BGPPeer Class Reference

Inheritance diagram for BGPPeer:

List of all members.

Public Member Functions

 BGPPeer (LocalData *ld, BGPPeerData *pd, SocketClient *sock, BGPMain *m)
uint32_t get_unique_id () const
 Get this peers unique ID.
void zero_stats ()
 Zero all the stats counters.
void clear_last_error ()
 Clear the last error.
BGPPeerDataswap_peerdata (BGPPeerData *pd)
 Replace the old peerdata with a new copy.
void connected (XorpFd s)
void remove_accept_attempt (AcceptSession *conn)
SocketClientswap_sockets (SocketClient *new_sock)
XorpFd get_sock ()
void event_start ()
 state machine handlers for the various BGP events
void event_stop (bool restart=false, bool automatic=false)
void event_open ()
void event_open (const XorpFd sock)
void event_closed ()
void event_openfail ()
void event_tranfatal ()
void event_connexp ()
void event_holdexp ()
void event_keepexp ()
void event_delay_open_exp ()
void event_idle_hold_exp ()
void event_openmess (const OpenPacket &p)
void event_keepmess ()
void event_recvupdate (UpdatePacket &p)
void event_recvnotify (const NotificationPacket &p)
void generate_open_message (OpenPacket &open)
void notify_peer_of_error (const int error, const int subcode=UNSPECIFIED, const uint8_t *data=0, const size_t len=0)
FSMState state ()
TimeVal jitter (const TimeVal &t)
 If jitter is globally enabled apply it to the time provided otherwise just return the input time.
void clear_all_timers ()
void start_connect_retry_timer ()
void clear_connect_retry_timer ()
void restart_connect_retry_timer ()
void start_keepalive_timer ()
void clear_keepalive_timer ()
void start_hold_timer ()
void clear_hold_timer ()
void restart_hold_timer ()
void start_stopped_timer ()
void clear_stopped_timer ()
void start_idle_hold_timer ()
void clear_idle_hold_timer ()
bool running_idle_hold_timer () const
void start_delay_open_timer ()
void clear_delay_open_timer ()
bool get_message (BGPPacket::Status status, const uint8_t *buf, size_t len, SocketClient *socket_client)
PeerOutputState send_message (const BGPPacket &p)
void send_message_complete (SocketClient::Event, const uint8_t *buf)
string str () const
bool is_connected () const
bool still_reading () const
LocalDatalocaldata ()
IPv4 id () const
BGPMainmain () const
const BGPPeerDatapeerdata () const
bool ibgp () const
bool use_4byte_asnums () const
bool we_use_4byte_asnums () const
bool send_netreachability (const BGPUpdateAttrib &n)
 send the netreachability message, return send result.
virtual PeerOutputState send_update_message (const UpdatePacket &p)
uint32_t get_established_transitions () const
uint32_t get_established_time () const
void get_msg_stats (uint32_t &in_updates, uint32_t &out_updates, uint32_t &in_msgs, uint32_t &out_msgs, uint16_t &last_error, uint32_t &in_update_elapsed) const

Static Public Member Functions

static const char * pretty_print_state (FSMState s)

Private Member Functions

void connect_to_peer (SocketClient::ConnectCallback cb)
void connect_to_peer_complete (bool success)
void send_notification (const NotificationPacket &p, bool restart=true, bool automatic=true)
void send_notification_complete (SocketClient::Event, const uint8_t *buf, bool restart, bool automatic)
void flush_transmit_queue ()
void stop_reader ()
void hook_stopped ()
void check_open_packet (const OpenPacket *p) throw (CorruptMessage)
NotificationPacketcheck_update_packet (const UpdatePacket *p, bool &good_nexthop)
bool established ()
 Called the first time that we go to the established state.
bool release_resources ()
void set_state (FSMState s, bool restart=true, bool automatic=true)
 move to the desired state, plus does some additional work to clean up existing state and possibly retrying to open/connect if restart = true
bool remote_ip_ge_than (const BGPPeer &peer)
void automatic_restart ()
 Called every time there is an automatic restart.
void set_current_peer_state (bool state)
bool get_current_peer_state ()
void set_next_peer_state (bool state)
bool get_next_peer_state ()
void set_activate_state (bool state)
bool get_activate_state ()

Private Attributes

const uint32_t _unique_id
bool _output_queue_was_busy
FSMState _state
list< AcceptSession * > _accept_attempt
string _peername
XorpTimer _timer_connect_retry
XorpTimer _timer_hold_time
XorpTimer _timer_keep_alive
XorpTimer _idle_hold
XorpTimer _delay_open
uint32_t _in_updates
uint32_t _out_updates
uint32_t _in_total_messages
uint32_t _out_total_messages
uint8_t _last_error [2]
uint32_t _established_transitions
TimeVal _established_time
TimeVal _in_update_time
XorpTimer _timer_stopped
 This timer is to break us out of the stopped state.
bool _damping_peer_oscillations
DampPeerOscillations _damp_peer_oscillations
bool _current_state
bool _next_state
bool _activated

Static Private Attributes

static uint32_t _unique_id_allocator = UNIQUE_ID_START
 For the processing in decision every peer requires a unique ID.


class BGPPeerList
class BGPMain

Member Function Documentation

void BGPPeer::automatic_restart ( ) [private]

Called every time there is an automatic restart.

Used for tracking peer damp oscillations.

bool BGPPeer::running_idle_hold_timer ( ) const
true if the idle hold timer is running.
void BGPPeer::set_state ( FSMState  s,
bool  restart = true,
bool  automatic = true 
) [private]

move to the desired state, plus does some additional work to clean up existing state and possibly retrying to open/connect if restart = true

restartif true and this is a transition to idle restart the connection.
automaticif the transition is to idle and automatic restart has been request. This is not a manual restart.
BGPPeerData* BGPPeer::swap_peerdata ( BGPPeerData pd) [inline]

Replace the old peerdata with a new copy.

It is the responsiblity of the caller to free the memory.

The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations