#include <epidemic/EpidemicStore.h>


Public Types | ||||
| typedef std::set< EpidemicBundle > | BundleList | |||
| The internal storage type. | ||||
| typedef BundleList::key_type | key_type | |||
| Convenient shorter version of the index type. | ||||
| typedef BundleList::iterator | iterator | |||
| An iterator into the internal store. | ||||
| typedef BundleList::const_iterator | const_iterator | |||
| A const iterator into the internal store. | ||||
|
typedef std::map < DTN::ByteString, iterator > | DigestMap | |||
| The type for the store of transferrable bundles. | ||||
| typedef std::list< iterator > | DestList | |||
| The type for a list of bundles addressed to a single destination. | ||||
|
typedef std::map < DTN::ByteString, DestList > | DestMap | |||
| The type for the store of last-hop-only bundles. | ||||
| typedef std::set< DTN::ByteString > | HistorySet | |||
| The type for the store of all bundles seen. | ||||
|
typedef std::list < DTN::ByteString > | DigestList | |||
| A simple type for lists of digests. | ||||
Public Member Functions | ||||
| EpidemicStore (DTN::Node *owner, uint32_t h=0) | ||||
| Constructor. | ||||
| virtual | ~EpidemicStore () | |||
| Virtual destructor. | ||||
| virtual void | consume (DTN::Bundle *b) | |||
| Perform an action on a Bundle received by its destination. | ||||
| DTN::BundlePointer | getPointer (const DTN::ByteString &digest) | |||
| Find a DTN::BundlePointer for a DTN::Bundle with a particular digest. | ||||
| iterator | begin () | |||
| ||||
| iterator | lower_bound (const key_type &x) | |||
| ||||
| iterator | upper_bound (const key_type &x) | |||
| ||||
| iterator | end () | |||
| ||||
| const_iterator | begin () const | |||
| ||||
| const_iterator | lower_bound (const key_type &x) const | |||
| ||||
| const_iterator | upper_bound (const key_type &x) const | |||
| ||||
| const_iterator | end () const | |||
| ||||
| DTN::ByteString * | summaryVector () const | |||
| Construct the summary vector for this data store. | ||||
| void | set_max_hops (uint32_t h) | |||
| Set the maximum number of epidemic transfers permitted for a bundle. | ||||
| void | forwardLastHop (const DTN::ByteString &addr, DTN::Node &node) | |||
| Enqueue the last-hop-only bundles for a newly arrived neighbor. | ||||
| bool | seen (const DTN::ByteString &digest) | |||
| Check for a digest in the history list. | ||||
Static Public Member Functions | ||||
| static DTN::ByteString | digest (const DTN::Bundle &b) | |||
| Create an epidemic digest for a bundle. | ||||
| static DTN::ByteString | digest (const DTN::ByteString &originator, uint32_t seqNum) | |||
| Create an epidemic digest. | ||||
| static DigestList * | parseSummaryVector (const DTN::ByteString &sv) | |||
| Split a summary vector into a list of bundle digests. | ||||
Protected Member Functions | ||||
| virtual DTN::BundlePointer | p_addBundle (DTN::Bundle *b) | |||
| Add a DTN::Bundle to the store. | ||||
| virtual void | p_deleteBundle (DTN::Bundle *b) | |||
| Remove a DTN::Bundle from the store. | ||||
| virtual DTN::BundlePointer | p_getPointer (const DTN::BundlePointer &p) | |||
| Update a DTN::BundlePointer from the store. | ||||
| virtual DTN::BundlePointer | p_getPointer (const DTN::ByteString &sender, uint32_t seqNum) | |||
| Find a DTN::BundlePointer for a particular DTN::Bundle. | ||||
| virtual bool | p_validatePointer (const DTN::BundlePointer &p) | |||
| Test the validity of a DTN::BundlePointer. | ||||
| virtual size_t | p_bytesUsed () | |||
| The size of the data store. | ||||
| virtual size_t | p_bundles () | |||
| The number of bundles stored. | ||||
| virtual void | p_shrinkStore (size_t s) | |||
| Change the size of the data store. | ||||
Definition at line 90 of file EpidemicStore.h.
| EpidemicStore::EpidemicStore | ( | DTN::Node * | owner, | |
| uint32_t | h = 0 | |||
| ) |
Constructor.
| owner | The node at which this store resides | |
| h | The maximum number of times a bundle may be transferred |
Definition at line 96 of file EpidemicStore.cc.
| void EpidemicStore::consume | ( | DTN::Bundle * | b | ) | [virtual] |
Perform an action on a Bundle received by its destination.
This only really makes sense for persistent stores, and then only in select cases, so for most policy classes this no-op default will be sufficient.
| b | A pointer to a delivered Bundle |
Reimplemented from DTN::BundleStore.
Definition at line 195 of file EpidemicStore.cc.
References digest(), DTN::Bundle::kACK, DTN::Bundle::kCustodial, and DTN::Bundle::type().
| DTN::BundlePointer EpidemicStore::getPointer | ( | const DTN::ByteString & | digest | ) |
Find a DTN::BundlePointer for a DTN::Bundle with a particular digest.
| digest | The epidemic-forwarding digest of a bundle |
NULL DTN::BundlePointer if it isn't Definition at line 240 of file EpidemicStore.cc.
References DTN::PersistentBundleStore::clean().
Referenced by Epidemic::EpidemicApp::process().
| EpidemicStore::iterator EpidemicStore::lower_bound | ( | const key_type & | x | ) |
| x | An index into the store |
Definition at line 294 of file EpidemicStore.cc.
| EpidemicStore::iterator EpidemicStore::upper_bound | ( | const key_type & | x | ) |
| x | An index into the store |
Definition at line 300 of file EpidemicStore.cc.
Referenced by Epidemic::EpidemicStoreItr::next().
| EpidemicStore::const_iterator EpidemicStore::lower_bound | ( | const key_type & | x | ) | const |
| x | An index into the store |
Definition at line 318 of file EpidemicStore.cc.
| EpidemicStore::const_iterator EpidemicStore::upper_bound | ( | const key_type & | x | ) | const |
| x | An index into the store |
Definition at line 324 of file EpidemicStore.cc.
| DTN::ByteString * EpidemicStore::summaryVector | ( | ) | const |
Construct the summary vector for this data store.
Definition at line 336 of file EpidemicStore.cc.
References end().
Referenced by Epidemic::EpidemicApp::newNeighbor().
| DTN::ByteString EpidemicStore::digest | ( | const DTN::Bundle & | b | ) | [static] |
Create an epidemic digest for a bundle.
| b | The bundle to digest |
Definition at line 351 of file EpidemicStore.cc.
References DTN::Bundle::seqNum(), and DTN::Bundle::source().
Referenced by consume(), Epidemic::EpidemicBundle::EpidemicBundle(), p_addBundle(), and p_deleteBundle().
| DTN::ByteString EpidemicStore::digest | ( | const DTN::ByteString & | originator, | |
| uint32_t | seqNum | |||
| ) | [static] |
Create an epidemic digest.
| originator | The originator of a bundle | |
| seqNum | The bundle's sequence number |
Definition at line 357 of file EpidemicStore.cc.
| EpidemicStore::DigestList * EpidemicStore::parseSummaryVector | ( | const DTN::ByteString & | sv | ) | [static] |
Split a summary vector into a list of bundle digests.
| sv | A summary vector |
NULL on error Definition at line 374 of file EpidemicStore.cc.
Referenced by Epidemic::EpidemicApp::process().
| void Epidemic::EpidemicStore::set_max_hops | ( | uint32_t | h | ) | [inline] |
Set the maximum number of epidemic transfers permitted for a bundle.
| h | The maximum number of hops |
Definition at line 184 of file EpidemicStore.h.
| void EpidemicStore::forwardLastHop | ( | const DTN::ByteString & | addr, | |
| DTN::Node & | node | |||
| ) |
Enqueue the last-hop-only bundles for a newly arrived neighbor.
| addr | The neighbor's address | |
| node | The node to which this store is attached |
Definition at line 389 of file EpidemicStore.cc.
References end(), DTN::Node::forward(), and DTN::Bundle::recv().
Referenced by Epidemic::EpidemicApp::newNeighbor().
| bool EpidemicStore::seen | ( | const DTN::ByteString & | digest | ) |
Check for a digest in the history list.
| digest | A bundle digest |
Definition at line 409 of file EpidemicStore.cc.
Referenced by Epidemic::EpidemicApp::process().
| DTN::BundlePointer EpidemicStore::p_addBundle | ( | DTN::Bundle * | b | ) | [protected, virtual] |
Add a DTN::Bundle to the store.
| b | The bundle to add; ownership of the memory is taken by the store |
Implements DTN::PersistentBundleStore.
Definition at line 108 of file EpidemicStore.cc.
References DTN::Bundle::destination(), digest(), DTN::Bundle::hopCount(), and DTN::Bundle::size().
| void EpidemicStore::p_deleteBundle | ( | DTN::Bundle * | b | ) | [protected, virtual] |
Remove a DTN::Bundle from the store.
| b | The bundle to delete |
Implements DTN::PersistentBundleStore.
Definition at line 140 of file EpidemicStore.cc.
References DTN::Bundle::destination(), digest(), end(), and DTN::Bundle::size().
Referenced by p_shrinkStore().
| DTN::BundlePointer EpidemicStore::p_getPointer | ( | const DTN::BundlePointer & | p | ) | [protected, virtual] |
Update a DTN::BundlePointer from the store.
| p | A cached DTN::BundlePointer |
p.isNull(), a DTN::BundlePointer to the beginning of the store is returned. If there is no valid DTN::BundlePointer to return, a NULL pointer will be returned. Implements DTN::PersistentBundleStore.
Definition at line 209 of file EpidemicStore.cc.
References DTN::BundlePointer::isNull(), and DTN::BundlePointer::repr().
| DTN::BundlePointer EpidemicStore::p_getPointer | ( | const DTN::ByteString & | sender, | |
| uint32_t | seqNum | |||
| ) | [protected, virtual] |
Find a DTN::BundlePointer for a particular DTN::Bundle.
This uses the unique identifying information for a DTN::Bundle, rather than a pointer, so that we can match acknowledgements.
| sender | The originator of a DTN::Bundle | |
| seqNum | The originator's unique ID for a DTN::Bundle |
NULL DTN::BundlePointer if it isn't Implements DTN::PersistentBundleStore.
Definition at line 229 of file EpidemicStore.cc.
| bool EpidemicStore::p_validatePointer | ( | const DTN::BundlePointer & | p | ) | [protected, virtual] |
Test the validity of a DTN::BundlePointer.
| p | A cached DTN::BundlePointer |
| true | The referenced DTN::Bundle is in the store | |
| false | The referenced DTN::Bundle is not in the store |
Implements DTN::PersistentBundleStore.
Definition at line 252 of file EpidemicStore.cc.
References DTN::BundlePointer::isNull(), and DTN::BundlePointer::repr().
| virtual size_t Epidemic::EpidemicStore::p_bytesUsed | ( | ) | [inline, protected, virtual] |
The size of the data store.
Implements DTN::PersistentBundleStore.
Definition at line 240 of file EpidemicStore.h.
| virtual size_t Epidemic::EpidemicStore::p_bundles | ( | ) | [inline, protected, virtual] |
The number of bundles stored.
Implements DTN::PersistentBundleStore.
Definition at line 245 of file EpidemicStore.h.
| void EpidemicStore::p_shrinkStore | ( | size_t | s | ) | [protected, virtual] |
Change the size of the data store.
| s | The new size for the data store |
Implements DTN::PersistentBundleStore.
Definition at line 261 of file EpidemicStore.cc.
References end(), DTN::BundleStore::m_owner, and p_deleteBundle().
1.5.4