A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::GlobalRouting< T > Class Template Reference

Global routing protocol for IPv4 stacks. More...

#include "global-routing.h"

Inheritance diagram for ns3::GlobalRouting< T >:
Collaboration diagram for ns3::GlobalRouting< T >:

Public Types

typedef Callback< void, Ptr< const Packet >, const IpHeader &, Socket::SocketErrnoErrorCallback
 Callback for routing errors (e.g., no route found).
typedef Callback< void, Ptr< const Packet >, const IpHeader &, uint32_tLocalDeliverCallback
 Callback for packets to be locally delivered.
typedef std::conditional_t< IsIpv4, MulticastForwardCallbackv4, MulticastForwardCallbackv6MulticastForwardCallback
 Callback for multicast packets to be forwarded.
typedef Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const IpHeader & > MulticastForwardCallbackv4
 Callback for IPv4 multicast packets to be forwarded.
typedef Callback< void, Ptr< const NetDevice >, Ptr< Ipv6MulticastRoute >, Ptr< const Packet >, const IpHeader & > MulticastForwardCallbackv6
 Callback for IPv6 multicast packets to be forwarded.
typedef std::conditional_t< IsIpv4, UnicastForwardCallbackv4, UnicastForwardCallbackv6UnicastForwardCallback
 Callback for unicast packets to be forwarded.
typedef Callback< void, Ptr< IpRoute >, Ptr< const Packet >, const IpHeader & > UnicastForwardCallbackv4
 Callback for IPv4 unicast packets to be forwarded.
typedef Callback< void, Ptr< const NetDevice >, Ptr< IpRoute >, Ptr< const Packet >, const IpHeader & > UnicastForwardCallbackv6
 Callback for IPv6 unicast packets to be forwarded.

Public Member Functions

 GlobalRouting ()
 Construct an empty Ipv4GlobalRouting routing protocol,.
 ~GlobalRouting ()
void AddASExternalRouteTo (IpAddress network, IpMaskOrPrefix networkMask, IpAddress nextHop, uint32_t interface)
 Add an external route to the global routing table.
void AddHostRouteTo (IpAddress dest, IpAddress nextHop, uint32_t interface)
 Add a host route to the global routing table.
void AddHostRouteTo (IpAddress dest, uint32_t interface)
 Add a host route to the global routing table.
void AddNetworkRouteTo (IpAddress network, IpMaskOrPrefix networkMask, IpAddress nextHop, uint32_t interface)
 Add a network route to the global routing table.
void AddNetworkRouteTo (IpAddress network, IpMaskOrPrefix networkMask, uint32_t interface)
 Add a network route to the global routing table.
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model.
uint32_t GetNRoutes () const
 Get the number of individual unicast routes that have been added to the routing table.
IpRoutingTableEntryGetRoute (uint32_t i) const
 Get a route from the global unicast routing table.
void NotifyAddAddress (uint32_t interface, IpInterfaceAddress address)
virtual void NotifyAddRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())
 Notify a new route.
void NotifyInterfaceDown (uint32_t interface)
void NotifyInterfaceUp (uint32_t interface)
void NotifyRemoveAddress (uint32_t interface, IpInterfaceAddress address)
virtual void NotifyRemoveRoute (Ipv6Address dst, Ipv6Prefix mask, Ipv6Address nextHop, uint32_t interface, Ipv6Address prefixToUse=Ipv6Address::GetZero())
 Notify route removing.
