|
IBR-DTNSuite
0.8
|
#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) |
| void | processIncomingBundle (const dtn::data::EID &source, dtn::data::Bundle &bundle) |
| Registration & | getRegistration (const std::string &handle) |
| virtual size_t | timeout (ibrcommon::Timer *) |
Protected Member Functions | |
| void | __cancellation () |
| virtual void | connectionUp (ClientHandler *conn) |
| virtual void | connectionDown (ClientHandler *conn) |
| void | componentUp () |
| void | componentRun () |
| void | componentDown () |
Definition at line 27 of file ApiServer.h.
| dtn::api::ApiServer::ApiServer | ( | const ibrcommon::File & | socket | ) |
Definition at line 33 of file ApiServer.cpp.
| dtn::api::ApiServer::ApiServer | ( | const ibrcommon::vinterface & | net, |
| int | port = 4550 |
||
| ) |
Definition at line 38 of file ApiServer.cpp.
References ibrcommon::tcpserver::bind().

| dtn::api::ApiServer::~ApiServer | ( | ) | [virtual] |
Definition at line 44 of file ApiServer.cpp.
References ibrcommon::JoinableThread::join(), and ibrcommon::JoinableThread::stop().

| void dtn::api::ApiServer::__cancellation | ( | ) | [protected, virtual] |
Implements dtn::daemon::IndependentComponent.
Definition at line 51 of file ApiServer.cpp.
References ibrcommon::tcpserver::shutdown().

| void dtn::api::ApiServer::componentDown | ( | ) | [protected, virtual] |
Implements dtn::daemon::IndependentComponent.
Definition at line 111 of file ApiServer.cpp.
References dtn::routing::QueueBundleEvent::className, dtn::core::NodeEvent::className, ibrcommon::tcpserver::close(), ibrcommon::Timer::pause(), ibrcommon::Thread::sleep(), and dtn::core::EventReceiver::unbindEvent().

| void dtn::api::ApiServer::componentRun | ( | ) | [protected, virtual] |
Implements dtn::daemon::IndependentComponent.
Definition at line 64 of file ApiServer.cpp.
References ibrcommon::tcpserver::accept(), ibrcommon::tcpstream::close(), dtn::api::Registration::getHandle(), dtn::daemon::Configuration::getInstance(), IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, ibrcommon::DetachedThread::start(), dtn::daemon::Configuration::version(), and ibrcommon::Thread::yield().

| void dtn::api::ApiServer::componentUp | ( | ) | [protected, virtual] |
Implements dtn::daemon::IndependentComponent.
Definition at line 56 of file ApiServer.cpp.
References dtn::core::EventReceiver::bindEvent(), dtn::routing::QueueBundleEvent::className, dtn::core::NodeEvent::className, and ibrcommon::tcpserver::listen().

| void dtn::api::ApiServer::connectionDown | ( | ClientHandler * | conn | ) | [protected, virtual] |
Implements dtn::api::ApiServerInterface.
Definition at line 266 of file ApiServer.cpp.
References IBRCOMMON_LOGGER_DEBUG, and IBRCOMMON_LOGGER_ENDL.
| void dtn::api::ApiServer::connectionUp | ( | ClientHandler * | conn | ) | [protected, virtual] |
Implements dtn::api::ApiServerInterface.
Definition at line 260 of file ApiServer.cpp.
References IBRCOMMON_LOGGER_DEBUG, and IBRCOMMON_LOGGER_ENDL.
| void dtn::api::ApiServer::freeRegistration | ( | Registration & | reg | ) | [virtual] |
Implements dtn::api::ApiServerInterface.
Definition at line 284 of file ApiServer.cpp.
References dtn::api::Registration::detach(), dtn::api::Registration::getHandle(), IBRCOMMON_LOGGER_DEBUG, IBRCOMMON_LOGGER_ENDL, and dtn::api::Registration::isPersistent().

| const std::string dtn::api::ApiServer::getName | ( | ) | const [virtual] |
Implements dtn::daemon::Component.
Definition at line 255 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
| 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 206 of file ApiServer.cpp.
| void dtn::api::ApiServer::processIncomingBundle | ( | const dtn::data::EID & | source, |
| dtn::data::Bundle & | bundle | ||
| ) | [virtual] |
Implements dtn::api::ApiServerInterface.
Definition at line 136 of file ApiServer.cpp.
References dtn::data::PrimaryBlock::_custodian, dtn::data::PrimaryBlock::_destination, dtn::data::PrimaryBlock::_reportto, dtn::data::PrimaryBlock::_source, dtn::data::PrimaryBlock::_timestamp, dtn::data::CompressedPayloadBlock::compress(), dtn::data::CompressedPayloadBlock::COMPRESSION_ZLIB, dtn::data::PrimaryBlock::DTNSEC_REQUEST_ENCRYPT, dtn::data::PrimaryBlock::DTNSEC_REQUEST_SIGN, dtn::security::SecurityManager::encrypt(), dtn::data::PrimaryBlock::get(), dtn::data::Bundle::getBlock(), dtn::security::SecurityManager::getInstance(), IBRCOMMON_LOGGER, IBRCOMMON_LOGGER_ENDL, dtn::data::PrimaryBlock::IBRDTN_REQUEST_COMPRESSION, dtn::data::Bundle::push_front(), dtn::net::BundleReceivedEvent::raise(), dtn::data::PrimaryBlock::set(), dtn::security::SecurityManager::sign(), and ibrcommon::Exception::what().

| void dtn::api::ApiServer::raiseEvent | ( | const dtn::core::Event * | evt | ) | [virtual] |
Implements dtn::core::EventReceiver.
Definition at line 307 of file ApiServer.cpp.
References dtn::routing::QueueBundleEvent::bundle, dtn::data::MetaBundle::destination, dtn::api::ClientHandler::eventNodeAvailable(), dtn::api::ClientHandler::eventNodeUnavailable(), dtn::data::BundleID::fragment, dtn::core::NodeEvent::getAction(), dtn::core::NodeEvent::getNode(), dtn::api::ClientHandler::getRegistration(), dtn::api::Registration::hasSubscribed(), dtn::core::NODE_AVAILABLE, dtn::core::NODE_UNAVAILABLE, dtn::api::Registration::notify(), and dtn::api::Registration::NOTIFY_BUNDLE_AVAILABLE.

| size_t dtn::api::ApiServer::timeout | ( | ibrcommon::Timer * | ) | [virtual] |
Removes expired registrations.
| ibrcommon::Timer::StopTimerException | thrown, if the GarbageCollector should be stopped |
Implements ibrcommon::TimerCallback.
Definition at line 224 of file ApiServer.cpp.
References IBRCOMMON_LOGGER_DEBUG, and IBRCOMMON_LOGGER_ENDL.