A Discrete-Event Network Simulator
API
ns3::dsdv::RoutingTable Class Reference

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

#include "dsdv-rtable.h"

+ Collaboration diagram for ns3::dsdv::RoutingTable:

Public Member Functions

 RoutingTable ()
 c-tor More...
 
bool AddIpv4Event (Ipv4Address address, EventId id)
 Add an event for a destination address so that the update to for that destination is sent after the event is completed. More...
 
bool AddRoute (RoutingTableEntry &r)
 Add routing table entry if it doesn't yet exist in routing table. More...
 
bool AnyRunningEvent (Ipv4Address address)
 Force delete an update waiting for settling time to complete as a better update to same destination was received. More...
 
void Clear ()
 Delete all entries from routing table. More...
 
void DeleteAllRoutesFromInterface (Ipv4InterfaceAddress iface)
 Delete all route from interface with address iface. More...
 
bool DeleteIpv4Event (Ipv4Address address)
 Clear up the entry from the map after the event is completed. More...
 
bool DeleteRoute (Ipv4Address dst)
 Delete routing table entry with destination address dst, if it exists. More...
 
bool ForceDeleteIpv4Event (Ipv4Address address)
 Force delete an update waiting for settling time to complete as a better update to same destination was received. More...
 
EventId GetEventId (Ipv4Address address)
 Get the EventId associated with that address. More...
 
Time Getholddowntime () const
 Get hold down time (time until an invalid route may be deleted) More...
 
void GetListOfAllRoutes (std::map< Ipv4Address, RoutingTableEntry > &allRoutes)
 Lookup list of all addresses in the routing table. More...
 
void GetListOfDestinationWithNextHop (Ipv4Address nxtHp, std::map< Ipv4Address, RoutingTableEntry > &dstList)
 Lookup list of addresses for which nxtHp is the next Hop address. More...
 
bool LookupRoute (Ipv4Address dst, RoutingTableEntry &rt)
 Lookup routing table entry with destination address dst. More...
 
bool LookupRoute (Ipv4Address id, RoutingTableEntry &rt, bool forRouteInput)
 Lookup routing table entry with destination address dst. More...
 
void Print (Ptr< OutputStreamWrapper > stream, Time::Unit unit=Time::S) const
 Print routing table. More...
 
void Purge (std::map< Ipv4Address, RoutingTableEntry > &removedAddresses)
 Delete all outdated entries if Lifetime is expired. More...
 
uint32_t RoutingTableSize ()
 Provides the number of routes present in that nodes routing table. More...
 
void Setholddowntime (Time t)
 Set hold down time (time until an invalid route may be deleted) More...
 
bool Update (RoutingTableEntry &rt)
 Updating the routing Table with routing table entry rt. More...
 

Private Attributes

Time m_holddownTime
 hold down time of an expired route More...
 
std::map< Ipv4Address, RoutingTableEntrym_ipv4AddressEntry
 an entry in the routing table. More...
 
std::map< Ipv4Address, EventIdm_ipv4Events
 an entry in the event table. More...
 

Detailed Description

The Routing table used by DSDV protocol.

Definition at line 327 of file dsdv-rtable.h.

Constructor & Destructor Documentation

◆ RoutingTable()

ns3::dsdv::RoutingTable::RoutingTable ( )

c-tor

Definition at line 72 of file dsdv-rtable.cc.

Member Function Documentation

◆ AddIpv4Event()

bool ns3::dsdv::RoutingTable::AddIpv4Event ( Ipv4Address  address,
EventId  id 
)

Add an event for a destination address so that the update to for that destination is sent after the event is completed.

Parameters
addressdestination address for which this event is running.
idunique eventid that was generated.
Returns
true on success

Definition at line 295 of file dsdv-rtable.cc.

References first::address, and m_ipv4Events.

Referenced by ns3::dsdv::RoutingProtocol::RecvDsdv().

+ Here is the caller graph for this function:

◆ AddRoute()

bool ns3::dsdv::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 125 of file dsdv-rtable.cc.

References ns3::dsdv::RoutingTableEntry::GetDestination(), and m_ipv4AddressEntry.

Referenced by DsdvTableTestCase::DoRun(), ns3::dsdv::RoutingProtocol::NotifyAddAddress(), ns3::dsdv::RoutingProtocol::NotifyInterfaceUp(), ns3::dsdv::RoutingProtocol::RecvDsdv(), ns3::dsdv::RoutingProtocol::RouteOutput(), and ns3::dsdv::RoutingProtocol::SetIpv4().

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

◆ AnyRunningEvent()

