IBR-DTNSuite
0.8
|
#include <ClientHandler.h>
Public Types | |
enum | STATUS_CODES { API_STATUS_CONTINUE = 100, API_STATUS_OK = 200, API_STATUS_CREATED = 201, API_STATUS_ACCEPTED = 202, API_STATUS_FOUND = 302, API_STATUS_BAD_REQUEST = 400, API_STATUS_UNAUTHORIZED = 401, API_STATUS_FORBIDDEN = 403, API_STATUS_NOT_FOUND = 404, API_STATUS_NOT_ALLOWED = 405, API_STATUS_NOT_ACCEPTABLE = 406, API_STATUS_CONFLICT = 409, API_STATUS_INTERNAL_ERROR = 500, API_STATUS_NOT_IMPLEMENTED = 501, API_STATUS_SERVICE_UNAVAILABLE = 503, API_STATUS_VERSION_NOT_SUPPORTED = 505 } |
Public Member Functions | |
ClientHandler (ApiServerInterface &srv, Registration ®istration, ibrcommon::tcpstream *conn) | |
virtual | ~ClientHandler () |
Registration & | getRegistration () |
ApiServerInterface & | getAPIServer () |
void | switchRegistration (Registration ®) |
void | eventNodeAvailable (const dtn::core::Node &node) |
void | eventNodeUnavailable (const dtn::core::Node &node) |
Protected Member Functions | |
void | run () |
void | finally () |
void | setup () |
void | __cancellation () |
Definition at line 41 of file ClientHandler.h.
Definition at line 44 of file ClientHandler.h.
dtn::api::ClientHandler::ClientHandler | ( | ApiServerInterface & | srv, |
Registration & | registration, | ||
ibrcommon::tcpstream * | conn | ||
) |
Definition at line 33 of file ClientHandler.cpp.
References ibrcommon::tcpstream::enableNoDelay(), and dtn::daemon::Configuration::getInstance().
dtn::api::ClientHandler::~ClientHandler | ( | ) | [virtual] |
Definition at line 42 of file ClientHandler.cpp.
void dtn::api::ClientHandler::__cancellation | ( | ) | [protected, virtual] |
Implements ibrcommon::Thread.
Definition at line 157 of file ClientHandler.cpp.
void dtn::api::ClientHandler::eventNodeAvailable | ( | const dtn::core::Node & | node | ) |
Definition at line 179 of file ClientHandler.cpp.
Referenced by dtn::api::ApiServer::raiseEvent().
void dtn::api::ClientHandler::eventNodeUnavailable | ( | const dtn::core::Node & | node | ) |
Definition at line 183 of file ClientHandler.cpp.
Referenced by dtn::api::ApiServer::raiseEvent().
void dtn::api::ClientHandler::finally | ( | void | ) | [protected, virtual] |
This method is called when the run() method finishes.
Reimplemented from ibrcommon::Thread.
Definition at line 163 of file ClientHandler.cpp.
References dtn::api::Registration::abort(), dtn::api::ApiServerInterface::connectionDown(), dtn::api::ApiServerInterface::freeRegistration(), IBRCOMMON_LOGGER_DEBUG, and IBRCOMMON_LOGGER_ENDL.
Definition at line 52 of file ClientHandler.cpp.
Referenced by dtn::api::ExtendedApiHandler::run(), and dtn::api::BinaryStreamClient::run().
Definition at line 47 of file ClientHandler.cpp.
Referenced by dtn::api::OrderedStreamHandler::delivered(), dtn::api::BinaryStreamClient::eventBundleForwarded(), dtn::api::BinaryStreamClient::eventConnectionDown(), dtn::api::BinaryStreamClient::eventConnectionUp(), dtn::api::ExtendedApiHandler::ExtendedApiHandler(), dtn::api::OrderedStreamHandler::finally(), dtn::api::ExtendedApiHandler::finally(), dtn::api::BinaryStreamClient::finally(), dtn::api::OrderedStreamHandler::get(), dtn::api::OrderedStreamHandler::OrderedStreamHandler(), dtn::api::OrderedStreamHandler::put(), dtn::api::ApiServer::raiseEvent(), dtn::api::OrderedStreamHandler::run(), dtn::api::ExtendedApiHandler::run(), dtn::api::BinaryStreamClient::~BinaryStreamClient(), and dtn::api::ExtendedApiHandler::~ExtendedApiHandler().
void dtn::api::ClientHandler::run | ( | ) | [protected, virtual] |
Abstract interface for thread context run method.
Implements ibrcommon::Thread.
Definition at line 70 of file ClientHandler.cpp.
References API_STATUS_BAD_REQUEST, API_STATUS_NOT_ACCEPTABLE, API_STATUS_OK, dtn::api::ApiServerInterface::connectionUp(), dtn::api::ProtocolHandler::finally(), dtn::api::ProtocolHandler::run(), dtn::api::ProtocolHandler::setup(), and dtn::utils::Utils::tokenize().
void dtn::api::ClientHandler::setup | ( | void | ) | [protected, virtual] |
This method is called before the run.
Reimplemented from ibrcommon::Thread.
Definition at line 66 of file ClientHandler.cpp.
void dtn::api::ClientHandler::switchRegistration | ( | Registration & | reg | ) |
swaps the active registration of this client with the given one
reg | the new registration |
Definition at line 57 of file ClientHandler.cpp.
References dtn::api::Registration::abort(), and dtn::api::ApiServerInterface::freeRegistration().
Referenced by dtn::api::ExtendedApiHandler::run().