The Micro C++ Library
micxx::SSLClientSocket Class Reference

A SSLClientSocket represents a Secure Socket Layer (TCP) client endpoint of a StreamSocket. More...

#include <micxx.hxx>

Inherits micxx::ClientSocket.

List of all members.

Public Member Functions

 SSLClientSocket ()
 Create a new unbound, disconnected SSLClientSocket.
virtual ~SSLClientSocket ()
 Destruct a SSLClientSocket.
virtual void close (ClosingMode closingMode=BiDirectional)
virtual void connect (const SocketAddress &socketAddress)
virtual SSLProtocolgetSSLProtocol ()
virtual int recv (void *bytes, size_t size, bool blocking=true)
virtual int send (const void *bytes, size_t size, bool blocking=true)

Protected Member Functions

 SSLClientSocket (socket_t rawSocket, SocketAddress *socketAddress)
 Create a SSLClientSocket to an already connected rawSocket socket descriptor bound to the specified socketAddress.

Protected Attributes

SSLProtocol sslProtocol

Friends

class SSLServerSocket

Detailed Description

A SSLClientSocket represents a Secure Socket Layer (TCP) client endpoint of a StreamSocket.

See also:
http://en.wikipedia.org/wiki/Secure_Sockets_Layer
http://www.rfc-editor.org/rfc/rfc5246.txt

The following example shows how to use this class with a TCP connection:

 micxx::InetAddress inetAddress(addr.c_str());
 micxx::SSLClientSocket sslClientSocket;

 // Customize the SSL protocol layer
 if (caStore.length())
 {
     sslClientSocket.getSSLProtocol().setCACertificatesFile(caStore);
 }

 // Connect the SSL client endpoint to the SSL server endpoint
 // (TCP connect incl. SSL Handshake)
 sslClientSocket.connect(inetAddress);

 // Exchange encrypted data ...
 sslClientSocket.send(MESSAGE.c_str(), MESSAGE.length());
 cout << sslClientSocket.readLn();

 // Shutdown SSL communication and close TCP connection
 sslClientSocket.close();
Note:
Although SSLClientSocket is derived from Mutex, itself does no locking at all. If you intend to use SSLClientSocket concurrently from different threads, you could use the inherited Mutex to synchronize access to the instance (depending on the scenario in which it is used).
Author:
Norbert Klose
Date:
May, 2009

Constructor & Destructor Documentation

micxx::SSLClientSocket::SSLClientSocket ( )

Create a new unbound, disconnected SSLClientSocket.

virtual micxx::SSLClientSocket::~SSLClientSocket ( ) [virtual]

Destruct a SSLClientSocket.

micxx::SSLClientSocket::SSLClientSocket ( socket_t  rawSocket,
SocketAddress socketAddress 
) [protected]

Create a SSLClientSocket to an already connected rawSocket socket descriptor bound to the specified socketAddress.

Parameters:
rawSocketthe socket descriptor
socketAddressthe socket address to be used internally. This socket takes ownership of the allocated SocketAdress and gets responsible for deleting it
See also:
SSLServerSocket::accept()

Member Function Documentation

virtual void micxx::SSLClientSocket::close ( ClosingMode  closingMode = BiDirectional) [virtual]
See also:
ClientSocket::close()

Reimplemented from micxx::StreamSocket.

virtual void micxx::SSLClientSocket::connect ( const SocketAddress socketAddress) [virtual]
virtual SSLProtocol& micxx::SSLClientSocket::getSSLProtocol ( ) [virtual]
virtual int micxx::SSLClientSocket::recv ( void *  bytes,
size_t  size,
bool  blocking = true 
) [virtual]
virtual int micxx::SSLClientSocket::send ( const void *  bytes,
size_t  size,
bool  blocking = true 
) [virtual]

Friends And Related Function Documentation

friend class SSLServerSocket [friend]

Member Data Documentation


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