A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::GlobalRouter< T > Class Template Reference

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

#include "global-router-interface.h"

Inheritance diagram for ns3::GlobalRouter< T >:
Collaboration diagram for ns3::GlobalRouter< T >:

Public Member Functions

 GlobalRouter ()
 Create a Global Router class.
 GlobalRouter (const GlobalRouter &)=delete
uint32_t DiscoverLSAs ()
 Walk the connected channels, discover the adjacent routers and build the associated number of Global Routing Link State Advertisements that this router can export.
IpRoutingTableEntryGetInjectedRoute (uint32_t i)
 Return the injected route indexed by i.
bool GetLSA (uint32_t n, GlobalRoutingLSA< T > &lsa) const
 Get a Global Routing Link State Advertisements that this router has said that it can export.
uint32_t GetNInjectedRoutes ()
 Get the number of injected routes that have been added to the routing table.
uint32_t GetNumLSAs () const
 Get the Number of Global Routing Link State Advertisements that this router can export.
IpAddress GetRouterId () const
 Get the Router ID associated with this Global Router.
Ptr< GlobalRouting< IpRoutingProtocol > > GetRoutingProtocol ()
 Get the specific Global Routing Protocol used.
void InjectRoute (IpAddress network, IpMaskOrPrefix networkMask)
 Inject a route to be circulated to other routers as an external route.
GlobalRouteroperator= (const GlobalRouter &)=delete
void RemoveInjectedRoute (uint32_t i)
 Withdraw a route from the global unicast routing table.
void SetRoutingProtocol (Ptr< GlobalRouting< IpRoutingProtocol > > routing)
 Set the specific Global Routing Protocol to be used.
bool WithdrawRoute (IpAddress network, IpMaskOrPrefix networkMask)
 Withdraw a route from the global unicast routing table.
Public Member Functions inherited from ns3::Object
 Object ()
 Caller graph was not generated because of its size.
 ~Object () override
 Destructor.
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together.
void Dispose ()
 Dispose of this Object.
AggregateIterator GetAggregateIterator () const
 Get an iterator to the Objects aggregated to this one.
TypeId GetInstanceTypeId () const final
 Get the most derived TypeId for this Object.
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object.
template<typename T>
Ptr< T > GetObject () const
 Get a pointer to the requested aggregated Object.
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object.
template<typename T>
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId.
void Initialize ()
 Invoke DoInitialize on all Objects aggregated to this one.
bool IsInitialized () const
 Check if the object has been initialized.
void UnidirectionalAggregateObject (Ptr< Object > other)
 Aggregate an Object to another Object.
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor.
uint32_t GetReferenceCount () const
 Get the reference count of the object.
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator.
void Ref () const
 Increment the reference count.
void Unref () const
 Decrement the reference count.
Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor.
void GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const
 Get the value of an attribute, raising fatal errors if unsuccessful.
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising errors.
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful.
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors.
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context.
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context.
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context.
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context.

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.
Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId ()
 Register this type.
Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId ()
 Get the type ID.

Private Types

typedef std::list< IpRoutingTableEntry * > InjectedRoutes
 container of Ipv4RoutingTableEntry
typedef std::list< IpRoutingTableEntry * >::const_iterator InjectedRoutesCI
 Const Iterator to container of Ipv4RoutingTableEntry.
typedef std::list< IpRoutingTableEntry * >::iterator InjectedRoutesI
 Iterator to container of Ipv4RoutingTableEntry.
using Ip = typename std::conditional_t<IsIpv4, Ipv4, Ipv6>
 Alias for Ipv4 and Ipv6 classes.
using IpAddress = typename std::conditional_t<IsIpv4, Ipv4Address, Ipv6Address>
 Alias for Ipv4Address and Ipv6Address classes.
using IpHeader = typename std::conditional_t<IsIpv4, Ipv4Header, Ipv6Header>
 Alias for Ipv4Header and Ipv6Header classes.
