A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::dsr::RouteCache Class Reference

DSR route request queue Since DSR is an on demand routing we queue requests while looking for route. More...

#include <dsr-rcache.h>

+ Inheritance diagram for ns3::dsr::RouteCache:
+ Collaboration diagram for ns3::dsr::RouteCache:

Classes

struct  Neighbor

Public Types

typedef std::list
< RouteCacheEntry::IP_VECTOR
routeVector
 Define the vector of route entries.

Public Member Functions

 RouteCache ()
 Constructor.
virtual ~RouteCache ()
 Destructor.
void AddArpCache (Ptr< ArpCache >)
 Add ARP cache to be used to allow layer 2 notifications processing.
void AddNeighbor (std::vector< Ipv4Address > nodeList, Ipv4Address ownAddress, Time expire)
 Add to the neighbor list.
bool AddRoute (RouteCacheEntry &rt)
 Add route cache entry if it doesn't yet exist in route cache.
bool AddRoute_Link (RouteCacheEntry::IP_VECTOR nodelist, Ipv4Address node)
uint16_t CheckUniqueAckId (Ipv4Address nextHop)
 Check for duplicate ids and save new entries if the id is not present in the table.
void Clear ()
void ClearMac ()
 Remove all entries.
void DelArpCache (Ptr< ArpCache >)
 Don't use given ARP cache any more (interface is down)
void DeleteAllRoutesIncludeLink (Ipv4Address errorSrc, Ipv4Address unreachNode, Ipv4Address node)
 Delete all the routes which includes the link from next hop address that has just been notified as unreachable.
bool DeleteRoute (Ipv4Address dst)
 Delete the route with certain destination address.
void DropPathWithDst (Ipv4Address dst)
 Remove all packets with destination IP address dst.
bool FindSameRoute (RouteCacheEntry &rt, std::list< RouteCacheEntry > &rtVector)
 Find the same route in the route cache.
uint16_t GetAckSize ()
 Get the ack table size.
Ipv4Address GetDestination (void) const
 Get the destination address of the route.
Time GetExpireTime (Ipv4Address addr)
 Return expire time for neighbor node with address addr, if exists, else return 0.
Callback< void, WifiMacHeader
const & > 
GetTxErrorCallback () const
 Get callback to ProcessTxError, this callback is trying to use the wifi mac tx error header to notify a link layer drop event, however, it is not fully supported yet.
bool IsEqual (RouteCacheEntry ca)
 To know if the two entries are the same.
bool IsLinkCache ()
bool IsNeighbor (Ipv4Address addr)
 Check that node with address addr is neighbor.
Mac48Address LookupMacAddress (Ipv4Address)
 Find MAC address by IP using list of ARP caches.
bool LookupRoute (Ipv4Address id, RouteCacheEntry &rt)
 Lookup route cache entry with destination address dst.
void Print (std::ostream &os)
void PrintRouteVector (std::list< RouteCacheEntry > route)
 Print all the route vector elements from the route list.
void PrintVector (std::vector< Ipv4Address > &vec)
 Print the route vector elements.
void ProcessTxError (WifiMacHeader const &)
 Process layer 2 TX error notification.
void Purge ()
void PurgeLinkNode ()
void PurgeMac ()
 Remove all expired mac entries.
void RebuildBestRouteTable (Ipv4Address source)
 USE MAXWEIGHT TO REPRESENT MAX; USE BROADCAST ADDRESS TO REPRESENT NULL PRECEEDING ADDRESS.
void RemoveLastEntry (std::list< RouteCacheEntry > &rtVector)
 Remove the aged route cache entries when the route cache is full.
void ScheduleTimer ()
 Schedule m_ntimer.
void SetCacheType (std::string type)
 dijsktra algorithm to get the best route from m_netGraph and update the m_bestRoutesTable_link current graph information has changed
void UpdateNeighbor (std::vector< Ipv4Address > nodeList, Time expire)
 Update expire time for entry with address addr, if it exists, else add new entry.
void UpdateNetGraph ()
 Update the Net Graph for the link and node cache has changed.
bool UpdateRouteEntry (Ipv4Address dst)
 Update route cache entry if it has been recently used and successfully delivered the data packet.
void UseExtends (RouteCacheEntry::IP_VECTOR rt)
bool GetSubRoute () const
void SetSubRoute (bool subRoute)
uint32_t GetMaxCacheLen () const
void SetMaxCacheLen (uint32_t len)
Time GetCacheTimeout () const
void SetCacheTimeout (Time t)
uint32_t GetMaxEntriesEachDst () const
void SetMaxEntriesEachDst (uint32_t entries)
Time GetBadLinkLifetime () const
void SetBadLinkLifetime (Time t)
uint64_t GetStabilityDecrFactor () const
void SetStabilityDecrFactor (uint64_t decrFactor)
uint64_t GetStabilityIncrFactor () const
void SetStabilityIncrFactor (uint64_t incrFactor)
Time GetInitStability () const
void SetInitStability (Time initStability)
Time GetMinLifeTime () const
void SetMinLifeTime (Time minLifeTime)
Time GetUseExtends () const
void SetUseExtends (Time useExtends)
void SetCallback (Callback< void, Ipv4Address, uint8_t > cb)
Callback< void, Ipv4Address,
uint8_t > 
GetCallback () const
- Public Member Functions inherited from ns3::Object
 Object ()
virtual ~Object ()
void AggregateObject (Ptr< Object > other)
void Dispose (void)
AggregateIterator GetAggregateIterator (void) const
virtual TypeId GetInstanceTypeId (void) const
template<typename T >
Ptr< T > GetObject (void) const
template<typename T >
Ptr< T > GetObject (TypeId tid) const
void Initialize (void)
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
void GetAttribute (std::string name, AttributeValue &value) const
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
void SetAttribute (std::string name, const AttributeValue &value)
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)

Static Public Member Functions

static TypeId GetTypeId ()
 The Route Cache used by DSR.

Public Attributes

std::vector< Ptr< ArpCache > > m_arp
 list of ARP cached to be used for layer 2 notifications processing
Time m_delay
 This timeout deals with the passive ack.
Callback< void, Ipv4Address,
uint8_t > 
m_handleLinkFailure
 link failure callback
std::vector< Neighborm_nb
 vector of entries
Timer m_ntimer
 Timer for neighbor's list. Schedule Purge().
Callback< void, WifiMacHeader
const & > 
m_txErrorCallback
 TX error callback.

Private Types

typedef std::list
< RouteCacheEntry
routeEntryVector

Private Member Functions

bool DecStability (Ipv4Address node)
 decrease the stability of the node
bool IncStability (Ipv4Address node)
 increase the stability of the node
bool LookupRoute_Link (Ipv4Address id, RouteCacheEntry &rt)
 used by LookupRoute when LinkCache
RouteCacheoperator= (RouteCache const &)

Private Attributes

std::map< Ipv4Address, uint16_t > m_ackIdCache
 The id cache to ensure all the ids are unique.
Time m_badLinkLifetime
 The time for which the neighboring node is put into the blacklist.
std::map< Ipv4Address,
RouteCacheEntry::IP_VECTOR
m_bestRoutesTable_link
 for link route cache
Time m_initStability
bool m_isLinkCache
 Check if the route is using path cache or link cache.
std::map< Link, LinkStabm_linkCache
 The data structure to store link info.
uint32_t m_maxCacheLen
 The maximum number of packets that we allow a routing protocol to buffer.
uint32_t m_maxEntriesEachDst
 number of entries for each destination
Time m_minLifeTime
std::map< Ipv4Address,
std::map< Ipv4Address,
uint32_t > > 
m_netGraph
std::map< Ipv4Address, NodeStabm_nodeCache
 The data structure to store node info.
routeEntryVector m_routeEntryVector
 Define the route vector.
std::map< Ipv4Address,
routeEntryVector
m_sortedRoutes
 Map the ipv4Address to route entry vector.
uint32_t m_stabilityDecrFactor
uint32_t m_stabilityIncrFactor
bool m_subRoute
 Check if save the sub route entries or not.
Time m_useExtends
RouteCacheEntry::IP_VECTOR m_vector
 The route vector to save the ip addresses for intermediate nodes.
Time RouteCacheTimeout
 The maximum period of time that dsr is allowed to for an unused route.

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
virtual void DoDispose (void)
virtual void DoInitialize (void)
virtual void NotifyNewAggregate (void)

Detailed Description

DSR route request queue Since DSR is an on demand routing we queue requests while looking for route.

Doxygen introspection did not find any typical Config paths.
No Attributes are defined for this type.
No TraceSources are defined for this type.

Definition at line 305 of file dsr-rcache.h.

Member Typedef Documentation

Define the route cache data structure

Definition at line 593 of file dsr-rcache.h.

Define the vector of route entries.

Definition at line 329 of file dsr-rcache.h.

Constructor & Destructor Documentation

ns3::dsr::RouteCache::RouteCache ( )

Constructor.

Definition at line 145 of file dsr-rcache.cc.

References m_delay, m_ntimer, m_txErrorCallback, ns3::MakeCallback(), ProcessTxError(), PurgeMac(), ns3::Timer::SetDelay(), and ns3::Timer::SetFunction().

+ Here is the call graph for this function:

ns3::dsr::RouteCache::~RouteCache ( )
virtual

Destructor.

Definition at line 160 of file dsr-rcache.cc.

References m_sortedRoutes, and NS_LOG_FUNCTION_NOARGS.

Member Function Documentation

void ns3::dsr::RouteCache::AddArpCache ( Ptr< ArpCache a)

Add ARP cache to be used to allow layer 2 notifications processing.

Definition at line 1200 of file dsr-rcache.cc.

References m_arp.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::AddNeighbor ( std::vector< Ipv4Address nodeList,
Ipv4Address  ownAddress,
Time  expire 
)

Add to the neighbor list.

Definition at line 1141 of file dsr-rcache.cc.

References LookupMacAddress(), m_nb, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_LOGIC, and PurgeMac().

+ Here is the call graph for this function:

bool ns3::dsr::RouteCache::AddRoute ( RouteCacheEntry rt)

Add route cache entry if it doesn't yet exist in route cache.

Parameters
rtroute cache entry
Returns
true in success

Save the new route cache along with the destination address in map

Drop the most aged packet when buffer reaches to max

Save the new route cache along with the destination address in map

Definition at line 655 of file dsr-rcache.cc.

References ns3::dsr::CompareRoutesExpire(), FindSameRoute(), ns3::dsr::RouteCacheEntry::GetDestination(), ns3::dsr::RouteCacheEntry::GetExpireTime(), ns3::dsr::RouteCacheEntry::GetVector(), m_maxEntriesEachDst, m_sortedRoutes, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, Purge(), and RemoveLastEntry().

Referenced by ns3::dsr::DsrRouting::AddRoute(), and ns3::dsr::DsrCacheEntryTest::DoRun().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::dsr::RouteCache::AddRoute_Link ( RouteCacheEntry::IP_VECTOR  nodelist,
Ipv4Address  node 
)

Purge the link node cache first

This is the node stability

Link represent the one link for the route

Link stability

Set the link stability as the smallest node stability

Set the link stability as the m)minLifeTime, default is 1 second

Definition at line 560 of file dsr-rcache.cc.

References ns3::dsr::LinkStab::GetLinkStability(), ns3::Time::GetSeconds(), m_initStability, m_linkCache, m_minLifeTime, m_nodeCache, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::dsr::Link::Print(), ns3::dsr::LinkStab::Print(), PurgeLinkNode(), RebuildBestRouteTable(), ns3::dsr::LinkStab::SetLinkStability(), ns3::dsr::NodeStab::SetNodeStability(), and UpdateNetGraph().

Referenced by ns3::dsr::DsrRouting::AddRoute_Link().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16_t ns3::dsr::RouteCache::CheckUniqueAckId ( Ipv4Address  nextHop)

Check for duplicate ids and save new entries if the id is not present in the table.

This part of code maintains an Acknowledgment id cache for next hop and remove duplicate ids

Definition at line 1049 of file dsr-rcache.cc.

References m_ackIdCache, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by ns3::dsr::DsrRouting::AddAckReqHeader().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::Clear ( void  )
inline

Definition at line 476 of file dsr-rcache.h.

References m_routeEntryVector.

void ns3::dsr::RouteCache::ClearMac ( )
inline

Remove all entries.

Definition at line 544 of file dsr-rcache.h.

References m_nb.

bool ns3::dsr::RouteCache::DecStability ( Ipv4Address  node)
private

decrease the stability of the node

Parameters
nodethe ip address of the node we want to decrease stability

Definition at line 537 of file dsr-rcache.cc.

References m_initStability, m_nodeCache, m_stabilityDecrFactor, NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by DeleteAllRoutesIncludeLink().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::DelArpCache ( Ptr< ArpCache a)

Don't use given ARP cache any more (interface is down)

Definition at line 1206 of file dsr-rcache.cc.

References m_arp.

