Q2 UTIL DLL
===========

All the code was written by Mark Davies. You may use the code as you
wish to but please credit me if you do.


Functions
=========


C Functions
===========


const SERVER *pingQ2ServerInfo( const char *pServerAddress )
------------------------------------------------------------

Pings the server specified by the pServerAddress string.
The string can hold the server address/I.P. and an optional port number, 
e.g. "192.168.0.2", "192.168.0.2:21910", "games.blah.com", "games.blah.com:27910"

The results are stored in the DLL and a pointer to the Server's info
is returned. If a ping of -1 is recorded then the information could
not be obtained. A NULL can be returned.

const SERVER *getQ2ServerInfo( const char *pServerAddress )
-----------------------------------------------------------

This function queries the DLL for information already obtained. The
parameter is the same as the above function as are the return values.
A NULL can be returned.


VB Functions
============


The Defs.bas file contains the function definitions.

Declare Function VB_pingQ2ServerInfo Lib "q2_util" (ByVal pServerAddress As String) As Long
Declare Function VB_getQ2ServerInfo_Addr Lib "q2_util" (ByVal pDest As String, ByVal dest_len As Long, ByVal pServerAddress As String) As Long
Declare Function VB_getQ2ServerInfo_IP Lib "q2_util" (ByVal pDest As String, ByVal dest_len As Long, ByVal pServerAddress As String) As Long
Declare Function VB_getQ2ServerInfo_Port Lib "q2_util" (ByRef pDest As Long, ByVal pServerAddress As String) As Long
Declare Function VB_getQ2ServerInfo_Ping Lib "q2_util" (ByRef pDest As Long, ByVal pServerAddress As String) As Long
Declare Function VB_getQ2ServerInfo_Resp Lib "q2_util" (ByVal pDest As String, ByVal dest_len As Long, ByVal pServerAddress As String) As Long


VB_pingQ2ServerInfo( pServerAddress )
-------------------------------------

Pings the server specified by the pServerAddress string.
The string can hold the server address/I.P. and an optional port number, 
e.g. "192.168.0.2", "192.168.0.2:21910", "games.blah.com", "games.blah.com:27910"

The results are stored in the DLL. The function will return 0 if a
internal failure occurred. This function can still return non-zero if
information could not be obtained. If a ping of -1 is recorded then
the information could not be obtained.

VB_getQ2ServerInfo_Addr( pDest, dest_len, pServerAddress )
----------------------------------------------------------

This function queries the DLL for information already obtained. The
pServerAddress parameter is the same as the above function. Zero will
be returned if the information could not be obtained. If information
does exist in the DLL then pDest will be filled with the Server
Address information. dest_len must hold the length of of the string
buffer pDest.


VB_getQ2ServerInfo_IP( pDest, dest_len, pServerAddress )
--------------------------------------------------------

This function queries the DLL for information already obtained. The
pServerAddress parameter is the same as the above function. Zero will
be returned if the information could not be obtained. If information
does exist in the DLL then pDest will be filled with the Server
IP information. dest_len must hold the length of of the string
buffer pDest.

VB_getQ2ServerInfo_Port( pDest, pServerAddress )
------------------------------------------------

This function queries the DLL for information already obtained. The
pServerAddress parameter is the same as the above function. Zero will
be returned if the information could not be obtained. If information
does exist in the DLL then pDest will be filled with the Server
Port information.


VB_getQ2ServerInfo_Ping( pDest, pServerAddress )
------------------------------------------------

This function queries the DLL for information already obtained. The
pServerAddress parameter is the same as the above function. Zero will
be returned if the information could not be obtained. If information
does exist in the DLL then pDest will be filled with the Server
Ping information. 


VB_getQ2ServerInfo_Resp( pDest, dest_len, pServerAddress )
----------------------------------------------------------

This function queries the DLL for information already obtained. The
pServerAddress parameter is the same as the above function. Zero will
be returned if the information could not be obtained. If information
does exist in the DLL then pDest will be filled with the Server
Response information. dest_len must hold the length of of the string
buffer pDest.



Response String
===============

A response string will normally contain server cvars (name\value) and
player information, e.g. (<CR> indicates a CHR(10))

\hostname\Grey\gamedir\mod-1\basedir\.<CR>
0 0 Grey<CR>
0 0 Fred<CR>

Watch out for error messages being returned. These will be contained in the first line, e.g.

Info string length exceeded<CR>
\md_weap_mess\1\mapname\crdm1\md_test\0\gamedate\Sep  1 1998\gamename\baseq2\md_safe_time\50\drones\0\sl_log_style\0\sl_tcp_dest\u_davies_build:28000\sl_filename\Test4.log\sl_log_method\5\md_map_file\maps.lst\md_map_debug\0\md_map_once\1\md_map_random\1\md_map_change\1\exploding_health\0\tech\0\bfg_grenade_cost\20\bfg_grenades\0\homing\0\maxclients\32\protocol\33\cheats\0\timelimit\20\fraglimit\25\dmflags\16912\deathmatch\1\version\3.17 x86 Jun 22 1998 Win32 RELEASE\hostname\Grey\gamedir\mod-1\basedir\.<CR>



Examples
========

There are two examples included in this zip file. Please study the
appropriate example before starting to code.

Spy.exe is a C program that can be run from the command line.
Example.exe is a VB5 program.


Contact
=======

If you need to ask a question please visit the GSLogMod web site
(http://www.planetquake.com/gslogmod) and look at the FAQ. If the
answer is not there then email GSLogMod@mdsoft.demon.co.uk
