IBR-DTN  1.0.0
dtn::api::Registration Class Reference

#include <Registration.h>

Collaboration diagram for dtn::api::Registration:
Collaboration graph

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

Detailed Description

Definition at line 39 of file Registration.h.

Member Enumeration Documentation

Enumerator
NOTIFY_BUNDLE_AVAILABLE 
NOTIFY_NEIGHBOR_AVAILABLE 
NOTIFY_NEIGHBOR_UNAVAILABLE 
NOTIFY_SHUTDOWN 

Definition at line 44 of file Registration.h.

Constructor & Destructor Documentation

dtn::api::Registration::Registration ( )

constructor of the registration

Definition at line 102 of file Registration.cpp.

References dtn::data::EID::setApplication().

Here is the call graph for this function:

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

Here is the call graph for this function:

dtn::api::Registration::~Registration ( )
virtual

destructor of the registration

Definition at line 110 of file Registration.cpp.

Member Function Documentation

void dtn::api::Registration::attach ( )

attaches a client to this registration

Exceptions
AlreadyAttachedExceptiona 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
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
ibrcommon::Timer::time_t dtn::api::Registration::getExpireTime ( ) const

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 472 of file Registration.cpp.

References isPersistent().

Here is the call graph for this function:

const std::string & dtn::api::Registration::getHandle ( ) const
const std::set< dtn::data::EID > dtn::api::Registration::getSubscriptions ( )
Returns
A list of active subscriptions.

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

Parameters
endpoint
Returns

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

Returns
the persistent state

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

Returns
the persistent state

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.

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.

Returns

Definition at line 174 of file Registration.cpp.

References dtn::storage::BundleStorage::get(), dtn::core::BundleCore::getInstance(), dtn::core::BundleCore::getStorage(), and receiveMetaBundle().

Here is the call graph for this function:

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

Here is the call graph for this function:

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

Parameters
lifetimethe 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)
void dtn::api::Registration::unsetPersistent ( )

remove the persistent flag of this registration

Definition at line 442 of file Registration.cpp.

Registration::NOTIFY_CALL dtn::api::Registration::wait ( )

wait for the next notify event

Returns

Definition at line 146 of file Registration.cpp.

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


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