ns-3
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:

List of all members.

Classes

struct  Neighbor

Public Types

typedef std::list
< RouteCacheEntry::IP_VECTOR > 
routeVector

Public Member Functions

 RouteCache ()
 Constructor.
virtual ~RouteCache ()
 Destructor.
void RemoveLastEntry (std::list< RouteCacheEntry > &rtVector)
Ipv4Address GetDestination (void) const
void DropPathWithDst (Ipv4Address dst)
bool IsEqual (RouteCacheEntry ca)
bool UpdateRouteEntry (Ipv4Address dst)
bool AddRoute (RouteCacheEntry &rt)
bool LookupRoute (Ipv4Address id, RouteCacheEntry &rt)
void PrintVector (std::vector< Ipv4Address > &vec)
void PrintRouteVector (std::list< RouteCacheEntry > route)
bool FindSameRoute (RouteCacheEntry &rt, std::list< RouteCacheEntry > &rtVector)
bool DeleteRoute (Ipv4Address dst)
void DeleteAllRoutesIncludeLink (Ipv4Address errorSrc, Ipv4Address unreachNode, Ipv4Address node)
void Clear ()
void Purge ()
void Print (std::ostream &os)
uint16_t CheckUniqueAckId (Ipv4Address nextHop)
uint16_t GetAckSize ()
Time GetExpireTime (Ipv4Address addr)
bool IsNeighbor (Ipv4Address addr)
void UpdateNeighbor (std::vector< Ipv4Address > nodeList, Time expire)
void AddNeighbor (std::vector< Ipv4Address > nodeList, Ipv4Address ownAddress, Time expire)
void PurgeMac ()
void ScheduleTimer ()
void ClearMac ()
void AddArpCache (Ptr< ArpCache >)
void DelArpCache (Ptr< ArpCache >)
Callback< void, WifiMacHeader
const & > 
GetTxErrorCallback () const
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
bool IsLinkCache ()
bool AddRoute_Link (RouteCacheEntry::IP_VECTOR nodelist, Ipv4Address node)
void RebuildBestRouteTable (Ipv4Address source)
 USE MAXWEIGHT TO REPRESENT MAX; USE BROADCAST ADDRESS TO REPRESENT NULL PRECEEDING ADDRESS.
void PurgeLinkNode ()
void UseExtends (RouteCacheEntry::IP_VECTOR rt)
void UpdateNetGraph ()
 Update the Net Graph for the link and node cache has changed.
Mac48Address LookupMacAddress (Ipv4Address)
void ProcessTxError (WifiMacHeader const &)
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
virtual TypeId GetInstanceTypeId (void) const
template<typename T >
Ptr< T > GetObject (void) const
template<typename T >
Ptr< T > GetObject (TypeId tid) const
void Dispose (void)
void AggregateObject (Ptr< Object > other)
AggregateIterator GetAggregateIterator (void) const
void Start (void)
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount (const SimpleRefCount &o)
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
uint32_t GetReferenceCount (void) const
- Public Member Functions inherited from ns3::ObjectBase
void SetAttribute (std::string name, const AttributeValue &value)
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
void GetAttribute (std::string name, AttributeValue &value) const
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
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

Callback< void, Ipv4Address,
uint8_t > 
m_handleLinkFailure
Callback< void, WifiMacHeader
const & > 
m_txErrorCallback
Timer m_ntimer
std::vector< Neighborm_nb
std::vector< Ptr< ArpCache > > m_arp
Time m_delay

Additional Inherited Members

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

Detailed Description

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


Member Function Documentation

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

References FindSameRoute(), NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_INFO.

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

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

References NS_LOG_FUNCTION, and NS_LOG_LOGIC.

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

References NS_LOG_FUNCTION, and NS_LOG_LOGIC.

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

References ns3::Time::GetSeconds(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by AddRoute().

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

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

References NS_LOG_FUNCTION.

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

Lookup route cache entry with destination address dst

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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, and NS_LOG_LOGIC.

Referenced by ns3::dsr::DsrRouting::CheckSendBuffer(), and ns3::dsr::DsrRouting::PacketNewRoute().

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

Print all the route vector elements from the route list

Parameters:
routethe route list

References NS_LOG_FUNCTION, NS_LOG_INFO, and PrintVector().

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

Print the route vector elements

Parameters:
vecthe route vector

References NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by PrintRouteVector(), and RebuildBestRouteTable().

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

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

The followings are initialize-single-source

The followings are core of dijskra algorithm

The followings are for comparison

Selects the shortest-length route that has the longest expected lifetime (highest minimum timeout of any link in the route) For the computation overhead and complexity Here I just implement kind of greedy strategy to select link with the longest expected lifetime when there is two options

Reverse the route

References ns3::Ipv4Address::IsBroadcast(), NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, and PrintVector().

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

References NS_LOG_DEBUG, and NS_LOG_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

References NS_LOG_DEBUG, NS_LOG_FUNCTION, and NS_LOG_INFO.

Referenced by ns3::dsr::DsrRouting::CheckSendBuffer(), and ns3::dsr::DsrRouting::PacketNewRoute().


Member Data Documentation

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

The following code handles link-layer acks


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