5 #ifndef SRC_BGP_BGP_PEER_H__
6 #define SRC_BGP_BGP_PEER_H__
8 #include <boost/asio/ip/tcp.hpp>
9 #include <boost/scoped_ptr.hpp>
10 #include <tbb/spin_mutex.h>
36 class BgpPeerInfoData;
40 class BgpNeighborResp;
105 virtual bool SendUpdate(
const uint8_t *msg,
size_t msgsize,
106 const std::string *msg_str);
107 virtual bool SendUpdate(
const uint8_t *msg,
size_t msgsize) {
135 const std::string &data = std::string());
173 uint32_t ribout_cid = 0)
const;
231 void Close(
bool graceful);
232 void Clear(
int subcode);
237 const BgpPath *old_path, uint32_t path_flags)
const;
346 const std::vector<BgpProto::OpenMessage::Capability *> &
394 std::string error_message);
403 std::string error_message);
409 std::string error_message);
423 template <
typename TableT,
typename PrefixT>
445 RouteTargetList::const_iterator it);
449 RouteTargetList::const_iterator it);
551 #endif // SRC_BGP_BGP_PEER_H__
OriginOverride origin_override_
virtual bool IsInGRTimerWaitState() const
void inc_tx_notification()
bool FlushUpdateUnlocked()
virtual bool ProcessSession() const
std::vector< std::string > negotiated_families_
void PrefixLimitIdleTimerErrorHandler(std::string error_name, std::string error_message)
virtual void ResetAs4Supported()
void AddRTargets(as_t as)
boost::asio::ip::tcp::endpoint Endpoint
size_t GetBufferCapacity() const
virtual bool ReceiveMsg(BgpSession *session, const u_int8_t *msg, size_t size)
uint64_t flap_count() const
size_t buffer_size() const
void FillBgpNeighborFamilyAttributes(BgpNeighborResp *nbr) const
tbb::atomic< int > primary_path_count_
bool KeepaliveTimerExpired()
PeerCloseManager * close_manager()
uint64_t get_open_error() const
bool ProcessAuthKeyChainConfig(const BgpNeighborConfig *config)
bool AcceptSession(BgpSession *session)
BgpAttrPtr GetMpNlriNexthop(BgpMpNlri *nlri, BgpAttrPtr attr)
uint32_t GetLocalPrefFromMed(uint32_t med) const
void StopKeepaliveTimerUnlocked()
std::string peer_basename_
std::vector< std::string > configured_families_
void UnregisterAllTables()
virtual uint32_t local_bgp_identifier() const
void StopPrefixLimitIdleTimer()
boost::scoped_ptr< DeleteActor > deleter_
friend class BgpConfigTest
boost::scoped_ptr< StateMachine > state_machine_
OriginOverride(const BgpNeighborConfig::OriginOverrideConfig &config)
std::vector< BgpPeerFamilyAttributes * > FamilyAttributesList
static const size_t kMinBufferCapacity
void inc_rx_notification()
virtual const std::vector< std::string > GetDefaultTunnelEncap(const Address::Family family) const
void EndOfRibTimerErrorHandler(std::string error_name, std::string error_message)
#define KEY_COMPARE(x, y)
uint64_t get_rx_route_reach() const
uint16_t peer_port() const
boost::asio::ip::address IpAddress
void BGPPeerInfoSend(const BgpPeerInfoData &peer_info) const
bool LookupFamily(Address::Family family)
virtual int GetPrimaryPathCount() const
boost::scoped_ptr< BgpPeerClose > peer_close_
virtual void UpdateTotalPathCount(int count) const
RibExportPolicy BuildRibExportPolicy(Address::Family family) const
void SetListenSocketAuthKey(const AuthenticationKey &auth_key, KeyType key_type)
std::map< Address::Family, const uint8_t * > FamilyToCapabilityMap
uint64_t get_rx_update() const
void inc_connect_timer_expired()
uint64_t get_socket_reads() const
BgpAttrOrigin::OriginType origin
virtual uint32_t bgp_identifier() const
virtual bool IsXmppPeer() const
virtual void UpdateCloseRouteStats(Address::Family family, const BgpPath *old_path, uint32_t path_flags) const
std::set< RouteTarget > RouteTargetList
bool IsRouterTypeBGPaaS() const
virtual bool CanUseMembershipManager() const
virtual IPeerClose * peer_close()
std::string GetInuseAuthKeyValue() const
uint16_t hold_time() const
virtual bool Is4ByteAsSupported() const
virtual void SetDataCollectionKey(BgpPeerInfo *peer_info) const
void ProcessEndpointConfig(const BgpNeighborConfig *config)
RoutingInstance * rtinstance_
virtual BgpProto::BgpPeerType PeerType() const
uint64_t get_tx_update() const
uint64_t total_flap_count() const
int GetTaskInstance() const
virtual bool send_ready() const
virtual time_t GetEorSendTimerElapsedTime() const
AuthenticationKey inuse_auth_key_
virtual bool MembershipPathCallback(DBTablePartBase *tpart, BgpRoute *route, BgpPath *path)
uint64_t get_rx_notification() const
boost::asio::ip::tcp::endpoint endpoint
virtual const std::string & ToString() const
bool KeepaliveTimerRunning()
const BgpNeighborConfig * config_
virtual void TriggerPrefixLimitCheck() const
static const int kEndOfRibSendRetryTime
IpAddress gateway_address
TaskTrigger prefix_limit_trigger_
void StartEndOfRibReceiveTimer(Address::Family family)
void SendOpen(TcpSession *session)
uint64_t get_tx_keepalive() const
void inc_rx_route_unreach(uint64_t count)
virtual void SetAdminState(bool down, int subcode=BgpProto::Notification::AdminShutdown)
void ConfigUpdate(const BgpNeighborConfig *config)
uint64_t get_rx_route_unreach() const
BgpPeer(BgpServer *server, RoutingInstance *instance, const BgpNeighborConfig *config)
virtual BgpServer * server()
void KeepaliveTimerErrorHandler(std::string error_name, std::string error_message)
bool IsCloseInProgress() const
StateMachine * state_machine()
bool EndOfRibReceiveTimerExpired(Address::Family family)
boost::intrusive_ptr< const BgpAttr > BgpAttrPtr
Timer * eor_send_timer_[Address::NUM_FAMILIES]
const BgpPeerKey & peer_key() const
const std::vector< std::string > & configured_families() const
void SetSessionSocketAuthKey(TcpSession *session)
bool IsCloseGraceful() const
void ProcessUpdate(const BgpProto::Update *msg, size_t msgsize=0)
static int Encode(const BgpMessage *msg, uint8_t *data, size_t size, EncodeOffsets *offsets=NULL, bool as4=false)
void inc_rx_route_reach(uint64_t count)
void RoutingInstanceCallback(const std::string &vrf_name, int op)
uint64_t get_rx_end_of_rib() const
void Register(BgpTable *table, const RibExportPolicy &policy)
BgpTable * GetRTargetTable()
void SendNotification(BgpSession *, int code, int subcode=0, const std::string &data=std::string())
const std::vector< std::string > & negotiated_families() const
RoutingInstance * GetRoutingInstance() const
void SetInuseAuthKeyInfo(const AuthenticationKey &key, KeyType type)
virtual bool FlushUpdate()
const std::string & peer_name() const
virtual time_t GetRTargetTableLastUpdatedTimeStamp() const
BgpSession * CreateSession()
bool SetCapabilities(const BgpProto::OpenMessage *msg)
virtual IPeerDebugStats * peer_stats()
virtual bool IsAs4Supported() const
std::string last_flap_at() const
KeyType inuse_authkey_type_
virtual bool IsRegistrationRequired() const
uint64_t get_tx_route_total() const
Timer * eor_receive_timer_[Address::NUM_FAMILIES]
void LogInstallAuthKeys(const std::string &socket_name, const std::string &oper, const AuthenticationKey &auth_key, KeyType key_type)
std::string BytesToHexString(const u_int8_t *msg, size_t size)
virtual void StartKeepaliveTimerUnlocked()
friend class BgpServerUnitTest
virtual const std::string GetStateName() const
void ResetInuseAuthKeyInfo()
RoutingInstance * GetRoutingInstance()
FamilyAttributesList family_attributes_list_
void set_session(BgpSession *session)
LifetimeRef< BgpPeer > instance_delete_ref_
virtual bool MpNlriAllowed(uint16_t afi, uint8_t safi)
AuthenticationData::KeyType KeyType
boost::scoped_ptr< PeerStats > peer_stats_
boost::scoped_ptr< PeerCloseManager > close_manager_
void SetSessionSocketOptionDscp(TcpSession *session)
uint64_t get_tx_route_unreach() const
bool PrefixLimitIdleTimerRunning() const
std::string gateway_address_string(Address::Family family) const
virtual uint32_t GetOutputQueueDepth(Address::Family family) const
tbb::spin_mutex spin_mutex_
uint32_t PeerAddress() const
void NotifyEstablished(bool established)
BgpAttrPtr GetRouteTargetRouteAttr() const
std::string router_type() const
virtual const std::string & ToUVEKey() const
virtual void SendEndOfRIB(Address::Family family)
bool PrefixLimitIdleTimerExpired()
Timer * prefix_limit_idle_timer_
const std::string & peer_basename() const
std::vector< std::string > default_tunnel_encap_list
virtual bool SendUpdate(const uint8_t *msg, size_t msgsize, const std::string *msg_str)
uint32_t GetEndOfRibReceiveTime(Address::Family family) const
void Close(bool graceful)
void FillNeighborInfo(const BgpSandeshContext *bsc, BgpNeighborResp *bnr, bool summary) const
const std::vector< BgpProto::OpenMessage::Capability * > & capabilities() const
StateMachine::State GetState() const
const std::string peer_address_string() const
void BGPaaSAddRTarget(as_t as, BgpTable *table, BgpAttrPtr attr, RouteTargetList::const_iterator it)
uint64_t get_hold_timer_expired() const
void RegisterToVpnTables()
uint64_t get_rx_route_total() const
uint64_t get_rx_keepalive() const
time_t eor_send_timer_start_time_
DISALLOW_COPY_AND_ASSIGN(BgpPeer)
virtual BgpServer * server() const
int operator()(const BgpPeerFamilyAttributes *lhs, const BgpPeerFamilyAttributes *rhs) const
bool peer_is_control_node_
std::vector< tbb::atomic< uint32_t > > family_primary_path_count_
void StartKeepaliveTimer()
bool GetBestAuthKey(AuthenticationKey *auth_key, KeyType *key_type) const
void ClearListenSocketAuthKey()
std::vector< uint8_t > buffer_
static const size_t kMaxBufferCapacity
virtual bool IsServerStartingUp() const
virtual void SendEndOfRIBActual(Address::Family family)
void inc_hold_timer_expired()
virtual int GetTotalPathCount() const
void StartPrefixLimitIdleTimer(uint32_t plim_idle_time_msecs)
uint64_t get_connect_error() const
virtual bool IsReady() const
static const std::vector< Address::Family > & supported_families()
void BGPaaSDeleteRTarget(as_t as, BgpTable *table, RouteTargetList::const_iterator it)
uint64_t get_connect_timer_expired() const
void FillCloseInfo(BgpNeighborResp *resp) const
void MembershipRequestCallback(BgpTable *table)
bool ProcessFamilyAttributesConfig(const BgpNeighborConfig *config)
void ProcessNlri(Address::Family family, DBRequest::DBOperation oper, const BgpMpNlri *nlri, BgpAttrPtr attr, uint32_t flags)
static const std::vector< Address::Family > supported_families_
std::set< Address::Family > AddressFamilyList
void ReceiveEndOfRIB(Address::Family family, size_t msgsize)
virtual void BindLocalEndpoint(BgpSession *session)
bool EndOfRibSendTimerExpired(Address::Family family)
TcpSession::Endpoint endpoint_
tbb::atomic< int > total_path_count_
static void FillBgpNeighborDebugState(BgpNeighborResp *bnr, const IPeerDebugStats *peer)
const string & private_as_action() const
RouteTargetList rtargets_
bool AttemptGRHelperMode(int code, int subcode) const
bool IsFamilyNegotiated(Address::Family family)
AuthenticationData auth_data_
uint64_t total_flap_count_
uint64_t get_tx_route_reach() const
BgpProto::BgpPeerType peer_type_
std::string transport_address_string() const
const BgpNeighborConfig * config() const
std::string bgp_identifier_string() const
std::vector< BgpProto::OpenMessage::Capability * > capabilities_
void DeleteRTargets(as_t as)
uint64_t last_flap() const
virtual bool notification() const
uint64_t get_socket_writes() const
virtual void ProcessPathTunnelEncapsulation(const BgpPath *path, BgpAttr *attr, ExtCommunityDB *extcomm_db, const BgpTable *table) const
tbb::atomic< int > membership_req_pending_
void ASNUpdateCallback(as_t old_asn, as_t old_local_asn)
void DSCPUpdateCallback(uint8_t dscp_value)
TcpSession::Endpoint endpoint() const
friend class StateMachineUnitTest
virtual bool CheckSplitHorizon(uint32_t cluster_id=0, uint32_t ribout_cid=0) const
virtual bool SendUpdate(const uint8_t *msg, size_t msgsize)
uint64_t get_tx_end_of_rib() const
uint64_t get_update_error() const
bool GetBestAuthKeyItem(AuthenticationKey *auth_key)
LifetimeActor * deleter()
string private_as_action_
uint32_t GetPathFlags(Address::Family family, const BgpAttr *attr) const
const StateMachine * state_machine() const
BgpPeerFamilyAttributes(const BgpNeighborConfig *config, const BgpFamilyAttributesConfig &family_config)
bool vpn_tables_registered_
void increment_flap_count()
int membership_req_pending() const
virtual void UpdatePrimaryPathCount(int count, Address::Family family) const
void SendKeepalive(bool from_timer)
static const int kRouteTargetEndOfRibTimeSecs
std::string local_bgp_identifier_string() const
bool operator!=(const OriginOverride &rhs) const