A Discrete-Event Network Simulator
API
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
ns3::SPFVertex Class Reference

Vertex used in shortest path first (SPF) computations. More...

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

Public Types

typedef std::pair< Ipv4Address, int32_t > NodeExit_t
 IPv4 / interface container for exit nodes. More...
 
enum  VertexType { VertexUnknown = 0, VertexRouter, VertexNetwork }
 Enumeration of the possible types of SPFVertex objects. More...
 

Public Member Functions

 SPFVertex ()
 Construct an empty ("uninitialized") SPFVertex (Shortest Path First Vertex). More...
 
 SPFVertex (GlobalRoutingLSA *lsa)
 Construct an initialized SPFVertex (Shortest Path First Vertex). More...
 
 ~SPFVertex ()
 Destroy an SPFVertex (Shortest Path First Vertex). More...
 
uint32_t AddChild (SPFVertex *child)
 Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex. More...
 
void ClearVertexProcessed (void)
 Clear the value of the VertexProcessed flag. More...
 
SPFVertexGetChild (uint32_t n) const
 Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex. More...
 
uint32_t GetDistanceFromRoot (void) const
 Get the distance from the root vertex to "this" SPFVertex object. More...
 
GlobalRoutingLSAGetLSA (void) const
 Get the Global Router Link State Advertisement returned by the Global Router represented by this SPFVertex during the route discovery process. More...
 
uint32_t GetNChildren (void) const
 Get the number of children of "this" SPFVertex. More...
 
uint32_t GetNRootExitDirections () const
 Get the number of exit directions from root for reaching 'this' vertex. More...
 
SPFVertexGetParent (uint32_t i=0) const
 Get a pointer to the SPFVector that is the parent of "this" SPFVertex. More...
 
NodeExit_t GetRootExitDirection (uint32_t i) const
 Obtain a pair indicating the exit direction from the root. More...
 
NodeExit_t GetRootExitDirection () const
 Obtain a pair indicating the exit direction from the root. More...
 
Ipv4Address GetVertexId (void) const
 Get the Vertex ID field of a SPFVertex object. More...
 
VertexType GetVertexType (void) const
 Get the Vertex Type field of a SPFVertex object. More...
 
void InheritAllRootExitDirections (const SPFVertex *vertex)
 Inherit all root exit directions from a given vertex to 'this' vertex. More...
 
bool IsVertexProcessed (void) const
 Check the value of the VertexProcessed flag. More...
 
void MergeParent (const SPFVertex *v)
 Merge the Parent list from the v into this vertex. More...
 
void MergeRootExitDirections (const SPFVertex *vertex)
 Merge into 'this' vertex the list of exit directions from another vertex. More...
 
void SetDistanceFromRoot (uint32_t distance)
 Set the distance from the root vertex to "this" SPFVertex object. More...
 
void SetLSA (GlobalRoutingLSA *lsa)
 Set the Global Router Link State Advertisement returned by the Global Router represented by this SPFVertex during the route discovery process. More...
 
void SetParent (SPFVertex *parent)
 Set the pointer to the SPFVector that is the parent of "this" SPFVertex. More...
 
void SetRootExitDirection (Ipv4Address nextHop, int32_t id=SPF_INFINITY)
 Set the IP address and outgoing interface index that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex. More...
 
void SetRootExitDirection (SPFVertex::NodeExit_t exit)
 Set the IP address and outgoing interface index that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex. More...
 
void SetVertexId (Ipv4Address id)
 Set the Vertex ID field of a SPFVertex object. More...
 
void SetVertexProcessed (bool value)
 Set the value of the VertexProcessed flag. More...
 
void SetVertexType (VertexType type)
 Set the Vertex Type field of a SPFVertex object. More...
 

Private Types

typedef std::list< NodeExit_tListOfNodeExit_t
 container of Exit nodes More...
 
typedef std::list< SPFVertex * > ListOfSPFVertex_t
 container of SPFVertexes More...
 

Private Member Functions

 SPFVertex (SPFVertex &v)
 The SPFVertex copy construction is disallowed. More...
 
SPFVertexoperator= (SPFVertex &v)
 The SPFVertex copy assignment operator is disallowed. More...
 

