A Discrete-Event Network Simulator
API
ns3::NixVectorRouting< T > Class Template Reference

Nix-vector routing protocol. More...

#include "nix-vector-routing.h"

+ Inheritance diagram for ns3::NixVectorRouting< T >:
+ Collaboration diagram for ns3::NixVectorRouting< T >:

Public Member Functions

 NixVectorRouting ()
 
 ~NixVectorRouting ()
 
void FlushGlobalNixRoutingCache (void) const
 Called when run-time link topology change occurs which iterates through the node list and flushes any nix vector caches. More...
 
void PrintRoutingPath (Ptr< Node > source, IpAddress dest, Ptr< OutputStreamWrapper > stream, Time::Unit unit) const
 Print the Routing Path according to Nix Routing. More...
 
void SetNode (Ptr< Node > node)
 Set the Node pointer of the node for which this routing protocol is to be placed. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 The Interface ID of the Global Router interface. More...
 

Private Types

typedef Callback< void, Ptr< const Packet >, const IpHeader &, Socket::SocketErrnoErrorCallback
 Callback for routing errors (e.g., no route found) More...
 
using Ip = typename std::conditional< IsIpv4::value, Ipv4, Ipv6 >::type
 Alias for Ipv4 and Ipv6 classes. More...
 
using IpAddress = typename std::conditional< IsIpv4::value, Ipv4Address, Ipv6Address >::type
 Alias for Ipv4Address and Ipv6Address classes. More...
 
using IpAddressHash = typename std::conditional< IsIpv4::value, Ipv4AddressHash, Ipv6AddressHash >::type
 Alias for Ipv4AddressHash and Ipv6AddressHash classes. More...
 
typedef std::unordered_map< IpAddress, ns3::Ptr< ns3::Node >, IpAddressHashIpAddressToNodeMap
 Mapping of IP address to ns-3 node. More...
 
using IpHeader = typename std::conditional< IsIpv4::value, Ipv4Header, Ipv6Header >::type
 Alias for Ipv4Header and Ipv6Header classes. More...
 
using IpInterface = typename std::conditional< IsIpv4::value, Ipv4Interface, Ipv6Interface >::type
 Alias for Ipv4Interface and Ipv6Interface classes. More...
 
using IpInterfaceAddress = typename std::conditional< IsIpv4::value, Ipv4InterfaceAddress, Ipv6InterfaceAddress >::type
 Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes. More...
 
using IpL3Protocol = typename std::conditional< IsIpv4::value, Ipv4L3Protocol, Ipv6L3Protocol >::type
 Alias for Ipv4L3Protocol and Ipv4L3Protocol classes. More...
 
using IpRoute = typename std::conditional< IsIpv4::value, Ipv4Route, Ipv6Route >::type
 Alias for Ipv4Route and Ipv6Route classes. More...
 
typedef std::map< IpAddress, Ptr< IpRoute > > IpRouteMap_t
 Map of IpAddress to IpRoute. More...
 
using IsIpv4 = std::is_same< Ipv4RoutingProtocol, T >
 Alias for determining whether the parent is Ipv4RoutingProtocol or Ipv6RoutingProtocol. More...
 
typedef Callback< void, Ptr< const Packet >, const IpHeader &, uint32_t > LocalDeliverCallback
 Callback for packets to be locally delivered. More...
 
typedef std::conditional< IsIpv4::value, MulticastForwardCallbackv4, MulticastForwardCallbackv6 >::type MulticastForwardCallback
 Callback for multicast packets to be forwarded. More...
 
typedef Callback< void, Ptr< Ipv4MulticastRoute >, Ptr< const Packet >, const IpHeader & > MulticastForwardCallbackv4
 Callback for IPv4 multicast packets to be forwarded. More...
 
typedef Callback< void, Ptr< const NetDevice >, Ptr< Ipv6MulticastRoute >, Ptr< const Packet >, const IpHeader & > MulticastForwardCallbackv6
 Callback for IPv6 multicast packets to be forwarded. More...
 
typedef std::unordered_map< Ptr< NetDevice >, Ptr< IpInterface > > NetDeviceToIpInterfaceMap
 Mapping of Ptr<NetDevice> to Ptr<IpInterface>. More...
 
