DSR route request queue Since DSR is an on demand routing we queue requests while looking for route. More...
#include <dsr-rcache.h>
Classes | |
struct | Neighbor |
The following code handles link-layer acks. More... | |
Public Types | |
typedef std::list < RouteCacheEntry::IP_VECTOR > | routeVector |
Define the vector of route entries. More... | |
Public Member Functions | |
RouteCache () | |
virtual | ~RouteCache () |
void | AddArpCache (Ptr< ArpCache >) |
Add ARP cache to be used to allow layer 2 notifications processing. More... | |
void | AddNeighbor (std::vector< Ipv4Address > nodeList, Ipv4Address ownAddress, Time expire) |
Add to the neighbor list. More... | |
bool | AddRoute (RouteCacheEntry &rt) |
Add route cache entry if it doesn't yet exist in route cache. More... | |
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. More... | |
void | Clear () |
Delete all entries from routing table. More... | |
void | ClearMac () |
Remove all entries. More... | |
void | DelArpCache (Ptr< ArpCache >) |
Don't use given ARP cache any more (interface is down) More... | |
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. More... | |
bool | DeleteRoute (Ipv4Address dst) |
Delete the route with certain destination address. More... | |
bool | FindSameRoute (RouteCacheEntry &rt, std::list< RouteCacheEntry > &rtVector) |
Find the same route in the route cache. More... | |
uint16_t | GetAckSize () |
Get the ack table size. More... | |
Time | GetExpireTime (Ipv4Address addr) |
Return expire time for neighbor node with address addr, if exists, else return 0. More... | |
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. More... | |
bool | IsLinkCache () |
bool | IsNeighbor (Ipv4Address addr) |
Check that node with address addr is neighbor. More... | |
Mac48Address | LookupMacAddress (Ipv4Address) |
Find MAC address by IP using list of ARP caches. More... | |
bool | LookupRoute (Ipv4Address id, RouteCacheEntry &rt) |
Lookup route cache entry with destination address dst. More... | |
void | Print (std::ostream &os) |
Print route cache. More... | |
void | PrintRouteVector (std::list< RouteCacheEntry > route) |
Print all the route vector elements from the route list. More... | |
void | PrintVector (std::vector< Ipv4Address > &vec) |
Print the route vector elements. More... | |
void | ProcessTxError (WifiMacHeader const &) |
Process layer 2 TX error notification. More... | |
void | Purge () |
Delete all outdated entries and invalidate valid entry if Lifetime is expired. More... | |
void | PurgeLinkNode () |
void | PurgeMac () |
Remove all expired mac entries. More... | |
void | RebuildBestRouteTable (Ipv4Address source) |
USE MAXWEIGHT TO REPRESENT MAX; USE BROADCAST ADDRESS TO REPRESENT NULL PRECEEDING ADDRESS. More... | |
void | RemoveLastEntry (std::list< RouteCacheEntry > &rtVector) |
Remove the aged route cache entries when the route cache is full. More... | |
void | ScheduleTimer () |
Schedule m_ntimer. More... | |
void | SetCacheType (std::string type) |
Dijsktra algorithm to get the best route from m_netGraph and update the m_bestRoutesTable_link when current graph information has changed. More... | |
void | UpdateNeighbor (std::vector< Ipv4Address > nodeList, Time expire) |
Update expire time for entry with address addr, if it exists, else add new entry. More... | |
void | UpdateNetGraph () |
Update the Net Graph for the link and node cache has changed. More... | |
bool | UpdateRouteEntry (Ipv4Address dst) |
Update route cache entry if it has been recently used and successfully delivered the data packet. More... | |
void | 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. More... | |
Fields | |
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) |
Handle link failure callback | |
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) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
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) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
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 () |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Noop. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Public Attributes | |
std::vector< Ptr< ArpCache > > | m_arp |
list of ARP cached to be used for layer 2 notifications processing More... | |
Time | m_delay |
This timeout deals with the passive ack. More... | |
Callback< void, Ipv4Address, uint8_t > | m_handleLinkFailure |
The following code handles link-layer acks. More... | |
std::vector< Neighbor > | m_nb |
vector of entries More... | |
Timer | m_ntimer |
Timer for neighbor's list. Schedule Purge(). More... | |
Callback< void, WifiMacHeader const & > | m_txErrorCallback |
TX error callback. More... | |
Private Types | |
typedef std::list < RouteCacheEntry > | routeEntryVector |
Define the route cache data structure. More... | |
Private Member Functions | |
bool | DecStability (Ipv4Address node) |
decrease the stability of the node More... | |
bool | IncStability (Ipv4Address node) |
increase the stability of the node More... | |
bool | LookupRoute_Link (Ipv4Address id, RouteCacheEntry &rt) |
used by LookupRoute when LinkCache More... | |
RouteCache & | operator= (RouteCache const &) |
Private Attributes | |
std::map< Ipv4Address, uint16_t > | m_ackIdCache |
The id cache to ensure all the ids are unique. More... | |
Time | m_badLinkLifetime |
The time for which the neighboring node is put into the blacklist. More... | |
std::map< Ipv4Address, RouteCacheEntry::IP_VECTOR > | m_bestRoutesTable_link |
for link route cache More... | |
Time | m_initStability |
bool | m_isLinkCache |
Check if the route is using path cache or link cache. More... | |
std::map< Link, LinkStab > | m_linkCache |
The data structure to store link info. More... | |
uint32_t | m_maxCacheLen |
The maximum number of packets that we allow a routing protocol to buffer. More... | |
uint32_t | m_maxEntriesEachDst |
number of entries for each destination More... | |
Time | m_minLifeTime |
std::map< Ipv4Address, std::map< Ipv4Address, uint32_t > > | m_netGraph |
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. More... | |
std::map< Ipv4Address, NodeStab > | m_nodeCache |
The data structure to store node info. More... | |
routeEntryVector | m_routeEntryVector |
Define the route vector. More... | |
std::map< Ipv4Address, routeEntryVector > | m_sortedRoutes |
Map the ipv4Address to route entry vector. More... | |
uint32_t | m_stabilityDecrFactor |
Define the parameters for link cache type. More... | |
uint32_t | m_stabilityIncrFactor |
bool | m_subRoute |
Check if save the sub route entries or not. More... | |
Time | m_useExtends |
RouteCacheEntry::IP_VECTOR | m_vector |
The route vector to save the ip addresses for intermediate nodes. More... | |
Time | RouteCacheTimeout |
The maximum period of time that dsr is allowed to for an unused route. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoDispose (void) |
This method is called by Object::Dispose or by the object's destructor, whichever comes first. More... | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
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 285 of file dsr-rcache.h.
|
private |
Define the route cache data structure.
Definition at line 552 of file dsr-rcache.h.
Define the vector of route entries.
Definition at line 301 of file dsr-rcache.h.
ns3::dsr::RouteCache::RouteCache | ( | ) |
Definition at line 146 of file dsr-rcache.cc.
References m_delay, m_ntimer, m_txErrorCallback, ns3::MakeCallback(), ProcessTxError(), PurgeMac(), ns3::Timer::SetDelay(), and ns3::Timer::SetFunction().
|
virtual |
Definition at line 161 of file dsr-rcache.cc.
References m_sortedRoutes, and NS_LOG_FUNCTION_NOARGS.
Add ARP cache to be used to allow layer 2 notifications processing.
Definition at line 1205 of file dsr-rcache.cc.
References m_arp.
void ns3::dsr::RouteCache::AddNeighbor | ( | std::vector< Ipv4Address > | nodeList, |
Ipv4Address | ownAddress, | ||
Time | expire | ||
) |
Add to the neighbor list.
Definition at line 1142 of file dsr-rcache.cc.
References LookupMacAddress(), m_nb, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_LOGIC, and PurgeMac().
bool ns3::dsr::RouteCache::AddRoute | ( | RouteCacheEntry & | rt | ) |
Add route cache entry if it doesn't yet exist in route cache.
rt | route cache entry |
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 656 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().
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 561 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().
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 1050 of file dsr-rcache.cc.
References m_ackIdCache, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
|
inline |
Delete all entries from routing table.
Definition at line 435 of file dsr-rcache.h.
References m_routeEntryVector.
|
inline |
|
private |
decrease the stability of the node
node | the ip address of the node we want to decrease stability |
Definition at line 538 of file dsr-rcache.cc.
References m_initStability, m_nodeCache, m_stabilityDecrFactor, NS_LOG_FUNCTION, and NS_LOG_INFO.
Referenced by DeleteAllRoutesIncludeLink().
Don't use given ARP cache any more (interface is down)
Definition at line 1211 of file dsr-rcache.cc.
References m_arp.
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.
errorSrc | The error source address |
unreachNode | The unreachable node |
node | This node's ip address |
Definition at line 773 of file dsr-rcache.cc.
References first::address, 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().
bool ns3::dsr::RouteCache::DeleteRoute | ( | Ipv4Address | dst | ) |
Delete the route with certain destination address.
dst | the destination address of the routes that should be deleted |
Definition at line 759 of file dsr-rcache.cc.
References m_sortedRoutes, NS_LOG_FUNCTION, NS_LOG_LOGIC, and Purge().
bool ns3::dsr::RouteCache::FindSameRoute | ( | RouteCacheEntry & | rt, |
std::list< RouteCacheEntry > & | rtVector | ||
) |
Find the same route in the route cache.
rt | entry with destination address dst, if exists |
rtVector | the route vector |
Definition at line 726 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().
uint16_t ns3::dsr::RouteCache::GetAckSize | ( | ) |
|
inline |
Definition at line 336 of file dsr-rcache.h.
References m_badLinkLifetime.
|
inline |
Definition at line 320 of file dsr-rcache.h.
References RouteCacheTimeout.
|
inline |
Definition at line 529 of file dsr-rcache.h.
References m_handleLinkFailure.
Time ns3::dsr::RouteCache::GetExpireTime | ( | Ipv4Address | addr | ) |
Return expire time for neighbor node with address addr, if exists, else return 0.
Definition at line 1098 of file dsr-rcache.cc.
References m_nb, ns3::Simulator::Now(), NS_LOG_FUNCTION, and PurgeMac().
|
inline |
Definition at line 360 of file dsr-rcache.h.
References m_initStability.
|
inline |
Definition at line 312 of file dsr-rcache.h.
References m_maxCacheLen.
|
inline |
Definition at line 328 of file dsr-rcache.h.
References m_maxEntriesEachDst.
|
inline |
Definition at line 368 of file dsr-rcache.h.
References m_minLifeTime.
|
inline |
Definition at line 344 of file dsr-rcache.h.
References m_stabilityDecrFactor.
|
inline |
Definition at line 352 of file dsr-rcache.h.
References m_stabilityIncrFactor.
|
inline |
Definition at line 304 of file dsr-rcache.h.
References m_subRoute.
|
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 519 of file dsr-rcache.h.
References m_txErrorCallback.
|
static |
Definition at line 137 of file dsr-rcache.cc.
References ns3::TypeId::SetParent().
|
inline |
Definition at line 376 of file dsr-rcache.h.
References m_useExtends.
|
private |
increase the stability of the node
node | the ip address of the node we want to increase stability |
Definition at line 514 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().
bool ns3::dsr::RouteCache::IsLinkCache | ( | ) |
Definition at line 309 of file dsr-rcache.cc.
References m_isLinkCache, and NS_LOG_FUNCTION.
Referenced by DeleteAllRoutesIncludeLink(), and LookupRoute().
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 1082 of file dsr-rcache.cc.
References m_nb, NS_LOG_FUNCTION, and PurgeMac().
Mac48Address ns3::dsr::RouteCache::LookupMacAddress | ( | Ipv4Address | addr | ) |
Find MAC address by IP using list of ARP caches.
Definition at line 1217 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().
bool ns3::dsr::RouteCache::LookupRoute | ( | Ipv4Address | id, |
RouteCacheEntry & | rt | ||
) |
Lookup route cache entry with destination address dst.
id | destination address |
rt | entry with destination address id, if exists |
Definition at line 207 of file dsr-rcache.cc.
References ns3::dsr::CompareRoutesExpire(), IsLinkCache(), LookupRoute_Link(), m_sortedRoutes, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, Purge(), ns3::dsr::RouteCacheEntry::SetDestination(), ns3::dsr::RouteCacheEntry::SetExpireTime(), and ns3::dsr::RouteCacheEntry::SetVector().
|
private |
used by LookupRoute when LinkCache
id | the ip address we are looking for |
rt | the route cache entry to store the found one |
We need to purge the link node cache
Definition at line 432 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().
|
private |
void ns3::dsr::RouteCache::Print | ( | std::ostream & | os | ) |
Print route cache.
Definition at line 1031 of file dsr-rcache.cc.
References m_routeEntryVector, NS_LOG_FUNCTION, and Purge().
void ns3::dsr::RouteCache::PrintRouteVector | ( | std::list< RouteCacheEntry > | route | ) |
Print all the route vector elements from the route list.
route | the route list |
Definition at line 952 of file dsr-rcache.cc.
References NS_LOG_FUNCTION, NS_LOG_INFO, and PrintVector().
void ns3::dsr::RouteCache::PrintVector | ( | std::vector< Ipv4Address > & | vec | ) |
Print the route vector elements.
vec | the route vector |
Definition at line 931 of file dsr-rcache.cc.
References NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by LookupRoute_Link(), PrintRouteVector(), and RebuildBestRouteTable().
void ns3::dsr::RouteCache::ProcessTxError | ( | WifiMacHeader const & | hdr | ) |
Process layer 2 TX error notification.
Definition at line 1234 of file dsr-rcache.cc.
References ns3::WifiMacHeader::GetAddr1(), m_nb, and PurgeMac().
Referenced by RouteCache().
void ns3::dsr::RouteCache::Purge | ( | ) |
Delete all outdated entries and invalidate valid entry if Lifetime is expired.
Definition at line 964 of file dsr-rcache.cc.
References m_sortedRoutes, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by AddRoute(), DeleteAllRoutesIncludeLink(), DeleteRoute(), LookupRoute(), and Print().
void ns3::dsr::RouteCache::PurgeLinkNode | ( | ) |
may need to remove them after verify
Definition at line 464 of file dsr-rcache.cc.
References m_linkCache, m_nodeCache, NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by AddRoute_Link(), DeleteAllRoutesIncludeLink(), LookupRoute_Link(), and UseExtends().
void ns3::dsr::RouteCache::PurgeMac | ( | ) |
Remove all expired mac entries.
Definition at line 1172 of file dsr-rcache.cc.
References ns3::Timer::Cancel(), m_handleLinkFailure, m_nb, m_ntimer, NS_LOG_LOGIC, and ns3::Timer::Schedule().
Referenced by AddNeighbor(), GetExpireTime(), IsNeighbor(), ProcessTxError(), RouteCache(), and UpdateNeighbor().
void ns3::dsr::RouteCache::RebuildBestRouteTable | ( | Ipv4Address | source | ) |
USE MAXWEIGHT TO REPRESENT MAX; USE BROADCAST ADDRESS TO REPRESENT NULL PRECEEDING ADDRESS.
source | The source address the routes based on |
The followings are initialize-single-source
The followings are core of dijskra algorithm
Definition at line 316 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, PrintVector(), and s.
Referenced by AddRoute_Link(), and DeleteAllRoutesIncludeLink().
void ns3::dsr::RouteCache::RemoveLastEntry | ( | std::list< RouteCacheEntry > & | rtVector | ) |
Remove the aged route cache entries when the route cache is full.
Definition at line 169 of file dsr-rcache.cc.
References NS_LOG_FUNCTION.
Referenced by AddRoute().
void ns3::dsr::RouteCache::ScheduleTimer | ( | ) |
Schedule m_ntimer.
Definition at line 1198 of file dsr-rcache.cc.
References ns3::Timer::Cancel(), m_ntimer, and ns3::Timer::Schedule().
|
inline |
Definition at line 340 of file dsr-rcache.h.
References m_badLinkLifetime.
|
inline |
Definition at line 324 of file dsr-rcache.h.
References RouteCacheTimeout.
void ns3::dsr::RouteCache::SetCacheType | ( | std::string | type | ) |
Dijsktra algorithm to get the best route from m_netGraph and update the m_bestRoutesTable_link when current graph information has changed.
type | The type of the cache |
Definition at line 290 of file dsr-rcache.cc.
References m_isLinkCache, NS_LOG_FUNCTION, and NS_LOG_INFO.
|
inline |
Definition at line 525 of file dsr-rcache.h.
References m_handleLinkFailure.
|
inline |
Definition at line 364 of file dsr-rcache.h.
References m_initStability.
|
inline |
Definition at line 316 of file dsr-rcache.h.
References m_maxCacheLen.
|
inline |
Definition at line 332 of file dsr-rcache.h.
References m_maxEntriesEachDst.
|
inline |
Definition at line 372 of file dsr-rcache.h.
References m_minLifeTime.
|
inline |
Definition at line 348 of file dsr-rcache.h.
References m_stabilityDecrFactor.
|
inline |
Definition at line 356 of file dsr-rcache.h.
References m_stabilityIncrFactor.
|
inline |
Definition at line 308 of file dsr-rcache.h.
References m_subRoute.
|
inline |
Definition at line 380 of file dsr-rcache.h.
References m_useExtends.
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 1114 of file dsr-rcache.cc.
References LookupMacAddress(), m_nb, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and PurgeMac().
void ns3::dsr::RouteCache::UpdateNetGraph | ( | ) |
Update the Net Graph for the link and node cache has changed.
Definition at line 499 of file dsr-rcache.cc.
References m_linkCache, m_netGraph, and NS_LOG_FUNCTION.
Referenced by AddRoute_Link(), and DeleteAllRoutesIncludeLink().
bool ns3::dsr::RouteCache::UpdateRouteEntry | ( | Ipv4Address | dst | ) |
Update route cache entry if it has been recently used and successfully delivered the data packet.
dst | destination address of the route |
Definition at line 177 of file dsr-rcache.cc.
References ns3::dsr::CompareRoutesExpire(), m_sortedRoutes, NS_LOG_FUNCTION, NS_LOG_LOGIC, RouteCacheTimeout, and ns3::dsr::RouteCacheEntry::SetExpireTime().
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
Increase the stability of the node cache
Definition at line 610 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().
|
private |
The id cache to ensure all the ids are unique.
Definition at line 560 of file dsr-rcache.h.
Referenced by CheckUniqueAckId(), and GetAckSize().
list of ARP cached to be used for layer 2 notifications processing
Definition at line 635 of file dsr-rcache.h.
Referenced by AddArpCache(), DelArpCache(), and LookupMacAddress().
|
private |
The time for which the neighboring node is put into the blacklist.
Definition at line 540 of file dsr-rcache.h.
Referenced by GetBadLinkLifetime(), and SetBadLinkLifetime().
|
private |
for link route cache
Definition at line 577 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 637 of file dsr-rcache.h.
Referenced by RouteCache().
Callback<void, Ipv4Address, uint8_t > ns3::dsr::RouteCache::m_handleLinkFailure |
The following code handles link-layer acks.
link failure callback
Definition at line 627 of file dsr-rcache.h.
Referenced by GetCallback(), PurgeMac(), and SetCallback().
|
private |
Definition at line 546 of file dsr-rcache.h.
Referenced by AddRoute_Link(), DecStability(), GetInitStability(), IncStability(), SetInitStability(), and UseExtends().
|
private |
Check if the route is using path cache or link cache.
Definition at line 562 of file dsr-rcache.h.
Referenced by IsLinkCache(), and SetCacheType().
The data structure to store link info.
Definition at line 578 of file dsr-rcache.h.
Referenced by AddRoute_Link(), DeleteAllRoutesIncludeLink(), PurgeLinkNode(), RebuildBestRouteTable(), UpdateNetGraph(), and UseExtends().
|
private |
The maximum number of packets that we allow a routing protocol to buffer.
Definition at line 538 of file dsr-rcache.h.
Referenced by GetMaxCacheLen(), and SetMaxCacheLen().
|
private |
number of entries for each destination
Definition at line 558 of file dsr-rcache.h.
Referenced by AddRoute(), GetMaxEntriesEachDst(), and SetMaxEntriesEachDst().
|
private |
Definition at line 547 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 633 of file dsr-rcache.h.
Referenced by AddNeighbor(), ClearMac(), GetExpireTime(), IsNeighbor(), ProcessTxError(), PurgeMac(), and UpdateNeighbor().
|
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 575 of file dsr-rcache.h.
Referenced by RebuildBestRouteTable(), and UpdateNetGraph().
|
private |
The data structure to store node info.
Definition at line 579 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 631 of file dsr-rcache.h.
Referenced by PurgeMac(), RouteCache(), and ScheduleTimer().
|
private |
Define the route vector.
Definition at line 556 of file dsr-rcache.h.
|
private |
Map the ipv4Address to route entry vector.
Definition at line 554 of file dsr-rcache.h.
Referenced by AddRoute(), DeleteAllRoutesIncludeLink(), DeleteRoute(), FindSameRoute(), LookupRoute(), Purge(), UpdateRouteEntry(), and ~RouteCache().
|
private |
Define the parameters for link cache type.
Definition at line 544 of file dsr-rcache.h.
Referenced by DecStability(), GetStabilityDecrFactor(), and SetStabilityDecrFactor().
|
private |
Definition at line 545 of file dsr-rcache.h.
Referenced by GetStabilityIncrFactor(), IncStability(), and SetStabilityIncrFactor().
|
private |
Check if save the sub route entries or not.
Definition at line 564 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 629 of file dsr-rcache.h.
Referenced by GetTxErrorCallback(), and RouteCache().
|
private |
Definition at line 548 of file dsr-rcache.h.
Referenced by GetUseExtends(), SetUseExtends(), and UseExtends().
|
private |
The route vector to save the ip addresses for intermediate nodes.
Definition at line 537 of file dsr-rcache.h.
|
private |
The maximum period of time that dsr is allowed to for an unused route.
Definition at line 539 of file dsr-rcache.h.
Referenced by GetCacheTimeout(), LookupRoute_Link(), SetCacheTimeout(), and UpdateRouteEntry().