Private Attributes

ListOfSPFVertex_t m_children
 Children list. More...
 
uint32_t m_distanceFromRoot
 Distance from root node. More...
 
ListOfNodeExit_t m_ecmpRootExits
 store the multiple root's exits for supporting ECMP More...
 
GlobalRoutingLSAm_lsa
 Link State Advertisement. More...
 
Ipv4Address m_nextHop
 next hop More...
 
ListOfSPFVertex_t m_parents
 parent list More...
 
int32_t m_rootOif
 root Output Interface More...
 
Ipv4Address m_vertexId
 Vertex ID. More...
 
bool m_vertexProcessed
 Flag to note whether vertex has been processed in stage two of SPF computation. More...
 
VertexType m_vertexType
 Vertex type. More...
 

Friends

std::ostream & operator<< (std::ostream &os, const SPFVertex::ListOfSPFVertex_t &vs)
 Stream insertion operator. More...
 

Detailed Description

Vertex used in shortest path first (SPF) computations.

See RFC 2328, Section 16.

Each router in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes. Each of these routers in the calculation has an associated SPFVertex.

The "Root" vertex is the SPFVertex representing the router that is having its routing tables set. The SPFVertex objects representing other routers or networks in the simulation are arranged in the SPF tree. It is this tree that represents the Shortest Paths to the other networks.

Each SPFVertex has a pointer to the Global Router Link State Advertisement (LSA) that its underlying router has exported. Within these LSAs are Global Router Link Records that describe the point to point links from the underlying router to other nodes (represented by other SPFVertex objects) in the simulation topology. The combination of the arrangement of the SPFVertex objects in the SPF tree, along with the details of the link records that connect them provide the information required to construct the required routes.

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

Member Typedef Documentation

◆ ListOfNodeExit_t

container of Exit nodes

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

◆ ListOfSPFVertex_t

container of SPFVertexes

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

◆ NodeExit_t

typedef std::pair<Ipv4Address, int32_t> ns3::SPFVertex::NodeExit_t

IPv4 / interface container for exit nodes.

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

Member Enumeration Documentation

◆ VertexType

Enumeration of the possible types of SPFVertex objects.

Currently we use VertexRouter to identify objects that represent a router in the simulation topology, and VertexNetwork to identify objects that represent a network.

Enumerator
VertexUnknown 

Uninitialized Link Record.

VertexRouter 

Vertex representing a router in the topology.

VertexNetwork 

Vertex representing a network in the topology.

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

Constructor & Destructor Documentation

◆ SPFVertex() [1/3]

ns3::SPFVertex::SPFVertex ( )

Construct an empty ("uninitialized") SPFVertex (Shortest Path First Vertex).

The Vertex Type is set to VertexUnknown, the Vertex ID is set to 255.255.255.255, and the distance from root is set to infinity (UINT32_MAX). The referenced Link State Advertisement (LSA) is set to null as is the parent SPFVertex. The outgoing interface index is set to infinity, the next hop address is set to 0.0.0.0 and the list of children of the SPFVertex is initialized to empty.

See also
VertexType

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

References NS_LOG_FUNCTION.

◆ SPFVertex() [2/3]

ns3::SPFVertex::SPFVertex ( GlobalRoutingLSA lsa)

Construct an initialized SPFVertex (Shortest Path First Vertex).

The Vertex Type is initialized to VertexRouter and the Vertex ID is found from the Link State ID of the Link State Advertisement (LSA) passed as a parameter. The Link State ID is set to the Router ID of the advertising router. The referenced LSA (m_lsa) is set to the given LSA. Other than these members, initialization is as in the default constructor. of the SPFVertex is initialized to empty.

See also
SPFVertex::SPFVertex ()
VertexType
GlobalRoutingLSA
Parameters
lsaThe Link State Advertisement used for finding initial values.

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

References ns3::GlobalRoutingLSA::GetLSType(), m_vertexType, ns3::GlobalRoutingLSA::NetworkLSA, NS_LOG_FUNCTION, NS_LOG_LOGIC(), ns3::GlobalRoutingLSA::RouterLSA, VertexNetwork, and VertexRouter.

◆ ~SPFVertex()