typedef std::map< IpAddress, Ptr< NixVector > > NixMap_t
 Map of IpAddress to NixVector. More...
 
typedef std::conditional< IsIpv4::value, UnicastForwardCallbackv4, UnicastForwardCallbackv6 >::type UnicastForwardCallback
 Callback for unicast packets to be forwarded. More...
 
typedef Callback< void, Ptr< IpRoute >, Ptr< const Packet >, const IpHeader & > UnicastForwardCallbackv4
 Callback for IPv4 unicast packets to be forwarded. More...
 
typedef Callback< void, Ptr< const NetDevice >, Ptr< IpRoute >, Ptr< const Packet >, const IpHeader & > UnicastForwardCallbackv6
 Callback for IPv6 unicast packets to be forwarded. More...
 

Private Member Functions

bool BFS (uint32_t numberOfNodes, Ptr< Node > source, Ptr< Node > dest, std::vector< Ptr< Node > > &parentVector, Ptr< NetDevice > oif) const
 Breadth first search algorithm. More...
 
void BuildIpAddressToNodeMap (void) const
 Build map from IP Address to Node for faster lookup. More...
 
bool BuildNixVector (const std::vector< Ptr< Node > > &parentVector, uint32_t source, uint32_t dest, Ptr< NixVector > nixVector) const
 Recurses the T vector, created by BFS and actually builds the nixvector. More...
 
void CheckCacheStateAndFlush (void) const
 Flushes routing caches if required. More...
 
void DoDispose (void)
 
void DoInitialize ()
 
uint32_t FindNetDeviceForNixIndex (Ptr< Node > node, uint32_t nodeIndex, IpAddress &gatewayIp) const
 Nix index is with respect to the neighbors. More...
 
uint32_t FindTotalNeighbors (Ptr< Node > node) const
 Simply iterates through the nodes net-devices and determines how many neighbors the node has. More...
 
void FlushIpRouteCache (void) const
 Flushes the cache which stores the Ip route based on the destination IP. More...
 
void FlushNixCache (void) const
 Flushes the cache which stores nix-vector based on destination IP. More...
 
void GetAdjacentNetDevices (Ptr< NetDevice > netDevice, Ptr< Channel > channel, NetDeviceContainer &netDeviceContainer) const
 Given a net-device returns all the adjacent net-devices, essentially getting the neighbors on that channel. More...
 
Ptr< IpInterfaceGetInterfaceByNetDevice (Ptr< NetDevice > netDevice) const
 Iterates through the node list and finds the one corresponding to the given IpAddress. More...
 
Ptr< IpRouteGetIpRouteInCache (IpAddress address)
 Checks the cache based on dest IP for the IpRoute. More...
 
Ptr< NixVectorGetNixVector (Ptr< Node > source, IpAddress dest, Ptr< NetDevice > oif) const
 Takes in the source node and dest IP and calls GetNodeByIp, BFS, accounting for any output interface specified, and finally BuildNixVector to return the built nix-vector. More...
 
Ptr< NixVectorGetNixVectorInCache (const IpAddress &address, bool &foundInCache) const
 Checks the cache based on dest IP for the nix-vector. More...
 
Ptr< NodeGetNodeByIp (IpAddress dest) const
 Iterates through the node list and finds the one corresponding to the given IpAddress. More...
 
Ptr< BridgeNetDeviceNetDeviceIsBridged (Ptr< NetDevice > nd) const
 Determine if the NetDevice is bridged. More...
 
virtual void NotifyAddAddress (uint32_t interface, IpInterfaceAddress address)
 
virtual void NotifyAddRoute (IpAddress dst, Ipv6Prefix mask, IpAddress nextHop, uint32_t interface, IpAddress prefixToUse=IpAddress::GetZero())
 Notify a new route. More...
 
virtual void NotifyInterfaceDown (uint32_t interface)
 
virtual void NotifyInterfaceUp (uint32_t interface)
 
virtual void NotifyRemoveAddress (uint32_t interface, IpInterfaceAddress address)
 
virtual void NotifyRemoveRoute (IpAddress dst, Ipv6Prefix mask, IpAddress nextHop, uint32_t interface, IpAddress prefixToUse=IpAddress::GetZero())
 Notify route removing. More...
 
