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

Dv::Ticket::Ticket Class Reference

Class representing a ticket. More...

#include <ticket.h>

Collaboration diagram for Dv::Ticket::Ticket:

Collaboration graph
[legend]
List of all members.

Public Types

typedef unsigned long SERIAL
 Type of serial number of ticket.

typedef Dv::Util::ref< Dv::Ticket::TicketRef
 Type of reference-counted pointer to ticket.


Public Member Functions

const Useruser () const
SERIAL serial () const
const Dv::Util::Dateexpiration_date () const
const std::string & server_host () const
const int server_port () const
const std::string & owner_host () const
Dv::Xml::Node xml (const std::string &name="ticket") const
 Return an XML representation of a ticket.


Static Public Member Functions

Ref buy (const std::string &host, int port, const std::string &name, const std::string &password, const std::string &info="", size_t duration=30) throw ()
 Obtain a new ticket from a ticket server.

Ref buy (const std::string &client_host, const std::string &server_host, int port, const std::string &name, const std::string &password, const std::string &info="", size_t duration=30) throw ()
 Obtain a new ticket from a ticket server.

Ref buy_anon (const std::string &host, int port, const std::string &name="anonymous", const std::string &info="", size_t duration=30) throw ()
 Buy an anonymous ticket from a ticket server.

Ref validate (const std::string &server_host, int server_port, SERIAL serial) throw ()
 Obtain a ticket by validating a serial number with a ticket server.

Ref validate (const std::string &server_host, int server_port, const std::string &host, SERIAL serial) throw ()
 Obtain a ticket by validating a serial number with a ticket server.


Private Member Functions

 Ticket (const Ticket &)
 Copy ctor is forbidden.

Ticketoperator= (const Ticket &)
 Assignment is forbidden.

 Ticket (const User &user, SERIAL serial, Dv::Util::Date expiration_date, const std::string &server_host, int server_port, const std::string &owner_host) throw ()
 Simple ctor.

 Ticket (const Dv::Xml::Node::Ref &root, const std::string &server_host, int server_port)
 Simple ctor.


Private Attributes

User user_
 User to whom this ticket was issued.

SERIAL serial_
 Unique serial number of this ticket.

Dv::Util::Date expiration_date_
 Expiration date for this ticket.

std::string server_host_
 Host of server that issued this ticket.

int server_port_
 Port of server that issued this ticket.

std::string owner_host_
 Name of host for which this ticket is valid.


Friends

class Server

Detailed Description

Class representing a ticket.

Definition at line 19 of file ticket.h.


Member Typedef Documentation

typedef unsigned long Dv::Ticket::Ticket::SERIAL
 

Type of serial number of ticket.

Definition at line 25 of file ticket.h.

Referenced by serial().

typedef Dv::Util::ref<Dv::Ticket::Ticket> Dv::Ticket::Ticket::Ref
 

Type of reference-counted pointer to ticket.

Definition at line 27 of file ticket.h.


Constructor & Destructor Documentation

Dv::Ticket::Ticket::Ticket const Ticket  )  [private]
 

Copy ctor is forbidden.

Dv::Ticket::Ticket::Ticket const User user,
SERIAL  serial,
Dv::Util::Date  expiration_date,
const std::string &  server_host,
int  server_port,
const std::string &  owner_host
throw () [inline, private]
 

Simple ctor.

Parameters:
user which is supposed to have been authenticated
serial unique numeric ID of ticket
expiration_date when ticket expires
server_host host of server issuing ticket
server_port host of server issuing ticket
owner_host host for which this ticket is valid (in dot notation)

Definition at line 138 of file ticket.h.

Dv::Ticket::Ticket::Ticket const Dv::Xml::Node::Ref root,
const std::string &  server_host,
int  server_port
[private]
 

Simple ctor.

Parameters:
root Xml node containing XML representation of ticket
server_host host of server issuing ticket
server_port host of server issuing ticket
Exceptions:
std::exception if xml node is not correct format


Member Function Documentation

const User& Dv::Ticket::Ticket::user  )  const [inline]
 

Returns:
Owner of this ticket.

Definition at line 30 of file ticket.h.

References user_.

SERIAL Dv::Ticket::Ticket::serial  )  const [inline]
 

Returns:
Serial number of this ticket.

Definition at line 32 of file ticket.h.

References SERIAL, and serial_.

const Dv::Util::Date& Dv::Ticket::Ticket::expiration_date  )  const [inline]
 

Returns:
expiration date of this ticket

Definition at line 34 of file ticket.h.

References expiration_date_.

const std::string& Dv::Ticket::Ticket::server_host  )  const [inline]
 

Returns:
host of server that issued this ticket

Definition at line 36 of file ticket.h.

References server_host_.

