22 #ifndef GLOBAL_ROUTER_INTERFACE_H
23 #define GLOBAL_ROUTER_INTERFACE_H
27 #include "ns3/object.h"
30 #include "ns3/channel.h"
31 #include "ns3/ipv4-address.h"
32 #include "ns3/net-device-container.h"
33 #include "ns3/bridge-net-device.h"
34 #include "ns3/global-route-manager.h"
35 #include "ns3/ipv4-routing-table-entry.h"
40 class Ipv4GlobalRouting;
380 void Print (std::ostream &os)
const;
712 void ClearLSAs (
void);
717 bool AnotherRouterOnLink (
Ptr<NetDevice> nd,
bool allowRecursion)
const;
727 typedef std::list<GlobalRoutingLSA*> ListOfLSAs_t;
733 typedef std::list<Ipv4RoutingTableEntry *> InjectedRoutes;
734 typedef std::list<Ipv4RoutingTableEntry *>::const_iterator InjectedRoutesCI;
735 typedef std::list<Ipv4RoutingTableEntry *>::iterator InjectedRoutesI;
736 InjectedRoutes m_injectedRoutes;
Ipv4Address GetLinkId(void) const
LSType GetLSType(void) const
Return the LSType field of the LSA.
GlobalRoutingLinkRecord * GetLinkRecord(uint32_t n) const
Return a pointer to the specified Global Routing Link Record.
virtual void DoDispose(void)
~GlobalRoutingLSA()
Destroy an existing Global Routing Link State Advertisement.
void SetMetric(uint16_t metric)
Set the Metric Data field of the Global Routing Link Record.
Ipv4Address m_advertisingRtr
Ipv4RoutingTableEntry * GetInjectedRoute(uint32_t i)
Return the injected route indexed by i.
a class to represent an Ipv4 address mask
static TypeId GetTypeId(void)
The Interface ID of the Global Router interface.
bool WithdrawRoute(Ipv4Address network, Ipv4Mask networkMask)
Withdraw a route from the global unicast routing table.
uint32_t DiscoverLSAs(void)
Walk the connected channels, discover the adjacent routers and build the associated number of Global ...
void SetAdvertisingRouter(Ipv4Address rtr)
Set the Advertising Router as defined by the OSPF spec. We always set it to the router ID of the rout...
uint32_t AddLinkRecord(GlobalRoutingLinkRecord *lr)
Add a given Global Routing Link Record to the LSA.
GlobalRouter & operator=(GlobalRouter &sr)
Global Router assignment operator is disallowed.
Ipv4Mask m_networkLSANetworkMask
bool GetLSA(uint32_t n, GlobalRoutingLSA &lsa) const
Get a Global Routing Link State Advertisements that this router has said that it can export...
void SetLinkId(Ipv4Address addr)
Set the Link ID field of the Global Routing Link Record.
uint32_t GetNInjectedRoutes(void)
Get the number of injected routes that have been added to the routing table.
uint32_t AddAttachedRouter(Ipv4Address addr)
Add an attached router to the list in the NetworkLSA.
Ipv4Mask GetNetworkLSANetworkMask(void) const
For a Network LSA, get the Network Mask field that precedes the list of attached routers.
void SetLinkData(Ipv4Address addr)
Set the Link Data field of the Global Routing Link Record.
void SetNode(Ptr< Node > node)
Set the Node pointer of the node that originated this LSA.
Ipv4Address GetAdvertisingRouter(void) const
Get the Advertising Router as defined by the OSPF spec. We always set it to the router ID of the rout...
void ClearLinkRecords(void)
Release all of the Global Routing Link Records present in the Global Routing Link State Advertisement...
LSType
corresponds to LS type field of RFC 2328 OSPF LSA header
A single link record for a link state advertisement.
a Link State Advertisement (LSA) for a router, used in global routing.
void InjectRoute(Ipv4Address network, Ipv4Mask networkMask)
Inject a route to be circulated to other routers as an external route.
holds a vector of ns3::NetDevice pointers
LinkType
Enumeration of the possible types of Global Routing Link Records.
void SetLSType(LSType typ)
Set the LS type field of the LSA.
void Print(std::ostream &os) const
Print the contents of the Global Routing Link State Advertisement and any Global Routing Link Records...
std::list< Ipv4Address > ListOfAttachedRouters_t
void RemoveInjectedRoute(uint32_t i)
Withdraw a route from the global unicast routing table.
SPFStatus GetStatus(void) const
Get the SPF status of the advertisement.
std::ostream & operator<<(std::ostream &os, const Angles &a)
void SetStatus(SPFStatus status)
Set the SPF status of the advertisement.
uint32_t GetNAttachedRouters(void) const
Return the number of attached routers listed in the NetworkLSA.
uint32_t GetNLinkRecords(void) const
Return the number of Global Routing Link Records in the LSA.
void SetLinkType(LinkType linkType)
Set the Link Type field of the Global Routing Link Record.
~GlobalRoutingLinkRecord()
Destroy a Global Routing Link Record.
GlobalRoutingLinkRecord()
Construct an empty ("uninitialized") Global Routing Link Record.
An interface aggregated to a node to provide global routing info.
Ipv4Address GetLinkData(void) const
Get the Link Data field of the Global Routing Link Record.
Ipv4Address m_linkStateId
Ipv4 addresses are stored in host order in this class.
void CopyLinkRecords(const GlobalRoutingLSA &lsa)
Copy any Global Routing Link Records in a given Global Routing Link State Advertisement to the curren...
GlobalRoutingLSA & operator=(const GlobalRoutingLSA &lsa)
Assignment operator for a Global Routing Link State Advertisement.
void SetNetworkLSANetworkMask(Ipv4Mask mask)
For a Network LSA, set the Network Mask field that precedes the list of attached routers.
SPFStatus
Enumeration of the possible values of the status flag in the Routing Link State Advertisements.
uint32_t GetNumLSAs(void) const
Get the Number of Global Routing Link State Advertisements that this router can export.
GlobalRouter()
Create a Global Router class.
Ipv4Address GetRouterId(void) const
Get the Router ID associated with this Global Router.
Ipv4Address GetAttachedRouter(uint32_t n) const
Return an Ipv4Address corresponding to the specified attached router.
Ptr< Node > GetNode(void) const
Get the Node pointer of the node that originated this LSA.
ListOfAttachedRouters_t m_attachedRouters
LinkType GetLinkType(void) const
Get the Link Type field of the Global Routing Link Record.
bool IsEmpty(void) const
Check to see if the list of Global Routing Link Records present in the Global Routing Link State Adve...
a base class which provides memory management and object aggregation
std::list< GlobalRoutingLinkRecord * > ListOfLinkRecords_t
GlobalRoutingLSA()
Create a blank Global Routing Link State Advertisement.
ListOfLinkRecords_t m_linkRecords
a unique identifier for an interface.
void SetLinkStateId(Ipv4Address addr)
Set the Link State ID is defined by the OSPF spec. We always set it to the router ID of the router ma...
uint16_t GetMetric(void) const
Get the Metric Data field of the Global Routing Link Record.
Ipv4Address GetLinkStateId(void) const
Get the Link State ID as defined by the OSPF spec. We always set it to the router ID of the router ma...