Edinburgh Speech Tools  2.1-release
EST_Server Class Reference

Client-server interface. More...

#include <include/EST_Server.h>

Inheritance diagram for EST_Server:

Classes

class  BufferedSocket
 
class  RequestHandler
 
class  ResultHandler
 

Public Types

enum  Mode {
  sm_unknown = 0, sm_client = 1, sm_sequential = 2, sm_interleaved =3,
  sm_fork = 4, sm_threded = 5
}
 What type of server is this. More...
 
typedef EST_Features Args
 
typedef EST_Features Result
 

Public Member Functions

virtual ~EST_Server ()
 Destroy the connection. More...
 
virtual bool parse_command (const EST_String command, EST_String &package, EST_String &operation, Args &arguments)
 
virtual EST_String build_command (const EST_String package, const EST_String operation, const Args &arguments)
 
virtual bool parse_result (const EST_String resultString, Result &res)
 
virtual EST_String build_result (const Result &res)
 
bool execute (const EST_String package, const EST_String operation, const Args &arguments, ResultHandler &handler)
 
bool execute (const EST_String command, ResultHandler &handler)
 
void run (RequestHandler &handler)
 
Client end constructors.
 EST_Server (EST_String name, EST_String type)
 Create a server connection by name, defaulting to "fringe", the default server name. More...
 
 EST_Server (EST_String name, EST_String type, ostream *trace)
 
 EST_Server (EST_String hostname, int port)
 Create a server connection by explicitly saying where to connect to. More...
 
 EST_Server (EST_String hostname, int port, ostream *trace)
 
Server end constructors
 EST_Server (Mode mode, EST_String name, EST_String type)
 
 EST_Server (Mode mode, EST_String name, EST_String type, ostream *trace)
 
information about the server.
const EST_String name (void) const
 Name of server. More...
 
const EST_String type (void) const
 Type of server. More...
 
const EST_String hostname (void) const
 Domain name of the server. More...
 
const EST_String address (void) const
 Dotted numeric IP address. More...
 
const EST_String servername (void) const
 Domain name or IP number. More...
 
int port (void) const
 Port number. More...
 
connection management
EST_connect_status connect (void)
 Connect to the server. More...
 
bool connected (void)
 Are we connected at the moment? More...
 
EST_connect_status disconnect (void)
 Disconnect. More...
 

Protected Member Functions

void write (BufferedSocket &s, const EST_String string, const EST_String term="")
 
EST_String read_data (BufferedSocket &s, const EST_String end, int &eof)
 
bool check_cookie (BufferedSocket &socket)
 
bool process_command (BufferedSocket &socket, EST_String command, RequestHandler &handler)
 
void handle_client (BufferedSocket &socket, RequestHandler &handler)
 
void return_error (BufferedSocket &socket, EST_String err)
 
void return_value (BufferedSocket &socket, Result &res, bool last)
 
void run_sequential (RequestHandler &handler)
 

Detailed Description

Client-server interface.

An EST_Server object represents a server, it can be at either end of a network connection. That is, a server process has an EST_Server object representing it's wait-dispatch-answer loop, while a client process has an EST_Server object which represents the server process.

Author
Richard Caley rjc@c.nosp@m.str..nosp@m.ed.ac.nosp@m..uk
Version
Id
EST_Server.h,v 1.4 2004/05/04 00:00:16 awb Exp

Definition at line 53 of file EST_Server.h.

Member Typedef Documentation

Definition at line 73 of file EST_Server.h.

Definition at line 74 of file EST_Server.h.

Member Enumeration Documentation

What type of server is this.

Enumerator
sm_unknown 

Bizarre state.

sm_client 

Client end of the connection.

sm_sequential 

Answer one client at a time.

sm_interleaved 

Answer requests from several clients, as requests arrive.

sm_fork 

For off a process for each client.

sm_threded 

Multi-threaded (not implemented)

Definition at line 58 of file EST_Server.h.

Constructor & Destructor Documentation

EST_Server::EST_Server ( EST_String  name,
EST_String  type 
)

Create a server connection by name, defaulting to "fringe", the default server name.

EST_Server::EST_Server ( EST_String  name,
EST_String  type,
ostream *  trace 
)
EST_Server::EST_Server ( EST_String  hostname,
int  port 
)

Create a server connection by explicitly saying where to connect to.

EST_Server::EST_Server ( EST_String  hostname,
int  port,
ostream *  trace 
)
EST_Server::EST_Server ( Mode  mode,
EST_String  name,
EST_String  type 
)
EST_Server::EST_Server ( Mode  mode,
EST_String  name,
EST_String  type,
ostream *  trace 
)
virtual EST_Server::~EST_Server ( )
virtual

Destroy the connection.

Member Function Documentation

void EST_Server::write ( BufferedSocket s,
const EST_String  string,
const EST_String  term = "" 
)
protected
EST_String EST_Server::read_data ( BufferedSocket s,
const EST_String  end,
int eof 
)
protected
bool EST_Server::check_cookie ( BufferedSocket socket)
protected
bool EST_Server::process_command ( BufferedSocket socket,
EST_String  command,
RequestHandler handler 
)
protected
void EST_Server::handle_client ( BufferedSocket socket,
RequestHandler handler 
)
protected
void EST_Server::return_error ( BufferedSocket socket,
EST_String  err 
)
protected
void EST_Server::return_value ( BufferedSocket socket,
Result res,
bool  last 
)
protected
void EST_Server::run_sequential ( RequestHandler handler)
protected
const EST_String EST_Server::name ( void  ) const

Name of server.

const EST_String EST_Server::type ( void  ) const

Type of server.

const EST_String EST_Server::hostname ( void  ) const

Domain name of the server.

const EST_String EST_Server::address ( void  ) const

Dotted numeric IP address.

const EST_String EST_Server::servername ( void  ) const

Domain name or IP number.

int EST_Server::port ( void  ) const

Port number.

EST_connect_status EST_Server::connect ( void  )

Connect to the server.

bool EST_Server::connected ( void  )

Are we connected at the moment?

EST_connect_status EST_Server::disconnect ( void  )

Disconnect.

virtual bool EST_Server::parse_command ( const EST_String  command,
EST_String package,
EST_String operation,
Args arguments 
)
virtual

Reimplemented in EST_FringeServer.

virtual EST_String EST_Server::build_command ( const EST_String  package,
const EST_String  operation,
const Args arguments 
)
virtual

Reimplemented in EST_FringeServer.

virtual bool EST_Server::parse_result ( const EST_String  resultString,
Result res 
)
virtual

Reimplemented in EST_FringeServer.

virtual EST_String EST_Server::build_result ( const Result res)
virtual

Reimplemented in EST_FringeServer.

bool EST_Server::execute ( const EST_String  package,
const EST_String  operation,
const Args arguments,
ResultHandler handler 
)
bool EST_Server::execute ( const EST_String  command,
ResultHandler handler 
)
void EST_Server::run ( RequestHandler handler)

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