A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::GlobalRouter Class Reference

An interface aggregated to a node to provide global routing info. More...

#include <global-router-interface.h>

+ Inheritance diagram for ns3::GlobalRouter:

Public Member Functions

 GlobalRouter ()
 Create a Global Router class.
 
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. More...
 
Ipv4RoutingTableEntryGetInjectedRoute (uint32_t i)
 Return the injected route indexed by i. More...
 
bool GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const
 Get a Global Routing Link State Advertisements that this router has said that it can export. More...
 
uint32_t GetNInjectedRoutes (void)
 Get the number of injected routes that have been added to the routing table. More...
 
uint32_t GetNumLSAs (void) const
 Get the Number of Global Routing Link State Advertisements that this router can export. More...
 
Ipv4Address GetRouterId (void) const
 Get the Router ID associated with this Global Router. More...
 
Ptr< Ipv4GlobalRoutingGetRoutingProtocol (void)
 
void InjectRoute (Ipv4Address network, Ipv4Mask networkMask)
 Inject a route to be circulated to other routers as an external route. More...
 
void RemoveInjectedRoute (uint32_t i)
 Withdraw a route from the global unicast routing table. More...
 
void SetRoutingProtocol (Ptr< Ipv4GlobalRouting > routing)
 
bool WithdrawRoute (Ipv4Address network, Ipv4Mask networkMask)
 Withdraw a route from the global unicast routing table. More...
 
