Public Types | Public Member Functions | Friends

ns3::SPFVertex Class Reference

Vertex used in shortest path first (SPF) computations. See RFC 2328, Section 16. More...

#include <global-route-manager-impl.h>

Collaboration diagram for ns3::SPFVertex:
Collaboration graph
[legend]

List of all members.

Public Types

enum  VertexType { VertexUnknown = 0, VertexRouter, VertexNetwork }
 

Enumeration of the possible types of SPFVertex objects.

More...
typedef std::pair< Ipv4Address,
int32_t > 
NodeExit_t

Public Member Functions

 SPFVertex ()
 Construct an empty ("uninitialized") SPFVertex (Shortest Path First Vertex).
 SPFVertex (GlobalRoutingLSA *lsa)
 Construct an initialized SPFVertex (Shortest Path First Vertex).
 ~SPFVertex ()
 Destroy an SPFVertex (Shortest Path First Vertex).
VertexType GetVertexType (void) const
 Get the Vertex Type field of a SPFVertex object.
void SetVertexType (VertexType type)
 Set the Vertex Type field of a SPFVertex object.
Ipv4Address GetVertexId (void) const
 Get the Vertex ID field of a SPFVertex object.
void SetVertexId (Ipv4Address id)
 Set the Vertex ID field of a SPFVertex object.
GlobalRoutingLSAGetLSA (void) const
 Get the Global Router Link State Advertisement returned by the Global Router represented by this SPFVertex during the route discovery process.
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.
uint32_t GetDistanceFromRoot (void) const
 Get the distance from the root vertex to "this" SPFVertex object.
void SetDistanceFromRoot (uint32_t distance)
 Set the distance from the root vertex to "this" SPFVertex object.
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.
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.
NodeExit_t GetRootExitDirection (uint32_t i) const
 Obtain a pair indicating the exit direction from the root.
NodeExit_t GetRootExitDirection () const
 Obtain a pair indicating the exit direction from the root.
void MergeRootExitDirections (const SPFVertex *vertex)
 Merge into 'this' vertex the list of exit directions from another vertex.
void InheritAllRootExitDirections (const SPFVertex *vertex)
 Inherit all root exit directions from a given vertex to 'this' vertex.
uint32_t GetNRootExitDirections () const
 Get the number of exit directions from root for reaching 'this' vertex.
SPFVertexGetParent (uint32_t i=0) const
 Get a pointer to the SPFVector that is the parent of "this" SPFVertex.
void SetParent (SPFVertex *parent)
 Set the pointer to the SPFVector that is the parent of "this" SPFVertex.
void MergeParent (const SPFVertex *v)
 Merge the Parent list from the v into this vertex.
uint32_t GetNChildren (void) const
 Get the number of children of "this" SPFVertex.
SPFVertexGetChild (uint32_t n) const
 Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.
uint32_t AddChild (SPFVertex *child)
 Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.
void SetVertexProcessed (bool value)
 Set the value of the VertexProcessed flag.
bool IsVertexProcessed (void) const
 Check the value of the VertexProcessed flag.
void ClearVertexProcessed (void)

Friends

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

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.


Member Enumeration Documentation

Enumeration of the possible types of SPFVertex objects.

Enumerator:
VertexUnknown 

Uninitialized Link Record

VertexRouter 

Vertex representing a router in the topology

VertexNetwork 

Vertex representing a network in the topology


Member Function Documentation

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
NodeExit_t ns3::SPFVertex::GetRootExitDirection ( uint32_t  i  )  const

Obtain a pair indicating the exit direction from the root.

Parameters:
i An 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
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
void ns3::SPFVertex::InheritAllRootExitDirections ( const SPFVertex vertex  ) 

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

Parameters:
vertex The 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.

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
void ns3::SPFVertex::MergeParent ( const SPFVertex v  ) 

Merge the Parent list from the v into this vertex.

Parameters:
v The 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
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:
vertex From which the list of exit directions are obtain and are merged into 'this' vertex
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:
value boolean value to set the flag

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