IBR-DTNSuite 0.6

dtn::api::Registration Class Reference

#include <Registration.h>

Collaboration diagram for dtn::api::Registration:

List of all members.

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 ()

Detailed Description

Definition at line 22 of file Registration.h.


Member Enumeration Documentation

Enumerator:
NOTIFY_BUNDLE_AVAILABLE 
NOTIFY_NEIGHBOR_AVAILABLE 
NOTIFY_NEIGHBOR_UNAVAILABLE 
NOTIFY_SHUTDOWN 

Definition at line 25 of file Registration.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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().

Here is the call graph for this function:

void dtn::api::Registration::delivered ( const dtn::data::MetaBundle m)

notify a bundle as delivered (and delete it if singleton destination)

Parameters:
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().

Here is the call graph for this function:

const std::string & dtn::api::Registration::getHandle ( ) const

returns the handle of this registration

Returns:

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
Returns:
A list of active subscriptions.

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

Parameters:
endpoint
Returns:

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().

Here is the call graph for this function:

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.

Returns:

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().

Here is the call graph for this function:

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]
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

Returns:

Definition at line 85 of file Registration.cpp.

References ibrcommon::Queue< T >::getnpop().

Here is the call graph for this function:

void dtn::api::Registration::wait_for_bundle ( )

wait for available bundle

Definition at line 75 of file Registration.cpp.

References ibrcommon::Conditional::wait().

Here is the call graph for this function:


The documentation for this class was generated from the following files: