21 #include "ns3/application.h" 22 #include "ns3/ipv4-address.h" 23 #include "ns3/socket.h" 34 class Peer :
public SimpleRefCount<Peer> {
51 uint8_t ebgp_multihop;
59 class Session :
public SimpleRefCount<Session> {
65 Ptr<BgpNs3SocketOut> out_handler;
66 Ptr<BgpNs3SocketIn> in_handler;
77 class Bgp :
public Application {
80 static TypeId GetTypeId (
void);
82 void StartApplication(
void);
83 void StopApplication(
void);
85 void AddPeer(
const Peer &peer);
87 void AddRoute(uint32_t prefix, uint8_t mask, uint32_t nexthop);
88 void AddRoute(
const Ipv4Address &prefix,
const Ipv4Mask &mask,
const Ipv4Address &nexthop);
89 void SetLibbgpLogLevel(libbgp::LogLevel log_level);
90 void SetBgpId(Ipv4Address bgp_id);
91 void SetHoldTimer(Time hold_timer);
92 void SetClockInterval(Time interval);
97 bool ConnectPeer(Ptr<Peer> peer);
98 bool SessionInit(
bool local_init, Ptr<Socket> socket);
100 void HandleConnectIn(Ptr<Socket> socket,
const Address &src);
101 bool HandleConnectInRequest(Ptr<Socket> socket,
const Address &src);
102 void HandleConnectOut(Ptr<Socket> socket);
103 void HandleConnectOutFailed(Ptr<Socket> socket);
104 void HandleClose(Ptr<Socket> socket);
105 void HandleStateChange(Ptr<Socket> socket,
int old_state,
int new_state);
108 Time _clock_interval;
115 Ptr<BgpRouting> _routing;
116 Ptr<Socket> _listen_socket;
118 std::vector<Ptr<Peer>> _peers;
119 std::vector<Ptr<Session>> _sessions;
124 libbgp::LogLevel _log_level;
bool forced_default_nexthop
always use peering IP as nexthop.
Peer configuration class.
ns3 BGP module: routing protocol (Ipv4RoutingProtocol)
Ipv4Address peer_address
peer's address.
The libbgp log forwarder class.
ns3 smart pointer wrapper for libbgp BGP FSM.
libbgp Clock interface for ns3.
bool ibgp_alter_nexthop
alter IBGP nexthop attribute the same way as EBGP.
int32_t weight
weight of this peer
Simple container class for FSM to send data to peer.
libbgp::BgpFilterRules egress_rules
egress router filter rules. See libbgp documents.
int8_t allow_local_as
Allow N local ASN in AS_PATH.
The clock interface. See libbgp document.
bool passive
passive peering (don't send OPEN)
Simple container class for FSM to receive data from peer.
bool no_nexthop_check
disable nexthop attribute validation
Session information class.
libbgp::BgpFilterRules ingress_rules
ingress router filter rules. See libbgp documents.
uint32_t local_asn
local ASN.
uint32_t peer_asn
peer ASN.