A global router implementation. More...
#include <global-route-manager-impl.h>
Public Member Functions | |
GlobalRouteManagerImpl () | |
virtual | ~GlobalRouteManagerImpl () |
virtual void | DeleteGlobalRoutes () |
Delete all static routes on all nodes that have a GlobalRouterInterface. | |
virtual void | SelectRouterNodes () |
Select which nodes in the system are to be router nodes and aggregate the appropriate interfaces onto those nodes. | |
virtual void | SelectRouterNodes (NodeContainer c) |
Select which nodes in the system are to be router nodes and aggregate the appropriate interfaces onto those nodes. | |
virtual void | BuildGlobalRoutingDatabase () |
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRouter interface. | |
virtual void | InitializeRoutes () |
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables. | |
void | DebugUseLsdb (GlobalRouteManagerLSDB *) |
Debugging routine; allow client code to supply a pre-built LSDB. | |
void | DebugSPFCalculate (Ipv4Address root) |
Debugging routine; call the core SPF from the unit tests. | |
Private Types | |
typedef std::list< std::pair < uint32_t, Ptr < Ipv4GlobalRouting > > > | Ipv4GlobalRoutingList |
Private Member Functions | |
GlobalRouteManagerImpl (GlobalRouteManagerImpl &srmi) | |
GlobalRouteManagerImpl copy construction is disallowed. There's no need for it and a compiler provided shallow copy would be wrong. | |
GlobalRouteManagerImpl & | operator= (GlobalRouteManagerImpl &srmi) |
Global Route Manager Implementation assignment operator is disallowed. There's no need for it and a compiler provided shallow copy would be hopelessly wrong. | |
void | SPFCalculate (Ipv4Address root) |
void | SPFProcessStubs (SPFVertex *v) |
void | SPFNext (SPFVertex *, CandidateQueue &) |
int | SPFNexthopCalculation (SPFVertex *v, SPFVertex *w, GlobalRoutingLinkRecord *l, uint32_t distance) |
void | SPFVertexAddParent (SPFVertex *v) |
GlobalRoutingLinkRecord * | SPFGetNextLink (SPFVertex *v, SPFVertex *w, GlobalRoutingLinkRecord *prev_link) |
void | SPFIntraAddRouter (SPFVertex *v) |
void | SPFIntraAddTransit (SPFVertex *v) |
void | SPFIntraAddStub (GlobalRoutingLinkRecord *l, SPFVertex *v) |
uint32_t | FindOutgoingTypeId (Ipv4Address a, Ipv4Mask amask=Ipv4Mask("255.255.255.255")) |
void | AddGlobalRoutingProtocol (uint32_t nodeId, Ptr< Ipv4GlobalRouting > proto) |
Ptr< Ipv4GlobalRouting > | GetGlobalRoutingProtocol (uint32_t nodeId) |
Private Attributes | |
SPFVertex * | m_spfroot |
GlobalRouteManagerLSDB * | m_lsdb |
Ipv4GlobalRoutingList | m_routingProtocols |
A global router implementation.
This singleton object can query interface each node in the system for a GlobalRouter interface. For those nodes, it fetches one or more Link State Advertisements and stores them in a local database. Then, it can compute shortest paths on a per-node basis to all routers, and finally configure each of the node's forwarding tables.
The design is guided by OSPFv2 RFC 2328 section 16.1.1 and quagga ospfd.
Definition at line 717 of file global-route-manager-impl.h.
typedef std::list< std::pair< uint32_t, Ptr<Ipv4GlobalRouting> > > ns3::GlobalRouteManagerImpl::Ipv4GlobalRoutingList [private] |
Definition at line 806 of file global-route-manager-impl.h.
ns3::GlobalRouteManagerImpl::GlobalRouteManagerImpl | ( | ) |
Definition at line 340 of file global-route-manager-impl.cc.
References m_lsdb, and NS_LOG_FUNCTION_NOARGS.
ns3::GlobalRouteManagerImpl::~GlobalRouteManagerImpl | ( | ) | [virtual] |
Definition at line 348 of file global-route-manager-impl.cc.
References m_lsdb, and NS_LOG_FUNCTION_NOARGS.
ns3::GlobalRouteManagerImpl::GlobalRouteManagerImpl | ( | GlobalRouteManagerImpl & | srmi | ) | [private] |
GlobalRouteManagerImpl copy construction is disallowed. There's no need for it and a compiler provided shallow copy would be wrong.
void ns3::GlobalRouteManagerImpl::AddGlobalRoutingProtocol | ( | uint32_t | nodeId, | |
Ptr< Ipv4GlobalRouting > | proto | |||
) | [private] |
Definition at line 1658 of file global-route-manager-impl.cc.
References m_routingProtocols, and NS_LOG_FUNCTION.
Referenced by SelectRouterNodes().
void ns3::GlobalRouteManagerImpl::BuildGlobalRoutingDatabase | ( | ) | [virtual] |
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRouter interface.
Definition at line 472 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::GlobalRouteManagerLSDB::Insert(), m_lsdb, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
void ns3::GlobalRouteManagerImpl::DebugSPFCalculate | ( | Ipv4Address | root | ) |
Debugging routine; call the core SPF from the unit tests.
Definition at line 1055 of file global-route-manager-impl.cc.
References NS_LOG_FUNCTION, and SPFCalculate().
Referenced by ns3::GlobalRouteManagerImplTest::RunTests().
void ns3::GlobalRouteManagerImpl::DebugUseLsdb | ( | GlobalRouteManagerLSDB * | lsdb | ) |
Debugging routine; allow client code to supply a pre-built LSDB.
Definition at line 358 of file global-route-manager-impl.cc.
References m_lsdb, and NS_LOG_FUNCTION.
Referenced by ns3::GlobalRouteManagerImplTest::RunTests().
void ns3::GlobalRouteManagerImpl::DeleteGlobalRoutes | ( | ) | [virtual] |
Delete all static routes on all nodes that have a GlobalRouterInterface.
TODO: separate manually assigned static routes from static routes that the global routing code injects, and only delete the latter
Definition at line 369 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), GetGlobalRoutingProtocol(), m_lsdb, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
uint32_t ns3::GlobalRouteManagerImpl::FindOutgoingTypeId | ( | Ipv4Address | a, | |
Ipv4Mask | amask = Ipv4Mask("255.255.255.255") | |||
) | [private] |
Definition at line 1359 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::SPFVertex::GetVertexId(), m_spfroot, NS_ASSERT_MSG, and NS_LOG_FUNCTION.
Referenced by SPFNexthopCalculation().
Ptr< Ipv4GlobalRouting > ns3::GlobalRouteManagerImpl::GetGlobalRoutingProtocol | ( | uint32_t | nodeId | ) | [private] |
Definition at line 1667 of file global-route-manager-impl.cc.
References m_routingProtocols.
Referenced by DeleteGlobalRoutes(), SPFIntraAddRouter(), SPFIntraAddStub(), and SPFIntraAddTransit().
void ns3::GlobalRouteManagerImpl::InitializeRoutes | ( | ) | [virtual] |
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.
Definition at line 553 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), NS_LOG_FUNCTION_NOARGS, and SPFCalculate().
GlobalRouteManagerImpl& ns3::GlobalRouteManagerImpl::operator= | ( | GlobalRouteManagerImpl & | srmi | ) | [private] |
Global Route Manager Implementation assignment operator is disallowed. There's no need for it and a compiler provided shallow copy would be hopelessly wrong.
void ns3::GlobalRouteManagerImpl::SelectRouterNodes | ( | NodeContainer | c | ) | [virtual] |
Select which nodes in the system are to be router nodes and aggregate the appropriate interfaces onto those nodes.
Definition at line 433 of file global-route-manager-impl.cc.
References AddGlobalRoutingProtocol(), ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), NS_ASSERT_MSG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
void ns3::GlobalRouteManagerImpl::SelectRouterNodes | ( | ) | [virtual] |
Select which nodes in the system are to be router nodes and aggregate the appropriate interfaces onto those nodes.
Definition at line 404 of file global-route-manager-impl.cc.
References AddGlobalRoutingProtocol(), ns3::NodeList::Begin(), ns3::NodeList::End(), NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
void ns3::GlobalRouteManagerImpl::SPFCalculate | ( | Ipv4Address | root | ) | [private] |
Definition at line 1063 of file global-route-manager-impl.cc.
References ns3::GlobalRouteManagerLSDB::GetLSA(), ns3::GlobalRouteManagerLSDB::Initialize(), ns3::GlobalRoutingLSA::LSA_SPF_IN_SPFTREE, m_lsdb, m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::CandidateQueue::Pop(), ns3::SPFVertex::SetDistanceFromRoot(), ns3::CandidateQueue::Size(), SPFIntraAddRouter(), SPFIntraAddTransit(), SPFNext(), SPFProcessStubs(), SPFVertexAddParent(), ns3::SPFVertex::VertexNetwork, and ns3::SPFVertex::VertexRouter.
Referenced by DebugSPFCalculate(), and InitializeRoutes().
GlobalRoutingLinkRecord * ns3::GlobalRouteManagerImpl::SPFGetNextLink | ( | SPFVertex * | v, | |
SPFVertex * | w, | |||
GlobalRoutingLinkRecord * | prev_link | |||
) | [private] |
Definition at line 977 of file global-route-manager-impl.cc.
References ns3::GlobalRoutingLinkRecord::GetLinkData(), ns3::GlobalRoutingLinkRecord::GetLinkId(), ns3::GlobalRoutingLSA::GetLinkRecord(), ns3::SPFVertex::GetLSA(), ns3::GlobalRoutingLSA::GetNLinkRecords(), ns3::SPFVertex::GetVertexId(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by SPFNexthopCalculation().
void ns3::GlobalRouteManagerImpl::SPFIntraAddRouter | ( | SPFVertex * | v | ) | [private] |
Definition at line 1435 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), GetGlobalRoutingProtocol(), ns3::GlobalRoutingLinkRecord::GetLinkData(), ns3::GlobalRoutingLSA::GetLinkRecord(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::GlobalRoutingLinkRecord::GetLinkType(), ns3::SPFVertex::GetLSA(), ns3::SPFVertex::GetNextHop(), ns3::GlobalRoutingLSA::GetNLinkRecords(), ns3::SPFVertex::GetOutgoingTypeId(), ns3::SPFVertex::GetVertexId(), m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::GlobalRoutingLinkRecord::PointToPoint.
Referenced by SPFCalculate().
void ns3::GlobalRouteManagerImpl::SPFIntraAddStub | ( | GlobalRoutingLinkRecord * | l, | |
SPFVertex * | v | |||
) | [private] |
Definition at line 1244 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::Ipv4Address::CombineMask(), ns3::NodeList::End(), GetGlobalRoutingProtocol(), ns3::GlobalRoutingLinkRecord::GetLinkId(), ns3::SPFVertex::GetLSA(), ns3::SPFVertex::GetNextHop(), ns3::SPFVertex::GetOutgoingTypeId(), ns3::SPFVertex::GetVertexId(), m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
Referenced by SPFProcessStubs().
void ns3::GlobalRouteManagerImpl::SPFIntraAddTransit | ( | SPFVertex * | v | ) | [private] |
Definition at line 1556 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::Ipv4Address::CombineMask(), ns3::NodeList::End(), GetGlobalRoutingProtocol(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::SPFVertex::GetLSA(), ns3::GlobalRoutingLSA::GetNetworkLSANetworkMask(), ns3::SPFVertex::GetNextHop(), ns3::SPFVertex::GetOutgoingTypeId(), ns3::SPFVertex::GetVertexId(), m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by SPFCalculate().
void ns3::GlobalRouteManagerImpl::SPFNext | ( | SPFVertex * | v, | |
CandidateQueue & | candidate | |||
) | [private] |
Definition at line 593 of file global-route-manager-impl.cc.
References ns3::CandidateQueue::Find(), ns3::GlobalRoutingLSA::GetAttachedRouter(), ns3::SPFVertex::GetDistanceFromRoot(), ns3::GlobalRoutingLSA::GetLinkRecord(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::GlobalRouteManagerLSDB::GetLSA(), ns3::SPFVertex::GetLSA(), ns3::GlobalRouteManagerLSDB::GetLSAByLinkData(), ns3::GlobalRoutingLSA::GetLSType(), ns3::GlobalRoutingLinkRecord::GetMetric(), ns3::GlobalRoutingLSA::GetNAttachedRouters(), ns3::GlobalRoutingLSA::GetNLinkRecords(), ns3::GlobalRoutingLSA::GetStatus(), ns3::SPFVertex::GetVertexId(), ns3::SPFVertex::GetVertexType(), ns3::GlobalRoutingLSA::LSA_SPF_CANDIDATE, ns3::GlobalRoutingLSA::LSA_SPF_IN_SPFTREE, ns3::GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED, m_lsdb, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::GlobalRoutingLinkRecord::PointToPoint, ns3::CandidateQueue::Push(), ns3::CandidateQueue::Reorder(), ns3::GlobalRoutingLSA::RouterLSA, ns3::GlobalRoutingLSA::SetStatus(), SPFNexthopCalculation(), ns3::GlobalRoutingLinkRecord::StubNetwork, ns3::GlobalRoutingLinkRecord::TransitNetwork, ns3::SPFVertex::VertexNetwork, and ns3::SPFVertex::VertexRouter.
Referenced by SPFCalculate().
int ns3::GlobalRouteManagerImpl::SPFNexthopCalculation | ( | SPFVertex * | v, | |
SPFVertex * | w, | |||
GlobalRoutingLinkRecord * | l, | |||
uint32_t | distance | |||
) | [private] |
Definition at line 791 of file global-route-manager-impl.cc.
References FindOutgoingTypeId(), ns3::GlobalRoutingLinkRecord::GetLinkData(), ns3::SPFVertex::GetLSA(), ns3::SPFVertex::GetNextHop(), ns3::SPFVertex::GetOutgoingTypeId(), ns3::SPFVertex::GetParent(), ns3::SPFVertex::GetVertexId(), ns3::SPFVertex::GetVertexType(), m_spfroot, ns3::GlobalRoutingLSA::NetworkLSA, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::SPFVertex::SetDistanceFromRoot(), ns3::SPFVertex::SetNextHop(), ns3::SPFVertex::SetOutgoingTypeId(), ns3::SPFVertex::SetParent(), SPFGetNextLink(), ns3::SPFVertex::VertexNetwork, and ns3::SPFVertex::VertexRouter.
Referenced by SPFNext().
void ns3::GlobalRouteManagerImpl::SPFProcessStubs | ( | SPFVertex * | v | ) | [private] |
Definition at line 1210 of file global-route-manager-impl.cc.
References ns3::SPFVertex::GetChild(), ns3::GlobalRoutingLSA::GetLinkRecord(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::SPFVertex::GetLSA(), ns3::SPFVertex::GetNChildren(), ns3::GlobalRoutingLSA::GetNLinkRecords(), ns3::SPFVertex::GetVertexId(), ns3::SPFVertex::GetVertexType(), ns3::SPFVertex::IsVertexProcessed(), NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, ns3::SPFVertex::SetVertexProcessed(), SPFIntraAddStub(), ns3::GlobalRoutingLinkRecord::StubNetwork, and ns3::SPFVertex::VertexRouter.
Referenced by SPFCalculate().
void ns3::GlobalRouteManagerImpl::SPFVertexAddParent | ( | SPFVertex * | v | ) | [private] |
Definition at line 1651 of file global-route-manager-impl.cc.
References ns3::SPFVertex::AddChild(), ns3::SPFVertex::GetParent(), and NS_LOG_FUNCTION.
Referenced by SPFCalculate().
Definition at line 790 of file global-route-manager-impl.h.
Referenced by BuildGlobalRoutingDatabase(), DebugUseLsdb(), DeleteGlobalRoutes(), GlobalRouteManagerImpl(), SPFCalculate(), SPFNext(), and ~GlobalRouteManagerImpl().
Definition at line 809 of file global-route-manager-impl.h.
Referenced by AddGlobalRoutingProtocol(), and GetGlobalRoutingProtocol().
SPFVertex* ns3::GlobalRouteManagerImpl::m_spfroot [private] |
Definition at line 789 of file global-route-manager-impl.h.
Referenced by FindOutgoingTypeId(), SPFCalculate(), SPFIntraAddRouter(), SPFIntraAddStub(), SPFIntraAddTransit(), and SPFNexthopCalculation().