Vertex used in shortest path first (SPF) computations. See RFC 2328, Section 16. More...
#include <global-route-manager-impl.h>
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. | |
GlobalRoutingLSA * | GetLSA (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. | |
uint32_t | GetOutgoingInterfaceId (void) const NS_DEPRECATED |
Get the interface ID that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex. | |
void | SetOutgoingInterfaceId (int32_t id) NS_DEPRECATED |
Set the interface ID that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex. | |
Ipv4Address | GetNextHop (void) const NS_DEPRECATED |
Get the IP address that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex. | |
void | SetNextHop (Ipv4Address nextHop) NS_DEPRECATED |
Set the IP address that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex. | |
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. | |
SPFVertex * | GetParent (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. | |
SPFVertex * | GetChild (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) |
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.
Enumeration of the possible types of SPFVertex objects.
Ipv4Address ns3::SPFVertex::GetNextHop | ( | void | ) | const |
Get the IP address that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex.
uint32_t ns3::SPFVertex::GetNRootExitDirections | ( | ) | const |
Get the number of exit directions from root for reaching 'this' vertex.
uint32_t ns3::SPFVertex::GetOutgoingInterfaceId | ( | void | ) | const |
Get the interface ID that should be used to begin forwarding packets from the root SPFVertex to "this" 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.
NodeExit_t ns3::SPFVertex::GetRootExitDirection | ( | uint32_t | i | ) | const |
Obtain a pair indicating the exit direction from the root.
i | An index to a pair |
void ns3::SPFVertex::InheritAllRootExitDirections | ( | const SPFVertex * | vertex | ) |
Inherit all root exit directions from a given vertex to 'this' vertex.
vertex | The vertex from which all root exit directions are to be inherrited |
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
void ns3::SPFVertex::MergeParent | ( | const SPFVertex * | v | ) |
Merge the Parent list from the v into this vertex.
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.
vertex | From which the list of exit directions are obtain and are merged into 'this' vertex |
void ns3::SPFVertex::SetNextHop | ( | Ipv4Address | nextHop | ) |
Set the IP address that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex.
void ns3::SPFVertex::SetOutgoingInterfaceId | ( | int32_t | id | ) |
Set the interface ID that should be used to begin forwarding packets from the root SPFVertex to "this" SPFVertex.
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
value | boolean value to set the flag |