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

A global router implementation. More...

#include "global-route-manager-impl.h"

Collaboration diagram for ns3::GlobalRouteManagerImpl< T >:

Public Member Functions

 GlobalRouteManagerImpl ()
 GlobalRouteManagerImpl (const GlobalRouteManagerImpl &)=delete
virtual ~GlobalRouteManagerImpl ()
virtual void BuildGlobalRoutingDatabase ()
 Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRouter interface.
void DebugSPFCalculate (IpAddress root)
 Debugging routine; call the core SPF from the unit tests.
void DebugUseLsdb (GlobalRouteManagerLSDB< T > *lsdb)
 Debugging routine; allow client code to supply a pre-built LSDB.
virtual void DeleteGlobalRoutes ()
 Delete all static routes on all nodes that have a GlobalRouterInterface.
void InitializeRouters ()
 initialize all nodes as routers.
virtual void InitializeRoutes ()
 Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.
GlobalRouteManagerImploperator= (const GlobalRouteManagerImpl &)=delete
void PrintRoute (Ptr< Node > sourceNode, IpAddress dest, Ptr< OutputStreamWrapper > stream, bool nodeIdLookup, Time::Unit unit)
 prints the path from this node to the destination node at a particular time.
void PrintRoute (Ptr< Node > sourceNode, Ptr< Node > dest, Ptr< OutputStreamWrapper > stream, bool nodeIdLookup, Time::Unit unit)
 prints the path from this node to the destination node at a particular time.

Private Types

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 IpGlobalRouting = GlobalRouting<IpRoutingProtocol>
 Alias for Ipv4GlobalRouting and Ipv6GlobalRouting 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 IpL3Protocol = typename std::conditional_t<IsIpv4, Ipv4L3Protocol, Ipv6L3Protocol>
 Alias for Ipv4l3Protocol and Ipv6l3Protocol classes.
using IpListRouting = typename std::conditional_t<IsIpv4, Ipv4ListRouting, Ipv6ListRouting>
 Alias for Ipv4ListRouting and Ipv6ListRouting classes.
using IpManager = typename std::conditional_t<IsIpv4, Ipv4Manager, Ipv6Manager>
 Alias for Ipv4Manager and Ipv6Manager 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.

Private Member Functions

bool CheckForStubNode (IpAddress root)
 Test if a node is a stub, from an OSPF sense.
int32_t FindOutgoingInterfaceId (IpAddress a, IpMaskOrPrefix amask=IpMaskOrPrefix::GetOnes())
 Return the interface number corresponding to a given IP address and mask.
Ptr< IpGlobalRoutingGetGlobalRoutingForNode (Ptr< Node > node)
 Is used by PrintRoute() to get the global routing protocol associated with it or returns nullptr if not found.
Ptr< NodeGetNodeByIp (const IpAddress &source)
 given IP it iterates through the node list to find the node associated with the ip
bool IsLocalDelivery (Ptr< Ip > ip, IpAddress dest)
 Is used by PrintRoute() to check if the destination is on the source node itself.
bool IsOnSameSubnet (Ptr< Ip > ipCurrentNode, IpAddress dest)
 Is used by PrintRoute() to check if the destination is on the same subnet as the source node.
void ProcessASExternals (SPFVertex< T > *v, GlobalRoutingLSA< IpManager > *extlsa)
 Process Autonomous Systems (AS) External LSA.
void SPFAddASExternal (GlobalRoutingLSA< IpManager > *extlsa, SPFVertex< T > *v)
 Add an external route to the routing tables.
void SPFCalculate (IpAddress root)
 Calculate the shortest path first (SPF) tree.
GlobalRoutingLinkRecord< IpManager > * SPFGetNextLink (SPFVertex< T > *v, SPFVertex< T > *w, GlobalRoutingLinkRecord< IpManager > *prev_link)
 Search for a link between two vertices.
void SPFIntraAddRouter (SPFVertex< T > *v)
 Add a host route to the routing tables.
void SPFIntraAddStub (GlobalRoutingLinkRecord< IpManager > *l, SPFVertex< T > *v)
 Add a stub to the routing tables.
void SPFIntraAddTransit (SPFVertex< T > *v)
 Add a transit to the routing tables.
void SPFNext (SPFVertex< T > *v, CandidateQueue< T > &candidate)
 Examine the links in v's LSA and update the list of candidates with any vertices not already on the list.
