Documentation
¶
Overview ¶
conn.go
fsm.go
peer.go
Index ¶
- Constants
- Variables
- type ActiveState
- type BGPFSMEvent
- type BaseState
- type BaseStateIface
- type ConnectState
- type EstablishedState
- type FSM
- func (fsm *FSM) AcceptPeerConn()
- func (fsm *FSM) ApplyAutomaticStart()
- func (fsm *FSM) ChangeState(newState BaseStateIface)
- func (fsm *FSM) ClearPeerConn()
- func (fsm *FSM) ConnBroken()
- func (fsm *FSM) ConnEstablished()
- func (fsm *FSM) GetIdleHoldTime() uint16
- func (fsm *FSM) HandleAnotherConnection(data interface{})
- func (fsm *FSM) IncrConnectRetryCounter()
- func (fsm *FSM) Init(state BaseStateIface)
- func (fsm *FSM) InitiateConnToPeer()
- func (fsm *FSM) ProcessEvent(event BGPFSMEvent, data interface{})
- func (fsm *FSM) ProcessOpenMessage(pkt *packet.BGPMessage) bool
- func (fsm *FSM) ProcessPacket(msg *packet.BGPMessage, msgErr *packet.BGPMessageError)
- func (fsm *FSM) ProcessUpdateMessage(pkt *packet.BGPMessage)
- func (fsm *FSM) RejectPeerConn()
- func (fsm *FSM) SendNotificationMessage(code uint8, subCode uint8, data []byte)
- func (fsm *FSM) SetConnectRetryCounter(value int)
- func (fsm *FSM) SetHoldTime(holdTime uint32, keepaliveTime uint32)
- func (fsm *FSM) SetIdleHoldTime(seconds uint16)
- func (fsm *FSM) SetPassiveTcpEstablishment(flag bool)
- func (fsm *FSM) SetPeerConn(data interface{})
- func (fsm *FSM) StartConnectRetryTimer()
- func (fsm *FSM) StartFSM()
- func (fsm *FSM) StartHoldTimer()
- func (fsm *FSM) StartIdleHoldTimer()
- func (fsm *FSM) StartKeepAliveTimer()
- func (fsm *FSM) StartRestartTimer()
- func (fsm *FSM) StopConnToPeer()
- func (fsm *FSM) StopConnectRetryTimer()
- func (fsm *FSM) StopHoldTimer()
- func (fsm *FSM) StopIdleHoldTimer()
- func (fsm *FSM) StopKeepAliveTimer()
- func (fsm *FSM) StopRestartTimer()
- type FSMIface
- type FSMManager
- type IdleState
- type OpenConfirmState
- type OpenSentState
- type OutTCPConn
- type PeerAttrs
- type PeerConn
- type PeerConnDir
- type PeerConnErr
- type PeerFSMCommand
- type PeerFSMConn
- type PeerFSMConnState
- type PeerFSMEvent
- type PeerFSMState
Constants ¶
View Source
const ( BGPCmdReasonNone int = iota BGPCmdReasonMaxPrefixExceeded )
View Source
const BGPIdleHoldTimeDefault uint16 = 5 // 240 seconds
View Source
const BGPRestartTimeDefault uint32 = 1 // 240 seconds
Variables ¶
View Source
var BGPEventTypeToStr = map[BGPFSMEvent]string{ BGPEventManualStart: "ManualStart", BGPEventManualStop: "ManualStop", BGPEventAutoStart: "AutoStart", BGPEventManualStartPassTcpEst: "ManualStartPassTcpEst", BGPEventAutoStartPassTcpEst: "AutoStartPassTcpEst", BGPEventAutoStartDampPeerOscl: "AutoStartDampPeerOscl", BGPEventAutoStartDampPeerOsclPassTcpEst: "AutoStartDampPeerOsclPassTcpEst", BGPEventAutoStop: "AutoStop", BGPEventConnRetryTimerExp: "ConnRetryTimerExp", BGPEventHoldTimerExp: "HoldTimerExp", BGPEventKeepAliveTimerExp: "KeepAliveTimerExp", BGPEventDelayOpenTimerExp: "DelayOpenTimerExp", BGPEventIdleHoldTimerExp: "IdleHoldTimerExp", BGPEventTcpConnValid: "TcpConnValid", BGPEventTcpCrInvalid: "TcpCrInvalid", BGPEventTcpCrAcked: "TcpCrAcked", BGPEventTcpConnConfirmed: "TcpConnConfirmed", BGPEventTcpConnFails: "TcpConnFails", BGPEventBGPOpen: "BGPOpen", BGPEventBGPOpenDelayOpenTimer: "BGPOpenDelayOpenTimer", BGPEventHeaderErr: "HeaderErr", BGPEventOpenMsgErr: "OpenMsgErr", BGPEventOpenCollisionDump: "OpenCollisionDump", BGPEventNotifMsgVerErr: "NotifMsgVerErr", BGPEventNotifMsg: "NotifMsg", BGPEventKeepAliveMsg: "KeepAliveMsg", BGPEventUpdateMsg: "UpdateMsg", BGPEventUpdateMsgErr: "UpdateMsgErr", }
View Source
var IdleHoldTimeInterval = map[uint16]uint16{
0: 0,
5: 10,
10: 30,
60: 120,
120: 180,
180: 300,
300: 500,
500: 0,
}
Functions ¶
This section is empty.
Types ¶
type ActiveState ¶
type ActiveState struct {
BaseState
}
func NewActiveState ¶
func NewActiveState(fsm *FSM) *ActiveState
func (*ActiveState) String ¶
func (st *ActiveState) String() string
type BGPFSMEvent ¶
type BGPFSMEvent int
const ( BGPEventManualStart BGPFSMEvent BGPEventManualStop BGPEventAutoStart BGPEventManualStartPassTcpEst BGPEventAutoStartPassTcpEst BGPEventAutoStartDampPeerOscl BGPEventAutoStartDampPeerOsclPassTcpEst BGPEventAutoStop BGPEventConnRetryTimerExp BGPEventHoldTimerExp BGPEventKeepAliveTimerExp BGPEventDelayOpenTimerExp BGPEventIdleHoldTimerExp BGPEventTcpConnValid BGPEventTcpCrInvalid BGPEventTcpCrAcked BGPEventTcpConnConfirmed BGPEventTcpConnFails BGPEventBGPOpen BGPEventBGPOpenDelayOpenTimer BGPEventHeaderErr BGPEventOpenMsgErr BGPEventOpenCollisionDump BGPEventNotifMsgVerErr BGPEventNotifMsg BGPEventKeepAliveMsg BGPEventUpdateMsg BGPEventUpdateMsgErr )
type BaseState ¶
type BaseState struct {
// contains filtered or unexported fields
}
func NewBaseState ¶
type BaseStateIface ¶
type BaseStateIface interface { String() string // contains filtered or unexported methods }
type ConnectState ¶
type ConnectState struct {
BaseState
}
func NewConnectState ¶
func NewConnectState(fsm *FSM) *ConnectState
func (*ConnectState) String ¶
func (st *ConnectState) String() string
type EstablishedState ¶
type EstablishedState struct {
BaseState
}
func NewEstablishedState ¶
func NewEstablishedState(fsm *FSM) *EstablishedState
func (*EstablishedState) String ¶
func (st *EstablishedState) String() string
type FSM ¶
type FSM struct { Manager *FSMManager State BaseStateIface // contains filtered or unexported fields }
func NewFSM ¶
func NewFSM(fsmManager *FSMManager, id uint8, neighborConf *base.NeighborConf) *FSM
func (*FSM) AcceptPeerConn ¶
func (fsm *FSM) AcceptPeerConn()
func (*FSM) ApplyAutomaticStart ¶
func (fsm *FSM) ApplyAutomaticStart()
func (*FSM) ChangeState ¶
func (fsm *FSM) ChangeState(newState BaseStateIface)
func (*FSM) ClearPeerConn ¶
func (fsm *FSM) ClearPeerConn()
func (*FSM) ConnBroken ¶
func (fsm *FSM) ConnBroken()
func (*FSM) ConnEstablished ¶
func (fsm *FSM) ConnEstablished()
func (*FSM) GetIdleHoldTime ¶
func (*FSM) HandleAnotherConnection ¶
func (fsm *FSM) HandleAnotherConnection(data interface{})
func (*FSM) IncrConnectRetryCounter ¶
func (fsm *FSM) IncrConnectRetryCounter()
func (*FSM) Init ¶
func (fsm *FSM) Init(state BaseStateIface)
func (*FSM) InitiateConnToPeer ¶
func (fsm *FSM) InitiateConnToPeer()
func (*FSM) ProcessEvent ¶
func (fsm *FSM) ProcessEvent(event BGPFSMEvent, data interface{})
func (*FSM) ProcessOpenMessage ¶
func (fsm *FSM) ProcessOpenMessage(pkt *packet.BGPMessage) bool
func (*FSM) ProcessPacket ¶
func (fsm *FSM) ProcessPacket(msg *packet.BGPMessage, msgErr *packet.BGPMessageError)
func (*FSM) ProcessUpdateMessage ¶
func (fsm *FSM) ProcessUpdateMessage(pkt *packet.BGPMessage)
func (*FSM) RejectPeerConn ¶
func (fsm *FSM) RejectPeerConn()
func (*FSM) SendNotificationMessage ¶
func (*FSM) SetConnectRetryCounter ¶
func (*FSM) SetHoldTime ¶
func (*FSM) SetIdleHoldTime ¶
func (*FSM) SetPassiveTcpEstablishment ¶
func (*FSM) SetPeerConn ¶
func (fsm *FSM) SetPeerConn(data interface{})
func (*FSM) StartConnectRetryTimer ¶
func (fsm *FSM) StartConnectRetryTimer()
func (*FSM) StartHoldTimer ¶
func (fsm *FSM) StartHoldTimer()
func (*FSM) StartIdleHoldTimer ¶
func (fsm *FSM) StartIdleHoldTimer()
func (*FSM) StartKeepAliveTimer ¶
func (fsm *FSM) StartKeepAliveTimer()
func (*FSM) StartRestartTimer ¶
func (fsm *FSM) StartRestartTimer()
func (*FSM) StopConnToPeer ¶
func (fsm *FSM) StopConnToPeer()
func (*FSM) StopConnectRetryTimer ¶
func (fsm *FSM) StopConnectRetryTimer()
func (*FSM) StopHoldTimer ¶
func (fsm *FSM) StopHoldTimer()
func (*FSM) StopIdleHoldTimer ¶
func (fsm *FSM) StopIdleHoldTimer()
func (*FSM) StopKeepAliveTimer ¶
func (fsm *FSM) StopKeepAliveTimer()
func (*FSM) StopRestartTimer ¶
func (fsm *FSM) StopRestartTimer()
type FSMIface ¶
type FSMIface interface { StartFSM(state BaseStateIface) ProcessEvent(event BGPFSMEvent) ChangeState(state BaseStateIface) }
type FSMManager ¶
type FSMManager struct { AcceptCh chan net.Conn CloseCh chan bool StopFSMCh chan string CommandCh chan PeerFSMCommand BfdStatusCh chan bool // contains filtered or unexported fields }
func NewFSMManager ¶
func NewFSMManager(logger *logging.Writer, neighborConf *base.NeighborConf, bgpPktSrcCh chan *packet.BGPPktSrc, fsmConnCh chan PeerFSMConn, reachabilityCh chan config.ReachabilityInfo) *FSMManager
func (*FSMManager) AcceptPeerConn ¶
func (mgr *FSMManager) AcceptPeerConn()
func (*FSMManager) Cleanup ¶
func (mgr *FSMManager) Cleanup()
func (*FSMManager) Init ¶
func (mgr *FSMManager) Init()
func (*FSMManager) RejectPeerConn ¶
func (mgr *FSMManager) RejectPeerConn()
func (*FSMManager) SendUpdateMsg ¶
func (mgr *FSMManager) SendUpdateMsg(bgpMsg *packet.BGPMessage)
func (*FSMManager) StopFSM ¶
func (mgr *FSMManager) StopFSM(stopMsg string)
type IdleState ¶
type IdleState struct { BaseState // contains filtered or unexported fields }
func NewIdleState ¶
type OpenConfirmState ¶
type OpenConfirmState struct {
BaseState
}
func NewOpenConfirmState ¶
func NewOpenConfirmState(fsm *FSM) *OpenConfirmState
func (*OpenConfirmState) String ¶
func (st *OpenConfirmState) String() string
type OpenSentState ¶
type OpenSentState struct {
BaseState
}
func NewOpenSentState ¶
func NewOpenSentState(fsm *FSM) *OpenSentState
func (*OpenSentState) String ¶
func (st *OpenSentState) String() string
type OutTCPConn ¶
type OutTCPConn struct { StopConnCh chan bool // contains filtered or unexported fields }
func NewOutTCPConn ¶
func NewOutTCPConn(fsm *FSM, fsmConnCh chan net.Conn, fsmConnErrCh chan PeerConnErr) *OutTCPConn
func (*OutTCPConn) ConnectToPeer ¶
func (o *OutTCPConn) ConnectToPeer(seconds uint32, remote, local string)
type PeerConn ¶
type PeerConn struct {
// contains filtered or unexported fields
}
func NewPeerConn ¶
func (*PeerConn) DecodeMessage ¶
func (p *PeerConn) DecodeMessage(header *packet.BGPHeader, buf []byte) (*packet.BGPMessage, *packet.BGPMessageError, bool)
func (*PeerConn) StartReading ¶
func (p *PeerConn) StartReading()
func (*PeerConn) StopReading ¶
type PeerConnDir ¶
type PeerConnDir struct {
// contains filtered or unexported fields
}
type PeerConnErr ¶
type PeerConnErr struct {
// contains filtered or unexported fields
}
type PeerFSMCommand ¶
type PeerFSMConnState ¶
type PeerFSMConnState struct {
// contains filtered or unexported fields
}
type PeerFSMEvent ¶
type PeerFSMEvent struct {
// contains filtered or unexported fields
}
type PeerFSMState ¶
type PeerFSMState struct { PeerIP string State config.BGPFSMState }
Click to show internal directories.
Click to hide internal directories.