IBR-DTNSuite  0.10
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 ()
 
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)
 

Static Public Attributes

static const std::string TAG = "Registration"
 

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.

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

destructor of the registration

Definition at line 109 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 479 of file Registration.cpp.

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 487 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:

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 471 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 156 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 150 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 446 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:

bool dtn::api::Registration::isPersistent ( ) const

returns the persistent state of this registration

Returns
the persistent state

Definition at line 456 of file Registration.cpp.

References ibrcommon::Timer::get_current_time().

Here is the call graph for this function:

void dtn::api::Registration::notify ( const NOTIFY_CALL  call)

notify the corresponding client about something happen

Definition at line 114 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 411 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 395 of file Registration.cpp.

bool dtn::api::Registration::operator== ( const Registration other) const

compares another registration with this one

Definition at line 403 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 173 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:

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

References ibrcommon::Timer::get_current_time().

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

Here is the call graph for this function:

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

void dtn::api::Registration::unsubscribe ( const dtn::data::EID endpoint)
Registration::NOTIFY_CALL dtn::api::Registration::wait ( )

wait for the next notify event

Returns

Definition at line 145 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 128 of file Registration.cpp.

References ibrcommon::Conditional::wait().

Referenced by dtn::api::OrderedStreamHandler::get(), and dtn::api::NativeSession::receive().

Here is the call graph for this function:

Member Data Documentation

const std::string dtn::api::Registration::TAG = "Registration"
static

Definition at line 42 of file Registration.h.

Referenced by processIncomingBundle(), receiveMetaBundle(), and underflow().


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