Referenced by ns3::dsr::DsrRouting::DoDispose().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::DeleteAllRoutesIncludeLink ( Ipv4Address  errorSrc,
Ipv4Address  unreachNode,
Ipv4Address  node 
)

Delete all the routes which includes the link from next hop address that has just been notified as unreachable.

Parameters
errorSrcThe error source address
unreachNodeThe unreachable node
nodeThis node's ip address

TODO get rid of this one

Definition at line 772 of file dsr-rcache.cc.

References ns3::dsr::CompareRoutesExpire(), DecStability(), IsLinkCache(), m_linkCache, m_nodeCache, m_sortedRoutes, m_subRoute, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, Purge(), PurgeLinkNode(), RebuildBestRouteTable(), ns3::dsr::RouteCacheEntry::SetDestination(), ns3::dsr::RouteCacheEntry::SetExpireTime(), ns3::dsr::RouteCacheEntry::SetVector(), and UpdateNetGraph().

Referenced by ns3::dsr::DsrRouting::DeleteAllRoutesIncludeLink(), ns3::dsr::DsrRouting::LinkScheduleTimerExpire(), ns3::dsr::DsrRouting::NetworkScheduleTimerExpire(), and ns3::dsr::DsrRouting::SendRerrWhenBreaksLinkToNextHop().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::dsr::RouteCache::DeleteRoute ( Ipv4Address  dst)

Delete the route with certain destination address.

Parameters
dstthe destination address of the routes that should be deleted

Definition at line 758 of file dsr-rcache.cc.

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

Referenced by ns3::dsr::DsrCacheEntryTest::DoRun().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::DropPathWithDst ( Ipv4Address  dst)

Remove all packets with destination IP address dst.

bool ns3::dsr::RouteCache::FindSameRoute ( RouteCacheEntry rt,
std::list< RouteCacheEntry > &  rtVector 
)

Find the same route in the route cache.

Parameters
rtentry with destination address dst, if exists
rtVectorthe route vector

Definition at line 725 of file dsr-rcache.cc.

References ns3::dsr::CompareRoutesExpire(), ns3::dsr::RouteCacheEntry::GetDestination(), ns3::dsr::RouteCacheEntry::GetExpireTime(), ns3::Time::GetSeconds(), ns3::dsr::RouteCacheEntry::GetVector(), m_sortedRoutes, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by AddRoute().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16_t ns3::dsr::RouteCache::GetAckSize ( )

Get the ack table size.

Definition at line 1071 of file dsr-rcache.cc.

References m_ackIdCache.

Time ns3::dsr::RouteCache::GetBadLinkLifetime ( ) const
inline

Definition at line 376 of file dsr-rcache.h.

References m_badLinkLifetime.

Time ns3::dsr::RouteCache::GetCacheTimeout ( ) const
inline

Definition at line 360 of file dsr-rcache.h.

References RouteCacheTimeout.

Callback<void, Ipv4Address, uint8_t > ns3::dsr::RouteCache::GetCallback ( ) const
inline

Definition at line 570 of file dsr-rcache.h.

References m_handleLinkFailure.

Ipv4Address ns3::dsr::RouteCache::GetDestination ( void  ) const

Get the destination address of the route.

Time ns3::dsr::RouteCache::GetExpireTime ( Ipv4Address  addr)

Return expire time for neighbor node with address addr, if exists, else return 0.

Definition at line 1097 of file dsr-rcache.cc.

References m_nb, ns3::Simulator::Now(), NS_LOG_FUNCTION, PurgeMac(), and ns3::Seconds().

+ Here is the call graph for this function:

Time ns3::dsr::RouteCache::GetInitStability ( ) const
inline

Definition at line 400 of file dsr-rcache.h.

References m_initStability.

uint32_t ns3::dsr::RouteCache::GetMaxCacheLen ( ) const
inline

Definition at line 352 of file dsr-rcache.h.

References m_maxCacheLen.

uint32_t ns3::dsr::RouteCache::GetMaxEntriesEachDst ( ) const
inline

Definition at line 368 of file dsr-rcache.h.

References m_maxEntriesEachDst.

Time ns3::dsr::RouteCache::GetMinLifeTime ( ) const
inline

Definition at line 408 of file dsr-rcache.h.

References m_minLifeTime.

uint64_t ns3::dsr::RouteCache::GetStabilityDecrFactor ( ) const
inline

Definition at line 384 of file dsr-rcache.h.

References m_stabilityDecrFactor.

uint64_t ns3::dsr::RouteCache::GetStabilityIncrFactor ( ) const
inline

Definition at line 392 of file dsr-rcache.h.

References m_stabilityIncrFactor.

bool ns3::dsr::RouteCache::GetSubRoute ( ) const
inline

Definition at line 344 of file dsr-rcache.h.

References m_subRoute.

Callback<void, WifiMacHeader const &> ns3::dsr::RouteCache::GetTxErrorCallback ( ) const
inline

Get callback to ProcessTxError, this callback is trying to use the wifi mac tx error header to notify a link layer drop event, however, it is not fully supported yet.

Definition at line 560 of file dsr-rcache.h.

References m_txErrorCallback.

Referenced by ns3::dsr::DsrRouting::DoDispose().

+ Here is the caller graph for this function:

Time ns3::dsr::RouteCache::GetUseExtends ( ) const
inline

Definition at line 416 of file dsr-rcache.h.

References m_useExtends.

bool ns3::dsr::RouteCache::IncStability ( Ipv4Address  node)
private

increase the stability of the node

Parameters
nodethe ip address of the node we want to increase stability

TODO get rid of the debug here

Definition at line 513 of file dsr-rcache.cc.

References ns3::Time::GetSeconds(), m_initStability, m_nodeCache, m_stabilityIncrFactor, NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by UseExtends().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::dsr::RouteCache::IsEqual ( RouteCacheEntry  ca)

To know if the two entries are the same.

bool ns3::dsr::RouteCache::IsNeighbor ( Ipv4Address  addr)

Check that node with address addr is neighbor.

This part maintains a neighbor list to handle unidirectional links and link-layer acks

Definition at line 1081 of file dsr-rcache.cc.

References m_nb, NS_LOG_FUNCTION, and PurgeMac().

+ Here is the call graph for this function:

Mac48Address ns3::dsr::RouteCache::LookupMacAddress ( Ipv4Address  addr)

Find MAC address by IP using list of ARP caches.

Definition at line 1212 of file dsr-rcache.cc.

References ns3::Mac48Address::ConvertFrom(), ns3::ArpCache::Entry::GetMacAddress(), ns3::ArpCache::Entry::IsAlive(), ns3::ArpCache::Entry::IsExpired(), and m_arp.

Referenced by AddNeighbor(), and UpdateNeighbor().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::dsr::RouteCache::LookupRoute_Link ( Ipv4Address  id,
RouteCacheEntry rt 
)
private

used by LookupRoute when LinkCache

Parameters
idthe ip address we are looking for
rtthe route cache entry to store the found one

We need to purge the link node cache

Definition at line 431 of file dsr-rcache.cc.

References ns3::dsr::RouteCacheEntry::GetVector(), m_bestRoutesTable_link, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, PrintVector(), PurgeLinkNode(), RouteCacheTimeout, ns3::dsr::RouteCacheEntry::SetDestination(), ns3::dsr::RouteCacheEntry::SetExpireTime(), and ns3::dsr::RouteCacheEntry::SetVector().

Referenced by LookupRoute().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

RouteCache& ns3::dsr::RouteCache::operator= ( RouteCache const &  )
private
void ns3::dsr::RouteCache::Print ( std::ostream &  os)

Definition at line 1030 of file dsr-rcache.cc.

References m_routeEntryVector, NS_LOG_FUNCTION, and Purge().

+ Here is the call graph for this function:

void ns3::dsr::RouteCache::PrintRouteVector ( std::list< RouteCacheEntry route)

Print all the route vector elements from the route list.

Parameters
routethe route list

Definition at line 951 of file dsr-rcache.cc.

References NS_LOG_FUNCTION, NS_LOG_INFO, and PrintVector().

+ Here is the call graph for this function:

void ns3::dsr::RouteCache::PrintVector ( std::vector< Ipv4Address > &  vec)

Print the route vector elements.

Parameters
vecthe route vector

Definition at line 930 of file dsr-rcache.cc.

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by LookupRoute_Link(), PrintRouteVector(), and RebuildBestRouteTable().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::ProcessTxError ( WifiMacHeader const &  hdr)

Process layer 2 TX error notification.

Definition at line 1229 of file dsr-rcache.cc.

References ns3::WifiMacHeader::GetAddr1(), m_nb, and PurgeMac().

Referenced by RouteCache().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::Purge ( )

Definition at line 963 of file dsr-rcache.cc.

References m_sortedRoutes, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Seconds().

