An interface aggregated to a node to provide global routing info. More...
#include <global-router-interface.h>
Public Member Functions | |
GlobalRouter () | |
Create a Global Router class. | |
Ipv4Address | GetRouterId (void) const |
Get the Router ID associated with this Global Router. | |
uint32_t | DiscoverLSAs (void) |
Walk the connected channels, discover the adjacent routers and build the associated number of Global Routing Link State Advertisements that this router can export. | |
uint32_t | GetNumLSAs (void) const |
Get the Number of Global Routing Link State Advertisements that this router can export. | |
bool | GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const |
Get a Global Routing Link State Advertisements that this router has said that it can export. | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
The Interface ID of the Global Router interface. | |
Private Types | |
typedef std::list < GlobalRoutingLSA * > | ListOfLSAs_t |
Private Member Functions | |
virtual | ~GlobalRouter () |
void | ClearLSAs (void) |
Ptr< NetDevice > | GetAdjacent (Ptr< NetDevice > nd, Ptr< Channel > ch) const |
bool | FindIfIndexForDevice (Ptr< Node > node, Ptr< NetDevice > nd, uint32_t &index) const |
Ipv4Address | FindDesignatedRouterForLink (Ptr< NetDevice > ndLocal, bool allowRecursion) const |
bool | AnotherRouterOnLink (Ptr< NetDevice > nd, bool allowRecursion) const |
void | ProcessBroadcastLink (Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c) |
void | ProcessSingleBroadcastLink (Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c) |
void | ProcessBridgedBroadcastLink (Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c) |
void | ProcessPointToPointLink (Ptr< NetDevice > ndLocal, GlobalRoutingLSA *pLSA) |
void | BuildNetworkLSAs (NetDeviceContainer c) |
Ptr< BridgeNetDevice > | NetDeviceIsBridged (Ptr< NetDevice > nd) const |
virtual void | DoDispose (void) |
GlobalRouter (GlobalRouter &sr) | |
Global Router copy construction is disallowed. | |
GlobalRouter & | operator= (GlobalRouter &sr) |
Global Router assignment operator is disallowed. | |
Private Attributes | |
ListOfLSAs_t | m_LSAs |
Ipv4Address | m_routerId |
An interface aggregated to a node to provide global routing info.
An interface aggregated to a node that provides global routing information to a global route manager. The presence of the interface indicates that the node is a router. The interface is the mechanism by which the router advertises its connections to neighboring routers. We're basically allowing the route manager to query for link state advertisements.
Definition at line 560 of file global-router-interface.h.
typedef std::list<GlobalRoutingLSA*> ns3::GlobalRouter::ListOfLSAs_t [private] |
Definition at line 659 of file global-router-interface.h.
ns3::GlobalRouter::GlobalRouter | ( | ) |
Create a Global Router class.
Definition at line 487 of file global-router-interface.cc.
References ns3::GlobalRouteManager::AllocateRouterId(), m_routerId, NS_LOG_FUNCTION_NOARGS, and ns3::Ipv4Address::Set().
ns3::GlobalRouter::~GlobalRouter | ( | ) | [private, virtual] |
Definition at line 494 of file global-router-interface.cc.
References ClearLSAs(), and NS_LOG_FUNCTION_NOARGS.
ns3::GlobalRouter::GlobalRouter | ( | GlobalRouter & | sr | ) | [private] |
Global Router copy construction is disallowed.
bool ns3::GlobalRouter::AnotherRouterOnLink | ( | Ptr< NetDevice > | nd, | |
bool | allowRecursion | |||
) | const [private] |
Definition at line 1275 of file global-router-interface.cc.
References NetDeviceIsBridged(), NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().
void ns3::GlobalRouter::BuildNetworkLSAs | ( | NetDeviceContainer | c | ) | [private] |
Definition at line 1057 of file global-router-interface.cc.
References ns3::GlobalRoutingLSA::AddAttachedRouter(), FindIfIndexForDevice(), ns3::NetDeviceContainer::Get(), ns3::NetDeviceContainer::GetN(), ns3::GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED, m_LSAs, m_routerId, ns3::GlobalRoutingLSA::NetworkLSA, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::GlobalRoutingLSA::SetAdvertisingRouter(), ns3::GlobalRoutingLSA::SetLinkStateId(), ns3::GlobalRoutingLSA::SetLSType(), ns3::GlobalRoutingLSA::SetNetworkLSANetworkMask(), and ns3::GlobalRoutingLSA::SetStatus().
Referenced by DiscoverLSAs().
void ns3::GlobalRouter::ClearLSAs | ( | void | ) | [private] |
Definition at line 508 of file global-router-interface.cc.
References m_LSAs, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
Referenced by DiscoverLSAs(), and ~GlobalRouter().
uint32_t ns3::GlobalRouter::DiscoverLSAs | ( | void | ) |
Walk the connected channels, discover the adjacent routers and build the associated number of Global Routing Link State Advertisements that this router can export.
This is a fairly expensive operation in that every time it is called the current list of LSAs is built by walking connected point-to-point channels and peeking into adjacent IPV4 stacks to get address information. This is done to allow for limited dymanics of the Global Routing environment. By that we mean that you can discover new link state advertisements after a network topology change by calling DiscoverLSAs and then by reading those advertisements.
Definition at line 541 of file global-router-interface.cc.
References BuildNetworkLSAs(), ClearLSAs(), FindIfIndexForDevice(), ns3::NetDeviceContainer::GetN(), ns3::GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED, m_LSAs, m_routerId, NetDeviceIsBridged(), NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, ProcessBroadcastLink(), ProcessPointToPointLink(), ns3::GlobalRoutingLSA::RouterLSA, ns3::GlobalRoutingLSA::SetAdvertisingRouter(), ns3::GlobalRoutingLSA::SetLinkStateId(), ns3::GlobalRoutingLSA::SetLSType(), and ns3::GlobalRoutingLSA::SetStatus().
void ns3::GlobalRouter::DoDispose | ( | void | ) | [private, virtual] |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
Reimplemented from ns3::Object.
Definition at line 501 of file global-router-interface.cc.
References NS_LOG_FUNCTION_NOARGS.
Ipv4Address ns3::GlobalRouter::FindDesignatedRouterForLink | ( | Ptr< NetDevice > | ndLocal, | |
bool | allowRecursion | |||
) | const [private] |
Definition at line 1148 of file global-router-interface.cc.
References FindIfIndexForDevice(), NetDeviceIsBridged(), NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().
bool ns3::GlobalRouter::FindIfIndexForDevice | ( | Ptr< Node > | node, | |
Ptr< NetDevice > | nd, | |||
uint32_t & | index | |||
) | const [private] |
Definition at line 1444 of file global-router-interface.cc.
References NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
Referenced by BuildNetworkLSAs(), DiscoverLSAs(), FindDesignatedRouterForLink(), ProcessBridgedBroadcastLink(), ProcessPointToPointLink(), and ProcessSingleBroadcastLink().
Ptr< NetDevice > ns3::GlobalRouter::GetAdjacent | ( | Ptr< NetDevice > | nd, | |
Ptr< Channel > | ch | |||
) | const [private] |
Definition at line 1406 of file global-router-interface.cc.
References NS_ASSERT_MSG, and NS_LOG_FUNCTION_NOARGS.
Referenced by ProcessPointToPointLink().
bool ns3::GlobalRouter::GetLSA | ( | uint32_t | n, | |
GlobalRoutingLSA & | lsa | |||
) | const |
Get a Global Routing Link State Advertisements that this router has said that it can export.
This is a fairly inexpensive expensive operation in that the hard work was done in GetNumLSAs. We just copy the indicated Global Routing Link State Advertisement into the requested GlobalRoutingLSA object.
You must call GlobalRouter::GetNumLSAs before calling this method in order to discover the adjacent routers and build the advertisements. GetNumLSAs will return the number of LSAs this router advertises. The parameter n (requested LSA number) must be in the range 0 to GetNumLSAs() - 1.
n | The index number of the LSA you want to read. | |
lsa | The GlobalRoutingLSA class to receive the LSA information. |
Definition at line 1376 of file global-router-interface.cc.
References ns3::GlobalRoutingLSA::IsEmpty(), m_LSAs, NS_ASSERT_MSG, and NS_LOG_FUNCTION_NOARGS.
uint32_t ns3::GlobalRouter::GetNumLSAs | ( | void | ) | const |
Get the Number of Global Routing Link State Advertisements that this router can export.
To get meaningful information you must have previously called DiscoverLSAs. After you know how many LSAs are present in the router, you may call GetLSA () to retrieve the actual advertisement.
Definition at line 1366 of file global-router-interface.cc.
References m_LSAs, and NS_LOG_FUNCTION_NOARGS.
Ipv4Address ns3::GlobalRouter::GetRouterId | ( | void | ) | const |
Get the Router ID associated with this Global Router.
The Router IDs are allocated in the RoutingEnvironment -- one per Router, starting at 0.0.0.1 and incrementing with each instantiation of a router.
Definition at line 528 of file global-router-interface.cc.
References m_routerId, and NS_LOG_FUNCTION_NOARGS.
TypeId ns3::GlobalRouter::GetTypeId | ( | void | ) | [static] |
The Interface ID of the Global Router interface.
This method returns the TypeId associated to ns3::GlobalRouter.
No Attributes defined for this type.
No TraceSources defined for this type.
Reimplemented from ns3::Object.
Definition at line 480 of file global-router-interface.cc.
References ns3::TypeId::SetParent().
Ptr< BridgeNetDevice > ns3::GlobalRouter::NetDeviceIsBridged | ( | Ptr< NetDevice > | nd | ) | const [private] |
Definition at line 1474 of file global-router-interface.cc.
References NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by AnotherRouterOnLink(), DiscoverLSAs(), and FindDesignatedRouterForLink().
GlobalRouter& ns3::GlobalRouter::operator= | ( | GlobalRouter & | sr | ) | [private] |
Global Router assignment operator is disallowed.
void ns3::GlobalRouter::ProcessBridgedBroadcastLink | ( | Ptr< NetDevice > | nd, | |
GlobalRoutingLSA * | pLSA, | |||
NetDeviceContainer & | c | |||
) | [private] |
Definition at line 788 of file global-router-interface.cc.
References ns3::NetDeviceContainer::Add(), ns3::GlobalRoutingLSA::AddLinkRecord(), AnotherRouterOnLink(), ns3::Ipv4Address::CombineMask(), FindDesignatedRouterForLink(), FindIfIndexForDevice(), ns3::Ipv4Mask::Get(), NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Ipv4Address::Set(), ns3::GlobalRoutingLinkRecord::SetLinkData(), ns3::GlobalRoutingLinkRecord::SetLinkId(), ns3::GlobalRoutingLinkRecord::SetLinkType(), ns3::GlobalRoutingLinkRecord::SetMetric(), ns3::GlobalRoutingLinkRecord::StubNetwork, and ns3::GlobalRoutingLinkRecord::TransitNetwork.
Referenced by ProcessBroadcastLink().
void ns3::GlobalRouter::ProcessBroadcastLink | ( | Ptr< NetDevice > | nd, | |
GlobalRoutingLSA * | pLSA, | |||
NetDeviceContainer & | c | |||
) | [private] |
Definition at line 669 of file global-router-interface.cc.
References NS_LOG_FUNCTION, ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().
Referenced by DiscoverLSAs().
void ns3::GlobalRouter::ProcessPointToPointLink | ( | Ptr< NetDevice > | ndLocal, | |
GlobalRoutingLSA * | pLSA | |||
) | [private] |
Definition at line 945 of file global-router-interface.cc.
References ns3::GlobalRoutingLSA::AddLinkRecord(), FindIfIndexForDevice(), ns3::Ipv4Mask::Get(), GetAdjacent(), NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::GlobalRoutingLinkRecord::PointToPoint, ns3::GlobalRoutingLinkRecord::SetLinkData(), ns3::GlobalRoutingLinkRecord::SetLinkId(), ns3::GlobalRoutingLinkRecord::SetLinkType(), ns3::GlobalRoutingLinkRecord::SetMetric(), and ns3::GlobalRoutingLinkRecord::StubNetwork.
Referenced by DiscoverLSAs().
void ns3::GlobalRouter::ProcessSingleBroadcastLink | ( | Ptr< NetDevice > | nd, | |
GlobalRoutingLSA * | pLSA, | |||
NetDeviceContainer & | c | |||
) | [private] |
Definition at line 684 of file global-router-interface.cc.
References ns3::NetDeviceContainer::Add(), ns3::GlobalRoutingLSA::AddLinkRecord(), AnotherRouterOnLink(), ns3::Ipv4Address::CombineMask(), FindDesignatedRouterForLink(), FindIfIndexForDevice(), ns3::Ipv4Mask::Get(), NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Ipv4Address::Set(), ns3::GlobalRoutingLinkRecord::SetLinkData(), ns3::GlobalRoutingLinkRecord::SetLinkId(), ns3::GlobalRoutingLinkRecord::SetLinkType(), ns3::GlobalRoutingLinkRecord::SetMetric(), ns3::GlobalRoutingLinkRecord::StubNetwork, and ns3::GlobalRoutingLinkRecord::TransitNetwork.
Referenced by ProcessBroadcastLink().
ListOfLSAs_t ns3::GlobalRouter::m_LSAs [private] |
Definition at line 660 of file global-router-interface.h.
Referenced by BuildNetworkLSAs(), ClearLSAs(), DiscoverLSAs(), GetLSA(), and GetNumLSAs().
Ipv4Address ns3::GlobalRouter::m_routerId [private] |
Definition at line 662 of file global-router-interface.h.
Referenced by BuildNetworkLSAs(), DiscoverLSAs(), GetRouterId(), and GlobalRouter().