IBR-DTNSuite
0.8
|
#include <Registration.h>
Definition at line 24 of file Registration.h.
NOTIFY_BUNDLE_AVAILABLE | |
NOTIFY_NEIGHBOR_AVAILABLE | |
NOTIFY_NEIGHBOR_UNAVAILABLE | |
NOTIFY_SHUTDOWN |
Definition at line 27 of file Registration.h.
constructor of the registration
Definition at line 73 of file Registration.cpp.
dtn::api::Registration::~Registration | ( | ) | [virtual] |
destructor of the registration
Definition at line 80 of file Registration.cpp.
void dtn::api::Registration::abort | ( | ) |
abort all blocking operations on this registration
Definition at line 357 of file Registration.cpp.
References ibrcommon::Conditional::abort(), and ibrcommon::Queue< T >::abort().
Referenced by dtn::api::OrderedStreamHandler::finally(), dtn::api::ExtendedApiHandler::finally(), dtn::api::BinaryStreamClient::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 415 of file Registration.cpp.
void dtn::api::Registration::delivered | ( | const dtn::data::MetaBundle & | m | ) |
notify a bundle as delivered (and delete it if singleton destination)
id |
Definition at line 133 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(), and dtn::api::ExtendedApiHandler::run().
void dtn::api::Registration::detach | ( | void | ) |
detaches a client from this registration
Definition at line 423 of file Registration.cpp.
References ibrcommon::Conditional::reset(), and ibrcommon::Queue< T >::reset().
Referenced by dtn::api::ApiServer::freeRegistration().
const dtn::data::EID & dtn::api::Registration::getDefaultEID | ( | ) | const |
returns a default EID based on the registration handle
Definition at line 366 of file Registration.cpp.
Referenced by dtn::api::BinaryStreamClient::eventConnectionUp(), dtn::api::OrderedStreamHandler::OrderedStreamHandler(), dtn::api::OrderedStreamHandler::put(), and dtn::api::ExtendedApiHandler::run().
gets the expire time of this registration if it is persistent
NotPersistentException | the registration is not persistent |
Definition at line 407 of file Registration.cpp.
References isPersistent().
const std::string & dtn::api::Registration::getHandle | ( | ) | const |
returns the handle of this registration
Definition at line 371 of file Registration.cpp.
Referenced by dtn::api::ApiServer::componentRun(), dtn::api::BinaryStreamClient::eventConnectionUp(), dtn::api::ApiServer::freeRegistration(), and dtn::api::ExtendedApiHandler::run().
const std::set< dtn::data::EID > dtn::api::Registration::getSubscriptions | ( | ) |
Definition at line 127 of file Registration.cpp.
Referenced by 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 121 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 387 of file Registration.cpp.
References ibrcommon::Timer::get_current_time().
Referenced by dtn::api::ApiServer::freeRegistration(), and getExpireTime().
bool dtn::api::Registration::isPersistent | ( | ) | const |
returns the persistent state of this registration
Definition at line 397 of file Registration.cpp.
References ibrcommon::Timer::get_current_time().
void dtn::api::Registration::notify | ( | const NOTIFY_CALL | call | ) |
notify the corresponding client about something happen
Definition at line 85 of file Registration.cpp.
References NOTIFY_BUNDLE_AVAILABLE, ibrcommon::Queue< T >::push(), and ibrcommon::Conditional::signal().
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 352 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 336 of file Registration.cpp.
bool dtn::api::Registration::operator== | ( | const Registration & | other | ) | const |
compares another registration with this one
Definition at line 344 of file Registration.cpp.
dtn::data::Bundle dtn::api::Registration::receive | ( | ) | throw (dtn::storage::BundleStorage::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 144 of file Registration.cpp.
References dtn::storage::BundleStorage::get(), dtn::core::BundleCore::getInstance(), ibrcommon::Queue< T >::getnpop(), dtn::core::BundleCore::getStorage(), ibrcommon::QueueUnblockedException::QUEUE_ABORT, ibrcommon::QueueUnblockedException::reason, and underflow().
dtn::data::MetaBundle dtn::api::Registration::receiveMetaBundle | ( | ) | throw (dtn::storage::BundleStorage::NoBundleFoundException) |
Definition at line 171 of file Registration.cpp.
References ibrcommon::Queue< T >::getnpop(), ibrcommon::QueueUnblockedException::QUEUE_ABORT, ibrcommon::QueueUnblockedException::reason, and underflow().
Referenced by dtn::api::OrderedStreamHandler::get().
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::setPersistent | ( | ibrcommon::Timer::time_t | lifetime | ) |
make this registration persistent
lifetime | the lifetime of the registration in seconds |
Definition at line 376 of file Registration.cpp.
References ibrcommon::Timer::get_current_time().
Referenced by dtn::api::ExtendedApiHandler::run().
void dtn::api::Registration::subscribe | ( | const dtn::data::EID & | endpoint | ) |
subscribe to a end-point
Definition at line 314 of file Registration.cpp.
References notify(), and NOTIFY_BUNDLE_AVAILABLE.
Referenced by dtn::api::BinaryStreamClient::eventConnectionUp(), dtn::api::ExtendedApiHandler::ExtendedApiHandler(), dtn::api::OrderedStreamHandler::run(), and dtn::api::ExtendedApiHandler::run().
void dtn::api::Registration::underflow | ( | ) | [protected] |
search for bundles in the storage
Definition at line 194 of file Registration.cpp.
References dtn::data::BundleList::add(), dtn::data::MetaBundle::destination, dtn::data::BundleList::expire(), dtn::storage::BundleStorage::get(), dtn::core::BundleCore::getInstance(), dtn::core::BundleCore::getStorage(), dtn::utils::Clock::getTime(), IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, ibrcommon::Queue< T >::push(), dtn::data::BundleID::source, and dtn::data::BundleID::toString().
Referenced by receive(), and receiveMetaBundle().
remove the persistent flag of this registration
Definition at line 382 of file Registration.cpp.
void dtn::api::Registration::unsubscribe | ( | const dtn::data::EID & | endpoint | ) |
unsubscribe to a end-point
Definition at line 327 of file Registration.cpp.
Referenced by dtn::api::BinaryStreamClient::eventConnectionDown(), and dtn::api::ExtendedApiHandler::run().
wait for the next notify event
Definition at line 116 of file Registration.cpp.
References ibrcommon::Queue< T >::getnpop().
void dtn::api::Registration::wait_for_bundle | ( | size_t | timeout = 0 | ) |
wait for available bundle
Definition at line 99 of file Registration.cpp.
References ibrcommon::Conditional::wait().
Referenced by dtn::api::OrderedStreamHandler::get().