void PrintRoutingTable (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
 Print the Routing Table entries.
void RemoveRoute (uint32_t i)
 Remove a route from the global unicast routing table.
bool RouteInput (Ptr< const Packet > p, const IpHeader &header, Ptr< const NetDevice > idev, const UnicastForwardCallback &ucb, const MulticastForwardCallback &mcb, const LocalDeliverCallback &lcb, const ErrorCallback &ecb)
 Route an input packet (to be forwarded or locally delivered).
Ptr< IpRouteRouteOutput (Ptr< Packet > p, const IpHeader &header, Ptr< NetDevice > oif, Socket::SocketErrno &sockerr)
 Query routing cache for an existing route, for an outbound packet.
virtual void SetIpv4 (Ptr< Ip > ipv4)
 Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol.
virtual void SetIpv6 (Ptr< Ip > ipv6)
 Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol.

Static Public Member Functions

static TypeId GetTypeId ()
 Get the type ID.

Protected Member Functions

void DoDispose ()

Private Types

typedef std::list< IpRoutingTableEntry * > ASExternalRoutes
 container of Ipv4RoutingTableEntry (routes to external AS)
typedef std::list< IpRoutingTableEntry * >::const_iterator ASExternalRoutesCI
 const iterator of container of Ipv4RoutingTableEntry (routes to external AS)
typedef std::list< IpRoutingTableEntry * >::iterator ASExternalRoutesI
 iterator of container of Ipv4RoutingTableEntry (routes to external AS)
typedef std::list< IpRoutingTableEntry * > HostRoutes
 container of Ipv4RoutingTableEntry (routes to hosts)
typedef std::list< IpRoutingTableEntry * >::const_iterator HostRoutesCI
 const iterator of container of Ipv4RoutingTableEntry (routes to hosts)
typedef std::list< IpRoutingTableEntry * >::iterator HostRoutesI
 iterator of container of Ipv4RoutingTableEntry (routes to hosts)
using Ip = typename std::conditional_t<IsIpv4, Ipv4, Ipv6>
 Alias for Ipv4 and Ipv6 classes.
using IpAddress = typename std::conditional_t<IsIpv4, Ipv4Address, Ipv6Address>
 Alias for Ipv4Address and Ipv6Address classes.
using IpHeader = typename std::conditional_t<IsIpv4, Ipv4Header, Ipv6Header>
 Alias for Ipv4Header and Ipv6Header classes.
using IpInterfaceAddress
 Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes.
using IpManager = typename std::conditional_t<IsIpv4, Ipv4Manager, Ipv6Manager>
 Alias for Ipv4Manager and Ipv6Manager classes.
using IpMaskOrPrefix = typename std::conditional_t<IsIpv4, Ipv4Mask, Ipv6Prefix>
 Alias for Ipv4Mask And Ipv6Prefix.
using IpRoute = typename std::conditional_t<IsIpv4, Ipv4Route, Ipv6Route>
 Alias for Ipv4Route and Ipv6Route classes.
using IpRoutingProtocol
 Alias for Ipv4RoutingProtocol and Ipv6RoutingProtocol classes.
using IpRoutingTableEntry
 Alias for Ipv4RoutingTableEntry and Ipv6RoutingTableEntry classes.
typedef std::list< IpRoutingTableEntry * > NetworkRoutes
 container of Ipv4RoutingTableEntry (routes to networks)
typedef std::list< IpRoutingTableEntry * >::const_iterator NetworkRoutesCI
 const iterator of container of Ipv4RoutingTableEntry (routes to networks)
typedef std::list< IpRoutingTableEntry * >::iterator NetworkRoutesI
 iterator of container of Ipv4RoutingTableEntry (routes to networks)

Private Member Functions

Ptr< IpRouteLookupGlobal (IpAddress dest, Ptr< NetDevice > oif=nullptr)
 Lookup in the forwarding table for destination.

Private Attributes

ASExternalRoutes m_ASexternalRoutes
 External routes imported.
HostRoutes m_hostRoutes
 Routes to hosts.
Ptr< Ipm_ip
 associated IPv4 instance
NetworkRoutes m_networkRoutes
 Routes to networks.
Ptr< UniformRandomVariablem_rand
 A uniform random number generator for randomly routing packets among ECMP.
bool m_randomEcmpRouting
 Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently.
bool m_respondToInterfaceEvents
 Set to true if this interface should respond to interface events by globally recomputing routes.

Static Private Attributes

static constexpr bool IsIpv4 = std::is_same_v<Ipv4RoutingProtocol, T>
 Alias for determining whether the parent is Ipv4RoutingHelper or Ipv6RoutingHelper.

Friends

template<typename>
class GlobalRouteManagerImpl

Detailed Description

template<typename T>
class ns3::GlobalRouting< T >

Global routing protocol for IPv4 stacks.

In ns-3 we have the concept of a pluggable routing protocol. Routing protocols are added to a list maintained by the Ipv4L3Protocol. Every stack gets one routing protocol for free – the Ipv4StaticRouting routing protocol is added in the constructor of the Ipv4L3Protocol (this is the piece of code that implements the functionality of the IP layer).

As an option to running a dynamic routing protocol, a GlobalRouteManager object has been created to allow users to build routes for all participating nodes. One can think of this object as a "routing oracle"; it has an omniscient view of the topology, and can construct shortest path routes between all pairs of nodes. These routes must be stored somewhere in the node, so therefore this class Ipv4GlobalRouting is used as one of the pluggable routing protocols. It is kept distinct from Ipv4StaticRouting because these routes may be dynamically cleared and rebuilt in the middle of the simulation, while manually entered routes into the Ipv4StaticRouting may need to be kept distinct.

This class deals with Ipv4 unicast routes only.

See also
Ipv4RoutingProtocol
GlobalRouteManager

Definition at line 139 of file global-routing.h.

Member Typedef Documentation

◆ ASExternalRoutes

template<typename T>
typedef std::list<IpRoutingTableEntry*> ns3::GlobalRouting< T >::ASExternalRoutes
private

container of Ipv4RoutingTableEntry (routes to external AS)

Definition at line 525 of file global-routing.h.

◆ ASExternalRoutesCI

template<typename T>
typedef std::list<IpRoutingTableEntry*>::const_iterator ns3::GlobalRouting< T >::ASExternalRoutesCI
private

const iterator of container of Ipv4RoutingTableEntry (routes to external AS)

Definition at line 527 of file global-routing.h.

◆ ASExternalRoutesI

template<typename T>
typedef std::list<IpRoutingTableEntry*>::iterator ns3::GlobalRouting< T >::ASExternalRoutesI
private

iterator of container of Ipv4RoutingTableEntry (routes to external AS)

Definition at line 529 of file global-routing.h.

◆ ErrorCallback

template<typename T>
typedef Callback<void, Ptr<const Packet>, const IpHeader&, Socket::SocketErrno> ns3::GlobalRouting< T >::ErrorCallback

Callback for routing errors (e.g., no route found).

Definition at line 249 of file global-routing.h.

◆ HostRoutes

template<typename T>
typedef std::list<IpRoutingTableEntry*> ns3::GlobalRouting< T >::HostRoutes
private

container of Ipv4RoutingTableEntry (routes to hosts)

Definition at line 511 of file global-routing.h.

◆ HostRoutesCI

template<typename T>
typedef std::list<IpRoutingTableEntry*>::const_iterator ns3::GlobalRouting< T >::HostRoutesCI
private

const iterator of container of Ipv4RoutingTableEntry (routes to hosts)

Definition at line 513 of file global-routing.h.

◆ HostRoutesI

template<typename T>
typedef std::list<IpRoutingTableEntry*>::iterator ns3::GlobalRouting< T >::HostRoutesI
private

iterator of container of Ipv4RoutingTableEntry (routes to hosts)

Definition at line 515 of file global-routing.h.

◆ Ip

template<typename T>
using ns3::GlobalRouting< T >::Ip = typename std::conditional_t<IsIpv4, Ipv4, Ipv6>
private

Alias for Ipv4 and Ipv6 classes.

Definition at line 149 of file global-routing.h.

◆ IpAddress

template<typename T>
using ns3::GlobalRouting< T >::IpAddress = typename std::conditional_t<IsIpv4, Ipv4Address, Ipv6Address>
private

Alias for Ipv4Address and Ipv6Address classes.

Definition at line 151 of file global-routing.h.

◆ IpHeader

template<typename T>
using ns3::GlobalRouting< T >::IpHeader = typename std::conditional_t<IsIpv4, Ipv4Header, Ipv6Header>
private

Alias for Ipv4Header and Ipv6Header classes.

Definition at line 157 of file global-routing.h.

◆ IpInterfaceAddress

template<typename T>
using ns3::GlobalRouting< T >::IpInterfaceAddress
private
Initial value:
typename std::conditional_t<IsIpv4, Ipv4InterfaceAddress, Ipv6InterfaceAddress>

Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes.

Definition at line 173 of file global-routing.h.

◆ IpManager

template<typename T>
using ns3::GlobalRouting< T >::IpManager = typename std::conditional_t<IsIpv4, Ipv4Manager, Ipv6Manager>
private

Alias for Ipv4Manager and Ipv6Manager classes.

Definition at line 170 of file global-routing.h.

◆ IpMaskOrPrefix

template<typename T>
using ns3::GlobalRouting< T >::IpMaskOrPrefix = typename std::conditional_t<IsIpv4, Ipv4Mask, Ipv6Prefix>
private

Alias for Ipv4Mask And Ipv6Prefix.

Definition at line 163 of file global-routing.h.

◆ IpRoute

template<typename T>
using ns3::GlobalRouting< T >::IpRoute = typename std::conditional_t<IsIpv4, Ipv4Route, Ipv6Route>
private

Alias for Ipv4Route and Ipv6Route classes.

Definition at line 160 of file global-routing.h.

◆ IpRoutingProtocol

template<typename T>
using ns3::GlobalRouting< T >::IpRoutingProtocol
private
Initial value:
typename std::conditional_t<IsIpv4, Ipv4RoutingProtocol, Ipv6RoutingProtocol>

Alias for Ipv4RoutingProtocol and Ipv6RoutingProtocol classes.

Definition at line 153 of file global-routing.h.

◆ IpRoutingTableEntry

template<typename T>
using ns3::GlobalRouting< T >::IpRoutingTableEntry
private
Initial value:
typename std::conditional_t<IsIpv4, Ipv4RoutingTableEntry, Ipv6RoutingTableEntry>

Alias for Ipv4RoutingTableEntry and Ipv6RoutingTableEntry classes.

Definition at line 166 of file global-routing.h.

◆ LocalDeliverCallback

template<typename T>
typedef Callback<void, Ptr<const Packet>, const IpHeader&, uint32_t> ns3::GlobalRouting< T >::LocalDeliverCallback

Callback for packets to be locally delivered.

Definition at line 246 of file global-routing.h.

◆ MulticastForwardCallback

template<typename T>
typedef std::conditional_t<IsIpv4, MulticastForwardCallbackv4, MulticastForwardCallbackv6> ns3::GlobalRouting< T >::MulticastForwardCallback

Callback for multicast packets to be forwarded.

Definition at line 243 of file global-routing.h.

◆ MulticastForwardCallbackv4

template<typename T>
typedef Callback<void, Ptr<Ipv4MulticastRoute>, Ptr<const Packet>, const IpHeader&> ns3::GlobalRouting< T >::MulticastForwardCallbackv4

Callback for IPv4 multicast packets to be forwarded.

Definition at line 230 of file global-routing.h.

◆ MulticastForwardCallbackv6

template<typename T>
typedef Callback<void, Ptr<const NetDevice>, Ptr<Ipv6MulticastRoute>, Ptr<const Packet>, const IpHeader&> ns3::GlobalRouting< T >::MulticastForwardCallbackv6

Callback for IPv6 multicast packets to be forwarded.

Definition at line 238 of file global-routing.h.

◆ NetworkRoutes

template<typename T>
typedef std::list<IpRoutingTableEntry*> ns3::GlobalRouting< T >::NetworkRoutes
private

container of Ipv4RoutingTableEntry (routes to networks)

Definition at line 518 of file global-routing.h.

◆ NetworkRoutesCI

template<typename T>
typedef std::list<IpRoutingTableEntry*>::const_iterator ns3::GlobalRouting< T >::NetworkRoutesCI
private

const iterator of container of Ipv4RoutingTableEntry (routes to networks)

Definition at line 520 of file global-routing.h.

◆ NetworkRoutesI

template<typename T>
typedef std::list<IpRoutingTableEntry*>::iterator ns3::GlobalRouting< T >::NetworkRoutesI
private

iterator of container of Ipv4RoutingTableEntry (routes to networks)

Definition at line 522 of file global-routing.h.

◆ UnicastForwardCallback

template<typename T>
typedef std::conditional_t<IsIpv4, UnicastForwardCallbackv4, UnicastForwardCallbackv6> ns3::GlobalRouting< T >::UnicastForwardCallback

Callback for unicast packets to be forwarded.

Definition at line 226 of file global-routing.h.

◆ UnicastForwardCallbackv4

template<typename T>
typedef Callback<void, Ptr<IpRoute>, Ptr<const Packet>, const IpHeader&> ns3::GlobalRouting< T >::UnicastForwardCallbackv4

Callback for IPv4 unicast packets to be forwarded.

Definition at line 218 of file global-routing.h.

◆ UnicastForwardCallbackv6

template<typename T>
typedef Callback<void, Ptr<const NetDevice>, Ptr<IpRoute>, Ptr<const Packet>, const IpHeader&> ns3::GlobalRouting< T >::UnicastForwardCallbackv6

Callback for IPv6 unicast packets to be forwarded.

Definition at line 222 of file global-routing.h.

Constructor & Destructor Documentation

◆ GlobalRouting()

template<typename T>
ns3::GlobalRouting< T >::GlobalRouting ( )

Construct an empty Ipv4GlobalRouting routing protocol,.

The Ipv4GlobalRouting class supports host and network unicast routes. This method initializes the lists containing these routes to empty.

See also
Ipv4GlobalRouting

Definition at line 84 of file global-routing.cc.

References ns3::CreateObject(), m_rand, m_randomEcmpRouting, m_respondToInterfaceEvents, and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ ~GlobalRouting()

template<typename T>
ns3::GlobalRouting< T >::~GlobalRouting ( )

Definition at line 94 of file global-routing.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ AddASExternalRouteTo()

template<typename T>
void ns3::GlobalRouting< T >::AddASExternalRouteTo ( IpAddress network,
IpMaskOrPrefix networkMask,
IpAddress nextHop,
uint32_t interface )

Add an external route to the global routing table.

Parameters
networkThe Ipv4Address network for this route.
networkMaskThe Ipv4Mask to extract the network.
nextHopThe next hop Ipv4Address
interfaceThe network interface index used to send packets to the destination.

Definition at line 182 of file global-routing.cc.

References m_ASexternalRoutes, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ AddHostRouteTo() [1/2]

template<typename T>
void ns3::GlobalRouting< T >::AddHostRouteTo ( IpAddress dest,
IpAddress nextHop,
uint32_t interface )

Add a host route to the global routing table.

Parameters
destThe Ipv4Address destination for this route.
nextHopThe Ipv4Address of the next hop in the route.
interfaceThe network interface index used to send packets to the destination.
See also
Ipv4Address

Definition at line 101 of file global-routing.cc.

References m_hostRoutes, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ AddHostRouteTo() [2/2]

template<typename T>
void ns3::GlobalRouting< T >::AddHostRouteTo ( IpAddress dest,
uint32_t interface )

Add a host route to the global routing table.

Parameters
destThe Ipv4Address destination for this route.
interfaceThe network interface index used to send packets to the destination.
See also
Ipv4Address

Definition at line 120 of file global-routing.cc.

References m_hostRoutes, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ AddNetworkRouteTo() [1/2]

template<typename T>
void ns3::GlobalRouting< T >::AddNetworkRouteTo ( IpAddress network,
IpMaskOrPrefix networkMask,
IpAddress nextHop,
uint32_t interface )

Add a network route to the global routing table.

Parameters
networkThe Ipv4Address network for this route.
networkMaskThe Ipv4Mask to extract the network.
nextHopThe next hop in the route to the destination network.
interfaceThe network interface index used to send packets to the destination.
See also
Ipv4Address

Definition at line 139 of file global-routing.cc.

References m_networkRoutes, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ AddNetworkRouteTo() [2/2]

template<typename T>
void ns3::GlobalRouting< T >::AddNetworkRouteTo ( IpAddress network,
IpMaskOrPrefix networkMask,
uint32_t interface )

Add a network route to the global routing table.

Parameters
networkThe Ipv4Address network for this route.
networkMaskThe Ipv4Mask to extract the network.
interfaceThe network interface index used to send packets to the destination.
See also
Ipv4Address

Definition at line 161 of file global-routing.cc.

References m_networkRoutes, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ AssignStreams()

template<typename T>
int64_t ns3::GlobalRouting< T >::AssignStreams ( int64_t stream)

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 463 of file global-routing.cc.

References m_rand, and NS_LOG_FUNCTION.

◆ DoDispose()

template<typename T>
void ns3::GlobalRouting< T >::DoDispose ( )
protected

◆ GetNRoutes()

template<typename T>
uint32_t ns3::GlobalRouting< T >::GetNRoutes ( ) const

Get the number of individual unicast routes that have been added to the routing table.

Warning
The default route counts as one of the routes.
Returns
the number of routes

Definition at line 351 of file global-routing.cc.

References m_ASexternalRoutes, m_hostRoutes, m_networkRoutes, and NS_LOG_FUNCTION.

Referenced by PrintRoutingTable().

Here is the caller graph for this function:

◆ GetRoute()

template<typename T>
GlobalRouting< T >::IpRoutingTableEntry * ns3::GlobalRouting< T >::GetRoute ( uint32_t i) const

Get a route from the global unicast routing table.

Externally, the unicast global routing table appears simply as a table with n entries. The one subtlety of note is that if a default route has been set it will appear as the zeroth entry in the table. This means that if you add only a default route, the table will have one entry that can be accessed either by explicitly calling GetDefaultRoute () or by calling GetRoute (0).

Similarly, if the default route has been set, calling RemoveRoute (0) will remove the default route.

Parameters
iThe index (into the routing table) of the route to retrieve. If the default route has been set, it will occupy index zero.
Returns
If route is set, a pointer to that Ipv4RoutingTableEntry is returned, otherwise a zero pointer is returned.
See also
Ipv4RoutingTableEntry
Ipv4GlobalRouting::RemoveRoute

Definition at line 363 of file global-routing.cc.

References m_ASexternalRoutes, m_hostRoutes, m_networkRoutes, NS_ASSERT, and NS_LOG_FUNCTION.

Referenced by PrintRoutingTable().

Here is the caller graph for this function:

◆ GetTypeId()

template<typename T>
TypeId ns3::GlobalRouting< T >::GetTypeId ( )
static

Get the type ID.

Returns
the object TypeId

Definition at line 33 of file global-routing.cc.

References ns3::TypeId::AddAttribute(), IsIpv4, m_randomEcmpRouting, m_respondToInterfaceEvents, ns3::MakeBooleanAccessor(), ns3::MakeBooleanChecker(), and ns3::TypeId::SetParent().

Here is the call graph for this function:

◆ LookupGlobal()

template<typename T>
Ptr< typename GlobalRouting< T >::IpRoute > ns3::GlobalRouting< T >::LookupGlobal ( IpAddress dest,
Ptr< NetDevice > oif = nullptr )
private

Lookup in the forwarding table for destination.

Parameters
destdestination address
oifoutput interface if any (put 0 otherwise)
Returns
Ipv4Route to route the packet to reach dest address
Todo
handle multi-address case

Definition at line 204 of file global-routing.cc.

References ns3::Create(), IsIpv4, m_ASexternalRoutes, m_hostRoutes, m_ip, m_networkRoutes, m_rand, m_randomEcmpRouting, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by RouteInput(), and RouteOutput().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NotifyAddAddress()

template<typename T>
void ns3::GlobalRouting< T >::NotifyAddAddress ( uint32_t interface,
IpInterfaceAddress address )
Parameters
interfacethe index of the interface we are being notified about
addressa new address being added to an interface
See also
Ipv4RoutingProtocol::NotifyAddAddress
Ipv6RoutingProtocol::NotifyAddAddress

Definition at line 716 of file global-routing.cc.

References ns3::GlobalRouteManager< T >::BuildGlobalRoutingDatabase(), ns3::GlobalRouteManager< T >::DeleteGlobalRoutes(), ns3::GlobalRouteManager< T >::InitializeRoutes(), m_respondToInterfaceEvents, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ NotifyAddRoute()

template<typename T>
void ns3::GlobalRouting< T >::NotifyAddRoute ( Ipv6Address dst,
Ipv6Prefix mask,
Ipv6Address nextHop,
uint32_t interface,
Ipv6Address prefixToUse = Ipv6Address::GetZero() )
virtual

Notify a new route.

Typically this is used to add another route from IPv6 stack (i.e. ICMPv6 redirect case, ...).

Parameters
dstdestination address
maskdestination mask
nextHopnextHop for this destination
interfaceoutput interface
prefixToUseprefix to use as source with this route

Definition at line 742 of file global-routing.cc.

◆ NotifyInterfaceDown()

template<typename T>
void ns3::GlobalRouting< T >::NotifyInterfaceDown ( uint32_t interface)
Parameters
interfacethe index of the interface we are being notified about
See also
Ipv4RoutingProtocol::NotifyInterfaceDown
Ipv6RoutingProtocol::NotifyInterfaceDown

Definition at line 703 of file global-routing.cc.

References ns3::GlobalRouteManager< T >::BuildGlobalRoutingDatabase(), ns3::GlobalRouteManager< T >::DeleteGlobalRoutes(), ns3::GlobalRouteManager< T >::InitializeRoutes(), m_respondToInterfaceEvents, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ NotifyInterfaceUp()

template<typename T>
void ns3::GlobalRouting< T >::NotifyInterfaceUp ( uint32_t interface)
Parameters
interfacethe index of the interface we are being notified about
See also
Ipv4RoutingProtocol::NotifyInterfaceUp
Ipv6RoutingProtocol::NotifyInterfaceUp

Definition at line 690 of file global-routing.cc.

References ns3::GlobalRouteManager< T >::BuildGlobalRoutingDatabase(), ns3::GlobalRouteManager< T >::DeleteGlobalRoutes(), ns3::GlobalRouteManager< T >::InitializeRoutes(), m_respondToInterfaceEvents, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ NotifyRemoveAddress()

template<typename T>
void ns3::GlobalRouting< T >::NotifyRemoveAddress ( uint32_t interface,
IpInterfaceAddress address )
Parameters
interfacethe index of the interface we are being notified about
addressa new address being added to an interface
See also
Ipv4RoutingProtocol::NotifyRemoveAddress
Ipv6RoutingProtocol::NotifyRemoveAddress

Definition at line 729 of file global-routing.cc.

References ns3::GlobalRouteManager< T >::BuildGlobalRoutingDatabase(), ns3::GlobalRouteManager< T >::DeleteGlobalRoutes(), ns3::GlobalRouteManager< T >::InitializeRoutes(), m_respondToInterfaceEvents, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ NotifyRemoveRoute()

template<typename T>
void ns3::GlobalRouting< T >::NotifyRemoveRoute ( Ipv6Address dst,
Ipv6Prefix mask,
Ipv6Address nextHop,
uint32_t interface,
Ipv6Address prefixToUse = Ipv6Address::GetZero() )
virtual

Notify route removing.

Parameters
dstdestination address
maskdestination mask
nextHopnextHop for this destination
interfaceoutput interface
prefixToUseprefix to use as source with this route

Definition at line 752 of file global-routing.cc.

◆ PrintRoutingTable()

template<typename T>
void ns3::GlobalRouting< T >::PrintRoutingTable ( Ptr< OutputStreamWrapper > stream,
Time::Unit unit = Time::S ) const

Print the Routing Table entries.

Parameters
streamThe ostream the Routing table is printed to
unitThe time unit to be used in the report
See also
Ipv4RoutingProtocol::PrintRoutingTable
Ipv6RoutingProtocol::PrintRoutingTable

Definition at line 495 of file global-routing.cc.

References ns3::Time::As(), ns3::Names::FindName(), GetNRoutes(), GetRoute(), IsIpv4, m_ip, ns3::Now(), and NS_LOG_FUNCTION.

Here is the call graph for this function:

◆ RemoveRoute()

template<typename T>
void ns3::GlobalRouting< T >::RemoveRoute ( uint32_t i)

Remove a route from the global unicast routing table.

Externally, the unicast global routing table appears simply as a table with n entries. The one subtlety of note is that if a default route has been set it will appear as the zeroth entry in the table. This means that if the default route has been set, calling RemoveRoute (0) will remove the default route.

Parameters
iThe index (into the routing table) of the route to remove. If the default route has been set, it will occupy index zero.
See also
Ipv4RoutingTableEntry
Ipv4GlobalRouting::GetRoute
Ipv4GlobalRouting::AddRoute

Definition at line 408 of file global-routing.cc.

References m_ASexternalRoutes, m_hostRoutes, m_networkRoutes, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ RouteInput()

template<typename T>
bool ns3::GlobalRouting< T >::RouteInput ( Ptr< const Packet > p,
const IpHeader & header,
Ptr< const NetDevice > idev,
const UnicastForwardCallback & ucb,
const MulticastForwardCallback & mcb,
const LocalDeliverCallback & lcb,
const ErrorCallback & ecb )

Route an input packet (to be forwarded or locally delivered).

Parameters
preceived packet
headerinput parameter used to form a search key for a route
idevPointer to ingress network device
ucbCallback for the case in which the packet is to be forwarded as unicast
mcbCallback for the case in which the packet is to be forwarded as multicast
lcbCallback for the case in which the packet is to be locally delivered
ecbCallback to call if there is an error in forwarding
Returns
true if GlobalRouting class takes responsibility for forwarding or delivering the packet, false otherwise
See also
Ipv4RoutingProtocol::RouteInput
Ipv6RoutingProtocol::RouteInput

Definition at line 618 of file global-routing.cc.

References ns3::Socket::ERROR_NOROUTETOHOST, IsIpv4, ns3::Callback< R, UArgs >::IsNull(), LookupGlobal(), m_ip, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Here is the call graph for this function:

◆ RouteOutput()

template<typename T>
Ptr< typename GlobalRouting< T >::IpRoute > ns3::GlobalRouting< T >::RouteOutput ( Ptr< Packet > p,
const IpHeader & header,
Ptr< NetDevice > oif,
Socket::SocketErrno & sockerr )

Query routing cache for an existing route, for an outbound packet.

Parameters
ppacket to be routed. Note that this method may modify the packet. Callers may also pass in a null pointer.
headerinput parameter (used to form key to search for the route)
oifOutput interface Netdevice. May be zero, or may be bound via socket options to a particular output interface.
sockerrOutput parameter; socket errno
Returns
a code that indicates what happened in the lookup
See also
Ipv4RoutingProtocol::RouteOutput
Ipv6RoutingProtocol::RouteOutput

Definition at line 585 of file global-routing.cc.

References ns3::Socket::ERROR_NOROUTETOHOST, ns3::Socket::ERROR_NOTERROR, LookupGlobal(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Here is the call graph for this function:

◆ SetIpv4()

template<typename T>
void ns3::GlobalRouting< T >::SetIpv4 ( Ptr< Ip > ipv4)
virtual

Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol.

Parameters
ipv4the ipv4 object this routing protocol is being associated with
See also
Ipv4RoutingProtocol::SetIpv4

Definition at line 763 of file global-routing.cc.

References m_ip, NS_ASSERT, and NS_LOG_FUNCTION.

◆ SetIpv6()

template<typename T>
void ns3::GlobalRouting< T >::SetIpv6 ( Ptr< Ip > ipv6)
virtual

Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol.

Parameters
ipv6the ipv6 object this routing protocol is being associated with
See also
Ipv6RoutingProtocol::SetIpv6

Definition at line 773 of file global-routing.cc.

References m_ip, NS_ASSERT, and NS_LOG_FUNCTION.

◆ GlobalRouteManagerImpl

template<typename T>
template<typename>
friend class GlobalRouteManagerImpl
friend

Definition at line 144 of file global-routing.h.

Member Data Documentation

◆ IsIpv4

template<typename T>
bool ns3::GlobalRouting< T >::IsIpv4 = std::is_same_v<Ipv4RoutingProtocol, T>
staticconstexprprivate

Alias for determining whether the parent is Ipv4RoutingHelper or Ipv6RoutingHelper.

Definition at line 147 of file global-routing.h.

Referenced by GetTypeId(), LookupGlobal(), PrintRoutingTable(), and RouteInput().

◆ m_ASexternalRoutes

template<typename T>
ASExternalRoutes ns3::GlobalRouting< T >::m_ASexternalRoutes
private

External routes imported.

Definition at line 541 of file global-routing.h.

Referenced by AddASExternalRouteTo(), DoDispose(), GetNRoutes(), GetRoute(), LookupGlobal(), and RemoveRoute().

◆ m_hostRoutes

template<typename T>
HostRoutes ns3::GlobalRouting< T >::m_hostRoutes
private

Routes to hosts.

Definition at line 539 of file global-routing.h.

Referenced by AddHostRouteTo(), AddHostRouteTo(), DoDispose(), GetNRoutes(), GetRoute(), LookupGlobal(), and RemoveRoute().

◆ m_ip

template<typename T>
Ptr<Ip> ns3::GlobalRouting< T >::m_ip
private

associated IPv4 instance

Definition at line 543 of file global-routing.h.

Referenced by LookupGlobal(), PrintRoutingTable(), RouteInput(), SetIpv4(), and SetIpv6().

◆ m_networkRoutes

template<typename T>
NetworkRoutes ns3::GlobalRouting< T >::m_networkRoutes
private

Routes to networks.

Definition at line 540 of file global-routing.h.

Referenced by AddNetworkRouteTo(), AddNetworkRouteTo(), DoDispose(), GetNRoutes(), GetRoute(), LookupGlobal(), and RemoveRoute().

◆ m_rand

template<typename T>
Ptr<UniformRandomVariable> ns3::GlobalRouting< T >::m_rand
private

A uniform random number generator for randomly routing packets among ECMP.

Definition at line 508 of file global-routing.h.

Referenced by GlobalRouting(), AssignStreams(), and LookupGlobal().

◆ m_randomEcmpRouting

template<typename T>
bool ns3::GlobalRouting< T >::m_randomEcmpRouting
private

Set to true if packets are randomly routed among ECMP; set to false for using only one route consistently.

Definition at line 503 of file global-routing.h.

Referenced by GlobalRouting(), GetTypeId(), and LookupGlobal().

◆ m_respondToInterfaceEvents

template<typename T>
bool ns3::GlobalRouting< T >::m_respondToInterfaceEvents
private

Set to true if this interface should respond to interface events by globally recomputing routes.

Definition at line 506 of file global-routing.h.

Referenced by GlobalRouting(), GetTypeId(), NotifyAddAddress(), NotifyInterfaceDown(), NotifyInterfaceUp(), and NotifyRemoveAddress().


The documentation for this class was generated from the following files: