A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::aodv::RoutingTable Class Reference

The Routing table used by AODV protocol. More...

#include "aodv-rtable.h"

+ Collaboration diagram for ns3::aodv::RoutingTable:

Public Member Functions

 RoutingTable (Time t)
 constructor
 

Handle lifetime of invalid route

std::map< Ipv4Address, RoutingTableEntrym_ipv4AddressEntry
 The routing table.
 
Time m_badLinkLifetime
 Deletion time for invalid routes.
 
Time GetBadLinkLifetime () const
 Get the lifetime of a bad link.
 
void SetBadLinkLifetime (Time t)
 Set the lifetime of a bad link.
 
bool AddRoute (RoutingTableEntry &r)
 Add routing table entry if it doesn't yet exist in routing table.
 
bool DeleteRoute (Ipv4Address dst)
 Delete routing table entry with destination address dst, if it exists.
 
bool LookupRoute (Ipv4Address dst, RoutingTableEntry &rt)
 Lookup routing table entry with destination address dst.
 
bool LookupValidRoute (Ipv4Address dst, RoutingTableEntry &rt)
 Lookup route in VALID state.
 
bool Update (RoutingTableEntry &rt)
 Update routing table.
 
bool SetEntryState (Ipv4Address dst, RouteFlags state)
 Set routing table entry flags.
 
void GetListOfDestinationWithNextHop (Ipv4Address nextHop, std::map< Ipv4Address, uint32_t > &unreachable)
 Lookup routing entries with next hop Address dst and not empty list of precursors.
 
void InvalidateRoutesWithDst (const std::map< Ipv4Address, uint32_t > &unreachable)
 Update routing entries with this destination as follows:
 
void DeleteAllRoutesFromInterface (Ipv4InterfaceAddress iface)
 Delete all route from interface with address iface.
 
void Clear ()
 Delete all entries from routing table.
 
void Purge ()
 Delete all outdated entries and invalidate valid entry if Lifetime is expired.
 
