#include <ProphetBundleCore.h>
Definition at line 44 of file ProphetBundleCore.h.
Public Member Functions | |
ProphetBundleCore (const std::string &local_eid, BundleActions *actions, oasys::SpinLock *lock) | |
Constructor. | |
ProphetBundleCore (oasys::Builder) | |
Test constructor. | |
virtual | ~ProphetBundleCore () |
Destructor. | |
bool | read_bundle (const prophet::Bundle *bundle, u_char *buffer, size_t &len) |
Implementation trick to get around const issues. | |
void | load_prophet_nodes (prophet::Table *nodes, prophet::ProphetParams *params) |
Initialization routine for deserializing routes from permanent storage. | |
void | load_dtn_bundles (const BundleList *list) |
Initialization routine for loading Bundle metadata into Prophet's facade. | |
void | shutdown () |
Callback for host system's shutdown routine. | |
prophet::Repository * | bundles () |
Prophet's queue policy implementation. | |
bool | is_route (const std::string &dest_id, const std::string &route) const |
Virtual from prophet::BundleCore. | |
bool | should_fwd (const prophet::Bundle *bundle, const prophet::Link *link) const |
Virtual from prophet::BundleCore. | |
std::string | get_route (const std::string &dest_id) const |
Virtual from prophet::BundleCore. | |
std::string | get_route_pattern (const std::string &dest_id) const |
Virtual from prophet::BundleCore. | |
u_int64_t | max_bundle_quota () const |
Virtual from prophet::BundleCore. | |
bool | custody_accepted () const |
Virtual from prophet::BundleCore. | |
void | drop_bundle (const prophet::Bundle *bundle) |
Virtual from prophet::BundleCore. | |
bool | send_bundle (const prophet::Bundle *bundle, const prophet::Link *link) |
Virtual from prophet::BundleCore. | |
bool | write_bundle (const prophet::Bundle *bundle, const u_char *buffer, size_t len) |
Virtual from prophet::BundleCore. | |
bool | read_bundle (const prophet::Bundle *bundle, u_char *buffer, size_t &len) const |
Virtual from prophet::BundleCore. | |
prophet::Bundle * | create_bundle (const std::string &src, const std::string &dst, u_int expiration) |
Virtual from prophet::BundleCore. | |
const prophet::BundleList & | bundles () const |
Virtual from prophet::BundleCore. | |
const prophet::Bundle * | find (const prophet::BundleList &list, const std::string &eid, u_int32_t creation_ts, u_int32_t seqno) const |
Virtual from prophet::BundleCore. | |
void | update_node (const prophet::Node *node) |
Virtual from prophet::BundleCore. | |
void | delete_node (const prophet::Node *node) |
Virtual from prophet::BundleCore. | |
std::string | local_eid () const |
Virtual from prophet::BundleCore. | |
std::string | prophet_id (const prophet::Link *link) const |
Virtual from prophet::BundleCore. | |
std::string | prophet_id () const |
Virtual from prophet::BundleCore. | |
prophet::Alarm * | create_alarm (prophet::ExpirationHandler *handler, u_int timeout, bool jitter=false) |
Virtual from prophet::BundleCore. | |
void | print_log (const char *name, int level, const char *fmt,...) |
Virtual from prophet::BundleCore. | |
const Bundle * | get_bundle (const prophet::Bundle *b) |
Conversion between Prophet's Facade type and DTN native type. | |
const prophet::Bundle * | get_bundle (const Bundle *b) |
Conversion between Prophet's Facade type and DTN native type. | |
const prophet::Bundle * | get_temp_bundle (const BundleRef &b) |
Conversion between Prophet's Facade type and DTN native type. | |
const Link * | get_link (const prophet::Link *link) |
Conversion between Prophet's Facade type and DTN native type. | |
const prophet::Link * | get_link (const Link *link) |
Conversion between Prophet's Facade type and DTN native type. | |
void | add (const BundleRef &b) |
void | del (const BundleRef &b) |
void | add (const LinkRef &link) |
void | del (const LinkRef &link) |
Protected Attributes | |
BundleActions *const | actions_ |
actions interface for send, delete, etc | |
ProphetBundleList | bundles_ |
objects that link DTN to Prophet bundles | |
ProphetLinkList | links_ |
objects that link DTN to Prophet links | |
ProphetNodeList | nodes_ |
interface into persistent storage | |
const std::string | local_eid_ |
route to local DTN instance | |
oasys::SpinLock *const | lock_ |
shared lock with ProphetRouter | |
bool | test_mode_ |
test constructor used, meaning that BundleDaemon is unavailable | |
Friends | |
class | ProphetRouter |
dtn::ProphetBundleCore::ProphetBundleCore | ( | const std::string & | local_eid, | |
BundleActions * | actions, | |||
oasys::SpinLock * | lock | |||
) |
dtn::ProphetBundleCore::ProphetBundleCore | ( | oasys::Builder | ) |
dtn::ProphetBundleCore::~ProphetBundleCore | ( | ) | [virtual] |
bool dtn::ProphetBundleCore::is_route | ( | const std::string & | dest_id, | |
const std::string & | route | |||
) | const [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 116 of file ProphetBundleCore.cc.
References get_route_pattern(), and dtn::EndpointIDPattern::match().
Referenced by find().
bool dtn::ProphetBundleCore::should_fwd | ( | const prophet::Bundle * | bundle, | |
const prophet::Link * | link | |||
) | const [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 81 of file ProphetBundleCore.cc.
References bundles_, dtn::ProphetLinkList::find_ref(), dtn::ProphetBundleList::find_ref(), links_, prophet::BundleCore::LOG_DEBUG, print_log(), dtn::BundleRouter::should_fwd(), and test_mode_.
std::string dtn::ProphetBundleCore::get_route | ( | const std::string & | dest_id | ) | const [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 134 of file ProphetBundleCore.cc.
References dtn::EndpointID::remove_service_tag(), and dtn::EndpointID::str().
Referenced by get_route_pattern(), and prophet_id().
std::string dtn::ProphetBundleCore::get_route_pattern | ( | const std::string & | dest_id | ) | const [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 124 of file ProphetBundleCore.cc.
References dtn::EndpointID::append_service_wildcard(), get_route(), and dtn::EndpointID::str().
Referenced by is_route().
u_int64_t dtn::ProphetBundleCore::max_bundle_quota | ( | ) | const [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 144 of file ProphetBundleCore.cc.
References test_mode_, and TEST_MODE_QUOTA.
bool dtn::ProphetBundleCore::custody_accepted | ( | ) | const [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 151 of file ProphetBundleCore.cc.
References dtn::BundleDaemon::params_, and test_mode_.
void dtn::ProphetBundleCore::drop_bundle | ( | const prophet::Bundle * | bundle | ) | [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 158 of file ProphetBundleCore.cc.
References actions_, bundles_, dtn::ProphetBundleList::del(), dtn::BundleActions::delete_bundle(), get_bundle(), dtn::LOG, dtn::BundleProtocol::REASON_NO_ADDTL_INFO, and prophet::Bundle::sequence_num().
bool dtn::ProphetBundleCore::send_bundle | ( | const prophet::Bundle * | bundle, | |
const prophet::Link * | link | |||
) | [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 194 of file ProphetBundleCore.cc.
References actions_, dtn::ForwardingInfo::COPY_ACTION, prophet::Bundle::destination_id(), get_bundle(), get_link(), dtn::LOG, dtn::BundleActions::open_link(), dtn::BundleActions::queue_bundle(), prophet::Link::remote_eid(), and prophet::Bundle::sequence_num().
bool dtn::ProphetBundleCore::write_bundle | ( | const prophet::Bundle * | bundle, | |
const u_char * | buffer, | |||
size_t | len | |||
) | [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 251 of file ProphetBundleCore.cc.
References get_bundle(), dtn::LOG, and prophet::Bundle::sequence_num().
bool dtn::ProphetBundleCore::read_bundle | ( | const prophet::Bundle * | bundle, | |
u_char * | buffer, | |||
size_t & | len | |||
) | const [inline, virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 82 of file ProphetBundleCore.h.
prophet::Bundle * dtn::ProphetBundleCore::create_bundle | ( | const std::string & | src, | |
const std::string & | dst, | |||
u_int | expiration | |||
) | [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 283 of file ProphetBundleCore.cc.
References dtn::EndpointID::assign(), get_bundle(), dtn::LOG, dtn::Bundle::mutable_custodian(), dtn::Bundle::mutable_dest(), dtn::Bundle::mutable_replyto(), dtn::Bundle::mutable_source(), dtn::EndpointID::NULL_EID(), and dtn::Bundle::set_expiration().
const prophet::BundleList& dtn::ProphetBundleCore::bundles | ( | ) | const [inline, virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 92 of file ProphetBundleCore.h.
References bundles_, and dtn::ProphetBundleList::get_bundles().
Referenced by dtn::ProphetRouter::get_routing_state(), and dtn::ProphetRouter::initialize().
const prophet::Bundle * dtn::ProphetBundleCore::find | ( | const prophet::BundleList & | list, | |
const std::string & | eid, | |||
u_int32_t | creation_ts, | |||
u_int32_t | seqno | |||
) | const [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 300 of file ProphetBundleCore.cc.
References is_route().
void dtn::ProphetBundleCore::update_node | ( | const prophet::Node * | node | ) | [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 350 of file ProphetBundleCore.cc.
References dtn::LOG, nodes_, and dtn::ProphetNodeList::update().
void dtn::ProphetBundleCore::delete_node | ( | const prophet::Node * | node | ) | [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 357 of file ProphetBundleCore.cc.
References dtn::ProphetNodeList::del(), dtn::LOG, and nodes_.
std::string dtn::ProphetBundleCore::local_eid | ( | ) | const [inline, virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 101 of file ProphetBundleCore.h.
References local_eid_.
Referenced by prophet_id().
std::string dtn::ProphetBundleCore::prophet_id | ( | const prophet::Link * | link | ) | const [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 364 of file ProphetBundleCore.cc.
References ASSERT, and prophet::Link::remote_eid().
std::string dtn::ProphetBundleCore::prophet_id | ( | ) | const [inline, virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 106 of file ProphetBundleCore.h.
References dtn::EndpointID::append_service_tag(), get_route(), local_eid(), and dtn::EndpointID::str().
prophet::Alarm * dtn::ProphetBundleCore::create_alarm | ( | prophet::ExpirationHandler * | handler, | |
u_int | timeout, | |||
bool | jitter = false | |||
) | [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 375 of file ProphetBundleCore.cc.
References lock_, dtn::LOG, prophet::ExpirationHandler::name(), and dtn::ProphetTimer::schedule().
void dtn::ProphetBundleCore::print_log | ( | const char * | name, | |
int | level, | |||
const char * | fmt, | |||
... | ||||
) | [virtual] |
Virtual from prophet::BundleCore.
Implements prophet::BundleCore.
Definition at line 396 of file ProphetBundleCore.cc.
Referenced by should_fwd().
bool dtn::ProphetBundleCore::read_bundle | ( | const prophet::Bundle * | bundle, | |
u_char * | buffer, | |||
size_t & | len | |||
) |
Implementation trick to get around const issues.
Definition at line 265 of file ProphetBundleCore.cc.
References get_bundle(), dtn::LOG, and prophet::Bundle::sequence_num().
void dtn::ProphetBundleCore::load_prophet_nodes | ( | prophet::Table * | nodes, | |
prophet::ProphetParams * | params | |||
) |
Initialization routine for deserializing routes from permanent storage.
Definition at line 314 of file ProphetBundleCore.cc.
References prophet::Table::age_nodes(), dtn::ProphetNodeList::clone(), dtn::ProphetNodeList::empty(), prophet::ProphetParams::epsilon(), dtn::ProphetStore::get(), dtn::ProphetNodeList::load(), dtn::ProphetStore::new_iterator(), nodes_, and prophet::Table::truncate().
Referenced by dtn::ProphetRouter::initialize().
void dtn::ProphetBundleCore::load_dtn_bundles | ( | const BundleList * | list | ) |
Initialization routine for loading Bundle metadata into Prophet's facade.
Definition at line 62 of file ProphetBundleCore.cc.
References ASSERT, dtn::BundleList::begin(), dtn::BundleList::end(), dtn::BundleList::lock(), dtn::LOG, and dtn::BundleList::size().
void dtn::ProphetBundleCore::shutdown | ( | ) | [inline] |
Callback for host system's shutdown routine.
Definition at line 141 of file ProphetBundleCore.h.
References bundles_, dtn::ProphetNodeList::clear(), dtn::ProphetLinkList::clear(), dtn::ProphetBundleList::clear(), links_, and nodes_.
Referenced by dtn::ProphetRouter::shutdown().
const Bundle * dtn::ProphetBundleCore::get_bundle | ( | const prophet::Bundle * | b | ) |
Conversion between Prophet's Facade type and DTN native type.
Definition at line 423 of file ProphetBundleCore.cc.
References bundles_, dtn::ProphetBundleList::find_ref(), and dtn::LOG.
Referenced by create_bundle(), drop_bundle(), dtn::ProphetRouter::handle_bundle_delivered(), dtn::ProphetRouter::handle_bundle_expired(), dtn::ProphetRouter::handle_bundle_transmitted(), read_bundle(), send_bundle(), and write_bundle().
const prophet::Bundle * dtn::ProphetBundleCore::get_bundle | ( | const Bundle * | b | ) |
Conversion between Prophet's Facade type and DTN native type.
Definition at line 433 of file ProphetBundleCore.cc.
References bundles_, dtn::ProphetBundleList::find(), and dtn::LOG.
const prophet::Bundle * dtn::ProphetBundleCore::get_temp_bundle | ( | const BundleRef & | b | ) |
Conversion between Prophet's Facade type and DTN native type.
Definition at line 441 of file ProphetBundleCore.cc.
References dtn::LOG.
Referenced by dtn::ProphetRouter::accept_bundle(), and dtn::ProphetRouter::handle_bundle_received().
const Link * dtn::ProphetBundleCore::get_link | ( | const prophet::Link * | link | ) |
Conversion between Prophet's Facade type and DTN native type.
Definition at line 449 of file ProphetBundleCore.cc.
References dtn::ProphetLinkList::find_ref(), links_, dtn::LOG, and prophet::Link::remote_eid().
Referenced by dtn::ProphetRouter::handle_bundle_received(), dtn::ProphetRouter::handle_bundle_transmitted(), dtn::ProphetRouter::handle_contact_down(), dtn::ProphetRouter::handle_contact_up(), and send_bundle().
const prophet::Link * dtn::ProphetBundleCore::get_link | ( | const Link * | link | ) |
Conversion between Prophet's Facade type and DTN native type.
Definition at line 459 of file ProphetBundleCore.cc.
References dtn::EndpointID::c_str(), dtn::ProphetLinkList::find(), links_, dtn::LOG, and dtn::Link::remote_eid().
void dtn::ProphetBundleCore::add | ( | const BundleRef & | b | ) |
Convenience method for insert/delete into Prophet's BundleCore facade
Definition at line 468 of file ProphetBundleCore.cc.
References dtn::ProphetBundleList::add(), bundles_, and dtn::LOG.
Referenced by dtn::ProphetRouter::handle_bundle_received(), and dtn::ProphetRouter::handle_contact_up().
void dtn::ProphetBundleCore::del | ( | const BundleRef & | b | ) |
Convenience method for insert/delete into Prophet's BundleCore facade
Definition at line 475 of file ProphetBundleCore.cc.
References bundles_, dtn::ProphetBundleList::del(), and dtn::LOG.
Referenced by dtn::ProphetRouter::handle_bundle_expired(), and dtn::ProphetRouter::handle_contact_down().
void dtn::ProphetBundleCore::add | ( | const LinkRef & | link | ) |
Convenience method for insert/delete into Prophet's BundleCore facade
Definition at line 482 of file ProphetBundleCore.cc.
References dtn::ProphetLinkList::add(), links_, and dtn::LOG.
void dtn::ProphetBundleCore::del | ( | const LinkRef & | link | ) |
Convenience method for insert/delete into Prophet's BundleCore facade
Definition at line 489 of file ProphetBundleCore.cc.
References dtn::ProphetLinkList::del(), links_, and dtn::LOG.
prophet::Repository* dtn::ProphetBundleCore::bundles | ( | ) | [inline] |
Prophet's queue policy implementation.
Definition at line 167 of file ProphetBundleCore.h.
References dtn::ProphetBundleList::bundles(), and bundles_.
friend class ProphetRouter [friend] |
Definition at line 170 of file ProphetBundleCore.h.
BundleActions* const dtn::ProphetBundleCore::actions_ [protected] |
actions interface for send, delete, etc
Definition at line 172 of file ProphetBundleCore.h.
Referenced by drop_bundle(), ProphetBundleCore(), and send_bundle().
ProphetBundleList dtn::ProphetBundleCore::bundles_ [protected] |
objects that link DTN to Prophet bundles
Definition at line 173 of file ProphetBundleCore.h.
Referenced by add(), bundles(), del(), drop_bundle(), get_bundle(), dtn::ProphetRouter::handle_bundle_received(), should_fwd(), and shutdown().
ProphetLinkList dtn::ProphetBundleCore::links_ [protected] |
objects that link DTN to Prophet links
Definition at line 174 of file ProphetBundleCore.h.
Referenced by add(), del(), get_link(), should_fwd(), and shutdown().
ProphetNodeList dtn::ProphetBundleCore::nodes_ [protected] |
interface into persistent storage
Definition at line 175 of file ProphetBundleCore.h.
Referenced by delete_node(), load_prophet_nodes(), shutdown(), and update_node().
const std::string dtn::ProphetBundleCore::local_eid_ [protected] |
route to local DTN instance
Definition at line 176 of file ProphetBundleCore.h.
Referenced by local_eid().
oasys::SpinLock* const dtn::ProphetBundleCore::lock_ [protected] |
shared lock with ProphetRouter
Definition at line 177 of file ProphetBundleCore.h.
Referenced by create_alarm().
bool dtn::ProphetBundleCore::test_mode_ [protected] |
test constructor used, meaning that BundleDaemon is unavailable
Definition at line 178 of file ProphetBundleCore.h.
Referenced by custody_accepted(), max_bundle_quota(), ProphetBundleCore(), and should_fwd().