Referenced by AddRoute(), DeleteAllRoutesIncludeLink(), DeleteRoute(), LookupRoute(), and Print().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::PurgeLinkNode ( )

may need to remove them after verify

Definition at line 463 of file dsr-rcache.cc.

References m_linkCache, m_nodeCache, NS_LOG_DEBUG, NS_LOG_FUNCTION, and ns3::Seconds().

Referenced by AddRoute_Link(), DeleteAllRoutesIncludeLink(), LookupRoute_Link(), and UseExtends().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::PurgeMac ( )

Remove all expired mac entries.

Definition at line 1167 of file dsr-rcache.cc.

References ns3::Timer::Cancel(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_handleLinkFailure, m_nb, m_ntimer, NS_LOG_LOGIC, and ns3::Timer::Schedule().

Referenced by AddNeighbor(), GetExpireTime(), IsNeighbor(), ProcessTxError(), RouteCache(), and UpdateNeighbor().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::RebuildBestRouteTable ( Ipv4Address  source)

USE MAXWEIGHT TO REPRESENT MAX; USE BROADCAST ADDRESS TO REPRESENT NULL PRECEEDING ADDRESS.

Parameters
Thesource address the routes based on

The followings are initialize-single-source

The followings are core of dijskra algorithm

Definition at line 315 of file dsr-rcache.cc.

References ns3::Ipv4Address::IsBroadcast(), m_bestRoutesTable_link, m_linkCache, m_netGraph, MAXWEIGHT, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, and PrintVector().

Referenced by AddRoute_Link(), and DeleteAllRoutesIncludeLink().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::RemoveLastEntry ( std::list< RouteCacheEntry > &  rtVector)

Remove the aged route cache entries when the route cache is full.

Definition at line 168 of file dsr-rcache.cc.

References NS_LOG_FUNCTION.

Referenced by AddRoute().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::ScheduleTimer ( )

Schedule m_ntimer.

Definition at line 1193 of file dsr-rcache.cc.

References ns3::Timer::Cancel(), m_ntimer, and ns3::Timer::Schedule().

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetBadLinkLifetime ( Time  t)
inline

Definition at line 380 of file dsr-rcache.h.

References m_badLinkLifetime.

void ns3::dsr::RouteCache::SetCacheTimeout ( Time  t)
inline

Definition at line 364 of file dsr-rcache.h.

References RouteCacheTimeout.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetCacheType ( std::string  type)

dijsktra algorithm to get the best route from m_netGraph and update the m_bestRoutesTable_link current graph information has changed

Parameters
Thetype of the cache

Definition at line 289 of file dsr-rcache.cc.

References m_isLinkCache, NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetCallback ( Callback< void, Ipv4Address, uint8_t >  cb)
inline

Definition at line 566 of file dsr-rcache.h.

References m_handleLinkFailure.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetInitStability ( Time  initStability)
inline

Definition at line 404 of file dsr-rcache.h.

References m_initStability.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetMaxCacheLen ( uint32_t  len)
inline

Definition at line 356 of file dsr-rcache.h.

References m_maxCacheLen.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetMaxEntriesEachDst ( uint32_t  entries)
inline

Definition at line 372 of file dsr-rcache.h.

References m_maxEntriesEachDst.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetMinLifeTime ( Time  minLifeTime)
inline

Definition at line 412 of file dsr-rcache.h.

References m_minLifeTime.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetStabilityDecrFactor ( uint64_t  decrFactor)
inline

Definition at line 388 of file dsr-rcache.h.

References m_stabilityDecrFactor.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetStabilityIncrFactor ( uint64_t  incrFactor)
inline

Definition at line 396 of file dsr-rcache.h.

References m_stabilityIncrFactor.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetSubRoute ( bool  subRoute)
inline

Definition at line 348 of file dsr-rcache.h.

References m_subRoute.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::SetUseExtends ( Time  useExtends)
inline

Definition at line 420 of file dsr-rcache.h.

References m_useExtends.

Referenced by ns3::dsr::DsrRouting::Start().

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::UpdateNeighbor ( std::vector< Ipv4Address nodeList,
Time  expire 
)

Update expire time for entry with address addr, if it exists, else add new entry.

Definition at line 1113 of file dsr-rcache.cc.

References LookupMacAddress(), m_nb, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and PurgeMac().

+ Here is the call graph for this function:

void ns3::dsr::RouteCache::UpdateNetGraph ( )

Update the Net Graph for the link and node cache has changed.

Definition at line 498 of file dsr-rcache.cc.

References m_linkCache, m_netGraph, and NS_LOG_FUNCTION.

Referenced by AddRoute_Link(), and DeleteAllRoutesIncludeLink().

+ Here is the caller graph for this function:

bool ns3::dsr::RouteCache::UpdateRouteEntry ( Ipv4Address  dst)

Update route cache entry if it has been recently used and successfully delivered the data packet.

Parameters
dstdestination address of the route
vecthe route vector
Returns
true in success

Definition at line 176 of file dsr-rcache.cc.

References ns3::dsr::CompareRoutesExpire(), m_sortedRoutes, NS_LOG_FUNCTION, NS_LOG_LOGIC, RouteCacheTimeout, and ns3::dsr::RouteCacheEntry::SetExpireTime().

Referenced by ns3::dsr::DsrRouting::UpdateRouteEntry().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::dsr::RouteCache::UseExtends ( RouteCacheEntry::IP_VECTOR  rt)

When a link from the Route Cache is used in routing a packet originated or salvaged by that node, the stability metric for each of the two endpoint nodes of that link is incremented by the amount of time since that link was last used. When a link is used in a route chosen for a packet originated or salvaged by this node, the link's lifetime is set to be at least UseExtends into the future

Purge the link node cache first

TODO remove after debug

Increase the stability of the node cache

Definition at line 609 of file dsr-rcache.cc.

References IncStability(), m_initStability, m_linkCache, m_nodeCache, m_useExtends, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, and PurgeLinkNode().

Referenced by ns3::dsr::DsrRouting::CheckSendBuffer(), ns3::dsr::DsrRouting::PacketNewRoute(), ns3::dsr::DsrRouting::RouteRequestTimerExpire(), ns3::dsr::DsrRouting::SalvagePacket(), ns3::dsr::DsrRouting::Send(), ns3::dsr::DsrRouting::SendErrorRequest(), ns3::dsr::DsrRouting::SendPacketFromBuffer(), ns3::dsr::DsrRouting::SendRerrWhenBreaksLinkToNextHop(), ns3::dsr::DsrRouting::SendUnreachError(), and ns3::dsr::DsrRouting::UseExtends().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

std::map<Ipv4Address, uint16_t> ns3::dsr::RouteCache::m_ackIdCache
private

The id cache to ensure all the ids are unique.

Definition at line 601 of file dsr-rcache.h.

Referenced by CheckUniqueAckId(), and GetAckSize().

std::vector<Ptr<ArpCache> > ns3::dsr::RouteCache::m_arp

list of ARP cached to be used for layer 2 notifications processing

Definition at line 676 of file dsr-rcache.h.

Referenced by AddArpCache(), DelArpCache(), and LookupMacAddress().

Time ns3::dsr::RouteCache::m_badLinkLifetime
private

The time for which the neighboring node is put into the blacklist.

Definition at line 581 of file dsr-rcache.h.

Referenced by GetBadLinkLifetime(), and SetBadLinkLifetime().

std::map<Ipv4Address, RouteCacheEntry::IP_VECTOR> ns3::dsr::RouteCache::m_bestRoutesTable_link
private

for link route cache

Definition at line 618 of file dsr-rcache.h.

Referenced by LookupRoute_Link(), and RebuildBestRouteTable().

Time ns3::dsr::RouteCache::m_delay

This timeout deals with the passive ack.

Definition at line 678 of file dsr-rcache.h.

Referenced by RouteCache().

Callback<void, Ipv4Address, uint8_t > ns3::dsr::RouteCache::m_handleLinkFailure

link failure callback

The following code handles link-layer acks

Definition at line 668 of file dsr-rcache.h.

Referenced by GetCallback(), PurgeMac(), and SetCallback().

Time ns3::dsr::RouteCache::m_initStability
private
bool ns3::dsr::RouteCache::m_isLinkCache
private

Check if the route is using path cache or link cache.

Definition at line 603 of file dsr-rcache.h.

Referenced by IsLinkCache(), and SetCacheType().

std::map<Link, LinkStab> ns3::dsr::RouteCache::m_linkCache
private

The data structure to store link info.

Definition at line 619 of file dsr-rcache.h.

Referenced by AddRoute_Link(), DeleteAllRoutesIncludeLink(), PurgeLinkNode(), RebuildBestRouteTable(), UpdateNetGraph(), and UseExtends().

uint32_t ns3::dsr::RouteCache::m_maxCacheLen
private

The maximum number of packets that we allow a routing protocol to buffer.

Definition at line 579 of file dsr-rcache.h.

Referenced by GetMaxCacheLen(), and SetMaxCacheLen().

uint32_t ns3::dsr::RouteCache::m_maxEntriesEachDst
private

number of entries for each destination

Definition at line 599 of file dsr-rcache.h.

Referenced by AddRoute(), GetMaxEntriesEachDst(), and SetMaxEntriesEachDst().

Time ns3::dsr::RouteCache::m_minLifeTime
private

Definition at line 588 of file dsr-rcache.h.

Referenced by AddRoute_Link(), GetMinLifeTime(), and SetMinLifeTime().

std::vector<Neighbor> ns3::dsr::RouteCache::m_nb

vector of entries

Definition at line 674 of file dsr-rcache.h.

Referenced by AddNeighbor(), ClearMac(), GetExpireTime(), IsNeighbor(), ProcessTxError(), PurgeMac(), and UpdateNeighbor().

std::map<Ipv4Address, std::map<Ipv4Address, uint32_t> > ns3::dsr::RouteCache::m_netGraph
private

Current network graph state for this node, double is weight, which is calculated by the node information and link information, any time some changes of link cache and node cache change the weight and then recompute the best choice for each node

Definition at line 616 of file dsr-rcache.h.

Referenced by RebuildBestRouteTable(), and UpdateNetGraph().

std::map<Ipv4Address, NodeStab> ns3::dsr::RouteCache::m_nodeCache
private

The data structure to store node info.

Definition at line 620 of file dsr-rcache.h.

Referenced by AddRoute_Link(), DecStability(), DeleteAllRoutesIncludeLink(), IncStability(), PurgeLinkNode(), and UseExtends().

Timer ns3::dsr::RouteCache::m_ntimer

Timer for neighbor's list. Schedule Purge().

Definition at line 672 of file dsr-rcache.h.

Referenced by PurgeMac(), RouteCache(), and ScheduleTimer().

routeEntryVector ns3::dsr::RouteCache::m_routeEntryVector
private

Define the route vector.

Definition at line 597 of file dsr-rcache.h.

Referenced by Clear(), and Print().

std::map<Ipv4Address, routeEntryVector> ns3::dsr::RouteCache::m_sortedRoutes
private

Map the ipv4Address to route entry vector.

Definition at line 595 of file dsr-rcache.h.

Referenced by AddRoute(), DeleteAllRoutesIncludeLink(), DeleteRoute(), FindSameRoute(), LookupRoute(), Purge(), UpdateRouteEntry(), and ~RouteCache().

uint32_t ns3::dsr::RouteCache::m_stabilityDecrFactor
private

Define the parameters for link cache type

Definition at line 585 of file dsr-rcache.h.

Referenced by DecStability(), GetStabilityDecrFactor(), and SetStabilityDecrFactor().

uint32_t ns3::dsr::RouteCache::m_stabilityIncrFactor
private

Definition at line 586 of file dsr-rcache.h.

Referenced by GetStabilityIncrFactor(), IncStability(), and SetStabilityIncrFactor().

bool ns3::dsr::RouteCache::m_subRoute
private

Check if save the sub route entries or not.

Definition at line 605 of file dsr-rcache.h.

Referenced by DeleteAllRoutesIncludeLink(), GetSubRoute(), and SetSubRoute().

Callback<void, WifiMacHeader const &> ns3::dsr::RouteCache::m_txErrorCallback

TX error callback.

Definition at line 670 of file dsr-rcache.h.

Referenced by GetTxErrorCallback(), and RouteCache().

Time ns3::dsr::RouteCache::m_useExtends
private

Definition at line 589 of file dsr-rcache.h.

Referenced by GetUseExtends(), SetUseExtends(), and UseExtends().

RouteCacheEntry::IP_VECTOR ns3::dsr::RouteCache::m_vector
private

The route vector to save the ip addresses for intermediate nodes.

Definition at line 578 of file dsr-rcache.h.

Time ns3::dsr::RouteCache::RouteCacheTimeout
private

The maximum period of time that dsr is allowed to for an unused route.

Definition at line 580 of file dsr-rcache.h.

Referenced by GetCacheTimeout(), LookupRoute_Link(), SetCacheTimeout(), and UpdateRouteEntry().


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