int SPFNexthopCalculation (SPFVertex< T > *v, SPFVertex< T > *w, GlobalRoutingLinkRecord< IpManager > *l, uint32_t distance)
 Calculate nexthop from root through V (parent) to vertex W (destination) with given distance from root->W.
void SPFProcessStubs (SPFVertex< T > *v)
 Process Stub nodes.
void SPFVertexAddParent (SPFVertex< T > *v)
 Adds a vertex to the list of children in each of its parents.
bool ValidateSourceNodeHasIpAddress (Ptr< Ip > ip)
 Is used by PrintRoute() to check if the source node has an ipv4 address.

Private Attributes

GlobalRouteManagerLSDB< IpManager > * m_lsdb
 the Link State DataBase (LSDB) of the Global Route Manager
SPFVertex< T > * m_spfroot
 the root node

Static Private Attributes

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

Detailed Description

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

A global router implementation.

This singleton object can query interface each node in the system for a GlobalRouter interface. For those nodes, it fetches one or more Link State Advertisements and stores them in a local database. Then, it can compute shortest paths on a per-node basis to all routers, and finally configure each of the node's forwarding tables.

The design is guided by OSPFv2 RFC 2328 section 16.1.1 and quagga ospfd.

Definition at line 787 of file global-route-manager-impl.h.

Member Typedef Documentation

◆ Ip

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

Alias for Ipv4 and Ipv6 classes.

Definition at line 796 of file global-route-manager-impl.h.

◆ IpAddress

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

Alias for Ipv4Address and Ipv6Address classes.

Definition at line 802 of file global-route-manager-impl.h.

◆ IpGlobalRouting

template<typename T>
using ns3::GlobalRouteManagerImpl< T >::IpGlobalRouting = GlobalRouting<IpRoutingProtocol>
private

Alias for Ipv4GlobalRouting and Ipv6GlobalRouting classes.

Definition at line 832 of file global-route-manager-impl.h.

◆ IpHeader

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

Alias for Ipv4Header and Ipv6Header classes.

Definition at line 808 of file global-route-manager-impl.h.

◆ IpInterfaceAddress

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

Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes.

Definition at line 811 of file global-route-manager-impl.h.

◆ IpL3Protocol

template<typename T>
using ns3::GlobalRouteManagerImpl< T >::IpL3Protocol = typename std::conditional_t<IsIpv4, Ipv4L3Protocol, Ipv6L3Protocol>
private

Alias for Ipv4l3Protocol and Ipv6l3Protocol classes.

Definition at line 825 of file global-route-manager-impl.h.

◆ IpListRouting

template<typename T>
using ns3::GlobalRouteManagerImpl< T >::IpListRouting = typename std::conditional_t<IsIpv4, Ipv4ListRouting, Ipv6ListRouting>
private

Alias for Ipv4ListRouting and Ipv6ListRouting classes.

Definition at line 822 of file global-route-manager-impl.h.

◆ IpManager

template<typename T>
using ns3::GlobalRouteManagerImpl< T >::IpManager = typename std::conditional_t<IsIpv4, Ipv4Manager, Ipv6Manager>
private

Alias for Ipv4Manager and Ipv6Manager classes.

Definition at line 799 of file global-route-manager-impl.h.

◆ IpMaskOrPrefix

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

Alias for Ipv4Mask And Ipv6Prefix.

Definition at line 819 of file global-route-manager-impl.h.

◆ IpRoute

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

Alias for Ipv4Route and Ipv6Route classes.

Definition at line 805 of file global-route-manager-impl.h.

◆ IpRoutingProtocol

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

Alias for Ipv4RoutingProtocol and Ipv6RoutingProtocol classes.

Definition at line 828 of file global-route-manager-impl.h.

◆ IpRoutingTableEntry

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

Alias for Ipv4RoutingTableEntry and Ipv6RoutingTableEntry classes.

Definition at line 815 of file global-route-manager-impl.h.

Constructor & Destructor Documentation

◆ GlobalRouteManagerImpl() [1/2]

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

Definition at line 568 of file global-route-manager-impl.cc.

References m_lsdb, m_spfroot, and NS_LOG_FUNCTION.

Referenced by GlobalRouteManagerImpl(), and operator=().

Here is the caller graph for this function:

◆ ~GlobalRouteManagerImpl()

