Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

Dv::Ssl::SslSocket Class Reference

An iostream derived from Dv::Net::Socket. More...

#include <sslsocket.h>

Inheritance diagram for Dv::Ssl::SslSocket:

Inheritance graph
[legend]
Collaboration diagram for Dv::Ssl::SslSocket:

Collaboration graph
[legend]
List of all members.

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< SslSocketfd2sslsocket (SslContext &, int fd, size_t bufsz=1024, int msecs=0)
 Used internally by Dv::Ssl::SslServerSocket::accept.


Private Attributes

SslContextcontext_
 Associated SSL context.

SslBuffersslbuf_
 Associated streambuf.


Friends

class SslServerSocket
 SslServerSocket is a friend.


Detailed Description

An iostream derived from Dv::Net::Socket.

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.


Member Enumeration Documentation

anonymous enum
 

Extra error code (see Dv::Net::Socket) for SSL connections.

Enumeration values:
SSL_CONNECTION_FAILED 
SSL_ACCEPT_FAILED 

Definition at line 53 of file sslsocket.h.


Constructor & Destructor Documentation

Dv::Ssl::SslSocket::~SslSocket  ) 
 

Destructor.


Member Function Documentation

Dv::Ssl::SslSocket::SslSocket::SslSocket SslContext context,
const std::string &  host,
int  port,
size_t  bufsize = 1024,
int  msecs = 0
 

Constructor.

The Dv::Ssl::SslContext parameter need not contain private key or certificate file information since it is not used.

void* Dv::Ssl::SslSocket::ssl  )  const
 

Return SSL* pointer, opaque to avoid inclusion of openssl header files.

const char* Dv::Ssl::SslSocket::cipher  )  const
 

Return string representation of used cipher.

std::string Dv::Ssl::SslSocket::strerror  )  const [virtual]
 

Overrides Dv::Net::Socket::strerror.

Reimplemented from Dv::Net::Socket.

Dv::Ssl::SslSocket::SslSocket::SslSocket SslContext context,
int  fd,
size_t  bufsize = 1024,
int  msecs = 0
[private]
 

Constructor version used by Dv::Ssl::SslSocket::fs2socket.

ref<SslSocket> Dv::Ssl::SslSocket::fd2sslsocket SslContext ,
int  fd,
size_t  bufsz = 1024,
int  msecs = 0
[static, private]
 

Used internally by Dv::Ssl::SslServerSocket::accept.


Friends And Related Function Documentation

friend class SslServerSocket [friend]
 

SslServerSocket is a friend.

Definition at line 49 of file sslsocket.h.


Member Data Documentation

SslContext& Dv::Ssl::SslSocket::context_ [private]
 

Associated SSL context.

Definition at line 78 of file sslsocket.h.

SslBuffer* Dv::Ssl::SslSocket::sslbuf_ [private]
 

Associated streambuf.

Definition at line 80 of file sslsocket.h.


The documentation for this class was generated from the following file:
dvssl-0.5.4 [19 September, 2003]