GameServer Class Reference

Provides tools to query game servers. More...

#include <gameserver.h>

Inheritance diagram for GameServer:

Plugin

List of all members.

Public Member Functions

 GameServer (BotKernel *)
 Constructor.
long strToLong (string)
 Convert a string to a long (seems fucked).
string getHLstring (unsigned int *, char *)
 Get a string in HL1 protocol.
char getHLbyte (unsigned int *, char *)
 Get a byte in HL1 protocol.
string getHLlong (unsigned int *, char *)
 Get a long in HL1 protocol (as a string).
bool getHL1Players (vector< string > *, char *)
 Get players list in HL1 protocol.
bool getHL1Challenge (string *, char *)
 Get HL1 challenge.
bool getHL1Infos (map< string, string > *, char *)
 Get HL1 server's settings.
string getQ3GameType (string)
 Get a Q3 gametype according to a number.
bool parseWSWinfos (map< string, string > *, vector< string > *, char *)
 Get warsow server's infos (settings and players).
bool parseQ3infos (map< string, string > *, vector< string > *, char *)
 Get Q3 server's infos (settings and players).
bool sendQuery (string, string, int *, string)
 Send a query to a server.
string getResult (int, char *)
 Get a result from a server.


Detailed Description

Provides tools to query game servers.

Provides tools to query game servers

Definition at line 44 of file gameserver.h.


Constructor & Destructor Documentation

GameServer::GameServer ( BotKernel b  ) 

Constructor.

Constructor

Definition at line 34 of file gameserver.cpp.

References Plugin::author, Plugin::bindFunction(), Plugin::description, IN_COMMAND_HANDLER, Plugin::name, and Plugin::version.


Member Function Documentation

bool GameServer::getHL1Challenge ( string *  challenge,
char *  datas 
)

Get HL1 challenge.

Get challenge in HL1 protocol

Parameters:
challenge string that will contain the challenge
datas Datas to read
Postcondition:
Challenge is updated
Returns:
True if protocol OK, else false

Definition at line 141 of file gameserver.cpp.

References getHLbyte(), and getHLlong().

Referenced by hl().

bool GameServer::getHL1Infos ( map< string, string > *  settings,
char *  datas 
)

Get HL1 server's settings.

Get HL server's info in HL1 protocol

Parameters:
settings Map that will contain settings
datas Datas to read
Postcondition:
Settings are set
Returns:
True if protocol OK, else false

Definition at line 156 of file gameserver.cpp.

References getHLbyte(), getHLlong(), and getHLstring().

Referenced by hl().

bool GameServer::getHL1Players ( vector< string > *  players,
char *  datas 
)

Get players list in HL1 protocol.

Get players list in HL1 protocol

Parameters:
players players list to fill
datas Datas to read
Postcondition:
Players list is updated
Returns:
True if protocol OK, else false

Definition at line 120 of file gameserver.cpp.

References getHLbyte(), and getHLstring().

Referenced by hl().

char GameServer::getHLbyte ( unsigned int *  index,
char *  datas 
)

Get a byte in HL1 protocol.

Get a byte in HL1 protocol Read only one byte

Parameters:
index Index to read datas
datas Datas to read
Postcondition:
The index is updated
Returns:
The byte

Definition at line 92 of file gameserver.cpp.

Referenced by getHL1Challenge(), getHL1Infos(), and getHL1Players().

string GameServer::getHLlong ( unsigned int *  index,
char *  datas 
)

Get a long in HL1 protocol (as a string).

Get a long in HL1 protocol

Parameters:
index Index to read datas
datas Datas to read
Postcondition:
The index is updated
Returns:
The long data

Definition at line 104 of file gameserver.cpp.

Referenced by getHL1Challenge(), and getHL1Infos().

string GameServer::getHLstring ( unsigned int *  index,
char *  datas 
)

Get a string in HL1 protocol.

Get a string in HL1 protocol Read datas until a 0x00 char is found

Parameters:
index Index to read datas
datas Datas to read
Postcondition:
The index is updated
Returns:
The string

Definition at line 73 of file gameserver.cpp.

Referenced by getHL1Infos(), and getHL1Players().

string GameServer::getQ3GameType ( string  number  ) 

Get a Q3 gametype according to a number.

Get a Q3 gametype according to a number

Parameters:
number gametype number
Returns:
Gametype string

Definition at line 192 of file gameserver.cpp.

Referenced by q3().

string GameServer::getResult ( int  sock,
char *  buffer 
)

Get a result from a server.

Get a UDP result from a server

Precondition:
A query has been sended
Parameters:
sock Socket used for communication
buffer Buffer that will contain result (answer)
Returns:
A string containing "0" is everything is OK, else contain the error that occured

Definition at line 301 of file gameserver.cpp.

References MAX_CHARS.

Referenced by hl(), q3(), and warsow().

bool GameServer::parseQ3infos ( map< string, string > *  settings,
vector< string > *  players,
char *  datas 
)

Get Q3 server's infos (settings and players).

Parse datas to extract settings and players from a Q3 server

Parameters:
settings map that will contain settings
players vector that will contain players
datas Datas to read
Postcondition:
players and settings are set
Returns:
True if protocol OK, else false

Definition at line 248 of file gameserver.cpp.

References Tools::parseQ3Colors(), and Tools::stringToVector().

Referenced by q3().

bool GameServer::parseWSWinfos ( map< string, string > *  settings,
vector< string > *  players,
char *  datas 
)

Get warsow server's infos (settings and players).

Parse datas to extract settings and players from a warsow server

Parameters:
settings map that will contain settings
players vector that will contain players
datas Datas to read
Postcondition:
players and settings are set
Returns:
True if protocol OK, else false

Definition at line 220 of file gameserver.cpp.

References Tools::parseQ3Colors(), and Tools::stringToVector().

Referenced by warsow().

bool GameServer::sendQuery ( string  ip,
string  port,
int *  sock,
string  query 
)

Send a query to a server.

Send a UDP query to a server

Parameters:
ip Server' ip
port Server's posrt
sock Pointer to a socket
query Query to send
Postcondition:
The socket is opened
Returns:
True if send OK, else false

Definition at line 274 of file gameserver.cpp.

References Tools::strToInt().

Referenced by hl(), q3(), and warsow().

long GameServer::strToLong ( string  str  ) 

Convert a string to a long (seems fucked).

Convert a string to a long (seems fucked) /!\ DOESN'T WORK /!\

Parameters:
str String to convert
Returns:
Number corresponding to the string

Definition at line 53 of file gameserver.cpp.


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

Generated on Sun Aug 16 15:28:41 2009 for trustyRC by  doxygen 1.5.8