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"
670 typedef std::map<Ipv4Address, GlobalRoutingLSA*>
LSDBMap_t;
671 typedef std::pair<Ipv4Address, GlobalRoutingLSA*>
LSDBPair_t;
int32_t FindOutgoingInterfaceId(Ipv4Address a, Ipv4Mask amask=Ipv4Mask("255.255.255.255"))
GlobalRoutingLSA * GetLSAByLinkData(Ipv4Address addr) const
Look up the Link State Advertisement associated with the given link state ID (address). This is a variation of the GetLSA call to allow the LSA to be found by matching addr with the LinkData field of the TransitNetwork link record.
ListOfSPFVertex_t m_parents
void SPFAddASExternal(GlobalRoutingLSA *extlsa, SPFVertex *v)
uint32_t m_distanceFromRoot
virtual void DeleteGlobalRoutes()
Delete all static routes on all nodes that have a GlobalRouterInterface.
const uint32_t SPF_INFINITY
void SetParent(SPFVertex *parent)
Set the pointer to the SPFVector that is the parent of "this" SPFVertex.
a class to represent an Ipv4 address mask
~SPFVertex()
Destroy an SPFVertex (Shortest Path First Vertex).
void SPFIntraAddRouter(SPFVertex *v)
GlobalRouteManagerLSDB * m_lsdb
void ProcessASExternals(SPFVertex *v, GlobalRoutingLSA *extlsa)
uint32_t GetNumExtLSAs() const
std::list< SPFVertex * > ListOfSPFVertex_t
void SPFIntraAddStub(GlobalRoutingLinkRecord *l, SPFVertex *v)
void InheritAllRootExitDirections(const SPFVertex *vertex)
Inherit all root exit directions from a given vertex to 'this' vertex.
void SPFProcessStubs(SPFVertex *v)
void MergeParent(const SPFVertex *v)
Merge the Parent list from the v into this vertex.
std::vector< GlobalRoutingLSA * > m_extdatabase
Vertex used in shortest path first (SPF) computations. See RFC 2328, Section 16.
GlobalRoutingLinkRecord * SPFGetNextLink(SPFVertex *v, SPFVertex *w, GlobalRoutingLinkRecord *prev_link)
SPFVertex()
Construct an empty ("uninitialized") SPFVertex (Shortest Path First Vertex).
friend std::ostream & operator<<(std::ostream &os, const SPFVertex::ListOfSPFVertex_t &vs)
void SetDistanceFromRoot(uint32_t distance)
Set the distance from the root vertex to "this" SPFVertex object.
A global router implementation.
ListOfNodeExit_t m_ecmpRootExits
store the multiple root's exits for supporting ECMP
A single link record for a link state advertisement.
A Candidate Queue used in static routing.
a Link State Advertisement (LSA) for a router, used in global routing.
ListOfSPFVertex_t m_children
uint32_t GetNChildren(void) const
Get the number of children of "this" SPFVertex.
std::pair< Ipv4Address, int32_t > NodeExit_t
std::pair< Ipv4Address, GlobalRoutingLSA * > LSDBPair_t
GlobalRoutingLSA * GetExtLSA(uint32_t index) const
void Initialize()
Set all LSA flags to an initialized state, for SPF computation.
~GlobalRouteManagerLSDB()
Destroy an empty Global Router Manager Link State Database.
Global routing protocol for IP version 4 stacks.
GlobalRouteManagerLSDB & operator=(GlobalRouteManagerLSDB &lsdb)
The SPFVertex copy assignment operator is disallowed. There's no need for it and a compiler provided ...
void DebugSPFCalculate(Ipv4Address root)
Debugging routine; call the core SPF from the unit tests.
std::list< NodeExit_t > ListOfNodeExit_t
uint32_t GetDistanceFromRoot(void) const
Get the distance from the root vertex to "this" SPFVertex object.
void SPFIntraAddTransit(SPFVertex *v)
SPFVertex & operator=(SPFVertex &v)
The SPFVertex copy assignment operator is disallowed. There's no need for it and a compiler provided ...
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...
void SetVertexType(VertexType type)
Set the Vertex Type field of a SPFVertex object.
void DebugUseLsdb(GlobalRouteManagerLSDB *)
Debugging routine; allow client code to supply a pre-built LSDB.
int SPFNexthopCalculation(SPFVertex *v, SPFVertex *w, GlobalRoutingLinkRecord *l, uint32_t distance)
void SetLSA(GlobalRoutingLSA *lsa)
Set the Global Router Link State Advertisement returned by the Global Router represented by this SPFV...
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 SetVertexId(Ipv4Address id)
Set the Vertex ID field of a SPFVertex object.
GlobalRoutingLSA * GetLSA(Ipv4Address addr) const
Look up the Link State Advertisement associated with the given link state ID (address).
void Insert(Ipv4Address addr, GlobalRoutingLSA *lsa)
Insert an IP address / Link State Advertisement pair into the Link State Database.
bool CheckForStubNode(Ipv4Address root)
void MergeRootExitDirections(const SPFVertex *vertex)
Merge into 'this' vertex the list of exit directions from another vertex.
uint32_t GetNRootExitDirections() const
Get the number of exit directions from root for reaching 'this' vertex.
virtual ~GlobalRouteManagerImpl()
Ipv4 addresses are stored in host order in this class.
void SPFNext(SPFVertex *, CandidateQueue &)
SPFVertex * GetParent(uint32_t i=0) const
Get a pointer to the SPFVector that is the parent of "this" SPFVertex.
NodeExit_t GetRootExitDirection() const
Obtain a pair indicating the exit direction from the root.
std::map< Ipv4Address, GlobalRoutingLSA * > LSDBMap_t
void ClearVertexProcessed(void)
VertexType GetVertexType(void) const
Get the Vertex Type field of a SPFVertex object.
void SPFCalculate(Ipv4Address root)
The Link State DataBase (LSDB) of the Global Route Manager.
void SetVertexProcessed(bool value)
Set the value of the VertexProcessed flag.
VertexType
Enumeration of the possible types of SPFVertex objects.
virtual void BuildGlobalRoutingDatabase()
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRo...
GlobalRouteManagerLSDB()
Construct an empty Global Router Manager Link State Database.
bool IsVertexProcessed(void) const
Check the value of the VertexProcessed flag.
Ipv4Address GetVertexId(void) const
Get the Vertex ID field of a SPFVertex object.
GlobalRouteManagerImpl & operator=(GlobalRouteManagerImpl &srmi)
Global Route Manager Implementation assignment operator is disallowed. There's no need for it and a c...
SPFVertex * GetChild(uint32_t n) const
Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.
void SPFVertexAddParent(SPFVertex *v)
uint32_t AddChild(SPFVertex *child)
Get a borrowed SPFVertex pointer to the specified child of "this" SPFVertex.