1 /*
2  * qstat.h
3  * by Steve Jankowski
4  * steve@qstat.org
5  * http://www.qstat.org
6  *
7  * Copyright 1996,1997,1998,1999,2000,2001,2002 by Steve Jankowski
8  * Copyright 2007-2021 Steven Hartland
9  */
10 
11 #ifndef __H_QSTAT
12 #define __H_QSTAT
13 #ifdef HAVE_CONFIG_H
14  #include "gnuconfig.h"
15 #endif
16 #include "version.h"
17 
18 #ifdef __EMX__
19  #include <sys/select.h>
20  #include <sys/param.h>
21 	#define strcasecmp	stricmp
22 	#define strncasecmp	strnicmp
23 #endif
24 
25 #ifdef _WIN32
26  #include <sys/timeb.h>
27  #include <winsock.h>
28 	#define PATH_MAX		MAX_PATH
29  #include <fcntl.h>
30 	#define _POSIX_			1
31  #ifndef FD_SETSIZE
32 		#define FD_SETSIZE	256
33  #endif
34 	#define close(a)    closesocket(a)
35 	static int
gettimeofday(struct timeval * now,void * blah)36 	gettimeofday(struct timeval *now, void *blah)
37 	{
38 		struct timeb timeb;
39 
40 		ftime(&timeb);
41 		now->tv_sec = timeb.time;
42 		now->tv_usec = (unsigned int)timeb.millitm * 1000;
43 		return (0);
44 	}
45 
46 
47 	#define sockerr()    WSAGetLastError()
48 	#define strcasecmp		stricmp
49 	#define strncasecmp		strnicmp
50 	#define STATIC
51  #ifndef EADDRINUSE
52 		#define EADDRINUSE	WSAEADDRINUSE
53  #endif
54  #if _MSC_VER < 1900
55 	#define snprintf		_snprintf
56  #endif
57 #else
58  #include <sys/time.h>
59 	#define SOCKET_ERROR		-1
60 #endif  /* _WIN32 */
61 
62 #include <string.h>
63 
64 #define MAXSTRLEN		2048
65 #define ENCODING_LATIN_1	1
66 #define ENCODING_UTF_8		8
67 #define UTF8BYTESWAPNOTACHAR	0xFFFE
68 #define UTF8NOTACHAR		0xFFFF
69 #define UTF8MAXFROMUCS4		0x10FFFF
70 
71 typedef struct _server_type server_type;
72 
73 #ifdef __GNUC__
74 	#define GCC_FORMAT_PRINTF(a, b)    __attribute__ ((format(printf, a, b)))
75 #else
76 	#define GCC_FORMAT_PRINTF(a, b)
77 #endif
78 
79 typedef enum {
80 	INPROGRESS = 0,
81 	DONE_AUTO = 1,
82 	DONE_FORCE = 2,
83 
84 	SYS_ERROR = -1,
85 	MEM_ERROR = -2,
86 	PKT_ERROR = -3,
87 	ORD_ERROR = -4,
88 	REQ_ERROR = -5
89 } query_status_t;
90 
91 #include "qserver.h"
92 
93 typedef void (*DisplayFunc)(struct qserver *);
94 typedef query_status_t (*QueryFunc)(struct qserver *);
95 typedef query_status_t (*PacketFunc)(struct qserver *, char *rawpkt, int pktlen);
96 
97 // Display modules
98 #include "display_json.h"
99 
100 // Packet modules
101 #include "ut2004.h"
102 #include "doom3.h"
103 #include "a2s.h"
104 #include "fl.h"
105 #include "gps.h"
106 #include "gs2.h"
107 #include "gs3.h"
108 #include "haze.h"
109 #include "ts2.h"
110 #include "ts3.h"
111 #include "tm.h"
112 #include "wic.h"
113 #include "ottd.h"
114 #include "tee.h"
115 #include "cube2.h"
116 #include "bfbc2.h"
117 #include "ventrilo.h"
118 #include "mumble.h"
119 #include "terraria.h"
120 #include "crysis.h"
121 #include "dirtybomb.h"
122 #include "starmade.h"
123 #include "farmsim.h"
124 #include "ksp.h"
125 #include "tf.h"
126 #include "armyops.h"
127 
128 /*
129  * Various magic numbers.
130  */
131 
132 #define Q_DEFAULT_PORT				26000
133 #define HEXEN2_DEFAULT_PORT			26900
134 #define Q2_DEFAULT_PORT				27910
135 #define Q3_DEFAULT_PORT				27960
136 #define Q2_MASTER_DEFAULT_PORT			27900
137 #define Q3_MASTER_DEFAULT_PORT			27950
138 #define QW_DEFAULT_PORT				27500
139 #define QW_MASTER_DEFAULT_PORT			27000
140 #define HW_DEFAULT_PORT				26950
141 #define HW_MASTER_DEFAULT_PORT			26900
142 #define UNREAL_DEFAULT_PORT			7777
143 #define UNREAL_MASTER_DEFAULT_PORT		28900
144 #define HALFLIFE_DEFAULT_PORT			27015
145 #define HL_MASTER_DEFAULT_PORT			27010
146 #define SIN_DEFAULT_PORT			22450
147 #define SHOGO_DEFAULT_PORT			27888
148 #define TRIBES_DEFAULT_PORT			28001
149 #define TRIBES_MASTER_DEFAULT_PORT		28000
150 #define BFRIS_DEFAULT_PORT			44001
151 #define KINGPIN_DEFAULT_PORT			31510
152 #define HERETIC2_DEFAULT_PORT			28910
153 #define SOF_DEFAULT_PORT			28910
154 #define GAMESPY_MASTER_DEFAULT_PORT		28900
155 #define TRIBES2_DEFAULT_PORT			28000
156 #define TRIBES2_MASTER_DEFAULT_PORT		28002
157 #define DESCENT3_GAMESPY_DEFAULT_PORT		20142
158 #define DESCENT3_DEFAULT_PORT			2092
159 #define DESCENT3_MASTER_DEFAULT_PORT		3445
160 #define RTCW_DEFAULT_PORT			27960
161 #define RTCW_MASTER_DEFAULT_PORT		27950
162 #define STEF_DEFAULT_PORT			27960
163 #define STEF_MASTER_DEFAULT_PORT		27953
164 #define JK3_DEFAULT_PORT			29070
165 #define JK3_MASTER_DEFAULT_PORT			29060
166 #define GHOSTRECON_PLAYER_DEFAULT_PORT		2346
167 #define RAVENSHIELD_DEFAULT_PORT		8777
168 #define SAVAGE_DEFAULT_PORT			11235
169 #define FARCRY_DEFAULT_PORT			49001
170 #define STEAM_MASTER_DEFAULT_PORT		27010
171 #define HL2_DEFAULT_PORT			27015
172 #define HL2_MASTER_DEFAULT_PORT			27011
173 #define TS2_DEFAULT_PORT			51234
174 #define TS3_DEFAULT_PORT			10011
175 #define BFBC2_DEFAULT_PORT			48888
176 #define TM_DEFAULT_PORT				5000
177 #define WIC_DEFAULT_PORT			5000 // Default is actually disabled
178 #define FL_DEFAULT_PORT				5478
179 #define VENTRILO_DEFAULT_PORT			3784
180 #define CUBE2_DEFAULT_PORT			28785
181 #define MUMBLE_DEFAULT_PORT			64738
182 #define TERRARIA_DEFAULT_PORT			7777
183 #define CRYSIS_DEFAULT_PORT			64087
184 #define DIRTYBOMB_DEFAULT_PORT			7877
185 #define STARMADE_DEFAULT_PORT			4242
186 #define FARMSIM_DEFAULT_PORT			10828
187 #define KSP_DEFAULT_PORT			6702
188 #define TF_DEFAULT_PORT				37016
189 
190 #define Q_UNKNOWN_TYPE				0
191 #define MASTER_SERVER				0x40000000
192 
193 #define Q_SERVER				1
194 #define QW_SERVER				2
195 #define QW_MASTER				(3 | MASTER_SERVER)
196 #define H2_SERVER				4
197 #define Q2_SERVER				5
198 #define Q2_MASTER				(6 | MASTER_SERVER)
199 #define HW_SERVER				7
200 #define UN_SERVER				8
201 #define UN_MASTER				(9 | MASTER_SERVER)
202 #define HL_SERVER				10
203 #define HL_MASTER				(11 | MASTER_SERVER)
204 #define SIN_SERVER				12
205 #define SHOGO_SERVER				13
206 #define TRIBES_SERVER				14
207 #define TRIBES_MASTER				(15 | MASTER_SERVER)
208 #define Q3_SERVER				16
209 #define Q3_MASTER				(17 | MASTER_SERVER)
210 #define BFRIS_SERVER				18
211 #define KINGPIN_SERVER				19
212 #define HERETIC2_SERVER				20
213 #define SOF_SERVER				21
214 #define GAMESPY_PROTOCOL_SERVER			22
215 #define GAMESPY_MASTER				(23 | MASTER_SERVER)
216 #define TRIBES2_SERVER				24
217 #define TRIBES2_MASTER				(25 | MASTER_SERVER)
218 #define DESCENT3_GAMESPY_SERVER			26
219 #define DESCENT3_PXO_SERVER			27
220 #define DESCENT3_SERVER				28
221 #define DESCENT3_MASTER				(29 | MASTER_SERVER)
222 #define RTCW_SERVER				30
223 #define RTCW_MASTER				(31 | MASTER_SERVER)
224 #define STEF_SERVER				32
225 #define STEF_MASTER				(33 | MASTER_SERVER)
226 #define UT2003_SERVER				34
227 #define GHOSTRECON_SERVER			35
228 #define ALLSEEINGEYE_PROTOCOL_SERVER		36
229 #define RAVENSHIELD_SERVER			37
230 #define SAVAGE_SERVER				38
231 #define FARCRY_SERVER				39
232 #define GAMESPY2_PROTOCOL_SERVER		40
233 #define STEAM_MASTER				(41 | MASTER_SERVER)
234 #define JK3_SERVER				42
235 #define JK3_MASTER				(43 | MASTER_SERVER)
236 #define DOOM3_SERVER				44
237 #define DOOM3_MASTER				(45 | MASTER_SERVER)
238 #define HL2_SERVER				46
239 #define HL2_MASTER				(47 | MASTER_SERVER)
240 #define UT2004_MASTER				(48 | MASTER_SERVER)
241 #define A2S_SERVER				49
242 #define PARIAH_SERVER				50
243 #define GAMESPY3_PROTOCOL_SERVER		51
244 #define TS2_PROTOCOL_SERVER			52
245 #define QUAKE4_SERVER				53
246 #define QUAKE4_MASTER				(53 | MASTER_SERVER)
247 #define ARMYOPS_SERVER				54
248 #define GAMESPY4_PROTOCOL_SERVER		55
249 #define PREY_SERVER				56
250 #define TM_PROTOCOL_SERVER			57
251 #define ETQW_SERVER				58
252 #define HAZE_SERVER				59
253 #define HW_MASTER				(60 | MASTER_SERVER)
254 #define WIC_PROTOCOL_SERVER			61
255 #define OTTD_SERVER				62
256 #define OTTD_MASTER				(63 | MASTER_SERVER)
257 #define FL_SERVER				64
258 #define WOLF_SERVER				65
259 #define TEE_SERVER				66
260 #define TS3_PROTOCOL_SERVER			67
261 #define BFBC2_PROTOCOL_SERVER			68
262 #define VENTRILO_PROTOCOL_SERVER		69
263 #define CUBE2_SERVER				70
264 #define MUMBLE_PROTOCOL_SERVER			71
265 #define TERRARIA_PROTOCOL_SERVER		72
266 #define CRYSIS_PROTOCOL_SERVER			73
267 #define DIRTYBOMB_PROTOCOL_SERVER		74
268 #define STARMADE_PROTOCOL_SERVER		75
269 #define FARMSIM_PROTOCOL_SERVER			76
270 #define KSP_PROTOCOL_SERVER			77
271 #define TF_PROTOCOL_SERVER			78
272 #define TEE_MASTER				79
273 
274 #define LAST_BUILTIN_SERVER			80
275 
276 #define TF_SINGLE_QUERY				(1 << 1)
277 #define TF_OUTFILE				(1 << 2)
278 #define TF_MASTER_MULTI_RESPONSE		(1 << 3)
279 #define TF_TCP_CONNECT				(1 << 4)
280 #define TF_QUERY_ARG				(1 << 5)
281 #define TF_QUERY_ARG_REQUIRED			(1 << 6)
282 #define TF_QUAKE3_NAMES				(1 << 7)
283 #define TF_TRIBES2_NAMES			(1 << 8)
284 #define TF_SOF_NAMES				(1 << 9)
285 #define TF_U2_NAMES				(1 << 10)
286 
287 #define TF_RAW_STYLE_QUAKE			(1 << 11)
288 #define TF_RAW_STYLE_TRIBES			(1 << 12)
289 #define TF_RAW_STYLE_GHOSTRECON			(1 << 13)
290 
291 #define TF_NO_PORT_OFFSET			(1 << 14)
292 #define TF_SHOW_GAME_PORT			(1 << 15)
293 
294 #define TF_MASTER_STEAM				(1 << 16) /* supports steam server filter */
295 
296 // What response type are we expecting
297 // XXX: this is not what server->flags is for
298 #define TF_STATUS_QUERY		(1 << 17)
299 #define TF_PLAYER_QUERY		(1 << 18)
300 #define TF_RULES_QUERY		(1 << 19)
301 #define TF_TM_NAMES		(1 << 20)
302 
303 #define TRIBES_TEAM		-1
304 
305 struct q_packet;
306 
307 /*
308  * Output and formatting functions
309  */
310 
311 void display_server(struct qserver *server);
312 void display_qwmaster(struct qserver *server);
313 void display_server_rules(struct qserver *server);
314 void display_player_info(struct qserver *server);
315 void display_q_player_info(struct qserver *server);
316 void display_qw_player_info(struct qserver *server);
317 void display_q2_player_info(struct qserver *server);
318 void display_unreal_player_info(struct qserver *server);
319 void display_shogo_player_info(struct qserver *server);
320 void display_halflife_player_info(struct qserver *server);
321 void display_tribes_player_info(struct qserver *server);
322 void display_tribes2_player_info(struct qserver *server);
323 void display_bfris_player_info(struct qserver *server);
324 void display_descent3_player_info(struct qserver *server);
325 void display_ravenshield_player_info(struct qserver *server);
326 void display_savage_player_info(struct qserver *server);
327 void display_farcry_player_info(struct qserver *server);
328 void display_ghostrecon_player_info(struct qserver *server);
329 void display_eye_player_info(struct qserver *server);
330 void display_armyops_player_info(struct qserver *server);
331 void display_gs2_player_info(struct qserver *server);
332 void display_doom3_player_info(struct qserver *server);
333 void display_ts2_player_info(struct qserver *server);
334 void display_ts3_player_info(struct qserver *server);
335 void display_bfbc2_player_info(struct qserver *server);
336 void display_tm_player_info(struct qserver *server);
337 void display_wic_player_info(struct qserver *server);
338 void display_fl_player_info(struct qserver *server);
339 void display_tee_player_info(struct qserver *server);
340 void display_ventrilo_player_info(struct qserver *server);
341 void display_starmade_player_info(struct qserver *server);
342 
343 void raw_display_server(struct qserver *server);
344 void raw_display_server_rules(struct qserver *server);
345 void raw_display_player_info(struct qserver *server);
346 void raw_display_q_player_info(struct qserver *server);
347 void raw_display_qw_player_info(struct qserver *server);
348 void raw_display_q2_player_info(struct qserver *server);
349 void raw_display_unreal_player_info(struct qserver *server);
350 void raw_display_halflife_player_info(struct qserver *server);
351 void raw_display_tribes_player_info(struct qserver *server);
352 void raw_display_tribes2_player_info(struct qserver *server);
353 void raw_display_bfris_player_info(struct qserver *server);
354 void raw_display_ravenshield_player_info(struct qserver *server);
355 void raw_display_savage_player_info(struct qserver *server);
356 void raw_display_farcry_player_info(struct qserver *server);
357 void raw_display_descent3_player_info(struct qserver *server);
358 void raw_display_ghostrecon_player_info(struct qserver *server);
359 void raw_display_eye_player_info(struct qserver *server);
360 void raw_display_armyops_player_info(struct qserver *server);
361 void raw_display_gs2_player_info(struct qserver *server);
362 void raw_display_doom3_player_info(struct qserver *server);
363 void raw_display_ts2_player_info(struct qserver *server);
364 void raw_display_ts3_player_info(struct qserver *server);
365 void raw_display_bfbc2_player_info(struct qserver *server);
366 void raw_display_tm_player_info(struct qserver *server);
367 void raw_display_wic_player_info(struct qserver *server);
368 void raw_display_fl_player_info(struct qserver *server);
369 void raw_display_tee_player_info(struct qserver *server);
370 void raw_display_ventrilo_player_info(struct qserver *server);
371 void raw_display_starmade_player_info(struct qserver *server);
372 
373 void xml_display_server(struct qserver *server);
374 void xml_header();
375 void xml_footer();
376 void xml_display_server_rules(struct qserver *server);
377 void xml_display_player_info(struct qserver *server);
378 void xml_display_q_player_info(struct qserver *server);
379 void xml_display_qw_player_info(struct qserver *server);
380 void xml_display_q2_player_info(struct qserver *server);
381 void xml_display_unreal_player_info(struct qserver *server);
382 void xml_display_halflife_player_info(struct qserver *server);
383 void xml_display_tribes_player_info(struct qserver *server);
384 void xml_display_tribes2_player_info(struct qserver *server);
385 void xml_display_ravenshield_player_info(struct qserver *server);
386 void xml_display_savage_player_info(struct qserver *server);
387 void xml_display_farcry_player_info(struct qserver *server);
388 void xml_display_bfris_player_info(struct qserver *server);
389 void xml_display_descent3_player_info(struct qserver *server);
390 void xml_display_ghostrecon_player_info(struct qserver *server);
391 void xml_display_eye_player_info(struct qserver *server);
392 void xml_display_armyops_player_info(struct qserver *server);
393 void xml_display_player_info(struct qserver *server);
394 void xml_display_doom3_player_info(struct qserver *server);
395 void xml_display_ts2_player_info(struct qserver *server);
396 void xml_display_ts3_player_info(struct qserver *server);
397 void xml_display_bfbc2_player_info(struct qserver *server);
398 void xml_display_tm_player_info(struct qserver *server);
399 void xml_display_wic_player_info(struct qserver *server);
400 void xml_display_fl_player_info(struct qserver *server);
401 void xml_display_tee_player_info(struct qserver *server);
402 void xml_display_ventrilo_player_info(struct qserver *server);
403 void xml_display_starmade_player_info(struct qserver *server);
404 char *xml_escape(char *);
405 
406 query_status_t send_qserver_request_packet(struct qserver *server);
407 query_status_t send_qwserver_request_packet(struct qserver *server);
408 query_status_t send_ut2003_request_packet(struct qserver *server);
409 query_status_t send_tribes_request_packet(struct qserver *server);
410 query_status_t send_qwmaster_request_packet(struct qserver *server);
411 query_status_t send_bfris_request_packet(struct qserver *server);
412 query_status_t send_player_request_packet(struct qserver *server);
413 query_status_t send_rule_request_packet(struct qserver *server);
414 query_status_t send_savage_request_packet(struct qserver *server);
415 query_status_t send_farcry_request_packet(struct qserver *server);
416 query_status_t send_gamespy_master_request(struct qserver *server);
417 query_status_t send_tribes2_request_packet(struct qserver *server);
418 query_status_t send_tribes2master_request_packet(struct qserver *server);
419 query_status_t send_hl2_request_packet(struct qserver *server);
420 
421 query_status_t deal_with_q_packet(struct qserver *server, char *pkt, int pktlen);
422 query_status_t deal_with_qw_packet(struct qserver *server, char *pkt, int pktlen);
423 query_status_t deal_with_q1qw_packet(struct qserver *server, char *pkt, int pktlen);
424 query_status_t deal_with_q2_packet(struct qserver *server, char *pkt, int pktlen);
425 query_status_t deal_with_qwmaster_packet(struct qserver *server, char *pkt, int pktlen);
426 query_status_t deal_with_halflife_packet(struct qserver *server, char *pkt, int pktlen);
427 query_status_t deal_with_ut2003_packet(struct qserver *server, char *pkt, int pktlen);
428 query_status_t deal_with_tribes_packet(struct qserver *server, char *pkt, int pktlen);
429 query_status_t deal_with_tribesmaster_packet(struct qserver *server, char *pkt, int pktlen);
430 query_status_t deal_with_bfris_packet(struct qserver *server, char *pkt, int pktlen);
431 query_status_t deal_with_gamespy_master_response(struct qserver *server, char *pkt, int pktlen);
432 query_status_t deal_with_ravenshield_packet(struct qserver *server, char *pkt, int pktlen);
433 query_status_t deal_with_savage_packet(struct qserver *server, char *pkt, int pktlen);
434 query_status_t deal_with_farcry_packet(struct qserver *server, char *pkt, int pktlen);
435 query_status_t deal_with_tribes2_packet(struct qserver *server, char *pkt, int pktlen);
436 query_status_t deal_with_tribes2master_packet(struct qserver *server, char *pkt, int pktlen);
437 query_status_t deal_with_descent3_packet(struct qserver *server, char *pkt, int pktlen);
438 query_status_t deal_with_descent3master_packet(struct qserver *server, char *pkt, int pktlen);
439 query_status_t deal_with_ghostrecon_packet(struct qserver *server, char *pkt, int pktlen);
440 query_status_t deal_with_eye_packet(struct qserver *server, char *pkt, int pktlen);
441 query_status_t deal_with_hl2_packet(struct qserver *server, char *pkt, int pktlen);
442 
443 struct _server_type {
444 	int id;
445 	char *type_prefix;
446 	char *type_string;
447 	char *type_option;
448 	char *game_name;
449 	int master;
450 	unsigned short default_port;
451 	unsigned short port_offset;
452 	int flags;
453 	char *game_rule;
454 	char *template_var;
455 	char *status_packet;
456 	int status_len;
457 	char *player_packet;
458 	int player_len;
459 	char *rule_packet;
460 	int rule_len;
461 	char *master_packet;
462 	int master_len;
463 	char *master_protocol;
464 	char *master_query;
465 	DisplayFunc display_player_func;
466 	DisplayFunc display_rule_func;
467 	DisplayFunc display_raw_player_func;
468 	DisplayFunc display_raw_rule_func;
469 	DisplayFunc display_xml_player_func;
470 	DisplayFunc display_xml_rule_func;
471 	DisplayFunc display_json_player_func;
472 	DisplayFunc display_json_rule_func;
473 	QueryFunc status_query_func;
474 	QueryFunc rule_query_func;
475 	QueryFunc player_query_func;
476 	PacketFunc packet_func;
477 };
478 
479 extern server_type builtin_types[];
480 extern server_type *types;
481 extern int n_server_types;
482 extern server_type *default_server_type;
483 server_type *find_server_type_string(char *type_string);
484 
485 #ifdef QUERY_PACKETS
486  #undef QUERY_PACKETS
487 
488 /* QUAKE */
489 	struct q_packet {
490 		unsigned char flag1;
491 		unsigned char flag2;
492 		unsigned short length;
493 		unsigned char op_code;
494 		unsigned char data[19];
495 	};
496 
497 	#define Q_HEADER_LEN    5
498 
499 /*
500  * struct {
501  *  unsigned char flag1;
502  *  unsigned char flag2;
503  *  unsigned short length;
504  *  unsigned char op_code;
505  *  char name[6];
506  *  unsigned char version;
507  * };
508  */
509 
510 	#define Q_FLAG1			0x80
511 	#define Q_FLAG2			0x00
512 	#define Q_CCREQ_SERVER_INFO	0x02
513 	#define Q_CCREQ_PLAYER_INFO	0x03
514 	#define Q_CCREQ_RULE_INFO	0x04
515 
516 /* The \003 below is the protocol version */
517 	#define Q_SERVERINFO_LEN	12
518 	struct q_packet q_serverinfo =
519 	{
520 		Q_FLAG1, Q_FLAG2, Q_SERVERINFO_LEN, Q_CCREQ_SERVER_INFO, "QUAKE\000\003"
521 	};
522 
523 	struct q_packet q_rule = {
524 		Q_FLAG1, Q_FLAG2, 0, Q_CCREQ_RULE_INFO, ""
525 	};
526 
527 	struct q_packet q_player = {
528 		Q_FLAG1, Q_FLAG2, 6, Q_CCREQ_PLAYER_INFO, ""
529 	};
530 
531 /* QUAKE WORLD */
532 	struct {
533 		char prefix[4];
534 		char command[10];
535 	}
536 	qw_serverstatus =
537 	{ { '\377', '\377', '\377', '\377' }, { 's', 't', 'a', 't', 'u', 's', ' ', '2', '3', '\n' } };
538 
539 /* QUAKE3 */
540 	struct {
541 		char prefix[4];
542 		char command[10];
543 	}
544 	q3_serverstatus =
545 	{ { '\377', '\377', '\377', '\377' }, { 'g', 'e', 't', 's', 't', 'a', 't', 'u', 's', '\n' } };
546 
547 	struct {
548 		char prefix[4];
549 		char command[8];
550 	}
551 	q3_serverinfo =
552 	{ { '\377', '\377', '\377', '\377' }, { 'g', 'e', 't', 'i', 'n', 'f', 'o', '\n' } };
553 
554 /* DOOM 3 */
555 	struct {
556 		char prefix[2];
557 		char command[12];
558 	}
559 	doom3_serverinfo =
560 	{ { '\377', '\377' }, { 'g', 'e', 't', 'I', 'n', 'f', 'o', '\0', '\0', '\0', '\0', '\0' } };
561 
562 /* HALF-LIFE 2 */
563 	char hl2_serverinfo[20] = { '\xFF', '\xFF', '\xFF', '\xFF', 'T', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' };
564 	char hl2_playerinfo[20] = { '\xFF', '\xFF', '\xFF', '\xFF', 'U', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' };
565 	char hl2_ruleinfo[20] = { '\xFF', '\xFF', '\xFF', '\xFF', 'V', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' };
566 
567 /* HEXEN WORLD */
568 	struct {
569 		char prefix[5];
570 		char command[7];
571 	}
572 	hw_serverstatus =
573 	{ { '\377', '\377', '\377', '\377', '\377' }, { 's', 't', 'a', 't', 'u', 's', '\n' } };
574 
575 /* HEXEN 2
576  * The \004 below is the protocol version */
577 	#define H2_SERVERINFO_LEN    14
578 	struct q_packet h2_serverinfo =
579 	{
580 		Q_FLAG1, Q_FLAG2, H2_SERVERINFO_LEN, Q_CCREQ_SERVER_INFO, "HEXENII\000\004"
581 	};
582 
583 /* UNREAL */
584 
585 	char unreal_serverstatus[8] = { '\\', 's', 't', 'a', 't', 'u', 's', '\\' };
586 
587 /*
588  * char unreal_serverstatus[] = { '\\', 's','t','a','t','u','s', '\\', '\\', 'p','l','a','y','e','r','s', '\\', '\\' };
589  */
590 	char unreal_masterlist[23] = "\\list\\\\gamename\\unreal";
591 
592 /* UT 2003 */
593 	char ut2003_basicstatus[] = { 0x78, 0, 0, 0, 0 };
594 //char ut2003_ruleinfo[] = { 0x78, 0,0,0, 1 };
595 //char ut2003_playerinfo[] = { 0x78, 0,0,0, 2 };
596 	char ut2003_allinfo[] = { 0x78, 0, 0, 0, 3 };
597 
598 /* Pariah */
599 	char pariah_basicstatus[] = { 0x77, 0, 0, 0, 0x13 };
600 
601 /* HALF LIFE */
602 	char hl_ping[9] =
603 	{ '\377', '\377', '\377', '\377', 'p', 'i', 'n', 'g', '\0' };
604 	char hl_rules[10] =
605 	{ '\377', '\377', '\377', '\377', 'r', 'u', 'l', 'e', 's', '\0' };
606 	char hl_info[9] =
607 	{ '\377', '\377', '\377', '\377', 'i', 'n', 'f', 'o', '\0' };
608 	char hl_players[12] =
609 	{ '\377', '\377', '\377', '\377', 'p', 'l', 'a', 'y', 'e', 'r', 's', '\0' };
610 	char hl_details[12] =
611 	{ '\377', '\377', '\377', '\377', 'd', 'e', 't', 'a', 'i', 'l', 's', '\0' };
612 
613 /* QUAKE WORLD MASTER */
614 	#define QW_GET_SERVERS    'c'
615 	char qw_masterquery[] = { QW_GET_SERVERS, '\n', '\0' };
616 
617 /* HEXENWORLD MASTER */
618 	#define HW_GET_SERVERS    'c'
619 	char hw_masterquery[] = { '\377', HW_GET_SERVERS, '\0' };
620 
621 /* QUAKE 2 MASTER */
622 	char q2_masterquery[] = { 'q', 'u', 'e', 'r', 'y', '\n', '\0' };
623 
624 /* QUAKE 3 MASTER */
625 	char q3_master_query_template[] = "\377\377\377\377getservers %s %s";
626 	char q3_master_default_protocol[] = "68";
627 	char q3_master_default_query[] = "empty full\n";
628 
629 /* RETURN TO CASTLE WOLFENSTEIN */
630 	char rtcw_master_default_protocol[] = "60";
631 
632 /* STAR TREK: ELITE FORCE */
633 	char stef_master_default_protocol[] = "24";
634 
635 /* JEDI KNIGHT: JEDI ACADEMY */
636 	char jk3_master_default_protocol[] = "26";
637 
638 /* HALF-LIFE MASTER */
639 	char hl_masterquery[4] = { 'e', '\0', '\0', '\0' };
640 	char new_hl_masterquery_prefix[5] = { '1', '\0', '\0', '\0', '\0' };
641 
642 /* TRIBES */
643 	char tribes_info[] = { '`', '*', '*' };
644 	char tribes_players[] = { 'b', '*', '*' };
645 
646 /*  This is what the game sends to get minimal status
647  * { '\020', '\03', '\377', 0, (unsigned char)0xc5, 6 };
648  */
649 	char tribes_info_reponse[] = { 'a', '*', '*', 'b' };
650 	char tribes_players_reponse[] = { 'c', '*', '*', 'b' };
651 	char tribes_masterquery[] = { 0x10, 0x3, '\377', 0, 0x2 };
652 	char tribes_master_response[] = { 0x10, 0x6 };
653 
654 /* GAMESPY */
655 	char gamespy_master_request_prefix[] = "\\list\\\\gamename\\";
656 	char gamespy_master_validate[] = "\\gamename\\gamespy2\\gamever\\020109017\\location\\5\\validate\\12345678\\final\\";
657 
658 /* TRIBES 2 */
659 	#define TRIBES2_QUERY_GAME_TYPES		2
660 	#define TRIBES2_QUERY_MASTER			6
661 	#define TRIBES2_QUERY_PING			14
662 	#define TRIBES2_QUERY_INFO			18
663 	#define TRIBES2_RESPONSE_GAME_TYPES		4
664 	#define TRIBES2_RESPONSE_MASTER			8
665 	#define TRIBES2_RESPONSE_PING			16
666 	#define TRIBES2_RESPONSE_INFO			20
667 
668 	#define TRIBES2_NO_COMPRESS			2
669 	#define TRIBES2_DEFAULT_PACKET_INDEX		255
670 	#define TRIBES2_STATUS_DEDICATED		(1 << 0)
671 	#define TRIBES2_STATUS_PASSWORD			(1 << 1)
672 	#define TRIBES2_STATUS_LINUX			(1 << 2)
673 	#define TRIBES2_STATUS_TOURNAMENT		(1 << 3)
674 	#define TRIBES2_STATUS_NOALIAS			(1 << 4)
675 	#define TRIBES2_STATUS_TEAMDAMAGE		(1 << 5)
676 	#define TRIBES2_STATUS_TOURNAMENT_VER3		(1 << 6)
677 	#define TRIBES2_STATUS_NOALIAS_VER3		(1 << 7)
678 	char tribes2_game_types_request[] = { TRIBES2_QUERY_GAME_TYPES, 0, 1, 2, 3, 4 };
679 	char tribes2_ping[] = { TRIBES2_QUERY_PING, TRIBES2_NO_COMPRESS, 1, 2, 3, 4 };
680 	char tribes2_info[] = { TRIBES2_QUERY_INFO, TRIBES2_NO_COMPRESS, 1, 2, 3, 4 };
681 	unsigned char tribes2_masterquery[] =
682 	{
683 		TRIBES2_QUERY_MASTER,  128, /* <= build 22228, this was 0 */
684 		11,			12,   13,  14,
685 		255,
686 		3,		      'a',  'n',  'y',
687 		3,		      'a',  'n',  'y',
688 		0,		       255,             /* min/max players */
689 		0xff,		      0xff, 0xff,0xff,  /* region mask */
690 		0,			 0,    0,   0,  /* build version */
691 		0,                                      /* status */
692 		255,                                    /* max bots */
693 		0,			 0,             /* min cpu */
694 		0                                       /* # buddies */
695 	};
696 	#define TRIBES2_ID_OFFSET    2
697 
698 	unsigned char descent3_masterquery[] =
699 	{
700 		0x03,                                           /* ID or something */
701 		0x24, 0x00, 0x00, 0x00,                         /* packet len */
702 		0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
703 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,       /* unknown */
704 		0x07,                                           /* type */
705 		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,       /* unknown */
706 		0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x00        /* "global" */
707 	};
708 
709 /* for some reason Descent3 uses a different request for pxo/non-pxo games. blah. */
710 	unsigned char descent3_pxoinfoquery[] =
711 	{
712 		0x01,                                           /* "internal descent3 routing" */
713 		0x29,                                           /* request server info? (pxo listed servers) */
714 		0x0b, 0x00,                                     /* packet length (- routing byte) */
715 		0x1b, 0x2f, 0xf4, 0x41, 0x09, 0x00, 0x00, 0x00  /* unknown */
716 	};
717 	unsigned char descent3_tcpipinfoquery[] =
718 	{
719 		0x01,                                           /* "internal descent3 routing" */
720 		0x1e,                                           /* request server info? (tcpip only servers) */
721 		0x0b, 0x00,                                     /* packet length (- routing byte) */
722 		0x1b, 0x2f, 0xf4, 0x41, 0x09, 0x00, 0x00, 0x00  /* unknown */
723 	};
724 
725 /* http://ml.warpcore.org/d3dl/200101/msg00001.html
726  * http://ml.warpcore.org/d3dl/200101/msg00004.html */
727 	unsigned char descent3_playerquery[] =
728 	{
729 		0x01,           /* "internal descent3 routing" */
730 		0x72,           /* MP_REQUEST_PLAYERLIST   */
731 		0x03, 0x00      /* packet length (- routing byte) */
732 	};
733 
734 	unsigned char ghostrecon_serverquery[] =
735 	{
736 		0xc0, 0xde, 0xf1, 0x11, /* const ? header */
737 		0x42,                   /* start flag */
738 		0x03, 0x00,             /* data len */
739 		0xe9, 0x03, 0x00        /* server request ?? */
740 	};
741 
742 	unsigned char ghostrecon_playerquery[] =
743 	{
744 		0xc0, 0xde, 0xf1, 0x11,                 /* const ? header */
745 		0x42,                                   /* start flag */
746 		0x06, 0x00,                             /* data len */
747 		0xf5, 0x03, 0x00, 0x78, 0x30, 0x63      /* player request ?? may be flag 0xf5; len 0x03,0x00; data 0x78, 0x30, 0x63 */
748 	};
749 
750 /* All Seeing Eye */
751 	char eye_status_query[1] = "s";
752 	char eye_ping_query[1] = "p";
753 
754 // Gamespy v2
755 // Format:
756 // 1 - 3: query head
757 // 4 - 7: queryid
758 // 8: server + rules info (00 to disable)
759 // 9: Player information (00 to disable)
760 // 10: Team information (00 to disable)
761 	unsigned char gs2_status_query[] =
762 	{
763 		0xfe, 0xfd, 0x00, 0x10, 0x20, 0x30, 0x40, 0xff, 0xff, 0xff
764 	};
765 
766 // Gamespy v3
767 // Format:
768 // 1 - 3: query head
769 // 4 - 7: queryid
770 // 8: server + rules info (00 to disable)
771 // 9: Player information (00 to disable)
772 // 10: Team information (00 to disable)
773 // 11: Request new format
774 	unsigned char gs3_player_query[] =
775 	{
776 		0xfe, 0xfd, 0x00,
777 		0x10, 0x20, 0x30, 0x40,
778 		0xff, 0xff, 0xff, 0x01
779 	};
780 
781 // Format:
782 // 1 - 3: query head
783 // 4 - 7: queryid
784 // 8: requested number of rules
785 // 9 - 9 + no_rules: requested ruleid
786 // last 2 : terminator?
787 
788 // Known ruleid's:
789 // 0x01: hostname
790 // 0x03: version
791 // 0x04: hostport
792 // 0x05: map
793 // 0x06: gametype
794 // 0x07: gamevarient
795 // 0x08: num_players
796 // 0x0a: max_players
797 // 0x0b: gamemode
798 	unsigned char gs3_status_query[] =
799 	{
800 		0xfe, 0xfd, 0x00,
801 		0x10, 0x20, 0x30, 0x40,
802 		0x06, 0x01, 0x06, 0x05, 0x08, 0x0a, 0x04, 0x00, 0x00
803 	};
804 
805 // Gamespy v3 + challenge
806 // Format:
807 // 1 - 3: query head
808 // 4 - 7: queryid
809 	unsigned char gs3_challenge[] =
810 	{
811 		0xfe, 0xfd, 0x09,
812 		0x10, 0x20, 0x30, 0x40
813 	};
814 
815 // Format:
816 // 1 - 8: Query Request
817 // 9 - 12: Query Header
818 // 13: Query ID
819 
820 // Query ID is made up of the following
821 // 0x01: Basic Info
822 // 0x02: Game Rules
823 // 0x03: Player Information
824 // 0x04: Team Information
825 	unsigned char haze_status_query[] =
826 	{
827 		'f',  'r',  'd',  'q',	'u', 'e', 'r', 'y',
828 		0x10, 0x20, 0x30, 0x40,
829 		0x0A
830 	};
831 
832 // Format:
833 // 1 - 8: Query Request
834 // 9 - 12: Query Header
835 // 13: Query ID
836 
837 // Query ID is made up of the following
838 // 0x01: Basic Info
839 // 0x02: Game Rules
840 // 0x03: Player Information
841 // 0x04: Team Information
842 	unsigned char haze_player_query[] =
843 	{
844 		'f',  'r',  'd',  'q',	'u', 'e', 'r', 'y',
845 		0x10, 0x20, 0x30, 0x40,
846 		0x03
847 	};
848 
849 // Steam
850 // Format:
851 // 1. Request type ( 1 byte )
852 // 2. Region ( 1 byte )
853 // 3. ip ( string + null )
854 // 4. Filter ( optional + null )
855 //
856 // Regions:
857 // 0 = US East Coast
858 // 1 = US West Coast
859 // 2 = South America
860 // 3 = Europe
861 // 4 = Asia
862 // 5 = Australia
863 // 6 = Middle East
864 // 7 = Africa
865 // 255 = N/A
866 // Filter:
867 // \type\d = Returns only dedicated servers
868 //
869 // \secure\1 = Returns servers running anti-cheat technology
870 //
871 // \gamedir\[mod] = Servers running the specified modification.
872 // The parameter is the directory that the mod resides in e.g.
873 // cstrike for Counter-Strike or dod for Day of Defeat.
874 //
875 // \map\[map] = Returns servers running the specified map
876 // (e.g. de_dust2 or cs_italy)
877 //
878 // \linux\1 = Servers running on the Linux platform
879 //
880 // \empty\1 = Servers that are not empty
881 //
882 // \full\1 = Servers that are not full
883 //
884 // \proxy\1 = Servers that are spectator proxies
885 //
886 // End the filter with 0x00
887 //
888 	unsigned char steam_masterquery_template[] = "1%c%s%c%s";
889 
890 	unsigned char savage_serverquery[] =
891 	{
892 		0x9e, 0x4c, 0x23, 0x00, 0x00, 0xc8, 0x01, 0x21, 0x00, 0x00
893 	};
894 
895 	unsigned char savage_playerquery[] =
896 	{
897 		0x9e, 0x4c, 0x23, 0x00, 0x00, 0xce, 0x76, 0x46, 0x00, 0x00
898 	};
899 
900 	unsigned char farcry_serverquery[] =
901 	{
902 		0x08, 0x80
903 	};
904 
905 	char ravenshield_serverquery[] = "REPORT";
906 
907 	char ottd_master_query[] =
908 	{
909 		0x04, 0x00,     // packet length
910 		0x06,           // packet type
911 		0x01            // packet version
912 	};
913 
914 	char ottd_serverinfo[] =
915 	{
916 		0x03, 0x00,     // packet length
917 		0x00,           // packet type
918 	};
919 
920 	char ottd_serverdetails[] =
921 	{
922 		0x03, 0x00,     // packet length
923 		0x02,           // packet type
924 	};
925 
926 /* Cube2 */
927 
928 	char cube2_serverstatus[3] = { '\x80', '\x10', '\x27' };
929 
930 /* Mumble */
931 	char mumble_serverstatus[12] = { '\x00', '\x00', '\x00', '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08' };
932 
933 /* Terraria */
934 	char terraria_serverstatus[] = "GET /v2/server/status HTTP/1.1\x0d\x0a\x0d\x0a";
935 
936 /* SERVER BUILTIN TYPES */
937 
938 	server_type builtin_types[] =
939 	{
940 		{
941 			/* QUAKE */
942 			Q_SERVER,                       /* id */
943 			"QS",                           /* type_prefix */
944 			"qs",                           /* type_string */
945 			"-qs",                          /* type_option */
946 			"Quake",                        /* game_name */
947 			0,                              /* master */
948 			Q_DEFAULT_PORT,                 /* default_port */
949 			0,                              /* port_offset */
950 			TF_RAW_STYLE_QUAKE,             /* flags */
951 			"*gamedir",                     /* game_rule */
952 			"QUAKE",                        /* template_var */
953 			(char *)&q_serverinfo,          /* status_packet */
954 			Q_SERVERINFO_LEN,               /* status_len */
955 			(char *)&q_player,              /* player_packet */
956 			Q_HEADER_LEN + 1,               /* player_len */
957 			(char *)&q_rule,                /* rule_packet */
958 			sizeof(q_rule),                 /* rule_len */
959 			NULL,                           /* master_packet */
960 			0,                              /* master_len */
961 			NULL,                           /* master_protocol */
962 			NULL,                           /* master_query */
963 			display_q_player_info,          /* display_player_func */
964 			display_server_rules,           /* display_rule_func */
965 			raw_display_q_player_info,      /* display_raw_player_func */
966 			raw_display_server_rules,       /* display_raw_rule_func */
967 			xml_display_q_player_info,      /* display_xml_player_func */
968 			xml_display_server_rules,       /* display_xml_rule_func */
969 			json_display_q_player_info,     /* display_json_player_func */
970 			json_display_server_rules,      /* display_json_rule_func */
971 			send_qserver_request_packet,    /* status_query_func */
972 			NULL,                           /* rule_query_func */
973 			NULL,                           /* player_query_func */
974 			deal_with_q_packet,             /* packet_func */
975 		},
976 		{
977 			/* HEXEN 2 */
978 			H2_SERVER,                      /* id */
979 			"H2S",                          /* type_prefix */
980 			"h2s",                          /* type_string */
981 			"-h2s",                         /* type_option */
982 			"Hexen II",                     /* game_name */
983 			0,                              /* master */
984 			HEXEN2_DEFAULT_PORT,            /* default_port */
985 			0,                              /* port_offset */
986 			TF_RAW_STYLE_QUAKE,             /* flags */
987 			"*gamedir",                     /* game_rule */
988 			"HEXEN2",                       /* template_var */
989 			(char *)&h2_serverinfo,         /* status_packet */
990 			H2_SERVERINFO_LEN,              /* status_len */
991 			(char *)&q_player,              /* player_packet */
992 			Q_HEADER_LEN + 1,               /* player_len */
993 			(char *)&q_rule,                /* rule_packet */
994 			sizeof(q_rule),                 /* rule_len */
995 			NULL,                           /* master_packet */
996 			0,                              /* master_len */
997 			NULL,                           /* master_protocol */
998 			NULL,                           /* master_query */
999 			display_q_player_info,          /* display_player_func */
1000 			display_server_rules,           /* display_rule_func */
1001 			raw_display_q_player_info,      /* display_raw_player_func */
1002 			raw_display_server_rules,       /* display_raw_rule_func */
1003 			xml_display_q_player_info,      /* display_xml_player_func */
1004 			xml_display_server_rules,       /* display_xml_rule_func */
1005 			json_display_q_player_info,     /* display_json_player_func */
1006 			json_display_server_rules,      /* display_json_rule_func */
1007 			send_qserver_request_packet,    /* status_query_func */
1008 			NULL,                           /* rule_query_func */
1009 			NULL,                           /* player_query_func */
1010 			deal_with_q_packet,             /* packet_func */
1011 		},
1012 		{
1013 			/* QUAKE WORLD */
1014 			QW_SERVER,                      /* id */
1015 			"QWS",                          /* type_prefix */
1016 			"qws",                          /* type_string */
1017 			"-qws",                         /* type_option */
1018 			"QuakeWorld",                   /* game_name */
1019 			0,                              /* master */
1020 			QW_DEFAULT_PORT,                /* default_port */
1021 			0,                              /* port_offset */
1022 			TF_SINGLE_QUERY,                /* flags */
1023 			"*gamedir",                     /* game_rule */
1024 			"QUAKEWORLD",                   /* template_var */
1025 			(char *)&qw_serverstatus,       /* status_packet */
1026 			sizeof(qw_serverstatus),        /* status_len */
1027 			NULL,                           /* player_packet */
1028 			0,                              /* player_len */
1029 			NULL,                           /* rule_packet */
1030 			0,                              /* rule_len */
1031 			NULL,                           /* master_packet */
1032 			0,                              /* master_len */
1033 			NULL,                           /* master_protocol */
1034 			NULL,                           /* master_query */
1035 			display_qw_player_info,         /* display_player_func */
1036 			display_server_rules,           /* display_rule_func */
1037 			raw_display_qw_player_info,     /* display_raw_player_func */
1038 			raw_display_server_rules,       /* display_raw_rule_func */
1039 			xml_display_qw_player_info,     /* display_xml_player_func */
1040 			xml_display_server_rules,       /* display_xml_rule_func */
1041 			json_display_qw_player_info,    /* display_json_player_func */
1042 			json_display_server_rules,      /* display_json_rule_func */
1043 			send_qwserver_request_packet,   /* status_query_func */
1044 			NULL,                           /* rule_query_func */
1045 			NULL,                           /* player_query_func */
1046 			deal_with_qw_packet,            /* packet_func */
1047 		},
1048 		{
1049 			/* HEXEN WORLD */
1050 			HW_SERVER,                      /* id */
1051 			"HWS",                          /* type_prefix */
1052 			"hws",                          /* type_string */
1053 			"-hws",                         /* type_option */
1054 			"HexenWorld",                   /* game_name */
1055 			0,                              /* master */
1056 			HW_DEFAULT_PORT,                /* default_port */
1057 			0,                              /* port_offset */
1058 			TF_SINGLE_QUERY,                /* flags */
1059 			"*gamedir",                     /* game_rule */
1060 			"HEXENWORLD",                   /* template_var */
1061 			(char *)&hw_serverstatus,       /* status_packet */
1062 			sizeof(hw_serverstatus),        /* status_len */
1063 			NULL,                           /* player_packet */
1064 			0,                              /* player_len */
1065 			NULL,                           /* rule_packet */
1066 			0,                              /* rule_len */
1067 			NULL,                           /* master_packet */
1068 			0,                              /* master_len */
1069 			NULL,                           /* master_protocol */
1070 			NULL,                           /* master_query */
1071 			display_qw_player_info,         /* display_player_func */
1072 			display_server_rules,           /* display_rule_func */
1073 			raw_display_qw_player_info,     /* display_raw_player_func */
1074 			raw_display_server_rules,       /* display_raw_rule_func */
1075 			xml_display_qw_player_info,     /* display_xml_player_func */
1076 			xml_display_server_rules,       /* display_xml_rule_func */
1077 			json_display_qw_player_info,    /* display_json_player_func */
1078 			json_display_server_rules,      /* display_json_rule_func */
1079 			send_qwserver_request_packet,   /* status_query_func */
1080 			NULL,                           /* rule_query_func */
1081 			NULL,                           /* player_query_func */
1082 			deal_with_qw_packet,            /* packet_func */
1083 		},
1084 		{
1085 			/* QUAKE 2 */
1086 			Q2_SERVER,                      /* id */
1087 			"Q2S",                          /* type_prefix */
1088 			"q2s",                          /* type_string */
1089 			"-q2s",                         /* type_option */
1090 			"Quake II",                     /* game_name */
1091 			0,                              /* master */
1092 			Q2_DEFAULT_PORT,                /* default_port */
1093 			0,                              /* port_offset */
1094 			TF_SINGLE_QUERY,                /* flags */
1095 			"gamedir",                      /* game_rule */
1096 			"QUAKE2",                       /* template_var */
1097 			(char *)&qw_serverstatus,       /* status_packet */
1098 			sizeof(qw_serverstatus),        /* status_len */
1099 			NULL,                           /* player_packet */
1100 			0,                              /* player_len */
1101 			NULL,                           /* rule_packet */
1102 			0,                              /* rule_len */
1103 			NULL,                           /* master_packet */
1104 			0,                              /* master_len */
1105 			NULL,                           /* master_protocol */
1106 			NULL,                           /* master_query */
1107 			display_q2_player_info,         /* display_player_func */
1108 			display_server_rules,           /* display_rule_func */
1109 			raw_display_q2_player_info,     /* display_raw_player_func */
1110 			raw_display_server_rules,       /* display_raw_rule_func */
1111 			xml_display_q2_player_info,     /* display_xml_player_func */
1112 			xml_display_server_rules,       /* display_xml_rule_func */
1113 			json_display_q2_player_info,    /* display_json_player_func */
1114 			json_display_server_rules,      /* display_json_rule_func */
1115 			send_qwserver_request_packet,   /* status_query_func */
1116 			NULL,                           /* rule_query_func */
1117 			NULL,                           /* player_query_func */
1118 			deal_with_qw_packet,            /* packet_func */
1119 		},
1120 		{
1121 			/* QUAKE 3 */
1122 			Q3_SERVER,                              /* id */
1123 			"Q3S",                                  /* type_prefix */
1124 			"q3s",                                  /* type_string */
1125 			"-q3s",                                 /* type_option */
1126 			"Quake III: Arena",                     /* game_name */
1127 			0,                                      /* master */
1128 			Q3_DEFAULT_PORT,                        /* default_port */
1129 			0,                                      /* port_offset */
1130 			TF_QUAKE3_NAMES /* TF_SINGLE_QUERY */,  /* flags */
1131 			"game",                                 /* game_rule */
1132 			"QUAKE3",                               /* template_var */
1133 			(char *)&q3_serverinfo,                 /* status_packet */
1134 			sizeof(q3_serverinfo),                  /* status_len */
1135 			NULL,                                   /* player_packet */
1136 			0,                                      /* player_len */
1137 			(char *)&q3_serverstatus,               /* rule_packet */
1138 			sizeof(q3_serverstatus),                /* rule_len */
1139 			NULL,                                   /* master_packet */
1140 			0,                                      /* master_len */
1141 			NULL,                                   /* master_protocol */
1142 			NULL,                                   /* master_query */
1143 			display_q2_player_info,                 /* display_player_func */
1144 			display_server_rules,                   /* display_rule_func */
1145 			raw_display_q2_player_info,             /* display_raw_player_func */
1146 			raw_display_server_rules,               /* display_raw_rule_func */
1147 			xml_display_q2_player_info,             /* display_xml_player_func */
1148 			xml_display_server_rules,               /* display_xml_rule_func */
1149 			json_display_q2_player_info,            /* display_json_player_func */
1150 			json_display_server_rules,              /* display_json_rule_func */
1151 			send_qwserver_request_packet,           /* status_query_func */
1152 			NULL,                                   /* rule_query_func */
1153 			NULL,                                   /* player_query_func */
1154 			deal_with_qw_packet,                    /* packet_func */
1155 		},
1156 		{
1157 			/* DOOM 3 */
1158 			DOOM3_SERVER,                   /* id */
1159 			"DM3S",                         /* type_prefix */
1160 			"dm3s",                         /* type_string */
1161 			"-dm3s",                        /* type_option */
1162 			"Doom 3",                       /* game_name */
1163 			0,                              /* master */
1164 			DOOM3_DEFAULT_PORT,             /* default_port */
1165 			0,                              /* port_offset */
1166 			TF_QUAKE3_NAMES,                /* flags */
1167 			"fs_game",                      /* game_rule */
1168 			"DOOM3",                        /* template_var */
1169 			(char *)&doom3_serverinfo,      /* status_packet */
1170 			sizeof(doom3_serverinfo),       /* status_len */
1171 			NULL,                           /* player_packet */
1172 			0,                              /* player_len */
1173 			NULL,                           /* rule_packet */
1174 			0,                              /* rule_len */
1175 			NULL,                           /* master_packet */
1176 			0,                              /* master_len */
1177 			NULL,                           /* master_protocol */
1178 			NULL,                           /* master_query */
1179 			display_doom3_player_info,      /* display_player_func */
1180 			display_server_rules,           /* display_rule_func */
1181 			raw_display_doom3_player_info,  /* display_raw_player_func */
1182 			raw_display_server_rules,       /* display_raw_rule_func */
1183 			xml_display_doom3_player_info,  /* display_xml_player_func */
1184 			xml_display_server_rules,       /* display_xml_rule_func */
1185 			json_display_doom3_player_info, /* display_json_player_func */
1186 			json_display_server_rules,      /* display_json_rule_func */
1187 			send_qwserver_request_packet,   /* status_query_func */
1188 			NULL,                           /* rule_query_func */
1189 			NULL,                           /* player_query_func */
1190 			deal_with_doom3_packet,         /* packet_func */
1191 		},
1192 		{
1193 			/* HALFLIFE 2 */
1194 			HL2_SERVER,                             /* id */
1195 			"HL2S",                                 /* type_prefix */
1196 			"hl2s",                                 /* type_string */
1197 			"-hl2s",                                /* type_option */
1198 			"Half-Life 2",                          /* game_name */
1199 			0,                                      /* master */
1200 			HL2_DEFAULT_PORT,                       /* default_port */
1201 			0,                                      /* port_offset */
1202 			TF_QUAKE3_NAMES,                        /* flags */
1203 			"",                                     /* game_rule */
1204 			"HL2",                                  /* template_var */
1205 			(char *)&hl2_serverinfo,                /* status_packet */
1206 			sizeof(hl2_serverinfo),                 /* status_len */
1207 			(char *)&hl2_playerinfo,                /* player_packet */
1208 			sizeof(hl2_playerinfo),                 /* player_len */
1209 			(char *)&hl2_ruleinfo,                  /* rule_packet */
1210 			sizeof(hl2_ruleinfo),                   /* rule_len */
1211 			NULL,                                   /* master_packet */
1212 			0,                                      /* master_len */
1213 			NULL,                                   /* master_protocol */
1214 			NULL,                                   /* master_query */
1215 			display_halflife_player_info,           /* display_player_func */
1216 			display_server_rules,                   /* display_rule_func */
1217 			raw_display_halflife_player_info,       /* display_raw_player_func */
1218 			raw_display_server_rules,               /* display_raw_rule_func */
1219 			xml_display_halflife_player_info,       /* display_xml_player_func */
1220 			xml_display_server_rules,               /* display_xml_rule_func */
1221 			json_display_halflife_player_info,      /* display_json_player_func */
1222 			json_display_server_rules,              /* display_json_rule_func */
1223 			send_hl2_request_packet,                /* status_query_func */
1224 			NULL,                                   /* rule_query_func */
1225 			NULL,                                   /* player_query_func */
1226 			deal_with_hl2_packet,                   /* packet_func */
1227 		},
1228 		{
1229 			/* RETURN TO CASTLE WOLFENSTEIN */
1230 			RTCW_SERVER,                            /* id */
1231 			"RWS",                                  /* type_prefix */
1232 			"rws",                                  /* type_string */
1233 			"-rws",                                 /* type_option */
1234 			"Return to Castle Wolfenstein",         /* game_name */
1235 			0,                                      /* master */
1236 			RTCW_DEFAULT_PORT,                      /* default_port */
1237 			0,                                      /* port_offset */
1238 			TF_QUAKE3_NAMES /* TF_SINGLE_QUERY */,  /* flags */
1239 			"game",                                 /* game_rule */
1240 			"RTCW",                                 /* template_var */
1241 			(char *)&q3_serverinfo,                 /* status_packet */
1242 			sizeof(q3_serverinfo),                  /* status_len */
1243 			NULL,                                   /* player_packet */
1244 			0,                                      /* player_len */
1245 			(char *)&q3_serverstatus,               /* rule_packet */
1246 			sizeof(q3_serverstatus),                /* rule_len */
1247 			NULL,                                   /* master_packet */
1248 			0,                                      /* master_len */
1249 			NULL,                                   /* master_protocol */
1250 			NULL,                                   /* master_query */
1251 			display_q2_player_info,                 /* display_player_func */
1252 			display_server_rules,                   /* display_rule_func */
1253 			raw_display_q2_player_info,             /* display_raw_player_func */
1254 			raw_display_server_rules,               /* display_raw_rule_func */
1255 			xml_display_q2_player_info,             /* display_xml_player_func */
1256 			xml_display_server_rules,               /* display_xml_rule_func */
1257 			json_display_q2_player_info,            /* display_json_player_func */
1258 			json_display_server_rules,              /* display_json_rule_func */
1259 			send_qwserver_request_packet,           /* status_query_func */
1260 			NULL,                                   /* rule_query_func */
1261 			NULL,                                   /* player_query_func */
1262 			deal_with_qw_packet,                    /* packet_func */
1263 		},
1264 		{
1265 			/* STAR TREK: ELITE FORCE */
1266 			STEF_SERVER,                            /* id */
1267 			"EFS",                                  /* type_prefix */
1268 			"efs",                                  /* type_string */
1269 			"-efs",                                 /* type_option */
1270 			"Star Trek: Elite Force",               /* game_name */
1271 			0,                                      /* master */
1272 			STEF_DEFAULT_PORT,                      /* default_port */
1273 			0,                                      /* port_offset */
1274 			TF_QUAKE3_NAMES /* TF_SINGLE_QUERY */,  /* flags */
1275 			"game",                                 /* game_rule */
1276 			"ELITEFORCE",                           /* template_var */
1277 			(char *)&q3_serverinfo,                 /* status_packet */
1278 			sizeof(q3_serverinfo),                  /* status_len */
1279 			NULL,                                   /* player_packet */
1280 			0,                                      /* player_len */
1281 			(char *)&q3_serverstatus,               /* rule_packet */
1282 			sizeof(q3_serverstatus),                /* rule_len */
1283 			NULL,                                   /* master_packet */
1284 			0,                                      /* master_len */
1285 			NULL,                                   /* master_protocol */
1286 			NULL,                                   /* master_query */
1287 			display_q2_player_info,                 /* display_player_func */
1288 			display_server_rules,                   /* display_rule_func */
1289 			raw_display_q2_player_info,             /* display_raw_player_func */
1290 			raw_display_server_rules,               /* display_raw_rule_func */
1291 			xml_display_q2_player_info,             /* display_xml_player_func */
1292 			xml_display_server_rules,               /* display_xml_rule_func */
1293 			json_display_q2_player_info,            /* display_json_player_func */
1294 			json_display_server_rules,              /* display_json_rule_func */
1295 			send_qwserver_request_packet,           /* status_query_func */
1296 			NULL,                                   /* rule_query_func */
1297 			NULL,                                   /* player_query_func */
1298 			deal_with_qw_packet,                    /* packet_func */
1299 		},
1300 		{
1301 			/* JEDI KNIGHT: JEDI ACADEMY */
1302 			JK3_SERVER,                             /* id */
1303 			"JK3S",                                 /* type_prefix */
1304 			"jk3s",                                 /* type_string */
1305 			"-jk3s",                                /* type_option */
1306 			"Jedi Knight: Jedi Academy",            /* game_name */
1307 			0,                                      /* master */
1308 			JK3_DEFAULT_PORT,                       /* default_port */
1309 			0,                                      /* port_offset */
1310 			TF_QUAKE3_NAMES /* TF_SINGLE_QUERY */,  /* flags */
1311 			"game",                                 /* game_rule */
1312 			"JEDIKNIGHT3",                          /* template_var */
1313 			(char *)&q3_serverinfo,                 /* status_packet */
1314 			sizeof(q3_serverinfo),                  /* status_len */
1315 			NULL,                                   /* player_packet */
1316 			0,                                      /* player_len */
1317 			(char *)&q3_serverstatus,               /* rule_packet */
1318 			sizeof(q3_serverstatus),                /* rule_len */
1319 			NULL,                                   /* master_packet */
1320 			0,                                      /* master_len */
1321 			NULL,                                   /* master_protocol */
1322 			NULL,                                   /* master_query */
1323 			display_q2_player_info,                 /* display_player_func */
1324 			display_server_rules,                   /* display_rule_func */
1325 			raw_display_q2_player_info,             /* display_raw_player_func */
1326 			raw_display_server_rules,               /* display_raw_rule_func */
1327 			xml_display_q2_player_info,             /* display_xml_player_func */
1328 			xml_display_server_rules,               /* display_xml_rule_func */
1329 			json_display_q2_player_info,            /* display_json_player_func */
1330 			json_display_server_rules,              /* display_json_rule_func */
1331 			send_qwserver_request_packet,           /* status_query_func */
1332 			NULL,                                   /* rule_query_func */
1333 			NULL,                                   /* player_query_func */
1334 			deal_with_qw_packet,                    /* packet_func */
1335 		},
1336 		{
1337 			/* UNREAL TOURNAMENT 2003 */
1338 			UT2003_SERVER,                          /* id */
1339 			"UT2S",                                 /* type_prefix */
1340 			"ut2s",                                 /* type_string */
1341 			"-ut2s",                                /* type_option */
1342 			"Unreal Tournament 2003",               /* game_name */
1343 			0,                                      /* master */
1344 			UNREAL_DEFAULT_PORT,                    /* default_port */
1345 			1,                                      /* port_offset */
1346 			TF_U2_NAMES,                            /* flags */
1347 			"gametype",                             /* game_rule */
1348 			"UNREALTOURNAMENT2003",                 /* template_var */
1349 			(char *)&ut2003_basicstatus,            /* status_packet */
1350 			sizeof(ut2003_basicstatus),             /* status_len */
1351 			NULL,                                   /* player_packet */
1352 			0,                                      /* player_len */
1353 			(char *)&ut2003_allinfo,                /* rule_packet */
1354 			sizeof(ut2003_allinfo),                 /* rule_len */
1355 			NULL,                                   /* master_packet */
1356 			0,                                      /* master_len */
1357 			NULL,                                   /* master_protocol */
1358 			0,                                      /* master_query */
1359 			display_unreal_player_info,             /* display_player_func */
1360 			display_server_rules,                   /* display_rule_func */
1361 			raw_display_unreal_player_info,         /* display_raw_player_func */
1362 			raw_display_server_rules,               /* display_raw_rule_func */
1363 			xml_display_unreal_player_info,         /* display_xml_player_func */
1364 			xml_display_server_rules,               /* display_xml_rule_func */
1365 			json_display_unreal_player_info,        /* display_json_player_func */
1366 			json_display_server_rules,              /* display_json_rule_func */
1367 			send_ut2003_request_packet,             /* status_query_func */
1368 			NULL,                                   /* rule_query_func */
1369 			NULL,                                   /* player_query_func */
1370 			deal_with_ut2003_packet,                /* packet_func */
1371 		},
1372 		{
1373 			/* UNREAL */
1374 			UN_SERVER,                              /* id */
1375 			"UNS",                                  /* type_prefix */
1376 			"uns",                                  /* type_string */
1377 			"-uns",                                 /* type_option */
1378 			"Unreal",                               /* game_name */
1379 			0,                                      /* master */
1380 			UNREAL_DEFAULT_PORT,                    /* default_port */
1381 			1,                                      /* port_offset */
1382 			TF_SINGLE_QUERY,                        /* flags */
1383 			"gametype",                             /* game_rule */
1384 			"UNREAL",                               /* template_var */
1385 			(char *)&unreal_serverstatus,           /* status_packet */
1386 			sizeof(unreal_serverstatus),            /* status_len */
1387 			NULL,                                   /* player_packet */
1388 			0,                                      /* player_len */
1389 			NULL,                                   /* rule_packet */
1390 			0,                                      /* rule_len */
1391 			NULL,                                   /* master_packet */
1392 			0,                                      /* master_len */
1393 			NULL,                                   /* master_protocol */
1394 			NULL,                                   /* master_query */
1395 			display_unreal_player_info,             /* display_player_func */
1396 			display_server_rules,                   /* display_rule_func */
1397 			raw_display_unreal_player_info,         /* display_raw_player_func */
1398 			raw_display_server_rules,               /* display_raw_rule_func */
1399 			xml_display_unreal_player_info,         /* display_xml_player_func */
1400 			xml_display_server_rules,               /* display_xml_rule_func */
1401 			json_display_unreal_player_info,        /* display_json_player_func */
1402 			json_display_server_rules,              /* display_json_rule_func */
1403 			send_gps_request_packet,                /* status_query_func */
1404 			NULL,                                   /* rule_query_func */
1405 			NULL,                                   /* player_query_func */
1406 			deal_with_gps_packet,                   /* packet_func */
1407 		},
1408 		{
1409 			/* HALF LIFE */
1410 			HL_SERVER,                              /* id */
1411 			"HLS",                                  /* type_prefix */
1412 			"hls",                                  /* type_string */
1413 			"-hls",                                 /* type_option */
1414 			"Half-Life",                            /* game_name */
1415 			0,                                      /* master */
1416 			HALFLIFE_DEFAULT_PORT,                  /* default_port */
1417 			0,                                      /* port_offset */
1418 			0,                                      /* flags */
1419 			"game",                                 /* game_rule */
1420 			"HALFLIFE",                             /* template_var */
1421 			(char *)&hl_details,                    /* status_packet */
1422 			sizeof(hl_details),                     /* status_len */
1423 			(char *)&hl_players,                    /* player_packet */
1424 			sizeof(hl_players),                     /* player_len */
1425 			(char *)&hl_rules,                      /* rule_packet */
1426 			sizeof(hl_rules),                       /* rule_len */
1427 			NULL,                                   /* master_packet */
1428 			0,                                      /* master_len */
1429 			NULL,                                   /* master_protocol */
1430 			NULL,                                   /* master_query */
1431 			display_halflife_player_info,           /* display_player_func */
1432 			display_server_rules,                   /* display_rule_func */
1433 			raw_display_halflife_player_info,       /* display_raw_player_func */
1434 			raw_display_server_rules,               /* display_raw_rule_func */
1435 			xml_display_halflife_player_info,       /* display_xml_player_func */
1436 			xml_display_server_rules,               /* display_xml_rule_func */
1437 			json_display_halflife_player_info,      /* display_json_player_func */
1438 			json_display_server_rules,              /* display_json_rule_func */
1439 			send_qwserver_request_packet,           /* status_query_func */
1440 			NULL,                                   /* rule_query_func */
1441 			NULL,                                   /* player_query_func */
1442 			deal_with_halflife_packet,              /* packet_func */
1443 		},
1444 		{
1445 			/* SIN */
1446 			SIN_SERVER,                     /* id */
1447 			"SNS",                          /* type_prefix */
1448 			"sns",                          /* type_string */
1449 			"-sns",                         /* type_option */
1450 			"Sin",                          /* game_name */
1451 			0,                              /* master */
1452 			SIN_DEFAULT_PORT,               /* default_port */
1453 			0,                              /* port_offset */
1454 			TF_SINGLE_QUERY,                /* flags */
1455 			"gamedir",                      /* game_rule */
1456 			"SIN",                          /* template_var */
1457 			(char *)&qw_serverstatus,       /* status_packet */
1458 			sizeof(qw_serverstatus),        /* status_len */
1459 			NULL,                           /* player_packet */
1460 			0,                              /* player_len */
1461 			NULL,                           /* rule_packet */
1462 			0,                              /* rule_len */
1463 			NULL,                           /* master_packet */
1464 			0,                              /* master_len */
1465 			NULL,                           /* master_protocol */
1466 			NULL,                           /* master_query */
1467 			display_q2_player_info,         /* display_player_func */
1468 			display_server_rules,           /* display_rule_func */
1469 			raw_display_q2_player_info,     /* display_raw_player_func */
1470 			raw_display_server_rules,       /* display_raw_rule_func */
1471 			xml_display_q2_player_info,     /* display_xml_player_func */
1472 			xml_display_server_rules,       /* display_xml_rule_func */
1473 			json_display_q2_player_info,    /* display_json_player_func */
1474 			json_display_server_rules,      /* display_json_rule_func */
1475 			send_qwserver_request_packet,   /* status_query_func */
1476 			NULL,                           /* rule_query_func */
1477 			NULL,                           /* player_query_func */
1478 			deal_with_qw_packet,            /* packet_func */
1479 		},
1480 		{
1481 			/* SHOGO */
1482 			SHOGO_SERVER,                   /* id */
1483 			"SGS",                          /* type_prefix */
1484 			"sgs",                          /* type_string */
1485 			"-sgs",                         /* type_option */
1486 			"Shogo: Mobile Armor Division", /* game_name */
1487 			0,                              /* master */
1488 			SHOGO_DEFAULT_PORT,             /* default_port */
1489 			0,                              /* port_offset */
1490 			0,                              /* flags */
1491 			"",                             /* game_rule */
1492 			"SHOGO",                        /* template_var */
1493 			(char *)&unreal_serverstatus,   /* status_packet */
1494 			sizeof(unreal_serverstatus),    /* status_len */
1495 			NULL,                           /* player_packet */
1496 			0,                              /* player_len */
1497 			NULL,                           /* rule_packet */
1498 			0,                              /* rule_len */
1499 			NULL,                           /* master_packet */
1500 			0,                              /* master_len */
1501 			NULL,                           /* master_protocol */
1502 			NULL,                           /* master_query */
1503 			display_q2_player_info,         /* display_player_func */
1504 			display_server_rules,           /* display_rule_func */
1505 			raw_display_q2_player_info,     /* display_raw_player_func */
1506 			raw_display_server_rules,       /* display_raw_rule_func */
1507 			xml_display_q2_player_info,     /* display_xml_player_func */
1508 			xml_display_server_rules,       /* display_xml_rule_func */
1509 			json_display_q2_player_info,    /* display_json_player_func */
1510 			json_display_server_rules,      /* display_json_rule_func */
1511 			send_gps_request_packet,        /* status_query_func */
1512 			NULL,                           /* rule_query_func */
1513 			NULL,                           /* player_query_func */
1514 			deal_with_gps_packet,           /* packet_func */
1515 		},
1516 		{
1517 			/* TRIBES */
1518 			TRIBES_SERVER,                          /* id */
1519 			"TBS",                                  /* type_prefix */
1520 			"tbs",                                  /* type_string */
1521 			"-tbs",                                 /* type_option */
1522 			"Tribes",                               /* game_name */
1523 			0,                                      /* master */
1524 			TRIBES_DEFAULT_PORT,                    /* default_port */
1525 			0,                                      /* port_offset */
1526 			TF_SINGLE_QUERY,                        /* flags */
1527 			"game",                                 /* game_rule */
1528 			"TRIBES",                               /* template_var */
1529 			(char *)&tribes_info,                   /* status_packet */
1530 			sizeof(tribes_info),                    /* status_len */
1531 			(char *)&tribes_players,                /* player_packet */
1532 			sizeof(tribes_players),                 /* player_len */
1533 			(char *)&tribes_players,                /* rule_packet */
1534 			sizeof(tribes_players),                 /* rule_len */
1535 			NULL,                                   /* master_packet */
1536 			0,                                      /* master_len */
1537 			NULL,                                   /* master_protocol */
1538 			NULL,                                   /* master_query */
1539 			display_tribes_player_info,             /* display_player_func */
1540 			display_server_rules,                   /* display_rule_func */
1541 			raw_display_tribes_player_info,         /* display_raw_player_func */
1542 			raw_display_server_rules,               /* display_raw_rule_func */
1543 			xml_display_tribes_player_info,         /* display_xml_player_func */
1544 			xml_display_server_rules,               /* display_xml_rule_func */
1545 			json_display_tribes_player_info,        /* display_json_player_func */
1546 			json_display_server_rules,              /* display_json_rule_func */
1547 			send_tribes_request_packet,             /* status_query_func */
1548 			NULL,                                   /* rule_query_func */
1549 			NULL,                                   /* player_query_func */
1550 			deal_with_tribes_packet,                /* packet_func */
1551 		},
1552 		{
1553 			/* BFRIS */
1554 			BFRIS_SERVER,                   /* id */
1555 			"BFS",                          /* type_prefix */
1556 			"bfs",                          /* type_string */
1557 			"-bfs",                         /* type_option */
1558 			"BFRIS",                        /* game_name */
1559 			0,                              /* master */
1560 			BFRIS_DEFAULT_PORT,             /* default_port */
1561 			0,                              /* port_offset */
1562 			TF_TCP_CONNECT,                 /* flags */
1563 			"Rules",                        /* game_rule */
1564 			"BFRIS",                        /* template_var */
1565 			NULL,                           /* status_packet */
1566 			0,                              /* status_len */
1567 			NULL,                           /* player_packet */
1568 			0,                              /* player_len */
1569 			NULL,                           /* rule_packet */
1570 			0,                              /* rule_len */
1571 			NULL,                           /* master_packet */
1572 			0,                              /* master_len */
1573 			NULL,                           /* master_protocol */
1574 			NULL,                           /* master_query */
1575 			display_bfris_player_info,      /* display_player_func */
1576 			display_server_rules,           /* display_rule_func */
1577 			raw_display_bfris_player_info,  /* display_raw_player_func */
1578 			raw_display_server_rules,       /* display_raw_rule_func */
1579 			xml_display_bfris_player_info,  /* display_xml_player_func */
1580 			xml_display_server_rules,       /* display_xml_rule_func */
1581 			json_display_bfris_player_info, /* display_json_player_func */
1582 			json_display_server_rules,      /* display_json_rule_func */
1583 			send_bfris_request_packet,      /* status_query_func */
1584 			NULL,                           /* rule_query_func */
1585 			NULL,                           /* player_query_func */
1586 			deal_with_bfris_packet,         /* packet_func */
1587 		},
1588 		{
1589 			/* KINGPIN */
1590 			KINGPIN_SERVER,                 /* id */
1591 			"KPS",                          /* type_prefix */
1592 			"kps",                          /* type_string */
1593 			"-kps",                         /* type_option */
1594 			"Kingpin",                      /* game_name */
1595 			0,                              /* master */
1596 			KINGPIN_DEFAULT_PORT,           /* default_port */
1597 			0,                              /* port_offset */
1598 			TF_SINGLE_QUERY,                /* flags */
1599 			"gamedir",                      /* game_rule */
1600 			"KINGPIN",                      /* template_var */
1601 			(char *)&qw_serverstatus,       /* status_packet */
1602 			sizeof(qw_serverstatus),        /* status_len */
1603 			NULL,                           /* player_packet */
1604 			0,                              /* player_len */
1605 			NULL,                           /* rule_packet */
1606 			0,                              /* rule_len */
1607 			NULL,                           /* master_packet */
1608 			0,                              /* master_len */
1609 			NULL,                           /* master_protocol */
1610 			NULL,                           /* master_query */
1611 			display_q2_player_info,         /* display_player_func */
1612 			display_server_rules,           /* display_rule_func */
1613 			raw_display_q2_player_info,     /* display_raw_player_func */
1614 			raw_display_server_rules,       /* display_raw_rule_func */
1615 			xml_display_q2_player_info,     /* display_xml_player_func */
1616 			xml_display_server_rules,       /* display_xml_rule_func */
1617 			json_display_q2_player_info,    /* display_json_player_func */
1618 			json_display_server_rules,      /* display_json_rule_func */
1619 			send_qwserver_request_packet,   /* status_query_func */
1620 			NULL,                           /* rule_query_func */
1621 			NULL,                           /* player_query_func */
1622 			deal_with_qw_packet,            /* packet_func */
1623 		},
1624 		{
1625 			/* HERETIC II */
1626 			HERETIC2_SERVER,                /* id */
1627 			"HRS",                          /* type_prefix */
1628 			"hrs",                          /* type_string */
1629 			"-hrs",                         /* type_option */
1630 			"Heretic II",                   /* game_name */
1631 			0,                              /* master */
1632 			HERETIC2_DEFAULT_PORT,          /* default_port */
1633 			0,                              /* port_offset */
1634 			TF_SINGLE_QUERY,                /* flags */
1635 			"gamedir",                      /* game_rule */
1636 			"HERETIC2",                     /* template_var */
1637 			(char *)&qw_serverstatus,       /* status_packet */
1638 			sizeof(qw_serverstatus),        /* status_len */
1639 			NULL,                           /* player_packet */
1640 			0,                              /* player_len */
1641 			NULL,                           /* rule_packet */
1642 			0,                              /* rule_len */
1643 			NULL,                           /* master_packet */
1644 			0,                              /* master_len */
1645 			NULL,                           /* master_protocol */
1646 			NULL,                           /* master_query */
1647 			display_q2_player_info,         /* display_player_func */
1648 			display_server_rules,           /* display_rule_func */
1649 			raw_display_q2_player_info,     /* display_raw_player_func */
1650 			raw_display_server_rules,       /* display_raw_rule_func */
1651 			xml_display_q2_player_info,     /* display_xml_player_func */
1652 			xml_display_server_rules,       /* display_xml_rule_func */
1653 			json_display_q2_player_info,    /* display_json_player_func */
1654 			json_display_server_rules,      /* display_json_rule_func */
1655 			send_qwserver_request_packet,   /* status_query_func */
1656 			NULL,                           /* rule_query_func */
1657 			NULL,                           /* player_query_func */
1658 			deal_with_qw_packet,            /* packet_func */
1659 		},
1660 		{
1661 			/* SOLDIER OF FORTUNE */
1662 			SOF_SERVER,                     /* id */
1663 			"SFS",                          /* type_prefix */
1664 			"sfs",                          /* type_string */
1665 			"-sfs",                         /* type_option */
1666 			"Soldier of Fortune",           /* game_name */
1667 			0,                              /* master */
1668 			SOF_DEFAULT_PORT,               /* default_port */
1669 			0,                              /* port_offset */
1670 			TF_SINGLE_QUERY | TF_SOF_NAMES, /* flags */
1671 			"gamedir",                      /* game_rule */
1672 			"SOLDIEROFFORTUNE",             /* template_var */
1673 			(char *)&qw_serverstatus,       /* status_packet */
1674 			sizeof(qw_serverstatus),        /* status_len */
1675 			NULL,                           /* player_packet */
1676 			0,                              /* player_len */
1677 			NULL,                           /* rule_packet */
1678 			0,                              /* rule_len */
1679 			NULL,                           /* master_packet */
1680 			0,                              /* master_len */
1681 			NULL,                           /* master_protocol */
1682 			NULL,                           /* master_query */
1683 			display_q2_player_info,         /* display_player_func */
1684 			display_server_rules,           /* display_rule_func */
1685 			raw_display_q2_player_info,     /* display_raw_player_func */
1686 			raw_display_server_rules,       /* display_raw_rule_func */
1687 			xml_display_q2_player_info,     /* display_xml_player_func */
1688 			xml_display_server_rules,       /* display_xml_rule_func */
1689 			json_display_q2_player_info,    /* display_json_player_func */
1690 			json_display_server_rules,      /* display_json_rule_func */
1691 			send_qwserver_request_packet,   /* status_query_func */
1692 			NULL,                           /* rule_query_func */
1693 			NULL,                           /* player_query_func */
1694 			deal_with_qw_packet,            /* packet_func */
1695 		},
1696 		{
1697 			/* GAMESPY PROTOCOL */
1698 			GAMESPY_PROTOCOL_SERVER,                /* id */
1699 			"GPS",                                  /* type_prefix */
1700 			"gps",                                  /* type_string */
1701 			"-gps",                                 /* type_option */
1702 			"Gamespy Protocol",                     /* game_name */
1703 			0,                                      /* master */
1704 			0,                                      /* default_port */
1705 			0,                                      /* port_offset */
1706 			TF_SINGLE_QUERY | TF_U2_NAMES,          /* flags */
1707 			"gametype",                             /* game_rule */
1708 			"GAMESPYPROTOCOL",                      /* template_var */
1709 			(char *)&unreal_serverstatus,           /* status_packet */
1710 			sizeof(unreal_serverstatus),            /* status_len */
1711 			NULL,                                   /* player_packet */
1712 			0,                                      /* player_len */
1713 			NULL,                                   /* rule_packet */
1714 			0,                                      /* rule_len */
1715 			NULL,                                   /* master_packet */
1716 			0,                                      /* master_len */
1717 			NULL,                                   /* master_protocol */
1718 			NULL,                                   /* master_query */
1719 			display_unreal_player_info,             /* display_player_func */
1720 			display_server_rules,                   /* display_rule_func */
1721 			raw_display_unreal_player_info,         /* display_raw_player_func */
1722 			raw_display_server_rules,               /* display_raw_rule_func */
1723 			xml_display_unreal_player_info,         /* display_xml_player_func */
1724 			xml_display_server_rules,               /* display_xml_rule_func */
1725 			json_display_unreal_player_info,        /* display_json_player_func */
1726 			json_display_server_rules,              /* display_json_rule_func */
1727 			send_gps_request_packet,                /* status_query_func */
1728 			NULL,                                   /* rule_query_func */
1729 			NULL,                                   /* player_query_func */
1730 			deal_with_gps_packet,                   /* packet_func */
1731 		},
1732 		{
1733 			/* TRIBES 2 */
1734 			TRIBES2_SERVER,                         /* id */
1735 			"T2S",                                  /* type_prefix */
1736 			"t2s",                                  /* type_string */
1737 			"-t2s",                                 /* type_option */
1738 			"Tribes 2",                             /* game_name */
1739 			0,                                      /* master */
1740 			TRIBES2_DEFAULT_PORT,                   /* default_port */
1741 			0,                                      /* port_offset */
1742 			0,                                      /* flags */
1743 			"game",                                 /* game_rule */
1744 			"TRIBES2",                              /* template_var */
1745 			(char *)&tribes2_ping,                  /* status_packet */
1746 			sizeof(tribes2_ping),                   /* status_len */
1747 			(char *)&tribes2_info,                  /* player_packet */
1748 			sizeof(tribes2_info),                   /* player_len */
1749 			(char *)NULL,                           /* rule_packet */
1750 			0,                                      /* rule_len */
1751 			NULL,                                   /* master_packet */
1752 			0,                                      /* master_len */
1753 			NULL,                                   /* master_protocol */
1754 			NULL,                                   /* master_query */
1755 			display_tribes2_player_info,            /* display_player_func */
1756 			display_server_rules,                   /* display_rule_func */
1757 			raw_display_tribes2_player_info,        /* display_raw_player_func */
1758 			raw_display_server_rules,               /* display_raw_rule_func */
1759 			xml_display_tribes2_player_info,        /* display_xml_player_func */
1760 			xml_display_server_rules,               /* display_xml_rule_func */
1761 			json_display_tribes2_player_info,       /* display_json_player_func */
1762 			json_display_server_rules,              /* display_json_rule_func */
1763 			send_tribes2_request_packet,            /* status_query_func */
1764 			NULL,                                   /* rule_query_func */
1765 			NULL,                                   /* player_query_func */
1766 			deal_with_tribes2_packet,               /* packet_func */
1767 		},
1768 		{
1769 			/* DESCENT3 GAMESPY PROTOCOL */
1770 			DESCENT3_GAMESPY_SERVER,                /* id */
1771 			"D3G",                                  /* type_prefix */
1772 			"d3g",                                  /* type_string */
1773 			"-d3g",                                 /* type_option */
1774 			"Descent3 Gamespy Protocol",            /* game_name */
1775 			0,                                      /* master */
1776 			DESCENT3_GAMESPY_DEFAULT_PORT,          /* default_port */
1777 			0,                                      /* port_offset */
1778 			TF_SINGLE_QUERY,                        /* flags */
1779 			"gametype",                             /* game_rule */
1780 			"DESCENT3",                             /* template_var */
1781 			(char *)&unreal_serverstatus,           /* status_packet */
1782 			sizeof(unreal_serverstatus),            /* status_len */
1783 			NULL,                                   /* player_packet */
1784 			0,                                      /* player_len */
1785 			NULL,                                   /* rule_packet */
1786 			0,                                      /* rule_len */
1787 			NULL,                                   /* master_packet */
1788 			0,                                      /* master_len */
1789 			NULL,                                   /* master_protocol */
1790 			NULL,                                   /* master_query */
1791 			display_descent3_player_info,           /* display_player_func */
1792 			display_server_rules,                   /* display_rule_func */
1793 			raw_display_descent3_player_info,       /* display_raw_player_func */
1794 			raw_display_server_rules,               /* display_raw_rule_func */
1795 			xml_display_descent3_player_info,       /* display_xml_player_func */
1796 			xml_display_server_rules,               /* display_xml_rule_func */
1797 			json_display_descent3_player_info,      /* display_json_player_func */
1798 			json_display_server_rules,              /* display_json_rule_func */
1799 			send_gps_request_packet,                /* status_query_func */
1800 			NULL,                                   /* rule_query_func */
1801 			NULL,                                   /* player_query_func */
1802 			deal_with_gps_packet,                   /* packet_func */
1803 		},
1804 		{
1805 			/* DESCENT3 PROTOCOL */
1806 			DESCENT3_SERVER,                        /* id */
1807 			"D3S",                                  /* type_prefix */
1808 			"d3s",                                  /* type_string */
1809 			"-d3s",                                 /* type_option */
1810 			"Descent3",                             /* game_name */
1811 			0,                                      /* master */
1812 			DESCENT3_DEFAULT_PORT,                  /* default_port */
1813 			0,                                      /* port_offset */
1814 			0,                                      /* flags */
1815 			"gametype",                             /* game_rule */
1816 			"DESCENT3",                             /* template_var */
1817 			(char *)&descent3_tcpipinfoquery,       /* status_packet */
1818 			sizeof(descent3_tcpipinfoquery),        /* status_len */
1819 			(char *)&descent3_playerquery,          /* player_packet */
1820 			sizeof(descent3_playerquery),           /* player_len */
1821 			NULL,                                   /* rule_packet */
1822 			0,                                      /* rule_len */
1823 			NULL,                                   /* master_packet */
1824 			0,                                      /* master_len */
1825 			NULL,                                   /* master_protocol */
1826 			NULL,                                   /* master_query */
1827 			display_descent3_player_info,           /* display_player_func */
1828 			display_server_rules,                   /* display_rule_func */
1829 			raw_display_descent3_player_info,       /* display_raw_player_func */
1830 			raw_display_server_rules,               /* display_raw_rule_func */
1831 			xml_display_descent3_player_info,       /* display_xml_player_func */
1832 			xml_display_server_rules,               /* display_xml_rule_func */
1833 			json_display_descent3_player_info,      /* display_json_player_func */
1834 			json_display_server_rules,              /* display_json_rule_func */
1835 			send_gps_request_packet,                /* status_query_func */
1836 			NULL,                                   /* rule_query_func */
1837 			NULL,                                   /* player_query_func */
1838 			deal_with_descent3_packet,              /* packet_func */
1839 		},
1840 		{
1841 			/* DESCENT3 PROTOCOL */
1842 			DESCENT3_PXO_SERVER,                    /* id */
1843 			"D3P",                                  /* type_prefix */
1844 			"d3p",                                  /* type_string */
1845 			"-d3p",                                 /* type_option */
1846 			"Descent3 PXO protocol",                /* game_name */
1847 			0,                                      /* master */
1848 			DESCENT3_DEFAULT_PORT,                  /* default_port */
1849 			0,                                      /* port_offset */
1850 			0,                                      /* flags */
1851 			"gametype",                             /* game_rule */
1852 			"DESCENT3",                             /* template_var */
1853 			(char *)&descent3_pxoinfoquery,         /* status_packet */
1854 			sizeof(descent3_pxoinfoquery),          /* status_len */
1855 			(char *)&descent3_playerquery,          /* player_packet */
1856 			sizeof(descent3_playerquery),           /* player_len */
1857 			NULL,                                   /* rule_packet */
1858 			0,                                      /* rule_len */
1859 			NULL,                                   /* master_packet */
1860 			0,                                      /* master_len */
1861 			NULL,                                   /* master_protocol */
1862 			NULL,                                   /* master_query */
1863 			display_descent3_player_info,           /* display_player_func */
1864 			display_server_rules,                   /* display_rule_func */
1865 			raw_display_descent3_player_info,       /* display_raw_player_func */
1866 			raw_display_server_rules,               /* display_raw_rule_func */
1867 			xml_display_descent3_player_info,       /* display_xml_player_func */
1868 			xml_display_server_rules,               /* display_xml_rule_func */
1869 			json_display_descent3_player_info,      /* display_json_player_func */
1870 			json_display_server_rules,              /* display_json_rule_func */
1871 			send_gps_request_packet,                /* status_query_func */
1872 			NULL,                                   /* rule_query_func */
1873 			NULL,                                   /* player_query_func */
1874 			deal_with_descent3_packet,              /* packet_func */
1875 		},
1876 		{
1877 			/* GHOSTRECON PROTOCOL */
1878 			GHOSTRECON_SERVER,                      /* id */
1879 			"GRS",                                  /* type_prefix */
1880 			"grs",                                  /* type_string */
1881 			"-grs",                                 /* type_option */
1882 			"Ghost Recon",                          /* game_name */
1883 			0,                                      /* master */
1884 			GHOSTRECON_PLAYER_DEFAULT_PORT,         /* default_port */
1885 			2,                                      /* port_offset */
1886 			TF_QUERY_ARG,                           /* flags */
1887 			"gametype",                             /* game_rule */
1888 			"GHOSTRECON",                           /* template_var */
1889 			(char *)&ghostrecon_playerquery,        /* status_packet */
1890 			sizeof(ghostrecon_playerquery),         /* status_len */
1891 			NULL,                                   /* player_packet */
1892 			0,                                      /* player_len */
1893 			NULL,                                   /* rule_packet */
1894 			0,                                      /* rule_len */
1895 			NULL,                                   /* master_packet */
1896 			0,                                      /* master_len */
1897 			NULL,                                   /* master_protocol */
1898 			NULL,                                   /* master_query */
1899 			display_ghostrecon_player_info,         /* display_player_func */
1900 			display_server_rules,                   /* display_rule_func */
1901 			raw_display_ghostrecon_player_info,     /* display_raw_player_func */
1902 			raw_display_server_rules,               /* display_raw_rule_func */
1903 			xml_display_ghostrecon_player_info,     /* display_xml_player_func */
1904 			xml_display_server_rules,               /* display_xml_rule_func */
1905 			json_display_ghostrecon_player_info,    /* display_json_player_func */
1906 			json_display_server_rules,              /* display_json_rule_func */
1907 			send_qserver_request_packet,            /* status_query_func */
1908 			NULL,                                   /* rule_query_func */
1909 			NULL,                                   /* player_query_func */
1910 			deal_with_ghostrecon_packet,            /* packet_func */
1911 		},
1912 		{
1913 			/* ALL SEEING EYE PROTOCOL */
1914 			ALLSEEINGEYE_PROTOCOL_SERVER,   /* id */
1915 			"EYE",                          /* type_prefix */
1916 			"eye",                          /* type_string */
1917 			"-eye",                         /* type_option */
1918 			"All Seeing Eye Protocol",      /* game_name */
1919 			0,                              /* master */
1920 			0,                              /* default_port */
1921 			123,                            /* port_offset */
1922 			TF_SINGLE_QUERY,                /* flags */
1923 			"gametype",                     /* game_rule */
1924 			"EYEPROTOCOL",                  /* template_var */
1925 			(char *)&eye_status_query,      /* status_packet */
1926 			sizeof(eye_status_query),       /* status_len */
1927 			NULL,                           /* player_packet */
1928 			0,                              /* player_len */
1929 			NULL,                           /* rule_packet */
1930 			0,                              /* rule_len */
1931 			NULL,                           /* master_packet */
1932 			0,                              /* master_len */
1933 			NULL,                           /* master_protocol */
1934 			NULL,                           /* master_query */
1935 			display_eye_player_info,        /* display_player_func */
1936 			display_server_rules,           /* display_rule_func */
1937 			raw_display_eye_player_info,    /* display_raw_player_func */
1938 			raw_display_server_rules,       /* display_raw_rule_func */
1939 			xml_display_eye_player_info,    /* display_xml_player_func */
1940 			xml_display_server_rules,       /* display_xml_rule_func */
1941 			json_display_eye_player_info,   /* display_json_player_func */
1942 			json_display_server_rules,      /* display_json_rule_func */
1943 			send_qserver_request_packet,    /* status_query_func */
1944 			NULL,                           /* rule_query_func */
1945 			NULL,                           /* player_query_func */
1946 			deal_with_eye_packet,           /* packet_func */
1947 		},
1948 		{
1949 			/* GAMESPY V2 PROTOCOL */
1950 			GAMESPY2_PROTOCOL_SERVER,       /* id */
1951 			"GS2",                          /* type_prefix */
1952 			"gs2",                          /* type_string */
1953 			"-gs2",                         /* type_option */
1954 			"Gamespy V2 Protocol",          /* game_name */
1955 			0,                              /* master */
1956 			0,                              /* default_port */
1957 			0,                              /* port_offset */
1958 			TF_SINGLE_QUERY,                /* flags */
1959 			"gametype",                     /* game_rule */
1960 			"GPS2PROTOCOL",                 /* template_var */
1961 			(char *)&gs2_status_query,      /* status_packet */
1962 			sizeof(gs2_status_query),       /* status_len */
1963 			NULL,                           /* player_packet */
1964 			0,                              /* player_len */
1965 			NULL,                           /* rule_packet */
1966 			0,                              /* rule_len */
1967 			NULL,                           /* master_packet */
1968 			0,                              /* master_len */
1969 			NULL,                           /* master_protocol */
1970 			NULL,                           /* master_query */
1971 			display_gs2_player_info,        /* display_player_func */
1972 			display_server_rules,           /* display_rule_func */
1973 			raw_display_gs2_player_info,    /* display_raw_player_func */
1974 			raw_display_server_rules,       /* display_raw_rule_func */
1975 			xml_display_player_info,        /* display_xml_player_func */
1976 			xml_display_server_rules,       /* display_xml_rule_func */
1977 			json_display_player_info,       /* display_json_player_func */
1978 			json_display_server_rules,      /* display_json_rule_func */
1979 			send_gs2_request_packet,        /* status_query_func */
1980 			NULL,                           /* rule_query_func */
1981 			NULL,                           /* player_query_func */
1982 			deal_with_gs2_packet,           /* packet_func */
1983 		},
1984 		{
1985 			/* AMERICA'S ARMY EXTENSION (GS2 BASED) */
1986 			ARMYOPS_SERVER,                         /* id */
1987 			"AMS",                                  /* type_prefix */
1988 			"ams",                                  /* type_string */
1989 			"-ams",                                 /* type_option */
1990 			"America's Army v2.x",                  /* game_name */
1991 			0,                                      /* master */
1992 			1716,                                   /* default_port */
1993 			1,                                      /* port_offset */
1994 			TF_SINGLE_QUERY | TF_U2_NAMES,          /* flags */
1995 			"gametype",                             /* game_rule */
1996 			"AMERICASARMY",                         /* template_var */
1997 			(char *)&gs2_status_query,              /* status_packet */
1998 			sizeof(gs2_status_query),               /* status_len */
1999 			NULL,                                   /* player_packet */
2000 			0,                                      /* player_len */
2001 			NULL,                                   /* rule_packet */
2002 			0,                                      /* rule_len */
2003 			NULL,                                   /* master_packet */
2004 			0,                                      /* master_len */
2005 			NULL,                                   /* master_protocol */
2006 			NULL,                                   /* master_query */
2007 			display_armyops_player_info,            /* display_player_func */
2008 			display_server_rules,                   /* display_rule_func */
2009 			raw_display_armyops_player_info,        /* display_raw_player_func */
2010 			raw_display_server_rules,               /* display_raw_rule_func */
2011 			xml_display_armyops_player_info,        /* display_xml_player_func */
2012 			xml_display_server_rules,               /* display_xml_rule_func */
2013 			json_display_armyops_player_info,       /* display_json_player_func */
2014 			json_display_server_rules,              /* display_json_rule_func */
2015 			send_gs2_request_packet,                /* status_query_func */
2016 			NULL,                                   /* rule_query_func */
2017 			NULL,                                   /* player_query_func */
2018 			deal_with_gs2_packet,                   /* packet_func */
2019 		},
2020 		{
2021 			/* RAVENSHIELD PROTOCOL */
2022 			RAVENSHIELD_SERVER,                     /* id */
2023 			"RSS",                                  /* type_prefix */
2024 			"rss",                                  /* type_string */
2025 			"-rss",                                 /* type_option */
2026 			"Ravenshield",                          /* game_name */
2027 			0,                                      /* master */
2028 			RAVENSHIELD_DEFAULT_PORT,               /* default_port */
2029 			1000,                                   /* port_offset */
2030 			TF_QUERY_ARG,                           /* flags */
2031 			"gametype",                             /* game_rule */
2032 			"RAVENSHIELD",                          /* template_var */
2033 			(char *)ravenshield_serverquery,        /* status_packet */
2034 			sizeof(ravenshield_serverquery) - 1,    /* status_len */
2035 			NULL,                                   /* player_packet */
2036 			0,                                      /* player_len */
2037 			NULL,                                   /* rule_packet */
2038 			0,                                      /* rule_len */
2039 			NULL,                                   /* master_packet */
2040 			0,                                      /* master_len */
2041 			NULL,                                   /* master_protocol */
2042 			NULL,                                   /* master_query */
2043 			display_ravenshield_player_info,        /* display_player_func */
2044 			display_server_rules,                   /* display_rule_func */
2045 			raw_display_ravenshield_player_info,    /* display_raw_player_func */
2046 			raw_display_server_rules,               /* display_raw_rule_func */
2047 			xml_display_ravenshield_player_info,    /* display_xml_player_func */
2048 			xml_display_server_rules,               /* display_xml_rule_func */
2049 			json_display_ravenshield_player_info,   /* display_json_player_func */
2050 			json_display_server_rules,              /* display_json_rule_func */
2051 			send_qserver_request_packet,            /* status_query_func */
2052 			NULL,                                   /* rule_query_func */
2053 			NULL,                                   /* player_query_func */
2054 			deal_with_ravenshield_packet,           /* packet_func */
2055 		},
2056 		{
2057 			/* SAVAGE PROTOCOL */
2058 			SAVAGE_SERVER,                          /* id */
2059 			"SAS",                                  /* type_prefix */
2060 			"sas",                                  /* type_string */
2061 			"-sas",                                 /* type_option */
2062 			"Savage",                               /* game_name */
2063 			0,                                      /* master */
2064 			SAVAGE_DEFAULT_PORT,                    /* default_port */
2065 			0,                                      /* port_offset */
2066 			TF_QUERY_ARG,                           /* flags */
2067 			"gametype",                             /* game_rule */
2068 			"SAVAGE",                               /* template_var */
2069 			(char *)savage_serverquery,             /* status_packet */
2070 			sizeof(savage_serverquery) - 1,         /* status_len */
2071 			(char *)savage_playerquery,             /* player_packet */
2072 			sizeof(savage_playerquery) - 1,         /* player_len */
2073 			NULL,                                   /* rule_packet */
2074 			0,                                      /* rule_len */
2075 			NULL,                                   /* master_packet */
2076 			0,                                      /* master_len */
2077 			NULL,                                   /* master_protocol */
2078 			NULL,                                   /* master_query */
2079 			display_savage_player_info,             /* display_player_func */
2080 			display_server_rules,                   /* display_rule_func */
2081 			raw_display_savage_player_info,         /* display_raw_player_func */
2082 			raw_display_server_rules,               /* display_raw_rule_func */
2083 			xml_display_savage_player_info,         /* display_xml_player_func */
2084 			xml_display_server_rules,               /* display_xml_rule_func */
2085 			json_display_savage_player_info,        /* display_json_player_func */
2086 			json_display_server_rules,              /* display_json_rule_func */
2087 			send_savage_request_packet,             /* status_query_func */
2088 			NULL,                                   /* rule_query_func */
2089 			NULL,                                   /* player_query_func */
2090 			deal_with_savage_packet,                /* packet_func */
2091 		},
2092 		{
2093 			/* FARCRY PROTOCOL */
2094 			FARCRY_SERVER,                          /* id */
2095 			"FCS",                                  /* type_prefix */
2096 			"fcs",                                  /* type_string */
2097 			"-fcs",                                 /* type_option */
2098 			"FarCry",                               /* game_name */
2099 			0,                                      /* master */
2100 			FARCRY_DEFAULT_PORT,                    /* default_port */
2101 			0,                                      /* port_offset */
2102 			TF_QUERY_ARG,                           /* flags */
2103 			"gametype",                             /* game_rule */
2104 			"FARCRY",                               /* template_var */
2105 			(char *)farcry_serverquery,             /* status_packet */
2106 			sizeof(savage_serverquery) - 1,         /* status_len */
2107 			NULL,                                   /* player_packet */
2108 			0,                                      /* player_len */
2109 			NULL,                                   /* rule_packet */
2110 			0,                                      /* rule_len */
2111 			NULL,                                   /* master_packet */
2112 			0,                                      /* master_len */
2113 			NULL,                                   /* master_protocol */
2114 			NULL,                                   /* master_query */
2115 			display_farcry_player_info,             /* display_player_func */
2116 			display_server_rules,                   /* display_rule_func */
2117 			raw_display_farcry_player_info,         /* display_raw_player_func */
2118 			raw_display_server_rules,               /* display_raw_rule_func */
2119 			xml_display_farcry_player_info,         /* display_xml_player_func */
2120 			xml_display_server_rules,               /* display_xml_rule_func */
2121 			json_display_farcry_player_info,        /* display_json_player_func */
2122 			json_display_server_rules,              /* display_json_rule_func */
2123 			send_farcry_request_packet,             /* status_query_func */
2124 			NULL,                                   /* rule_query_func */
2125 			NULL,                                   /* player_query_func */
2126 			deal_with_farcry_packet,                /* packet_func */
2127 		},
2128 
2129 /* --- MASTER SERVERS --- */
2130 		{
2131 			/* QUAKE WORLD MASTER */
2132 			QW_MASTER,                      /* id */
2133 			"QWM",                          /* type_prefix */
2134 			"qwm",                          /* type_string */
2135 			"-qwm",                         /* type_option */ /* ## also "-qw" */
2136 			"QuakeWorld Master",            /* game_name */
2137 			QW_SERVER,                      /* master */
2138 			QW_MASTER_DEFAULT_PORT,         /* default_port */
2139 			0,                              /* port_offset */
2140 			TF_SINGLE_QUERY | TF_OUTFILE,   /* flags */
2141 			"",                             /* game_rule */
2142 			"QWMASTER",                     /* template_var */
2143 			NULL,                           /* status_packet */
2144 			0,                              /* status_len */
2145 			NULL,                           /* player_packet */
2146 			0,                              /* player_len */
2147 			NULL,                           /* rule_packet */
2148 			0,                              /* rule_len */
2149 			(char *)&qw_masterquery,        /* master_packet */
2150 			sizeof(qw_masterquery),         /* master_len */
2151 			NULL,                           /* master_protocol */
2152 			NULL,                           /* master_query */
2153 			display_qwmaster,               /* display_player_func */
2154 			NULL,                           /* display_rule_func */
2155 			NULL,                           /* display_raw_player_func */
2156 			NULL,                           /* display_raw_rule_func */
2157 			NULL,                           /* display_xml_player_func */
2158 			NULL,                           /* display_xml_rule_func */
2159 			NULL,                           /* display_json_player_func */
2160 			NULL,                           /* display_json_rule_func */
2161 			send_qwmaster_request_packet,   /* status_query_func */
2162 			NULL,                           /* rule_query_func */
2163 			NULL,                           /* player_query_func */
2164 			deal_with_qwmaster_packet,      /* packet_func */
2165 		},
2166 		{
2167 			/* HEXEN2WORLD MASTER */
2168 			HW_MASTER,                      /* id */
2169 			"HWM",                          /* type_prefix */
2170 			"hwm",                          /* type_string */
2171 			"-hwm",                         /* type_option */ /* ## also "-qw" */
2172 			"HexenWorld Master",            /* game_name */
2173 			HW_SERVER,                      /* master */
2174 			HW_MASTER_DEFAULT_PORT,         /* default_port */
2175 			0,                              /* port_offset */
2176 			TF_SINGLE_QUERY | TF_OUTFILE,   /* flags */
2177 			"",                             /* game_rule */
2178 			"HWMASTER",                     /* template_var */
2179 			NULL,                           /* status_packet */
2180 			0,                              /* status_len */
2181 			NULL,                           /* player_packet */
2182 			0,                              /* player_len */
2183 			NULL,                           /* rule_packet */
2184 			0,                              /* rule_len */
2185 			(char *)&hw_masterquery,        /* master_packet */
2186 			sizeof(hw_masterquery),         /* master_len */
2187 			NULL,                           /* master_protocol */
2188 			NULL,                           /* master_query */
2189 			display_qwmaster,               /* display_player_func */
2190 			NULL,                           /* display_rule_func */
2191 			NULL,                           /* display_raw_player_func */
2192 			NULL,                           /* display_raw_rule_func */
2193 			NULL,                           /* display_xml_player_func */
2194 			NULL,                           /* display_xml_rule_func */
2195 			NULL,                           /* display_json_player_func */
2196 			NULL,                           /* display_json_rule_func */
2197 			send_qwmaster_request_packet,   /* status_query_func */
2198 			NULL,                           /* rule_query_func */
2199 			NULL,                           /* player_query_func */
2200 			deal_with_qwmaster_packet,      /* packet_func */
2201 		},
2202 		{
2203 			/* QUAKE 2 MASTER */
2204 			Q2_MASTER,                      /* id */
2205 			"Q2M",                          /* type_prefix */
2206 			"q2m",                          /* type_string */
2207 			"-q2m",                         /* type_option */ /* ## also "-qw" */
2208 			"Quake II Master",              /* game_name */
2209 			Q2_SERVER,                      /* master */
2210 			Q2_MASTER_DEFAULT_PORT,         /* default_port */
2211 			0,                              /* port_offset */
2212 			TF_SINGLE_QUERY | TF_OUTFILE,   /* flags */
2213 			"",                             /* game_rule */
2214 			"Q2MASTER",                     /* template_var */
2215 			NULL,                           /* status_packet */
2216 			0,                              /* status_len */
2217 			NULL,                           /* player_packet */
2218 			0,                              /* player_len */
2219 			NULL,                           /* rule_packet */
2220 			0,                              /* rule_len */
2221 			q2_masterquery,                 /* master_packet */
2222 			sizeof(q2_masterquery),         /* master_len */
2223 			NULL,                           /* master_protocol */
2224 			NULL,                           /* master_query */
2225 			display_qwmaster,               /* display_player_func */
2226 			NULL,                           /* display_rule_func */
2227 			NULL,                           /* display_raw_player_func */
2228 			NULL,                           /* display_raw_rule_func */
2229 			NULL,                           /* display_xml_player_func */
2230 			NULL,                           /* display_xml_rule_func */
2231 			NULL,                           /* display_json_player_func */
2232 			NULL,                           /* display_json_rule_func */
2233 			send_qwmaster_request_packet,   /* status_query_func */
2234 			NULL,                           /* rule_query_func */
2235 			NULL,                           /* player_query_func */
2236 			deal_with_qwmaster_packet,      /* packet_func */
2237 		},
2238 		{
2239 			/* QUAKE 3 MASTER */
2240 			Q3_MASTER,                      /* id */
2241 			"Q3M",                          /* type_prefix */
2242 			"q3m",                          /* type_string */
2243 			"-q3m",                         /* type_option */
2244 			"Quake III Master",             /* game_name */
2245 			Q3_SERVER,                      /* master */
2246 			Q3_MASTER_DEFAULT_PORT,         /* default_port */
2247 			0,                              /* port_offset */
2248 			TF_OUTFILE | TF_QUERY_ARG,      /* flags */
2249 			"",                             /* game_rule */
2250 			"Q3MASTER",                     /* template_var */
2251 			NULL,                           /* status_packet */
2252 			0,                              /* status_len */
2253 			NULL,                           /* player_packet */
2254 			0,                              /* player_len */
2255 			NULL,                           /* rule_packet */
2256 			0,                              /* rule_len */
2257 			q3_master_query_template,       /* master_packet */
2258 			0,                              /* master_len */
2259 			q3_master_default_protocol,     /* master_protocol */
2260 			q3_master_default_query,        /* master_query */
2261 			display_qwmaster,               /* display_player_func */
2262 			NULL,                           /* display_rule_func */
2263 			NULL,                           /* display_raw_player_func */
2264 			NULL,                           /* display_raw_rule_func */
2265 			NULL,                           /* display_xml_player_func */
2266 			NULL,                           /* display_xml_rule_func */
2267 			NULL,                           /* display_json_player_func */
2268 			NULL,                           /* display_json_rule_func */
2269 			send_qwmaster_request_packet,   /* status_query_func */
2270 			NULL,                           /* rule_query_func */
2271 			NULL,                           /* player_query_func */
2272 			deal_with_qwmaster_packet,      /* packet_func */
2273 		},
2274 		{
2275 			/* DOOM 3 MASTER */
2276 			DOOM3_MASTER,                           /* id */
2277 			"DM3M",                                 /* type_prefix */
2278 			"dm3m",                                 /* type_string */
2279 			"-dm3m",                                /* type_option */
2280 			"Doom 3 Master",                        /* game_name */
2281 			DOOM3_SERVER,                           /* master */
2282 			DOOM3_MASTER_DEFAULT_PORT,              /* default_port */
2283 			0,                                      /* port_offset */
2284 			TF_OUTFILE | TF_QUERY_ARG,              /* flags */
2285 			"",                                     /* game_rule */
2286 			"DOOM3MASTER",                          /* template_var */
2287 			NULL,                                   /* status_packet */
2288 			0,                                      /* status_len */
2289 			NULL,                                   /* player_packet */
2290 			0,                                      /* player_len */
2291 			NULL,                                   /* rule_packet */
2292 			0,                                      /* rule_len */
2293 			NULL,                                   /* master_packet */
2294 			0,                                      /* master_len */
2295 			NULL,                                   /* master_protocol */
2296 			NULL,                                   /* master_query */
2297 			display_qwmaster,                       /* display_player_func */
2298 			NULL,                                   /* display_rule_func */
2299 			NULL,                                   /* display_raw_player_func */
2300 			NULL,                                   /* display_raw_rule_func */
2301 			NULL,                                   /* display_xml_player_func */
2302 			NULL,                                   /* display_xml_rule_func */
2303 			NULL,                                   /* display_json_player_func */
2304 			NULL,                                   /* display_json_rule_func */
2305 			send_doom3master_request_packet,        /* status_query_func */
2306 			NULL,                                   /* rule_query_func */
2307 			NULL,                                   /* player_query_func */
2308 			deal_with_doom3master_packet,           /* packet_func */
2309 		},
2310 		{
2311 			/* RETURN TO CASTLE WOLFENSTEIN MASTER */
2312 			RTCW_MASTER,                            /* id */
2313 			"RWM",                                  /* type_prefix */
2314 			"rwm",                                  /* type_string */
2315 			"-rwm",                                 /* type_option */
2316 			"Return to Castle Wolfenstein Master",  /* game_name */
2317 			RTCW_SERVER,                            /* master */
2318 			RTCW_MASTER_DEFAULT_PORT,               /* default_port */
2319 			0,                                      /* port_offset */
2320 			TF_OUTFILE | TF_QUERY_ARG,              /* flags */
2321 			"",                                     /* game_rule */
2322 			"RTCWMASTER",                           /* template_var */
2323 			NULL,                                   /* status_packet */
2324 			0,                                      /* status_len */
2325 			NULL,                                   /* player_packet */
2326 			0,                                      /* player_len */
2327 			NULL,                                   /* rule_packet */
2328 			0,                                      /* rule_len */
2329 			q3_master_query_template,               /* master_packet */
2330 			0,                                      /* master_len */
2331 			rtcw_master_default_protocol,           /* master_protocol */
2332 			q3_master_default_query,                /* master_query */
2333 			display_qwmaster,                       /* display_player_func */
2334 			NULL,                                   /* display_rule_func */
2335 			NULL,                                   /* display_raw_player_func */
2336 			NULL,                                   /* display_raw_rule_func */
2337 			NULL,                                   /* display_xml_player_func */
2338 			NULL,                                   /* display_xml_rule_func */
2339 			NULL,                                   /* display_json_player_func */
2340 			NULL,                                   /* display_json_rule_func */
2341 			send_qwmaster_request_packet,           /* status_query_func */
2342 			NULL,                                   /* rule_query_func */
2343 			NULL,                                   /* player_query_func */
2344 			deal_with_qwmaster_packet,              /* packet_func */
2345 		},
2346 		{
2347 			/* STAR TREK: ELITE FORCE MASTER */
2348 			STEF_MASTER,                    /* id */
2349 			"EFM",                          /* type_prefix */
2350 			"efm",                          /* type_string */
2351 			"-efm",                         /* type_option */
2352 			"Star Trek: Elite Force",       /* game_name */
2353 			STEF_SERVER,                    /* master */
2354 			STEF_MASTER_DEFAULT_PORT,       /* default_port */
2355 			0,                              /* port_offset */
2356 			TF_OUTFILE | TF_QUERY_ARG,      /* flags */
2357 			"",                             /* game_rule */
2358 			"ELITEFORCEMASTER",             /* template_var */
2359 			NULL,                           /* status_packet */
2360 			0,                              /* status_len */
2361 			NULL,                           /* player_packet */
2362 			0,                              /* player_len */
2363 			NULL,                           /* rule_packet */
2364 			0,                              /* rule_len */
2365 			q3_master_query_template,       /* master_packet */
2366 			0,                              /* master_len */
2367 			stef_master_default_protocol,   /* master_protocol */
2368 			q3_master_default_query,        /* master_query */
2369 			display_qwmaster,               /* display_player_func */
2370 			NULL,                           /* display_rule_func */
2371 			NULL,                           /* display_raw_player_func */
2372 			NULL,                           /* display_raw_rule_func */
2373 			NULL,                           /* display_xml_player_func */
2374 			NULL,                           /* display_xml_rule_func */
2375 			NULL,                           /* display_json_player_func */
2376 			NULL,                           /* display_json_rule_func */
2377 			send_qwmaster_request_packet,   /* status_query_func */
2378 			NULL,                           /* rule_query_func */
2379 			NULL,                           /* player_query_func */
2380 			deal_with_qwmaster_packet,      /* packet_func */
2381 		},
2382 		{
2383 			/* JEDI KNIGHT 3 FORCE MASTER */
2384 			JK3_MASTER,                     /* id */
2385 			"JK3M",                         /* type_prefix */
2386 			"jk3m",                         /* type_string */
2387 			"-jk3m",                        /* type_option */
2388 			"Jedi Knight: Jedi Academy",    /* game_name */
2389 			JK3_SERVER,                     /* master */
2390 			JK3_MASTER_DEFAULT_PORT,        /* default_port */
2391 			0,                              /* port_offset */
2392 			TF_OUTFILE | TF_QUERY_ARG,      /* flags */
2393 			"",                             /* game_rule */
2394 			"JK3MASTER",                    /* template_var */
2395 			NULL,                           /* status_packet */
2396 			0,                              /* status_len */
2397 			NULL,                           /* player_packet */
2398 			0,                              /* player_len */
2399 			NULL,                           /* rule_packet */
2400 			0,                              /* rule_len */
2401 			q3_master_query_template,       /* master_packet */
2402 			0,                              /* master_len */
2403 			jk3_master_default_protocol,    /* master_protocol */
2404 			NULL,                           /* master_query */
2405 			display_qwmaster,               /* display_player_func */
2406 			NULL,                           /* display_rule_func */
2407 			NULL,                           /* display_raw_player_func */
2408 			NULL,                           /* display_raw_rule_func */
2409 			NULL,                           /* display_xml_player_func */
2410 			NULL,                           /* display_xml_rule_func */
2411 			NULL,                           /* display_json_player_func */
2412 			NULL,                           /* display_json_rule_func */
2413 			send_qwmaster_request_packet,   /* status_query_func */
2414 			NULL,                           /* rule_query_func */
2415 			NULL,                           /* player_query_func */
2416 			deal_with_qwmaster_packet,      /* packet_func */
2417 		},
2418 		{
2419 			/* HALF-LIFE MASTER */
2420 			HL_MASTER,                                      /* id */
2421 			"HLM",                                          /* type_prefix */
2422 			"hlm",                                          /* type_string */
2423 			"-hlm",                                         /* type_option */ /* ## also "-qw" */
2424 			"Half-Life Master",                             /* game_name */
2425 			HL_SERVER,                                      /* master */
2426 			HL_MASTER_DEFAULT_PORT,                         /* default_port */
2427 			0,                                              /* port_offset */
2428 			TF_SINGLE_QUERY | TF_OUTFILE | TF_QUERY_ARG,    /* flags */
2429 			"",                                             /* game_rule */
2430 			"HLMASTER",                                     /* template_var */
2431 			NULL,                                           /* status_packet */
2432 			0,                                              /* status_len */
2433 			NULL,                                           /* player_packet */
2434 			0,                                              /* player_len */
2435 			NULL,                                           /* rule_packet */
2436 			0,                                              /* rule_len */
2437 			(char *)&new_hl_masterquery_prefix,             /* master_packet */
2438 			sizeof(new_hl_masterquery_prefix),              /* master_len */
2439 			NULL,                                           /* master_protocol */
2440 			NULL,                                           /* master_query */
2441 			display_qwmaster,                               /* display_player_func */
2442 			NULL,                                           /* display_rule_func */
2443 			NULL,                                           /* display_raw_player_func */
2444 			NULL,                                           /* display_raw_rule_func */
2445 			NULL,                                           /* display_xml_player_func */
2446 			NULL,                                           /* display_xml_rule_func */
2447 			NULL,                                           /* display_json_player_func */
2448 			NULL,                                           /* display_json_rule_func */
2449 			send_qwmaster_request_packet,                   /* status_query_func */
2450 			NULL,                                           /* rule_query_func */
2451 			NULL,                                           /* player_query_func */
2452 			deal_with_qwmaster_packet,                      /* packet_func */
2453 		},
2454 		{
2455 			/* TRIBES MASTER */
2456 			TRIBES_MASTER,                  /* id */
2457 			"TBM",                          /* type_prefix */
2458 			"tbm",                          /* type_string */
2459 			"-tbm",                         /* type_option */
2460 			"Tribes Master",                /* game_name */
2461 			TRIBES_SERVER,                  /* master */
2462 			TRIBES_MASTER_DEFAULT_PORT,     /* default_port */
2463 			0,                              /* port_offset */
2464 			TF_OUTFILE,                     /* flags */
2465 			"",                             /* game_rule */
2466 			"TRIBESMASTER",                 /* template_var */
2467 			NULL,                           /* status_packet */
2468 			0,                              /* status_len */
2469 			NULL,                           /* player_packet */
2470 			0,                              /* player_len */
2471 			NULL,                           /* rule_packet */
2472 			0,                              /* rule_len */
2473 			(char *)&tribes_masterquery,    /* master_packet */
2474 			sizeof(tribes_masterquery),     /* master_len */
2475 			NULL,                           /* master_protocol */
2476 			NULL,                           /* master_query */
2477 			display_qwmaster,               /* display_player_func */
2478 			NULL,                           /* display_rule_func */
2479 			NULL,                           /* display_raw_player_func */
2480 			NULL,                           /* display_raw_rule_func */
2481 			NULL,                           /* display_xml_player_func */
2482 			NULL,                           /* display_xml_rule_func */
2483 			NULL,                           /* display_json_player_func */
2484 			NULL,                           /* display_json_rule_func */
2485 			send_qwmaster_request_packet,   /* status_query_func */
2486 			NULL,                           /* rule_query_func */
2487 			NULL,                           /* player_query_func */
2488 			deal_with_tribesmaster_packet,  /* packet_func */
2489 		},
2490 		{
2491 			/* GAMESPY MASTER */
2492 			GAMESPY_MASTER,                                                         /* id */
2493 			"GSM",                                                                  /* type_prefix */
2494 			"gsm",                                                                  /* type_string */
2495 			"-gsm",                                                                 /* type_option */
2496 			"Gamespy Master",                                                       /* game_name */
2497 			GAMESPY_PROTOCOL_SERVER,                                                /* master */
2498 			GAMESPY_MASTER_DEFAULT_PORT,                                            /* default_port */
2499 			0,                                                                      /* port_offset */
2500 			TF_OUTFILE | TF_TCP_CONNECT | TF_QUERY_ARG | TF_QUERY_ARG_REQUIRED,     /* flags */
2501 			"",                                                                     /* game_rule */
2502 			"GAMESPYMASTER",                                                        /* template_var */
2503 			(char *)&gamespy_master_request_prefix,                                 /* status_packet */
2504 			sizeof(gamespy_master_request_prefix) - 1,                              /* status_len */
2505 			NULL,                                                                   /* player_packet */
2506 			0,                                                                      /* player_len */
2507 			NULL,                                                                   /* rule_packet */
2508 			0,                                                                      /* rule_len */
2509 			(char *)&gamespy_master_validate,                                       /* master_packet */
2510 			sizeof(gamespy_master_validate) - 1,                                    /* master_len */
2511 			NULL,                                                                   /* master_protocol */
2512 			NULL,                                                                   /* master_query */
2513 			display_qwmaster,                                                       /* display_player_func */
2514 			NULL,                                                                   /* display_rule_func */
2515 			NULL,                                                                   /* display_raw_player_func */
2516 			NULL,                                                                   /* display_raw_rule_func */
2517 			NULL,                                                                   /* display_xml_player_func */
2518 			NULL,                                                                   /* display_xml_rule_func */
2519 			NULL,                                                                   /* display_json_player_func */
2520 			NULL,                                                                   /* display_json_rule_func */
2521 			send_gamespy_master_request,                                            /* status_query_func */
2522 			NULL,                                                                   /* rule_query_func */
2523 			NULL,                                                                   /* player_query_func */
2524 			deal_with_gamespy_master_response,                                      /* packet_func */
2525 		},
2526 		{
2527 			/* TRIBES 2 MASTER */
2528 			TRIBES2_MASTER,                         /* id */
2529 			"T2M",                                  /* type_prefix */
2530 			"t2m",                                  /* type_string */
2531 			"-t2m",                                 /* type_option */
2532 			"Tribes 2 Master",                      /* game_name */
2533 			TRIBES2_SERVER,                         /* master */
2534 			TRIBES2_MASTER_DEFAULT_PORT,            /* default_port */
2535 			0,                                      /* port_offset */
2536 			TF_OUTFILE | TF_QUERY_ARG,              /* flags */
2537 			"",                                     /* game_rule */
2538 			"TRIBES2MASTER",                        /* template_var */
2539 			NULL,                                   /* status_packet */
2540 			0,                                      /* status_len */
2541 			NULL,                                   /* player_packet */
2542 			0,                                      /* player_len */
2543 			NULL,                                   /* rule_packet */
2544 			0,                                      /* rule_len */
2545 			(char *)&tribes2_masterquery,           /* master_packet */
2546 			sizeof(tribes2_masterquery),            /* master_len */
2547 			NULL,                                   /* master_protocol */
2548 			NULL,                                   /* master_query */
2549 			display_qwmaster,                       /* display_player_func */
2550 			NULL,                                   /* display_rule_func */
2551 			NULL,                                   /* display_raw_player_func */
2552 			NULL,                                   /* display_raw_rule_func */
2553 			NULL,                                   /* display_xml_player_func */
2554 			NULL,                                   /* display_xml_rule_func */
2555 			NULL,                                   /* display_json_player_func */
2556 			NULL,                                   /* display_json_rule_func */
2557 			send_tribes2master_request_packet,      /* status_query_func */
2558 			NULL,                                   /* rule_query_func */
2559 			NULL,                                   /* player_query_func */
2560 			deal_with_tribes2master_packet,         /* packet_func */
2561 		},
2562 		{
2563 			/* DESCENT3 MASTER */
2564 			DESCENT3_MASTER,                        /* id */
2565 			"D3M",                                  /* type_prefix */
2566 			"d3m",                                  /* type_string */
2567 			"-d3m",                                 /* type_option */ /* ## also "-qw" */
2568 			"Descent3 Master (PXO)",                /* game_name */
2569 			DESCENT3_PXO_SERVER,                    /* master */
2570 			DESCENT3_MASTER_DEFAULT_PORT,           /* default_port */
2571 			0,                                      /* port_offset */
2572 			TF_MASTER_MULTI_RESPONSE | TF_OUTFILE,  /* flags */
2573 			"",                                     /* game_rule */
2574 			"D3MASTER",                             /* template_var */
2575 			NULL,                                   /* status_packet */
2576 			0,                                      /* status_len */
2577 			NULL,                                   /* player_packet */
2578 			0,                                      /* player_len */
2579 			NULL,                                   /* rule_packet */
2580 			0,                                      /* rule_len */
2581 			(char *)descent3_masterquery,           /* master_packet */
2582 			sizeof(descent3_masterquery),           /* master_len */
2583 			NULL,                                   /* master_protocol */
2584 			NULL,                                   /* master_query */
2585 			display_qwmaster,                       /* display_player_func */
2586 			NULL,                                   /* display_rule_func */
2587 			NULL,                                   /* display_raw_player_func */
2588 			NULL,                                   /* display_raw_rule_func */
2589 			NULL,                                   /* display_xml_player_func */
2590 			NULL,                                   /* display_xml_rule_func */
2591 			NULL,                                   /* display_json_player_func */
2592 			NULL,                                   /* display_json_rule_func */
2593 			send_qwmaster_request_packet,           /* status_query_func */
2594 			NULL,                                   /* rule_query_func */
2595 			NULL,                                   /* player_query_func */
2596 			deal_with_descent3master_packet,        /* packet_func */
2597 		},
2598 		{
2599 			/* STEAM MASTER */
2600 			STEAM_MASTER,                                                   /* id */
2601 			"STM",                                                          /* type_prefix */
2602 			"stm",                                                          /* type_string */
2603 			"-stm",                                                         /* type_option */ /* ## also "-qw" */
2604 			"Steam Master",                                                 /* game_name */
2605 			A2S_SERVER,                                                     /* master */
2606 			STEAM_MASTER_DEFAULT_PORT,                                      /* default_port */
2607 			0,                                                              /* port_offset */
2608 			TF_SINGLE_QUERY | TF_OUTFILE | TF_QUERY_ARG | TF_MASTER_STEAM,  /* flags */
2609 			"",                                                             /* game_rule */
2610 			"STEAMMASTER",                                                  /* template_var */
2611 			NULL,                                                           /* status_packet */
2612 			0,                                                              /* status_len */
2613 			NULL,                                                           /* player_packet */
2614 			0,                                                              /* player_len */
2615 			NULL,                                                           /* rule_packet */
2616 			0,                                                              /* rule_len */
2617 			(char *)&steam_masterquery_template,                            /* master_packet */
2618 			0,                                                              /* master_len */
2619 			NULL,                                                           /* master_protocol */
2620 			NULL,                                                           /* master_query */
2621 			display_qwmaster,                                               /* display_player_func */
2622 			NULL,                                                           /* display_rule_func */
2623 			NULL,                                                           /* display_raw_player_func */
2624 			NULL,                                                           /* display_raw_rule_func */
2625 			NULL,                                                           /* display_xml_player_func */
2626 			NULL,                                                           /* display_xml_rule_func */
2627 			NULL,                                                           /* display_json_player_func */
2628 			NULL,                                                           /* display_json_rule_func */
2629 			send_qwmaster_request_packet,                                   /* status_query_func */
2630 			NULL,                                                           /* rule_query_func */
2631 			NULL,                                                           /* player_query_func */
2632 			deal_with_qwmaster_packet,                                      /* packet_func */
2633 		},
2634 
2635 		{
2636 			/* UT2004 MASTER */
2637 			UT2004_MASTER,                                  /* id */
2638 			"UT2004M",                                      /* type_prefix */
2639 			"ut2004m",                                      /* type_string */
2640 			"-ut2004m",                                     /* type_option */
2641 			"UT2004 Master",                                /* game_name */
2642 			UT2003_SERVER,                                  /* master */
2643 			28902,                                          /* default_port */
2644 			0,                                              /* port_offset */
2645 			TF_OUTFILE | TF_QUERY_ARG | TF_TCP_CONNECT,     /* flags */
2646 			"",                                             /* game_rule */
2647 			"UT2004MASTER",                                 /* template_var */
2648 			NULL,                                           /* status_packet */
2649 			0,                                              /* status_len */
2650 			NULL,                                           /* player_packet */
2651 			0,                                              /* player_len */
2652 			NULL,                                           /* rule_packet */
2653 			0,                                              /* rule_len */
2654 			NULL,                                           /* master_packet */
2655 			0,                                              /* master_len */
2656 			NULL,                                           /* master_protocol */
2657 			NULL,                                           /* master_query */
2658 			display_qwmaster,                               /* display_player_func */
2659 			NULL,                                           /* display_rule_func */
2660 			NULL,                                           /* display_raw_player_func */
2661 			NULL,                                           /* display_raw_rule_func */
2662 			NULL,                                           /* display_xml_player_func */
2663 			NULL,                                           /* display_xml_rule_func */
2664 			NULL,                                           /* display_json_player_func */
2665 			NULL,                                           /* display_json_rule_func */
2666 			send_ut2004master_request_packet,               /* status_query_func */
2667 			NULL,                                           /* rule_query_func */
2668 			NULL,                                           /* player_query_func */
2669 			deal_with_ut2004master_packet,                  /* packet_func */
2670 		},
2671 		{
2672 			/* HALFLIFE 2 */
2673 			A2S_SERVER,                             /* id */
2674 			"A2S",                                  /* type_prefix */
2675 			"a2s",                                  /* type_string */
2676 			"-a2s",                                 /* type_option */
2677 			"Half-Life 2 new",                      /* game_name */
2678 			0,                                      /* master */
2679 			HL2_DEFAULT_PORT,                       /* default_port */
2680 			0,                                      /* port_offset */
2681 			TF_QUAKE3_NAMES,                        /* flags */
2682 			"gamedir",                              /* game_rule */
2683 			"A2S",                                  /* template_var */
2684 			NULL,                                   /* status_packet */
2685 			0,                                      /* status_len */
2686 			NULL,                                   /* player_packet */
2687 			0,                                      /* player_len */
2688 			NULL,                                   /* rule_packet */
2689 			0,                                      /* rule_len */
2690 			NULL,                                   /* master_packet */
2691 			0,                                      /* master_len */
2692 			NULL,                                   /* master_protocol */
2693 			NULL,                                   /* master_query */
2694 			display_halflife_player_info,           /* display_player_func */
2695 			display_server_rules,                   /* display_rule_func */
2696 			raw_display_halflife_player_info,       /* display_raw_player_func */
2697 			raw_display_server_rules,               /* display_raw_rule_func */
2698 			xml_display_halflife_player_info,       /* display_xml_player_func */
2699 			xml_display_server_rules,               /* display_xml_rule_func */
2700 			json_display_halflife_player_info,      /* display_json_player_func */
2701 			json_display_server_rules,              /* display_json_rule_func */
2702 			send_a2s_request_packet,                /* status_query_func */
2703 			send_a2s_rule_request_packet,           /* rule_query_func */
2704 			NULL,                                   /* player_query_func */
2705 			deal_with_a2s_packet,                   /* packet_func */
2706 		},
2707 		{
2708 			/* PARIAH */
2709 			PARIAH_SERVER,                          /* id */
2710 			"PRS",                                  /* type_prefix */
2711 			"prs",                                  /* type_string */
2712 			"-prs",                                 /* type_option */
2713 			"Pariah",                               /* game_name */
2714 			0,                                      /* master */
2715 			UNREAL_DEFAULT_PORT,                    /* default_port */
2716 			1,                                      /* port_offset */
2717 			TF_U2_NAMES,                            /* flags */
2718 			"gametype",                             /* game_rule */
2719 			"UNREALTOURNAMENT2003",                 /* template_var */
2720 			(char *)&pariah_basicstatus,            /* status_packet */
2721 			sizeof(pariah_basicstatus),             /* status_len */
2722 			NULL,                                   /* player_packet */
2723 			0,                                      /* player_len */
2724 			NULL,                                   /* rule_packet */
2725 			0,                                      /* rule_len */
2726 			NULL,                                   /* master_packet */
2727 			0,                                      /* master_len */
2728 			NULL,                                   /* master_protocol */
2729 			0,                                      /* master_query */
2730 			display_unreal_player_info,             /* display_player_func */
2731 			display_server_rules,                   /* display_rule_func */
2732 			raw_display_unreal_player_info,         /* display_raw_player_func */
2733 			raw_display_server_rules,               /* display_raw_rule_func */
2734 			xml_display_unreal_player_info,         /* display_xml_player_func */
2735 			xml_display_server_rules,               /* display_xml_rule_func */
2736 			json_display_unreal_player_info,        /* display_json_player_func */
2737 			json_display_server_rules,              /* display_json_rule_func */
2738 			send_ut2003_request_packet,             /* status_query_func */
2739 			NULL,                                   /* rule_query_func */
2740 			NULL,                                   /* player_query_func */
2741 			deal_with_ut2003_packet,                /* packet_func */
2742 		},
2743 		{
2744 			/* GAMESPY V3 PROTOCOL */
2745 			GAMESPY3_PROTOCOL_SERVER,       /* id */
2746 			"GS3",                          /* type_prefix */
2747 			"gs3",                          /* type_string */
2748 			"-gs3",                         /* type_option */
2749 			"Gamespy V3 Protocol",          /* game_name */
2750 			0,                              /* master */
2751 			0,                              /* default_port */
2752 			0,                              /* port_offset */
2753 			TF_SINGLE_QUERY,                /* flags */
2754 			"gametype",                     /* game_rule */
2755 			"GPS3PROTOCOL",                 /* template_var */
2756 			(char *)&gs3_status_query,      /* status_packet */
2757 			sizeof(gs3_status_query),       /* status_len */
2758 			(char *)&gs3_player_query,      /* player_packet */
2759 			sizeof(gs3_player_query),       /* player_len */
2760 			NULL,                           /* rule_packet */
2761 			0,                              /* rule_len */
2762 			NULL,                           /* master_packet */
2763 			0,                              /* master_len */
2764 			NULL,                           /* master_protocol */
2765 			NULL,                           /* master_query */
2766 			display_gs2_player_info,        /* display_player_func */
2767 			display_server_rules,           /* display_rule_func */
2768 			raw_display_gs2_player_info,    /* display_raw_player_func */
2769 			raw_display_server_rules,       /* display_raw_rule_func */
2770 			xml_display_player_info,        /* display_xml_player_func */
2771 			xml_display_server_rules,       /* display_xml_rule_func */
2772 			json_display_player_info,       /* display_json_player_func */
2773 			json_display_server_rules,      /* display_json_rule_func */
2774 			send_gs3_request_packet,        /* status_query_func */
2775 			NULL,                           /* rule_query_func */
2776 			NULL,                           /* player_query_func */
2777 			deal_with_gs3_packet,           /* packet_func */
2778 		},
2779 		{
2780 			/* TEAMSPEAK 2 PROTOCOL */
2781 			TS2_PROTOCOL_SERVER,                                    /* id */
2782 			"TS2",                                                  /* type_prefix */
2783 			"ts2",                                                  /* type_string */
2784 			"-ts2",                                                 /* type_option */
2785 			"Teamspeak 2",                                          /* game_name */
2786 			0,                                                      /* master */
2787 			0,                                                      /* default_port */
2788 			0,                                                      /* port_offset */
2789 			TF_TCP_CONNECT | TF_QUERY_ARG_REQUIRED | TF_QUERY_ARG,  /* flags */
2790 			"N/A",                                                  /* game_rule */
2791 			"TS2PROTOCOL",                                          /* template_var */
2792 			NULL,                                                   /* status_packet */
2793 			0,                                                      /* status_len */
2794 			NULL,                                                   /* player_packet */
2795 			0,                                                      /* player_len */
2796 			NULL,                                                   /* rule_packet */
2797 			0,                                                      /* rule_len */
2798 			NULL,                                                   /* master_packet */
2799 			0,                                                      /* master_len */
2800 			NULL,                                                   /* master_protocol */
2801 			NULL,                                                   /* master_query */
2802 			display_ts2_player_info,                                /* display_player_func */
2803 			display_server_rules,                                   /* display_rule_func */
2804 			raw_display_ts2_player_info,                            /* display_raw_player_func */
2805 			raw_display_server_rules,                               /* display_raw_rule_func */
2806 			xml_display_ts2_player_info,                            /* display_xml_player_func */
2807 			xml_display_server_rules,                               /* display_xml_rule_func */
2808 			json_display_ts2_player_info,                           /* display_json_player_func */
2809 			json_display_server_rules,                              /* display_json_rule_func */
2810 			send_ts2_request_packet,                                /* status_query_func */
2811 			NULL,                                                   /* rule_query_func */
2812 			NULL,                                                   /* player_query_func */
2813 			deal_with_ts2_packet,                                   /* packet_func */
2814 		},
2815 		{
2816 			/* QUAKE 4 */
2817 			QUAKE4_SERVER,                  /* id */
2818 			"Q4S",                          /* type_prefix */
2819 			"q4s",                          /* type_string */
2820 			"-q4s",                         /* type_option */
2821 			"Quake 4",                      /* game_name */
2822 			0,                              /* master */
2823 			QUAKE4_DEFAULT_PORT,            /* default_port */
2824 			0,                              /* port_offset */
2825 			TF_QUAKE3_NAMES,                /* flags */
2826 			"fs_game",                      /* game_rule */
2827 			"QUAKE4",                       /* template_var */
2828 			(char *)&doom3_serverinfo,      /* status_packet */
2829 			sizeof(doom3_serverinfo),       /* status_len */
2830 			NULL,                           /* player_packet */
2831 			0,                              /* player_len */
2832 			NULL,                           /* rule_packet */
2833 			0,                              /* rule_len */
2834 			NULL,                           /* master_packet */
2835 			0,                              /* master_len */
2836 			NULL,                           /* master_protocol */
2837 			NULL,                           /* master_query */
2838 			display_doom3_player_info,      /* display_player_func */
2839 			display_server_rules,           /* display_rule_func */
2840 			raw_display_doom3_player_info,  /* display_raw_player_func */
2841 			raw_display_server_rules,       /* display_raw_rule_func */
2842 			xml_display_doom3_player_info,  /* display_xml_player_func */
2843 			xml_display_server_rules,       /* display_xml_rule_func */
2844 			json_display_doom3_player_info, /* display_json_player_func */
2845 			json_display_server_rules,      /* display_json_rule_func */
2846 			send_qwserver_request_packet,   /* status_query_func */
2847 			NULL,                           /* rule_query_func */
2848 			NULL,                           /* player_query_func */
2849 			deal_with_quake4_packet,        /* packet_func */
2850 		},
2851 		{
2852 			/* QUAKE 4 MASTER */
2853 			QUAKE4_MASTER,                          /* id */
2854 			"Q4M",                                  /* type_prefix */
2855 			"q4m",                                  /* type_string */
2856 			"-q4m",                                 /* type_option */
2857 			"Quake 4 Master",                       /* game_name */
2858 			QUAKE4_SERVER,                          /* master */
2859 			QUAKE4_MASTER_DEFAULT_PORT,             /* default_port */
2860 			0,                                      /* port_offset */
2861 			TF_OUTFILE | TF_QUERY_ARG,              /* flags */
2862 			"",                                     /* game_rule */
2863 			"QUAKE4MASTER",                         /* template_var */
2864 			NULL,                                   /* status_packet */
2865 			0,                                      /* status_len */
2866 			NULL,                                   /* player_packet */
2867 			0,                                      /* player_len */
2868 			NULL,                                   /* rule_packet */
2869 			0,                                      /* rule_len */
2870 			NULL,                                   /* master_packet */
2871 			0,                                      /* master_len */
2872 			NULL,                                   /* master_protocol */
2873 			NULL,                                   /* master_query */
2874 			display_qwmaster,                       /* display_player_func */
2875 			NULL,                                   /* display_rule_func */
2876 			NULL,                                   /* display_raw_player_func */
2877 			NULL,                                   /* display_raw_rule_func */
2878 			NULL,                                   /* display_xml_player_func */
2879 			NULL,                                   /* display_xml_rule_func */
2880 			NULL,                                   /* display_json_player_func */
2881 			NULL,                                   /* display_json_rule_func */
2882 			send_quake4master_request_packet,       /* status_query_func */
2883 			NULL,                                   /* rule_query_func */
2884 			NULL,                                   /* player_query_func */
2885 			deal_with_doom3master_packet,           /* packet_func */
2886 		},
2887 		{
2888 			/* GAMESPY V4 PROTOCOL */
2889 			GAMESPY4_PROTOCOL_SERVER,       /* id */
2890 			"GS4",                          /* type_prefix */
2891 			"gs4",                          /* type_string */
2892 			"-gs4",                         /* type_option */
2893 			"Gamespy V4 Protocol",          /* game_name */
2894 			0,                              /* master */
2895 			0,                              /* default_port */
2896 			0,                              /* port_offset */
2897 			TF_SINGLE_QUERY,                /* flags */
2898 			"gametype",                     /* game_rule */
2899 			"GPS4PROTOCOL",                 /* template_var */
2900 			(char *)&gs3_challenge,         /* status_packet */
2901 			sizeof(gs3_challenge),          /* status_len */
2902 			(char *)&gs3_challenge,         /* player_packet */
2903 			sizeof(gs3_challenge),          /* player_len */
2904 			NULL,                           /* rule_packet */
2905 			0,                              /* rule_len */
2906 			NULL,                           /* master_packet */
2907 			0,                              /* master_len */
2908 			NULL,                           /* master_protocol */
2909 			NULL,                           /* master_query */
2910 			display_gs2_player_info,        /* display_player_func */
2911 			display_server_rules,           /* display_rule_func */
2912 			raw_display_gs2_player_info,    /* display_raw_player_func */
2913 			raw_display_server_rules,       /* display_raw_rule_func */
2914 			xml_display_player_info,        /* display_xml_player_func */
2915 			xml_display_server_rules,       /* display_xml_rule_func */
2916 			json_display_player_info,       /* display_json_player_func */
2917 			json_display_server_rules,      /* display_json_rule_func */
2918 			send_gs3_request_packet,        /* status_query_func */
2919 			NULL,                           /* rule_query_func */
2920 			NULL,                           /* player_query_func */
2921 			deal_with_gs3_packet,           /* packet_func */
2922 		},
2923 		{
2924 			/* PREY */
2925 			PREY_SERVER,                    /* id */
2926 			"PREYS",                        /* type_prefix */
2927 			"preys",                        /* type_string */
2928 			"-preys",                       /* type_option */
2929 			"PREY",                         /* game_name */
2930 			0,                              /* master */
2931 			PREY_DEFAULT_PORT,              /* default_port */
2932 			0,                              /* port_offset */
2933 			TF_QUAKE3_NAMES,                /* flags */
2934 			"fs_game",                      /* game_rule */
2935 			"PREY",                         /* template_var */
2936 			(char *)&doom3_serverinfo,      /* status_packet */
2937 			sizeof(doom3_serverinfo),       /* status_len */
2938 			NULL,                           /* player_packet */
2939 			0,                              /* player_len */
2940 			NULL,                           /* rule_packet */
2941 			0,                              /* rule_len */
2942 			NULL,                           /* master_packet */
2943 			0,                              /* master_len */
2944 			NULL,                           /* master_protocol */
2945 			NULL,                           /* master_query */
2946 			display_doom3_player_info,      /* display_player_func */
2947 			display_server_rules,           /* display_rule_func */
2948 			raw_display_doom3_player_info,  /* display_raw_player_func */
2949 			raw_display_server_rules,       /* display_raw_rule_func */
2950 			xml_display_doom3_player_info,  /* display_xml_player_func */
2951 			xml_display_server_rules,       /* display_xml_rule_func */
2952 			json_display_doom3_player_info, /* display_json_player_func */
2953 			json_display_server_rules,      /* display_json_rule_func */
2954 			send_qwserver_request_packet,   /* status_query_func */
2955 			NULL,                           /* rule_query_func */
2956 			NULL,                           /* player_query_func */
2957 			deal_with_prey_packet,          /* packet_func */
2958 		},
2959 		{
2960 			/* TRACKMANIA PROTOCOL */
2961 			TM_PROTOCOL_SERVER,                             /* id */
2962 			"TM",                                           /* type_prefix */
2963 			"tm",                                           /* type_string */
2964 			"-tm",                                          /* type_option */
2965 			"TrackMania",                                   /* game_name */
2966 			0,                                              /* master */
2967 			0,                                              /* default_port */
2968 			0,                                              /* port_offset */
2969 			TF_TCP_CONNECT | TF_QUERY_ARG | TF_TM_NAMES,    /* flags */
2970 			"N/A",                                          /* game_rule */
2971 			"TMPROTOCOL",                                   /* template_var */
2972 			NULL,                                           /* status_packet */
2973 			0,                                              /* status_len */
2974 			NULL,                                           /* player_packet */
2975 			0,                                              /* player_len */
2976 			NULL,                                           /* rule_packet */
2977 			0,                                              /* rule_len */
2978 			NULL,                                           /* master_packet */
2979 			0,                                              /* master_len */
2980 			NULL,                                           /* master_protocol */
2981 			NULL,                                           /* master_query */
2982 			display_tm_player_info,                         /* display_player_func */
2983 			display_server_rules,                           /* display_rule_func */
2984 			raw_display_tm_player_info,                     /* display_raw_player_func */
2985 			raw_display_server_rules,                       /* display_raw_rule_func */
2986 			xml_display_tm_player_info,                     /* display_xml_player_func */
2987 			xml_display_server_rules,                       /* display_xml_rule_func */
2988 			json_display_tm_player_info,                    /* display_json_player_func */
2989 			json_display_server_rules,                      /* display_json_rule_func */
2990 			send_tm_request_packet,                         /* status_query_func */
2991 			NULL,                                           /* rule_query_func */
2992 			NULL,                                           /* player_query_func */
2993 			deal_with_tm_packet,                            /* packet_func */
2994 		},
2995 		{
2996 			/* Enemy Territory : QuakeWars */
2997 			ETQW_SERVER,                    /* id */
2998 			"ETQWS",                        /* type_prefix */
2999 			"etqws",                        /* type_string */
3000 			"-etqws",                       /* type_option */
3001 			"QuakeWars",                    /* game_name */
3002 			0,                              /* master */
3003 			ETQW_DEFAULT_PORT,              /* default_port */
3004 			0,                              /* port_offset */
3005 			TF_QUAKE3_NAMES,                /* flags */
3006 			"fs_game",                      /* game_rule */
3007 			"QUAKE4",                       /* template_var */
3008 			(char *)&doom3_serverinfo,      /* status_packet */
3009 			sizeof(doom3_serverinfo),       /* status_len */
3010 			NULL,                           /* player_packet */
3011 			0,                              /* player_len */
3012 			NULL,                           /* rule_packet */
3013 			0,                              /* rule_len */
3014 			NULL,                           /* master_packet */
3015 			0,                              /* master_len */
3016 			NULL,                           /* master_protocol */
3017 			NULL,                           /* master_query */
3018 			display_doom3_player_info,      /* display_player_func */
3019 			display_server_rules,           /* display_rule_func */
3020 			raw_display_doom3_player_info,  /* display_raw_player_func */
3021 			raw_display_server_rules,       /* display_raw_rule_func */
3022 			xml_display_doom3_player_info,  /* display_xml_player_func */
3023 			xml_display_server_rules,       /* display_xml_rule_func */
3024 			json_display_doom3_player_info, /* display_json_player_func */
3025 			json_display_server_rules,      /* display_json_rule_func */
3026 			send_qwserver_request_packet,   /* status_query_func */
3027 			NULL,                           /* rule_query_func */
3028 			NULL,                           /* player_query_func */
3029 			deal_with_etqw_packet,          /* packet_func */
3030 		},
3031 		{
3032 			/* HAZE PROTOCOL */
3033 			HAZE_SERVER,                    /* id */
3034 			"HAZES",                        /* type_prefix */
3035 			"hazes",                        /* type_string */
3036 			"-hazes",                       /* type_option */
3037 			"Haze Protocol",                /* game_name */
3038 			0,                              /* master */
3039 			0,                              /* default_port */
3040 			0,                              /* port_offset */
3041 			TF_SINGLE_QUERY,                /* flags */
3042 			"gametype",                     /* game_rule */
3043 			"HAZE",                         /* template_var */
3044 			(char *)&haze_status_query,     /* status_packet */
3045 			sizeof(haze_status_query),      /* status_len */
3046 			(char *)&haze_player_query,     /* player_packet */
3047 			sizeof(haze_player_query),      /* player_len */
3048 			NULL,                           /* rule_packet */
3049 			0,                              /* rule_len */
3050 			NULL,                           /* master_packet */
3051 			0,                              /* master_len */
3052 			NULL,                           /* master_protocol */
3053 			NULL,                           /* master_query */
3054 			display_gs2_player_info,        /* display_player_func */
3055 			display_server_rules,           /* display_rule_func */
3056 			raw_display_gs2_player_info,    /* display_raw_player_func */
3057 			raw_display_server_rules,       /* display_raw_rule_func */
3058 			xml_display_player_info,        /* display_xml_player_func */
3059 			xml_display_server_rules,       /* display_xml_rule_func */
3060 			json_display_player_info,       /* display_json_player_func */
3061 			json_display_server_rules,      /* display_json_rule_func */
3062 			send_haze_request_packet,       /* status_query_func */
3063 			NULL,                           /* rule_query_func */
3064 			NULL,                           /* player_query_func */
3065 			deal_with_haze_packet,          /* packet_func */
3066 		},
3067 		{
3068 			/* World in Confict PROTOCOL */
3069 			WIC_PROTOCOL_SERVER,                                    /* id */
3070 			"WICS",                                                 /* type_prefix */
3071 			"wics",                                                 /* type_string */
3072 			"-wics",                                                /* type_option */
3073 			"World in Conflict",                                    /* game_name */
3074 			0,                                                      /* master */
3075 			0,                                                      /* default_port */
3076 			0,                                                      /* port_offset */
3077 			TF_TCP_CONNECT | TF_QUERY_ARG_REQUIRED | TF_QUERY_ARG,  /* flags */
3078 			"N/A",                                                  /* game_rule */
3079 			"WICPROTOCOL",                                          /* template_var */
3080 			NULL,                                                   /* status_packet */
3081 			0,                                                      /* status_len */
3082 			NULL,                                                   /* player_packet */
3083 			0,                                                      /* player_len */
3084 			NULL,                                                   /* rule_packet */
3085 			0,                                                      /* rule_len */
3086 			NULL,                                                   /* master_packet */
3087 			0,                                                      /* master_len */
3088 			NULL,                                                   /* master_protocol */
3089 			NULL,                                                   /* master_query */
3090 			display_wic_player_info,                                /* display_player_func */
3091 			display_server_rules,                                   /* display_rule_func */
3092 			raw_display_wic_player_info,                            /* display_raw_player_func */
3093 			raw_display_server_rules,                               /* display_raw_rule_func */
3094 			xml_display_wic_player_info,                            /* display_xml_player_func */
3095 			xml_display_server_rules,                               /* display_xml_rule_func */
3096 			json_display_wic_player_info,                           /* display_json_player_func */
3097 			json_display_server_rules,                              /* display_json_rule_func */
3098 			send_wic_request_packet,                                /* status_query_func */
3099 			NULL,                                                   /* rule_query_func */
3100 			NULL,                                                   /* player_query_func */
3101 			deal_with_wic_packet,                                   /* packet_func */
3102 		},
3103 		{
3104 			/* openTTD */
3105 			OTTD_SERVER,                    /* id */
3106 			"OTTDS",                        /* type_prefix */
3107 			"ottds",                        /* type_string */
3108 			"-ottds",                       /* type_option */
3109 			"OpenTTD",                      /* game_name */
3110 			0,                              /* master */
3111 			3979,                           /* default_port */
3112 			0,                              /* port_offset */
3113 			0,                              /* flags */
3114 			"",                             /* game_rule */
3115 			"OPENTTD",                      /* template_var */
3116 			(char *)&ottd_serverinfo,       /* status_packet */
3117 			sizeof(ottd_serverinfo),        /* status_len */
3118 			NULL,                           /* player_packet */
3119 			0,                              /* player_len */
3120 			(char *)&ottd_serverdetails,    /* rule_packet */
3121 			sizeof(ottd_serverdetails),     /* rule_len */
3122 			NULL,                           /* master_packet */
3123 			0,                              /* master_len */
3124 			NULL,                           /* master_protocol */
3125 			NULL,                           /* master_query */
3126 			display_q2_player_info,         /* display_player_func */
3127 			display_server_rules,           /* display_rule_func */
3128 			raw_display_q2_player_info,     /* display_raw_player_func */
3129 			raw_display_server_rules,       /* display_raw_rule_func */
3130 			xml_display_player_info,        /* display_xml_player_func */
3131 			xml_display_server_rules,       /* display_xml_rule_func */
3132 			json_display_player_info,       /* display_json_player_func */
3133 			json_display_server_rules,      /* display_json_rule_func */
3134 			send_ottd_request_packet,       /* status_query_func */
3135 			NULL,                           /* rule_query_func */
3136 			NULL,                           /* player_query_func */
3137 			deal_with_ottd_packet,          /* packet_func */
3138 		},
3139 		{
3140 			/* openTTD Master */
3141 			OTTD_MASTER,                    /* id */
3142 			"OTTDM",                        /* type_prefix */
3143 			"ottdm",                        /* type_string */
3144 			"-ottdm",                       /* type_option */
3145 			"openTTD Master",               /* game_name */
3146 			OTTD_SERVER,                    /* master */
3147 			3978,                           /* default_port */
3148 			0,                              /* port_offset */
3149 			TF_OUTFILE | TF_QUERY_ARG,      /* flags */
3150 			"",                             /* game_rule */
3151 			"OTTDMASTER",                   /* template_var */
3152 			NULL,                           /* status_packet */
3153 			0,                              /* status_len */
3154 			NULL,                           /* player_packet */
3155 			0,                              /* player_len */
3156 			NULL,                           /* rule_packet */
3157 			0,                              /* rule_len */
3158 			ottd_master_query,              /* master_packet */
3159 			sizeof(ottd_master_query),      /* master_len */
3160 			NULL,                           /* master_protocol */
3161 			NULL,                           /* master_query */
3162 			display_qwmaster,               /* display_player_func */
3163 			NULL,                           /* display_rule_func */
3164 			NULL,                           /* display_raw_player_func */
3165 			NULL,                           /* display_raw_rule_func */
3166 			NULL,                           /* display_xml_player_func */
3167 			NULL,                           /* display_xml_rule_func */
3168 			NULL,                           /* display_json_player_func */
3169 			NULL,                           /* display_json_rule_func */
3170 			send_ottdmaster_request_packet, /* status_query_func */
3171 			NULL,                           /* rule_query_func */
3172 			NULL,                           /* player_query_func */
3173 			deal_with_ottdmaster_packet,    /* packet_func */
3174 		},
3175 		{
3176 			/* Frontlines-Fuel of War */
3177 			FL_SERVER,                      /* id */
3178 			"FLS",                          /* type_prefix */
3179 			"fls",                          /* type_string */
3180 			"-fls",                         /* type_option */
3181 			"Frontlines-Fuel of War",       /* game_name */
3182 			0,                              /* master */
3183 			FL_DEFAULT_PORT,                /* default_port */
3184 			0,                              /* port_offset */
3185 			TF_QUAKE3_NAMES,                /* flags */
3186 			"gamedir",                      /* game_rule */
3187 			"FLS",                          /* template_var */
3188 			NULL,                           /* status_packet */
3189 			0,                              /* status_len */
3190 			NULL,                           /* player_packet */
3191 			0,                              /* player_len */
3192 			NULL,                           /* rule_packet */
3193 			0,                              /* rule_len */
3194 			NULL,                           /* master_packet */
3195 			0,                              /* master_len */
3196 			NULL,                           /* master_protocol */
3197 			NULL,                           /* master_query */
3198 			display_fl_player_info,         /* display_player_func */
3199 			display_server_rules,           /* display_rule_func */
3200 			raw_display_fl_player_info,     /* display_raw_player_func */
3201 			raw_display_server_rules,       /* display_raw_rule_func */
3202 			xml_display_fl_player_info,     /* display_xml_player_func */
3203 			xml_display_server_rules,       /* display_xml_rule_func */
3204 			json_display_fl_player_info,    /* display_json_player_func */
3205 			json_display_server_rules,      /* display_json_rule_func */
3206 			send_fl_request_packet,         /* status_query_func */
3207 			send_fl_rule_request_packet,    /* rule_query_func */
3208 			NULL,                           /* player_query_func */
3209 			deal_with_fl_packet,            /* packet_func */
3210 		},
3211 		{
3212 			/* Wolfenstein */
3213 			WOLF_SERVER,                    /* id */
3214 			"WOLF",                         /* type_prefix */
3215 			"wolfs",                        /* type_string */
3216 			"-wolfs",                       /* type_option */
3217 			"Wolfenstein",                  /* game_name */
3218 			0,                              /* master */
3219 			WOLF_DEFAULT_PORT,              /* default_port */
3220 			0,                              /* port_offset */
3221 			TF_QUAKE3_NAMES,                /* flags */
3222 			"fs_game",                      /* game_rule */
3223 			"QUAKE4",                       /* template_var */
3224 			(char *)&doom3_serverinfo,      /* status_packet */
3225 			sizeof(doom3_serverinfo),       /* status_len */
3226 			NULL,                           /* player_packet */
3227 			0,                              /* player_len */
3228 			NULL,                           /* rule_packet */
3229 			0,                              /* rule_len */
3230 			NULL,                           /* master_packet */
3231 			0,                              /* master_len */
3232 			NULL,                           /* master_protocol */
3233 			NULL,                           /* master_query */
3234 			display_doom3_player_info,      /* display_player_func */
3235 			display_server_rules,           /* display_rule_func */
3236 			raw_display_doom3_player_info,  /* display_raw_player_func */
3237 			raw_display_server_rules,       /* display_raw_rule_func */
3238 			xml_display_doom3_player_info,  /* display_xml_player_func */
3239 			xml_display_server_rules,       /* display_xml_rule_func */
3240 			json_display_doom3_player_info, /* display_json_player_func */
3241 			json_display_server_rules,      /* display_json_rule_func */
3242 			send_qwserver_request_packet,   /* status_query_func */
3243 			NULL,                           /* rule_query_func */
3244 			NULL,                           /* player_query_func */
3245 			deal_with_wolf_packet,          /* packet_func */
3246 		},
3247 		{
3248 			/* Teeworlds */
3249 			TEE_SERVER,                     /* id */
3250 			"TEES",                         /* type_prefix */
3251 			"tees",                         /* type_string */
3252 			"-tees",                        /* type_option */
3253 			"Teeworlds",                    /* game_name */
3254 			0,                              /* master */
3255 			35515,                          /* default_port */
3256 			0,                              /* port_offset */
3257 			0,                              /* flags */
3258 			"gametype",                     /* game_rule */
3259 			"TEEWORLDS",                    /* template_var */
3260 			NULL,                           /* status_packet */
3261 			0,                              /* status_len */
3262 			NULL,                           /* player_packet */
3263 			0,                              /* player_len */
3264 			NULL,                           /* rule_packet */
3265 			0,                              /* rule_len */
3266 			NULL,                           /* master_packet */
3267 			0,                              /* master_len */
3268 			NULL,                           /* master_protocol */
3269 			NULL,                           /* master_query */
3270 			display_tee_player_info,        /* display_player_func */
3271 			display_server_rules,           /* display_rule_func */
3272 			raw_display_tee_player_info,    /* display_raw_player_func */
3273 			raw_display_server_rules,       /* display_raw_rule_func */
3274 			xml_display_tee_player_info,    /* display_xml_player_func */
3275 			xml_display_server_rules,       /* display_xml_rule_func */
3276 			json_display_tee_player_info,   /* display_json_player_func */
3277 			json_display_server_rules,      /* display_json_rule_func */
3278 			send_teeserver_request_packet,  /* status_query_func */
3279 			NULL,                           /* rule_query_func */
3280 			NULL,                           /* player_query_func */
3281 			deal_with_teeserver_packet,     /* packet_func */
3282 		},
3283 		{
3284 			/* TEAMSPEAK 3 PROTOCOL */
3285 			TS3_PROTOCOL_SERVER,                                    /* id */
3286 			"TS3",                                                  /* type_prefix */
3287 			"ts3",                                                  /* type_string */
3288 			"-ts3",                                                 /* type_option */
3289 			"Teamspeak 3",                                          /* game_name */
3290 			0,                                                      /* master */
3291 			0,                                                      /* default_port */
3292 			0,                                                      /* port_offset */
3293 			TF_TCP_CONNECT | TF_QUERY_ARG_REQUIRED | TF_QUERY_ARG,  /* flags */
3294 			"N/A",                                                  /* game_rule */
3295 			"TS3PROTOCOL",                                          /* template_var */
3296 			NULL,                                                   /* status_packet */
3297 			0,                                                      /* status_len */
3298 			NULL,                                                   /* player_packet */
3299 			0,                                                      /* player_len */
3300 			NULL,                                                   /* rule_packet */
3301 			0,                                                      /* rule_len */
3302 			NULL,                                                   /* master_packet */
3303 			0,                                                      /* master_len */
3304 			NULL,                                                   /* master_protocol */
3305 			NULL,                                                   /* master_query */
3306 			display_ts3_player_info,                                /* display_player_func */
3307 			display_server_rules,                                   /* display_rule_func */
3308 			raw_display_ts3_player_info,                            /* display_raw_player_func */
3309 			raw_display_server_rules,                               /* display_raw_rule_func */
3310 			xml_display_ts3_player_info,                            /* display_xml_player_func */
3311 			xml_display_server_rules,                               /* display_xml_rule_func */
3312 			json_display_ts3_player_info,                           /* display_json_player_func */
3313 			json_display_server_rules,                              /* display_json_rule_func */
3314 			send_ts3_request_packet,                                /* status_query_func */
3315 			NULL,                                                   /* rule_query_func */
3316 			NULL,                                                   /* player_query_func */
3317 			deal_with_ts3_packet,                                   /* packet_func */
3318 		},
3319 		{
3320 			/* BATTLEFIELD BAD COMPANY 2 PROTOCOL */
3321 			BFBC2_PROTOCOL_SERVER,          /* id */
3322 			"BFBC2",                        /* type_prefix */
3323 			"bfbc2",                        /* type_string */
3324 			"-bfbc2",                       /* type_option */
3325 			"Battlefield Bad Company 2",    /* game_name */
3326 			0,                              /* master */
3327 			BFBC2_DEFAULT_PORT,             /* default_port */
3328 			0,                              /* port_offset */
3329 			TF_TCP_CONNECT,                 /* flags */
3330 			"gametype",                     /* game_rule */
3331 			"BFBC2PROTOCOL",                /* template_var */
3332 			NULL,                           /* status_packet */
3333 			0,                              /* status_len */
3334 			NULL,                           /* player_packet */
3335 			0,                              /* player_len */
3336 			NULL,                           /* rule_packet */
3337 			0,                              /* rule_len */
3338 			NULL,                           /* master_packet */
3339 			0,                              /* master_len */
3340 			NULL,                           /* master_protocol */
3341 			NULL,                           /* master_query */
3342 			display_bfbc2_player_info,      /* display_player_func */
3343 			display_server_rules,           /* display_rule_func */
3344 			raw_display_bfbc2_player_info,  /* display_raw_player_func */
3345 			raw_display_server_rules,       /* display_raw_rule_func */
3346 			xml_display_bfbc2_player_info,  /* display_xml_player_func */
3347 			xml_display_server_rules,       /* display_xml_rule_func */
3348 			json_display_bfbc2_player_info, /* display_json_player_func */
3349 			json_display_server_rules,      /* display_json_rule_func */
3350 			send_bfbc2_request_packet,      /* status_query_func */
3351 			NULL,                           /* rule_query_func */
3352 			NULL,                           /* player_query_func */
3353 			deal_with_bfbc2_packet,         /* packet_func */
3354 		},
3355 		{
3356 			/* VENTRILO PROTOCOL */
3357 			VENTRILO_PROTOCOL_SERVER,               /* id */
3358 			"VENTRILO",                             /* type_prefix */
3359 			"ventrilo",                             /* type_string */
3360 			"-vent",                                /* type_option */
3361 			"Ventrilo",                             /* game_name */
3362 			0,                                      /* master */
3363 			VENTRILO_DEFAULT_PORT,                  /* default_port */
3364 			0,                                      /* port_offset */
3365 			0,                                      /* flags */
3366 			"gametype",                             /* game_rule */
3367 			"VENTRILO",                             /* template_var */
3368 			NULL,                                   /* status_packet */
3369 			0,                                      /* status_len */
3370 			NULL,                                   /* player_packet */
3371 			0,                                      /* player_len */
3372 			NULL,                                   /* rule_packet */
3373 			0,                                      /* rule_len */
3374 			NULL,                                   /* master_packet */
3375 			0,                                      /* master_len */
3376 			NULL,                                   /* master_protocol */
3377 			NULL,                                   /* master_query */
3378 			display_ventrilo_player_info,           /* display_player_func */
3379 			display_server_rules,                   /* display_rule_func */
3380 			raw_display_ventrilo_player_info,       /* display_raw_player_func */
3381 			raw_display_server_rules,               /* display_raw_rule_func */
3382 			xml_display_ventrilo_player_info,       /* display_xml_player_func */
3383 			xml_display_server_rules,               /* display_xml_rule_func */
3384 			json_display_ventrilo_player_info,      /* display_json_player_func */
3385 			json_display_server_rules,              /* display_json_rule_func */
3386 			send_ventrilo_request_packet,           /* status_query_func */
3387 			NULL,                                   /* rule_query_func */
3388 			NULL,                                   /* player_query_func */
3389 			deal_with_ventrilo_packet,              /* packet_func */
3390 		},
3391 		{
3392 			/* Cube 2/Sauerbraten/Blood Frontier */
3393 			CUBE2_SERVER,                   /* id */
3394 			"CUBE2",                        /* type_prefix */
3395 			"cube2",                        /* type_string */
3396 			"-cubes",                       /* type_option */
3397 			"Sauerbraten",                  /* game_name */
3398 			0,                              /* master */
3399 			CUBE2_DEFAULT_PORT,             /* default_port */
3400 			1,                              /* port_offset */
3401 			0,                              /* flags */
3402 			"",                             /* game_rule */
3403 			"CUBE2",                        /* template_var */
3404 			cube2_serverstatus,             /* status_packet */
3405 			sizeof(cube2_serverstatus),     /* status_len */
3406 			NULL,                           /* player_packet */
3407 			0,                              /* player_len */
3408 			NULL,                           /* rule_packet */
3409 			0,                              /* rule_len */
3410 			NULL,                           /* master_packet */
3411 			0,                              /* master_len */
3412 			NULL,                           /* master_protocol */
3413 			NULL,                           /* master_query */
3414 			NULL,                           /* display_player_func */
3415 			display_server_rules,           /* display_rule_func */
3416 			NULL,                           /* display_raw_player_func */
3417 			raw_display_server_rules,       /* display_raw_rule_func */
3418 			NULL,                           /* display_xml_player_func */
3419 			xml_display_server_rules,       /* display_xml_rule_func */
3420 			NULL,                           /* display_json_player_func */
3421 			json_display_server_rules,      /* display_json_rule_func */
3422 			send_cube2_request_packet,      /* status_query_func */
3423 			NULL,                           /* rule_query_func */
3424 			NULL,                           /* player_query_func */
3425 			deal_with_cube2_packet,         /* packet_func */
3426 		},
3427 		{
3428 			/* MUMBLE PROTOCOL */
3429 			MUMBLE_PROTOCOL_SERVER,         /* id */
3430 			"MUMBLE",                       /* type_prefix */
3431 			"mumble",                       /* type_string */
3432 			"-mumble",                      /* type_option */
3433 			"Mumble",                       /* game_name */
3434 			0,                              /* master */
3435 			MUMBLE_DEFAULT_PORT,            /* default_port */
3436 			0,                              /* port_offset */
3437 			0,                              /* flags */
3438 			"gametype",                     /* game_rule */
3439 			"MUMBLEPROTOCOL",               /* template_var */
3440 			mumble_serverstatus,            /* status_packet */
3441 			12,                             /* status_len */
3442 			NULL,                           /* player_packet */
3443 			0,                              /* player_len */
3444 			NULL,                           /* rule_packet */
3445 			0,                              /* rule_len */
3446 			NULL,                           /* master_packet */
3447 			0,                              /* master_len */
3448 			NULL,                           /* master_protocol */
3449 			NULL,                           /* master_query */
3450 			NULL,                           /* display_player_func */
3451 			display_server_rules,           /* display_rule_func */
3452 			NULL,                           /* display_raw_player_func */
3453 			raw_display_server_rules,       /* display_raw_rule_func */
3454 			xml_display_player_info,        /* display_xml_player_func */
3455 			xml_display_server_rules,       /* display_xml_rule_func */
3456 			json_display_player_info,       /* display_json_player_func */
3457 			json_display_server_rules,      /* display_json_rule_func */
3458 			send_mumble_request_packet,     /* status_query_func */
3459 			NULL,                           /* rule_query_func */
3460 			NULL,                           /* player_query_func */
3461 			deal_with_mumble_packet,        /* packet_func */
3462 		},
3463 		{
3464 			/* TERRARIA PROTOCOL */
3465 			TERRARIA_PROTOCOL_SERVER,       /* id */
3466 			"TERRARIA",                     /* type_prefix */
3467 			"terraria",                     /* type_string */
3468 			"-terraria",                    /* type_option */
3469 			"Terraria",                     /* game_name */
3470 			0,                              /* master */
3471 			TERRARIA_DEFAULT_PORT,          /* default_port */
3472 			0,                              /* port_offset */
3473 			TF_TCP_CONNECT,                 /* flags */
3474 			"gametype",                     /* game_rule */
3475 			"TERRARIPROTOCOL",              /* template_var */
3476 			terraria_serverstatus,          /* status_packet */
3477 			sizeof(terraria_serverstatus),  /* status_len */
3478 			NULL,                           /* player_packet */
3479 			0,                              /* player_len */
3480 			NULL,                           /* rule_packet */
3481 			0,                              /* rule_len */
3482 			NULL,                           /* master_packet */
3483 			0,                              /* master_len */
3484 			NULL,                           /* master_protocol */
3485 			NULL,                           /* master_query */
3486 			NULL,                           /* display_player_func */
3487 			display_server_rules,           /* display_rule_func */
3488 			NULL,                           /* display_raw_player_func */
3489 			raw_display_server_rules,       /* display_raw_rule_func */
3490 			xml_display_player_info,        /* display_xml_player_func */
3491 			xml_display_server_rules,       /* display_xml_rule_func */
3492 			json_display_player_info,       /* display_json_player_func */
3493 			json_display_server_rules,      /* display_json_rule_func */
3494 			send_mumble_request_packet,     /* status_query_func */
3495 			NULL,                           /* rule_query_func */
3496 			NULL,                           /* player_query_func */
3497 			deal_with_terraria_packet,      /* packet_func */
3498 		},
3499 		{
3500 			/* CRYSIS PROTOCOL */
3501 			CRYSIS_PROTOCOL_SERVER,                                 /* id */
3502 			"CRYSIS",                                               /* type_prefix */
3503 			"crysis",                                               /* type_string */
3504 			"-crysis",                                              /* type_option */
3505 			"Crysis",                                               /* game_name */
3506 			0,                                                      /* master */
3507 			0,                                                      /* default_port */
3508 			0,                                                      /* port_offset */
3509 			TF_TCP_CONNECT | TF_QUERY_ARG_REQUIRED | TF_QUERY_ARG,  /* flags */
3510 			"gamerules",                                            /* game_rule */
3511 			"CRYSISPROTOCOL",                                       /* template_var */
3512 			NULL,                                                   /* status_packet */
3513 			0,                                                      /* status_len */
3514 			NULL,                                                   /* player_packet */
3515 			0,                                                      /* player_len */
3516 			NULL,                                                   /* rule_packet */
3517 			0,                                                      /* rule_len */
3518 			NULL,                                                   /* master_packet */
3519 			0,                                                      /* master_len */
3520 			NULL,                                                   /* master_protocol */
3521 			NULL,                                                   /* master_query */
3522 			NULL,                                                   /* display_player_func */
3523 			display_server_rules,                                   /* display_rule_func */
3524 			NULL,                                                   /* display_raw_player_func */
3525 			raw_display_server_rules,                               /* display_raw_rule_func */
3526 			xml_display_player_info,                                /* display_xml_player_func */
3527 			xml_display_server_rules,                               /* display_xml_rule_func */
3528 			json_display_player_info,                               /* display_json_player_func */
3529 			json_display_server_rules,                              /* display_json_rule_func */
3530 			send_crysis_request_packet,                             /* status_query_func */
3531 			NULL,                                                   /* rule_query_func */
3532 			NULL,                                                   /* player_query_func */
3533 			deal_with_crysis_packet,                                /* packet_func */
3534 		},
3535 		{
3536 			/* DIRTYBOMB PROTOCOL */
3537 			DIRTYBOMB_PROTOCOL_SERVER,      /* id */
3538 			"DIRTYBOMB",                    /* type_prefix */
3539 			"dirtybomb",                    /* type_string */
3540 			"-dirtybomb",                   /* type_option */
3541 			"DirtyBomb",                    /* game_name */
3542 			0,                              /* master */
3543 			DIRTYBOMB_DEFAULT_PORT,         /* default_port */
3544 			0,                              /* port_offset */
3545 			0,                              /* flags */
3546 			"gamerules",                    /* game_rule */
3547 			"DIRYTBOMBPROTOCOL",            /* template_var */
3548 			NULL,                           /* status_packet */
3549 			0,                              /* status_len */
3550 			NULL,                           /* player_packet */
3551 			0,                              /* player_len */
3552 			NULL,                           /* rule_packet */
3553 			0,                              /* rule_len */
3554 			NULL,                           /* master_packet */
3555 			0,                              /* master_len */
3556 			NULL,                           /* master_protocol */
3557 			NULL,                           /* master_query */
3558 			NULL,                           /* display_player_func */
3559 			display_server_rules,           /* display_rule_func */
3560 			NULL,                           /* display_raw_player_func */
3561 			raw_display_server_rules,       /* display_raw_rule_func */
3562 			xml_display_player_info,        /* display_xml_player_func */
3563 			xml_display_server_rules,       /* display_xml_rule_func */
3564 			json_display_player_info,       /* display_json_player_func */
3565 			json_display_server_rules,      /* display_json_rule_func */
3566 			send_dirtybomb_request_packet,  /* status_query_func */
3567 			NULL,                           /* rule_query_func */
3568 			NULL,                           /* player_query_func */
3569 			deal_with_dirtybomb_packet,     /* packet_func */
3570 		},
3571 		{
3572 			/* STARMADE PROTOCOL */
3573 			STARMADE_PROTOCOL_SERVER,               /* id */
3574 			"STARMADE",                             /* type_prefix */
3575 			"starmade",                             /* type_string */
3576 			"-starmade",                            /* type_option */
3577 			"StarMade",                             /* game_name */
3578 			0,                                      /* master */
3579 			0,                                      /* default_port */
3580 			0,                                      /* port_offset */
3581 			TF_TCP_CONNECT,                         /* flags */
3582 			"N/A",                                  /* game_rule */
3583 			"STARMADEPROTOCOL",                     /* template_var */
3584 			NULL,                                   /* status_packet */
3585 			0,                                      /* status_len */
3586 			NULL,                                   /* player_packet */
3587 			0,                                      /* player_len */
3588 			NULL,                                   /* rule_packet */
3589 			0,                                      /* rule_len */
3590 			NULL,                                   /* master_packet */
3591 			0,                                      /* master_len */
3592 			NULL,                                   /* master_protocol */
3593 			NULL,                                   /* master_query */
3594 			display_starmade_player_info,           /* display_player_func */
3595 			display_server_rules,                   /* display_rule_func */
3596 			raw_display_starmade_player_info,       /* display_raw_player_func */
3597 			raw_display_server_rules,               /* display_raw_rule_func */
3598 			xml_display_starmade_player_info,       /* display_xml_player_func */
3599 			xml_display_server_rules,               /* display_xml_rule_func */
3600 			json_display_starmade_player_info,      /* display_json_player_func */
3601 			json_display_server_rules,              /* display_json_rule_func */
3602 			send_starmade_request_packet,           /* status_query_func */
3603 			NULL,                                   /* rule_query_func */
3604 			NULL,                                   /* player_query_func */
3605 			deal_with_starmade_packet,              /* packet_func */
3606 		},
3607 		{
3608 			/* FARMSIM PROTOCOL */
3609 			FARMSIM_PROTOCOL_SERVER,                                /* id */
3610 			"FARMSIM",                                              /* type_prefix */
3611 			"farmsim",                                              /* type_string */
3612 			"-farmsim",                                             /* type_option */
3613 			"FarmingSimulator",                                     /* game_name */
3614 			0,                                                      /* master */
3615 			0,                                                      /* default_port */
3616 			0,                                                      /* port_offset */
3617 			TF_TCP_CONNECT | TF_QUERY_ARG_REQUIRED | TF_QUERY_ARG,  /* flags */
3618 			"gamerules",                                            /* game_rule */
3619 			"FARMSIMPROTOCOL",                                      /* template_var */
3620 			NULL,                                                   /* status_packet */
3621 			0,                                                      /* status_len */
3622 			NULL,                                                   /* player_packet */
3623 			0,                                                      /* player_len */
3624 			NULL,                                                   /* rule_packet */
3625 			0,                                                      /* rule_len */
3626 			NULL,                                                   /* master_packet */
3627 			0,                                                      /* master_len */
3628 			NULL,                                                   /* master_protocol */
3629 			NULL,                                                   /* master_query */
3630 			NULL,                                                   /* display_player_func */
3631 			display_server_rules,                                   /* display_rule_func */
3632 			NULL,                                                   /* display_raw_player_func */
3633 			raw_display_server_rules,                               /* display_raw_rule_func */
3634 			xml_display_player_info,                                /* display_xml_player_func */
3635 			xml_display_server_rules,                               /* display_xml_rule_func */
3636 			json_display_player_info,                               /* display_json_player_func */
3637 			json_display_server_rules,                              /* display_json_rule_func */
3638 			send_farmsim_request_packet,                            /* status_query_func */
3639 			NULL,                                                   /* rule_query_func */
3640 			NULL,                                                   /* player_query_func */
3641 			deal_with_farmsim_packet,                               /* packet_func */
3642 		},
3643 		{
3644 			/* KSP PROTOCOL */
3645 			KSP_PROTOCOL_SERVER,            /* id */
3646 			"KSP",                          /* type_prefix */
3647 			"ksp",                          /* type_string */
3648 			"-ksp",                         /* type_option */
3649 			"Kerbal Space Program",         /* game_name */
3650 			0,                              /* master */
3651 			0,                              /* default_port */
3652 			0,                              /* port_offset */
3653 			TF_TCP_CONNECT,                 /* flags */
3654 			"gamerules",                    /* game_rule */
3655 			"KSPPROTOCOL",                  /* template_var */
3656 			NULL,                           /* status_packet */
3657 			0,                              /* status_len */
3658 			NULL,                           /* player_packet */
3659 			0,                              /* player_len */
3660 			NULL,                           /* rule_packet */
3661 			0,                              /* rule_len */
3662 			NULL,                           /* master_packet */
3663 			0,                              /* master_len */
3664 			NULL,                           /* master_protocol */
3665 			NULL,                           /* master_query */
3666 			NULL,                           /* display_player_func */
3667 			display_server_rules,           /* display_rule_func */
3668 			NULL,                           /* display_raw_player_func */
3669 			raw_display_server_rules,       /* display_raw_rule_func */
3670 			xml_display_player_info,        /* display_xml_player_func */
3671 			xml_display_server_rules,       /* display_xml_rule_func */
3672 			json_display_player_info,       /* display_json_player_func */
3673 			json_display_server_rules,      /* display_json_rule_func */
3674 			send_ksp_request_packet,        /* status_query_func */
3675 			NULL,                           /* rule_query_func */
3676 			NULL,                           /* player_query_func */
3677 			deal_with_ksp_packet,           /* packet_func */
3678 		},
3679 		{
3680 			/* TF PROTOCOL */
3681 			TF_PROTOCOL_SERVER,             /* id */
3682 			"TF",                           /* type_prefix */
3683 			"tf",                           /* type_string */
3684 			"-tf",                          /* type_option */
3685 			"Titanfall",                    /* game_name */
3686 			0,                              /* master */
3687 			0,                              /* default_port */
3688 			0,                              /* port_offset */
3689 			TF_QUERY_ARG,                   /* flags */
3690 			"game_mode",                    /* game_rule */
3691 			"TFPROTOCOL",                   /* template_var */
3692 			NULL,                           /* status_packet */
3693 			0,                              /* status_len */
3694 			NULL,                           /* player_packet */
3695 			0,                              /* player_len */
3696 			NULL,                           /* rule_packet */
3697 			0,                              /* rule_len */
3698 			NULL,                           /* master_packet */
3699 			0,                              /* master_len */
3700 			NULL,                           /* master_protocol */
3701 			NULL,                           /* master_query */
3702 			NULL,                           /* display_player_func */
3703 			display_server_rules,           /* display_rule_func */
3704 			NULL,                           /* display_raw_player_func */
3705 			raw_display_server_rules,       /* display_raw_rule_func */
3706 			xml_display_player_info,        /* display_xml_player_func */
3707 			xml_display_server_rules,       /* display_xml_rule_func */
3708 			json_display_player_info,       /* display_json_player_func */
3709 			json_display_server_rules,      /* display_json_rule_func */
3710 			send_tf_request_packet,         /* status_query_func */
3711 			NULL,                           /* rule_query_func */
3712 			NULL,                           /* player_query_func */
3713 			deal_with_tf_packet,            /* packet_func */
3714 		},
3715 		{
3716 			/* Teeworlds master */
3717 			TEE_MASTER,                     /* id */
3718 			"TEEM",                         /* type_prefix */
3719 			"teem",                         /* type_string */
3720 			"-teem",                        /* type_option */
3721 			"Teeworlds Master",             /* game_name */
3722 			TEE_SERVER,                     /* master */
3723 			8300,                           /* default_port */
3724 			0,                              /* port_offset */
3725 			0,                              /* flags */
3726 			"gametype",                     /* game_rule */
3727 			"TEEWORLDSMASTER",              /* template_var */
3728 			NULL,                           /* status_packet */
3729 			0,                              /* status_len */
3730 			NULL,                           /* player_packet */
3731 			0,                              /* player_len */
3732 			NULL,                           /* rule_packet */
3733 			0,                              /* rule_len */
3734 			NULL,                           /* master_packet */
3735 			0,                              /* master_len */
3736 			NULL,                           /* master_protocol */
3737 			NULL,                           /* master_query */
3738 			NULL,                           /* display_player_func */
3739 			NULL,                           /* display_rule_func */
3740 			NULL,                           /* display_raw_player_func */
3741 			NULL,                           /* display_raw_rule_func */
3742 			NULL,                           /* display_xml_player_func */
3743 			NULL,                           /* display_xml_rule_func */
3744 			NULL,                           /* display_json_player_func */
3745 			NULL,                           /* display_json_rule_func */
3746 			send_teemaster_request_packet,  /* status_query_func */
3747 			NULL,                           /* rule_query_func */
3748 			NULL,                           /* player_query_func */
3749 			deal_with_teemaster_packet,     /* packet_func */
3750 		},
3751 		{
3752 			Q_UNKNOWN_TYPE, /* id */
3753 			"",             /* type_prefix */
3754 			"",             /* type_string */
3755 			"",             /* type_option */
3756 			"",             /* game_name */
3757 			0,              /* master */
3758 			0,              /* default_port */
3759 			0,              /* port_offset */
3760 			0,              /* flags */
3761 			"",             /* game_rule */
3762 			"",             /* template_var */
3763 			NULL,           /* status_packet */
3764 			0,              /* status_len */
3765 			NULL,           /* player_packet */
3766 			0,              /* player_len */
3767 			NULL,           /* rule_packet */
3768 			0,              /* rule_len */
3769 			(char *)NULL,   /* master_packet */
3770 			0,              /* master_len */
3771 			NULL,           /* master_protocol */
3772 			NULL,           /* master_query */
3773 			NULL,           /* display_player_func */
3774 			NULL,           /* display_rule_func */
3775 			NULL,           /* display_raw_player_func */
3776 			NULL,           /* display_raw_rule_func */
3777 			NULL,           /* display_xml_player_func */
3778 			NULL,           /* display_xml_rule_func */
3779 			NULL,           /* display_json_player_func */
3780 			NULL,           /* display_json_rule_func */
3781 			NULL,           /* status_query_func */
3782 			NULL,           /* rule_query_func */
3783 			NULL,           /* player_query_func */
3784 			NULL,           /* packet_func */
3785 		}
3786 	};
3787 
3788 #endif  /* QUERY_PACKETS */
3789 
3790 /* Structures for keeping information about Quake servers, server
3791  * rules, and players.
3792  */
3793 
3794 struct player;
3795 
3796 #define FLAG_BROADCAST			(1 << 1)
3797 #define FLAG_PLAYER_TEAMS		(1 << 2)
3798 #define FLAG_DO_NOT_FREE_GAME		(1 << 3)
3799 
3800 #define PLAYER_TYPE_NORMAL		1
3801 #define PLAYER_TYPE_BOT			2
3802 #define PLAYER_TYPE_ALIAS		4
3803 
3804 #define PLAYER_FLAG_DO_NOT_FREE_TEAM	1
3805 
3806 struct player {
3807 	int number;
3808 	char *name;
3809 	int frags;
3810 	int team;                       /* Unreal and Tribes only */
3811 	char *team_name;                /* Tribes, BFRIS only, do not free()  */
3812 	int connect_time;
3813 	int shirt_color;
3814 	int pants_color;
3815 	char *address;
3816 	int ping;
3817 	short flags;
3818 	short type_flag;                /* Tribes 2 only */
3819 	int packet_loss;                /* Tribes only */
3820 	char *tribe_tag;                /* Tribes 2 / Quake 4 clan name */
3821 	char *skin;
3822 	char *mesh;                     /* Unreal only */
3823 	char *face;                     /* Unreal only */
3824 	int score;                      /* BFRIS only */
3825 	int ship;                       /* BFRIS only */
3826 	int room;                       /* BFRIS only */
3827 	int deaths;                     /* Descent3 only */
3828 
3829 	char *next_info;
3830 	int n_info;
3831 	struct info *info;
3832 	struct info **last_info;
3833 	int missing_rules;
3834 
3835 	struct player *next;
3836 };
3837 
3838 struct rule {
3839 	char *name;
3840 	char *value;
3841 	struct rule *next;
3842 };
3843 
3844 struct info {
3845 	char *name;
3846 	char *value;
3847 	struct info *next;
3848 };
3849 
3850 extern char *qstat_version;
3851 extern char *DOWN;
3852 extern char *SYSERROR;
3853 extern char *TIMEOUT;
3854 extern char *MASTER;
3855 extern char *SERVERERROR;
3856 extern char *HOSTNOTFOUND;
3857 
3858 extern int n_retries;
3859 
3860 extern struct timeval packet_recv_time;
3861 
3862 #define DEFAULT_RETRIES			3
3863 #define DEFAULT_RETRY_INTERVAL		500 /* milli-seconds */
3864 #define MAXFD_DEFAULT			20
3865 
3866 #define SORT_GAME			1
3867 #define SORT_PING			2
3868 extern int first_sort_key;
3869 extern int second_sort_key;
3870 
3871 #define SECONDS				0
3872 #define CLOCK_TIME			1
3873 #define STOPWATCH_TIME			2
3874 #define DEFAULT_TIME_FMT_RAW		SECONDS
3875 #define DEFAULT_TIME_FMT_DISPLAY	CLOCK_TIME
3876 extern int time_format;
3877 
3878 extern int color_names;
3879 extern int show_errors;
3880 
3881 extern int get_player_info;
3882 extern int get_server_rules;
3883 extern int no_port_offset;
3884 
3885 /* Definitions for the original Quake network protocol.
3886  */
3887 
3888 #define PACKET_LEN    0xffff
3889 
3890 /* Quake packet formats and magic numbers
3891  */
3892 struct qheader {
3893 	unsigned char flag1;
3894 	unsigned char flag2;
3895 	unsigned short length;
3896 	unsigned char op_code;
3897 };
3898 
3899 #define Q_NET_PROTOCOL_VERSION		3
3900 #define HEXEN2_NET_PROTOCOL_VERSION	4
3901 
3902 #define Q_CCREQ_CONNECT			0x01
3903 #define Q_CCREP_ACCEPT			0x81
3904 #define Q_CCREP_REJECT			0x82
3905 
3906 #define Q_CCREP_SERVER_INFO		0x83
3907 
3908 #define Q_CCREP_PLAYER_INFO		0x84
3909 
3910 #define Q_CCREP_RULE_INFO		0x85
3911 
3912 #define Q_DEFAULT_SV_MAXSPEED		"320"
3913 #define Q_DEFAULT_SV_FRICTION		"4"
3914 #define Q_DEFAULT_SV_GRAVITY		"800"
3915 #define Q_DEFAULT_NOEXIT		"0"
3916 #define Q_DEFAULT_TEAMPLAY		"0"
3917 #define Q_DEFAULT_TIMELIMIT		"0"
3918 #define Q_DEFAULT_FRAGLIMIT		"0"
3919 
3920 /* Definitions for the QuakeWorld network protocol
3921  */
3922 
3923 /*
3924  #define QW_GET_SERVERS    'c'
3925  */
3926 #define QW_SERVERS		'd'
3927 #define HL_SERVERS		'f'
3928 
3929 /*
3930  * HL master: send 'a', master responds with a small 'l' packet containing
3931  *  the text "Outdated protocol"
3932  * HL master: send 'e', master responds with a small 'f' packet
3933  * HL master: send 'g', master responds with a small 'h' packet containing
3934  *  name of master server
3935  * HL master: send 'i', master responds with a small 'j' packet
3936  */
3937 #define QW_GET_USERINFO		'o'
3938 #define QW_USERINFO		'p'
3939 #define QW_GET_SEENINFO		'u'
3940 #define QW_SEENINFO		'v'
3941 #define QW_NACK			'm'
3942 #define QW_NEWLINE		'\n'
3943 #define QW_RULE_SEPARATOR	'\\'
3944 
3945 #define QW_REQUEST_LENGTH	20
3946 
3947 int is_default_rule(struct rule *rule);
3948 char *xform_name(char *, struct qserver *server);
3949 char *quake_color(int color);
3950 char *play_time(int seconds, int show_seconds);
3951 char *ping_time(int ms);
3952 char *get_qw_game(struct qserver *server);
3953 
3954 /*
3955  * Query status and packet handling functions
3956  */
3957 
3958 int cleanup_qserver(struct qserver *server, int force);
3959 void change_server_port(struct qserver *server, unsigned short port, int force);
3960 
3961 int server_info_packet(struct qserver *server, struct q_packet *pkt, int datalen);
3962 int player_info_packet(struct qserver *server, struct q_packet *pkt, int datalen);
3963 int rule_info_packet(struct qserver *server, struct q_packet *pkt, int datalen);
3964 
3965 int time_delta(struct timeval *later, struct timeval *past);
3966 char *strherror(int h_err);
3967 int connection_refused();
3968 int connection_would_block();
3969 int connection_reset();
3970 
3971 void add_file(char *filename);
3972 int add_qserver(char *arg, server_type *type, char *outfilename, char *query_arg);
3973 struct qserver *add_qserver_byaddr(unsigned int ipaddr, unsigned short port, server_type *type, int *new_server);
3974 void init_qserver(struct qserver *server, server_type *type);
3975 int bind_qserver(struct qserver *server);
3976 int bind_sockets();
3977 void send_packets();
3978 struct qserver *find_server_by_address(unsigned int ipaddr, unsigned short port);
3979 void add_server_to_hash(struct qserver *server);
3980 void quicksort(void **array, int i, int j, int (*compare)(void *, void *));
3981 int type_option_compare(server_type *one, server_type *two);
3982 int type_string_compare(server_type *one, server_type *two);
3983 
3984 #define NO_FLAGS			0
3985 #define NO_VALUE_COPY			1
3986 #define CHECK_DUPLICATE_RULES		2
3987 #define NO_KEY_COPY			4
3988 #define COMBINE_VALUES			8
3989 #define OVERWITE_DUPLICATES		16
3990 
3991 struct player *get_player_by_number(struct qserver *server, int player_number);
3992 struct rule *add_rule(struct qserver *server, char *key, char *value, int flags);
3993 struct player *add_player(struct qserver *server, int player_number);
3994 struct info *player_add_info(struct player *player, char *key, char *value, int flags);
3995 void players_set_teamname(struct qserver *server, int teamid, char *teamname);
3996 
3997 /*
3998  * Output template stuff
3999  */
4000 
4001 int read_qserver_template(char *filename);
4002 int read_rule_template(char *filename);
4003 int read_header_template(char *filename);
4004 int read_trailer_template(char *filename);
4005 int read_player_template(char *filename);
4006 int have_server_template();
4007 int have_header_template();
4008 int have_trailer_template();
4009 
4010 void template_display_server(struct qserver *server);
4011 void template_display_header();
4012 void template_display_trailer();
4013 void template_display_players(struct qserver *server);
4014 void template_display_player(struct qserver *server, struct player *player);
4015 void template_display_rules(struct qserver *server);
4016 void template_display_rule(struct qserver *server, struct rule *rule);
4017 
4018 /*
4019  * Host cache stuff
4020  */
4021 
4022 int hcache_open(char *filename, int update);
4023 void hcache_write(char *filename);
4024 void hcache_invalidate();
4025 void hcache_validate();
4026 unsigned long hcache_lookup_hostname(char *hostname);
4027 char *hcache_lookup_ipaddr(unsigned long ipaddr);
4028 void hcache_write_file(char *filename);
4029 void hcache_update_file();
4030 
4031 unsigned int swap_long_from_little(void *l);
4032 unsigned short swap_short_from_little(void *l);
4033 float swap_float_from_little(void *f);
4034 
4035 /** \brief write four bytes in little endian order */
4036 void put_long_little(unsigned val, char *buf);
4037 
4038 /*
4039  * Exported Globals
4040  */
4041 extern int show_game_port;
4042 extern int up_servers_only;
4043 extern int hostname_lookup;
4044 
4045 #define NA_INT			-32767
4046 #define NO_PLAYER_INFO		0xffff
4047 #define NO_SERVER_RULES		NULL
4048 
4049 #define FORCE			1
4050 #define NO_FORCE		0
4051 
4052 #endif
4053