#include <BundleCore.h>
Public Member Functions | |
virtual | ~BundleCore () |
Destructor. | |
virtual bool | is_route (const std::string &dest_id, const std::string &route) const =0 |
Answers whether dest_id matches route. | |
virtual bool | should_fwd (const Bundle *bundle, const Link *link) const =0 |
Query the Bundle core for route status. | |
virtual std::string | get_route (const std::string &dest_id) const =0 |
Given a Bundle's destination, return the route. | |
virtual std::string | get_route_pattern (const std::string &dest_id) const =0 |
Given a Bundle's destination, return the route pattern. | |
virtual u_int64_t | max_bundle_quota () const =0 |
Callback method for Prophet to query storage_quota(). | |
virtual bool | custody_accepted () const =0 |
Callback method for Prophet to query whether Bundle host is willing to accept custody transfers. | |
virtual const BundleList & | bundles () const =0 |
Enumerate Bundles in host's store. | |
virtual void | drop_bundle (const Bundle *bundle)=0 |
Callback method for Prophet to request for a bundle to be deleted; required by Repository's evict() routine. | |
virtual bool | send_bundle (const Bundle *bundle, const Link *link)=0 |
Given a Bundle and a candidate Link, attempt to send a Bundle. | |
virtual bool | write_bundle (const Bundle *bundle, const u_char *buf, size_t len)=0 |
Transfer buffer into Bundle's payload. | |
virtual bool | read_bundle (const Bundle *bundle, u_char *buffer, size_t &len) const =0 |
Request a Bundle's payload from Bundle host. | |
virtual Bundle * | create_bundle (const std::string &src, const std::string &dst, u_int exp)=0 |
Factory method to request new Bundle from bundle host. | |
virtual const Bundle * | find (const BundleList &list, const std::string &eid, u_int32_t creation_ts, u_int32_t seqno) const =0 |
Given a BundleList, a route, a creation ts, and a sequence number, find the Bundle. | |
virtual void | update_node (const Node *node)=0 |
Update (or create) a persistent Node to reflect handle's info. | |
virtual void | delete_node (const Node *node)=0 |
Remove this Node from persistent storage. | |
virtual std::string | local_eid () const =0 |
Query the local endpoint ID. | |
virtual std::string | prophet_id (const Link *link) const =0 |
Query for the endpoint ID to the Prophet node on the remote end of this link. | |
virtual std::string | prophet_id () const =0 |
Query for the endpoint ID to the local Prophet instance. | |
virtual Alarm * | create_alarm (ExpirationHandler *handler, u_int timeout, bool jitter=false)=0 |
Factory method to allocate memory for and return pointer to new Alarm object that will invoke handler->handle_timeout() after timeout milliseconds. | |
virtual void | print_log (const char *name, int level, const char *fmt,...)=0 |
Defer implementation of logging to host system . | |
Static Public Attributes | |
static const int | LOG_DEBUG = 1 |
Log level. | |
static const int | LOG_INFO = 2 |
Log level. | |
static const int | LOG_NOTICE = 3 |
Log level. | |
static const int | LOG_WARN = 4 |
Log level. | |
static const int | LOG_ERR = 5 |
Log level. | |
static const int | LOG_CRIT = 6 |
Log level. | |
static const int | LOG_ALWAYS = 7 |
Log level. |
Prophet requires Bundle handling (create, read, write, send, find), routing functions, preferences and parameters, persistent storage, timers and timeout handling, and debug logging. BundleCore decouples the Prophet facade library from its host implementation by abstracting away the specifics of implmentation for these core functions.
Definition at line 48 of file BundleCore.h.
virtual prophet::BundleCore::~BundleCore | ( | ) | [inline, virtual] |
virtual const BundleList& prophet::BundleCore::bundles | ( | ) | const [pure virtual] |
Enumerate Bundles in host's store.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual Alarm* prophet::BundleCore::create_alarm | ( | ExpirationHandler * | handler, | |
u_int | timeout, | |||
bool | jitter = false | |||
) | [pure virtual] |
Factory method to allocate memory for and return pointer to new Alarm object that will invoke handler->handle_timeout() after timeout milliseconds.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual Bundle* prophet::BundleCore::create_bundle | ( | const std::string & | src, | |
const std::string & | dst, | |||
u_int | exp | |||
) | [pure virtual] |
Factory method to request new Bundle from bundle host.
src | Route of bundle originator | |
dst | Route of bundle destination | |
exp | Lifespan in seconds |
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual bool prophet::BundleCore::custody_accepted | ( | ) | const [pure virtual] |
Callback method for Prophet to query whether Bundle host is willing to accept custody transfers.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual void prophet::BundleCore::delete_node | ( | const Node * | node | ) | [pure virtual] |
Remove this Node from persistent storage.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
Referenced by prophet::Table::remove().
virtual void prophet::BundleCore::drop_bundle | ( | const Bundle * | bundle | ) | [pure virtual] |
Callback method for Prophet to request for a bundle to be deleted; required by Repository's evict() routine.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual const Bundle* prophet::BundleCore::find | ( | const BundleList & | list, | |
const std::string & | eid, | |||
u_int32_t | creation_ts, | |||
u_int32_t | seqno | |||
) | const [pure virtual] |
Given a BundleList, a route, a creation ts, and a sequence number, find the Bundle.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual std::string prophet::BundleCore::get_route | ( | const std::string & | dest_id | ) | const [pure virtual] |
Given a Bundle's destination, return the route.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
Referenced by prophet::BundleOffer::get_bundle_offer(), prophet::AckList::insert(), and prophet::Table::p_value().
virtual std::string prophet::BundleCore::get_route_pattern | ( | const std::string & | dest_id | ) | const [pure virtual] |
Given a Bundle's destination, return the route pattern.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual bool prophet::BundleCore::is_route | ( | const std::string & | dest_id, | |
const std::string & | route | |||
) | const [pure virtual] |
Answers whether dest_id matches route.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual std::string prophet::BundleCore::local_eid | ( | ) | const [pure virtual] |
Query the local endpoint ID.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual u_int64_t prophet::BundleCore::max_bundle_quota | ( | ) | const [pure virtual] |
Callback method for Prophet to query storage_quota().
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual void prophet::BundleCore::print_log | ( | const char * | name, | |
int | level, | |||
const char * | fmt, | |||
... | ||||
) | [pure virtual] |
Defer implementation of logging to host system .
.. but still propagate messages up to host system from within prophet namespace
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
Referenced by prophet::Table::age_nodes(), prophet::Table::assign(), prophet::Dictionary::dump(), prophet::Table::enforce_quota(), prophet::Table::truncate(), prophet::Table::update(), prophet::Table::update_route(), and prophet::Table::update_transitive().
virtual std::string prophet::BundleCore::prophet_id | ( | ) | const [pure virtual] |
Query for the endpoint ID to the local Prophet instance.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual std::string prophet::BundleCore::prophet_id | ( | const Link * | link | ) | const [pure virtual] |
Query for the endpoint ID to the Prophet node on the remote end of this link.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual bool prophet::BundleCore::read_bundle | ( | const Bundle * | bundle, | |
u_char * | buffer, | |||
size_t & | len | |||
) | const [pure virtual] |
Request a Bundle's payload from Bundle host.
bundle | bundle metadata object | |
buffer | in/out memory into which to write Bundle payload | |
len | in/out size of inbound buffer, amount written into outbound buffer |
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual bool prophet::BundleCore::send_bundle | ( | const Bundle * | bundle, | |
const Link * | link | |||
) | [pure virtual] |
Given a Bundle and a candidate Link, attempt to send a Bundle.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual bool prophet::BundleCore::should_fwd | ( | const Bundle * | bundle, | |
const Link * | link | |||
) | const [pure virtual] |
Query the Bundle core for route status.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
virtual void prophet::BundleCore::update_node | ( | const Node * | node | ) | [pure virtual] |
Update (or create) a persistent Node to reflect handle's info.
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
Referenced by prophet::Table::age_nodes(), prophet::Table::update(), prophet::Table::update_route(), and prophet::Table::update_transitive().
virtual bool prophet::BundleCore::write_bundle | ( | const Bundle * | bundle, | |
const u_char * | buf, | |||
size_t | len | |||
) | [pure virtual] |
Transfer buffer into Bundle's payload.
bundle | bundle metadata object | |
buf | Buffer to write into payload |
Implemented in prophet::BundleCoreTestImpl, and dtn::ProphetBundleCore.
const int prophet::BundleCore::LOG_ALWAYS = 7 [static] |
const int prophet::BundleCore::LOG_CRIT = 6 [static] |
const int prophet::BundleCore::LOG_DEBUG = 1 [static] |
Log level.
Definition at line 181 of file BundleCore.h.
Referenced by prophet::Dictionary::dump(), and dtn::ProphetBundleCore::should_fwd().
const int prophet::BundleCore::LOG_ERR = 5 [static] |
const int prophet::BundleCore::LOG_INFO = 2 [static] |
Log level.
Definition at line 182 of file BundleCore.h.
Referenced by prophet::Table::age_nodes(), prophet::Table::assign(), prophet::Table::enforce_quota(), prophet::Table::truncate(), prophet::Table::update(), prophet::Table::update_route(), and prophet::Table::update_transitive().
const int prophet::BundleCore::LOG_NOTICE = 3 [static] |
const int prophet::BundleCore::LOG_WARN = 4 [static] |