#include <sslsocket.h>
Inheritance diagram for Dv::Ssl::SslSocket:
Public Types | |
enum | { SSL_CONNECTION_FAILED = -30, SSL_ACCEPT_FAILED = -31 } |
Extra error code (see Dv::Net::Socket) for SSL connections. More... | |
Public Member Functions | |
SslSocket::SslSocket (SslContext &context, const std::string &host, int port, size_t bufsize=1024, int msecs=0) | |
Constructor. | |
~SslSocket () | |
Destructor. | |
void * | ssl () const |
Return SSL* pointer, opaque to avoid inclusion of openssl header files. | |
const char * | cipher () const |
Return string representation of used cipher. | |
std::string | strerror () const |
Overrides Dv::Net::Socket::strerror. | |
Private Member Functions | |
SslSocket::SslSocket (SslContext &context, int fd, size_t bufsize=1024, int msecs=0) | |
Constructor version used by Dv::Ssl::SslSocket::fs2socket. | |
Static Private Member Functions | |
ref< SslSocket > | fd2sslsocket (SslContext &, int fd, size_t bufsz=1024, int msecs=0) |
Used internally by Dv::Ssl::SslServerSocket::accept. | |
Private Attributes | |
SslContext & | context_ |
Associated SSL context. | |
SslBuffer * | sslbuf_ |
Associated streambuf. | |
Friends | |
class | SslServerSocket |
SslServerSocket is a friend. |
Example usage:
SslContextV23 context; SslSocket client(context,"host.domain",9999); if (!client) { cerr << "connection failed: " << client.strerror() << endl; return 1; } X509Certificate cert(client); cout << "client: certificate name = " << cert.name() << endl << "client: certificate issuer = " << cert.issuer() << endl; const string out("hello world"); client << out << endl; string line; getline(client,line); if (line!=out) { cerr << "Client expected \"" << out << "\", got \"" << line << "\"" << endl; return 1; } cout << "Client exit status:" << client.strerror() << endl; return client.error();
Definition at line 46 of file sslsocket.h.
|
Extra error code (see Dv::Net::Socket) for SSL connections.
Definition at line 53 of file sslsocket.h. |
|
Destructor.
|
|
Constructor. The Dv::Ssl::SslContext parameter need not contain private key or certificate file information since it is not used. |
|
Return SSL* pointer, opaque to avoid inclusion of openssl header files.
|
|
Return string representation of used cipher.
|
|
Overrides Dv::Net::Socket::strerror.
Reimplemented from Dv::Net::Socket. |
|
Constructor version used by Dv::Ssl::SslSocket::fs2socket.
|
|
Used internally by Dv::Ssl::SslServerSocket::accept.
|
|
SslServerSocket is a friend.
Definition at line 49 of file sslsocket.h. |
|
Associated SSL context.
Definition at line 78 of file sslsocket.h. |
|
Associated streambuf.
Definition at line 80 of file sslsocket.h. |