using IpInterfaceAddress
 Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes.
using IpMaskOrPrefix = typename std::conditional_t<IsIpv4, Ipv4Mask, Ipv6Prefix>
 Alias for Ipv4Mask And Ipv6Prefix.
using IpRoute = typename std::conditional_t<IsIpv4, Ipv4Route, Ipv6Route>
 Alias for Ipv4Route and Ipv6Route classes.
using IpRoutingProtocol
 Alias for Ipv4RoutingProtocol and Ipv6RoutingProtocol classes.
using IpRoutingTableEntry
 Alias for Ipv4RoutingTableEntry and Ipv6RoutingTableEntry classes.
typedef std::list< GlobalRoutingLSA< T > * > ListOfLSAs_t
 container for the GlobalRoutingLSAs

Private Member Functions

 ~GlobalRouter () override
bool AnotherRouterOnLink (Ptr< NetDevice > nd) const
 Checks for the presence of another router on the NetDevice.
bool BridgeHasAlreadyBeenVisited (Ptr< BridgeNetDevice > device) const
 When recursively checking for devices on the link, check whether a given device has already been visited.
void BuildNetworkLSAs (NetDeviceContainer c)
 Build one NetworkLSA for each net device talking to a network that we are the designated router for.
void ClearBridgesVisited () const
 Clear the list of bridges visited on the link.
void ClearLSAs ()
 Clear list of LSAs.
void DoDispose () override
 Destructor implementation.
NetDeviceContainer FindAllNonBridgedDevicesOnLink (Ptr< Channel > ch) const
 Return a container of all non-bridged NetDevices on a link.
IpAddress FindDesignatedRouterForLink (Ptr< NetDevice > ndLocal) const
 Finds a designated router.
Ptr< NetDeviceGetAdjacent (Ptr< NetDevice > nd, Ptr< Channel > ch) const
 Link through the given channel and find the net device that's on the other end.
void MarkBridgeAsVisited (Ptr< BridgeNetDevice > device) const
 When recursively checking for devices on the link, mark a given device as having been visited.
Ptr< BridgeNetDeviceNetDeviceIsBridged (Ptr< NetDevice > nd) const
 Decide whether or not a given net device is being bridged by a BridgeNetDevice.
void ProcessBridgedBroadcastLink (Ptr< NetDevice > nd, GlobalRoutingLSA< T > *pLSA, NetDeviceContainer &c)
 Process a bridged broadcast link.
void ProcessBroadcastLink (Ptr< NetDevice > nd, GlobalRoutingLSA< T > *pLSA, NetDeviceContainer &c)
 Process a generic broadcast link.
void ProcessPointToPointLink (Ptr< NetDevice > ndLocal, GlobalRoutingLSA< T > *pLSA)
 Process a point to point link.
void ProcessSingleBroadcastLink (Ptr< NetDevice > nd, GlobalRoutingLSA< T > *pLSA, NetDeviceContainer &c)
 Process a single broadcast link.

Private Attributes

std::vector< Ptr< BridgeNetDevice > > m_bridgesVisited
 Container of bridges visited.
InjectedRoutes m_injectedRoutes
 Routes we are exporting.
ListOfLSAs_t m_LSAs
 database of GlobalRoutingLSAs
IpAddress m_routerId
 router ID (its IPv4 address)
Ptr< GlobalRouting< IpRoutingProtocol > > m_routingProtocol
 the Ipv4GlobalRouting in use

Static Private Attributes

static constexpr bool IsIpv4 = std::is_same_v<Ipv4Manager, T>
 Alias for determining whether the parent is Ipv4RoutingProtocol or Ipv6RoutingProtocol.

Additional Inherited Members

Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object.
virtual void DoInitialize ()
 Initialize() implementation.
virtual void NotifyNewAggregate ()
 Notify all Objects aggregated to this one of a new Object being aggregated.
Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes.
virtual void NotifyConstructionCompleted ()
 Notifier called once the ObjectBase is fully constructed.