ns3::SPFVertex::~SPFVertex ( )

Destroy an SPFVertex (Shortest Path First Vertex).

The children vertices of the SPFVertex are recursively deleted.

See also
SPFVertex::SPFVertex ()

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

References GetVertexId(), m_children, m_ecmpRootExits, m_parents, m_vertexId, NS_ASSERT_MSG(), NS_LOG_FUNCTION, and NS_LOG_LOGIC().

◆ SPFVertex() [3/3]

ns3::SPFVertex::SPFVertex ( SPFVertex v)
private

The SPFVertex copy construction is disallowed.

There's no need for it and a compiler provided shallow copy would be wrong.

Parameters
vobject to copy from

Member Function Documentation

◆ AddChild()

uint32_t ns3::SPFVertex::AddChild ( SPFVertex child)

Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.

Each router node in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes.

The "Root" vertex is then the SPFVertex representing the router that is having its routing tables set and is the root of the SPF tree. Each vertex in the SPF tree can have a number of children that represent host or network routes available via that vertex.

This method the number of children of "this" SPFVertex (which reside in the SPF tree.

See also
SPFVertex::GetNChildren
Warning
Ownership of the pointer added to the children of "this" SPFVertex is transferred to the "this" SPFVertex. You must not delete the (now) child SPFVertex after calling this method.
Parameters
childA pointer to the SPFVertex (which resides in the SPF tree) to be added to the list of children of "this" SPFVertex.
Returns
The number of children of "this" SPFVertex after the addition of the new child.

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

References m_children, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl::SPFVertexAddParent().

◆ ClearVertexProcessed()

void ns3::SPFVertex::ClearVertexProcessed ( void  )

Clear the value of the VertexProcessed flag.

Flag to note whether vertex has been processed in stage two of SPF computation

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

References ClearVertexProcessed(), GetChild(), GetNChildren(), NS_LOG_FUNCTION, and SetVertexProcessed().

Referenced by ClearVertexProcessed(), and ns3::GlobalRouteManagerImpl::SPFCalculate().

◆ GetChild()

SPFVertex * ns3::SPFVertex::GetChild ( uint32_t  n) const

Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.

Each router node in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes.

The "Root" vertex is then the SPFVertex representing the router that is having its routing tables set and is the root of the SPF tree. Each vertex in the SPF tree can have a number of children that represent host or network routes available via that vertex.

This method the number of children of "this" SPFVertex (which reside in the SPF tree.

See also
SPFVertex::GetNChildren
Parameters
nThe index (from 0 to the number of children minus 1) of the child SPFVertex to return.
Warning
The pointer returned by GetChild () is a borrowed pointer. You do not have any ownership of the underlying object and must not delete that object.
Returns
A pointer to the specified child SPFVertex (which resides in the SPF tree).

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

References m_children, sample-rng-plot::n, NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

Referenced by ClearVertexProcessed(), ns3::GlobalRouteManagerImpl::ProcessASExternals(), and ns3::GlobalRouteManagerImpl::SPFProcessStubs().

◆ GetDistanceFromRoot()

uint32_t ns3::SPFVertex::GetDistanceFromRoot ( void  ) const

Get the distance from the root vertex to "this" SPFVertex object.

Each router in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes. Each of these routers in the calculation has an associated SPFVertex.

The "Root" vertex is then the SPFVertex representing the router that is having its routing tables set. The "this" SPFVertex is the vertex to which a route is being calculated from the root. The distance from the root that we're asking for is the number of hops from the root vertex to the vertex in question.

The distance is calculated during route discovery and is stored in a member variable. This method simply fetches that value.

Returns
The distance, in hops, from the root SPFVertex to "this" SPFVertex.

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

References m_distanceFromRoot, and NS_LOG_FUNCTION.

Referenced by ns3::CandidateQueue::CompareSPFVertex(), and ns3::GlobalRouteManagerImpl::SPFNext().

◆ GetLSA()

GlobalRoutingLSA * ns3::SPFVertex::GetLSA ( void  ) const

◆ GetNChildren()

uint32_t ns3::SPFVertex::GetNChildren ( void  ) const

Get the number of children of "this" SPFVertex.

Each router node in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes.

The "Root" vertex is then the SPFVertex representing the router that is having its routing tables set and is the root of the SPF tree. Each vertex in the SPF tree can have a number of children that represent host or network routes available via that vertex.

This method returns the number of children of "this" SPFVertex (which reside in the SPF tree).

Returns
The number of children of "this" SPFVertex (which reside in the SPF tree).

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

References m_children, and NS_LOG_FUNCTION.

Referenced by ClearVertexProcessed(), ns3::GlobalRouteManagerImpl::ProcessASExternals(), and ns3::GlobalRouteManagerImpl::SPFProcessStubs().

◆ GetNRootExitDirections()

uint32_t ns3::SPFVertex::GetNRootExitDirections ( ) const

Get the number of exit directions from root for reaching 'this' vertex.

Returns
The number of exit directions from root

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

References m_ecmpRootExits, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl::SPFAddASExternal(), ns3::GlobalRouteManagerImpl::SPFIntraAddRouter(), ns3::GlobalRouteManagerImpl::SPFIntraAddStub(), and ns3::GlobalRouteManagerImpl::SPFIntraAddTransit().

◆ GetParent()

SPFVertex * ns3::SPFVertex::GetParent ( uint32_t  i = 0) const

Get a pointer to the SPFVector that is the parent of "this" SPFVertex.

Each router node in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes.

The "Root" vertex is then the SPFVertex representing the router that is having its routing tables set and is the root of the SPF tree.

This method returns a pointer to the parent node of "this" SPFVertex (both of which reside in that SPF tree).

Parameters
iThe index to one of the parents
Returns
A pointer to the SPFVertex that is the parent of "this" SPFVertex in the SPF tree.

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

References m_parents, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by ns3::GlobalRouteManagerImpl::SPFNexthopCalculation(), and ns3::GlobalRouteManagerImpl::SPFVertexAddParent().

◆ GetRootExitDirection() [1/2]

SPFVertex::NodeExit_t ns3::SPFVertex::GetRootExitDirection ( uint32_t  i) const

Obtain a pair indicating the exit direction from the root.

Parameters
iAn index to a pair
Returns
A pair of next-hop-IP and outgoing-interface-index for indicating an exit direction from the root. It is 0 if the index 'i' is out-of-range

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

References m_ecmpRootExits, NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl::SPFAddASExternal(), ns3::GlobalRouteManagerImpl::SPFIntraAddRouter(), ns3::GlobalRouteManagerImpl::SPFIntraAddStub(), ns3::GlobalRouteManagerImpl::SPFIntraAddTransit(), and ns3::GlobalRouteManagerImpl::SPFNexthopCalculation().

◆ GetRootExitDirection() [2/2]

SPFVertex::NodeExit_t ns3::SPFVertex::GetRootExitDirection ( ) const

Obtain a pair indicating the exit direction from the root.

This method assumes there is only a single exit direction from the root. Error occur if this assumption is invalid.

Returns
The pair of next-hop-IP and outgoing-interface-index for reaching 'this' vertex from the root

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

References m_ecmpRootExits, NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

◆ GetVertexId()

Ipv4Address ns3::SPFVertex::GetVertexId ( void  ) const

Get the Vertex ID field of a SPFVertex object.

The Vertex ID uniquely identifies the simulation object a given SPFVertex represents. Typically, this is the Router ID for SPFVertex objects representing routers, and comes from the Link State Advertisement of a router aggregated to a node in the simulation. These IDs are allocated automatically by the routing environment and look like IP addresses beginning at 0.0.0.0 and monotonically increasing as new routers are instantiated.

Returns
The Ipv4Address Vertex ID of the current SPFVertex object.

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

References m_vertexId, and NS_LOG_FUNCTION.

Referenced by ns3::CandidateQueue::Find(), ns3::GlobalRouteManagerImpl::FindOutgoingInterfaceId(), ns3::GlobalRouteManagerImpl::ProcessASExternals(), ns3::GlobalRouteManagerImpl::SPFAddASExternal(), ns3::GlobalRouteManagerImpl::SPFGetNextLink(), ns3::GlobalRouteManagerImpl::SPFIntraAddRouter(), ns3::GlobalRouteManagerImpl::SPFIntraAddStub(), ns3::GlobalRouteManagerImpl::SPFIntraAddTransit(), ns3::GlobalRouteManagerImpl::SPFNext(), ns3::GlobalRouteManagerImpl::SPFNexthopCalculation(), ns3::GlobalRouteManagerImpl::SPFProcessStubs(), and ~SPFVertex().

◆ GetVertexType()

SPFVertex::VertexType ns3::SPFVertex::GetVertexType ( void  ) const

Get the Vertex Type field of a SPFVertex object.

The Vertex Type describes the kind of simulation object a given SPFVertex represents.

See also
VertexType
Returns
The VertexType of the current SPFVertex object.

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

References m_vertexType, and NS_LOG_FUNCTION.

Referenced by ns3::CandidateQueue::CompareSPFVertex(), ns3::GlobalRouteManagerImpl::ProcessASExternals(), ns3::GlobalRouteManagerImpl::SPFNext(), ns3::GlobalRouteManagerImpl::SPFNexthopCalculation(), and ns3::GlobalRouteManagerImpl::SPFProcessStubs().

◆ InheritAllRootExitDirections()

void ns3::SPFVertex::InheritAllRootExitDirections ( const SPFVertex vertex)

Inherit all root exit directions from a given vertex to 'this' vertex.

Parameters
vertexThe vertex from which all root exit directions are to be inherited

After the call of this method, the original root exit directions in 'this' vertex are all lost.

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

References m_ecmpRootExits, NS_LOG_FUNCTION, and NS_LOG_WARN.

Referenced by ns3::GlobalRouteManagerImpl::SPFNexthopCalculation().

◆ IsVertexProcessed()

bool ns3::SPFVertex::IsVertexProcessed ( void  ) const

Check the value of the VertexProcessed flag.

Flag to note whether vertex has been processed in stage two of SPF computation

Returns
value of underlying flag

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

References m_vertexProcessed, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl::ProcessASExternals(), and ns3::GlobalRouteManagerImpl::SPFProcessStubs().

◆ MergeParent()

void ns3::SPFVertex::MergeParent ( const SPFVertex v)

Merge the Parent list from the v into this vertex.

Parameters
vThe vertex from which its list of Parent is read and then merged into the list of Parent of this vertex. Note that the list in v remains intact

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

References m_parents, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by ns3::GlobalRouteManagerImpl::SPFNext().

◆ MergeRootExitDirections()

void ns3::SPFVertex::MergeRootExitDirections ( const SPFVertex vertex)

Merge into 'this' vertex the list of exit directions from another vertex.

This merge is necessary when ECMP are found.

Parameters
vertexFrom which the list of exit directions are obtain and are merged into 'this' vertex

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

References m_ecmpRootExits, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl::SPFNext().

◆ operator=()

SPFVertex& ns3::SPFVertex::operator= ( SPFVertex v)
private

The SPFVertex copy assignment operator is disallowed.

There's no need for it and a compiler provided shallow copy would be wrong.

Parameters
vobject to copy from
Returns
the copied object

◆ SetDistanceFromRoot()

void ns3::SPFVertex::SetDistanceFromRoot ( uint32_t  distance)

Set the distance from the root vertex to "this" SPFVertex object.

Each router in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes. Each of these routers in the calculation has an associated SPFVertex.

The "Root" vertex is then the SPFVertex representing the router that is having its routing tables set. The "this" SPFVertex is the vertex to which a route is being calculated from the root. The distance from the root that we're asking for is the number of hops from the root vertex to the vertex in question.

Parameters
distanceThe distance, in hops, from the root SPFVertex to "this" SPFVertex.

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

References m_distanceFromRoot, and NS_LOG_FUNCTION.

Referenced by GlobalRouteManagerImplTestCase::DoRun(), ns3::GlobalRouteManagerImpl::SPFCalculate(), and ns3::GlobalRouteManagerImpl::SPFNexthopCalculation().

◆ SetLSA()

void ns3::SPFVertex::SetLSA ( GlobalRoutingLSA lsa)

Set the Global Router Link State Advertisement returned by the Global Router represented by this SPFVertex during the route discovery process.

See also
SPFVertex::GetLSA ()
GlobalRouter
GlobalRoutingLSA
GlobalRouter::DiscoverLSAs ()
Warning
Ownership of the LSA is transferred to the "this" SPFVertex. You must not delete the LSA after calling this method.
Parameters
lsaA pointer to the GlobalRoutingLSA.

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

References m_lsa, and NS_LOG_FUNCTION.

◆ SetParent()

void ns3::SPFVertex::SetParent ( SPFVertex parent)

Set the pointer to the SPFVector that is the parent of "this" SPFVertex.

Each router node in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes.

The "Root" vertex is then the SPFVertex representing the router that is having its routing tables set and is the root of the SPF tree.

This method sets the parent pointer of "this" SPFVertex (both of which reside in that SPF tree).

Parameters
parentA pointer to the SPFVertex that is the parent of "this" SPFVertex* in the SPF tree.

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

References m_parents, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl::SPFNexthopCalculation().

◆ SetRootExitDirection() [1/2]

void ns3::SPFVertex::SetRootExitDirection ( Ipv4Address  nextHop,
int32_t  id = SPF_INFINITY 
)

Set the IP address and outgoing interface index that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex.

Each router node in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes.

The "Root" vertex is then the SPFVertex representing the router that is having its routing tables set. The "this" SPFVertex is the vertex that represents the host or network to which a route is being calculated from the root. The IP address that we're asking for is the address on the remote side of a link off of the root node that should be used as the destination for packets along the path to "this" vertex.

When initializing the root SPFVertex, the IP address used when forwarding packets is determined by examining the Global Router Link Records of the Link State Advertisement generated by the root node's GlobalRouter. This address is used to forward packets off of the root's network down those links. As other vertices / nodes are discovered which are further away from the root, they will be accessible down one of the paths via a link described by one of these Global Router Link Records.

To forward packets to these hosts or networks, the root node must begin the forwarding process by sending the packets to a first hop router down an interface. This means that the first hop address and interface ID must be the same for all downstream SPFVertices. We call this "inheriting" the interface and next hop.

In this method we are telling the root node which exit direction it should send should I send a packet to the network or host represented by 'this' SPFVertex.

See also
GlobalRouter
GlobalRoutingLSA
GlobalRoutingLinkRecord
Parameters
nextHopThe IP address to use when forwarding packets to the host or network represented by "this" SPFVertex.
idThe interface index to use when forwarding packets to the host or network represented by "this" SPFVertex.

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

References m_ecmpRootExits, m_nextHop, m_rootOif, and NS_LOG_FUNCTION.

Referenced by SetRootExitDirection(), and ns3::GlobalRouteManagerImpl::SPFNexthopCalculation().

◆ SetRootExitDirection() [2/2]

void ns3::SPFVertex::SetRootExitDirection ( SPFVertex::NodeExit_t  exit)

Set the IP address and outgoing interface index that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex.

Each router node in the simulation is associated with an SPFVertex object. When calculating routes, each of these routers is, in turn, chosen as the "root" of the calculation and routes to all of the other routers are eventually saved in the routing tables of each of the chosen nodes.

The "Root" vertex is then the SPFVertex representing the router that is having its routing tables set. The "this" SPFVertex is the vertex that represents the host or network to which a route is being calculated from the root. The IP address that we're asking for is the address on the remote side of a link off of the root node that should be used as the destination for packets along the path to "this" vertex.

When initializing the root SPFVertex, the IP address used when forwarding packets is determined by examining the Global Router Link Records of the Link State Advertisement generated by the root node's GlobalRouter. This address is used to forward packets off of the root's network down those links. As other vertices / nodes are discovered which are further away from the root, they will be accessible down one of the paths via a link described by one of these Global Router Link Records.

To forward packets to these hosts or networks, the root node must begin the forwarding process by sending the packets to a first hop router down an interface. This means that the first hop address and interface ID must be the same for all downstream SPFVertices. We call this "inheriting" the interface and next hop.

In this method we are telling the root node which exit direction it should send should I send a packet to the network or host represented by 'this' SPFVertex.

See also
GlobalRouter
GlobalRoutingLSA
GlobalRoutingLinkRecord
Parameters
exitThe pair of next-hop-IP and outgoing-interface-index to use when forwarding packets to the host or network represented by "this" SPFVertex.

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

References NS_LOG_FUNCTION, and SetRootExitDirection().

◆ SetVertexId()

void ns3::SPFVertex::SetVertexId ( Ipv4Address  id)

Set the Vertex ID field of a SPFVertex object.

The Vertex ID uniquely identifies the simulation object a given SPFVertex represents. Typically, this is the Router ID for SPFVertex objects representing routers, and comes from the Link State Advertisement of a router aggregated to a node in the simulation. These IDs are allocated automatically by the routing environment and look like IP addresses beginning at 0.0.0.0 and monotonically increase as new routers are instantiated. This method is an explicit override of the automatically generated value.

Parameters
idThe new Ipv4Address Vertex ID for the current SPFVertex object.

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

References m_vertexId, and NS_LOG_FUNCTION.

◆ SetVertexProcessed()

void ns3::SPFVertex::SetVertexProcessed ( bool  value)

Set the value of the VertexProcessed flag.

Flag to note whether vertex has been processed in stage two of SPF computation

Parameters
valueboolean value to set the flag

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

References m_vertexProcessed, and NS_LOG_FUNCTION.

Referenced by ClearVertexProcessed(), ns3::GlobalRouteManagerImpl::ProcessASExternals(), and ns3::GlobalRouteManagerImpl::SPFProcessStubs().

◆ SetVertexType()

void ns3::SPFVertex::SetVertexType ( SPFVertex::VertexType  type)

Set the Vertex Type field of a SPFVertex object.

The Vertex Type describes the kind of simulation object a given SPFVertex represents.

See also
VertexType
Parameters
typeThe new VertexType for the current SPFVertex object.

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

References m_vertexType, and NS_LOG_FUNCTION.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const SPFVertex::ListOfSPFVertex_t vs 
)
friend

Stream insertion operator.

Parameters
osthe reference to the output stream
vsa list of SPFVertexes
Returns
the reference to the output stream

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

Member Data Documentation

◆ m_children

ListOfSPFVertex_t ns3::SPFVertex::m_children
private

Children list.

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

Referenced by AddChild(), GetChild(), GetNChildren(), and ~SPFVertex().

◆ m_distanceFromRoot

uint32_t ns3::SPFVertex::m_distanceFromRoot
private

Distance from root node.

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

Referenced by GetDistanceFromRoot(), and SetDistanceFromRoot().

◆ m_ecmpRootExits

ListOfNodeExit_t ns3::SPFVertex::m_ecmpRootExits
private

store the multiple root's exits for supporting ECMP

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

Referenced by GetNRootExitDirections(), GetRootExitDirection(), InheritAllRootExitDirections(), MergeRootExitDirections(), SetRootExitDirection(), and ~SPFVertex().

◆ m_lsa

GlobalRoutingLSA* ns3::SPFVertex::m_lsa
private

Link State Advertisement.

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

Referenced by GetLSA(), and SetLSA().

◆ m_nextHop

Ipv4Address ns3::SPFVertex::m_nextHop
private

next hop

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

Referenced by SetRootExitDirection().

◆ m_parents

ListOfSPFVertex_t ns3::SPFVertex::m_parents
private

parent list

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

Referenced by GetParent(), MergeParent(), SetParent(), and ~SPFVertex().

◆ m_rootOif

int32_t ns3::SPFVertex::m_rootOif
private

root Output Interface

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

Referenced by SetRootExitDirection().

◆ m_vertexId

Ipv4Address ns3::SPFVertex::m_vertexId
private

Vertex ID.

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

Referenced by GetVertexId(), SetVertexId(), and ~SPFVertex().

◆ m_vertexProcessed

bool ns3::SPFVertex::m_vertexProcessed
private

Flag to note whether vertex has been processed in stage two of SPF computation.

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

Referenced by IsVertexProcessed(), and SetVertexProcessed().

◆ m_vertexType

VertexType ns3::SPFVertex::m_vertexType
private

Vertex type.

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

Referenced by GetVertexType(), SetVertexType(), and SPFVertex().


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