Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   Related Pages  

CODEX_SSL::SSLSocket Class Reference

This class handles sockets using Secure Sockets Layer (SSL). More...

#include <SSLSocket.h>

Inheritance diagram for CODEX_SSL::SSLSocket:

Inheritance graph
[legend]
Collaboration diagram for CODEX_SSL::SSLSocket:

Collaboration graph
[legend]
List of all members.

Public Methods

 SSLSocket (SSL_CTX *ctx, int domain=PF_INET, int type=SOCK_STREAM, int protocol=0, bool blocking=false)
 Constructor for SSL sockets.

 SSLSocket (const SSLSocket &aOther)
 Copy constructor.

virtual ~SSLSocket ()
 Destructor.

int set_fd (fd_set *fd_bitmap, StateType s) const
 Fill file descriptor bitmap.

bool isset_fd (const fd_set *fd_bitmap, StateType s) const
 Check file descriptor bitmap.

size_t readFrom (void *output, size_t maxSize=1024) const
 This reimplements CODEX_Quorum::SocketBase::readFrom() to handle OpenSSL's I/O.


Protected Methods

CODEX_Quorum::SocketBaseclone ()
 Subclass-aware object duplication.

void connect (const CODEX_Quorum::RemoteServer &server)
 This reimplements CODEX_Quorum::SocketBase::connect() to add SSL configuration.

void finish_accept ()
 This reimplements CODEX_Quorum::SocketBase::finish_accept() to add SSL configuration.

int internal_write (const unsigned char *output, size_t maxSize) const
 This reimplements CODEX_Quorum::SocketBase::internal_write() to handle OpenSSL's I/O.


Detailed Description

This class handles sockets using Secure Sockets Layer (SSL).

It is important to note that this class does not handle all aspects of setting up SSL, only the specific socket actions. Initializing SSL, maintaining certificates, and so forth will still need to be taken care of externally.

Definition at line 42 of file SSLSocket.h.


Constructor & Destructor Documentation

SSLSocket::SSLSocket SSL_CTX *    ctx,
int    domain = PF_INET,
int    type = SOCK_STREAM,
int    protocol = 0,
bool    blocking = false
 

Constructor for SSL sockets.

Parameters:
ctx  SSL context structure describing the environment relevant to SSL operations. The context must be created before passing it to SSLSocket. This class does not take possession of the memory, since multiple sockets may be created using the same context.
domain  see SocketBase::SocketBase
type  see SocketBase::SocketBase
protocol  see SocketBase::SocketBase
blocking  see SocketBase::SocketBase

Definition at line 31 of file SSLSocket.cc.

Referenced by clone().


Member Function Documentation

SocketBase * SSLSocket::clone   [protected, virtual]
 

Subclass-aware object duplication.

This is similar to a copy constructor except that, as a virtual function, it can be overridden in order for derived classes to return copies of themselves that have the correct type, yet which use an identical interface from the base class. Each class in the SocketBase hierarchy overrides this method to use its own copy constructor.

Reimplemented from CODEX_Quorum::SocketBase.

Definition at line 216 of file SSLSocket.cc.

References CODEX_Quorum::SocketBase::SocketBase(), and SSLSocket().

bool SSLSocket::isset_fd const fd_set *    fd_bitmap,
StateType    s
const [virtual]
 

Check file descriptor bitmap.

The base-class method will be called initially to determine if the socket needs to be examined.

Parameters:
fd_bitmap  bitmap of file descriptors to check. This is typically a fd_set returned by select(2), and will have the bit corresponding to the socket file descriptor set to 1 if the relevant action is appropriate.
s  state of the socket to be tested. Because SSL maintains state for whether a socket expects a read or a write, so this parameter is used to determine whether the socket is in fact ready for use or whether the socket activity reported by select(2) indicates a state change.
Return values:
true  the bit is set
false  the bit is not set

Reimplemented from CODEX_Quorum::SocketBase.

Definition at line 91 of file SSLSocket.cc.

int SSLSocket::set_fd fd_set *    fd_bitmap,
StateType    s
const [virtual]
 

Fill file descriptor bitmap.

The base-class method will be called if it is determined that setting the bitmap is appropriate.

Parameters:
fd_bitmap  bitmap of file descriptors to modify. The bit corresponding to the socket file descriptor will be set to 1.
s  state of the socket to be tested. Because SSL maintains state for whether a socket expects a read or a write, passing in the StateType allows us to set the bitmap or not according to whether a read or write is currently permitted.
Returns:
file descriptor of the socket

Reimplemented from CODEX_Quorum::SocketBase.

Definition at line 65 of file SSLSocket.cc.


The documentation for this class was generated from the following files:
Generated on Wed Jun 2 16:33:23 2004 for COrnell Data EXchange (CODEX) by doxygen1.2.18