Detailed Description

template<typename T>
class ns3::GlobalRouter< T >

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 705 of file global-router-interface.h.

Member Typedef Documentation

◆ InjectedRoutes

template<typename T>
typedef std::list<IpRoutingTableEntry*> ns3::GlobalRouter< T >::InjectedRoutes
private

container of Ipv4RoutingTableEntry

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

◆ InjectedRoutesCI

template<typename T>
typedef std::list<IpRoutingTableEntry*>::const_iterator ns3::GlobalRouter< T >::InjectedRoutesCI
private

Const Iterator to container of Ipv4RoutingTableEntry.

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

◆ InjectedRoutesI

template<typename T>
typedef std::list<IpRoutingTableEntry*>::iterator ns3::GlobalRouter< T >::InjectedRoutesI
private

Iterator to container of Ipv4RoutingTableEntry.

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

◆ Ip

template<typename T>
using ns3::GlobalRouter< T >::Ip = typename std::conditional_t<IsIpv4, Ipv4, Ipv6>
private

Alias for Ipv4 and Ipv6 classes.

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

◆ IpAddress

template<typename T>
using ns3::GlobalRouter< T >::IpAddress = typename std::conditional_t<IsIpv4, Ipv4Address, Ipv6Address>
private

Alias for Ipv4Address and Ipv6Address classes.

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

◆ IpHeader

template<typename T>
using ns3::GlobalRouter< T >::IpHeader = typename std::conditional_t<IsIpv4, Ipv4Header, Ipv6Header>
private

Alias for Ipv4Header and Ipv6Header classes.

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

◆ IpInterfaceAddress

template<typename T>
using ns3::GlobalRouter< T >::IpInterfaceAddress
private
Initial value:
typename std::conditional_t<IsIpv4, Ipv4InterfaceAddress, Ipv6InterfaceAddress>

Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes.

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

◆ IpMaskOrPrefix

template<typename T>
using ns3::GlobalRouter< T >::IpMaskOrPrefix = typename std::conditional_t<IsIpv4, Ipv4Mask, Ipv6Prefix>
private

Alias for Ipv4Mask And Ipv6Prefix.

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

◆ IpRoute

template<typename T>
using ns3::GlobalRouter< T >::IpRoute = typename std::conditional_t<IsIpv4, Ipv4Route, Ipv6Route>
private

Alias for Ipv4Route and Ipv6Route classes.

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

◆ IpRoutingProtocol

template<typename T>
using ns3::GlobalRouter< T >::IpRoutingProtocol
private
Initial value:
typename std::conditional_t<IsIpv4, Ipv4RoutingProtocol, Ipv6RoutingProtocol>

Alias for Ipv4RoutingProtocol and Ipv6RoutingProtocol classes.

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

◆ IpRoutingTableEntry

template<typename T>
using ns3::GlobalRouter< T >::IpRoutingTableEntry
private
Initial value:
typename std::conditional_t<IsIpv4, Ipv4RoutingTableEntry, Ipv6RoutingTableEntry>

Alias for Ipv4RoutingTableEntry and Ipv6RoutingTableEntry classes.

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

◆ ListOfLSAs_t

template<typename T>
typedef std::list<GlobalRoutingLSA<T>*> ns3::GlobalRouter< T >::ListOfLSAs_t
private

container for the GlobalRoutingLSAs

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

Constructor & Destructor Documentation

◆ GlobalRouter() [1/2]

template<typename T>
ns3::GlobalRouter< T >::GlobalRouter ( )

Create a Global Router class.

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

References m_LSAs, and NS_LOG_FUNCTION.

Referenced by AnotherRouterOnLink(), BuildNetworkLSAs(), FindDesignatedRouterForLink(), and ProcessPointToPointLink().

Here is the caller graph for this function:

◆ GlobalRouter() [2/2]

template<typename T>
ns3::GlobalRouter< T >::GlobalRouter ( const GlobalRouter< T > & )
delete

◆ ~GlobalRouter()

