IBR-DTNSuite  0.10
dtn::api::ApiServer Class Reference

#include <ApiServer.h>

Inheritance diagram for dtn::api::ApiServer:
Inheritance graph
Collaboration diagram for dtn::api::ApiServer:
Collaboration graph

Public Member Functions

 ApiServer (const ibrcommon::File &socket)
 
 ApiServer (const ibrcommon::vinterface &net, int port=4550)
 
virtual ~ApiServer ()
 
virtual const std::string getName () const
 
void freeRegistration (Registration &reg)
 
void raiseEvent (const dtn::core::Event *evt) throw ()
 
RegistrationgetRegistration (const std::string &handle)
 
virtual size_t timeout (ibrcommon::Timer *)
 
- Public Member Functions inherited from dtn::daemon::IndependentComponent
 IndependentComponent ()
 
virtual ~IndependentComponent ()
 
virtual void initialize () throw ()
 
virtual void startup () throw ()
 
virtual void terminate () throw ()
 
- Public Member Functions inherited from dtn::daemon::Component
virtual ~Component ()=0
 
- Public Member Functions inherited from dtn::core::EventReceiver
virtual ~EventReceiver ()=0
 
- Public Member Functions inherited from dtn::api::ApiServerInterface
virtual ~ApiServerInterface ()
 
- Public Member Functions inherited from ibrcommon::TimerCallback
virtual ~TimerCallback ()
 

Static Public Attributes

static const std::string TAG = "ApiServer"
 

Protected Member Functions

void __cancellation () throw ()
 
virtual void connectionUp (ClientHandler *conn)
 
virtual void connectionDown (ClientHandler *conn)
 
void componentUp () throw ()
 
void componentRun () throw ()
 
void componentDown () throw ()
 
- Protected Member Functions inherited from dtn::daemon::IndependentComponent
void run () throw ()
 
- Protected Member Functions inherited from ibrcommon::JoinableThread
virtual ~JoinableThread ()=0
 
void join (void) throw (ThreadException)
 
bool isRunning (void)
 
void start (int priority=0) throw (ThreadException)
 
void stop () throw ()
 
 JoinableThread (size_t size=DEFAULT_STACKSIZE)
 

Additional Inherited Members

Detailed Description

Definition at line 42 of file ApiServer.h.

Constructor & Destructor Documentation

dtn::api::ApiServer::ApiServer ( const ibrcommon::File socket)

Definition at line 47 of file ApiServer.cpp.

References ibrcommon::vsocket::add().

Here is the call graph for this function:

dtn::api::ApiServer::~ApiServer ( )
virtual

Definition at line 98 of file ApiServer.cpp.

References ibrcommon::vsocket::destroy(), ibrcommon::JoinableThread::join(), and ibrcommon::JoinableThread::stop().

Here is the call graph for this function:

Member Function Documentation

void dtn::api::ApiServer::__cancellation ( ) throw ()
protectedvirtual

This method is called after componentDown() and should should guarantee that blocking calls in componentRun() will unblock.

Implements dtn::daemon::IndependentComponent.

Definition at line 107 of file ApiServer.cpp.

References ibrcommon::vsocket::down().

Here is the call graph for this function:

void dtn::api::ApiServer::componentDown ( ) throw ()
protectedvirtual

This method is called if the component should stop. Clean-up code should be inserted here.

Implements dtn::daemon::IndependentComponent.

Definition at line 218 of file ApiServer.cpp.

References ibrcommon::vsocket::down(), ibrcommon::Timer::pause(), dtn::core::EventDispatcher< E >::remove(), and ibrcommon::Thread::sleep().

Here is the call graph for this function:

void dtn::api::ApiServer::componentUp ( ) throw ()
protectedvirtual

Is called in preparation of the component. Before componentRun() is called.

Implements dtn::daemon::IndependentComponent.

Definition at line 113 of file ApiServer.cpp.

References dtn::core::EventDispatcher< E >::add(), ibrcommon::LogLevel::error, IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, TAG, ibrcommon::vsocket::up(), and ibrcommon::Exception::what().

Here is the call graph for this function:

void dtn::api::ApiServer::connectionDown ( ClientHandler conn)
protectedvirtual

Implements dtn::api::ApiServerInterface.

Definition at line 306 of file ApiServer.cpp.

References IBRCOMMON_LOGGER_DEBUG_TAG, and IBRCOMMON_LOGGER_ENDL.

void dtn::api::ApiServer::connectionUp ( ClientHandler conn)
protectedvirtual

Implements dtn::api::ApiServerInterface.

Definition at line 300 of file ApiServer.cpp.

References IBRCOMMON_LOGGER_DEBUG_TAG, and IBRCOMMON_LOGGER_ENDL.

void dtn::api::ApiServer::freeRegistration ( Registration reg)
virtual
const std::string dtn::api::ApiServer::getName ( ) const
virtual
See Also
Component::getName()

Implements dtn::daemon::Component.

Definition at line 295 of file ApiServer.cpp.

Registration & dtn::api::ApiServer::getRegistration ( const std::string &  handle)
virtual

retrieve a registration for a given handle from the ApiServers registration list the registration is automatically set into the attached state

Parameters
handlethe handle of the registration to return
Exceptions
Registration::AlreadyAttachedExceptionthe registration is already attached to a different client
Registration::NotFoundExceptionno registration was found for the given handle
Returns
the registration with the given handle

Implements dtn::api::ApiServerInterface.

Definition at line 246 of file ApiServer.cpp.

size_t dtn::api::ApiServer::timeout ( ibrcommon::Timer )
virtual

Removes expired registrations.

Exceptions
ibrcommon::Timer::StopTimerExceptionthrown, if the GarbageCollector should be stopped
See Also
ibrcommon::TimerCallback::timeout(Timer*)
Returns
the seconds till the GarbageCollector should be triggered next

Implements ibrcommon::TimerCallback.

Definition at line 264 of file ApiServer.cpp.

References IBRCOMMON_LOGGER_DEBUG_TAG, and IBRCOMMON_LOGGER_ENDL.

Member Data Documentation

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

Definition at line 45 of file ApiServer.h.

Referenced by ApiServer(), and componentUp().


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