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

Eris::Meta Class Reference

Meta encapsulates the meta-game system, including the meta-server protocol and queries. More...

#include <Metaserver.h>

List of all members.

Public Member Functions

 Meta (const std::string &cnm, const std::string &msv, unsigned int maxQueries)
ServerList getGameServerList ()
 Return the list of game servers.

int getGameServerCount ()
 Return the current size of the server list.

void queryServer (const std::string &host)
 Query a specific game server; emits a signal when complete.

void refresh ()
 Refresh the entire server list.

void cancel ()
 Cancel outstanding refresh / queries.

const std::string & getClientName () const
 Access the client name.

MetaStatus getStatus () const
 Get the current status of the Meta server list.


Public Attributes

SigC::Signal1< void, const
ServerInfo & > 
ReceivedServerInfo
 Emitted when information about a server is received.

SigC::Signal1< void, int > GotServerCount
 Emitted once the size of the server list is known.

SigC::Signal0< void > CompletedServerList
 Emitted when the entire server list has been refreshed.

SigC::Signal1< void, const
std::string & > 
Failure
 Indicates a failure (usually network related) has occurred.


Protected Types

typedef std::list< MetaQuery * > MetaQueryList
typedef std::map< std::string,
ServerInfo
ServerInfoMap

Protected Member Functions

virtual void objectArrived (const Atlas::Message::Element &msg)
void recv ()
 process raw UDP packets from the meta-server

void recvCmd (uint32_t op)
 Invoked when _bytesToRecv = 0 and expecting a command (_recvCmd = true).

void processCmd ()
 Invoked when _bytesToRecv = 0 and processing a command (_recvCmd = false).

void listReq (int offset=0)
 Request a portion of the server list from the meta-server.

void setupRecvCmd ()
void setupRecvData (int words, uint32_t got)
void doFailure (const std::string &msg)
void queryFailure (MetaQuery *q, const std::string &msg)
void queryTimeout (MetaQuery *q)
void metaTimeout ()
void connect ()
 initiate a connection to the meta-server : this will issue a keep-alive followed by a list request.

void disconnect ()
 tear down an existing connection to the server

void gotData (PollData &)

Protected Attributes

std::string _clientName
 the name to use when negotiating

MetaStatus _status
std::string _metaHost
MetaQueryList _activeQueries
MetaQueryList _deleteQueries
StringList _pendingQueries
unsigned int _maxActiveQueries
ServerInfoMap _gameServers
ServerInfoMap _lastValidList
udp_socket_stream * _stream
char _data [DATA_BUFFER_SIZE]
char * _dataPtr
 The current insert/extract pointer in the buffer.

unsigned int _bytesToRecv
 The number of bytes to read before processing / dispatch.

unsigned int _totalServers
 Total number of servers the Meta knows of.

unsigned int _packed
 The servers in the curent LIST_RESP.

bool _recvCmd
 true if the next block is a new command

uint32_t _gotCmd
 the curent command being processed

Timeout_timeout
 Metaserver channel timeout.


Detailed Description

Meta encapsulates the meta-game system, including the meta-server protocol and queries.


Member Function Documentation

void Eris::Meta::cancel  ) 
 

Cancel outstanding refresh / queries.

This is primarily intended for use with 'Refresh', which might takes several minutes to complete. Note that 'CompletedServerList' is not emitted following cancellation.

void Eris::Meta::listReq int  offset = 0  )  [protected]
 

Request a portion of the server list from the meta-server.

Parameters:
offset The first index to retrieve

void Eris::Meta::refresh  ) 
 

Refresh the entire server list.

This will clear the current list, ask the meta-server for each game server, and then issue a query against every returned server. This process can take a large amount of real-time as the number of game servers increases. Completion of the entire refresh is indicated by the 'CompletedServerList' signal.


Member Data Documentation

SigC::Signal1<void, const std::string&> Eris::Meta::Failure
 

Indicates a failure (usually network related) has occurred.

The server list will be cleared, and the status set to INVALID.


The documentation for this class was generated from the following files:
Generated on Thu Jul 29 08:12:34 2004 for Eris by doxygen 1.3.7