#include <ulxr_ssl_connection.h>
Inheritance diagram for ulxr::SSLConnection:


Public Member Functions | |
| SSLConnection (bool server, const CppString &domain, unsigned port=80) | |
| Constructs a generic connection, primarily for a client. | |
| SSLConnection (bool server, long adr=INADDR_ANY, unsigned port=0) | |
| Constructs a generic connection, primarily for a server. | |
| virtual | ~SSLConnection () |
| Constructs a connection. | |
| virtual void | close () |
| Closes the connection. | |
| virtual void | open () |
| Opens the connection in rpc client mode. | |
| virtual bool | accept (int timeout=0) |
| Opens the connection in rpc server mode, thus waiting for connections from clients. | |
| virtual CppString | getInterfaceName () |
| Tests if the current transmission expects a return value. | |
| virtual void | cut () |
| Cuts the connection. | |
| std::string | getPassword () const |
| Returns the password. | |
| void | setCryptographyData (const std::string &password, const std::string &certfile, const std::string &keyfile) |
| Sets the cryptography data. | |
Protected Member Functions | |
| SSL * | getSslObject () const |
| Returns the SSL object. | |
| SSL_CTX * | getSslContextObject () const |
| Returns the SSL context object. | |
| SSL_SESSION * | getSslSessionObject () const |
| Returns the SSL session object. | |
| virtual bool | hasPendingInput () const |
| Checks if there is input data which can immediately be read. | |
Private Member Functions | |
| void | createSSL () |
| Create SSL object. | |
| void | initializeCTX () |
| Initialise SSL context data. | |
| virtual ssize_t | low_level_write (char const *buff, long len) |
| Actually writes data to the connection. | |
| virtual ssize_t | low_level_read (char *buff, long len) |
| Reads data from the connection. | |
| void | init () |
| Initializes internal variables. | |
| virtual TcpIpConnection * | makeClone () |
| Creates a shallow copy of this object. | |
Private Attributes | |
| SSL * | ssl |
| SSL_CTX * | ssl_ctx |
| SSL_SESSION * | session |
| std::string | password |
| std::string | keyfile |
| std::string | certfile |
Static Private Attributes | |
| static bool | ssl_initialized |
Definition at line 49 of file ulxr_ssl_connection.h.
| ulxr::SSLConnection::SSLConnection | ( | bool | server, | |
| const CppString & | domain, | |||
| unsigned | port = 80 | |||
| ) |
Constructs a generic connection, primarily for a client.
The connection is not yet open after construction.
| server | true: bind socket to adress for server mode | |
| domain | domain name of the server | |
| port | port on the the server |
Definition at line 68 of file ulxr_ssl_connection.cpp.
References init(), ULXR_PCHAR, and ULXR_TRACE.
Referenced by makeClone().
| ulxr::SSLConnection::SSLConnection | ( | bool | server, | |
| long | adr = INADDR_ANY, |
|||
| unsigned | port = 0 | |||
| ) |
Constructs a generic connection, primarily for a server.
The connection is not yet open after construction.
| server | true: bind socket to adress for server mode | |
| adr | accepted client adress | |
| port | port on which the connect is accepted |
Definition at line 76 of file ulxr_ssl_connection.cpp.
References init(), ULXR_PCHAR, and ULXR_TRACE.
| ulxr::SSLConnection::~SSLConnection | ( | ) | [virtual] |
Constructs a connection.
The connection is not yet open after construction.
Definition at line 141 of file ulxr_ssl_connection.cpp.
References session, ssl_ctx, ULXR_PCHAR, and ULXR_TRACE.
| void ulxr::SSLConnection::close | ( | ) | [virtual] |
Closes the connection.
Reimplemented from ulxr::TcpIpConnection.
Definition at line 156 of file ulxr_ssl_connection.cpp.
References ulxr::TcpIpConnection::close(), ULXR_PCHAR, and ULXR_TRACE.
| void ulxr::SSLConnection::open | ( | ) | [virtual] |
Opens the connection in rpc client mode.
Reimplemented from ulxr::TcpIpConnection.
Definition at line 300 of file ulxr_ssl_connection.cpp.
References ulxr::TcpIpConnection::open(), ulxr::SystemError, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
| bool ulxr::SSLConnection::accept | ( | int | timeout = 0 |
) | [virtual] |
Opens the connection in rpc server mode, thus waiting for connections from clients.
| timeout | the timeout value [sec] (0 - no timeout) |
true when connection has been accepted Reimplemented from ulxr::TcpIpConnection.
Definition at line 324 of file ulxr_ssl_connection.cpp.
References ulxr::TcpIpConnection::accept(), ulxr::SystemError, ULXR_GET_STRING, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
| CppString ulxr::SSLConnection::getInterfaceName | ( | ) | [virtual] |
Tests if the current transmission expects a return value.
Reimplemented from ulxr::TcpIpConnection.
Definition at line 357 of file ulxr_ssl_connection.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
| void ulxr::SSLConnection::cut | ( | ) | [virtual] |
Cuts the connection.
Just the variables are reset, the connection itself is not touched.
Reimplemented from ulxr::Connection.
Definition at line 364 of file ulxr_ssl_connection.cpp.
References ulxr::Connection::cut(), ULXR_PCHAR, and ULXR_TRACE.
| std::string ulxr::SSLConnection::getPassword | ( | ) | const |
Returns the password.
Definition at line 372 of file ulxr_ssl_connection.cpp.
Referenced by ulxr::password_cb().
| void ulxr::SSLConnection::setCryptographyData | ( | const std::string & | password, | |
| const std::string & | certfile, | |||
| const std::string & | keyfile | |||
| ) |
Sets the cryptography data.
| password | password for the crypto files | |
| certfile | name of the servers certificate file (PEM format) | |
| keyfile | name of the servers private key file (PEM format) |
Definition at line 85 of file ulxr_ssl_connection.cpp.
| SSL * ulxr::SSLConnection::getSslObject | ( | ) | const [protected] |
Returns the SSL object.
Definition at line 378 of file ulxr_ssl_connection.cpp.
| SSL_CTX * ulxr::SSLConnection::getSslContextObject | ( | ) | const [protected] |
Returns the SSL context object.
Definition at line 384 of file ulxr_ssl_connection.cpp.
| SSL_SESSION * ulxr::SSLConnection::getSslSessionObject | ( | ) | const [protected] |
Returns the SSL session object.
Definition at line 390 of file ulxr_ssl_connection.cpp.
| bool ulxr::SSLConnection::hasPendingInput | ( | ) | const [protected, virtual] |
Checks if there is input data which can immediately be read.
Reimplemented from ulxr::Connection.
Definition at line 216 of file ulxr_ssl_connection.cpp.
References ulxr::Connection::hasPendingInput(), ULXR_PCHAR, and ULXR_TRACE.
| void ulxr::SSLConnection::createSSL | ( | ) | [private] |
Create SSL object.
Definition at line 274 of file ulxr_ssl_connection.cpp.
References s_server_auth_session_id_context, ulxr::SystemError, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
| void ulxr::SSLConnection::initializeCTX | ( | ) | [private] |
Initialise SSL context data.
Definition at line 95 of file ulxr_ssl_connection.cpp.
References ulxr::password_cb(), s_server_session_id_context, ULXR_PCHAR, and ULXR_TRACE.
| ssize_t ulxr::SSLConnection::low_level_write | ( | char const * | buff, | |
| long | len | |||
| ) | [private, virtual] |
Actually writes data to the connection.
| buff | pointer to data | |
| len | valid buffer length |
Reimplemented from ulxr::Connection.
Definition at line 177 of file ulxr_ssl_connection.cpp.
References ulxr::Connection::low_level_write(), ulxr::SystemError, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
| ssize_t ulxr::SSLConnection::low_level_read | ( | char * | buff, | |
| long | len | |||
| ) | [private, virtual] |
Reads data from the connection.
| buff | pointer to data buffer | |
| len | maimum number of bytes to read into buffer |
Reimplemented from ulxr::Connection.
Definition at line 229 of file ulxr_ssl_connection.cpp.
References ulxr::Connection::low_level_read(), ulxr::SystemError, ulxr_i18n, ULXR_PCHAR, and ULXR_TRACE.
| void ulxr::SSLConnection::init | ( | ) | [private] |
Initializes internal variables.
Reimplemented from ulxr::Connection.
Definition at line 124 of file ulxr_ssl_connection.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
Referenced by SSLConnection().
| TcpIpConnection * ulxr::SSLConnection::makeClone | ( | ) | [private, virtual] |
Creates a shallow copy of this object.
Reimplemented from ulxr::TcpIpConnection.
Definition at line 268 of file ulxr_ssl_connection.cpp.
References SSLConnection().
SSL* ulxr::SSLConnection::ssl [private] |
Definition at line 137 of file ulxr_ssl_connection.h.
SSL_CTX* ulxr::SSLConnection::ssl_ctx [private] |
SSL_SESSION* ulxr::SSLConnection::session [private] |
std::string ulxr::SSLConnection::password [private] |
Definition at line 141 of file ulxr_ssl_connection.h.
std::string ulxr::SSLConnection::keyfile [private] |
Definition at line 142 of file ulxr_ssl_connection.h.
std::string ulxr::SSLConnection::certfile [private] |
Definition at line 143 of file ulxr_ssl_connection.h.
bool ulxr::SSLConnection::ssl_initialized [static, private] |
Definition at line 145 of file ulxr_ssl_connection.h.
1.5.1