|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
22 #ifndef GLOBAL_ROUTE_MANAGER_IMPL_H
23 #define GLOBAL_ROUTE_MANAGER_IMPL_H
30 #include "ns3/object.h"
32 #include "ns3/ipv4-address.h"
679 typedef std::map<Ipv4Address, GlobalRoutingLSA*>
LSDBMap_t;
680 typedef std::pair<Ipv4Address, GlobalRoutingLSA*>
LSDBPair_t;
GlobalRouteManagerLSDB(GlobalRouteManagerLSDB &lsdb)
GlobalRouteManagerLSDB copy construction is disallowed.
void SPFIntraAddTransit(SPFVertex *v)
Add a transit to the routing tables.
void ClearVertexProcessed(void)
Clear the value of the VertexProcessed flag.
void MergeParent(const SPFVertex *v)
Merge the Parent list from the v into this vertex.
void SetVertexProcessed(bool value)
Set the value of the VertexProcessed flag.
void SPFAddASExternal(GlobalRoutingLSA *extlsa, SPFVertex *v)
Add an external route to the routing tables.
virtual void DeleteGlobalRoutes()
Delete all static routes on all nodes that have a GlobalRouterInterface.
void SetVertexId(Ipv4Address id)
Set the Vertex ID field of a SPFVertex object.
virtual void InitializeRoutes()
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.
GlobalRoutingLSA * GetLSA(void) const
Get 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.
A Candidate Queue used in routing calculations.
SPFVertex(SPFVertex &v)
The SPFVertex copy construction is disallowed.
GlobalRoutingLSA * GetExtLSA(uint32_t index) const
Look up the External Link State Advertisement associated with the given index.
int32_t m_rootOif
root Output Interface
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 ProcessASExternals(SPFVertex *v, GlobalRoutingLSA *extlsa)
Process Autonomous Systems (AS) External LSA.
void SetLSA(GlobalRoutingLSA *lsa)
Set the Global Router Link State Advertisement returned by the Global Router represented by this SPFV...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
const uint32_t SPF_INFINITY
"infinite" distance between nodes
void SPFIntraAddRouter(SPFVertex *v)
Add a host route to the routing tables.
ListOfSPFVertex_t m_children
Children list.
GlobalRouteManagerLSDB * m_lsdb
the Link State DataBase (LSDB) of the Global Route Manager
a Link State Advertisement (LSA) for a router, used in global routing.
NodeExit_t GetRootExitDirection() const
Obtain a pair indicating the exit direction from the root.
uint32_t GetNumExtLSAs() const
Get the number of External Link State Advertisements.
Ipv4Address GetVertexId(void) const
Get the Vertex ID field of a SPFVertex object.
@ VertexRouter
Vertex representing a router in the topology.
Ipv4 addresses are stored in host order in this class.
std::pair< Ipv4Address, GlobalRoutingLSA * > LSDBPair_t
pair of IPv4 addresses / Link State Advertisements
std::list< NodeExit_t > ListOfNodeExit_t
container of Exit nodes
ListOfSPFVertex_t m_parents
parent list
void DebugUseLsdb(GlobalRouteManagerLSDB *lsdb)
Debugging routine; allow client code to supply a pre-built LSDB.
The Link State DataBase (LSDB) of the Global Route Manager.
void SetDistanceFromRoot(uint32_t distance)
Set the distance from the root vertex to "this" SPFVertex object.
GlobalRoutingLinkRecord * SPFGetNextLink(SPFVertex *v, SPFVertex *w, GlobalRoutingLinkRecord *prev_link)
Search for a link between two vertices.
void SPFCalculate(Ipv4Address root)
Calculate the shortest path first (SPF) tree.
uint32_t GetDistanceFromRoot(void) const
Get the distance from the root vertex to "this" SPFVertex object.
SPFVertex * m_spfroot
the root node
virtual ~GlobalRouteManagerImpl()
SPFVertex & operator=(SPFVertex &v)
The SPFVertex copy assignment operator is disallowed.
~GlobalRouteManagerLSDB()
Destroy an empty Global Router Manager Link State Database.
Global routing protocol for IPv4 stacks.
std::list< SPFVertex * > ListOfSPFVertex_t
container of SPFVertexes
GlobalRoutingLSA * m_lsa
Link State Advertisement.
GlobalRouteManagerImpl & operator=(GlobalRouteManagerImpl &srmi)
Global Route Manager Implementation assignment operator is disallowed.
void DebugSPFCalculate(Ipv4Address root)
Debugging routine; call the core SPF from the unit tests.
std::map< Ipv4Address, GlobalRoutingLSA * > LSDBMap_t
container of IPv4 addresses / Link State Advertisements
void InheritAllRootExitDirections(const SPFVertex *vertex)
Inherit all root exit directions from a given vertex to 'this' vertex.
LSDBMap_t m_database
database of IPv4 addresses / Link State Advertisements
VertexType GetVertexType(void) const
Get the Vertex Type field of a SPFVertex object.
Ipv4Address m_nextHop
next hop
GlobalRouteManagerLSDB()
Construct an empty Global Router Manager Link State Database.
void SPFVertexAddParent(SPFVertex *v)
Adds a vertex to the list of children in each of its parents.
GlobalRouteManagerImpl(GlobalRouteManagerImpl &srmi)
GlobalRouteManagerImpl copy construction is disallowed.
@ VertexNetwork
Vertex representing a network in the topology.
void Initialize()
Set all LSA flags to an initialized state, for SPF computation.
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...
~SPFVertex()
Destroy an SPFVertex (Shortest Path First Vertex).
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...
VertexType m_vertexType
Vertex type.
GlobalRoutingLSA * GetLSA(Ipv4Address addr) const
Look up the Link State Advertisement associated with the given link state ID (address).
std::pair< Ipv4Address, int32_t > NodeExit_t
IPv4 / interface container for exit nodes.
bool CheckForStubNode(Ipv4Address root)
Test if a node is a stub, from an OSPF sense.
A global router implementation.
void SPFProcessStubs(SPFVertex *v)
Process Stub nodes.
GlobalRouteManagerLSDB & operator=(GlobalRouteManagerLSDB &lsdb)
The SPFVertex copy assignment operator is disallowed.
bool IsVertexProcessed(void) const
Check the value of the VertexProcessed flag.
ListOfNodeExit_t m_ecmpRootExits
store the multiple root's exits for supporting ECMP
void MergeRootExitDirections(const SPFVertex *vertex)
Merge into 'this' vertex the list of exit directions from another vertex.
SPFVertex * GetParent(uint32_t i=0) const
Get a pointer to the SPFVector that is the parent of "this" SPFVertex.
void SPFIntraAddStub(GlobalRoutingLinkRecord *l, SPFVertex *v)
Add a stub to the routing tables.
a class to represent an Ipv4 address mask
uint32_t AddChild(SPFVertex *child)
Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.
A single link record for a link state advertisement.
Ipv4Address m_vertexId
Vertex ID.
uint32_t m_distanceFromRoot
Distance from root node.
@ VertexUnknown
Uninitialized Link Record.
VertexType
Enumeration of the possible types of SPFVertex objects.
void SetVertexType(VertexType type)
Set the Vertex Type field of a SPFVertex object.
SPFVertex()
Construct an empty ("uninitialized") SPFVertex (Shortest Path First Vertex).
virtual void BuildGlobalRoutingDatabase()
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRo...
void SetParent(SPFVertex *parent)
Set the pointer to the SPFVector that is the parent of "this" SPFVertex.
GlobalRoutingLSA * GetLSAByLinkData(Ipv4Address addr) const
Look up the Link State Advertisement associated with the given link state ID (address).
bool m_vertexProcessed
Flag to note whether vertex has been processed in stage two of SPF computation.
Vertex used in shortest path first (SPF) computations.
uint32_t GetNChildren(void) const
Get the number of children of "this" SPFVertex.
void Insert(Ipv4Address addr, GlobalRoutingLSA *lsa)
Insert an IP address / Link State Advertisement pair into the Link State Database.
SPFVertex * GetChild(uint32_t n) const
Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.
friend std::ostream & operator<<(std::ostream &os, const SPFVertex::ListOfSPFVertex_t &vs)
Stream insertion operator.
std::vector< GlobalRoutingLSA * > m_extdatabase
database of External Link State Advertisements
int32_t FindOutgoingInterfaceId(Ipv4Address a, Ipv4Mask amask=Ipv4Mask("255.255.255.255"))
Return the interface number corresponding to a given IP address and mask.