|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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;
383 void Print (std::ostream &os)
const;
holds a vector of ns3::NetDevice pointers
a unique identifier for an interface.
@ LSA_SPF_NOT_EXPLORED
New vertex not yet considered.
@ Unknown
Uninitialized Type.
bool IsEmpty(void) const
Check to see if the list of Global Routing Link Records present in the Global Routing Link State Adve...
Ipv4RoutingTableEntry * GetInjectedRoute(uint32_t i)
Return the injected route indexed by i.
void SetLinkData(Ipv4Address addr)
Set the Link Data field of the Global Routing Link Record.
SPFStatus m_status
This is a tristate flag used internally in the SPF computation to mark if an SPFVertex (a data struct...
Ipv4Address FindDesignatedRouterForLink(Ptr< NetDevice > ndLocal) const
Finds a designated router.
ListOfAttachedRouters_t m_attachedRouters
Each Network LSA contains a list of attached routers.
uint32_t AddLinkRecord(GlobalRoutingLinkRecord *lr)
Add a given Global Routing Link Record to the LSA.
bool BridgeHasAlreadyBeenVisited(Ptr< BridgeNetDevice > device) const
When recursively checking for devices on the link, check whether a given device has already been visi...
LinkType
Enumeration of the possible types of Global Routing Link Records.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::list< GlobalRoutingLinkRecord * > ListOfLinkRecords_t
A convenience typedef to avoid too much writers cramp.
uint16_t m_metric
The metric for a given link.
void SetLinkId(Ipv4Address addr)
Set the Link ID field of the Global Routing Link Record.
a Link State Advertisement (LSA) for a router, used in global routing.
SPFStatus GetStatus(void) const
Get the SPF status of the advertisement.
void ProcessBroadcastLink(Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
Process a generic broadcast link.
void ProcessBridgedBroadcastLink(Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
Process a bridged broadcast link.
void ClearLSAs(void)
Clear list of LSAs.
void ClearBridgesVisited(void) const
Clear the list of bridges visited on the link.
Ipv4 addresses are stored in host order in this class.
void Print(std::ostream &os) const
Print the contents of the Global Routing Link State Advertisement and any Global Routing Link Records...
@ TransitNetwork
Unused – for future OSPF compatibility
Ipv4Mask m_networkLSANetworkMask
Each Network LSA contains the network mask of the attached network.
Ipv4Address GetRouterId(void) const
Get the Router ID associated with this Global Router.
void SetLinkStateId(Ipv4Address addr)
Set the Link State ID is defined by the OSPF spec.
An interface aggregated to a node to provide global routing info.
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
Ptr< Node > GetNode(void) const
Get the Node pointer of the node that originated this LSA.
LSType GetLSType(void) const
Return the LSType field of the LSA.
uint32_t GetNLinkRecords(void) const
Return the number of Global Routing Link Records in the LSA.
void ProcessSingleBroadcastLink(Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
Process a single broadcast link.
Ptr< Ipv4GlobalRouting > GetRoutingProtocol(void)
Get the specific Global Routing Protocol used.
void SetStatus(SPFStatus status)
Set the SPF status of the advertisement.
virtual void DoDispose(void)
Destructor implementation.
LSType
corresponds to LS type field of RFC 2328 OSPF LSA header
Ipv4Address m_linkId
m_linkId and m_linkData are defined by OSPF to have different meanings depending on the type of link ...
A base class which provides memory management and object aggregation.
InjectedRoutes m_injectedRoutes
Routes we are exporting.
Ptr< Ipv4GlobalRouting > m_routingProtocol
the Ipv4GlobalRouting in use
bool GetLSA(uint32_t n, GlobalRoutingLSA &lsa) const
Get a Global Routing Link State Advertisements that this router has said that it can export.
LinkType GetLinkType(void) const
Get the Link Type field of the Global Routing Link Record.
Ipv4Address m_routerId
router ID (its IPv4 address)
GlobalRoutingLinkRecord()
Construct an empty ("uninitialized") Global Routing Link Record.
bool FindInterfaceForDevice(Ptr< Node > node, Ptr< NetDevice > nd, uint32_t &index) const
Given a node and a net device, find an IPV4 interface index that corresponds to that net device.
Ipv4Address m_linkStateId
The Link State ID is defined by the OSPF spec.
void ClearLinkRecords(void)
Release all of the Global Routing Link Records present in the Global Routing Link State Advertisement...
Ipv4Address GetAdvertisingRouter(void) const
Get the Advertising Router as defined by the OSPF spec.
void SetNetworkLSANetworkMask(Ipv4Mask mask)
For a Network LSA, set the Network Mask field that precedes the list of attached routers.
std::list< GlobalRoutingLSA * > ListOfLSAs_t
container for the GlobalRoutingLSAs
std::list< Ipv4RoutingTableEntry * >::iterator InjectedRoutesI
Iterator to container of Ipv4RoutingTableEntry.
std::list< Ipv4Address > ListOfAttachedRouters_t
A convenience typedef to avoid too much writers cramp.
void BuildNetworkLSAs(NetDeviceContainer c)
Build one NetworkLSA for each net device talking to a network that we are the designated router for.
GlobalRoutingLinkRecord * GetLinkRecord(uint32_t n) const
Return a pointer to the specified Global Routing Link Record.
Ipv4Mask GetNetworkLSANetworkMask(void) const
For a Network LSA, get the Network Mask field that precedes the list of attached routers.
@ StubNetwork
Record represents a leaf node network.
LinkType m_linkType
The type of the Global Routing Link Record.
uint32_t DiscoverLSAs(void)
Walk the connected channels, discover the adjacent routers and build the associated number of Global ...
GlobalRouter()
Create a Global Router class.
uint32_t GetNInjectedRoutes(void)
Get the number of injected routes that have been added to the routing table.
Ipv4Address GetLinkId(void) const
Get the Link ID field of the Global Routing Link Record.
Ipv4Address GetAttachedRouter(uint32_t n) const
Return an Ipv4Address corresponding to the specified attached router.
@ PointToPoint
Record representing a point to point channel.
std::vector< Ptr< BridgeNetDevice > > m_bridgesVisited
Container of bridges visited.
SPFStatus
Enumeration of the possible values of the status flag in the Routing Link State Advertisements.
Ipv4Address GetLinkData(void) const
Get the Link Data field of the Global Routing Link Record.
void ProcessPointToPointLink(Ptr< NetDevice > ndLocal, GlobalRoutingLSA *pLSA)
Process a point to point link.
ListOfLSAs_t m_LSAs
database of GlobalRoutingLSAs
void SetLSType(LSType typ)
Set the LS type field of the LSA.
@ LSA_SPF_IN_SPFTREE
Vertex is in the SPF tree.
~GlobalRoutingLinkRecord()
Destroy a Global Routing Link Record.
void SetNode(Ptr< Node > node)
Set the Node pointer of the node that originated this LSA.
GlobalRouter(GlobalRouter &sr)
Global Router copy construction is disallowed.
GlobalRoutingLSA & operator=(const GlobalRoutingLSA &lsa)
Assignment operator for a Global Routing Link State Advertisement.
ListOfLinkRecords_t m_linkRecords
Each Link State Advertisement contains a number of Link Records that describe the kinds of links that...
std::list< Ipv4RoutingTableEntry * >::const_iterator InjectedRoutesCI
Const Iterator to container of Ipv4RoutingTableEntry.
@ VirtualLink
Unused – for future OSPF compatibility
void CopyLinkRecords(const GlobalRoutingLSA &lsa)
Copy any Global Routing Link Records in a given Global Routing Link State Advertisement to the curren...
GlobalRoutingLSA()
Create a blank Global Routing Link State Advertisement.
@ LSA_SPF_CANDIDATE
Vertex is in the SPF candidate queue.
void InjectRoute(Ipv4Address network, Ipv4Mask networkMask)
Inject a route to be circulated to other routers as an external route.
a class to represent an Ipv4 address mask
void MarkBridgeAsVisited(Ptr< BridgeNetDevice > device) const
When recursively checking for devices on the link, mark a given device as having been visited.
uint32_t GetNAttachedRouters(void) const
Return the number of attached routers listed in the NetworkLSA.
A single link record for a link state advertisement.
void SetLinkType(LinkType linkType)
Set the Link Type field of the Global Routing Link Record.
uint16_t GetMetric(void) const
Get the Metric Data field of the Global Routing Link Record.
uint32_t m_node_id
node ID
LSType m_lsType
The type of the LSA.
@ Unknown
Uninitialized Link Record.
uint32_t GetNumLSAs(void) const
Get the Number of Global Routing Link State Advertisements that this router can export.
bool AnotherRouterOnLink(Ptr< NetDevice > nd) const
Checks for the presence of another router on the NetDevice.
~GlobalRoutingLSA()
Destroy an existing Global Routing Link State Advertisement.
void RemoveInjectedRoute(uint32_t i)
Withdraw a route from the global unicast routing table.
uint32_t AddAttachedRouter(Ipv4Address addr)
Add an attached router to the list in the NetworkLSA.
void SetMetric(uint16_t metric)
Set the Metric Data field of the Global Routing Link Record.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Ipv4Address GetLinkStateId(void) const
Get the Link State ID as defined by the OSPF spec.
Ptr< NetDevice > GetAdjacent(Ptr< NetDevice > nd, Ptr< Channel > ch) const
Link through the given channel and find the net device that's on the other end.
Ipv4Address m_linkData
m_linkId and m_linkData are defined by OSPF to have different meanings depending on the type of link ...
bool WithdrawRoute(Ipv4Address network, Ipv4Mask networkMask)
Withdraw a route from the global unicast routing table.
static TypeId GetTypeId(void)
Get the type ID.
NetDeviceContainer FindAllNonBridgedDevicesOnLink(Ptr< Channel > ch) const
Return a container of all non-bridged NetDevices on a link.
void SetAdvertisingRouter(Ipv4Address rtr)
Set the Advertising Router as defined by the OSPF spec.
void SetRoutingProtocol(Ptr< Ipv4GlobalRouting > routing)
Set the specific Global Routing Protocol to be used.
GlobalRouter & operator=(GlobalRouter &sr)
Global Router assignment operator is disallowed.
std::list< Ipv4RoutingTableEntry * > InjectedRoutes
container of Ipv4RoutingTableEntry
Ptr< BridgeNetDevice > NetDeviceIsBridged(Ptr< NetDevice > nd) const
Decide whether or not a given net device is being bridged by a BridgeNetDevice.
Ipv4Address m_advertisingRtr
The Advertising Router is defined by the OSPF spec.