const int Dv::Ticket::Ticket::server_port  )  const [inline]
 

Returns:
port of server that issued this ticket

Definition at line 38 of file ticket.h.

References server_port_.

const std::string& Dv::Ticket::Ticket::owner_host  )  const [inline]
 

Returns:
host for which this ticket is valid

Definition at line 40 of file ticket.h.

References owner_host_.

Dv::Xml::Node Dv::Ticket::Ticket::xml const std::string &  name = "ticket"  )  const
 

Return an XML representation of a ticket.

Parameters:
name to be used as the root tag
Returns:
root node of XML representation

Ref Dv::Ticket::Ticket::buy const std::string &  host,
int  port,
const std::string &  name,
const std::string &  password,
const std::string &  info = "",
size_t  duration = 30
throw () [static]
 

Obtain a new ticket from a ticket server.

Parameters:
host name of ticket server
port on which ticket server is listening
name of user to obtain ticket for
password of user to obtain ticket for
info to be added to (user date member) in ticket
duration (in minutes) that ticket should remain valid.
Returns:
a reference-counted pointer to a valid ticket, or a nil pointer.
See also:
Dv::Ticket::Authenticator

Ref Dv::Ticket::Ticket::buy const std::string &  client_host,
const std::string &  server_host,
int  port,
const std::string &  name,
const std::string &  password,
const std::string &  info = "",
size_t  duration = 30
throw () [static]
 

Obtain a new ticket from a ticket server.

This function explicitly specifies the client host, which may be different from the host on which this function is called. It is useful e.g. for general "login" cgi programs. Such programs avoid user programs to deal with passwords.

Parameters:
client_host name of ticket server
server_host name of ticket server
port on which ticket server is listening
name of user to obtain ticket for
password of user to obtain ticket for
info to be added to (user date member) in ticket
duration (in minutes) that ticket should remain valid.
Returns:
a reference-counted pointer to a valid ticket, or a nil pointer.
Warning:
This function must be called from the same host as the one running the ticket server.
See also:
Dv::Ticket::Authenticator

Ref Dv::Ticket::Ticket::buy_anon const std::string &  host,
int  port,
const std::string &  name = "anonymous",
const std::string &  info = "",
size_t  duration = 30
throw () [static]
 

Buy an anonymous ticket from a ticket server.

Parameters:
host name of ticket server
port on which ticket server is listening
name of user to obtain ticket for
info to be added to (user date member) in ticket
duration (in minutes) that ticket should remain valid.
Returns:
a reference-counted pointer to a valid ticket, or a nil pointer. The ticket user will have "anonymous" as its category.
See also:
Dv::Ticket::User

Dv::Ticket::Authenticator

Ref Dv::Ticket::Ticket::validate const std::string &  server_host,
int  server_port,
SERIAL  serial
throw () [static]
 

Obtain a ticket by validating a serial number with a ticket server.

Parameters:
server_host name of ticket server
server_port on which ticket server is listening
serial number of previously obtained ticket
Returns:
a reference-counted pointer to a valid ticket, or a nil pointer.

Ref Dv::Ticket::Ticket::validate const std::string &  server_host,
int  server_port,
const std::string &  host,
SERIAL  serial
throw () [static]
 

Obtain a ticket by validating a serial number with a ticket server.

Parameters:
server_host name of ticket server
server_port on which ticket server is listening
host dot address of owner host of ticket
serial number of previously obtained ticket
Returns:
a reference-counted pointer to a valid ticket, or a nil pointer.

Ticket& Dv::Ticket::Ticket::operator= const Ticket  )  [private]
 

Assignment is forbidden.


Friends And Related Function Documentation

friend class Server [friend]
 

Definition at line 20 of file ticket.h.


Member Data Documentation

User Dv::Ticket::Ticket::user_ [private]
 

User to whom this ticket was issued.

Definition at line 153 of file ticket.h.

Referenced by user().

SERIAL Dv::Ticket::Ticket::serial_ [private]
 

Unique serial number of this ticket.

Definition at line 157 of file ticket.h.

Referenced by serial().

Dv::Util::Date Dv::Ticket::Ticket::expiration_date_ [private]
 

Expiration date for this ticket.

Definition at line 159 of file ticket.h.

Referenced by expiration_date().

std::string Dv::Ticket::Ticket::server_host_ [private]
 

Host of server that issued this ticket.

Definition at line 161 of file ticket.h.

Referenced by server_host().

int Dv::Ticket::Ticket::server_port_ [private]
 

Port of server that issued this ticket.

Definition at line 163 of file ticket.h.

Referenced by server_port().

std::string Dv::Ticket::Ticket::owner_host_ [private]
 

Name of host for which this ticket is valid.

Definition at line 165 of file ticket.h.

Referenced by owner_host().


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