- Public Member Functions inherited from ns3::Object
void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 
AggregateIterator GetAggregateIterator (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 
template<typename T >
Ptr< T > GetObject (void) const
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 
void Initialize (void)
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount (const SimpleRefCount &o)
 
uint32_t GetReferenceCount (void) const
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 
void Ref (void) const
 
void Unref (void) const
 
- Public Member Functions inherited from ns3::ObjectBase
void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static TypeId GetTypeId (void)
 The Interface ID of the Global Router interface. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 

Private Types

typedef std::list
< Ipv4RoutingTableEntry * > 
InjectedRoutes
 
typedef std::list
< Ipv4RoutingTableEntry * >
::const_iterator 
InjectedRoutesCI
 
typedef std::list
< Ipv4RoutingTableEntry * >
::iterator 
InjectedRoutesI
 
typedef std::list
< GlobalRoutingLSA * > 
ListOfLSAs_t
 

Private Member Functions

 GlobalRouter (GlobalRouter &sr)
 Global Router copy construction is disallowed.
 
bool AnotherRouterOnLink (Ptr< NetDevice > nd, bool allowRecursion) const
 
void BuildNetworkLSAs (NetDeviceContainer c)
 
void ClearLSAs (void)
 
virtual void DoDispose (void)
 
Ipv4Address FindDesignatedRouterForLink (Ptr< NetDevice > ndLocal, bool allowRecursion) const
 
bool FindInterfaceForDevice (Ptr< Node > node, Ptr< NetDevice > nd, uint32_t &index) const
 
Ptr< NetDeviceGetAdjacent (Ptr< NetDevice > nd, Ptr< Channel > ch) const
 
Ptr< BridgeNetDeviceNetDeviceIsBridged (Ptr< NetDevice > nd) const
 
GlobalRouteroperator= (GlobalRouter &sr)
 Global Router assignment operator is disallowed.
 
void ProcessBridgedBroadcastLink (Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
 
void ProcessBroadcastLink (Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
 
void ProcessPointToPointLink (Ptr< NetDevice > ndLocal, GlobalRoutingLSA *pLSA)
 
void ProcessSingleBroadcastLink (Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
 

Private Attributes

InjectedRoutes m_injectedRoutes
 
ListOfLSAs_t m_LSAs
 
Ipv4Address m_routerId
 
Ptr< Ipv4GlobalRoutingm_routingProtocol
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 
virtual void DoInitialize (void)
 
virtual void NotifyNewAggregate (void)
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 

Detailed Description

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.

Doxygen introspection did not find any typical Config paths.
No Attributes are defined for this type.
No TraceSources are defined for this type.

Definition at line 576 of file global-router-interface.h.

Member Function Documentation

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 dynamics 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.

See Also
GlobalRoutingLSA
GlobalRouter::GetLSA ()
Returns
The number of Global Routing Link State Advertisements.

Definition at line 591 of file global-router-interface.cc.

References ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::NetDeviceContainer::GetN(), ns3::Node::GetNDevices(), ns3::Object::GetObject(), ns3::GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::GlobalRoutingLSA::SetAdvertisingRouter(), ns3::GlobalRoutingLSA::SetLinkStateId(), ns3::GlobalRoutingLSA::SetLSType(), ns3::GlobalRoutingLSA::SetNetworkLSANetworkMask(), ns3::GlobalRoutingLSA::SetNode(), and ns3::GlobalRoutingLSA::SetStatus().

void ns3::GlobalRouter::DoDispose ( void  )
privatevirtual

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.

It is safe to call GetObject from within this method.

Reimplemented from ns3::Object.

Definition at line 544 of file global-router-interface.cc.

References ns3::Object::DoDispose(), and NS_LOG_FUNCTION.

Ipv4RoutingTableEntry * ns3::GlobalRouter::GetInjectedRoute ( uint32_t  i)

Return the injected route indexed by i.

Parameters
ithe index of the route
Returns
a pointer to that Ipv4RoutingTableEntry is returned

Definition at line 1523 of file global-router-interface.cc.

References NS_ASSERT, and NS_LOG_FUNCTION.

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.

See Also
GlobalRoutingLSA
GlobalRouting::GetNumLSAs ()
Parameters
nThe index number of the LSA you want to read.
lsaThe GlobalRoutingLSA class to receive the LSA information.
Returns
The number of Global Router Link State Advertisements.

Definition at line 1483 of file global-router-interface.cc.

References ns3::GlobalRoutingLSA::IsEmpty(), NS_ASSERT_MSG, and NS_LOG_FUNCTION.

uint32_t ns3::GlobalRouter::GetNInjectedRoutes ( void  )

Get the number of injected routes that have been added to the routing table.

Returns
number of injected routes

Definition at line 1546 of file global-router-interface.cc.

References NS_LOG_FUNCTION.

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.

See Also
GlobalRouterLSA
GlobalRouting::DiscoverLSAs ()
GlobalRouting::GetLSA ()
Returns
The number of Global Routing Link State Advertisements.

Definition at line 1473 of file global-router-interface.cc.

References NS_LOG_FUNCTION.

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.

See Also
RoutingEnvironment::AllocateRouterId ()
Returns
The Router ID associated with the Global Router.

Definition at line 578 of file global-router-interface.cc.

References NS_LOG_FUNCTION.

TypeId ns3::GlobalRouter::GetTypeId ( void  )
static

The Interface ID of the Global Router interface.

See Also
Object::GetObject ()

Definition at line 510 of file global-router-interface.cc.

References ns3::TypeId::SetParent().

void ns3::GlobalRouter::InjectRoute ( Ipv4Address  network,
Ipv4Mask  networkMask 
)

Inject a route to be circulated to other routers as an external route.

Parameters
networkThe Network to inject
networkMaskThe Network Mask to inject

Definition at line 1509 of file global-router-interface.cc.

References ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(), and NS_LOG_FUNCTION.

void ns3::GlobalRouter::RemoveInjectedRoute ( uint32_t  i)

Withdraw a route from the global unicast routing table.

Calling this function will cause all indexed routes numbered above index i to have their index decremented. For instance, it is possible to remove N injected routes by calling RemoveInjectedRoute (0) N times.

Parameters
iThe index (into the injected routing list) of the route to remove.
See Also
GlobalRouter::WithdrawRoute ()

Definition at line 1553 of file global-router-interface.cc.

References NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

bool ns3::GlobalRouter::WithdrawRoute ( Ipv4Address  network,
Ipv4Mask  networkMask 
)

Withdraw a route from the global unicast routing table.

Parameters
networkThe Network to withdraw
networkMaskThe Network Mask to withdraw
Returns
whether the operation succeeded (will return false if no such route)
See Also
GlobalRouter::RemoveInjectedRoute ()

Definition at line 1572 of file global-router-interface.cc.

References NS_LOG_FUNCTION, and NS_LOG_LOGIC.


The documentation for this class was generated from the following files: