eris 1.4.0
A WorldForge client library.
Eris::MetaQuery Class Reference

#include <MetaQuery.h>

Inheritance diagram for Eris::MetaQuery:
Collaboration diagram for Eris::MetaQuery:

Public Types

enum  Status {
  INVALID_STATUS = 0 , NEGOTIATE , CONNECTING , CONNECTED ,
  DISCONNECTED , DISCONNECTING , QUERY_GET
}
 possible states for the connection More...
 

Public Member Functions

 MetaQuery (boost::asio::io_service &io_service, Atlas::Bridge &bridge, Meta &meta, const std::string &host, size_t index)
 
std::int64_t getQueryNo () const
 return the serial-number of the query GET operation [for identification of replies] More...
 
size_t getServerIndex () const
 
long getElapsed ()
 Access the elapsed time (in millseconds) since the query was issued. More...
 
bool isComplete () const
 
virtual int connectRemote (const std::string &host, short port)
 
virtual int connectLocal (const std::string &socket)
 
Status getStatus () const
 get the current status of the connection More...
 
bool isConnected () const
 Ascertain whether or not the connection is usable for transport. More...
 
const std::string & getHost () const
 
short getPort () const
 
Atlas::Objects::Factories & getFactories ()
 
const Atlas::Objects::Factories & getFactories () const
 

Public Attributes

sigc::signal< void > Connected
 sent on successful negotiation of a game server connection More...
 
sigc::signal< void > Disconnected
 final disconnect (or hard disocnnect) notifcation More...
 

Protected Member Functions

void setComplete ()
 
void onConnect () override
 Over-ride the default connection behaviour to issue the query. More...
 
void handleFailure (const std::string &msg) override
 derived-class notification when a failure occurs More...
 
void handleTimeout (const std::string &msg) override
 
void onQueryTimeout ()
 
void dispatch () override
 
void stateChanged (StreamSocket::Status status)
 
virtual void setStatus (Status sc)
 update the connection status and generate signals More...
 
void onConnectTimeout ()
 
void onNegotiateTimeout ()
 
void hardDisconnect (bool emit)
 

Protected Attributes

Meta_meta
 The Meta-server object which owns the query. More...
 
std::int64_t _queryNo
 The serial number of the query GET. More...
 
WFMath::TimeStamp _stamp
 Time stamp of the request, to estimate ping to server. More...
 
size_t m_serverIndex
 
bool m_complete
 
boost::asio::steady_timer m_completeTimer
 
boost::asio::io_service & _io_service
 
std::unique_ptr< Atlas::Objects::Factories > _factories
 
std::shared_ptr< StreamSocket_socket
 
Status _status
 current status of the connection More...
 
const std::string _id
 a unique identifier for this connection More...
 
std::string _clientName
 the client identified used during connection More...
 
Atlas::Bridge * _bridge
 
std::string _host
 the host name we're connected to More...
 
short _port
 the port we're connected to More...
 

Friends

class Meta
 

Detailed Description

MetaQuery is a temporary connection used to retrieve information about a game server. It issues an anoymous GET operation, and expects to receive an INFO operation containing a 'server' entity in response. This entity contains attributes such as the ruleset, uptime, number of connectec players and so on. In addition, MetaQuery tracks the time the server takes to response, and this estimates the server's ping. This time also includes server latency.

Definition at line 20 of file MetaQuery.h.

Member Enumeration Documentation

◆ Status

possible states for the connection

Enumerator
INVALID_STATUS 

indicates an illegal state

NEGOTIATE 

Atlas negotiation in progress.

CONNECTING 

stream / socket connection in progress

CONNECTED 

connection fully established

DISCONNECTED 

finished disconnection

DISCONNECTING 

clean disconnection in progress

QUERY_GET 

meta-query performing GET operation

Definition at line 55 of file BaseConnection.h.

Constructor & Destructor Documentation

◆ MetaQuery()

Eris::MetaQuery::MetaQuery ( boost::asio::io_service &  io_service,
Atlas::Bridge &  bridge,
Meta meta,
const std::string &  host,
size_t  index 
)

Definition at line 22 of file MetaQuery.cpp.

Member Function Documentation

◆ connectLocal()

int Eris::BaseConnection::connectLocal ( const std::string &  socket)
virtualinherited

◆ connectRemote()

int Eris::BaseConnection::connectRemote ( const std::string &  host,
short  port 
)
virtualinherited

◆ dispatch()

void Eris::MetaQuery::dispatch ( )
overrideprotectedvirtual

Implements Eris::BaseConnection.

Definition at line 64 of file MetaQuery.cpp.

◆ getElapsed()

long Eris::MetaQuery::getElapsed ( )

Access the elapsed time (in millseconds) since the query was issued.

Definition at line 68 of file MetaQuery.cpp.

◆ getFactories() [1/2]

Atlas::Objects::Factories & Eris::BaseConnection::getFactories ( )
inherited

Definition at line 213 of file BaseConnection.cpp.

◆ getFactories() [2/2]

const Atlas::Objects::Factories & Eris::BaseConnection::getFactories ( ) const
inherited

Definition at line 217 of file BaseConnection.cpp.

◆ getHost()

const std::string & Eris::BaseConnection::getHost ( ) const
inherited

Gets the host of the connection.

Returns
The host of the connection.

Definition at line 203 of file BaseConnection.cpp.

References Eris::BaseConnection::_host.

◆ getPort()

short Eris::BaseConnection::getPort ( ) const
inherited

Gets the port of the connection.

Returns
The port of the connection.

Definition at line 208 of file BaseConnection.cpp.

References Eris::BaseConnection::_port.

◆ getQueryNo()

std::int64_t Eris::MetaQuery::getQueryNo ( ) const
inline

return the serial-number of the query GET operation [for identification of replies]

Definition at line 66 of file MetaQuery.h.

References _queryNo.

◆ getServerIndex()

size_t Eris::MetaQuery::getServerIndex ( ) const
inline

Definition at line 70 of file MetaQuery.h.

◆ getStatus()

Status Eris::BaseConnection::getStatus ( ) const
inlineinherited

get the current status of the connection

Definition at line 68 of file BaseConnection.h.

References Eris::BaseConnection::_status.

◆ handleFailure()

void Eris::MetaQuery::handleFailure ( const std::string &  msg)
overrideprotectedvirtual

derived-class notification when a failure occurs

Implements Eris::BaseConnection.

Definition at line 72 of file MetaQuery.cpp.

◆ handleTimeout()

void Eris::MetaQuery::handleTimeout ( const std::string &  msg)
overrideprotectedvirtual

Implements Eris::BaseConnection.

Definition at line 76 of file MetaQuery.cpp.

◆ hardDisconnect()

void Eris::BaseConnection::hardDisconnect ( bool  emit)
protectedinherited

◆ isComplete()

bool Eris::MetaQuery::isComplete ( ) const
inline

Definition at line 74 of file MetaQuery.h.

◆ isConnected()

◆ onConnect()

void Eris::MetaQuery::onConnect ( )
overrideprotectedvirtual

Over-ride the default connection behaviour to issue the query.

Reimplemented from Eris::BaseConnection.

Definition at line 40 of file MetaQuery.cpp.

References Eris::getNewSerialno().

◆ onConnectTimeout()

void Eris::BaseConnection::onConnectTimeout ( )
protectedinherited

Definition at line 184 of file BaseConnection.cpp.

◆ onNegotiateTimeout()

void Eris::BaseConnection::onNegotiateTimeout ( )
protectedinherited

Definition at line 192 of file BaseConnection.cpp.

◆ onQueryTimeout()

void Eris::MetaQuery::onQueryTimeout ( )
protected

Definition at line 80 of file MetaQuery.cpp.

◆ setComplete()

void Eris::MetaQuery::setComplete ( )
protected

Definition at line 84 of file MetaQuery.cpp.

◆ setStatus()

void Eris::BaseConnection::setStatus ( Status  sc)
protectedvirtualinherited

update the connection status and generate signals

Reimplemented in Eris::Connection.

Definition at line 198 of file BaseConnection.cpp.

References Eris::BaseConnection::_status.

Referenced by Eris::BaseConnection::connectLocal(), Eris::BaseConnection::connectRemote(), and Eris::BaseConnection::hardDisconnect().

◆ stateChanged()

void Eris::BaseConnection::stateChanged ( StreamSocket::Status  status)
protectedinherited

Definition at line 125 of file BaseConnection.cpp.

Friends And Related Function Documentation

◆ Meta

friend class Meta
friend

Definition at line 40 of file MetaQuery.h.

Member Data Documentation

◆ _bridge

Atlas::Bridge* Eris::BaseConnection::_bridge
protectedinherited

the connection bridge (i.e something implementing objectArrived()) : this can be the derived class itself, or any other object

Definition at line 139 of file BaseConnection.h.

Referenced by Eris::Connection::Connection(), Eris::BaseConnection::connectLocal(), and Eris::BaseConnection::connectRemote().

◆ _clientName

std::string Eris::BaseConnection::_clientName
protectedinherited

the client identified used during connection

Definition at line 135 of file BaseConnection.h.

Referenced by Eris::BaseConnection::connectLocal(), and Eris::BaseConnection::connectRemote().

◆ _factories

std::unique_ptr<Atlas::Objects::Factories> Eris::BaseConnection::_factories
protectedinherited

Definition at line 129 of file BaseConnection.h.

◆ _host

std::string Eris::BaseConnection::_host
protectedinherited

the host name we're connected to

Definition at line 141 of file BaseConnection.h.

Referenced by Eris::BaseConnection::getHost().

◆ _id

const std::string Eris::BaseConnection::_id
protectedinherited

a unique identifier for this connection

Definition at line 133 of file BaseConnection.h.

◆ _io_service

boost::asio::io_service& Eris::BaseConnection::_io_service
protectedinherited

Definition at line 128 of file BaseConnection.h.

◆ _meta

Meta& Eris::MetaQuery::_meta
protected

The Meta-server object which owns the query.

Definition at line 56 of file MetaQuery.h.

◆ _port

short Eris::BaseConnection::_port
protectedinherited

the port we're connected to

Definition at line 142 of file BaseConnection.h.

Referenced by Eris::BaseConnection::getPort().

◆ _queryNo

std::int64_t Eris::MetaQuery::_queryNo
protected

The serial number of the query GET.

Definition at line 58 of file MetaQuery.h.

Referenced by getQueryNo().

◆ _socket

std::shared_ptr<StreamSocket> Eris::BaseConnection::_socket
protectedinherited

Definition at line 130 of file BaseConnection.h.

◆ _stamp

WFMath::TimeStamp Eris::MetaQuery::_stamp
protected

Time stamp of the request, to estimate ping to server.

Definition at line 59 of file MetaQuery.h.

◆ _status

◆ Connected

sigc::signal<void> Eris::BaseConnection::Connected
inherited

sent on successful negotiation of a game server connection

Definition at line 95 of file BaseConnection.h.

Referenced by Eris::Account::Account(), and Eris::BaseConnection::onConnect().

◆ Disconnected

sigc::signal<void> Eris::BaseConnection::Disconnected
inherited

final disconnect (or hard disocnnect) notifcation

Definition at line 98 of file BaseConnection.h.

Referenced by Eris::BaseConnection::hardDisconnect().

◆ m_complete

bool Eris::MetaQuery::m_complete
protected

Definition at line 61 of file MetaQuery.h.

◆ m_completeTimer

boost::asio::steady_timer Eris::MetaQuery::m_completeTimer
protected

Definition at line 62 of file MetaQuery.h.

◆ m_serverIndex

size_t Eris::MetaQuery::m_serverIndex
protected

Definition at line 60 of file MetaQuery.h.


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