TOST 1.4 Extended Query Protocol
================================

Formulating a Query
===================

The syntax of this protocol is very similar to the classic query protocol. However,
it requires a password sent to the server together with every single query. 
A query is a simple UDP packet with the following content:

\<password>\<command>\[parameter]\

The password is the one you set in the GIDServer.ini file of your Server.
Currently the protocol supports two commands:

- To get a list of players in the game, together with their IP addresses, PGIDs, ...
use this query:

\<password>\players\

- If you want to execute a console command use this:
\<password>\console\<console command>\


Parsing the reply
=================

Replies always come in packets. The "console" command returns only one packet, while
the "player" command can return multiple packets. A single packet has the following syntax:

\<rule 1>\<value 1>\<rule 2>\<value 2>\...<rule n>\<value n\

the last packet of a query always contains a tailing   \final\

A console query has the following rules\values:

\<console command>\<console reply>\queryid\<query num>.<packet num>\final\

the console command is the command that was initially sent
console reply is the reply that the console gave to the command
queryid gives you information about to which query this packet belongs. in most cases you do not need this information.


\player_n\<player name>\ip_n\<players ip address>\pgid_n\<players pgid>\gid_age_n\<players GID age in hours>\ini_checksum_n\<players ini checksume>\queryid\<query num>.<packet num>\

n in the rule is substituted by the Player ID in the game
the last packet of a "players" query contains a tailing \final\

Restrictions
============

A misformulated (wrong syntax or wrong password) query will block *all* queries for the next 5 seconds.


Example PHP script to parse a reply
===================================

take a look at query_example.php 