IBR-DTN
1.0.0
|
#include <Registration.h>
Classes | |
class | AlreadyAttachedException |
class | NotFoundException |
class | NotPersistentException |
class | RegistrationException |
Public Types | |
enum | NOTIFY_CALL { NOTIFY_BUNDLE_AVAILABLE = 0, NOTIFY_NEIGHBOR_AVAILABLE = 1, NOTIFY_NEIGHBOR_UNAVAILABLE = 2, NOTIFY_SHUTDOWN = 3 } |
Public Member Functions | |
Registration () | |
Registration (const std::string &handle) | |
virtual | ~Registration () |
void | notify (const NOTIFY_CALL) |
NOTIFY_CALL | wait () |
void | wait_for_bundle (size_t timeout=0) |
void | subscribe (const dtn::data::EID &endpoint) |
void | unsubscribe (const dtn::data::EID &endpoint) |
bool | hasSubscribed (const dtn::data::EID &endpoint) |
const std::set< dtn::data::EID > | getSubscriptions () |
bool | operator== (const std::string &) const |
bool | operator== (const Registration &) const |
bool | operator< (const Registration &) const |
dtn::data::Bundle | receive () throw (dtn::storage::NoBundleFoundException) |
dtn::data::MetaBundle | receiveMetaBundle () throw (dtn::storage::NoBundleFoundException) |
void | delivered (const dtn::data::MetaBundle &m) const |
const dtn::data::EID & | getDefaultEID () const |
const std::string & | getHandle () const |
void | abort () |
void | reset () |
void | setPersistent (ibrcommon::Timer::time_t lifetime) |
void | unsetPersistent () |
bool | isPersistent () |
bool | isPersistent () const |
void | setFilterFragments (bool val) |
ibrcommon::Timer::time_t | getExpireTime () const |
void | attach () |
void | detach () |
Static Public Member Functions | |
static void | processIncomingBundle (const dtn::data::EID &source, dtn::data::Bundle &bundle) |
Protected Member Functions | |
void | underflow () |
Definition at line 39 of file Registration.h.
Enumerator | |
---|---|
NOTIFY_BUNDLE_AVAILABLE | |
NOTIFY_NEIGHBOR_AVAILABLE | |
NOTIFY_NEIGHBOR_UNAVAILABLE | |
NOTIFY_SHUTDOWN |
Definition at line 44 of file Registration.h.
dtn::api::Registration::Registration | ( | ) |
constructor of the registration
Definition at line 102 of file Registration.cpp.
References dtn::data::EID::setApplication().
dtn::api::Registration::Registration | ( | const std::string & | handle | ) |
create a registration with a pre-defined handle (used to resume a session with an external manager)
Definition at line 94 of file Registration.cpp.
References dtn::data::EID::setApplication().
|
virtual |
destructor of the registration
Definition at line 110 of file Registration.cpp.
void dtn::api::Registration::abort | ( | ) |
abort all blocking operations on this registration
Definition at line 417 of file Registration.cpp.
Referenced by dtn::api::NativeSession::destroy(), dtn::api::OrderedStreamHandler::finally(), dtn::api::BinaryStreamClient::finally(), dtn::api::ExtendedApiHandler::finally(), dtn::api::ClientHandler::finally(), dtn::api::ExtendedApiHandler::run(), dtn::api::ClientHandler::switchRegistration(), dtn::api::BinaryStreamClient::~BinaryStreamClient(), and dtn::api::ExtendedApiHandler::~ExtendedApiHandler().
void dtn::api::Registration::attach | ( | ) |
attaches a client to this registration
AlreadyAttachedException | a client is already attached |
Definition at line 480 of file Registration.cpp.
Referenced by dtn::api::ApiServer::getRegistration(), and dtn::api::ApiServer::timeout().
void dtn::api::Registration::delivered | ( | const dtn::data::MetaBundle & | m | ) | const |
notify a bundle as delivered (and delete it if singleton destination)
id |
Definition at line 163 of file Registration.cpp.
References dtn::core::BUNDLE_DELIVERED, dtn::data::PrimaryBlock::DESTINATION_IS_SINGLETON, dtn::data::MetaBundle::get(), dtn::core::BundlePurgeEvent::raise(), and dtn::core::BundleEvent::raise().
Referenced by dtn::api::OrderedStreamHandler::delivered(), dtn::api::BinaryStreamClient::eventBundleForwarded(), dtn::api::NativeSession::receive(), and dtn::api::ExtendedApiHandler::run().
void dtn::api::Registration::detach | ( | ) |
detaches a client from this registration
Definition at line 488 of file Registration.cpp.
Referenced by dtn::api::ApiServer::freeRegistration(), and dtn::api::ApiServer::timeout().
const dtn::data::EID & dtn::api::Registration::getDefaultEID | ( | ) | const |
returns a default EID based on the registration handle
Definition at line 426 of file Registration.cpp.
Referenced by dtn::api::BinaryStreamClient::eventConnectionUp(), dtn::api::NativeSession::NativeSession(), dtn::api::OrderedStreamHandler::OrderedStreamHandler(), dtn::api::OrderedStreamHandler::put(), dtn::api::NativeSession::resetEndpoint(), and dtn::api::ExtendedApiHandler::run().
ibrcommon::Timer::time_t dtn::api::Registration::getExpireTime | ( | ) | const |
gets the expire time of this registration if it is persistent
NotPersistentException | the registration is not persistent |
Definition at line 472 of file Registration.cpp.
References isPersistent().
const std::string & dtn::api::Registration::getHandle | ( | ) | const |
returns the handle of this registration
Definition at line 431 of file Registration.cpp.
Referenced by dtn::api::ApiServer::componentRun(), dtn::api::BinaryStreamClient::eventConnectionUp(), dtn::api::ApiServer::freeRegistration(), dtn::api::NativeSession::getHandle(), dtn::api::ExtendedApiHandler::run(), and dtn::api::ApiServer::timeout().
const std::set< dtn::data::EID > dtn::api::Registration::getSubscriptions | ( | ) |
Definition at line 157 of file Registration.cpp.
Referenced by dtn::api::NativeSession::clearRegistration(), dtn::api::NativeSession::getSubscriptions(), and dtn::api::ExtendedApiHandler::run().
bool dtn::api::Registration::hasSubscribed | ( | const dtn::data::EID & | endpoint | ) |
check if this registration has subscribed to a specific endpoint
endpoint |
Definition at line 151 of file Registration.cpp.
Referenced by dtn::api::ApiServer::raiseEvent().
bool dtn::api::Registration::isPersistent | ( | ) |
returns the persistent state of this registration and also sets the persistent state to false, if the timer is expired
Definition at line 447 of file Registration.cpp.
Referenced by dtn::api::ApiServer::freeRegistration(), getExpireTime(), dtn::api::ApiServer::getRegistration(), and dtn::api::ApiServer::timeout().
bool dtn::api::Registration::isPersistent | ( | ) | const |
returns the persistent state of this registration
Definition at line 457 of file Registration.cpp.
void dtn::api::Registration::notify | ( | const NOTIFY_CALL | call | ) |
notify the corresponding client about something happen
Definition at line 115 of file Registration.cpp.
References NOTIFY_BUNDLE_AVAILABLE.
Referenced by dtn::api::ApiServer::raiseEvent(), and subscribe().
bool dtn::api::Registration::operator< | ( | const Registration & | other | ) | const |
compares and order a registration (using the handle)
Definition at line 412 of file Registration.cpp.
bool dtn::api::Registration::operator== | ( | const std::string & | other | ) | const |
compares the local handle with the given one
Definition at line 396 of file Registration.cpp.
bool dtn::api::Registration::operator== | ( | const Registration & | other | ) | const |
compares another registration with this one
Definition at line 404 of file Registration.cpp.
|
static |
Definition at line 501 of file Registration.cpp.
References dtn::data::PrimaryBlock::custodian, dtn::data::PrimaryBlock::destination, dtn::data::Bundle::find(), dtn::core::BundleCore::inject(), dtn::data::Bundle::push_front(), dtn::data::PrimaryBlock::relabel(), dtn::data::PrimaryBlock::reportto, dtn::data::BundleID::source, and dtn::data::BundleID::timestamp.
Referenced by dtn::api::BinaryStreamClient::run(), dtn::api::ExtendedApiHandler::run(), and dtn::api::NativeSession::send().
dtn::data::Bundle dtn::api::Registration::receive | ( | ) | ||
throw | ( | dtn::storage::NoBundleFoundException | ||
) |
Receive a bundle from the queue. If the queue is empty, it will query the storage for more bundles (up to 10). If no bundle is found and the queue is empty an exception is thrown.
Definition at line 174 of file Registration.cpp.
References dtn::storage::BundleStorage::get(), dtn::core::BundleCore::getInstance(), dtn::core::BundleCore::getStorage(), and receiveMetaBundle().
dtn::data::MetaBundle dtn::api::Registration::receiveMetaBundle | ( | ) | ||
throw | ( | dtn::storage::NoBundleFoundException | ||
) |
Definition at line 186 of file Registration.cpp.
References underflow().
Referenced by dtn::api::OrderedStreamHandler::get(), receive(), and dtn::api::NativeSession::receive().
void dtn::api::Registration::reset | ( | ) |
resets the underlying queues (if you want to continue using the registration after an abort call
void dtn::api::Registration::setFilterFragments | ( | bool | val | ) |
Allows to disable the re-assemble of fragments
Definition at line 467 of file Registration.cpp.
void dtn::api::Registration::setPersistent | ( | ibrcommon::Timer::time_t | lifetime | ) |
make this registration persistent
lifetime | the lifetime of the registration in seconds |
Definition at line 436 of file Registration.cpp.
Referenced by dtn::api::ExtendedApiHandler::run().
void dtn::api::Registration::subscribe | ( | const dtn::data::EID & | endpoint | ) |
subscribe to a end-point
Definition at line 374 of file Registration.cpp.
References notify(), and NOTIFY_BUNDLE_AVAILABLE.
Referenced by dtn::api::BinaryStreamClient::eventConnectionUp(), dtn::api::ExtendedApiHandler::ExtendedApiHandler(), dtn::api::NativeSession::resetEndpoint(), dtn::api::OrderedStreamHandler::run(), and dtn::api::ExtendedApiHandler::run().
|
protected |
search for bundles in the storage
Definition at line 212 of file Registration.cpp.
References dtn::data::MetaBundle::destination, dtn::daemon::Configuration::Network::doFragmentation(), dtn::storage::BundleSeeker::get(), dtn::core::BundleCore::getInstance(), dtn::daemon::Configuration::getInstance(), dtn::daemon::Configuration::getNetwork(), dtn::core::BundleCore::getSeeker(), dtn::utils::Clock::getTime(), dtn::data::MetaBundle::isFragment(), dtn::core::BundleCore::max_bundles_in_transit, dtn::data::BundleID::source, and dtn::data::BundleID::toString().
Referenced by receiveMetaBundle().
void dtn::api::Registration::unsetPersistent | ( | ) |
remove the persistent flag of this registration
Definition at line 442 of file Registration.cpp.
void dtn::api::Registration::unsubscribe | ( | const dtn::data::EID & | endpoint | ) |
unsubscribe to a end-point
Definition at line 387 of file Registration.cpp.
Referenced by dtn::api::NativeSession::clearRegistration(), dtn::api::BinaryStreamClient::eventConnectionDown(), dtn::api::NativeSession::resetEndpoint(), dtn::api::OrderedStreamHandler::run(), and dtn::api::ExtendedApiHandler::run().
Registration::NOTIFY_CALL dtn::api::Registration::wait | ( | ) |
void dtn::api::Registration::wait_for_bundle | ( | size_t | timeout = 0 | ) |
wait for available bundle
Definition at line 129 of file Registration.cpp.
Referenced by dtn::api::OrderedStreamHandler::get(), and dtn::api::NativeSession::receive().