template<typename T>
ns3::GlobalRouteManagerImpl< T >::~GlobalRouteManagerImpl ( )
virtual

Definition at line 576 of file global-route-manager-impl.cc.

References m_lsdb, and NS_LOG_FUNCTION.

◆ GlobalRouteManagerImpl() [2/2]

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

References GlobalRouteManagerImpl().

Here is the call graph for this function:

Member Function Documentation

◆ BuildGlobalRoutingDatabase()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::BuildGlobalRoutingDatabase ( )
virtual

Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRouter interface.

Definition at line 644 of file global-route-manager-impl.cc.

References ns3::NodeList::Begin(), ns3::NodeList::End(), and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ CheckForStubNode()

template<typename T>
bool ns3::GlobalRouteManagerImpl< T >::CheckForStubNode ( IpAddress root)
private

Test if a node is a stub, from an OSPF sense.

If there is only one link of type 1 or 2, then a default route can safely be added to the next-hop router and SPF does not need to be run

Parameters
rootthe root node
Returns
true if the node is a stub

Definition at line 1317 of file global-route-manager-impl.cc.

References FindOutgoingInterfaceId(), ns3::GlobalRoutingLinkRecord< T >::GetLinkData(), ns3::GlobalRoutingLinkRecord< T >::GetLinkId(), ns3::GlobalRoutingLinkRecord< T >::GetLinkLocData(), ns3::GlobalRoutingLSA< T >::GetLinkRecord(), ns3::GlobalRoutingLSA< T >::GetLinkStateId(), ns3::GlobalRoutingLinkRecord< T >::GetLinkType(), ns3::GlobalRoutingLSA< T >::GetNLinkRecords(), ns3::GlobalRoutingLSA< T >::GetNode(), IsIpv4, m_lsdb, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::GlobalRoutingLinkRecord< T >::PointToPoint, and ns3::GlobalRoutingLinkRecord< T >::TransitNetwork.

Referenced by SPFCalculate().

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

◆ DebugSPFCalculate()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::DebugSPFCalculate ( IpAddress root)

Debugging routine; call the core SPF from the unit tests.

Parameters
rootthe root node to start calculations

Definition at line 1302 of file global-route-manager-impl.cc.

References NS_LOG_FUNCTION, and SPFCalculate().

Here is the call graph for this function:

◆ DebugUseLsdb()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::DebugUseLsdb ( GlobalRouteManagerLSDB< T > * lsdb)

Debugging routine; allow client code to supply a pre-built LSDB.

Parameters
lsdbthe pre-built LSDB

Definition at line 587 of file global-route-manager-impl.cc.

References m_lsdb, and NS_LOG_FUNCTION.

◆ DeleteGlobalRoutes()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::DeleteGlobalRoutes ( )
virtual

Delete all static routes on all nodes that have a GlobalRouterInterface.

Todo
separate manually assigned static routes from static routes that the global routing code injects, and only delete the latter

Definition at line 599 of file global-route-manager-impl.cc.

References ns3::NodeList::Begin(), ns3::NodeList::End(), m_lsdb, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Here is the call graph for this function:

◆ FindOutgoingInterfaceId()

template<typename T>
int32_t ns3::GlobalRouteManagerImpl< T >::FindOutgoingInterfaceId ( IpAddress a,
IpMaskOrPrefix amask = IpMaskOrPrefix::GetOnes() )
private

Return the interface number corresponding to a given IP address and mask.

This is a wrapper around GetInterfaceForPrefix(), but we first have to find the right node pointer to pass to that function. If no such interface is found, return -1 (note: unit test framework for routing assumes -1 to be a legal return value)

Parameters
athe target IP address
amaskthe target subnet mask
Returns
the outgoing interface number

Definition at line 1928 of file global-route-manager-impl.cc.

References ns3::GlobalRouteManager< T >::routerId, m_spfroot, NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by CheckForStubNode(), and SPFNexthopCalculation().

Here is the caller graph for this function:

◆ GetGlobalRoutingForNode()

template<typename T>
Ptr< typename GlobalRouteManagerImpl< T >::IpGlobalRouting > ns3::GlobalRouteManagerImpl< T >::GetGlobalRoutingForNode ( Ptr< Node > node)
private

Is used by PrintRoute() to get the global routing protocol associated with it or returns nullptr if not found.

Parameters
nodethe node pointer
Returns
the global routing protocol associated with the node

