a server handling incoming commands More...
#include <command_server.hxx>
Public Member Functions | |
command_server (server &_s) | |
~command_server () | |
void | handle (long long usec_timeout=-1, long long *usec_timeout_remaining=NULL) |
handle incoming commands | |
void | send_hello (unsigned int conn_id) |
send a hello message to a new connection | |
std::ostream * | get_logstream (log_level_values level) |
Protected Member Functions | |
virtual command * | cast_command (command *input) |
Private Member Functions | |
void | handle_packet (const std::string &packet, server_connection *conn) |
handle a command including deserialization and answering | |
Private Attributes | |
server & | s |
int | guard_handle |
a server handling incoming commands
libt2n::command_server::command_server | ( | server & | _s | ) |
References libt2n::server::add_callback(), libt2n::new_connection, s, and send_hello().
libt2n::command_server::~command_server | ( | ) |
Destructor
virtual command* libt2n::command_server::cast_command | ( | command * | input | ) | [inline, protected, virtual] |
Reimplemented in libt2n::group_command_server< COMMAND_GROUP >.
Referenced by handle_packet().
std::ostream* libt2n::command_server::get_logstream | ( | log_level_values | level | ) | [inline] |
References libt2n::server::get_logstream(), and s.
void libt2n::command_server::handle | ( | long long | usec_timeout = -1 , |
|
long long * | usec_timeout_remaining = NULL | |||
) |
handle incoming commands
[in,out] | usec_timeout | wait until new data is found, max timeout usecs. -1: wait endless, 0: instant return |
[out] | usec_timeout_remaining | microseconds from the timeout that were not used |
References libt2n::server::cleanup(), libt2n::connection::close(), libt2n::error, EXCEPTIONSTREAM, libt2n::server::fill_buffer(), libt2n::server::get_connection(), libt2n::server::get_packet(), guard_handle, handle_packet(), and s.
void libt2n::command_server::handle_packet | ( | const std::string & | packet, | |
server_connection * | conn | |||
) | [private] |
handle a command including deserialization and answering
References cast_command(), libt2n::t2n_exception::clone(), libt2n::debug, libt2n::fulldebug, libt2n::command_container::get_command(), libt2n::server_connection::get_id(), libt2n::server::get_logstream(), libt2n::result_container::has_exception(), OBJLOGSTREAM, s, libt2n::result_container::set_exception(), libt2n::result_container::set_result(), and libt2n::connection::write().
Referenced by handle().
void libt2n::command_server::send_hello | ( | unsigned int | conn_id | ) |
send a hello message to a new connection
References libt2n::server::get_connection(), s, and libt2n::connection::write().
Referenced by command_server().
int libt2n::command_server::guard_handle [private] |
Referenced by handle().
server& libt2n::command_server::s [private] |
Referenced by command_server(), get_logstream(), handle(), handle_packet(), and send_hello().