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 |
Structure to manage neighbor state. More... | |
Public Types | |
typedef std::list< DsrRouteCacheEntry::IP_VECTOR > | routeVector |
Define the vector of route entries. More... | |
Public Member Functions | |
DsrRouteCache () | |
virtual | ~DsrRouteCache () |
void | AddArpCache (Ptr< ArpCache > a) |
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 (DsrRouteCacheEntry &rt) |
Add route cache entry if it doesn't yet exist in route cache. More... | |
bool | AddRoute_Link (DsrRouteCacheEntry::IP_VECTOR nodelist, Ipv4Address node) |
dd route link to cache More... | |
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 the provided 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 (DsrRouteCacheEntry &rt, std::list< DsrRouteCacheEntry > &rtVector) |
Find the same route in the route cache. More... | |
uint16_t | GetAckSize () |
Get the ack table size. More... | |
Time | GetBadLinkLifetime () const |
Get bad link lifetime function. More... | |
Time | GetCacheTimeout () const |
Get cache timeout value. More... | |
Callback< void, Ipv4Address, uint8_t > | GetCallback () const |
Handle link failure callback. More... | |
Time | GetExpireTime (Ipv4Address addr) |
Return expire time for neighbor node with address addr, if exists, else return 0. More... | |
Time | GetInitStability () const |
Get initial stability. More... | |
uint32_t | GetMaxCacheLen () const |
Get the max queue length. More... | |
uint32_t | GetMaxEntriesEachDst () const |
Get max entries for each destination. More... | |
Time | GetMinLifeTime () const |
Get minimum lifetime. More... | |
uint64_t | GetStabilityDecrFactor () const |
Get stability decrease factor. More... | |
uint64_t | GetStabilityIncrFactor () const |
Get stability increase factor. More... | |
bool | GetSubRoute () const |
Get subroute indicator. 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... | |
Time | GetUseExtends () const |
Get use extends. More... | |
bool | IsLinkCache () |
is link cached More... | |
bool | IsNeighbor (Ipv4Address addr) |
Check that node with address addr is neighbor. More... | |
Mac48Address | LookupMacAddress (Ipv4Address addr) |
Find MAC address by IP using list of ARP caches. More... | |
bool | LookupRoute (Ipv4Address id, DsrRouteCacheEntry &rt) |
Lookup route cache entry with destination address dst. More... | |
DsrRouteCache & | operator= (DsrRouteCache const &)=delete |
void | Print (std::ostream &os) |
Print route cache. More... | |
void | PrintRouteVector (std::list< DsrRouteCacheEntry > 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 &hdr) |
Process layer 2 TX error notification. More... | |
void | Purge () |
Delete all outdated entries and invalidate valid entry if Lifetime is expired. More... | |
void | PurgeLinkNode () |
Purge from the cache if the stability time expired. More... | |
void | PurgeMac () |
Remove all expired mac entries. More... | |
void | RebuildBestRouteTable (Ipv4Address source) |
Rebuild the best route table. More... | |
void | RemoveLastEntry (std::list< DsrRouteCacheEntry > &rtVector) |
Remove the aged route cache entries when the route cache is full. More... | |
void | ScheduleTimer () |
Schedule m_ntimer. More... | |
void | SetBadLinkLifetime (Time t) |
Set bad link lifetime function. More... | |
void | SetCacheTimeout (Time t) |
Set cache timeout value. 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 | SetCallback (Callback< void, Ipv4Address, uint8_t > cb) |
Handle link failure callback. More... | |
void | SetInitStability (Time initStability) |
Set initial stability. More... | |
void | SetMaxCacheLen (uint32_t len) |
Set the max queue length. More... | |
void | SetMaxEntriesEachDst (uint32_t entries) |
Set max entries for each destination. More... | |
void | SetMinLifeTime (Time minLifeTime) |
Set minimum lifetime. More... | |
void | SetStabilityDecrFactor (uint64_t decrFactor) |
Set stability decrease factor. More... | |
void | SetStabilityIncrFactor (uint64_t incrFactor) |
Set stability increase factor. More... | |
void | SetSubRoute (bool subRoute) |
Set subroute indicator. More... | |
void | SetUseExtends (Time useExtends) |
Set use extends. 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 (DsrRouteCacheEntry::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... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
virtual | ~Object () |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose (void) |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator (void) const |
Get an iterator to the Objects aggregated to this one. More... | |
virtual TypeId | GetInstanceTypeId (void) const |
Get the most derived TypeId for this Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (void) const |
Get a pointer to the requested aggregated Object. More... | |
void | Initialize (void) |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized (void) const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= ([[maybe_unused]] const SimpleRefCount &o) |
Assignment operator. 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 |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising erros. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. 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< DsrRouteCacheEntry > | 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, DsrRouteCacheEntry &rt) |
used by LookupRoute when LinkCache More... | |
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, DsrRouteCacheEntry::IP_VECTOR > | m_bestRoutesTable_link |
for link route cache More... | |
Time | m_initStability |
initial stability More... | |
bool | m_isLinkCache |
Check if the route is using path cache or link cache. More... | |
std::map< Link, DsrLinkStab > | 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 |
minimum lifetime More... | |
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, DsrNodeStab > | 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 |
stability decrease factor More... | |
uint32_t | m_stabilityIncrFactor |
stability increase factor More... | |
bool | m_subRoute |
Check if save the sub route entries or not. More... | |
Time | m_useExtends |
use extend More... | |
DsrRouteCacheEntry::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) | |
Copy an Object. More... | |
virtual void | DoDispose (void) |
Destructor implementation. More... | |
virtual void | DoInitialize (void) |
Initialize() implementation. More... | |
virtual void | NotifyNewAggregate (void) |
Notify all Objects aggregated to this one of a new Object being aggregated. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted (void) |
Notifier called once the ObjectBase is fully constructed. More... | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid (void) |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
DSR route request queue Since DSR is an on demand routing we queue requests while looking for route.
ns3::dsr::DsrRouteCache is accessible through the following paths with Config::Set and Config::Connect:
No Attributes are defined for this type.
No TraceSources are defined for this type.
Size of this type is 568 bytes (on a 64-bit architecture).
Definition at line 380 of file dsr-rcache.h.
|
private |
Define the route cache data structure.
Definition at line 763 of file dsr-rcache.h.
Define the vector of route entries.
Definition at line 403 of file dsr-rcache.h.
ns3::dsr::DsrRouteCache::DsrRouteCache | ( | ) |
Definition at line 147 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 162 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.
a | ARP cache |
Definition at line 1213 of file dsr-rcache.cc.
References m_arp.
void ns3::dsr::DsrRouteCache::AddNeighbor | ( | std::vector< Ipv4Address > | nodeList, |
Ipv4Address | ownAddress, | ||
Time | expire | ||
) |
Add to the neighbor list.
nodeList | neighbor list |
ownAddress | local address |
expire | expiration time |
Definition at line 1143 of file dsr-rcache.cc.
References LookupMacAddress(), m_nb, ns3::Simulator::Now(), NS_LOG_DEBUG, NS_LOG_LOGIC, and PurgeMac().
bool ns3::dsr::DsrRouteCache::AddRoute | ( | DsrRouteCacheEntry & | 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 657 of file dsr-rcache.cc.
References ns3::dsr::CompareRoutesExpire(), FindSameRoute(), ns3::dsr::DsrRouteCacheEntry::GetDestination(), ns3::dsr::DsrRouteCacheEntry::GetExpireTime(), ns3::dsr::DsrRouteCacheEntry::GetVector(), m_maxEntriesEachDst, m_sortedRoutes, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, Purge(), RemoveLastEntry(), test-ns3::result, and ns3::Time::S.
bool ns3::dsr::DsrRouteCache::AddRoute_Link | ( | DsrRouteCacheEntry::IP_VECTOR | nodelist, |
Ipv4Address | node | ||
) |
dd route link to cache
nodelist | vector of nodes |
node | ip address of node to add |
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 562 of file dsr-rcache.cc.
References ns3::Time::As(), ns3::dsr::DsrLinkStab::GetLinkStability(), m_initStability, m_linkCache, m_minLifeTime, m_nodeCache, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::dsr::Link::Print(), ns3::dsr::DsrLinkStab::Print(), PurgeLinkNode(), RebuildBestRouteTable(), ns3::Time::S, ns3::dsr::DsrLinkStab::SetLinkStability(), ns3::dsr::DsrNodeStab::SetNodeStability(), and UpdateNetGraph().
uint16_t ns3::dsr::DsrRouteCache::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.
nextHop | to check for in cache |
Definition at line 1051 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 619 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 539 of file dsr-rcache.cc.
References ns3::Time::As(), m_initStability, m_nodeCache, m_stabilityDecrFactor, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::Time::S.
Referenced by DeleteAllRoutesIncludeLink().
Don't use the provided ARP cache any more (interface is down)
a | ARP cache |
Definition at line 1219 of file dsr-rcache.cc.
References m_arp.
void ns3::dsr::DsrRouteCache::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 774 of file dsr-rcache.cc.
References first::address, ns3::dsr::CompareRoutesExpire(), DecStability(), IsLinkCache(), bianchi11ax::k, m_linkCache, m_nodeCache, m_sortedRoutes, m_subRoute, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC, Purge(), PurgeLinkNode(), RebuildBestRouteTable(), ns3::dsr::DsrRouteCacheEntry::SetDestination(), ns3::dsr::DsrRouteCacheEntry::SetExpireTime(), ns3::dsr::DsrRouteCacheEntry::SetVector(), and UpdateNetGraph().
bool ns3::dsr::DsrRouteCache::DeleteRoute | ( | Ipv4Address | dst | ) |
Delete the route with certain destination address.
dst | the destination address of the routes that should be deleted |
Definition at line 760 of file dsr-rcache.cc.
References m_sortedRoutes, NS_LOG_FUNCTION, NS_LOG_LOGIC, and Purge().
bool ns3::dsr::DsrRouteCache::FindSameRoute | ( | DsrRouteCacheEntry & | rt, |
std::list< DsrRouteCacheEntry > & | rtVector | ||
) |
Find the same route in the route cache.
rt | entry with destination address dst, if exists |
rtVector | the route vector |
Definition at line 727 of file dsr-rcache.cc.
References ns3::Time::As(), ns3::dsr::CompareRoutesExpire(), ns3::dsr::DsrRouteCacheEntry::GetDestination(), ns3::dsr::DsrRouteCacheEntry::GetExpireTime(), ns3::dsr::DsrRouteCacheEntry::GetVector(), m_sortedRoutes, NS_LOG_DEBUG, NS_LOG_FUNCTION, test-ns3::result, and ns3::Time::S.
Referenced by AddRoute().
uint16_t ns3::dsr::DsrRouteCache::GetAckSize | ( | ) |
Get the ack table size.
Definition at line 1073 of file dsr-rcache.cc.
References m_ackIdCache.
|
inline |
Get bad link lifetime function.
Definition at line 474 of file dsr-rcache.h.
References m_badLinkLifetime.
|
inline |
Get cache timeout value.
Definition at line 442 of file dsr-rcache.h.
References RouteCacheTimeout.
|
inline |
Handle link failure callback.
Definition at line 742 of file dsr-rcache.h.
References m_handleLinkFailure.
Time ns3::dsr::DsrRouteCache::GetExpireTime | ( | Ipv4Address | addr | ) |
Return expire time for neighbor node with address addr, if exists, else return 0.
addr | IP address |
Definition at line 1099 of file dsr-rcache.cc.
References m_nb, ns3::Simulator::Now(), NS_LOG_FUNCTION, PurgeMac(), and ns3::Seconds().
|
inline |
Get initial stability.
Definition at line 522 of file dsr-rcache.h.
References m_initStability.
|
inline |
Get the max queue length.
Definition at line 426 of file dsr-rcache.h.
References m_maxCacheLen.
|
inline |
Get max entries for each destination.
Definition at line 458 of file dsr-rcache.h.
References m_maxEntriesEachDst.
|
inline |
Get minimum lifetime.
Definition at line 538 of file dsr-rcache.h.
References m_minLifeTime.
|
inline |
Get stability decrease factor.
Definition at line 490 of file dsr-rcache.h.
References m_stabilityDecrFactor.
|
inline |
Get stability increase factor.
Definition at line 506 of file dsr-rcache.h.
References m_stabilityIncrFactor.
|
inline |
Get subroute indicator.
Definition at line 410 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 725 of file dsr-rcache.h.
References m_txErrorCallback.
|
static |
Get the type ID.
Definition at line 137 of file dsr-rcache.cc.
References ns3::TypeId::SetParent().
|
inline |
Get use extends.
Definition at line 554 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 515 of file dsr-rcache.cc.
References ns3::Time::As(), m_initStability, m_nodeCache, m_stabilityIncrFactor, NS_LOG_FUNCTION, NS_LOG_INFO, and ns3::Time::S.
Referenced by UseExtends().
bool ns3::dsr::DsrRouteCache::IsLinkCache | ( | ) |
is link cached
Definition at line 310 of file dsr-rcache.cc.
References m_isLinkCache, and NS_LOG_FUNCTION.
Referenced by DeleteAllRoutesIncludeLink(), and LookupRoute().
bool ns3::dsr::DsrRouteCache::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.
addr | IP address |
Definition at line 1083 of file dsr-rcache.cc.
References m_nb, NS_LOG_FUNCTION, and PurgeMac().
Mac48Address ns3::dsr::DsrRouteCache::LookupMacAddress | ( | Ipv4Address | addr | ) |
Find MAC address by IP using list of ARP caches.
addr | the IPv4 address to look for |
Definition at line 1225 of file dsr-rcache.cc.
References ns3::Mac48Address::ConvertFrom(), ns3::ArpCache::Entry::GetMacAddress(), ns3::ArpCache::Entry::IsAlive(), ns3::ArpCache::Entry::IsExpired(), ns3::ArpCache::Entry::IsPermanent(), and m_arp.
Referenced by AddNeighbor(), and UpdateNeighbor().
bool ns3::dsr::DsrRouteCache::LookupRoute | ( | Ipv4Address | id, |
DsrRouteCacheEntry & | rt | ||
) |
Lookup route cache entry with destination address dst.
id | destination address |
rt | entry with destination address id, if exists |
Definition at line 208 of file dsr-rcache.cc.
References ns3::dsr::CompareRoutesExpire(), IsLinkCache(), bianchi11ax::k, LookupRoute_Link(), m_sortedRoutes, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, Purge(), ns3::dsr::DsrRouteCacheEntry::SetDestination(), ns3::dsr::DsrRouteCacheEntry::SetExpireTime(), and ns3::dsr::DsrRouteCacheEntry::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 433 of file dsr-rcache.cc.
References ns3::dsr::DsrRouteCacheEntry::GetVector(), m_bestRoutesTable_link, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, PrintVector(), PurgeLinkNode(), RouteCacheTimeout, ns3::dsr::DsrRouteCacheEntry::SetDestination(), ns3::dsr::DsrRouteCacheEntry::SetExpireTime(), and ns3::dsr::DsrRouteCacheEntry::SetVector().
Referenced by LookupRoute().
|
delete |
void ns3::dsr::DsrRouteCache::Print | ( | std::ostream & | os | ) |
Print route cache.
os | the output stream |
Definition at line 1032 of file dsr-rcache.cc.
References m_routeEntryVector, NS_LOG_FUNCTION, and Purge().
void ns3::dsr::DsrRouteCache::PrintRouteVector | ( | std::list< DsrRouteCacheEntry > | route | ) |
Print all the route vector elements from the route list.
route | the route list |
Definition at line 953 of file dsr-rcache.cc.
References NS_LOG_FUNCTION, NS_LOG_INFO, and PrintVector().
void ns3::dsr::DsrRouteCache::PrintVector | ( | std::vector< Ipv4Address > & | vec | ) |
Print the route vector elements.
vec | the route vector |
Definition at line 932 of file dsr-rcache.cc.
References NS_LOG_DEBUG, and NS_LOG_FUNCTION.
Referenced by LookupRoute_Link(), PrintRouteVector(), and RebuildBestRouteTable().
void ns3::dsr::DsrRouteCache::ProcessTxError | ( | WifiMacHeader const & | hdr | ) |
Process layer 2 TX error notification.
hdr | Wi-Fi Mac Header |
Definition at line 1242 of file dsr-rcache.cc.
References ns3::WifiMacHeader::GetAddr1(), m_nb, and PurgeMac().
Referenced by DsrRouteCache().
void ns3::dsr::DsrRouteCache::Purge | ( | ) |
Delete all outdated entries and invalidate valid entry if Lifetime is expired.
Definition at line 965 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().
void ns3::dsr::DsrRouteCache::PurgeLinkNode | ( | ) |
Purge from the cache if the stability time expired.
may need to remove them after verify
Definition at line 465 of file dsr-rcache.cc.
References m_linkCache, m_nodeCache, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::Time::S, and ns3::Seconds().
Referenced by AddRoute_Link(), DeleteAllRoutesIncludeLink(), LookupRoute_Link(), and UseExtends().
void ns3::dsr::DsrRouteCache::PurgeMac | ( | ) |
Remove all expired mac entries.
Definition at line 1180 of file dsr-rcache.cc.
References ns3::Timer::Cancel(), m_handleLinkFailure, m_nb, m_ntimer, NS_LOG_LOGIC, and ns3::Timer::Schedule().
Referenced by DsrRouteCache(), AddNeighbor(), GetExpireTime(), IsNeighbor(), ProcessTxError(), and UpdateNeighbor().
void ns3::dsr::DsrRouteCache::RebuildBestRouteTable | ( | Ipv4Address | source | ) |
Rebuild the best route table.
source | The source address used for computing the routes |
The following are initialize-single-source
The following is the core of Dijkstra algorithm
Definition at line 317 of file dsr-rcache.cc.
References ns3::Ipv4Address::IsBroadcast(), bianchi11ax::k, 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().
void ns3::dsr::DsrRouteCache::RemoveLastEntry | ( | std::list< DsrRouteCacheEntry > & | rtVector | ) |
Remove the aged route cache entries when the route cache is full.
rtVector | the route cache to scan. |
Definition at line 170 of file dsr-rcache.cc.
References NS_LOG_FUNCTION.
Referenced by AddRoute().
void ns3::dsr::DsrRouteCache::ScheduleTimer | ( | ) |
Schedule m_ntimer.
Definition at line 1206 of file dsr-rcache.cc.
References ns3::Timer::Cancel(), m_ntimer, and ns3::Timer::Schedule().
|
inline |
Set bad link lifetime function.
t | the bad link lifetime |
Definition at line 482 of file dsr-rcache.h.
References m_badLinkLifetime.
|
inline |
Set cache timeout value.
t | the cache timeout time |
Definition at line 450 of file dsr-rcache.h.
References RouteCacheTimeout.
void ns3::dsr::DsrRouteCache::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 291 of file dsr-rcache.cc.
References m_isLinkCache, NS_LOG_FUNCTION, and NS_LOG_INFO.
|
inline |
Handle link failure callback.
cb | the callback to be set |
Definition at line 734 of file dsr-rcache.h.
References m_handleLinkFailure.
|
inline |
Set initial stability.
initStability | the initial stability |
Definition at line 530 of file dsr-rcache.h.
References m_initStability.
|
inline |
Set the max queue length.
len | the maximum queue length |
Definition at line 434 of file dsr-rcache.h.
References m_maxCacheLen.
|
inline |
Set max entries for each destination.
entries | the maximum entries for each destination |
Definition at line 466 of file dsr-rcache.h.
References m_maxEntriesEachDst.
|
inline |
Set minimum lifetime.
minLifeTime | the minimum lifetime |
Definition at line 546 of file dsr-rcache.h.
References m_minLifeTime.
|
inline |
Set stability decrease factor.
decrFactor | the stability decrease factor |
Definition at line 498 of file dsr-rcache.h.
References m_stabilityDecrFactor.
|
inline |
Set stability increase factor.
incrFactor | the stability increase factor |
Definition at line 514 of file dsr-rcache.h.
References m_stabilityIncrFactor.
|
inline |
Set subroute indicator.
subRoute | the subroute indicator |
Definition at line 418 of file dsr-rcache.h.
References m_subRoute.
|
inline |
Set use extends.
useExtends | the use extends time |
Definition at line 562 of file dsr-rcache.h.
References m_useExtends.
void ns3::dsr::DsrRouteCache::UpdateNeighbor | ( | std::vector< Ipv4Address > | nodeList, |
Time | expire | ||
) |
Update expire time for entry with address addr, if it exists, else add new entry.
nodeList | list of addresses |
expire | expiration time |
Definition at line 1115 of file dsr-rcache.cc.
References LookupMacAddress(), m_nb, max, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_LOG_LOGIC, and PurgeMac().
void ns3::dsr::DsrRouteCache::UpdateNetGraph | ( | ) |
Update the Net Graph for the link and node cache has changed.
Definition at line 500 of file dsr-rcache.cc.
References m_linkCache, m_netGraph, and NS_LOG_FUNCTION.
Referenced by AddRoute_Link(), and DeleteAllRoutesIncludeLink().
bool ns3::dsr::DsrRouteCache::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 178 of file dsr-rcache.cc.
References ns3::dsr::CompareRoutesExpire(), m_sortedRoutes, NS_LOG_FUNCTION, NS_LOG_LOGIC, test-ns3::result, RouteCacheTimeout, and ns3::dsr::DsrRouteCacheEntry::SetExpireTime().
void ns3::dsr::DsrRouteCache::UseExtends | ( | DsrRouteCacheEntry::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
rt | cache entry |
Purge the link node cache first
Increase the stability of the node cache
Definition at line 611 of file dsr-rcache.cc.
References IncStability(), m_initStability, m_linkCache, m_nodeCache, m_useExtends, NS_LOG_FUNCTION, NS_LOG_INFO, NS_LOG_LOGIC, PurgeLinkNode(), and ns3::Time::S.
|
private |
The id cache to ensure all the ids are unique.
Definition at line 771 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 865 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 751 of file dsr-rcache.h.
Referenced by GetBadLinkLifetime(), and SetBadLinkLifetime().
|
private |
for link route cache
Definition at line 788 of file dsr-rcache.h.
Referenced by LookupRoute_Link(), and RebuildBestRouteTable().
Time ns3::dsr::DsrRouteCache::m_delay |
This timeout deals with the passive ack.
Definition at line 867 of file dsr-rcache.h.
Referenced by DsrRouteCache().
Callback<void, Ipv4Address, uint8_t > ns3::dsr::DsrRouteCache::m_handleLinkFailure |
The following code handles link-layer acks.
link failure callback
Definition at line 857 of file dsr-rcache.h.
Referenced by GetCallback(), PurgeMac(), and SetCallback().
|
private |
initial stability
Definition at line 757 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 773 of file dsr-rcache.h.
Referenced by IsLinkCache(), and SetCacheType().
|
private |
The data structure to store link info.
Definition at line 789 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 749 of file dsr-rcache.h.
Referenced by GetMaxCacheLen(), and SetMaxCacheLen().
|
private |
number of entries for each destination
Definition at line 769 of file dsr-rcache.h.
Referenced by AddRoute(), GetMaxEntriesEachDst(), and SetMaxEntriesEachDst().
|
private |
minimum lifetime
Definition at line 758 of file dsr-rcache.h.
Referenced by AddRoute_Link(), GetMinLifeTime(), and SetMinLifeTime().
std::vector<Neighbor> ns3::dsr::DsrRouteCache::m_nb |
vector of entries
Definition at line 863 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 786 of file dsr-rcache.h.
Referenced by RebuildBestRouteTable(), and UpdateNetGraph().
|
private |
The data structure to store node info.
Definition at line 790 of file dsr-rcache.h.
Referenced by AddRoute_Link(), DecStability(), DeleteAllRoutesIncludeLink(), IncStability(), PurgeLinkNode(), and UseExtends().
Timer ns3::dsr::DsrRouteCache::m_ntimer |
Timer for neighbor's list. Schedule Purge().
Definition at line 861 of file dsr-rcache.h.
Referenced by DsrRouteCache(), PurgeMac(), and ScheduleTimer().
|
private |
Define the route vector.
Definition at line 767 of file dsr-rcache.h.
|
private |
Map the ipv4Address to route entry vector.
Definition at line 765 of file dsr-rcache.h.
Referenced by ~DsrRouteCache(), AddRoute(), DeleteAllRoutesIncludeLink(), DeleteRoute(), FindSameRoute(), LookupRoute(), Purge(), and UpdateRouteEntry().
|
private |
stability decrease factor
Definition at line 755 of file dsr-rcache.h.
Referenced by DecStability(), GetStabilityDecrFactor(), and SetStabilityDecrFactor().
|
private |
stability increase factor
Definition at line 756 of file dsr-rcache.h.
Referenced by GetStabilityIncrFactor(), IncStability(), and SetStabilityIncrFactor().
|
private |
Check if save the sub route entries or not.
Definition at line 775 of file dsr-rcache.h.
Referenced by DeleteAllRoutesIncludeLink(), GetSubRoute(), and SetSubRoute().
Callback<void, WifiMacHeader const &> ns3::dsr::DsrRouteCache::m_txErrorCallback |
TX error callback.
Definition at line 859 of file dsr-rcache.h.
Referenced by DsrRouteCache(), and GetTxErrorCallback().
|
private |
use extend
Definition at line 759 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 748 of file dsr-rcache.h.
|
private |
The maximum period of time that dsr is allowed to for an unused route.
Definition at line 750 of file dsr-rcache.h.
Referenced by GetCacheTimeout(), LookupRoute_Link(), SetCacheTimeout(), and UpdateRouteEntry().