21#include "ns3/assert.h"
22#include "ns3/fatal-error.h"
24#include "ns3/node-list.h"
25#include "ns3/simulator.h"
49 os <<
"(" << exit.first <<
" ," << exit.second <<
")";
57 for (
auto iter = vs.begin(); iter != vs.end();)
59 os << (*iter)->m_vertexId;
60 if (++iter != vs.end())
132 uint32_t orgCount = (*piter)->m_children.size();
133 (*piter)->m_children.remove(
this);
134 uint32_t newCount = (*piter)->m_children.size();
137 "Unable to find the current vertex from its parents --- impossible!");
244 NS_LOG_LOGIC(
"Index to SPFVertex's parent is out-of-range.");
296 "Index out-of-range when accessing SPFVertex::m_ecmpRootExits!");
312 "Assumed there is at most one exit from the root to this vertex");
339 NS_LOG_WARN(
"x root exit directions in this vertex are going to be discarded");
497 if (i->first == addr)
576 uint32_t nRoutes = gr->GetNRoutes();
577 NS_LOG_LOGIC(
"Deleting " << gr->GetNRoutes() <<
" routes from node " << node->GetId());
581 for (j = 0; j < nRoutes; j++)
583 NS_LOG_LOGIC(
"Deleting global route " << j <<
" from node " << node->GetId());
586 NS_LOG_LOGIC(
"Deleted " << j <<
" global routes from node " << node->GetId());
634 uint32_t numLSAs = rtr->DiscoverLSAs();
637 for (
uint32_t j = 0; j < numLSAs; ++j)
644 rtr->GetLSA(j, *lsa);
649 m_lsdb->Insert(lsa->GetLinkStateId(), lsa);
706 if (node->GetSystemId() != systemId)
715 if (rtr && rtr->GetNumLSAs())
752 numRecordsInVertex =
v->GetLSA()->GetNLinkRecords();
756 numRecordsInVertex =
v->GetLSA()->GetNAttachedRouters();
760 for (
uint32_t i = 0; i < numRecordsInVertex; i++)
765 NS_LOG_LOGIC(
"Examining link " << i <<
" of " <<
v->GetVertexId() <<
"'s "
766 <<
v->GetLSA()->GetNLinkRecords() <<
" link records");
772 l =
v->GetLSA()->GetLinkRecord(i);
792 NS_LOG_LOGIC(
"Found a P2P record from " <<
v->GetVertexId() <<
" to "
799 NS_LOG_LOGIC(
"Found a Transit record from " <<
v->GetVertexId() <<
" to "
810 w_lsa =
m_lsdb->GetLSAByLinkData(
v->GetLSA()->GetAttachedRouter(i));
815 NS_LOG_LOGIC(
"Found a Network LSA from " <<
v->GetVertexId() <<
" to "
841 distance =
v->GetDistanceFromRoot() + l->
GetMetric();
845 distance =
v->GetDistanceFromRoot();
870 <<
", parent vertexId: " <<
v->GetVertexId()
875 NS_ASSERT_MSG(0,
"SPFNexthopCalculation never return false, but it does now!");
1057 <<
" goes through next hop " << nextHop
1058 <<
" via outgoing interface " << outIf
1059 <<
" with distance " << distance);
1076 <<
" via outgoing interface " << outIf
1077 <<
" with distance " << distance);
1101 uint32_t outIf =
v->GetRootExitDirection().second;
1104 <<
" goes through next hop " << nextHop
1105 <<
" via outgoing interface " << outIf);
1159 bool found_prev_link =
false;
1165 if (prev_link ==
nullptr)
1168 found_prev_link =
true;
1175 for (
uint32_t i = 0; i <
v->GetLSA()->GetNLinkRecords(); ++i)
1177 l =
v->GetLSA()->GetLinkRecord(i);
1188 if (!found_prev_link)
1191 found_prev_link =
true;
1264 NS_LOG_WARN(
"all nodes should have at least one transit link:" << root);
1277 NS_LOG_LOGIC(
"TBD: Would have inserted default for transit");
1287 for (
uint32_t j = 0; j < nLinkRecords; ++j)
1310 << myRouterId <<
" to next hop " << lr->
GetLinkData()
1311 <<
" via interface "
1350 v->SetDistanceFromRoot(0);
1352 NS_LOG_LOGIC(
"Starting SPFCalculate for node " << root);
1363 NS_LOG_LOGIC(
"SPFCalculate truncated for stub node " << root);
1392 if (candidate.
Size() == 0)
1406 v = candidate.
Pop();
1500 NS_LOG_LOGIC(
"Found advertising router to destination");
1504 for (
uint32_t i = 0; i <
v->GetNChildren(); i++)
1506 if (!
v->GetChild(i)->IsVertexProcessed())
1508 NS_LOG_LOGIC(
"Vertex's child " << i <<
" not yet processed, processing...");
1510 v->GetChild(i)->SetVertexProcessed(
true);
1529 if (
v->GetVertexId() ==
m_spfroot->GetVertexId())
1531 NS_LOG_LOGIC(
"External is on local host: " <<
v->GetVertexId() <<
"; returning");
1548 NS_FATAL_ERROR(
"SPFAddASExternal():Can't find root node " << routerId);
1557 NS_ASSERT_MSG(router,
"No GlobalRouter interface on SPF root node " << node->GetId());
1563 if (router->GetRouterId() == routerId)
1565 NS_LOG_LOGIC(
"Setting routes for node " << node->GetId());
1573 "GlobalRouteManagerImpl::SPFIntraAddRouter (): "
1574 "QI for <Ipv4> interface failed");
1582 "GlobalRouteManagerImpl::SPFIntraAddRouter (): "
1583 "Expected valid LSA in SPFVertex* v");
1603 NS_ASSERT_MSG(router,
"No GlobalRouter interface on node " << node->GetId());
1609 for (
uint32_t i = 0; i <
v->GetNRootExitDirections(); i++)
1616 gr->AddASExternalRouteTo(tempip, tempmask, nextHop, outIf);
1617 NS_LOG_LOGIC(
"(Route " << i <<
") Node " << node->GetId()
1618 <<
" add external network route to " << tempip
1619 <<
" using next hop " << nextHop <<
" via interface "
1624 NS_LOG_LOGIC(
"(Route " << i <<
") Node " << node->GetId()
1625 <<
" NOT able to add network route to " << tempip
1626 <<
" using next hop " << nextHop
1627 <<
" since outgoing interface id is negative");
1633 NS_FATAL_ERROR(
"SPFIntraAddRouter(): routerId and vertex ID do not match");
1650 NS_LOG_LOGIC(
"Examining link " << i <<
" of " <<
v->GetVertexId() <<
"'s "
1651 <<
v->GetLSA()->GetNLinkRecords() <<
" link records");
1661 for (
uint32_t i = 0; i <
v->GetNChildren(); i++)
1663 if (!
v->GetChild(i)->IsVertexProcessed())
1666 v->GetChild(i)->SetVertexProcessed(
true);
1684 if (
v->GetVertexId() ==
m_spfroot->GetVertexId())
1686 NS_LOG_LOGIC(
"Stub is on local host: " <<
v->GetVertexId() <<
"; returning");
1689 NS_LOG_LOGIC(
"Stub is on remote host: " <<
v->GetVertexId() <<
"; installing");
1707 NS_LOG_ERROR(
"SPFIntraAddStub():Can't find root node " << routerId);
1716 NS_ASSERT_MSG(router,
"No GlobalRouter interface on node " << node->GetId());
1722 if (routerId == router->GetRouterId())
1724 NS_LOG_LOGIC(
"Setting routes for node " << node->GetId());
1732 "GlobalRouteManagerImpl::SPFIntraAddRouter (): "
1733 "QI for <Ipv4> interface failed");
1741 "GlobalRouteManagerImpl::SPFIntraAddRouter (): "
1742 "Expected valid LSA in SPFVertex* v");
1766 for (
uint32_t i = 0; i <
v->GetNRootExitDirections(); i++)
1773 gr->AddNetworkRouteTo(tempip, tempmask, nextHop, outIf);
1774 NS_LOG_LOGIC(
"(Route " << i <<
") Node " << node->GetId()
1775 <<
" add network route to " << tempip <<
" using next hop "
1776 << nextHop <<
" via interface " << outIf);
1780 NS_LOG_LOGIC(
"(Route " << i <<
") Node " << node->GetId()
1781 <<
" NOT able to add network route to " << tempip
1782 <<
" using next hop " << nextHop
1783 <<
" since outgoing interface id is negative");
1789 NS_LOG_ERROR(
"SPFIntraAddStub(): routerId and vertex ID do not match");
1822 NS_LOG_LOGIC(
"FindOutgoingInterfaceId():Can't find root node " << routerId);
1827 NS_ASSERT_MSG(rtr,
"No GlobalRouter interface on node " << node->GetId());
1833 if (rtr->GetRouterId() == routerId)
1843 "GlobalRouteManagerImpl::FindOutgoingInterfaceId (): "
1844 "GetObject for <Ipv4> interface failed");
1850 int32_t interface = ipv4->GetInterfaceForPrefix(a, amask);
1855 NS_FATAL_ERROR (
"GlobalRouteManagerImpl::FindOutgoingInterfaceId(): "
1856 "Expected an interface associated with address a:" << a);
1862 NS_FATAL_ERROR(
"SPFIntraAddRouter(): routerId and vertex ID do not match");
1905 NS_LOG_ERROR(
"SPFIntraAddRouter():Can't find root node " << routerId);
1915 NS_ASSERT_MSG(rtr,
"No GlobalRouter interface on node " << node->GetId());
1922 if (rtr->GetRouterId() == routerId)
1924 NS_LOG_LOGIC(
"Setting routes for node " << node->GetId());
1932 "GlobalRouteManagerImpl::SPFIntraAddRouter (): "
1933 "GetObject for <Ipv4> interface failed");
1942 "GlobalRouteManagerImpl::SPFIntraAddRouter (): "
1943 "Expected valid LSA in SPFVertex* v");
1954 NS_LOG_LOGIC(
" Node " << node->GetId() <<
" found " << nLinkRecords
1955 <<
" link records in LSA " << lsa <<
"with LinkStateId "
1957 for (
uint32_t j = 0; j < nLinkRecords; ++j)
1990 for (
uint32_t i = 0; i <
v->GetNRootExitDirections(); i++)
1997 gr->AddHostRouteTo(lr->
GetLinkData(), nextHop, outIf);
1998 NS_LOG_LOGIC(
"(Route " << i <<
") Node " << node->GetId()
2000 <<
" using next hop " << nextHop
2001 <<
" and outgoing interface " << outIf);
2005 NS_LOG_LOGIC(
"(Route " << i <<
") Node " << node->GetId()
2006 <<
" NOT able to add host route to " << lr->
GetLinkData()
2007 <<
" using next hop " << nextHop
2008 <<
" since outgoing interface id is negative " << outIf);
2018 NS_FATAL_ERROR(
"SPFIntraAddRouter(): routerId and vertex ID do not match");
2044 NS_LOG_ERROR(
"SPFIntraAddTransit():Can't find root node " << routerId);
2054 NS_ASSERT_MSG(rtr,
"No GlobalRouter interface on node " << node->GetId());
2061 if (rtr->GetRouterId() == routerId)
2063 NS_LOG_LOGIC(
"setting routes for node " << node->GetId());
2071 "GlobalRouteManagerImpl::SPFIntraAddTransit (): "
2072 "GetObject for <Ipv4> interface failed");
2081 "GlobalRouteManagerImpl::SPFIntraAddTransit (): "
2082 "Expected valid LSA in SPFVertex* v");
2092 for (
uint32_t i = 0; i <
v->GetNRootExitDirections(); i++)
2100 gr->AddNetworkRouteTo(tempip, tempmask, nextHop, outIf);
2101 NS_LOG_LOGIC(
"(Route " << i <<
") Node " << node->GetId()
2102 <<
" add network route to " << tempip <<
" using next hop "
2103 << nextHop <<
" via interface " << outIf);
2107 NS_LOG_LOGIC(
"(Route " << i <<
") Node " << node->GetId()
2108 <<
" NOT able to add network route to " << tempip
2109 <<
" using next hop " << nextHop
2110 <<
" since outgoing interface id is negative " << outIf);
2119 NS_FATAL_ERROR(
"SPFIntraAddTransit(): routerId and vertex ID do not match");
2140 if ((parent =
v->GetParent(i++)) ==
nullptr)
2162 int32_t interface = ipv4->GetInterfaceForAddress(address);
2180 NS_ASSERT_MSG(ipv4,
"Ipv4 not found on destination node " << dest->GetId());
2182 uint32_t numInterfaces = ipv4->GetNInterfaces();
2184 for (
uint32_t i = 0; i < numInterfaces; i++)
2186 uint32_t numAddresses = ipv4->GetNAddresses(i);
2187 for (
uint32_t j = 0; j < numAddresses; j++)
2194 PrintRoute(sourceNode, destinationAddr, stream, nodeIdLookup, unit);
2200 NS_ABORT_MSG(
"No IP address associated with destination Node");
2211 return globalRouting;
2220 for (
uint32_t i = 0; i <
list->GetNRoutingProtocols(); i++)
2222 int16_t priority = 0;
2226 return globalRouting;
2236 for (
uint32_t i = 0; i < ipv4->GetNInterfaces(); i++)
2238 for (
uint32_t j = 0; j < ipv4->GetNAddresses(i); j++)
2240 auto addr = ipv4->GetAddress(i, j);
2241 if (dest == addr.GetLocal())
2254 uint32_t numInter = ipv4->GetNInterfaces();
2257 NS_ABORT_MSG(
"No interfaces associated with source Node");
2261 for (
uint32_t i = 0; i < numInter; i++)
2263 if (ipv4->GetNAddresses(i) > 0)
2269 NS_ABORT_MSG(
"No IP address associated with source Node");
2277 uint32_t numInterfaces = ipv4CurrentNode->GetNInterfaces();
2278 for (
uint32_t i = 0; i < numInterfaces; i++)
2280 uint32_t numAddresses = ipv4CurrentNode->GetNAddresses(i);
2281 for (
uint32_t j = 0; j < numAddresses; j++)
2310 NS_ABORT_MSG(
"Destination node not found for IP address: " << dest);
2317 NS_ABORT_MSG_IF(!ipv4,
"No Ipv4 object found on source node " << sourceNode->GetId());
2322 NS_ABORT_MSG(
"No IP address associated with source Node");
2331 NS_ABORT_MSG(
"No global routing protocol found on source node " << sourceNode->GetId());
2336 std::ostream* os = stream->GetStream();
2340 *os <<
", " << hopsRemaining <<
" hops Max." << std::endl;
2345 NS_LOG_DEBUG(
"PrintRoute: Source and Destination are on the same Node "
2346 << sourceNode->GetId());
2347 *os <<
"Source and Destination are on the same Node";
2348 *os << std::endl << std::endl;
2353 if (!globalRouting->LookupGlobal(dest))
2355 *os <<
"There is no path from Node " << sourceNode->GetId() <<
" to Node "
2356 << destNode->GetId() <<
"." << std::endl
2364 std::list<Ptr<Node>> visitedNodes;
2365 visitedNodes.push_back(currentNode);
2366 while (currentNode != destNode)
2385 Ipv4Address gatewayAddress = gateway->GetGateway();
2396 *os <<
"Error: Did not find any addresses for " << dest <<
" From "
2397 << currentNode->GetId() << std::endl;
2402 currentNode = destNode;
2409 if (nextNode == currentNode)
2411 *os <<
"Invalid route: Next hop points back to the current node (Node "
2412 << currentNode->GetId() <<
").\n";
2413 NS_LOG_WARN(
"Invalid route: Next hop points back to the current node.");
2418 if (std::find(visitedNodes.begin(), visitedNodes.end(), nextNode) != visitedNodes.end())
2420 *os <<
"Loop detected! Node " << nextNode->GetId() <<
" revisited.\n\n";
2424 visitedNodes.push_back(nextNode);
2428 uint32_t interfaceIndex = ipv4CurrentNode->GetInterfaceForDevice(outdevice);
2429 currentNodeIp = ipv4->SourceAddressSelection(interfaceIndex, gatewayAddress);
2432 std::ostringstream addr;
2433 std::ostringstream node;
2434 if (nextNode != destNode)
2436 node <<
"(Node " << nextNode->GetId() <<
")";
2437 addr << gatewayAddress;
2438 *os << std::right << std::setw(2) << currHop++ <<
" " << addr.str();
2441 *os <<
" " << node.str();
2449 node <<
"(Node " << destNode->GetId() <<
")";
2451 *os << std::right << std::setw(2) << currHop++ <<
" " << addr.str();
2454 *os <<
" " << node.str();
2458 currentNode = nextNode;
2459 currentNodeIp = gatewayAddress;
A Candidate Queue used in routing calculations.
SPFVertex * Pop()
Pop the Shortest Path First Vertex pointer at the top of the queue.
uint32_t Size() const
Return the number of Shortest Path First Vertex pointers presently stored in the Candidate Queue.
void Push(SPFVertex *vNew)
Push a Shortest Path First Vertex pointer onto the queue according to the priority scheme.
void Reorder()
Reorders the Candidate Queue according to the priority scheme.
SPFVertex * Find(const Ipv4Address addr) const
Searches the Candidate Queue for a Shortest Path First Vertex pointer that points to a vertex having ...
void SPFCalculate(Ipv4Address root)
Calculate the shortest path first (SPF) tree.
void SPFAddASExternal(GlobalRoutingLSA *extlsa, SPFVertex *v)
Add an external route to the routing tables.
bool IsLocalDelivery(Ptr< Ipv4 > ipv4, Ipv4Address dest)
Is used by PrintRoute() to check if the destination is on the source node itself.
virtual ~GlobalRouteManagerImpl()
void ProcessASExternals(SPFVertex *v, GlobalRoutingLSA *extlsa)
Process Autonomous Systems (AS) External LSA.
bool ValidateSourceNodeHasIpAddress(Ptr< Ipv4 > ipv4)
Is used by PrintRoute() to check if the source node has an ipv4 address.
virtual void InitializeRoutes()
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.
void SPFProcessStubs(SPFVertex *v)
Process Stub nodes.
virtual void BuildGlobalRoutingDatabase()
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRo...
GlobalRoutingLinkRecord * SPFGetNextLink(SPFVertex *v, SPFVertex *w, GlobalRoutingLinkRecord *prev_link)
Search for a link between two vertices.
int32_t FindOutgoingInterfaceId(Ipv4Address a, Ipv4Mask amask=Ipv4Mask("255.255.255.255"))
Return the interface number corresponding to a given IP address and mask.
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.
virtual void DeleteGlobalRoutes()
Delete all static routes on all nodes that have a GlobalRouterInterface.
GlobalRouteManagerLSDB * m_lsdb
the Link State DataBase (LSDB) of the Global Route Manager
bool CheckForStubNode(Ipv4Address root)
Test if a node is a stub, from an OSPF sense.
void DebugUseLsdb(GlobalRouteManagerLSDB *lsdb)
Debugging routine; allow client code to supply a pre-built LSDB.
bool IsOnSameSubnet(Ptr< Ipv4 > ipv4CurrentNode, Ipv4Address dest)
Is used by PrintRoute() to check if the destination is on the same subnet as the source node.
SPFVertex * m_spfroot
the root node
void SPFNext(SPFVertex *v, CandidateQueue &candidate)
Examine the links in v's LSA and update the list of candidates with any vertices not already on the l...
void DebugSPFCalculate(Ipv4Address root)
Debugging routine; call the core SPF from the unit tests.
void SPFIntraAddTransit(SPFVertex *v)
Add a transit to the routing tables.
Ptr< Node > GetNodeByIp(const Ipv4Address &source)
given IP it iterates through the node list to find the node associated with the ip
int SPFNexthopCalculation(SPFVertex *v, SPFVertex *w, GlobalRoutingLinkRecord *l, uint32_t distance)
Calculate nexthop from root through V (parent) to vertex W (destination) with given distance from roo...
void SPFIntraAddStub(GlobalRoutingLinkRecord *l, SPFVertex *v)
Add a stub to the routing tables.
Ptr< Ipv4GlobalRouting > GetGlobalRoutingForNode(Ptr< Node > node)
Is used by PrintRoute() to get the global routing protocol associated with it or returns nullptr if n...
void SPFIntraAddRouter(SPFVertex *v)
Add a host route to the routing tables.
void SPFVertexAddParent(SPFVertex *v)
Adds a vertex to the list of children in each of its parents.
The Link State DataBase (LSDB) of the Global Route Manager.
void Initialize()
Set all LSA flags to an initialized state, for SPF computation.
std::pair< Ipv4Address, GlobalRoutingLSA * > LSDBPair_t
pair of IPv4 addresses / Link State Advertisements
~GlobalRouteManagerLSDB()
Destroy an empty Global Router Manager Link State Database.
uint32_t GetNumExtLSAs() const
Get the number of External Link State Advertisements.
GlobalRoutingLSA * GetLSA(Ipv4Address addr) const
Look up the Link State Advertisement associated with the given link state ID (address).
std::vector< GlobalRoutingLSA * > m_extdatabase
database of External Link State Advertisements
void Insert(Ipv4Address addr, GlobalRoutingLSA *lsa)
Insert an IP address / Link State Advertisement pair into the Link State Database.
LSDBMap_t m_database
database of IPv4 addresses / Link State Advertisements
GlobalRoutingLSA * GetExtLSA(uint32_t index) const
Look up the External Link State Advertisement associated with the given index.
GlobalRouteManagerLSDB()
Construct an empty Global Router Manager Link State Database.
GlobalRoutingLSA * GetLSAByLinkData(Ipv4Address addr) const
Look up the Link State Advertisement associated with the given link state ID (address).
An interface aggregated to a node to provide global routing info.
a Link State Advertisement (LSA) for a router, used in global routing.
Ipv4Address GetAdvertisingRouter() const
Get the Advertising Router as defined by the OSPF spec.
void SetStatus(SPFStatus status)
Set the SPF status of the advertisement.
@ LSA_SPF_NOT_EXPLORED
New vertex not yet considered.
@ LSA_SPF_IN_SPFTREE
Vertex is in the SPF tree.
@ LSA_SPF_CANDIDATE
Vertex is in the SPF candidate queue.
Ptr< Node > GetNode() const
Get the Node pointer of the node that originated this LSA.
SPFStatus GetStatus() const
Get the SPF status of the advertisement.
Ipv4Mask GetNetworkLSANetworkMask() const
For a Network LSA, get the Network Mask field that precedes the list of attached routers.
LSType GetLSType() const
Return the LSType field of the LSA.
uint32_t GetNLinkRecords() const
Return the number of Global Routing Link Records in the LSA.
GlobalRoutingLinkRecord * GetLinkRecord(uint32_t n) const
Return a pointer to the specified Global Routing Link Record.
Ipv4Address GetLinkStateId() const
Get the Link State ID as defined by the OSPF spec.
A single link record for a link state advertisement.
LinkType GetLinkType() const
Get the Link Type field of the Global Routing Link Record.
Ipv4Address GetLinkId() const
Get the Link ID field of the Global Routing Link Record.
uint16_t GetMetric() const
Get the Metric Data field of the Global Routing Link Record.
Ipv4Address GetLinkData() const
Get the Link Data field of the Global Routing Link Record.
@ StubNetwork
Record represents a leaf node network.
@ PointToPoint
Record representing a point to point channel.
@ TransitNetwork
Unused – for future OSPF compatibility.
Ipv4 addresses are stored in host order in this class.
static Ipv4Address GetLoopback()
static Ipv4Address GetZero()
Ipv4Address CombineMask(const Ipv4Mask &mask) const
Combine this address with a network mask.
uint32_t Get() const
Get the host-order 32-bit IP address.
Access to the IPv4 forwarding table, interfaces, and configuration.
a class to store IPv4 address information on an interface
Ipv4Mask GetMask() const
Get the network mask.
Ipv4Address GetLocal() const
Get the local address.
Implement the IPv4 layer.
a class to represent an Ipv4 address mask
bool IsMatch(Ipv4Address a, Ipv4Address b) const
static uint32_t GetNNodes()
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Smart pointer class similar to boost::intrusive_ptr.
Vertex used in shortest path first (SPF) computations.
Ipv4Address GetVertexId() const
Get the Vertex ID field of a SPFVertex object.
std::pair< Ipv4Address, int32_t > NodeExit_t
IPv4 / interface container for exit nodes.
GlobalRoutingLSA * GetLSA() const
Get the Global Router Link State Advertisement returned by the Global Router represented by this SPFV...
Ipv4Address m_nextHop
next hop
void SetVertexId(Ipv4Address id)
Set the Vertex ID field of a SPFVertex object.
Ptr< Node > GetNode() const
Get the node pointer corresponding to this Vertex.
void MergeParent(const SPFVertex *v)
Merge the Parent list from the v into this vertex.
VertexType
Enumeration of the possible types of SPFVertex objects.
@ VertexNetwork
Vertex representing a network in the topology.
@ VertexRouter
Vertex representing a router in the topology.
@ VertexUnknown
Uninitialized Link Record.
void InheritAllRootExitDirections(const SPFVertex *vertex)
Inherit all root exit directions from a given vertex to 'this' vertex.
void SetDistanceFromRoot(uint32_t distance)
Set the distance from the root vertex to "this" SPFVertex object.
SPFVertex * GetChild(uint32_t n) const
Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.
VertexType GetVertexType() const
Get the Vertex Type field of a SPFVertex object.
bool IsVertexProcessed() const
Check the value of the VertexProcessed flag.
void SetParent(SPFVertex *parent)
Set the pointer to the SPFVector that is the parent of "this" SPFVertex.
void MergeRootExitDirections(const SPFVertex *vertex)
Merge into 'this' vertex the list of exit directions from another vertex.
std::list< SPFVertex * > ListOfSPFVertex_t
container of SPFVertex items
Ptr< Node > m_node
node pointer corresponding to the this Vertex
uint32_t GetDistanceFromRoot() const
Get the distance from the root vertex to "this" SPFVertex object.
GlobalRoutingLSA * m_lsa
Link State Advertisement.
~SPFVertex()
Destroy an SPFVertex (Shortest Path First Vertex).
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 ...
void SetVertexProcessed(bool value)
Set the value of the VertexProcessed flag.
std::list< NodeExit_t > ListOfNodeExit_t
container of Exit nodes
void SetVertexType(VertexType type)
Set the Vertex Type field of a SPFVertex object.
void SetLSA(GlobalRoutingLSA *lsa)
Set the Global Router Link State Advertisement returned by the Global Router represented by this SPFV...
uint32_t GetNRootExitDirections() const
Get the number of exit directions from root for reaching 'this' vertex.
int32_t m_rootOif
root Output Interface
uint32_t m_distanceFromRoot
Distance from root node.
void ClearVertexProcessed()
Clear the value of the VertexProcessed flag.
bool m_vertexProcessed
Flag to note whether vertex has been processed in stage two of SPF computation.
uint32_t GetNChildren() const
Get the number of children of "this" SPFVertex.
Ipv4Address m_vertexId
Vertex ID.
uint32_t AddChild(SPFVertex *child)
Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.
NodeExit_t GetRootExitDirection() const
Obtain a pair indicating the exit direction from the root.
ListOfNodeExit_t m_ecmpRootExits
store the multiple root's exits for supporting ECMP
SPFVertex * GetParent(uint32_t i=0) const
Get a pointer to the SPFVector that is the parent of "this" SPFVertex.
ListOfSPFVertex_t m_children
Children list.
VertexType m_vertexType
Vertex type.
ListOfSPFVertex_t m_parents
parent list
SPFVertex()
Construct an empty ("uninitialized") SPFVertex (Shortest Path First Vertex).
static uint32_t GetSystemId()
Get the system id of this simulator.
Unit
The unit to use to interpret a number representing time.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
const uint32_t SPF_INFINITY
"infinite" distance between nodes