Definition at line 2364 of file global-route-manager-impl.cc.

References ns3::DynamicCast(), and list.

Referenced by PrintRoute().

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

◆ GetNodeByIp()

template<typename T>
Ptr< Node > ns3::GlobalRouteManagerImpl< T >::GetNodeByIp ( const IpAddress & source)
private

given IP it iterates through the node list to find the node associated with the ip

Parameters
sourceip address associated with the node we want to find
Returns
the node pointer to the ip

Definition at line 2300 of file global-route-manager-impl.cc.

References ns3::NodeList::Begin(), and ns3::NodeList::End().

Referenced by PrintRoute().

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

◆ InitializeRouters()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::InitializeRouters ( )

initialize all nodes as routers.

this method queries all the nodes in the simulation and enables ipv6 forwarding on all of them.

Definition at line 2651 of file global-route-manager-impl.cc.

References ns3::NodeList::Begin(), ns3::NodeList::End(), IsIpv4, and NS_LOG_FUNCTION_NOARGS.

Here is the call graph for this function:

◆ InitializeRoutes()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::InitializeRoutes ( )
virtual

Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.

Definition at line 728 of file global-route-manager-impl.cc.

◆ IsLocalDelivery()

template<typename T>
bool ns3::GlobalRouteManagerImpl< T >::IsLocalDelivery ( Ptr< Ip > ip,
IpAddress dest )
private

Is used by PrintRoute() to check if the destination is on the source node itself.

Parameters
ipthe ip stack of the source node
destthe destination
Returns
true if the destination is on the source node itself

Definition at line 2395 of file global-route-manager-impl.cc.

References IsIpv4.

Referenced by PrintRoute().

Here is the caller graph for this function:

◆ IsOnSameSubnet()

template<typename T>
bool ns3::GlobalRouteManagerImpl< T >::IsOnSameSubnet ( Ptr< Ip > ipCurrentNode,
IpAddress dest )
private

Is used by PrintRoute() to check if the destination is on the same subnet as the source node.

Parameters
ipCurrentNodethe current node
destthe destination
Returns
true if the destination is on the same subnet as the source node

Definition at line 2446 of file global-route-manager-impl.cc.

References IsIpv4.

Referenced by PrintRoute().

Here is the caller graph for this function:

◆ operator=()

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

References GlobalRouteManagerImpl().

Here is the call graph for this function:

◆ PrintRoute() [1/2]

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::PrintRoute ( Ptr< Node > sourceNode,
IpAddress dest,
Ptr< OutputStreamWrapper > stream,
bool nodeIdLookup,
Time::Unit unit )

prints the path from this node to the destination node at a particular time.

Parameters
sourceNodethe source node
destthe destination nodes ipv4 address
streamThe output stream to which the routing path will be written.
nodeIdLookupPrint the node id
unitThe time unit for timestamps in the printed output.
See also
Ipv4GlobalRoutingHelper::PrintRoute

Definition at line 2482 of file global-route-manager-impl.cc.

References GetGlobalRoutingForNode(), GetNodeByIp(), IsLocalDelivery(), IsOnSameSubnet(), NS_ABORT_MSG, NS_ABORT_MSG_IF, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_WARN, and ValidateSourceNodeHasIpAddress().

Here is the call graph for this function:

◆ PrintRoute() [2/2]

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::PrintRoute ( Ptr< Node > sourceNode,
Ptr< Node > dest,
Ptr< OutputStreamWrapper > stream,
bool nodeIdLookup,
Time::Unit unit )

prints the path from this node to the destination node at a particular time.

Parameters
sourceNodethe source node
destthe destination node
streamThe output stream to which the routing path will be written.
nodeIdLookupPrint the Node Id
unitThe time unit for timestamps in the printed output.
See also
Ipv4GlobalRoutingHelper::PrintRoute

Definition at line 2324 of file global-route-manager-impl.cc.

References IsIpv4, NS_ABORT_MSG, NS_ASSERT_MSG, and PrintRoute().

Referenced by PrintRoute().

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

◆ ProcessASExternals()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::ProcessASExternals ( SPFVertex< T > * v,
GlobalRoutingLSA< IpManager > * extlsa )
private

Process Autonomous Systems (AS) External LSA.

Parameters
vvertex to be processed
extlsaexternal LSA

