sends::ssl_bio Class Reference
[Sends Data Classes]

OpenSSL BIO wrapper. More...

#include <sslbase.hh>

Inheritance diagram for sends::ssl_bio:

sends::socket_api

List of all members.

Public Member Functions

 ssl_bio (void)
 ssl_bio empty constructor.
 ssl_bio (ssl_ctx &ctx)
 New ssl_bio constructor.
virtual ~ssl_bio (void)
 Destructor.
ssl_biooperator= (ssl_bio &bio)
 Assignment operator.
ssl_bioaccept (void)
 Accept a client connection.
sock_err bind (const std::string &port)
 Complete client handshake.
sock_err close (void)
 Close connection.
sock_err connect (const std::string &peer)
 Close connection.
sock_err handshake (void)
 Complete client handshake.
sock_err listen (const std::string &port, int lq)
 Listen for clients.
long read_available (char *buffer, long length)
 Read a string.
bio_st & ref_bio (void)
bio_st * release (void)
void reset (bio_st *bio)
 Reset the inter BIO pointer.
void set_ssl_mode (long mode)
 Set the SSL mode flags.
int socket_id (void) const
 Get the socket id.
long write (const char *buffer, long length)
 Write data.


Detailed Description

OpenSSL BIO wrapper.

SSL BIO wrapper. Performs I/O and control functions to an SSL port. Note that this class contains a pointer to a BIO that it owns. When the class is copied bu an operator= or a copy constructor, the ownership is passed to the new class and the BIO pointer is reset. This might appear to be an obvious application for the auto_ptr template, but the BIO must be release by BIO_free rather than being deleted.

Author:
John Zweizig
Version:
1.0; Last modified January 23, 2008

Constructor & Destructor Documentation

sends::ssl_bio::ssl_bio ( void   ) 

ssl_bio empty constructor.

Construct a null SSL BIO wrapper.

sends::ssl_bio::ssl_bio ( ssl_ctx ctx  )  [explicit]

New ssl_bio constructor.

Construct an SSL BIO wrapper. The OpenSSL bio is allocated from the specified context.

Parameters:
ctx OpenSSL contect used to construct the BIO structure.

virtual sends::ssl_bio::~ssl_bio ( void   )  [virtual]

Destructor.

Destroy and free the bio.


Member Function Documentation

ssl_bio& sends::ssl_bio::operator= ( ssl_bio bio  ) 

Assignment operator.

Parasitic assignment operator. The Bio of the argument is appropriated by the lhs ssl_bio object.

Parameters:
bio ssl_bio object which is copied.
Returns:
Reference to this object.

ssl_bio* sends::ssl_bio::accept ( void   )  [virtual]

Accept a client connection.

Accept a connection from a client. THe current ssl_bio should be listening to a port (see listen method).

Returns:
Pointer to Bio for accepted connetion.

Implements sends::socket_api.

sock_err sends::ssl_bio::bind ( const std::string &  port  )  [virtual]

Complete client handshake.

Complete the handshake on an accepted lient connection.

Parameters:
port Prt number string.
Returns:
Socket error code.

Implements sends::socket_api.

sock_err sends::ssl_bio::close ( void   )  [virtual]

Close connection.

Shut-down and free current BIO and zero the internal pointer.

Returns:
Socket error code.

Implements sends::socket_api.

sock_err sends::ssl_bio::connect ( const std::string &  peer  )  [virtual]

Close connection.

Shut-down and free current BIO and zero the internal pointer.

Parameters:
peer IP address to which the connection will be made.
Returns:
Socket error code.

Implements sends::socket_api.

sock_err sends::ssl_bio::handshake ( void   )  [virtual]

Complete client handshake.

Complete the handshake on an accepted lient connection.

Returns:
Socket error code.

Reimplemented from sends::socket_api.

sock_err sends::ssl_bio::listen ( const std::string &  port,
int  lq 
) [virtual]

Listen for clients.

Listen to the specified port for client connection requests. The port to be listened to is identified by a character string containing the port number.

Parameters:
port Port ID string.
lq length of request queue.
Returns:
Socket error code.

Implements sends::socket_api.

long sends::ssl_bio::read_available ( char *  buffer,
long  length 
) [virtual]

Read a string.

Read a data string via the Bio.

Parameters:
buffer Character vector to receive the data.
length Maximum length of data to be read.
Returns:
Number of bytes read.

Implements sends::socket_api.

bio_st & sends::ssl_bio::ref_bio ( void   )  [inline]

Reference the wrapped OpenSSL BIO structure.

Returns:
Modifiable reference to the OpenSSL BIO structure.

bio_st* sends::ssl_bio::release ( void   ) 

Release the wrapped OpenSSL BIO structure from this object. The Bio structure pointer is is returned and the internal pointer is set to null.

Returns:
Modifiable reference to the OpenSSL BIO structure.

void sends::ssl_bio::reset ( bio_st *  bio  ) 

Reset the inter BIO pointer.

Free the wrapped bio structure if one exists and reset the internal pointer to the argument value.

Parameters:
bio New value of the bio pointer.

void sends::ssl_bio::set_ssl_mode ( long  mode  ) 

Set the SSL mode flags.

Set the OpenSSL mode flags in the wrapped BIO.

Parameters:
mode New mode flags

int sends::ssl_bio::socket_id ( void   )  const [virtual]

Get the socket id.

Get a socket id number. In general this will be the system fd for the socket.

Returns:
Socket id for use in select.

Implements sends::socket_api.

long sends::ssl_bio::write ( const char *  buffer,
long  length 
) [virtual]

Write data.

Write data string to the socket.

Parameters:
buffer Character vector with data to be written.
length Length of data to be written.
Returns:
Number of bytes written.

Implements sends::socket_api.


The documentation for this class was generated from the following file:

Generated on Tue Jun 10 12:18:12 2008 for SENDS by  doxygen 1.5.5