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

SSLSocket Class Reference

#include <SSLSocket.h>

Inheritance diagram for SSLSocket:

Socket List of all members.

Public Methods

const SSLSocket & operator>> (string &mesg)
 SSLSocket (const int socket, SSL_CTX &sslContext)
 SSLSocket (const char *hostname, uint16_t port, SSL_CTX &sslContext)
int readLine (string &msg)
void interrupt ()
bool connected ()

Protected Methods

virtual int readBlock (void *buffer, int maxlen)
virtual int writeBlock (const void *buffer, int length)

Detailed Description

This class wraps the openSSL api for secure sockets. An SSL socket is always established on top of an orinary socket. Use the SSLSocketServer class to make connections.
Author:
Denis de Leeuw Duarte


Constructor & Destructor Documentation

SSLSocket::SSLSocket const int    socket,
SSL_CTX &    sslContext
 

Server-side constructor. Construct a new SSL Socket around the supplied TCP socket, which should already be connected. The SSL handshake will be performed from the server-perspective if this constructor is used. Normally, only the SSLServerSocket will use this constructor, so you shouldn't use it directly.

Parameters:
socket  file descriptor of a connected socket.
sslContext  SSL context containing the server's certificate chain, CA list and keys.

SSLSocket::SSLSocket const char *    hostname,
uint16_t    port,
SSL_CTX &    sslContext
 

Creates a new SSLSocket connection to the specified server and port.

Parameters:
server  the server's name or IP address.
port  the destination port number of the connection.
sslContext  SSL context containing the client's key. Use the static createClientSSLContext() function to make this context.


Member Function Documentation

bool SSLSocket::connected  
 

Checks if the SSLSocket is in a connected state.

void SSLSocket::interrupt   [virtual]
 

Interrupt current read actions (socket becomes write-only).

Implements Socket.

const SSLSocket & SSLSocket::operator>> string &    mesg
 

Overwrites a string with bytes from the socket. Blocks waiting for more input. The original content of the string is overwritten with the read data and a zero is user for termination.

Parameters:
mesg  the target string. If mesg has length n n-1 bytes will be read and a terminating zero will be added in the last position..
Exceptions:
SocketException 

int SSLSocket::readBlock void *    buffer,
int    maxlen
[protected, virtual]
 

Reads raw bytes from the socket for binary data transmission.

Parameters:
buffer  a pointer to the data.
maxlen  the maximum number of bytes to read.
Returns:
the number of bytes actually read or -1 on failure.

Implements Socket.

int SSLSocket::readLine string &    msg [virtual]
 

Read a single line of ASCII data (CR/LF automatically removed).

Parameters:
msg  the string that receives the ASCII data
Returns:
the number of bytes actually read or -1 on failure.

Implements Socket.

int SSLSocket::writeBlock const void *    buffer,
int    length
[protected, virtual]
 

Writes raw data to the socket for binary data transmission.

Parameters:
buffer  a pointer to the data.
length  the length of the data buffer in bytes.
Returns:
the number of bytes actually written or -1 on failure

Implements Socket.


The documentation for this class was generated from the following files:
Generated on Wed Feb 18 13:45:57 2004 for strongroom by doxygen1.2.18