virtual void PrintRoutingTable (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
 Print the Routing Table entries. More...
 
void ResetTotalNeighbors (void)
 Upon a run-time topology change caches are flushed and the total number of neighbors is reset to zero. More...
 
virtual bool RouteInput (Ptr< const Packet > p, const IpHeader &header, Ptr< const NetDevice > idev, UnicastForwardCallback ucb, MulticastForwardCallback mcb, LocalDeliverCallback lcb, ErrorCallback ecb)
 Route an input packet (to be forwarded or locally delivered) More...
 
virtual 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. More...
 
virtual void SetIpv4 (Ptr< Ip > ipv4)
 Typically, invoked directly or indirectly from ns3::Ipv4::SetRoutingProtocol. More...
 
virtual void SetIpv6 (Ptr< Ip > ipv6)
 Typically, invoked directly or indirectly from ns3::Ipv6::SetRoutingProtocol. More...
 

Private Attributes

Ptr< Ipm_ip
 IP object. More...
 
IpRouteMap_t m_ipRouteCache
 Cache stores IpRoutes based on destination ip. More...
 
NixMap_t m_nixCache
 Cache stores nix-vectors based on destination ip. More...
 
Ptr< Nodem_node
 Node object. More...
 
uint32_t m_totalNeighbors
 Total neighbors used for nix-vector to determine number of bits. More...
 

Static Private Attributes

static uint32_t g_epoch = 1
 Nix Epoch, incremented each time a flush is perfomed. More...
 
static IpAddressToNodeMap g_ipAddressToNodeMap
 Address to node map. More...
 
static bool g_isCacheDirty = false
 Flag to mark when caches are dirty and need to be flushed. More...
 
static NetDeviceToIpInterfaceMap g_netdeviceToIpInterfaceMap
 NetDevice pointer to IpInterface pointer map. More...
 

Detailed Description

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

Nix-vector routing protocol.

Internal:
Since this class is meant to be specialized only by Ipv4RoutingProtocol or Ipv6RoutingProtocol the implementation of this class doesn't need to be exposed here; it is in nix-vector-routing.cc.

Definition at line 67 of file nix-vector-routing.h.

Member Typedef Documentation

◆ ErrorCallback

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

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

Definition at line 302 of file nix-vector-routing.h.

◆ Ip

template<typename T >
using ns3::NixVectorRouting< T >::Ip = typename std::conditional <IsIpv4::value, Ipv4, Ipv6>::type
private

Alias for Ipv4 and Ipv6 classes.

Definition at line 73 of file nix-vector-routing.h.

◆ IpAddress

template<typename T >
using ns3::NixVectorRouting< T >::IpAddress = typename std::conditional<IsIpv4::value, Ipv4Address, Ipv6Address>::type
private

Alias for Ipv4Address and Ipv6Address classes.

Definition at line 76 of file nix-vector-routing.h.

◆ IpAddressHash

template<typename T >
using ns3::NixVectorRouting< T >::IpAddressHash = typename std::conditional<IsIpv4::value, Ipv4AddressHash, Ipv6AddressHash>::type
private

Alias for Ipv4AddressHash and Ipv6AddressHash classes.

Definition at line 82 of file nix-vector-routing.h.

◆ IpAddressToNodeMap

template<typename T >
typedef std::unordered_map<IpAddress, ns3::Ptr<ns3::Node>, IpAddressHash > ns3::NixVectorRouting< T >::IpAddressToNodeMap
private

Mapping of IP address to ns-3 node.

Used to avoid linear searching of nodes/devices to find a node in GetNodeByIp() method. NIX vector routing assumes IP addresses are unique so mapping can be done without duplication.

Definition at line 476 of file nix-vector-routing.h.

◆ IpHeader

template<typename T >
using ns3::NixVectorRouting< T >::IpHeader = typename std::conditional<IsIpv4::value, Ipv4Header, Ipv6Header>::type
private

Alias for Ipv4Header and Ipv6Header classes.

Definition at line 85 of file nix-vector-routing.h.

◆ IpInterface

template<typename T >
using ns3::NixVectorRouting< T >::IpInterface = typename std::conditional<IsIpv4::value, Ipv4Interface, Ipv6Interface>::type
private

Alias for Ipv4Interface and Ipv6Interface classes.

Definition at line 91 of file nix-vector-routing.h.

◆ IpInterfaceAddress

template<typename T >
using ns3::NixVectorRouting< T >::IpInterfaceAddress = typename std::conditional<IsIpv4::value, Ipv4InterfaceAddress, Ipv6InterfaceAddress>::type
private

Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes.

Definition at line 88 of file nix-vector-routing.h.

◆ IpL3Protocol

template<typename T >
using ns3::NixVectorRouting< T >::IpL3Protocol = typename std::conditional<IsIpv4::value, Ipv4L3Protocol, Ipv6L3Protocol>::type
private

Alias for Ipv4L3Protocol and Ipv4L3Protocol classes.

Definition at line 94 of file nix-vector-routing.h.

◆ IpRoute

template<typename T >
using ns3::NixVectorRouting< T >::IpRoute = typename std::conditional<IsIpv4::value, Ipv4Route, Ipv6Route>::type
private

Alias for Ipv4Route and Ipv6Route classes.

Definition at line 79 of file nix-vector-routing.h.

◆ IpRouteMap_t

template<typename T >
typedef std::map<IpAddress, Ptr<IpRoute> > ns3::NixVectorRouting< T >::IpRouteMap_t
private

Map of IpAddress to IpRoute.

Definition at line 278 of file nix-vector-routing.h.

◆ IsIpv4

template<typename T >
using ns3::NixVectorRouting< T >::IsIpv4 = std::is_same <Ipv4RoutingProtocol, T>
private

Alias for determining whether the parent is Ipv4RoutingProtocol or Ipv6RoutingProtocol.

Definition at line 70 of file nix-vector-routing.h.

◆ LocalDeliverCallback

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

Callback for packets to be locally delivered.

Definition at line 299 of file nix-vector-routing.h.

◆ MulticastForwardCallback

template<typename T >
typedef std::conditional<IsIpv4::value, MulticastForwardCallbackv4, MulticastForwardCallbackv6>::type ns3::NixVectorRouting< T >::MulticastForwardCallback
private

Callback for multicast packets to be forwarded.

Definition at line 296 of file nix-vector-routing.h.

◆ MulticastForwardCallbackv4

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

Callback for IPv4 multicast packets to be forwarded.

Definition at line 290 of file nix-vector-routing.h.

◆ MulticastForwardCallbackv6

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

Callback for IPv6 multicast packets to be forwarded.

Definition at line 293 of file nix-vector-routing.h.

◆ NetDeviceToIpInterfaceMap

template<typename T >
typedef std::unordered_map<Ptr<NetDevice>, Ptr<IpInterface> > ns3::NixVectorRouting< T >::NetDeviceToIpInterfaceMap
private

Mapping of Ptr<NetDevice> to Ptr<IpInterface>.

Definition at line 480 of file nix-vector-routing.h.

◆ NixMap_t

template<typename T >
typedef std::map<IpAddress, Ptr<NixVector> > ns3::NixVectorRouting< T >::NixMap_t
private

Map of IpAddress to NixVector.

Definition at line 276 of file nix-vector-routing.h.

◆ UnicastForwardCallback

template<typename T >
typedef std::conditional<IsIpv4::value, UnicastForwardCallbackv4, UnicastForwardCallbackv6>::type ns3::NixVectorRouting< T >::UnicastForwardCallback
private

Callback for unicast packets to be forwarded.

Definition at line 287 of file nix-vector-routing.h.

◆ UnicastForwardCallbackv4

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

Callback for IPv4 unicast packets to be forwarded.

Definition at line 281 of file nix-vector-routing.h.

◆ UnicastForwardCallbackv6

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

Callback for IPv6 unicast packets to be forwarded.

Definition at line 284 of file nix-vector-routing.h.

Constructor & Destructor Documentation

◆ NixVectorRouting()

template<typename T >
ns3::NixVectorRouting< T >::NixVectorRouting

Definition at line 72 of file nix-vector-routing.cc.

References NS_LOG_FUNCTION_NOARGS.

◆ ~NixVectorRouting()

template<typename T >
ns3::NixVectorRouting< T >::~NixVectorRouting

Definition at line 79 of file nix-vector-routing.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

◆ BFS()

template<typename T >
bool ns3::NixVectorRouting< T >::BFS ( uint32_t  numberOfNodes,
Ptr< Node source,
Ptr< Node dest,
std::vector< Ptr< Node > > &  parentVector,
Ptr< NetDevice oif 
) const
private

Breadth first search algorithm.

Parameters
[in]numberOfNodestotal number of nodes
[in]sourceSource Node
[in]destDestination Node
[out]parentVectorParent vector for retracing routes
[in]oifspecific output interface to use from source node, if not null
Returns
false if dest not found, true o.w.

Definition at line 1077 of file nix-vector-routing.cc.

References ns3::NetDeviceContainer::Begin(), third::channel, ns3::NetDeviceContainer::End(), ns3::NetDevice::GetChannel(), ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::Node::GetNDevices(), ns3::Object::GetObject(), ns3::NetDevice::IsLinkUp(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ BuildIpAddressToNodeMap()

template<typename T >
void ns3::NixVectorRouting< T >::BuildIpAddressToNodeMap ( void  ) const
private

Build map from IP Address to Node for faster lookup.

Definition at line 452 of file nix-vector-routing.cc.

References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::Node::GetNDevices(), ns3::Object::GetObject(), NS_ABORT_MSG_IF, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ BuildNixVector()

template<typename T >
bool ns3::NixVectorRouting< T >::BuildNixVector ( const std::vector< Ptr< Node > > &  parentVector,
uint32_t  source,
uint32_t  dest,
Ptr< NixVector nixVector 
) const
private

Recurses the T vector, created by BFS and actually builds the nixvector.

Parameters
[in]parentVectorParent vector for retracing routes
[in]sourceSource Node index
[in]destDestination Node index
[out]nixVectorthe NixVector to be used for routing
Returns
true on success, false otherwise.

Definition at line 279 of file nix-vector-routing.cc.

References ns3::NixVector::AddNeighborIndex(), ns3::NetDeviceContainer::Begin(), ns3::NixVector::BitCount(), third::channel, ns3::NetDeviceContainer::End(), ns3::NetDevice::GetChannel(), ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::NetDeviceContainer::GetN(), ns3::Node::GetNDevices(), ns3::NetDevice::IsBridge(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ CheckCacheStateAndFlush()

template<typename T >
void ns3::NixVectorRouting< T >::CheckCacheStateAndFlush ( void  ) const
private

Flushes routing caches if required.

Definition at line 1366 of file nix-vector-routing.cc.

◆ DoDispose()

template<typename T >
void ns3::NixVectorRouting< T >::DoDispose ( void  )
private

◆ DoInitialize()

template<typename T >
void ns3::NixVectorRouting< T >::DoInitialize ( void  )
private

◆ FindNetDeviceForNixIndex()

template<typename T >
uint32_t ns3::NixVectorRouting< T >::FindNetDeviceForNixIndex ( Ptr< Node node,
uint32_t  nodeIndex,
IpAddress gatewayIp 
) const
private

Nix index is with respect to the neighbors.

The net-device index must be derived from this

Parameters
[in]nodethe current node under consideration
[in]nodeIndexNix Node index
[out]gatewayIpIP address of the gateway
Returns
the index of the NetDevice in the node.

Definition at line 629 of file nix-vector-routing.cc.

References third::channel, ns3::NetDeviceContainer::Get(), ns3::NetDevice::GetChannel(), ns3::Node::GetDevice(), ns3::NetDeviceContainer::GetN(), ns3::Node::GetNDevices(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ FindTotalNeighbors()

template<typename T >
uint32_t ns3::NixVectorRouting< T >::FindTotalNeighbors ( Ptr< Node node) const
private

Simply iterates through the nodes net-devices and determines how many neighbors the node has.

Parameters
[in]nodenode pointer
Returns
the number of neighbors of m_node.

Definition at line 554 of file nix-vector-routing.cc.

References third::channel, ns3::NetDevice::GetChannel(), ns3::Node::GetDevice(), ns3::NetDeviceContainer::GetN(), ns3::Node::GetNDevices(), and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ FlushGlobalNixRoutingCache()

template<typename T >
template void ns3::NixVectorRouting< T >::FlushGlobalNixRoutingCache ( void  ) const

Called when run-time link topology change occurs which iterates through the node list and flushes any nix vector caches.

Internal:
const is used here due to need to potentially flush the cache in const methods such as PrintRoutingTable. Caches are stored in mutable variables and flushed in const methods.

Definition at line 143 of file nix-vector-routing.cc.

References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::Object::GetObject(), NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ FlushIpRouteCache()

template<typename T >
void ns3::NixVectorRouting< T >::FlushIpRouteCache ( void  ) const
private

Flushes the cache which stores the Ip route based on the destination IP.

Definition at line 177 of file nix-vector-routing.cc.

References NS_LOG_FUNCTION_NOARGS.

◆ FlushNixCache()

template<typename T >
void ns3::NixVectorRouting< T >::FlushNixCache ( void  ) const
private

Flushes the cache which stores nix-vector based on destination IP.

Definition at line 169 of file nix-vector-routing.cc.

References NS_LOG_FUNCTION_NOARGS.

◆ GetAdjacentNetDevices()

template<typename T >
void ns3::NixVectorRouting< T >::GetAdjacentNetDevices ( Ptr< NetDevice netDevice,
Ptr< Channel channel,
NetDeviceContainer netDeviceContainer 
) const
private

Given a net-device returns all the adjacent net-devices, essentially getting the neighbors on that channel.

Parameters
[in]netDevicethe NetDevice attached to the channel.
[in]channelthe channel to check
[out]netDeviceContainerthe NetDeviceContainer of the NetDevices in the channel.

Definition at line 353 of file nix-vector-routing.cc.

References ns3::NetDeviceContainer::Add(), third::channel, ns3::NetDevice::GetChannel(), bianchi11ax::k, ns3::Ipv6InterfaceAddress::LINKLOCAL, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ GetInterfaceByNetDevice()

template<typename T >
Ptr< typename NixVectorRouting< T >::IpInterface > ns3::NixVectorRouting< T >::GetInterfaceByNetDevice ( Ptr< NetDevice netDevice) const
private

Iterates through the node list and finds the one corresponding to the given IpAddress.

Parameters
netDeviceNetDevice pointer
Returns
The node with the specified IP.

Definition at line 527 of file nix-vector-routing.cc.

References NS_LOG_ERROR.

◆ GetIpRouteInCache()

template<typename T >
Ptr< typename NixVectorRouting< T >::IpRoute > ns3::NixVectorRouting< T >::GetIpRouteInCache ( IpAddress  address)
private

Checks the cache based on dest IP for the IpRoute.

Parameters
addressAddress to check
Returns
The cached route.

Definition at line 260 of file nix-vector-routing.cc.

References first::address, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ GetNixVector()

template<typename T >
Ptr< NixVector > ns3::NixVectorRouting< T >::GetNixVector ( Ptr< Node source,
IpAddress  dest,
Ptr< NetDevice oif 
) const
private

Takes in the source node and dest IP and calls GetNodeByIp, BFS, accounting for any output interface specified, and finally BuildNixVector to return the built nix-vector.

Parameters
sourceSource node
destDestination node address
oifPreferred output interface
Returns
The NixVector to be used in routing.
Internal:
Do not process packets to self (see Bug 1308)

Definition at line 185 of file nix-vector-routing.cc.

References ns3::Node::GetId(), ns3::NodeList::GetNNodes(), NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_FUNCTION, and ns3::NixVector::SetEpoch().

+ Here is the call graph for this function:

◆ GetNixVectorInCache()

template<typename T >
Ptr< NixVector > ns3::NixVectorRouting< T >::GetNixVectorInCache ( const IpAddress address,
bool &  foundInCache 
) const
private

Checks the cache based on dest IP for the nix-vector.

Parameters
addressAddress to check
foundInCacheAddress found in cache
Returns
The NixVector to be used in routing.

Definition at line 239 of file nix-vector-routing.cc.

References first::address, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

◆ GetNodeByIp()

template<typename T >
Ptr< Node > ns3::NixVectorRouting< T >::GetNodeByIp ( IpAddress  dest) const
private

Iterates through the node list and finds the one corresponding to the given IpAddress.

Parameters
destdestination node IP
Returns
The node with the specified IP.

Definition at line 498 of file nix-vector-routing.cc.

References NS_LOG_ERROR, and NS_LOG_FUNCTION.

◆ GetTypeId()

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

The Interface ID of the Global Router interface.

Returns
The Interface ID
See also
Object::GetObject ()

Definition at line 59 of file nix-vector-routing.cc.

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ NetDeviceIsBridged()

template<typename T >
Ptr< BridgeNetDevice > ns3::NixVectorRouting< T >::NetDeviceIsBridged ( Ptr< NetDevice nd) const
private

Determine if the NetDevice is bridged.

Parameters
ndthe NetDevice to check
Returns
the bridging NetDevice (or null if the NetDevice is not bridged)

Definition at line 588 of file nix-vector-routing.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.

+ Here is the call graph for this function:

◆ NotifyAddAddress()

template<typename T >
void ns3::NixVectorRouting< T >::NotifyAddAddress ( uint32_t  interface,
IpInterfaceAddress  address 
)
privatevirtual
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 1052 of file nix-vector-routing.cc.

◆ NotifyAddRoute()

template<typename T >
void ns3::NixVectorRouting< T >::NotifyAddRoute ( IpAddress  dst,
Ipv6Prefix  mask,
IpAddress  nextHop,
uint32_t  interface,
IpAddress  prefixToUse = IpAddress::GetZero () 
)
privatevirtual

Notify a new route.

Parameters
dstdestination address
maskdestination mask
nextHopnextHop for this destination
interfaceoutput interface
prefixToUseprefix to use as source with this route
See also
Ipv6RoutingProtocol::NotifyAddRoute

Definition at line 1064 of file nix-vector-routing.cc.

◆ NotifyInterfaceDown()

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

Definition at line 1046 of file nix-vector-routing.cc.

◆ NotifyInterfaceUp()

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

Definition at line 1040 of file nix-vector-routing.cc.

◆ NotifyRemoveAddress()

template<typename T >
void ns3::NixVectorRouting< T >::NotifyRemoveAddress ( uint32_t  interface,
IpInterfaceAddress  address 
)
privatevirtual
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 1058 of file nix-vector-routing.cc.

◆ NotifyRemoveRoute()

template<typename T >
void ns3::NixVectorRouting< T >::NotifyRemoveRoute ( IpAddress  dst,
Ipv6Prefix  mask,
IpAddress  nextHop,
uint32_t  interface,
IpAddress  prefixToUse = IpAddress::GetZero () 
)
privatevirtual

Notify route removing.

Parameters
dstdestination address
maskdestination mask
nextHopnextHop for this destination
interfaceoutput interface
prefixToUseprefix to use as source with this route
See also
Ipv6RoutingProtocol::NotifyRemoveRoute

Definition at line 1070 of file nix-vector-routing.cc.

◆ PrintRoutingPath()

template<typename T >
template void ns3::NixVectorRouting< T >::PrintRoutingPath ( Ptr< Node source,
IpAddress  dest,
Ptr< OutputStreamWrapper stream,
Time::Unit  unit 
) const

Print the Routing Path according to Nix Routing.

Parameters
sourceSource node
destDestination node address
streamThe ostream the Routing path is printed to
unitthe time unit to be used in the report
Note
IpAddress is alias for either Ipv4Address or Ipv6Address depending on on whether the network is IPv4 or IPv6 respectively.

Definition at line 1236 of file nix-vector-routing.cc.

References ns3::Time::As(), ns3::NixVector::BitCount(), ns3::NixVector::Copy(), ns3::NixVector::ExtractNeighborIndex(), ns3::Node::GetDevice(), ns3::Node::GetId(), ns3::Object::GetObject(), ns3::OutputStreamWrapper::GetStream(), ns3::Now(), NS_LOG_ERROR, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

+ Here is the call graph for this function:

◆ PrintRoutingTable()

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

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 965 of file nix-vector-routing.cc.

References ns3::Time::As(), ns3::Names::FindName(), ns3::OutputStreamWrapper::GetStream(), ns3::Now(), and NS_LOG_FUNCTION_NOARGS.

+ Here is the call graph for this function:

◆ ResetTotalNeighbors()

template<typename T >
void ns3::NixVectorRouting< T >::ResetTotalNeighbors ( void  )
private

Upon a run-time topology change caches are flushed and the total number of neighbors is reset to zero.

◆ RouteInput()

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

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 NixVectorRouting class takes responsibility for forwarding or delivering the packet, false otherwise
See also
Ipv4RoutingProtocol::RouteInput
Ipv6RoutingProtocol::RouteInput

Definition at line 837 of file nix-vector-routing.cc.

References ns3::NixVector::BitCount(), ns3::Socket::ERROR_NOROUTETOHOST, ns3::NixVector::ExtractNeighborIndex(), ns3::NixVector::GetEpoch(), ns3::Packet::GetNixVector(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Packet::SetNixVector().

+ Here is the call graph for this function:

◆ RouteOutput()

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

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 675 of file nix-vector-routing.cc.

References ns3::NixVector::BitCount(), ns3::NixVector::Copy(), ns3::Socket::ERROR_NOROUTETOHOST, ns3::Socket::ERROR_NOTERROR, ns3::NixVector::ExtractNeighborIndex(), ns3::NixVector::GetRemainingBits(), ns3::Ipv6Address::GetZero(), NS_ASSERT_MSG, NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Packet::SetNixVector().

+ Here is the call graph for this function:

◆ SetIpv4()

template<typename T >
void ns3::NixVectorRouting< T >::SetIpv4 ( Ptr< Ip ipv4)
privatevirtual

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 86 of file nix-vector-routing.cc.

References NS_ASSERT, and NS_LOG_DEBUG.

◆ SetIpv6()

template<typename T >
void ns3::NixVectorRouting< T >::SetIpv6 ( Ptr< Ip ipv6)
privatevirtual

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 97 of file nix-vector-routing.cc.

References NS_ASSERT, and NS_LOG_DEBUG.

◆ SetNode()

template<typename T >
template void ns3::NixVectorRouting< T >::SetNode ( Ptr< Node node)

Set the Node pointer of the node for which this routing protocol is to be placed.

Parameters
nodeNode pointer

Definition at line 134 of file nix-vector-routing.cc.

References NS_LOG_FUNCTION_NOARGS.

Member Data Documentation

◆ g_epoch

template<typename T >
uint32_t ns3::NixVectorRouting< T >::g_epoch = 1
staticprivate

Nix Epoch, incremented each time a flush is perfomed.

Definition at line 454 of file nix-vector-routing.h.

◆ g_ipAddressToNodeMap

template<typename T >
NixVectorRouting< T >::IpAddressToNodeMap ns3::NixVectorRouting< T >::g_ipAddressToNodeMap
staticprivate

Address to node map.

Definition at line 477 of file nix-vector-routing.h.

◆ g_isCacheDirty

template<typename T >
bool ns3::NixVectorRouting< T >::g_isCacheDirty = false
staticprivate

Flag to mark when caches are dirty and need to be flushed.


Used for lazy cleanup of caches when there are many topology changes.

Definition at line 449 of file nix-vector-routing.h.

◆ g_netdeviceToIpInterfaceMap

template<typename T >
NixVectorRouting< T >::NetDeviceToIpInterfaceMap ns3::NixVectorRouting< T >::g_netdeviceToIpInterfaceMap
staticprivate

NetDevice pointer to IpInterface pointer map.

Definition at line 481 of file nix-vector-routing.h.

◆ m_ip

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

IP object.

Definition at line 462 of file nix-vector-routing.h.

◆ m_ipRouteCache

template<typename T >
IpRouteMap_t ns3::NixVectorRouting< T >::m_ipRouteCache
mutableprivate

Cache stores IpRoutes based on destination ip.

Definition at line 460 of file nix-vector-routing.h.

◆ m_nixCache

template<typename T >
NixMap_t ns3::NixVectorRouting< T >::m_nixCache
mutableprivate

Cache stores nix-vectors based on destination ip.

Definition at line 457 of file nix-vector-routing.h.

◆ m_node

template<typename T >
Ptr<Node> ns3::NixVectorRouting< T >::m_node
private

Node object.

Definition at line 463 of file nix-vector-routing.h.

◆ m_totalNeighbors

template<typename T >
uint32_t ns3::NixVectorRouting< T >::m_totalNeighbors
private

Total neighbors used for nix-vector to determine number of bits.

Definition at line 466 of file nix-vector-routing.h.


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