libbgp
0.6
A C++ BGP Library.
|
#include <bgp-fsm.h>
Public Member Functions | |
BgpFsm (const BgpConfig &config) | |
uint32_t | getAsn () const |
Get local ASN. More... | |
uint32_t | getBgpId () const |
Get local BGP ID. More... | |
uint32_t | getPeerAsn () const |
Get peer ASN. More... | |
uint32_t | getPeerBgpId () const |
Get peer BGP ID. More... | |
uint16_t | getHoldTimer () const |
Get the negotiated hold timer. More... | |
BgpRib4 & | getRib4 () const |
Get the IPv4 Routing Information Base. More... | |
BgpRib6 & | getRib6 () const |
Get the IPv6 Routing Information Base. More... | |
BgpState | getState () const |
Get current FSM state. More... | |
int | start () |
send OPEN message to peer. (IDLE -> OpenSent) More... | |
int | stop () |
Stop the FSM. (Any -> Idle) More... | |
int | run (const uint8_t *buffer, const size_t buffer_size) |
Run the FSM on buffer. More... | |
int | tick () |
Tick the clock (Check for time-based events) More... | |
int | resetSoft () |
Perform a soft reset. More... | |
void | resetHard () |
Perform a hard reset. More... | |
Additional Inherited Members |
The BgpFsm class.
uint32_t libbgp::BgpFsm::getAsn | ( | ) | const |
uint32_t libbgp::BgpFsm::getBgpId | ( | ) | const |
Get local BGP ID.
Definition at line 90 of file bgp-fsm.cc.
uint16_t libbgp::BgpFsm::getHoldTimer | ( | ) | const |
Get the negotiated hold timer.
0 | Hold timer was not negotiated yet. |
>0 | negotiated hold timer. |
Definition at line 102 of file bgp-fsm.cc.
uint32_t libbgp::BgpFsm::getPeerAsn | ( | ) | const |
Get peer ASN.
0 | Peer ASN unknow at this time. |
>=0 | Peer ASN. |
Definition at line 94 of file bgp-fsm.cc.
uint32_t libbgp::BgpFsm::getPeerBgpId | ( | ) | const |
Get peer BGP ID.
0 | Peer BGP ID unknow at this time. |
>=0 | Peer BGP ID. |
Definition at line 98 of file bgp-fsm.cc.
BgpRib4 & libbgp::BgpFsm::getRib4 | ( | ) | const |
Get the IPv4 Routing Information Base.
Definition at line 106 of file bgp-fsm.cc.
BgpRib6 & libbgp::BgpFsm::getRib6 | ( | ) | const |
Get the IPv6 Routing Information Base.
Definition at line 110 of file bgp-fsm.cc.
BgpState libbgp::BgpFsm::getState | ( | ) | const |
void libbgp::BgpFsm::resetHard | ( | ) |
Perform a hard reset.
Set FSM state to IDLE and clear the packet buffer.
Definition at line 320 of file bgp-fsm.cc.
int libbgp::BgpFsm::resetSoft | ( | ) |
Perform a soft reset.
An Administrative Reset Notification will be sent to peer and FSM will go IDLE. This will also clear the BGP packet buffer.
-1 | Fatal Error. FSM is now in BROKEN state. error may be written to stderr with log handler. |
0 | Success. Notification sent. FSM is now IDLE. |
Definition at line 313 of file bgp-fsm.cc.
int libbgp::BgpFsm::run | ( | const uint8_t * | buffer, |
const size_t | buffer_size | ||
) |
Run the FSM on buffer.
buffer | Pointer to buffer. |
buffer_size | Size of buffer. |
-1 | Fatal error occured. FSM is now in BROKEN state and needs to be reset. error may be written to stderr with log handler. |
0 | Protocol error occurred on the other side. Notification message was sent to peer and FSM is now IDLE state. error may be written to stderr with log handler. |
1 | Success. |
2 | Protocol error occurred on the local side. Got Notification message from peer and FSM is now IDLE state. error may be written to stderr with log handler. |
3 | The packet passed in was incomplete. FSM will wait for more data. |
Definition at line 179 of file bgp-fsm.cc.
int libbgp::BgpFsm::start | ( | ) |
send OPEN message to peer. (IDLE -> OpenSent)
0 | Failed to start. error may be written to stderr with log handler. |
1 | open message sent. |
Definition at line 118 of file bgp-fsm.cc.
int libbgp::BgpFsm::stop | ( | ) |
Stop the FSM. (Any -> Idle)
0 | Failed to stop. error may be written to stderr with log handler. |
Definition at line 157 of file bgp-fsm.cc.
int libbgp::BgpFsm::tick | ( | ) |
Tick the clock (Check for time-based events)
tick() should be called regularly to check for time-based events like hold timer checks and keepalive message sending. BGP FSM will tick itself when run() is called but you should call tink() regularly to ensure the hold timer on the other side won't expire.
0 | Hold timer expired. Notification message was sent to the peer. FSM is now in IDLE state. error may be written to stderr with log handler. |
1 | Success. |
2 | Success, KEEPALIVE message sent to peer. |
Definition at line 290 of file bgp-fsm.cc.