IBR-DTNSuite
0.12
|
#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::socketstream *conn) | |
virtual | ~ClientHandler () |
Registration & | getRegistration () |
ApiServerInterface & | getAPIServer () |
void | switchRegistration (Registration ®) |
Public Member Functions inherited from ibrcommon::DetachedThread | |
virtual | ~DetachedThread ()=0 |
void | start (int priority=0) throw (ThreadException) |
void | stop () throw (ThreadException) |
Protected Member Functions | |
void | run () throw () |
void | finally () throw () |
void | setup () throw () |
void | __cancellation () throw () |
Protected Member Functions inherited from ibrcommon::DetachedThread | |
DetachedThread (size_t size=DEFAULT_STACKSIZE) | |
Protected Member Functions inherited from ibrcommon::Thread | |
virtual | ~Thread ()=0 |
void | reset () throw (ThreadException) |
bool | isFinalized () throw () |
bool | operator== (const ibrcommon::Thread &other) |
Thread (size_t stack=DEFAULT_STACKSIZE) | |
int | kill (int sig) |
void | cancel () throw () |
Additional Inherited Members | |
Static Protected Member Functions inherited from ibrcommon::Thread | |
static size_t | getNumberOfProcessors () |
static void | yield (void) |
static void | sleep (time_t timeout) |
static void | concurrency (int level) |
static bool | equal (pthread_t thread1, pthread_t thread2) |
static void * | __execute__ (void *obj) throw () |
Definition at line 55 of file ClientHandler.h.
Definition at line 58 of file ClientHandler.h.
dtn::api::ClientHandler::ClientHandler | ( | ApiServerInterface & | srv, |
Registration & | registration, | ||
ibrcommon::socketstream * | conn | ||
) |
Definition at line 48 of file ClientHandler.cpp.
|
virtual |
Definition at line 53 of file ClientHandler.cpp.
|
protectedvirtual |
Implements ibrcommon::Thread.
Definition at line 192 of file ClientHandler.cpp.
|
protectedvirtual |
This method is called when the run() method finishes.
Reimplemented from ibrcommon::Thread.
Definition at line 198 of file ClientHandler.cpp.
References dtn::api::Registration::abort(), dtn::api::ApiServerInterface::connectionDown(), dtn::api::ApiServerInterface::freeRegistration(), IBRCOMMON_LOGGER_DEBUG_TAG, and IBRCOMMON_LOGGER_ENDL.
ApiServerInterface & dtn::api::ClientHandler::getAPIServer | ( | ) |
Definition at line 63 of file ClientHandler.cpp.
Referenced by dtn::api::ExtendedApiHandler::run().
Registration & dtn::api::ClientHandler::getRegistration | ( | ) |
Definition at line 58 of file ClientHandler.cpp.
Referenced by dtn::api::OrderedStreamHandler::delivered(), dtn::api::BinaryStreamClient::eventBundleForwarded(), dtn::api::BinaryStreamClient::eventConnectionDown(), dtn::api::ExtendedApiHandler::ExtendedApiHandler(), dtn::api::OrderedStreamHandler::finally(), dtn::api::BinaryStreamClient::finally(), dtn::api::ExtendedApiHandler::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().
|
protectedvirtual |
Abstract interface for thread context run method.
Implements ibrcommon::Thread.
Definition at line 81 of file ClientHandler.cpp.
References API_STATUS_BAD_REQUEST, API_STATUS_NOT_ACCEPTABLE, API_STATUS_OK, dtn::core::Node::CONN_P2P_BT, dtn::core::Node::CONN_P2P_WIFI, dtn::api::ApiServerInterface::connectionUp(), dtn::api::ProtocolHandler::finally(), IBRCOMMON_LOGGER_ENDL, IBRCOMMON_LOGGER_TAG, dtn::api::ProtocolHandler::run(), dtn::api::ProtocolHandler::setup(), dtn::utils::Utils::tokenize(), and ibrcommon::Exception::what().
|
protectedvirtual |
This method is called before the run.
Reimplemented from ibrcommon::Thread.
Definition at line 77 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 68 of file ClientHandler.cpp.
References dtn::api::Registration::abort(), and dtn::api::ApiServerInterface::freeRegistration().
Referenced by dtn::api::ExtendedApiHandler::run().