IBR-DTNSuite
0.12
|
#include <ApiServer.h>
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 ®) |
void | raiseEvent (const dtn::core::Event *evt) throw () |
Registration & | getRegistration (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 () |
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 |
Definition at line 42 of file ApiServer.h.
dtn::api::ApiServer::ApiServer | ( | const ibrcommon::File & | socket) |
Definition at line 47 of file ApiServer.cpp.
References ibrcommon::vsocket::add().
dtn::api::ApiServer::ApiServer | ( | const ibrcommon::vinterface & | net, |
int | port = 4550 |
||
) |
Definition at line 53 of file ApiServer.cpp.
References ibrcommon::vsocket::add(), ibrcommon::vaddress::family(), ibrcommon::vinterface::getAddresses(), ibrcommon::basesocket::hasSupport(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, ibrcommon::vinterface::isAny(), ibrcommon::vinterface::isLoopback(), ibrcommon::vaddress::setService(), ibrcommon::vaddress::VADDR_ANY, ibrcommon::vaddress::VADDR_LOCALHOST, ibrcommon::LogLevel::warning, and ibrcommon::Exception::what().
|
virtual |
Definition at line 98 of file ApiServer.cpp.
References ibrcommon::vsocket::destroy(), ibrcommon::JoinableThread::join(), and ibrcommon::JoinableThread::stop().
|
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().
|
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().
|
protectedvirtual |
This is the run method. The component should loop in there until componentDown() or __cancellation() is called.
Implements dtn::daemon::IndependentComponent.
Definition at line 127 of file ApiServer.cpp.
References ibrcommon::serversocket::accept(), ibrcommon::socketstream::close(), dtn::api::Registration::getHandle(), dtn::daemon::Configuration::getInstance(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, ibrcommon::clientsocket::NO_DELAY, ibrcommon::vsocket::select(), ibrcommon::clientsocket::set(), ibrcommon::DetachedThread::start(), dtn::daemon::Configuration::version(), and ibrcommon::Thread::yield().
|
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, ibrcommon::vsocket::up(), and ibrcommon::Exception::what().
|
protectedvirtual |
Implements dtn::api::ApiServerInterface.
Definition at line 311 of file ApiServer.cpp.
References IBRCOMMON_LOGGER_DEBUG_TAG, and IBRCOMMON_LOGGER_ENDL.
|
protectedvirtual |
Implements dtn::api::ApiServerInterface.
Definition at line 305 of file ApiServer.cpp.
References IBRCOMMON_LOGGER_DEBUG_TAG, and IBRCOMMON_LOGGER_ENDL.
|
virtual |
Implements dtn::api::ApiServerInterface.
Definition at line 329 of file ApiServer.cpp.
References dtn::api::Registration::detach(), dtn::api::Registration::getHandle(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, and dtn::api::Registration::isPersistent().
|
virtual |
Implements dtn::daemon::Component.
Definition at line 300 of file ApiServer.cpp.
|
virtual |
retrieve a registration for a given handle from the ApiServers registration list the registration is automatically set into the attached state
handle | the handle of the registration to return |
Registration::AlreadyAttachedException | the registration is already attached to a different client |
Registration::NotFoundException | no registration was found for the given handle |
Implements dtn::api::ApiServerInterface.
Definition at line 246 of file ApiServer.cpp.
References dtn::api::Registration::attach(), and dtn::api::Registration::isPersistent().
|
virtual |
Implements dtn::core::EventReceiver.
Definition at line 355 of file ApiServer.cpp.
References dtn::routing::QueueBundleEvent::bundle, dtn::data::MetaBundle::destination, dtn::api::ClientHandler::getRegistration(), dtn::api::Registration::hasSubscribed(), dtn::data::MetaBundle::isFragment(), dtn::api::Registration::notify(), and dtn::api::Registration::NOTIFY_BUNDLE_AVAILABLE.
|
virtual |
Removes expired registrations.
ibrcommon::Timer::StopTimerException | thrown, if the GarbageCollector should be stopped |
Implements ibrcommon::TimerCallback.
Definition at line 266 of file ApiServer.cpp.
References dtn::api::Registration::attach(), dtn::api::Registration::detach(), dtn::api::Registration::getHandle(), IBRCOMMON_LOGGER_DEBUG_TAG, IBRCOMMON_LOGGER_ENDL, and dtn::api::Registration::isPersistent().