a basic implementation of ConnectionWrapper More...
#include <socket_wrapper.hxx>

Public Member Functions | |
| BasicSocketWrapper (int _port, const std::string &_server="127.0.0.1", long long _connect_timeout_usec=socket_client_connection::connect_timeout_usec_default, int _max_retries=socket_client_connection::max_retries_default) | |
| BasicSocketWrapper (const std::string &_path, long long _connect_timeout_usec=socket_client_connection::connect_timeout_usec_default, int _max_retries=socket_client_connection::max_retries_default) | |
| client_connection * | get_connection (void) |
| return active connection, create new tcp or unix connection if not existing | |
| bool | connection_established (void) |
| void | set_logging (std::ostream *_logstream, log_level_values _log_level) |
| set logging for coming and current connections | |
| virtual bool | handle (command_client *stubBase, boost::function< void() > f) |
| this function is called on every execution of a method on a server | |
| long long | get_command_timeout_usec (void) |
| void | set_command_timeout_usec (long long _command_timeout_usec) |
| long long | get_hello_timeout_usec (void) |
| void | set_hello_timeout_usec (long long _hello_timeout_usec) |
| std::ostream * | get_logstream (log_level_values level) |
| get pointer to logging stream, returns NULL if no logging needed | |
Protected Member Functions | |
| void | set_logging_on_connection (client_connection &c) |
| always call this when you got a new connection to transfer logging settings | |
Protected Attributes | |
| socket_type_value | socket_type |
| std::string | path |
| std::string | server |
| int | port |
| long long | connect_timeout_usec |
| int | max_retries |
| std::auto_ptr < socket_client_connection > | c |
| log_level_values | log_level |
| std::ostream * | logstream |
a basic implementation of ConnectionWrapper
This is a basic version of a ConnectionWrapper which does not do any fancy error handling or anything, it justs executes the regular calls. Use this wrapper if you only want to use the singleton-feature of T2nSingletonWrapper.
| libt2n::BasicSocketWrapper::BasicSocketWrapper | ( | int | _port, | |
| const std::string & | _server = "127.0.0.1", |
|||
| long long | _connect_timeout_usec = socket_client_connection::connect_timeout_usec_default, |
|||
| int | _max_retries = socket_client_connection::max_retries_default | |||
| ) | [inline] |
| libt2n::BasicSocketWrapper::BasicSocketWrapper | ( | const std::string & | _path, | |
| long long | _connect_timeout_usec = socket_client_connection::connect_timeout_usec_default, |
|||
| int | _max_retries = socket_client_connection::max_retries_default | |||
| ) | [inline] |
| bool libt2n::BasicSocketWrapper::connection_established | ( | void | ) | [inline] |
References c.
Referenced by libt2n::ReconnectIgnoreFailureSocketWrapper::handle(), and set_logging().
| long long libt2n::ConnectionWrapper::get_command_timeout_usec | ( | void | ) | [inline, inherited] |
References libt2n::ConnectionWrapper::command_timeout_usec.
| client_connection * libt2n::BasicSocketWrapper::get_connection | ( | void | ) | [virtual] |
return active connection, create new tcp or unix connection if not existing
Implements libt2n::ConnectionWrapper.
Reimplemented in libt2n::ReconnectIgnoreFailureSocketWrapper.
References c, connect_timeout_usec, libt2n::ConnectionWrapper::log_level, libt2n::ConnectionWrapper::logstream, max_retries, path, port, socket_type, libt2n::tcp_s, and libt2n::unix_s.
Referenced by set_logging().
| long long libt2n::ConnectionWrapper::get_hello_timeout_usec | ( | void | ) | [inline, inherited] |
References libt2n::ConnectionWrapper::hello_timeout_usec.
| std::ostream * libt2n::ConnectionWrapper::get_logstream | ( | log_level_values | level | ) | [inherited] |
get pointer to logging stream, returns NULL if no logging needed
References libt2n::ConnectionWrapper::log_level, and libt2n::ConnectionWrapper::logstream.
| virtual bool libt2n::ConnectionWrapper::handle | ( | command_client * | stubBase, | |
| boost::function< void() > | f | |||
| ) | [inline, virtual, inherited] |
this function is called on every execution of a method on a server
| stubBase | pointer to the command_client executing the call | |
| f | boost::function object containing the method to call and all parameters |
| true | if the call was successful and the original return-value of the called function can be used false if T2nSingletonWrapper has to create a return-value with the default-constructor |
T2nSingletonWrapper will call this function on every execution of a server-side method. This version will just call the function without any special treatment. You can overload this function to implement different error handling strategies.
Reimplemented in libt2n::ReconnectSocketWrapper, and libt2n::ReconnectIgnoreFailureSocketWrapper.
| void libt2n::ConnectionWrapper::set_command_timeout_usec | ( | long long | _command_timeout_usec | ) | [inline, inherited] |
References libt2n::ConnectionWrapper::command_timeout_usec.
| void libt2n::ConnectionWrapper::set_hello_timeout_usec | ( | long long | _hello_timeout_usec | ) | [inline, inherited] |
References libt2n::ConnectionWrapper::hello_timeout_usec.
| void libt2n::BasicSocketWrapper::set_logging | ( | std::ostream * | _logstream, | |
| log_level_values | _log_level | |||
| ) | [virtual] |
set logging for coming and current connections
Reimplemented from libt2n::ConnectionWrapper.
References connection_established(), get_connection(), and libt2n::client_connection::set_logging().
| void libt2n::ConnectionWrapper::set_logging_on_connection | ( | client_connection & | c | ) | [protected, inherited] |
always call this when you got a new connection to transfer logging settings
References libt2n::ConnectionWrapper::log_level, libt2n::ConnectionWrapper::logstream, libt2n::none, and libt2n::client_connection::set_logging().
std::auto_ptr<socket_client_connection> libt2n::BasicSocketWrapper::c [protected] |
long long libt2n::BasicSocketWrapper::connect_timeout_usec [protected] |
Referenced by get_connection().
log_level_values libt2n::ConnectionWrapper::log_level [protected, inherited] |
std::ostream* libt2n::ConnectionWrapper::logstream [protected, inherited] |
int libt2n::BasicSocketWrapper::max_retries [protected] |
Referenced by get_connection(), and libt2n::ReconnectSocketWrapper::handle().
std::string libt2n::BasicSocketWrapper::path [protected] |
Referenced by get_connection().
int libt2n::BasicSocketWrapper::port [protected] |
Referenced by get_connection().
std::string libt2n::BasicSocketWrapper::server [protected] |
Referenced by get_connection().
1.6.1
© Intra2net AG 2025
| Legal | Contact