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

Dv::Ticket::Server Class Reference

Ticket server class. More...

#include <server.h>

Collaboration diagram for Dv::Ticket::Server:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Server (const Dv::Xml::Node::Ref config, Dv::Ticket::Authenticator &authenticator) throw (Dv::Ticket::Exception)
 Constructor.

 Server (const std::string &config_fn, Dv::Ticket::Authenticator &authenticator) throw (Dv::Ticket::Exception)
 Constructor.

int main () throw ()
 Server main loop.

virtual ~Server ()
 Destructor (virtual).

const std::string & dtd_dir () const
const std::string & config_fn () const
const std::string & config_dtd_fn () const
const std::string & request_dtd_fn () const
const std::string & log_fn () const
const std::string & cert_fn () const
const std::string & key_fn () const
const std::string & pid_fn () const
int port () const
const std::string & host () const
size_t client_delay () const
std::ostream & log ()
Dv::MySql::Dbdb ()
Dv::Ticket::Authenticatorauthenticator ()
Dv::Ticket::Ticket::Ref make_ticket (const User &user, const std::string &host, size_t duration) throw (Dv::Ticket::Exception)
 Create and store a new ticket for a user.

Dv::Ticket::Ticket::Ref validate_ticket (Dv::Ticket::Ticket::SERIAL serial, const std::string &host) throw (Dv::Ticket::Exception)
 Retrieve a ticket with a given serial number.


Private Member Functions

void init (const Dv::Xml::Node::Ref config) throw (Dv::Ticket::Exception)
 Initialize a server.


Private Attributes

std::string dtd_dir_
 name of directory containing relevant DTD files

std::string config_fn_
 configuration file name

std::string config_dtd_fn_
 configuration DTD file name

std::string request_dtd_fn_
 request DTD file name

std::string log_fn_
 log DTD file name

std::string cert_fn_
 server certificate file name

std::string key_fn_
 server key file name

std::string pid_fn_
 name of file containing server process ID

int port_
 port on which server is listening

std::string host_
 this host

size_t client_delay_
 delay that the server is prepared to wait for any communication from the client, in millisec

Dv::Ticket::Authenticatorauthenticator_
 reference to authentictor object that is used by this server

Dv::MySql::Dbdb_
 pointer to ticket database connection, never 0

std::ostream * log_
 pointer to log output stream, never 0

Dv::Ssl::SslContextV23ssl_context_
 SSL context.

Dv::Ssl::SslServerSocketssl_ss_
 SSL server socket.


Detailed Description

Ticket server class.

Warning:
The server is single-threaded. DOS attacks are -- hopefully -- avoided by using a max. client delay.
See also:
Dv::Ticket::Server::client_delay

Definition at line 24 of file server.h.


Constructor & Destructor Documentation

Dv::Ticket::Server::Server const Dv::Xml::Node::Ref  config,
Dv::Ticket::Authenticator authenticator
throw (Dv::Ticket::Exception)
 

Constructor.

Parameters:
config XML node containing configuration parameters. This node is assumed to conform to the configuration DTD.
authenticator object to which actual user name/passwd verification will be delegated.
Exceptions:
Dv::Ticket::Exception upon any error
The constructor will connect to the database, set up the SSL server etc.

Dv::Ticket::Server::Server const std::string &  config_fn,
Dv::Ticket::Authenticator authenticator
throw (Dv::Ticket::Exception)
 

Constructor.

Parameters:
config_fn name of XML file containing configuration parameters. The file will be checked vs the DTD.
authenticator object to which actual user name/passwd verification will be delegated.
Exceptions:
Dv::Ticket::Exception upon any error
The constructor will connect to the database, set up the SSL server etc.

virtual Dv::Ticket::Server::~Server  )  [virtual]
 

Destructor (virtual).


Member Function Documentation

int Dv::Ticket::Server::main  )  throw ()
 

Server main loop.

Returns:
0 if ok, non-zero if error.

const std::string& Dv::Ticket::Server::dtd_dir  )  const [inline]
 

Returns:
name of directory containin DTD files

Definition at line 61 of file server.h.

References dtd_dir_.

const std::string& Dv::Ticket::Server::config_fn  )  const [inline]
 

Returns:
name of configuration file

Definition at line 63 of file server.h.

References config_fn_.

const std::string& Dv::Ticket::Server::config_dtd_fn  )  const [inline]
 

Returns:
name of configuration DTD file

Definition at line 65 of file server.h.

References config_dtd_fn_.

const std::string& Dv::Ticket::Server::request_dtd_fn  )  const [inline]
 

Returns:
name of request DTD file

Definition at line 67 of file server.h.

References request_dtd_fn_.

const std::string& Dv::Ticket::Server::log_fn  )  const [inline]
 

Returns:
name of log file

Definition at line 69 of file server.h.

References log_fn_.

const std::string& Dv::Ticket::Server::cert_fn  )  const [inline]
 

Returns:
name of server certificate file

Definition at line 71 of file server.h.

References cert_fn_.

const std::string& Dv::Ticket::Server::key_fn  )  const [inline]
 

Returns:
name of server key file

Definition at line 73 of file server.h.

References key_fn_.

const std::string& Dv::Ticket::Server::pid_fn  )  const [inline]
 

Returns:
name of file containing process ID of this server

Definition at line 75 of file server.h.

References pid_fn_.

int Dv::Ticket::Server::port  )  const [inline]
 

Returns:
port number on which the server listens for connections

Definition at line 78 of file server.h.

References port_.

const std::string& Dv::Ticket::Server::host  )  const [inline]
 

Returns:
host name, in dot notation, of the server (this machine).

Definition at line 80 of file server.h.

References host_.

size_t Dv::Ticket::Server::client_delay  )  const [inline]
 

Returns:
delay the server is prepared to wait for any communication from the client, in millisec

Definition at line 84 of file server.h.

References client_delay_.

std::ostream& Dv::Ticket::Server::log  )  [inline]
 

Returns:
reference to log output stream

Definition at line 87 of file server.h.

References log_.

Dv::MySql::Db& Dv::Ticket::Server::db  )  [inline]
 

Returns:
pointer to ticket database connection, never 0

Definition at line 89 of file server.h.

References db_.

Dv::Ticket::Authenticator& Dv::Ticket::Server::authenticator  )  [inline]
 

Returns:
reference to authentictor object that is used by this server

Definition at line 92 of file server.h.

References authenticator_.

Dv::Ticket::Ticket::Ref Dv::Ticket::Server::make_ticket const User user,
const std::string &  host,
size_t  duration
throw (Dv::Ticket::Exception)
 

Create and store a new ticket for a user.

Parameters:
user which is supposed to have been authenticated
host for which ticket will be valid, in dot notation (e.g. 134.184.65.2)
duration that ticket will be valid, in minutes.
Exceptions:
Dv::Ticket::Exception if anything goes wrong

Dv::Ticket::Ticket::Ref Dv::Ticket::Server::validate_ticket Dv::Ticket::Ticket::SERIAL  serial,
const std::string &  host
throw (Dv::Ticket::Exception)
 

Retrieve a ticket with a given serial number.

Parameters:
serial unique numeric ID of ticket
host that should be associated with the ticket
Exceptions:
Dv::Ticket::Exception if anything goes wrong, e.g. the ticket is no longer valid, or the ticket with the given id was issued for a different host.

void Dv::Ticket::Server::init const Dv::Xml::Node::Ref  config  )  throw (Dv::Ticket::Exception) [private]
 

Initialize a server.

Parameters:
config XML root node containing configuration info
Exceptions:
Dv::Ticket::Exception if anything goes wrong, e.g. config is not valid w.r.t config_dtd_fn.


Member Data Documentation

std::string Dv::Ticket::Server::dtd_dir_ [private]
 

name of directory containing relevant DTD files

Definition at line 123 of file server.h.

Referenced by dtd_dir().

std::string Dv::Ticket::Server::config_fn_ [private]
 

configuration file name

Definition at line 125 of file server.h.

Referenced by config_fn().

std::string Dv::Ticket::Server::config_dtd_fn_ [private]
 

configuration DTD file name

Definition at line 127 of file server.h.

Referenced by config_dtd_fn().

std::string Dv::Ticket::Server::request_dtd_fn_ [private]
 

request DTD file name

Definition at line 129 of file server.h.

Referenced by request_dtd_fn().

std::string Dv::Ticket::Server::log_fn_ [private]
 

log DTD file name

Definition at line 131 of file server.h.

Referenced by log_fn().

std::string Dv::Ticket::Server::cert_fn_ [private]
 

server certificate file name

Definition at line 133 of file server.h.

Referenced by cert_fn().

std::string Dv::Ticket::Server::key_fn_ [private]
 

server key file name

Definition at line 135 of file server.h.

Referenced by key_fn().

std::string Dv::Ticket::Server::pid_fn_ [private]
 

name of file containing server process ID

Definition at line 137 of file server.h.

Referenced by pid_fn().

int Dv::Ticket::Server::port_ [private]
 

port on which server is listening

Definition at line 140 of file server.h.

Referenced by port().

std::string Dv::Ticket::Server::host_ [private]
 

this host

Definition at line 142 of file server.h.

Referenced by host().

size_t Dv::Ticket::Server::client_delay_ [private]
 

delay that the server is prepared to wait for any communication from the client, in millisec

Definition at line 145 of file server.h.

Referenced by client_delay().

Dv::Ticket::Authenticator& Dv::Ticket::Server::authenticator_ [private]
 

reference to authentictor object that is used by this server

Definition at line 148 of file server.h.

Referenced by authenticator().

Dv::MySql::Db* Dv::Ticket::Server::db_ [private]
 

pointer to ticket database connection, never 0

Definition at line 150 of file server.h.

Referenced by db().

std::ostream* Dv::Ticket::Server::log_ [private]
 

pointer to log output stream, never 0

Definition at line 152 of file server.h.

Referenced by log().

Dv::Ssl::SslContextV23* Dv::Ticket::Server::ssl_context_ [private]
 

SSL context.

Definition at line 154 of file server.h.

Dv::Ssl::SslServerSocket* Dv::Ticket::Server::ssl_ss_ [private]
 

SSL server socket.

Definition at line 156 of file server.h.


The documentation for this class was generated from the following file:
dvticket-0.7.1 [24 October, 2003]