Definition at line 1582 of file global-route-manager-impl.cc.

References ns3::GlobalRoutingLSA< T >::GetAdvertisingRouter(), ns3::GlobalRoutingLSA< T >::GetLinkStateId(), NS_LOG_FUNCTION, NS_LOG_LOGIC, ProcessASExternals(), SPFAddASExternal(), v, and ns3::SPFVertex< T >::VertexRouter.

Referenced by ProcessASExternals(), and SPFCalculate().

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

◆ SPFAddASExternal()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::SPFAddASExternal ( GlobalRoutingLSA< IpManager > * extlsa,
SPFVertex< T > * v )
private

Add an external route to the routing tables.

Parameters
extlsathe external LSA
vthe vertex

Definition at line 1616 of file global-route-manager-impl.cc.

References ns3::GlobalRoutingLSA< T >::GetAdvertisingRouter(), ns3::GlobalRoutingLSA< T >::GetLinkStateId(), ns3::GlobalRoutingLSA< T >::GetNetworkLSANetworkMask(), ns3::GlobalRouteManager< T >::routerId, IsIpv4, m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, and v.

Referenced by ProcessASExternals().

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

◆ SPFCalculate()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::SPFCalculate ( IpAddress root)
private

Calculate the shortest path first (SPF) tree.

Equivalent to quagga ospf_spf_calculate

Parameters
rootthe root node

Definition at line 1416 of file global-route-manager-impl.cc.

References CheckForStubNode(), ns3::GlobalRoutingLSA< T >::GetLinkStateId(), ns3::NodeList::GetNNodes(), ns3::GlobalRoutingLSA< T >::LSA_SPF_IN_SPFTREE, m_lsdb, m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::CandidateQueue< T >::Pop(), ProcessASExternals(), ns3::CandidateQueue< T >::Size(), SPFIntraAddRouter(), SPFIntraAddTransit(), SPFNext(), SPFProcessStubs(), SPFVertexAddParent(), v, ns3::SPFVertex< T >::VertexNetwork, and ns3::SPFVertex< T >::VertexRouter.

Referenced by DebugSPFCalculate().

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

◆ SPFGetNextLink()

template<typename T>
GlobalRoutingLinkRecord< typename GlobalRouteManagerImpl< T >::IpManager > * ns3::GlobalRouteManagerImpl< T >::SPFGetNextLink ( SPFVertex< T > * v,
SPFVertex< T > * w,
GlobalRoutingLinkRecord< IpManager > * prev_link )
private

Search for a link between two vertices.

This method is derived from quagga ospf_get_next_link ()

First search the Global Router Link Records of vertex v for one representing a point-to point link to vertex w.

What is done depends on prev_link. Contrary to appearances, prev_link just acts as a flag here. If prev_link is NULL, we return the first Global Router Link Record we find that describes a point-to-point link from v to w. If prev_link is not NULL, we return a Global Router Link Record representing a possible second link from v to w.

Parameters
vfirst vertex
wsecond vertex
prev_linkthe previous link in the list
Returns
the link's record

Definition at line 1223 of file global-route-manager-impl.cc.

