Home C-Bits Package Documentation Project Page

Main Page   Namespace List   Compound List   File List   Compound Members   File Members  

cbits::SSLServerSocket Class Reference

This class is a SSL-enabled cbits::ServerSocket. More...

#include <SSLServerSocket.h>

Collaboration diagram for cbits::SSLServerSocket:

[legend]
List of all members.

Public Methods

 SSLServerSocket (const int port, const int qdepth=20, SSLContext *const ctxt=0) throw ( SocketException )
 Construct an SSL-enabled server socket. More...

virtual SSLSocketaccept (const long int msec=0) throw ( SocketException )
 Accept the next SSL connection on this server socket. More...


Static Public Methods

void setGlobalContext (SSLContext *g_ctxt) throw ( SSLContextException )
 Set a SSL context to be used by ALL new SSLServerSocket instances. More...


Private Attributes

BIO * _bio
 OpenSSL BIO object wrapping the low-level BSD socket. More...

SSLContext_ctxt
 The SSL context for this SSLServerSocket. More...

CriticalSection _csect
 Critical section to prevent multiple threads from invoking cbits::SSLServerSocket::accept simultaneously. More...


Static Private Attributes

SSLContext_global_ctxt = 0
 The global, default SSL security context, if set. More...


Detailed Description

This class is a SSL-enabled cbits::ServerSocket.

The OpenSSL library (http://www.openssl.org) is used to provide SSL-related functionality and X.509 certificate handling.

From the user's perspective, a cbits::SSLServerSocket is (in principle) identical to a cbits::ServerSocket in terms of functionality after the network connection has been established and the SSL handshake has succeeded.

However, all SSL sockets have to be created within a particular SSL context that defines parameters and data used during the SSL handshake, such as what ciphers are allowed (or not) and the location of relevant X.509 certificates.

The cbits::SSLContext class is used to represent an SSL security context for establishing SSL network connections. An instance of cbits::SSLContext should be provided to the cbits::SSLServerSocket constructor or set globally, in advance, for all (future) SSLServerSocket instances via the cbits::SSLServerSocket::setGlobalContext method.

Further, all cbits::SSLSocket connections produced from a cbits::SSLServerSocket, as a result of the SSL-enabled server accepting SSL connections from remote clients, inherit the cbits::SSLContect of the cbits::SSLServerSocket that produced them.


Constructor & Destructor Documentation

cbits::SSLServerSocket::SSLServerSocket const int    port,
const int    qdepth = 20,
SSLContext *const    ctxt = 0
throw ( SocketException )
 

Construct an SSL-enabled server socket.

port - the port to accept client connections on.

Returns: ------------ n/a

Exceptions: ----------- SocketException - if the socket can not be created.

Parameters:
port  local host port
qdepth  Max number of pending client connections. In most cases, the default is adequate.
ctxt  SSL context to use for this connection. If not specified, then a global context should have already been set.


Member Function Documentation

SSLSocket * SSLServerSocket::accept const long int    msec = 0 throw ( SocketException ) [virtual]
 

Accept the next SSL connection on this server socket.

Returns:
A pointer to a cbits::SSLSocket representing a new client connection, or 0 if the call timed out.
Exceptions:
SocketException  if an error occurred on the underlying socket.
Parameters:
msec  The maximum number of milliseconds to wait for a client connection. A zero or negative number is interpreted to mean 'wait forever'.

void SSLServerSocket::setGlobalContext SSLContext   g_ctxt throw ( SSLContextException ) [static]
 

Set a SSL context to be used by ALL new SSLServerSocket instances.

This may be overridden for individual SSLServerSocket instances by supplying a different context to the SSLServerSocket constructor when the SSLServerSocket is created.

Exceptions:
SSLContextException  if an invalid SSL context is supplied.
Parameters:
g_ctxt  Global SSL context


Member Data Documentation

BIO* cbits::SSLServerSocket::_bio [private]
 

OpenSSL BIO object wrapping the low-level BSD socket.

CriticalSection cbits::SSLServerSocket::_csect [private]
 

Critical section to prevent multiple threads from invoking cbits::SSLServerSocket::accept simultaneously.

SSLContext* cbits::SSLServerSocket::_ctxt [private]
 

The SSL context for this SSLServerSocket.

SSLContext * SSLServerSocket::_global_ctxt = 0 [static, private]
 

The global, default SSL security context, if set.


The documentation for this class was generated from the following files:
Generated by
doxygen
Hosted by
SourceForge