template<typename T>
ns3::GlobalRouter< T >::~GlobalRouter ( )
overrideprivate

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

Member Function Documentation

◆ AnotherRouterOnLink()

template<typename T>
bool ns3::GlobalRouter< T >::AnotherRouterOnLink ( Ptr< NetDevice > nd) const
private

Checks for the presence of another router on the NetDevice.

Given a node and an attached net device, take a look off in the channel to which the net device is attached and look for a node on the other side that has a GlobalRouter interface aggregated.

Parameters
ndNetDevice to scan
Returns
true if a router is found

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

References GlobalRouter(), AnotherRouterOnLink(), BridgeHasAlreadyBeenVisited(), MarkBridgeAsVisited(), NetDeviceIsBridged(), NS_ABORT_MSG, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by AnotherRouterOnLink(), ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BridgeHasAlreadyBeenVisited()

template<typename T>
bool ns3::GlobalRouter< T >::BridgeHasAlreadyBeenVisited ( Ptr< BridgeNetDevice > device) const
private

When recursively checking for devices on the link, check whether a given device has already been visited.

Parameters
devicethe bridge device to check
Returns
true if bridge has already been visited

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

References m_bridgesVisited, and NS_LOG_LOGIC.

Referenced by AnotherRouterOnLink(), FindAllNonBridgedDevicesOnLink(), and FindDesignatedRouterForLink().

Here is the caller graph for this function:

◆ BuildNetworkLSAs()

template<typename T>
void ns3::GlobalRouter< T >::BuildNetworkLSAs ( NetDeviceContainer c)
private

Build one NetworkLSA for each net device talking to a network that we are the designated router for.

Parameters
cthe devices.

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

References GlobalRouter(), ClearBridgesVisited(), FindAllNonBridgedDevicesOnLink(), ns3::NetDeviceContainer::Get(), ns3::NetDeviceContainer::GetN(), IsIpv4, ns3::GlobalRoutingLSA< T >::LSA_SPF_NOT_EXPLORED, m_LSAs, m_routerId, ns3::GlobalRoutingLSA< T >::NetworkLSA, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and NS_LOG_WARN.

Referenced by DiscoverLSAs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClearBridgesVisited()

template<typename T>
void ns3::GlobalRouter< T >::ClearBridgesVisited ( ) const
private

Clear the list of bridges visited on the link.

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

References m_bridgesVisited.

Referenced by BuildNetworkLSAs(), ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().

Here is the caller graph for this function:

◆ ClearLSAs()

template<typename T>
void ns3::GlobalRouter< T >::ClearLSAs ( )
private

Clear list of LSAs.

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

References m_LSAs, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by DiscoverLSAs().

Here is the caller graph for this function:

◆ DiscoverLSAs()

template<typename T>
uint32_t ns3::GlobalRouter< T >::DiscoverLSAs ( )

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 670 of file global-router-interface.cc.

References ns3::GlobalRoutingLSA< T >::ASExternalLSAs, BuildNetworkLSAs(), ClearLSAs(), ns3::DynamicCast(), ns3::NetDeviceContainer::GetN(), ns3::Object::GetObject(), IsIpv4, ns3::GlobalRoutingLSA< T >::LSA_SPF_NOT_EXPLORED, m_injectedRoutes, m_LSAs, m_routerId, NetDeviceIsBridged(), NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ProcessBroadcastLink(), ProcessPointToPointLink(), ns3::GlobalRoutingLSA< T >::RouterLSA, and ns3::GlobalRoutingLSA< T >::SetLSType().

Here is the call graph for this function:

◆ DoDispose()

template<typename T>
void ns3::GlobalRouter< T >::DoDispose ( )
overrideprivatevirtual

Destructor implementation.

This method is called by Dispose() or by the Object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overridden 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.

Caller graph was not generated because of its size.

Reimplemented from ns3::Object.

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

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

Here is the call graph for this function:

◆ FindAllNonBridgedDevicesOnLink()

template<typename T>
NetDeviceContainer ns3::GlobalRouter< T >::FindAllNonBridgedDevicesOnLink ( Ptr< Channel > ch) const
private

Return a container of all non-bridged NetDevices on a link.

This method will recursively find all of the 'edge' devices in an L2 broadcast domain. If there are no bridged devices, then the container returned is simply the set of devices on the channel passed in as an argument. If the link has bridges on it (and therefore multiple ns3::Channel objects interconnected by bridges), the method will find all of the non-bridged devices in the L2 broadcast domain.

Parameters
cha channel from the link
Returns
the NetDeviceContainer.

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

References ns3::NetDeviceContainer::Add(), BridgeHasAlreadyBeenVisited(), FindAllNonBridgedDevicesOnLink(), ns3::NetDeviceContainer::GetN(), MarkBridgeAsVisited(), NetDeviceIsBridged(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by BuildNetworkLSAs(), and FindAllNonBridgedDevicesOnLink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindDesignatedRouterForLink()

template<typename T>
GlobalRouter< T >::IpAddress ns3::GlobalRouter< T >::FindDesignatedRouterForLink ( Ptr< NetDevice > ndLocal) const
private

Finds a designated router.

Given a local net device, we need to walk the channel to which the net device is attached and look for nodes with GlobalRouter interfaces on them (one of them will be us). Of these, the router with the lowest IP address on the net device connecting to the channel becomes the designated router for the link.

Parameters
ndLocallocal NetDevice to scan
Returns
the IP address of the designated router

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

References GlobalRouter(), BridgeHasAlreadyBeenVisited(), FindDesignatedRouterForLink(), ns3::Ipv4Address::GetBroadcast(), ns3::Ipv6Address::GetOnes(), IsIpv4, MarkBridgeAsVisited(), NetDeviceIsBridged(), NS_ABORT_MSG, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and NS_LOG_WARN.

Referenced by FindDesignatedRouterForLink(), ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAdjacent()

template<typename T>
Ptr< NetDevice > ns3::GlobalRouter< T >::GetAdjacent ( Ptr< NetDevice > nd,
Ptr< Channel > ch ) const
private

Link through the given channel and find the net device that's on the other end.

This only makes sense with a point-to-point channel.

Parameters
ndoutgoing NetDevice
chchannel
Returns
the NetDevice on the other end

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

References NS_ASSERT_MSG, and NS_LOG_FUNCTION.

Referenced by ProcessPointToPointLink().

Here is the caller graph for this function:

◆ GetInjectedRoute()

template<typename T>
GlobalRouter< T >::IpRoutingTableEntry * ns3::GlobalRouter< T >::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 1997 of file global-router-interface.cc.

References m_injectedRoutes, NS_ASSERT, and NS_LOG_FUNCTION.

◆ GetLSA()

template<typename T>
bool ns3::GlobalRouter< T >::GetLSA ( uint32_t n,
GlobalRoutingLSA< T > & 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 1957 of file global-router-interface.cc.

References ns3::GlobalRoutingLSA< T >::IsEmpty(), m_LSAs, NS_ASSERT_MSG, and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ GetNInjectedRoutes()

template<typename T>
uint32_t ns3::GlobalRouter< T >::GetNInjectedRoutes ( )

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

Returns
number of injected routes

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

References m_injectedRoutes, and NS_LOG_FUNCTION.

◆ GetNumLSAs()

template<typename T>
uint32_t ns3::GlobalRouter< T >::GetNumLSAs ( ) 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 1946 of file global-router-interface.cc.

References m_LSAs, and NS_LOG_FUNCTION.

◆ GetRouterId()

template<typename T>
GlobalRouter< T >::IpAddress ns3::GlobalRouter< T >::GetRouterId ( ) 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 656 of file global-router-interface.cc.

References m_routerId, and NS_LOG_FUNCTION.

◆ GetRoutingProtocol()

template<typename T>
Ptr< GlobalRouting< typename GlobalRouter< T >::IpRoutingProtocol > > ns3::GlobalRouter< T >::GetRoutingProtocol ( )

Get the specific Global Routing Protocol used.

Returns
the routing protocol

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

References m_routingProtocol, and NS_LOG_FUNCTION.

◆ GetTypeId()

template<typename T>
TypeId ns3::GlobalRouter< T >::GetTypeId ( )
static

Get the type ID.

Returns
the object TypeId

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

◆ InjectRoute()

template<typename T>
void ns3::GlobalRouter< T >::InjectRoute ( IpAddress network,
IpMaskOrPrefix 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 1984 of file global-router-interface.cc.

References m_injectedRoutes, and NS_LOG_FUNCTION.

◆ MarkBridgeAsVisited()

template<typename T>
void ns3::GlobalRouter< T >::MarkBridgeAsVisited ( Ptr< BridgeNetDevice > device) const
private

When recursively checking for devices on the link, mark a given device as having been visited.

Parameters
devicethe bridge device to mark

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

References m_bridgesVisited, and NS_LOG_FUNCTION.

Referenced by AnotherRouterOnLink(), FindAllNonBridgedDevicesOnLink(), and FindDesignatedRouterForLink().

Here is the caller graph for this function:

◆ NetDeviceIsBridged()

template<typename T>
Ptr< BridgeNetDevice > ns3::GlobalRouter< T >::NetDeviceIsBridged ( Ptr< NetDevice > nd) const
private

Decide whether or not a given net device is being bridged by a BridgeNetDevice.

Parameters
ndthe NetDevice
Returns
the BridgeNetDevice smart pointer or null if not found

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

References NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by AnotherRouterOnLink(), DiscoverLSAs(), FindAllNonBridgedDevicesOnLink(), and FindDesignatedRouterForLink().

Here is the caller graph for this function:

◆ operator=()

template<typename T>
GlobalRouter & ns3::GlobalRouter< T >::operator= ( const GlobalRouter< T > & )
delete

◆ ProcessBridgedBroadcastLink()

template<typename T>
void ns3::GlobalRouter< T >::ProcessBridgedBroadcastLink ( Ptr< NetDevice > nd,
GlobalRoutingLSA< T > * pLSA,
NetDeviceContainer & c )
private

Process a bridged broadcast link.

Parameters
ndthe NetDevice
pLSAthe Global LSA
cthe returned NetDevice container

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

References ns3::NetDeviceContainer::Add(), ns3::GlobalRoutingLSA< T >::AddLinkRecord(), AnotherRouterOnLink(), ClearBridgesVisited(), FindDesignatedRouterForLink(), ns3::Ipv6Address::GetOnes(), IsIpv4, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::GlobalRoutingLinkRecord< T >::SetLinkData(), ns3::GlobalRoutingLinkRecord< T >::SetLinkId(), ns3::GlobalRoutingLinkRecord< T >::SetLinkLocData(), ns3::GlobalRoutingLinkRecord< T >::SetLinkType(), ns3::GlobalRoutingLinkRecord< T >::SetMetric(), ns3::GlobalRoutingLinkRecord< T >::StubNetwork, and ns3::GlobalRoutingLinkRecord< T >::TransitNetwork.

Referenced by ProcessBroadcastLink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessBroadcastLink()

template<typename T>
void ns3::GlobalRouter< T >::ProcessBroadcastLink ( Ptr< NetDevice > nd,
GlobalRoutingLSA< T > * pLSA,
NetDeviceContainer & c )
private

Process a generic broadcast link.

Parameters
ndthe NetDevice
pLSAthe Global LSA
cthe returned NetDevice container

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

References NS_LOG_FUNCTION, ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().

Referenced by DiscoverLSAs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessPointToPointLink()

template<typename T>
void ns3::GlobalRouter< T >::ProcessPointToPointLink ( Ptr< NetDevice > ndLocal,
GlobalRoutingLSA< T > * pLSA )
private

Process a point to point link.

Parameters
ndLocalthe NetDevice
pLSAthe Global LSA

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

References GlobalRouter(), ns3::GlobalRoutingLSA< T >::AddLinkRecord(), GetAdjacent(), IsIpv4, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::GlobalRoutingLinkRecord< T >::PointToPoint, ns3::GlobalRoutingLinkRecord< T >::SetLinkData(), ns3::GlobalRoutingLinkRecord< T >::SetLinkId(), ns3::GlobalRoutingLinkRecord< T >::SetLinkLocData(), ns3::GlobalRoutingLinkRecord< T >::SetLinkType(), ns3::GlobalRoutingLinkRecord< T >::SetMetric(), and ns3::GlobalRoutingLinkRecord< T >::StubNetwork.

Referenced by DiscoverLSAs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ProcessSingleBroadcastLink()

template<typename T>
void ns3::GlobalRouter< T >::ProcessSingleBroadcastLink ( Ptr< NetDevice > nd,
GlobalRoutingLSA< T > * pLSA,
NetDeviceContainer & c )
private

Process a single broadcast link.

Parameters
ndthe NetDevice
pLSAthe Global LSA
cthe returned NetDevice container

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

References ns3::NetDeviceContainer::Add(), ns3::GlobalRoutingLSA< T >::AddLinkRecord(), AnotherRouterOnLink(), ClearBridgesVisited(), FindDesignatedRouterForLink(), ns3::Ipv6Address::GetOnes(), IsIpv4, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::GlobalRoutingLinkRecord< T >::StubNetwork, and ns3::GlobalRoutingLinkRecord< T >::TransitNetwork.

Referenced by ProcessBroadcastLink().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RemoveInjectedRoute()

template<typename T>
void ns3::GlobalRouter< T >::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 2027 of file global-router-interface.cc.

References m_injectedRoutes, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ SetRoutingProtocol()

template<typename T>
void ns3::GlobalRouter< T >::SetRoutingProtocol ( Ptr< GlobalRouting< IpRoutingProtocol > > routing)

Set the specific Global Routing Protocol to be used.

Parameters
routingthe routing protocol

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

References m_routingProtocol, and NS_LOG_FUNCTION.

◆ WithdrawRoute()

template<typename T>
bool ns3::GlobalRouter< T >::WithdrawRoute ( IpAddress network,
IpMaskOrPrefix 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 2047 of file global-router-interface.cc.

References IsIpv4, m_injectedRoutes, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Member Data Documentation

◆ IsIpv4

template<typename T>
bool ns3::GlobalRouter< T >::IsIpv4 = std::is_same_v<Ipv4Manager, T>
staticconstexprprivate

◆ m_bridgesVisited

template<typename T>
std::vector<Ptr<BridgeNetDevice> > ns3::GlobalRouter< T >::m_bridgesVisited
mutableprivate

Container of bridges visited.

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

Referenced by BridgeHasAlreadyBeenVisited(), ClearBridgesVisited(), and MarkBridgeAsVisited().

◆ m_injectedRoutes

template<typename T>
InjectedRoutes ns3::GlobalRouter< T >::m_injectedRoutes
private

◆ m_LSAs

template<typename T>
ListOfLSAs_t ns3::GlobalRouter< T >::m_LSAs
private

database of GlobalRoutingLSAs

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

Referenced by GlobalRouter(), BuildNetworkLSAs(), ClearLSAs(), DiscoverLSAs(), GetLSA(), and GetNumLSAs().

◆ m_routerId

template<typename T>
IpAddress ns3::GlobalRouter< T >::m_routerId
private

◆ m_routingProtocol

template<typename T>
Ptr<GlobalRouting<IpRoutingProtocol> > ns3::GlobalRouter< T >::m_routingProtocol
private

the Ipv4GlobalRouting in use

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

Referenced by DoDispose(), GetRoutingProtocol(), and SetRoutingProtocol().


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