ns3-bgp  0.2
BGP module for ns-3.
bgp-routing.h
Go to the documentation of this file.
1 
11 #ifndef BGP_ROUTING_H
12 #define BGP_ROUTING_H
13 
14 #include <libbgp/bgp-rib4.h>
15 #include "ns3/ipv4-routing-protocol.h"
16 
17 namespace ns3 {
18 
23 class BgpRouting : public Ipv4RoutingProtocol {
24 public:
25  BgpRouting();
26 
27  static TypeId GetTypeId (void);
28 
29  Ptr<Ipv4Route> RouteOutput (Ptr<Packet> p, const Ipv4Header &header, Ptr<NetDevice> oif,
30  Socket::SocketErrno &sockerr);
31 
32  bool RouteInput (Ptr<const Packet> p, const Ipv4Header &header, Ptr<const NetDevice> idev,
33  UnicastForwardCallback ucb, MulticastForwardCallback mcb,
34  LocalDeliverCallback lcb, ErrorCallback ecb);
35 
36  void NotifyInterfaceUp (uint32_t interface);
37  void NotifyInterfaceDown (uint32_t interface);
38  void NotifyAddAddress (uint32_t interface, Ipv4InterfaceAddress address);
39  void NotifyRemoveAddress (uint32_t interface, Ipv4InterfaceAddress address);
40  void PrintRoutingTable (Ptr<OutputStreamWrapper> stream, Time::Unit unit = Time::S) const;
41 
42  void SetIpv4 (Ptr<Ipv4> ipv4);
43  void SetRib(const libbgp::BgpRib4 *rib);
44 
45  Ptr<NetDevice> GetDeviceByNexthop(const Ipv4Address &nexthop) const;
46  Ipv4InterfaceAddress GetAddressByNexthop(const Ipv4Address &nexthop) const;
47 
48 private:
49  const libbgp::BgpRib4 *_rib;
50  Ptr<Ipv4> _ipv4;
51 };
52 
53 }
54 
55 #endif // BGP_ROUTING_H
Ipv4InterfaceAddress GetAddressByNexthop(const Ipv4Address &nexthop) const
Look for the interface address that can reach a given nexthop.
Definition: bgp-routing.cc:164
Definition: bgp-log.cc:15
void SetRib(const libbgp::BgpRib4 *rib)
Set the libbgp Routing Information Base to use.
Definition: bgp-routing.cc:186
Ptr< NetDevice > GetDeviceByNexthop(const Ipv4Address &nexthop) const
Look for device to output/forward packet by nexthop.
Definition: bgp-routing.cc:136
The Ipv4RoutingProtocol for Bgp module.
Definition: bgp-routing.h:23