A Discrete-Event Network Simulator
API
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ns3::aodv::RoutingTable Class Reference

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

#include "aodv-rtable.h"

Public Member Functions

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

Private Member Functions

void Purge (std::map< Ipv4Address, RoutingTableEntry > &table) const
 const version of Purge, for use by Print() method More...
 

Private Attributes

Time m_badLinkLifetime
 Deletion time for invalid routes. More...
 
std::map< Ipv4Address, RoutingTableEntrym_ipv4AddressEntry
 The routing table. More...
 

Detailed Description

The Routing table used by AODV protocol.

Definition at line 388 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 208 of file aodv-rtable.cc.

Member Function Documentation

◆ AddRoute()

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

◆ Clear()

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

Delete all entries from routing table.

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

References m_ipv4AddressEntry.

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

◆ DeleteAllRoutesFromInterface()

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

Delete all route from interface with address iface.

Parameters
ifacethe interface IP address

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

References m_ipv4AddressEntry, and NS_LOG_FUNCTION.

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

◆ 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 249 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().

◆ GetBadLinkLifetime()

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

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

References m_badLinkLifetime.

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

◆ 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 314 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().

◆ InvalidateRoutesWithDst()

void ns3::aodv::RoutingTable::InvalidateRoutesWithDst ( std::map< Ipv4Address, uint32_t > const &  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 331 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().

◆ LookupRoute()

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

◆ LookupValidRoute()

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

◆ 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
neighbor- neighbor address link to which assumed to be unidirectional
blacklistTimeout- time 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::GetSeconds(), m_ipv4AddressEntry, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

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

◆ Print()

void ns3::aodv::RoutingTable::Print ( Ptr< OutputStreamWrapper stream) const

Print routing table.

Parameters
streamthe output stream

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

References ns3::OutputStreamWrapper::GetStream(), m_ipv4AddressEntry, and Purge().

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

◆ Purge() [1/2]

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

◆ 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 412 of file aodv-rtable.cc.

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

◆ SetBadLinkLifetime()

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

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

References m_badLinkLifetime.

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

◆ 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 297 of file aodv-rtable.cc.

References m_ipv4AddressEntry, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

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

◆ Update()

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

Member Data Documentation

◆ m_badLinkLifetime

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

Deletion time for invalid routes.

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

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

◆ m_ipv4AddressEntry

std::map<Ipv4Address, RoutingTableEntry> ns3::aodv::RoutingTable::m_ipv4AddressEntry
private

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