|
IBR-DTNSuite 0.6
|
#include <Registration.h>

Public Types | |
| enum | NOTIFY_CALL { NOTIFY_BUNDLE_AVAILABLE = 0, NOTIFY_NEIGHBOR_AVAILABLE = 1, NOTIFY_NEIGHBOR_UNAVAILABLE = 2, NOTIFY_SHUTDOWN = 3 } |
Public Member Functions | |
| Registration () | |
| virtual | ~Registration () |
| void | notify (const NOTIFY_CALL) |
| NOTIFY_CALL | wait () |
| void | wait_for_bundle () |
| void | subscribe (const dtn::data::EID &endpoint) |
| void | unsubscribe (const dtn::data::EID &endpoint) |
| bool | hasSubscribed (const dtn::data::EID &endpoint) const |
| const std::set< dtn::data::EID > & | getSubscriptions () const |
| bool | operator== (const std::string &) const |
| bool | operator== (const Registration &) const |
| bool | operator< (const Registration &) const |
| dtn::data::Bundle | receive () throw (dtn::core::BundleStorage::NoBundleFoundException) |
| void | delivered (const dtn::data::MetaBundle &m) |
| const std::string & | getHandle () const |
| void | abort () |
Protected Member Functions | |
| void | underflow () |
Definition at line 22 of file Registration.h.
| NOTIFY_BUNDLE_AVAILABLE | |
| NOTIFY_NEIGHBOR_AVAILABLE | |
| NOTIFY_NEIGHBOR_UNAVAILABLE | |
| NOTIFY_SHUTDOWN |
Definition at line 25 of file Registration.h.
| dtn::api::Registration::Registration | ( | ) |
constructor of the registration
Definition at line 52 of file Registration.cpp.
| dtn::api::Registration::~Registration | ( | ) | [virtual] |
destructor of the registration
Definition at line 56 of file Registration.cpp.
| void dtn::api::Registration::abort | ( | ) |
abort all blocking operations on this registration
Definition at line 285 of file Registration.cpp.
References ibrcommon::Conditional::abort(), and ibrcommon::Queue< T >::abort().
Referenced by dtn::api::ClientHandler::finally().

| 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 100 of file Registration.cpp.
References dtn::core::BUNDLE_DELIVERED, dtn::data::PrimaryBlock::DESTINATION_IS_SINGLETON, dtn::data::MetaBundle::get(), dtn::core::BundleCore::getInstance(), dtn::core::BundleEvent::raise(), and dtn::core::BundleStorage::remove().
Referenced by dtn::api::BinaryStreamClient::eventBundleForwarded().

| const std::string & dtn::api::Registration::getHandle | ( | ) | const |
returns the handle of this registration
Definition at line 294 of file Registration.cpp.
Referenced by dtn::api::ApiServer::componentRun(), and dtn::api::ApiServer::freeRegistration().
| const std::set< dtn::data::EID > & dtn::api::Registration::getSubscriptions | ( | ) | const |
Definition at line 95 of file Registration.cpp.
| bool dtn::api::Registration::hasSubscribed | ( | const dtn::data::EID & | endpoint | ) | const |
check if this registration has subscribed to a specific endpoint
| endpoint |
Definition at line 90 of file Registration.cpp.
Referenced by dtn::api::ApiServer::raiseEvent().
| void dtn::api::Registration::notify | ( | const NOTIFY_CALL | call | ) |
notify the corresponding client about something happen
Definition at line 61 of file Registration.cpp.
References NOTIFY_BUNDLE_AVAILABLE, ibrcommon::Queue< T >::push(), and ibrcommon::Conditional::signal().
Referenced by dtn::api::ApiServer::raiseEvent().

| bool dtn::api::Registration::operator< | ( | const Registration & | other | ) | const |
compares and order a registration (using the handle)
Definition at line 280 of file Registration.cpp.
| bool dtn::api::Registration::operator== | ( | const Registration & | other | ) | const |
compares another registration with this one
Definition at line 272 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 264 of file Registration.cpp.
| dtn::data::Bundle dtn::api::Registration::receive | ( | ) | throw (dtn::core::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 115 of file Registration.cpp.
References dtn::core::BundleStorage::get(), dtn::core::BundleCore::getInstance(), ibrcommon::Queue< T >::getnpop(), ibrcommon::QueueUnblockedException::QUEUE_ABORT, ibrcommon::QueueUnblockedException::reason, and underflow().

| void dtn::api::Registration::subscribe | ( | const dtn::data::EID & | endpoint | ) |
subscribe to a end-point
Definition at line 251 of file Registration.cpp.
Referenced by dtn::api::BinaryStreamClient::eventConnectionUp().
| void dtn::api::Registration::underflow | ( | ) | [protected] |
search for bundles in the storage
Definition at line 142 of file Registration.cpp.
References dtn::data::BundleList::add(), dtn::data::MetaBundle::destination, dtn::data::BundleList::expire(), dtn::core::BundleStorage::get(), dtn::core::BundleCore::getInstance(), dtn::utils::Clock::getTime(), IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, ibrcommon::Queue< T >::push(), and dtn::data::BundleID::toString().
Referenced by receive().

| void dtn::api::Registration::unsubscribe | ( | const dtn::data::EID & | endpoint | ) |
unsubscribe to a end-point
Definition at line 256 of file Registration.cpp.
Referenced by dtn::api::BinaryStreamClient::eventConnectionDown().
| Registration::NOTIFY_CALL dtn::api::Registration::wait | ( | ) |
wait for the next notify event
Definition at line 85 of file Registration.cpp.
References ibrcommon::Queue< T >::getnpop().

| void dtn::api::Registration::wait_for_bundle | ( | ) |
wait for available bundle
Definition at line 75 of file Registration.cpp.
References ibrcommon::Conditional::wait().
