IBR-DTNSuite  0.8
dtn::api::Registration Class Reference

#include <Registration.h>

List of all members.

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 ()
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::EIDgetSubscriptions ()
bool operator== (const std::string &) const
bool operator== (const Registration &) const
bool operator< (const Registration &) const
dtn::data::Bundle receive () throw (dtn::storage::BundleStorage::NoBundleFoundException)
dtn::data::MetaBundle receiveMetaBundle () throw (dtn::storage::BundleStorage::NoBundleFoundException)
void delivered (const dtn::data::MetaBundle &m)
const dtn::data::EIDgetDefaultEID () const
const std::string & getHandle () const
void abort ()
void reset ()
void setPersistent (ibrcommon::Timer::time_t lifetime)
void unsetPersistent ()
bool isPersistent ()
bool isPersistent () const
ibrcommon::Timer::time_t getExpireTime () const
void attach ()
void detach ()

Protected Member Functions

void underflow ()

Detailed Description

Definition at line 24 of file Registration.h.


Member Enumeration Documentation

Enumerator:
NOTIFY_BUNDLE_AVAILABLE 
NOTIFY_NEIGHBOR_AVAILABLE 
NOTIFY_NEIGHBOR_UNAVAILABLE 
NOTIFY_SHUTDOWN 

Definition at line 27 of file Registration.h.


Constructor & Destructor Documentation

constructor of the registration

Definition at line 73 of file Registration.cpp.

destructor of the registration

Definition at line 80 of file Registration.cpp.


Member Function Documentation

attaches a client to this registration

Exceptions:
AlreadyAttachedExceptiona client is already attached

Definition at line 415 of file Registration.cpp.

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

Here is the call graph for this function:

gets the expire time of this registration if it is persistent

See also:
ibrcommon::Timer::get_current_time()
Exceptions:
NotPersistentExceptionthe registration is not persistent
Returns:
the expire time according to ibrcommon::Timer::get_current_time()

Definition at line 407 of file Registration.cpp.

References isPersistent().

Here is the call graph for this function:

Returns:
A list of active subscriptions.

Definition at line 127 of file Registration.cpp.

Referenced by dtn::api::ExtendedApiHandler::run().

check if this registration has subscribed to a specific endpoint

Parameters:
endpoint
Returns:

Definition at line 121 of file Registration.cpp.

Referenced by dtn::api::ApiServer::raiseEvent().

returns the persistent state of this registration and also sets the persistent state to false, if the timer is expired

Returns:
the persistent state

Definition at line 387 of file Registration.cpp.

References ibrcommon::Timer::get_current_time().

Referenced by dtn::api::ApiServer::freeRegistration(), and getExpireTime().

Here is the call graph for this function:

returns the persistent state of this registration

Returns:
the persistent state

Definition at line 397 of file Registration.cpp.

References ibrcommon::Timer::get_current_time().

Here is the call graph for this function:

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

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

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

Here is the call graph for this function:

resets the underlying queues (if you want to continue using the registration after an abort call

make this registration persistent

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

Here is the call graph for this function:

remove the persistent flag of this registration

Definition at line 382 of file Registration.cpp.

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

Returns:

Definition at line 116 of file Registration.cpp.

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

Here is the call graph for this function:

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

Here is the call graph for this function:


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