References ns3::GlobalRoutingLinkRecord< T >::GetLinkData(), ns3::GlobalRoutingLinkRecord< T >::GetLinkId(), ns3::SPFVertex< T >::GetVertexId(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and v.

Referenced by SPFNexthopCalculation().

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

◆ SPFIntraAddRouter()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::SPFIntraAddRouter ( SPFVertex< T > * v)
private

Add a host route to the routing tables.

This method is derived from quagga ospf_intra_add_router ()

This is where we are actually going to add the host routes to the routing tables of the individual nodes.

The vertex passed as a parameter has just been added to the SPF tree. This vertex must have a valid m_root_oid, corresponding to the outgoing interface on the root router of the tree that is the first hop on the path to the vertex. The vertex must also have a next hop address, corresponding to the next hop on the path to the vertex. The vertex has an m_lsa field that has some number of link records. For each point to point link record, the m_linkData is the local IP address of the link. This corresponds to a destination IP address, reachable from the root, to which we add a host route.

Parameters
vthe vertex

Definition at line 2013 of file global-route-manager-impl.cc.

References ns3::GlobalRoutingLinkRecord< T >::GetLinkData(), ns3::GlobalRoutingLSA< T >::GetLinkRecord(), ns3::GlobalRoutingLSA< T >::GetLinkStateId(), ns3::GlobalRoutingLinkRecord< T >::GetLinkType(), ns3::GlobalRoutingLSA< T >::GetNLinkRecords(), ns3::GlobalRouteManager< T >::routerId, m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::GlobalRoutingLinkRecord< T >::PointToPoint, and v.

Referenced by SPFCalculate().

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

◆ SPFIntraAddStub()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::SPFIntraAddStub ( GlobalRoutingLinkRecord< IpManager > * l,
SPFVertex< T > * v )
private

Add a stub to the routing tables.

Parameters
lthe global routing link record
vthe vertex

Definition at line 1780 of file global-route-manager-impl.cc.

References ns3::GlobalRoutingLinkRecord< T >::GetLinkData(), ns3::GlobalRoutingLinkRecord< T >::GetLinkId(), ns3::GlobalRouteManager< T >::routerId, IsIpv4, m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, and v.

Referenced by SPFProcessStubs().

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

◆ SPFIntraAddTransit()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::SPFIntraAddTransit ( SPFVertex< T > * v)
private

Add a transit to the routing tables.

Parameters
vthe vertex

Definition at line 2163 of file global-route-manager-impl.cc.

References ns3::GlobalRoutingLSA< T >::GetLinkStateId(), ns3::GlobalRoutingLSA< T >::GetNetworkLSANetworkMask(), ns3::GlobalRouteManager< T >::routerId, IsIpv4, m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, and v.

Referenced by SPFCalculate().

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

◆ SPFNext()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::SPFNext ( SPFVertex< T > * v,
CandidateQueue< T > & candidate )
private

Examine the links in v's LSA and update the list of candidates with any vertices not already on the list.

Internal:

This method is derived from quagga ospf_spf_next (). See RFC2328 Section 16.1 (2) for further details.

We're passed a parameter v that is a vertex which is already in the SPF tree. A vertex represents a router node. We also get a reference to the SPF candidate queue, which is a priority queue containing the shortest paths to the networks we know about.

We examine the links in v's LSA and update the list of candidates with any vertices not already on the list. If a lower-cost path is found to a vertex already on the candidate list, store the new (lower) cost.

Parameters
vthe vertex
candidatethe SPF candidate queue

Definition at line 779 of file global-route-manager-impl.cc.

References ns3::CandidateQueue< T >::Find(), ns3::SPFVertex< T >::GetDistanceFromRoot(), ns3::GlobalRoutingLinkRecord< T >::GetLinkId(), ns3::GlobalRoutingLSA< T >::GetLinkStateId(), ns3::GlobalRoutingLinkRecord< T >::GetLinkType(), ns3::GlobalRoutingLinkRecord< T >::GetMetric(), ns3::GlobalRoutingLSA< T >::GetStatus(), ns3::SPFVertex< T >::GetVertexId(), ns3::GlobalRoutingLSA< T >::LSA_SPF_CANDIDATE, ns3::GlobalRoutingLSA< T >::LSA_SPF_IN_SPFTREE, ns3::GlobalRoutingLSA< T >::LSA_SPF_NOT_EXPLORED, m_lsdb, ns3::SPFVertex< T >::MergeParent(), ns3::SPFVertex< T >::MergeRootExitDirections(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::GlobalRoutingLinkRecord< T >::PointToPoint, ns3::CandidateQueue< T >::Push(), ns3::CandidateQueue< T >::Reorder(), ns3::GlobalRoutingLSA< T >::RouterLSA, ns3::GlobalRoutingLSA< T >::SetStatus(), SPFNexthopCalculation(), SPFVertexAddParent(), ns3::GlobalRoutingLinkRecord< T >::StubNetwork, ns3::GlobalRoutingLinkRecord< T >::TransitNetwork, v, ns3::SPFVertex< T >::VertexNetwork, and ns3::SPFVertex< T >::VertexRouter.

Referenced by SPFCalculate().

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

◆ SPFNexthopCalculation()

template<typename T>
int ns3::GlobalRouteManagerImpl< T >::SPFNexthopCalculation ( SPFVertex< T > * v,
SPFVertex< T > * w,
GlobalRoutingLinkRecord< IpManager > * l,
uint32_t distance )
private

Calculate nexthop from root through V (parent) to vertex W (destination) with given distance from root->W.

This method is derived from quagga ospf_nexthop_calculation() 16.1.1. For now, this is greatly simplified from the quagga code

Parameters
vthe parent
wthe destination
lthe link record
distancethe target distance
Returns
1 on success

Definition at line 1012 of file global-route-manager-impl.cc.

References FindOutgoingInterfaceId(), ns3::GlobalRoutingLinkRecord< T >::GetLinkData(), ns3::GlobalRoutingLinkRecord< T >::GetLinkLocData(), ns3::GlobalRoutingLSA< T >::GetLinkStateId(), ns3::SPFVertex< T >::GetLSA(), ns3::GlobalRoutingLSA< T >::GetLSType(), ns3::GlobalRoutingLSA< T >::GetNetworkLSANetworkMask(), ns3::SPFVertex< T >::GetVertexId(), ns3::SPFVertex< T >::GetVertexType(), ns3::SPFVertex< T >::InheritAllRootExitDirections(), IsIpv4, m_spfroot, ns3::GlobalRoutingLSA< T >::NetworkLSA, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::SPFVertex< T >::SetDistanceFromRoot(), ns3::SPFVertex< T >::SetParent(), ns3::SPFVertex< T >::SetRootExitDirection(), SPFGetNextLink(), v, ns3::SPFVertex< T >::VertexNetwork, and ns3::SPFVertex< T >::VertexRouter.

Referenced by SPFNext().

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

◆ SPFProcessStubs()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::SPFProcessStubs ( SPFVertex< T > * v)
private

Process Stub nodes.

Processing logic from RFC 2328, page 166 and quagga ospf_spf_process_stubs () stub link records will exist for point-to-point interfaces and for broadcast interfaces for which no neighboring router can be found

Parameters
vvertex to be processed

Definition at line 1745 of file global-route-manager-impl.cc.

References ns3::GlobalRoutingLinkRecord< T >::GetLinkId(), ns3::GlobalRoutingLSA< T >::GetLinkStateId(), ns3::GlobalRoutingLinkRecord< T >::GetLinkType(), ns3::GlobalRoutingLSA< T >::GetNLinkRecords(), NS_LOG_FUNCTION, NS_LOG_LOGIC, SPFIntraAddStub(), SPFProcessStubs(), ns3::GlobalRoutingLinkRecord< T >::StubNetwork, v, and ns3::SPFVertex< T >::VertexRouter.

Referenced by SPFCalculate(), and SPFProcessStubs().

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

◆ SPFVertexAddParent()

template<typename T>
void ns3::GlobalRouteManagerImpl< T >::SPFVertexAddParent ( SPFVertex< T > * v)
private

Adds a vertex to the list of children in each of its parents.

Derived from quagga ospf_vertex_add_parents ()

This is a somewhat oddly named method (blame quagga). Although you might expect it to add a parent to something, it actually adds a vertex to the list of children in each of its parents.

Given a pointer to a vertex, it links back to the vertex's parent that it already has set and adds itself to that vertex's list of children.

Parameters
vthe vertex

Definition at line 2282 of file global-route-manager-impl.cc.

References ns3::SPFVertex< T >::AddChild(), NS_LOG_FUNCTION, and v.

Referenced by SPFCalculate(), and SPFNext().

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

◆ ValidateSourceNodeHasIpAddress()

template<typename T>
bool ns3::GlobalRouteManagerImpl< T >::ValidateSourceNodeHasIpAddress ( Ptr< Ip > ip)
private

Is used by PrintRoute() to check if the source node has an ipv4 address.

Parameters
ipthe ip stack of the source node
Returns
true if the source node has an ipv4 address

Definition at line 2423 of file global-route-manager-impl.cc.

References NS_ABORT_MSG.

Referenced by PrintRoute().

Here is the caller graph for this function:

Member Data Documentation

◆ IsIpv4

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

◆ m_lsdb

template<typename T>
GlobalRouteManagerLSDB<IpManager>* ns3::GlobalRouteManagerImpl< T >::m_lsdb
private

the Link State DataBase (LSDB) of the Global Route Manager

Definition at line 914 of file global-route-manager-impl.h.

Referenced by GlobalRouteManagerImpl(), ~GlobalRouteManagerImpl(), CheckForStubNode(), DebugUseLsdb(), DeleteGlobalRoutes(), SPFCalculate(), and SPFNext().

◆ m_spfroot


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