dtn::BundleInfoCache Class Reference

#include <BundleInfoCache.h>

List of all members.


Detailed Description

Utility class for maintain a cache of recently received bundles, indexed by GbofId.

Used for routers to detect redundant BundleInfos and to avoid duplicate deliveries to registrations.

Definition at line 33 of file BundleInfoCache.h.


Public Member Functions

 BundleInfoCache (const std::string &logpath, size_t capacity)
 Constructor that takes the logpath and the number of entries to maintain in the cache.
bool add_entry (const Bundle *bundle, const EndpointID &prevhop)
 Try to add the bundle to the cache.
bool lookup (const Bundle *bundle, EndpointID *prevhop)
 Check if the given bundle is in the cache, returning the EID of the node from which it arrived (if known).
void evict_all ()
 Flush the cache.

Protected Types

typedef
oasys::CacheCapacityHelper
< GbofId, EndpointID
CacheCapacityHelper
typedef oasys::Cache< GbofId,
EndpointID,
CacheCapacityHelper
Cache

Protected Attributes

Cache cache_

Member Typedef Documentation

typedef oasys::CacheCapacityHelper<GbofId, EndpointID> dtn::BundleInfoCache::CacheCapacityHelper [protected]

Definition at line 59 of file BundleInfoCache.h.

Definition at line 60 of file BundleInfoCache.h.


Constructor & Destructor Documentation

dtn::BundleInfoCache::BundleInfoCache ( const std::string &  logpath,
size_t  capacity 
)

Constructor that takes the logpath and the number of entries to maintain in the cache.

Definition at line 26 of file BundleInfoCache.cc.


Member Function Documentation

bool dtn::BundleInfoCache::add_entry ( const Bundle bundle,
const EndpointID prevhop 
)

Try to add the bundle to the cache.

If it already exists in the cache, adding it again fails, and the method returns false.

Definition at line 34 of file BundleInfoCache.cc.

References cache_, dtn::Bundle::creation_ts(), dtn::Bundle::frag_offset(), dtn::Bundle::is_fragment(), dtn::BundlePayload::length(), dtn::Bundle::payload(), and dtn::Bundle::source().

Referenced by dtn::Registration::deliver_if_not_duplicate(), and dtn::TableBasedRouter::handle_bundle_received().

bool dtn::BundleInfoCache::lookup ( const Bundle bundle,
EndpointID prevhop 
)

Check if the given bundle is in the cache, returning the EID of the node from which it arrived (if known).

Definition at line 54 of file BundleInfoCache.cc.

References cache_, dtn::Bundle::creation_ts(), dtn::Bundle::frag_offset(), dtn::Bundle::is_fragment(), dtn::BundlePayload::length(), dtn::Bundle::payload(), and dtn::Bundle::source().

Referenced by dtn::TableBasedRouter::should_fwd().

void dtn::BundleInfoCache::evict_all (  ) 

Flush the cache.

Definition at line 67 of file BundleInfoCache.cc.

References cache_.

Referenced by dtn::TableBasedRouter::del_route(), and dtn::TableBasedRouter::handle_changed_routes().


Member Data Documentation

Definition at line 61 of file BundleInfoCache.h.

Referenced by add_entry(), evict_all(), and lookup().


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

Generated on Mon Jul 21 14:12:20 2008 for DTN Reference Implementation by  doxygen 1.5.6