bool ns3::dsdv::RoutingTable::AnyRunningEvent ( Ipv4Address  address)

Force delete an update waiting for settling time to complete as a better update to same destination was received.

Parameters
addressdestination address for which this event is running.
Returns
true on success

Definition at line 302 of file dsdv-rtable.cc.

References first::address, and m_ipv4Events.

Referenced by ns3::dsdv::RoutingProtocol::MergeTriggerPeriodicUpdates(), ns3::dsdv::RoutingProtocol::RecvDsdv(), and ns3::dsdv::RoutingProtocol::SendTriggeredUpdate().

+ Here is the caller graph for this function:

◆ Clear()

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

Delete all entries from routing table.

Definition at line 385 of file dsdv-rtable.h.

References m_ipv4AddressEntry.

Referenced by ns3::dsdv::RoutingProtocol::NotifyInterfaceDown().

+ Here is the caller graph for this function:

◆ DeleteAllRoutesFromInterface()

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

Delete all route from interface with address iface.

Parameters
ifacethe interface

Definition at line 144 of file dsdv-rtable.cc.

References m_ipv4AddressEntry.

Referenced by ns3::dsdv::RoutingProtocol::NotifyInterfaceDown().

+ Here is the caller graph for this function:

◆ DeleteIpv4Event()

bool ns3::dsdv::RoutingTable::DeleteIpv4Event ( Ipv4Address  address)

Clear up the entry from the map after the event is completed.

Parameters
addressdestination address for which this event is running.
Returns
true on success

Definition at line 334 of file dsdv-rtable.cc.

References first::address, ns3::EventId::IsExpired(), ns3::EventId::IsRunning(), and m_ipv4Events.

Referenced by ns3::dsdv::RoutingProtocol::SendTriggeredUpdate().

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

◆ DeleteRoute()

bool ns3::dsdv::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 113 of file dsdv-rtable.cc.

References m_ipv4AddressEntry.

Referenced by ns3::dsdv::RoutingProtocol::MergeTriggerPeriodicUpdates(), ns3::dsdv::RoutingProtocol::RecvDsdv(), and ns3::dsdv::RoutingProtocol::SendTriggeredUpdate().

+ Here is the caller graph for this function:

◆ ForceDeleteIpv4Event()

bool ns3::dsdv::RoutingTable::ForceDeleteIpv4Event ( Ipv4Address  address)

Force delete an update waiting for settling time to complete as a better update to same destination was received.

Parameters
addressdestination address for which this event is running.
Returns
true on finding out that an event is already running for that destination address.

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

References first::address, ns3::Simulator::Cancel(), and m_ipv4Events.

Referenced by ns3::dsdv::RoutingProtocol::RecvDsdv().

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

◆ GetEventId()

EventId ns3::dsdv::RoutingTable::GetEventId ( Ipv4Address  address)

Get the EventId associated with that address.

Parameters
addressdestination address for which this event is running.
Returns
EventId on finding out an event is associated else return NULL.

Definition at line 361 of file dsdv-rtable.cc.

References first::address, and m_ipv4Events.

Referenced by ns3::dsdv::RoutingProtocol::SendTriggeredUpdate().

+ Here is the caller graph for this function:

◆ Getholddowntime()

Time ns3::dsdv::RoutingTable::Getholddowntime ( ) const
inline

Get hold down time (time until an invalid route may be deleted)

Returns
the hold down time

Definition at line 445 of file dsdv-rtable.h.

References m_holddownTime.

◆ GetListOfAllRoutes()

void ns3::dsdv::RoutingTable::GetListOfAllRoutes ( std::map< Ipv4Address, RoutingTableEntry > &  allRoutes)

Lookup list of all addresses in the routing table.

Parameters
allRoutesis the list that will hold all these addresses present in the nodes routing table

Definition at line 166 of file dsdv-rtable.cc.

References m_ipv4AddressEntry, and ns3::dsdv::VALID.

Referenced by ns3::dsdv::RoutingProtocol::LookForQueuedPackets(), ns3::dsdv::RoutingProtocol::MergeTriggerPeriodicUpdates(), ns3::dsdv::RoutingProtocol::RecvDsdv(), ns3::dsdv::RoutingProtocol::SendPeriodicUpdate(), and ns3::dsdv::RoutingProtocol::SendTriggeredUpdate().

+ Here is the caller graph for this function:

◆ GetListOfDestinationWithNextHop()

void ns3::dsdv::RoutingTable::GetListOfDestinationWithNextHop ( Ipv4Address  nxtHp,
std::map< Ipv4Address, RoutingTableEntry > &  dstList 
)