bool MarkLinkAsUnidirectional (Ipv4Address neighbor, Time blacklistTimeout)
 Mark entry as unidirectional (e.g.
 
void Print (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
 Print routing table.
 
void Purge (std::map< Ipv4Address, RoutingTableEntry > &table) const
 const version of Purge, for use by Print() method
 

Detailed Description

The Routing table used by AODV protocol.

Definition at line 412 of file aodv-rtable.h.

Constructor & Destructor Documentation

◆ RoutingTable()

ns3::aodv::RoutingTable::RoutingTable ( Time t)

constructor

Parameters
tthe routing table entry lifetime

Definition at line 216 of file aodv-rtable.cc.

Member Function Documentation

◆ AddRoute()

bool ns3::aodv::RoutingTable::AddRoute ( RoutingTableEntry & r)

Add routing table entry if it doesn't yet exist in routing table.

Parameters
rrouting table entry
Returns
true in success

Definition at line 271 of file aodv-rtable.cc.

References ns3::aodv::RoutingTableEntry::GetDestination(), ns3::aodv::RoutingTableEntry::GetFlag(), ns3::aodv::IN_SEARCH, m_ipv4AddressEntry, NS_LOG_FUNCTION, Purge(), and ns3::aodv::RoutingTableEntry::SetRreqCnt().

Referenced by ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::NotifyAddAddress(), ns3::aodv::RoutingProtocol::NotifyInterfaceUp(), ns3::aodv::RoutingProtocol::NotifyRemoveAddress(), ns3::aodv::RoutingProtocol::ProcessHello(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::SetIpv4(), and ns3::aodv::RoutingProtocol::UpdateRouteToNeighbor().

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

◆ Clear()

void ns3::aodv::RoutingTable::Clear ( )
inline

Delete all entries from routing table.

Definition at line 507 of file aodv-rtable.h.

References m_ipv4AddressEntry.

Referenced by ns3::aodv::RoutingProtocol::NotifyInterfaceDown(), and ns3::aodv::RoutingProtocol::NotifyRemoveAddress().

+ Here is the caller graph for this function:

◆ DeleteAllRoutesFromInterface()

void ns3::aodv::RoutingTable::DeleteAllRoutesFromInterface ( Ipv4InterfaceAddress iface)

Delete all route from interface with address iface.

Parameters
ifacethe interface IP address

Definition at line 354 of file aodv-rtable.cc.

References m_ipv4AddressEntry, and NS_LOG_FUNCTION.

Referenced by ns3::aodv::RoutingProtocol::NotifyInterfaceDown(), and ns3::aodv::RoutingProtocol::NotifyRemoveAddress().

+ Here is the caller graph for this function:

◆ DeleteRoute()

bool ns3::aodv::RoutingTable::DeleteRoute ( Ipv4Address dst)

Delete routing table entry with destination address dst, if it exists.

Parameters
dstdestination address
Returns
true on success

Definition at line 257 of file aodv-rtable.cc.

References m_ipv4AddressEntry, NS_LOG_FUNCTION, NS_LOG_LOGIC, and Purge().

Referenced by ns3::aodv::AodvRtableTest::DoRun(), and ns3::aodv::RoutingProtocol::RouteRequestTimerExpire().

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

◆ GetBadLinkLifetime()

Time ns3::aodv::RoutingTable::GetBadLinkLifetime ( ) const
inline

Get the lifetime of a bad link.

Returns
the lifetime of a bad link

Definition at line 428 of file aodv-rtable.h.

References m_badLinkLifetime.

Referenced by ns3::aodv::AodvRtableTest::DoRun().

+ Here is the caller graph for this function:

◆ GetListOfDestinationWithNextHop()

void ns3::aodv::RoutingTable::GetListOfDestinationWithNextHop ( Ipv4Address nextHop,
std::map< Ipv4Address, uint32_t > & unreachable )

Lookup routing entries with next hop Address dst and not empty list of precursors.

Parameters
nextHopthe next hop IP address
unreachable

Definition at line 319 of file aodv-rtable.cc.

References m_ipv4AddressEntry, NS_LOG_FUNCTION, NS_LOG_LOGIC, and Purge().

Referenced by ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::RecvError(), and ns3::aodv::RoutingProtocol::SendRerrWhenBreaksLinkToNextHop().

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

◆ InvalidateRoutesWithDst()

void ns3::aodv::RoutingTable::InvalidateRoutesWithDst ( const std::map< Ipv4Address, uint32_t > & unreachable)

Update routing entries with this destination as follows:

  1. The destination sequence number of this routing entry, if it exists and is valid, is incremented.
  2. The entry is invalidated by marking the route entry as invalid
  3. The Lifetime field is updated to current time plus DELETE_PERIOD.
    Parameters
    unreachableroutes to invalidate

Definition at line 336 of file aodv-rtable.cc.

References m_badLinkLifetime, m_ipv4AddressEntry, NS_LOG_FUNCTION, NS_LOG_LOGIC, Purge(), and ns3::aodv::VALID.

Referenced by ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::RecvError(), and ns3::aodv::RoutingProtocol::SendRerrWhenBreaksLinkToNextHop().

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

◆ LookupRoute()

bool ns3::aodv::RoutingTable::LookupRoute ( Ipv4Address dst,
RoutingTableEntry & rt )

Lookup routing table entry with destination address dst.

Parameters
dstdestination address
rtentry with destination address dst, if exists
Returns
true on success

Definition at line 222 of file aodv-rtable.cc.

References m_ipv4AddressEntry, NS_LOG_FUNCTION, NS_LOG_LOGIC, and Purge().

Referenced by ns3::aodv::RoutingProtocol::DeferredRouteOutput(), ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::Forwarding(), LookupValidRoute(), ns3::aodv::RoutingProtocol::ProcessHello(), ns3::aodv::RoutingProtocol::RecvError(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvReplyAck(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::aodv::RoutingProtocol::ScheduleRreqRetry(), ns3::aodv::RoutingProtocol::SendReplyAck(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), ns3::aodv::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::SendRerrWhenBreaksLinkToNextHop(), ns3::aodv::RoutingProtocol::UpdateRouteLifeTime(), and ns3::aodv::RoutingProtocol::UpdateRouteToNeighbor().

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

◆ LookupValidRoute()

bool ns3::aodv::RoutingTable::LookupValidRoute ( Ipv4Address dst,
RoutingTableEntry & rt )

Lookup route in VALID state.

Parameters
dstdestination address
rtentry with destination address dst, if exists
Returns
true on success

Definition at line 243 of file aodv-rtable.cc.

References ns3::aodv::RoutingTableEntry::GetFlag(), LookupRoute(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::aodv::VALID.

Referenced by ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RouteInput(), ns3::aodv::RoutingProtocol::RouteOutput(), ns3::aodv::RoutingProtocol::RouteRequestTimerExpire(), ns3::aodv::RoutingProtocol::SendRerrMessage(), and ns3::aodv::RoutingProtocol::SendRerrWhenNoRouteToForward().

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

◆ MarkLinkAsUnidirectional()

bool ns3::aodv::RoutingTable::MarkLinkAsUnidirectional ( Ipv4Address neighbor,
Time blacklistTimeout )

Mark entry as unidirectional (e.g.

add this neighbor to "blacklist" for blacklistTimeout period)

Parameters
neighborneighbor address link to which assumed to be unidirectional
blacklistTimeouttime for which the neighboring node is put into the blacklist
Returns
true on success

Definition at line 449 of file aodv-rtable.cc.

References ns3::Time::As(), m_ipv4AddressEntry, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::Time::S.

Referenced by ns3::aodv::RoutingProtocol::AckTimerExpire(), and ns3::aodv::AodvRtableTest::DoRun().

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

◆ Print()

void ns3::aodv::RoutingTable::Print ( Ptr< OutputStreamWrapper > stream,
Time::Unit unit = Time::S ) const

Print routing table.

Parameters
streamthe output stream
unitThe time unit to use (default Time::S)

Definition at line 466 of file aodv-rtable.cc.

References m_ipv4AddressEntry, and Purge().

Referenced by ns3::aodv::RoutingProtocol::PrintRoutingTable().

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

◆ Purge() [1/2]

void ns3::aodv::RoutingTable::Purge ( )

Delete all outdated entries and invalidate valid entry if Lifetime is expired.

Definition at line 377 of file aodv-rtable.cc.

References ns3::aodv::INVALID, m_badLinkLifetime, m_ipv4AddressEntry, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Seconds(), and ns3::aodv::VALID.

Referenced by AddRoute(), DeleteRoute(), ns3::aodv::RoutingProtocol::Forwarding(), GetListOfDestinationWithNextHop(), InvalidateRoutesWithDst(), LookupRoute(), and Print().

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

◆ Purge() [2/2]

void ns3::aodv::RoutingTable::Purge ( std::map< Ipv4Address, RoutingTableEntry > & table) const
private

const version of Purge, for use by Print() method

Parameters
tablethe routing table entry to purge

Definition at line 413 of file aodv-rtable.cc.

References ns3::aodv::INVALID, m_badLinkLifetime, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::Seconds(), and ns3::aodv::VALID.

+ Here is the call graph for this function:

◆ SetBadLinkLifetime()

void ns3::aodv::RoutingTable::SetBadLinkLifetime ( Time t)
inline

Set the lifetime of a bad link.

Parameters
tthe lifetime of a bad link

Definition at line 438 of file aodv-rtable.h.

References m_badLinkLifetime.

Referenced by ns3::aodv::AodvRtableTest::DoRun().

+ Here is the caller graph for this function:

◆ SetEntryState()

bool ns3::aodv::RoutingTable::SetEntryState ( Ipv4Address dst,
RouteFlags state )

Set routing table entry flags.

Parameters
dstdestination address
statethe routing flags
Returns
true on success

Definition at line 303 of file aodv-rtable.cc.

References m_ipv4AddressEntry, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by ns3::aodv::AodvRtableTest::DoRun().

+ Here is the caller graph for this function:

◆ Update()

bool ns3::aodv::RoutingTable::Update ( RoutingTableEntry & rt)

Update routing table.

Parameters
rtentry with destination address dst, if exists
Returns
true on success

Definition at line 284 of file aodv-rtable.cc.

References ns3::aodv::RoutingTableEntry::GetDestination(), ns3::aodv::IN_SEARCH, m_ipv4AddressEntry, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by ns3::aodv::AodvRtableTest::DoRun(), ns3::aodv::RoutingProtocol::ProcessHello(), ns3::aodv::RoutingProtocol::RecvReply(), ns3::aodv::RoutingProtocol::RecvReplyAck(), ns3::aodv::RoutingProtocol::RecvRequest(), ns3::aodv::RoutingProtocol::SendReplyByIntermediateNode(), ns3::aodv::RoutingProtocol::SendRequest(), ns3::aodv::RoutingProtocol::UpdateRouteLifeTime(), and ns3::aodv::RoutingProtocol::UpdateRouteToNeighbor().

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

Member Data Documentation

◆ m_badLinkLifetime

Time ns3::aodv::RoutingTable::m_badLinkLifetime
private

Deletion time for invalid routes.

Definition at line 532 of file aodv-rtable.h.

Referenced by GetBadLinkLifetime(), InvalidateRoutesWithDst(), Purge(), Purge(), and SetBadLinkLifetime().

◆ m_ipv4AddressEntry


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