Dv::Ssl::ServerSocket Class Reference

A class derived from Dv::Net::ServerSocket that uses SSL. More...

#include <sslserversocket.h>

Inheritance diagram for Dv::Ssl::ServerSocket:

Inheritance graph
[legend]
Collaboration diagram for Dv::Ssl::ServerSocket:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ServerSocket (Context &context, int port, int backlog=10, std::string address="", unsigned int min_debug_level=0, Debugable *debug_master=0) throw (std::runtime_error)
 Constructor.
shared_ptr< Dv::Net::Socketaccept (time_t delay=0, size_t bufsz=1024, bool non_blocking=false)
 Accept a connection from an SSL client.

Private Attributes

Contextcontext_

Detailed Description

A class derived from Dv::Net::ServerSocket that uses SSL.

Example usage:

 try { 
   Dv::Ssl::ContextV23 context("key.pem","cert.pem"); 
   Dv::Ssl::ServerSocket server(context,port); 
   
   std::cerr << "SSL echo server started.." << std::endl; 
   Dv::Util::ref<Dv::Ssl::Socket>       client(server.accept()); 
   
   std::string line; 
   while (std::getline(*client, line)) 
     *client << line << std::endl; 
   std::cout << "client status: " << client->strerror() << std::endl;
   return server.error(); 
 }
 catch (std::exception& e) { 
   std::cerr << e.what() << std::endl;
   return 2; 
 }

Definition at line 35 of file sslserversocket.h.


Constructor & Destructor Documentation

Dv::Ssl::ServerSocket::ServerSocket ( Context context,
int  port,
int  backlog = 10,
std::string  address = "",
unsigned int  min_debug_level = 0,
Debugable debug_master = 0 
) throw (std::runtime_error)

Constructor.

Parameters:
context existing Dv::Ssl::Context object, this parameter must contain both a key file and a certificate file. Note that the Dv::Ssl::ServerSocket does not own the context object.
port on which connections will be accepted
backlog number of connections allowed in backlog
address local address to bind to, this is useful if e.g. you want the server to listen to a specific network interface, the default (empty string) will bind to the localhost (INADDR_ANY) interface.
min_debug_level if a debug_master is connected, logging info will only be written if the master's level is at least min_debug_level
debug_master from where debug info will be taken
See also:
Dv::DebugSlave

Dv::Net::ServerSocket


Member Function Documentation

shared_ptr<Dv::Net::Socket> Dv::Ssl::ServerSocket::accept ( time_t  delay = 0,
size_t  bufsz = 1024,
bool  non_blocking = false 
) [virtual]

Accept a connection from an SSL client.

Delay and bufsz are used for the resulting Socket. The client Dv::Ssl::Socket will be a Dv::DebugSlave of the same debug_master as the Dv::Ssl::ServerSocket.

Parameters:
delay number of millisecs resulting socket will wait for I/O.
bufsz (input and output) buffer size of streambuf associated with resulting socket
non_blocking ignored (for compatibility with Dv::Net::ServerSocket::accept)

Reimplemented from Dv::Net::ServerSocket.


Member Data Documentation

Context& Dv::Ssl::ServerSocket::context_ [private]

Definition at line 67 of file sslserversocket.h.


The documentation for this class was generated from the following file:
dvssl-0.6.1 [15 March, 2008]