Lookup list of addresses for which nxtHp is the next Hop address.

Parameters
nxtHpnexthop's address for which we want the list of destinations
dstListis the list that will hold all these destination addresses

Definition at line 178 of file dsdv-rtable.cc.

References m_ipv4AddressEntry.

Referenced by ns3::dsdv::RoutingProtocol::RecvDsdv().

+ Here is the caller graph for this function:

◆ LookupRoute() [1/2]

bool ns3::dsdv::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 77 of file dsdv-rtable.cc.

References m_ipv4AddressEntry.

Referenced by DsdvTableTestCase::DoRun(), ns3::dsdv::RoutingProtocol::GetSettlingTime(), ns3::dsdv::RoutingProtocol::LookForQueuedPackets(), ns3::dsdv::RoutingProtocol::RecvDsdv(), ns3::dsdv::RoutingProtocol::RouteInput(), ns3::dsdv::RoutingProtocol::RouteOutput(), ns3::dsdv::RoutingProtocol::SendPeriodicUpdate(), and ns3::dsdv::RoutingProtocol::SendTriggeredUpdate().

+ Here is the caller graph for this function:

◆ LookupRoute() [2/2]

bool ns3::dsdv::RoutingTable::LookupRoute ( Ipv4Address  id,
RoutingTableEntry rt,
bool  forRouteInput 
)

Lookup routing table entry with destination address dst.

Parameters
iddestination address
rtentry with destination address dst, if exists
forRouteInputfor routing input
Returns
true onns3 success

Definition at line 93 of file dsdv-rtable.cc.

References m_ipv4AddressEntry.

◆ Print()

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

Print routing table.

Parameters
streamthe output stream
unitthe Time unit

Definition at line 268 of file dsdv-rtable.cc.

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

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

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

◆ Purge()

void ns3::dsdv::RoutingTable::Purge ( std::map< Ipv4Address, RoutingTableEntry > &  removedAddresses)

Delete all outdated entries if Lifetime is expired.

Parameters
removedAddressesis the list of addresses to purge
Todo:
Need to decide when to invalidate a route

Definition at line 224 of file dsdv-rtable.cc.

References m_holddownTime, and m_ipv4AddressEntry.

Referenced by ns3::dsdv::RoutingProtocol::RouteOutput(), and ns3::dsdv::RoutingProtocol::SendPeriodicUpdate().

+ Here is the caller graph for this function:

◆ RoutingTableSize()

uint32_t ns3::dsdv::RoutingTable::RoutingTableSize ( )

Provides the number of routes present in that nodes routing table.

Returns
the number of routes

Definition at line 119 of file dsdv-rtable.cc.

References m_ipv4AddressEntry.

Referenced by DsdvTableTestCase::DoRun().

+ Here is the caller graph for this function:

◆ Setholddowntime()

void ns3::dsdv::RoutingTable::Setholddowntime ( Time  t)
inline

Set hold down time (time until an invalid route may be deleted)

Parameters
tthe hold down time

Definition at line 454 of file dsdv-rtable.h.

References m_holddownTime.

Referenced by ns3::dsdv::RoutingProtocol::Start().

+ Here is the caller graph for this function:

◆ Update()

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

Updating the routing Table with routing table entry rt.

Parameters
rtrouting table entry
Returns
true on success

Definition at line 132 of file dsdv-rtable.cc.

References ns3::dsdv::RoutingTableEntry::GetDestination(), and m_ipv4AddressEntry.

Referenced by ns3::dsdv::RoutingProtocol::MergeTriggerPeriodicUpdates(), ns3::dsdv::RoutingProtocol::RecvDsdv(), ns3::dsdv::RoutingProtocol::SendPeriodicUpdate(), and ns3::dsdv::RoutingProtocol::SendTriggeredUpdate().

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

Member Data Documentation

◆ m_holddownTime

Time ns3::dsdv::RoutingTable::m_holddownTime
private

hold down time of an expired route

Definition at line 466 of file dsdv-rtable.h.

Referenced by Getholddowntime(), Purge(), and Setholddowntime().

◆ m_ipv4AddressEntry

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

◆ m_ipv4Events

std::map<Ipv4Address, EventId> ns3::dsdv::RoutingTable::m_ipv4Events
private

an entry in the event table.

Definition at line 464 of file dsdv-rtable.h.

Referenced by AddIpv4Event(), AnyRunningEvent(), DeleteIpv4Event(), ForceDeleteIpv4Event(), and GetEventId().


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