An interface aggregated to a node to provide global routing info. More...
#include <global-router-interface.h>
Public Member Functions | |
GlobalRouter () | |
Create a Global Router class. | |
uint32_t | DiscoverLSAs (void) |
Walk the connected channels, discover the adjacent routers and build the associated number of Global Routing Link State Advertisements that this router can export. | |
Ipv4RoutingTableEntry * | GetInjectedRoute (uint32_t i) |
Return the injected route indexed by i. | |
bool | GetLSA (uint32_t n, GlobalRoutingLSA &lsa) const |
Get a Global Routing Link State Advertisements that this router has said that it can export. | |
uint32_t | GetNInjectedRoutes (void) |
Get the number of injected routes that have been added to the routing table. | |
uint32_t | GetNumLSAs (void) const |
Get the Number of Global Routing Link State Advertisements that this router can export. | |
Ipv4Address | GetRouterId (void) const |
Get the Router ID associated with this Global Router. | |
Ptr< Ipv4GlobalRouting > | GetRoutingProtocol (void) |
void | InjectRoute (Ipv4Address network, Ipv4Mask networkMask) |
Inject a route to be circulated to other routers as an external route. | |
void | RemoveInjectedRoute (uint32_t i) |
Withdraw a route from the global unicast routing table. | |
void | SetRoutingProtocol (Ptr< Ipv4GlobalRouting > routing) |
bool | WithdrawRoute (Ipv4Address network, Ipv4Mask networkMask) |
Withdraw a route from the global unicast routing table. | |
![]() | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Start (void) |
![]() | |
SimpleRefCount () | |
SimpleRefCount (const SimpleRefCount &o) | |
uint32_t | GetReferenceCount (void) const |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
void | Ref (void) const |
void | Unref (void) const |
![]() | |
virtual | ~ObjectBase () |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
The Interface ID of the Global Router interface. |
Private Types | |
typedef std::list < Ipv4RoutingTableEntry * > | InjectedRoutes |
typedef std::list < Ipv4RoutingTableEntry * > ::const_iterator | InjectedRoutesCI |
typedef std::list < Ipv4RoutingTableEntry * > ::iterator | InjectedRoutesI |
typedef std::list < GlobalRoutingLSA * > | ListOfLSAs_t |
Private Attributes | |
InjectedRoutes | m_injectedRoutes |
ListOfLSAs_t | m_LSAs |
Ipv4Address | m_routerId |
Ptr< Ipv4GlobalRouting > | m_routingProtocol |
Additional Inherited Members | |
![]() | |
Object (const Object &o) | |
virtual void | DoDispose (void) |
virtual void | DoStart (void) |
virtual void | NotifyNewAggregate (void) |
An interface aggregated to a node to provide global routing info.
An interface aggregated to a node that provides global routing information to a global route manager. The presence of the interface indicates that the node is a router. The interface is the mechanism by which the router advertises its connections to neighboring routers. We're basically allowing the route manager to query for link state advertisements.
This type is not accessible from the Config system.
No Attributes are defined for this type.
No TraceSources are defined for this type.
Definition at line 576 of file global-router-interface.h.
|
private |
Definition at line 733 of file global-router-interface.h.
|
private |
Definition at line 734 of file global-router-interface.h.
|
private |
Definition at line 735 of file global-router-interface.h.
|
private |
Definition at line 727 of file global-router-interface.h.
ns3::GlobalRouter::GlobalRouter | ( | ) |
Create a Global Router class.
Definition at line 516 of file global-router-interface.cc.
References ns3::GlobalRouteManager::AllocateRouterId(), m_routerId, NS_LOG_FUNCTION_NOARGS, and ns3::Ipv4Address::Set().
|
privatevirtual |
Definition at line 523 of file global-router-interface.cc.
References ClearLSAs(), and NS_LOG_FUNCTION_NOARGS.
|
private |
Global Router copy construction is disallowed.
|
private |
Definition at line 1379 of file global-router-interface.cc.
References ns3::NetDevice::GetChannel(), ns3::Channel::GetDevice(), ns3::Node::GetId(), ns3::Channel::GetNDevices(), ns3::NetDevice::GetNode(), ns3::Object::GetObject(), NetDeviceIsBridged(), NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().
|
private |
Definition at line 1142 of file global-router-interface.cc.
References ns3::GlobalRoutingLSA::AddAttachedRouter(), FindInterfaceForDevice(), ns3::NetDeviceContainer::Get(), ns3::Ipv4::GetAddress(), ns3::NetDevice::GetChannel(), ns3::Channel::GetDevice(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::NetDeviceContainer::GetN(), ns3::Ipv4::GetNAddresses(), ns3::Channel::GetNDevices(), ns3::Ipv4::GetNInterfaces(), ns3::NetDevice::GetNode(), ns3::Object::GetObject(), ns3::Ipv4::IsUp(), ns3::GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED, m_LSAs, m_routerId, ns3::GlobalRoutingLSA::NetworkLSA, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::GlobalRoutingLSA::SetAdvertisingRouter(), ns3::GlobalRoutingLSA::SetLinkStateId(), ns3::GlobalRoutingLSA::SetLSType(), ns3::GlobalRoutingLSA::SetNetworkLSANetworkMask(), ns3::GlobalRoutingLSA::SetNode(), and ns3::GlobalRoutingLSA::SetStatus().
Referenced by DiscoverLSAs().
|
private |
Definition at line 555 of file global-router-interface.cc.
References m_LSAs, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
Referenced by DiscoverLSAs(), and ~GlobalRouter().
uint32_t ns3::GlobalRouter::DiscoverLSAs | ( | void | ) |
Walk the connected channels, discover the adjacent routers and build the associated number of Global Routing Link State Advertisements that this router can export.
This is a fairly expensive operation in that every time it is called the current list of LSAs is built by walking connected point-to-point channels and peeking into adjacent IPV4 stacks to get address information. This is done to allow for limited dynamics of the Global Routing environment. By that we mean that you can discover new link state advertisements after a network topology change by calling DiscoverLSAs and then by reading those advertisements.
Definition at line 588 of file global-router-interface.cc.
References ns3::GlobalRoutingLSA::ASExternalLSAs, BuildNetworkLSAs(), ClearLSAs(), FindInterfaceForDevice(), ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::NetDeviceContainer::GetN(), ns3::Node::GetNDevices(), ns3::Ipv4::GetNetDevice(), ns3::Ipv4::GetNInterfaces(), ns3::Object::GetObject(), ns3::NetDevice::IsBroadcast(), ns3::Ipv4::IsForwarding(), ns3::NetDevice::IsPointToPoint(), ns3::Ipv4::IsUp(), ns3::GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED, m_injectedRoutes, m_LSAs, m_routerId, NetDeviceIsBridged(), NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, ProcessBroadcastLink(), ProcessPointToPointLink(), ns3::GlobalRoutingLSA::RouterLSA, ns3::GlobalRoutingLSA::SetAdvertisingRouter(), ns3::GlobalRoutingLSA::SetLinkStateId(), ns3::GlobalRoutingLSA::SetLSType(), ns3::GlobalRoutingLSA::SetNetworkLSANetworkMask(), ns3::GlobalRoutingLSA::SetNode(), and ns3::GlobalRoutingLSA::SetStatus().
|
privatevirtual |
Definition at line 541 of file global-router-interface.cc.
References m_injectedRoutes, m_routingProtocol, and NS_LOG_FUNCTION_NOARGS.
|
private |
Definition at line 1242 of file global-router-interface.cc.
References FindInterfaceForDevice(), ns3::NetDevice::GetChannel(), ns3::Channel::GetDevice(), ns3::Node::GetId(), ns3::Channel::GetNDevices(), ns3::Ipv4::GetNInterfaces(), ns3::NetDevice::GetNode(), ns3::Object::GetObject(), NetDeviceIsBridged(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and NS_LOG_WARN.
Referenced by ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().
|
private |
Definition at line 1628 of file global-router-interface.cc.
References ns3::Node::GetId(), ns3::Object::GetObject(), NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
Referenced by BuildNetworkLSAs(), DiscoverLSAs(), FindDesignatedRouterForLink(), ProcessBridgedBroadcastLink(), ProcessPointToPointLink(), and ProcessSingleBroadcastLink().
|
private |
Definition at line 1590 of file global-router-interface.cc.
References ns3::Channel::GetDevice(), ns3::Channel::GetNDevices(), NS_ASSERT_MSG, and NS_LOG_FUNCTION_NOARGS.
Referenced by ProcessPointToPointLink().
Ipv4RoutingTableEntry * ns3::GlobalRouter::GetInjectedRoute | ( | uint32_t | i | ) |
Return the injected route indexed by i.
i | the index of the route |
Definition at line 1520 of file global-router-interface.cc.
References m_injectedRoutes, NS_ASSERT, and NS_LOG_FUNCTION.
bool ns3::GlobalRouter::GetLSA | ( | uint32_t | n, |
GlobalRoutingLSA & | lsa | ||
) | const |
Get a Global Routing Link State Advertisements that this router has said that it can export.
This is a fairly inexpensive expensive operation in that the hard work was done in GetNumLSAs. We just copy the indicated Global Routing Link State Advertisement into the requested GlobalRoutingLSA object.
You must call GlobalRouter::GetNumLSAs before calling this method in order to discover the adjacent routers and build the advertisements. GetNumLSAs will return the number of LSAs this router advertises. The parameter n (requested LSA number) must be in the range 0 to GetNumLSAs() - 1.
n | The index number of the LSA you want to read. |
lsa | The GlobalRoutingLSA class to receive the LSA information. |
Definition at line 1480 of file global-router-interface.cc.
References ns3::GlobalRoutingLSA::IsEmpty(), m_LSAs, NS_ASSERT_MSG, and NS_LOG_FUNCTION_NOARGS.
uint32_t ns3::GlobalRouter::GetNInjectedRoutes | ( | void | ) |
Get the number of injected routes that have been added to the routing table.
Definition at line 1543 of file global-router-interface.cc.
References m_injectedRoutes.
uint32_t ns3::GlobalRouter::GetNumLSAs | ( | void | ) | const |
Get the Number of Global Routing Link State Advertisements that this router can export.
To get meaningful information you must have previously called DiscoverLSAs. After you know how many LSAs are present in the router, you may call GetLSA () to retrieve the actual advertisement.
Definition at line 1470 of file global-router-interface.cc.
References m_LSAs, and NS_LOG_FUNCTION_NOARGS.
Ipv4Address ns3::GlobalRouter::GetRouterId | ( | void | ) | const |
Get the Router ID associated with this Global Router.
The Router IDs are allocated in the RoutingEnvironment – one per Router, starting at 0.0.0.1 and incrementing with each instantiation of a router.
Definition at line 575 of file global-router-interface.cc.
References m_routerId, and NS_LOG_FUNCTION_NOARGS.
Ptr< Ipv4GlobalRouting > ns3::GlobalRouter::GetRoutingProtocol | ( | void | ) |
Definition at line 535 of file global-router-interface.cc.
References m_routingProtocol.
|
static |
The Interface ID of the Global Router interface.
Reimplemented from ns3::Object.
Definition at line 509 of file global-router-interface.cc.
References ns3::TypeId::SetParent().
void ns3::GlobalRouter::InjectRoute | ( | Ipv4Address | network, |
Ipv4Mask | networkMask | ||
) |
Inject a route to be circulated to other routers as an external route.
network | The Network to inject |
networkMask | The Network Mask to inject |
Definition at line 1506 of file global-router-interface.cc.
References ns3::Ipv4RoutingTableEntry::CreateNetworkRouteTo(), m_injectedRoutes, and NS_LOG_FUNCTION.
|
private |
Definition at line 1658 of file global-router-interface.cc.
References ns3::Node::GetDevice(), ns3::Node::GetNDevices(), ns3::NetDevice::GetNode(), ns3::Object::GetObject(), ns3::NetDevice::IsBridge(), NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by AnotherRouterOnLink(), DiscoverLSAs(), and FindDesignatedRouterForLink().
|
private |
Global Router assignment operator is disallowed.
|
private |
Definition at line 860 of file global-router-interface.cc.
References ns3::NetDeviceContainer::Add(), ns3::GlobalRoutingLSA::AddLinkRecord(), AnotherRouterOnLink(), ns3::Ipv4Address::CombineMask(), FindDesignatedRouterForLink(), FindInterfaceForDevice(), ns3::Ipv4Mask::Get(), ns3::Ipv4::GetAddress(), ns3::Node::GetId(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::Ipv4::GetMetric(), ns3::Ipv4::GetNAddresses(), ns3::Ipv4::GetNInterfaces(), ns3::NetDevice::GetNode(), ns3::Object::GetObject(), ns3::NetDevice::IsBridge(), NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::Ipv4Address::Set(), ns3::GlobalRoutingLinkRecord::SetLinkData(), ns3::GlobalRoutingLinkRecord::SetLinkId(), ns3::GlobalRoutingLinkRecord::SetLinkType(), ns3::GlobalRoutingLinkRecord::SetMetric(), ns3::GlobalRoutingLinkRecord::StubNetwork, and ns3::GlobalRoutingLinkRecord::TransitNetwork.
Referenced by ProcessBroadcastLink().
|
private |
Definition at line 736 of file global-router-interface.cc.
References ns3::NetDevice::IsBridge(), NS_LOG_FUNCTION, ProcessBridgedBroadcastLink(), and ProcessSingleBroadcastLink().
Referenced by DiscoverLSAs().
|
private |
Definition at line 1021 of file global-router-interface.cc.
References ns3::GlobalRoutingLSA::AddLinkRecord(), FindInterfaceForDevice(), ns3::Ipv4Mask::Get(), ns3::Ipv4::GetAddress(), GetAdjacent(), ns3::NetDevice::GetChannel(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::Ipv4::GetMetric(), ns3::Ipv4::GetNAddresses(), ns3::Ipv4::GetNInterfaces(), ns3::NetDevice::GetNode(), ns3::Object::GetObject(), ns3::Ipv4::IsUp(), NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::GlobalRoutingLinkRecord::PointToPoint, ns3::GlobalRoutingLinkRecord::SetLinkData(), ns3::GlobalRoutingLinkRecord::SetLinkId(), ns3::GlobalRoutingLinkRecord::SetLinkType(), ns3::GlobalRoutingLinkRecord::SetMetric(), and ns3::GlobalRoutingLinkRecord::StubNetwork.
Referenced by DiscoverLSAs().
|
private |
Definition at line 751 of file global-router-interface.cc.
References ns3::NetDeviceContainer::Add(), ns3::GlobalRoutingLSA::AddLinkRecord(), AnotherRouterOnLink(), ns3::Ipv4Address::CombineMask(), FindDesignatedRouterForLink(), FindInterfaceForDevice(), ns3::Ipv4Mask::Get(), ns3::Ipv4::GetAddress(), ns3::Node::GetId(), ns3::Ipv4InterfaceAddress::GetLocal(), ns3::Ipv4InterfaceAddress::GetMask(), ns3::Ipv4::GetMetric(), ns3::Ipv4::GetNAddresses(), ns3::Ipv4::GetNInterfaces(), ns3::NetDevice::GetNode(), ns3::Object::GetObject(), NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::Ipv4Address::Set(), ns3::GlobalRoutingLinkRecord::SetLinkData(), ns3::GlobalRoutingLinkRecord::SetLinkId(), ns3::GlobalRoutingLinkRecord::SetLinkType(), ns3::GlobalRoutingLinkRecord::SetMetric(), ns3::GlobalRoutingLinkRecord::StubNetwork, and ns3::GlobalRoutingLinkRecord::TransitNetwork.
Referenced by ProcessBroadcastLink().
void ns3::GlobalRouter::RemoveInjectedRoute | ( | uint32_t | i | ) |
Withdraw a route from the global unicast routing table.
Calling this function will cause all indexed routes numbered above index i to have their index decremented. For instance, it is possible to remove N injected routes by calling RemoveInjectedRoute (0) N times.
i | The index (into the injected routing list) of the route to remove. |
Definition at line 1549 of file global-router-interface.cc.
References m_injectedRoutes, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
void ns3::GlobalRouter::SetRoutingProtocol | ( | Ptr< Ipv4GlobalRouting > | routing | ) |
Definition at line 530 of file global-router-interface.cc.
References m_routingProtocol.
bool ns3::GlobalRouter::WithdrawRoute | ( | Ipv4Address | network, |
Ipv4Mask | networkMask | ||
) |
Withdraw a route from the global unicast routing table.
network | The Network to withdraw |
networkMask | The Network Mask to withdraw |
Definition at line 1568 of file global-router-interface.cc.
References m_injectedRoutes, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
|
private |
Definition at line 736 of file global-router-interface.h.
Referenced by DiscoverLSAs(), DoDispose(), GetInjectedRoute(), GetNInjectedRoutes(), InjectRoute(), RemoveInjectedRoute(), and WithdrawRoute().
|
private |
Definition at line 728 of file global-router-interface.h.
Referenced by BuildNetworkLSAs(), ClearLSAs(), DiscoverLSAs(), GetLSA(), and GetNumLSAs().
|
private |
Definition at line 730 of file global-router-interface.h.
Referenced by BuildNetworkLSAs(), DiscoverLSAs(), GetRouterId(), and GlobalRouter().
|
private |
Definition at line 731 of file global-router-interface.h.
Referenced by DoDispose(), GetRoutingProtocol(), and SetRoutingProtocol().