A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::aodv::IdCache Class Reference

Unique packets identification cache used for simple duplicate detection. More...

#include "aodv-id-cache.h"

+ Collaboration diagram for ns3::aodv::IdCache:

Classes

struct  IsExpired
 IsExpired structure. More...
 
struct  UniqueId
 Unique packet ID. More...
 

Public Member Functions

 IdCache (Time lifetime)
 constructor
 
Time GetLifeTime () const
 Return lifetime for existing entries in cache.
 
uint32_t GetSize ()
 
bool IsDuplicate (Ipv4Address addr, uint32_t id)
 Check that entry (addr, id) exists in cache.
 
void Purge ()
 Remove all expired entries.
 
void SetLifetime (Time lifetime)
 Set lifetime for future added entries.
 

Private Attributes

std::vector< UniqueIdm_idCache
 Already seen IDs.
 
Time m_lifetime
 Default lifetime for ID records.
 

Detailed Description

Unique packets identification cache used for simple duplicate detection.

Definition at line 34 of file aodv-id-cache.h.

Constructor & Destructor Documentation

◆ IdCache()

ns3::aodv::IdCache::IdCache ( Time lifetime)
inline

constructor

Parameters
lifetimethe lifetime for added entries

Definition at line 41 of file aodv-id-cache.h.

Member Function Documentation

◆ GetLifeTime()

Time ns3::aodv::IdCache::GetLifeTime ( ) const
inline

Return lifetime for existing entries in cache.

Returns
the lifetime

Definition at line 73 of file aodv-id-cache.h.

References m_lifetime.

Referenced by ns3::aodv::IdCacheTest::DoRun(), and ns3::aodv::DuplicatePacketDetection::GetLifetime().

+ Here is the caller graph for this function:

◆ GetSize()

uint32_t ns3::aodv::IdCache::GetSize ( )
Returns
number of entries in cache

Definition at line 47 of file aodv-id-cache.cc.

References m_idCache, and Purge().

Referenced by ns3::aodv::IdCacheTest::CheckTimeout1(), ns3::aodv::IdCacheTest::CheckTimeout2(), ns3::aodv::IdCacheTest::CheckTimeout3(), and ns3::aodv::IdCacheTest::DoRun().

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

◆ IsDuplicate()

bool ns3::aodv::IdCache::IsDuplicate ( Ipv4Address addr,
uint32_t id )

Check that entry (addr, id) exists in cache.

Add entry, if it doesn't exist.

Parameters
addrthe IP address
idthe cache entry ID
Returns
true if the pair exists

Definition at line 25 of file aodv-id-cache.cc.

References m_idCache, m_lifetime, ns3::Simulator::Now(), and Purge().

Referenced by ns3::aodv::IdCacheTest::DoRun(), ns3::aodv::DuplicatePacketDetection::IsDuplicate(), ns3::aodv::RoutingProtocol::RecvRequest(), and ns3::aodv::RoutingProtocol::SendRequest().

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

◆ Purge()

void ns3::aodv::IdCache::Purge ( )

Remove all expired entries.

Definition at line 41 of file aodv-id-cache.cc.

References m_idCache.

Referenced by GetSize(), and IsDuplicate().

+ Here is the caller graph for this function:

◆ SetLifetime()

void ns3::aodv::IdCache::SetLifetime ( Time lifetime)
inline

Set lifetime for future added entries.

Parameters
lifetimethe lifetime for entries

Definition at line 64 of file aodv-id-cache.h.

References m_lifetime.

Referenced by ns3::aodv::IdCacheTest::DoRun(), and ns3::aodv::DuplicatePacketDetection::SetLifetime().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_idCache

std::vector<UniqueId> ns3::aodv::IdCache::m_idCache
private

Already seen IDs.

Definition at line 108 of file aodv-id-cache.h.

Referenced by GetSize(), IsDuplicate(), and Purge().

◆ m_lifetime

Time ns3::aodv::IdCache::m_lifetime
private

Default lifetime for ID records.

Definition at line 110 of file aodv-id-cache.h.

Referenced by GetLifeTime(), IsDuplicate(), and SetLifetime().


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