2 * Routines for QuakeWorld packet dissection
4 * Uwe Girlich <uwe@planetquake.com>
5 * http://www.idsoftware.com/q1source/q1source.zip
7 * $Id: packet-quakeworld.c,v 1.14 2002/06/09 21:25:47 guy Exp $
9 * Ethereal - Network traffic analyzer
10 * By Gerald Combs <gerald@ethereal.com>
11 * Copyright 1998 Gerald Combs
13 * Copied from packet-quake.c
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 #ifdef HAVE_SYS_TYPES_H
35 # include <sys/types.h>
40 #include <epan/packet.h>
43 static int proto_quakeworld = -1;
45 static int hf_quakeworld_s2c = -1;
46 static int hf_quakeworld_c2s = -1;
47 static int hf_quakeworld_connectionless = -1;
48 static int hf_quakeworld_game = -1;
49 static int hf_quakeworld_connectionless_marker = -1;
50 static int hf_quakeworld_connectionless_text = -1;
51 static int hf_quakeworld_connectionless_command = -1;
52 static int hf_quakeworld_connectionless_arguments = -1;
53 static int hf_quakeworld_connectionless_connect_version = -1;
54 static int hf_quakeworld_connectionless_connect_qport = -1;
55 static int hf_quakeworld_connectionless_connect_challenge = -1;
56 static int hf_quakeworld_connectionless_connect_infostring = -1;
57 static int hf_quakeworld_connectionless_connect_infostring_key_value = -1;
58 static int hf_quakeworld_connectionless_connect_infostring_key = -1;
59 static int hf_quakeworld_connectionless_connect_infostring_value = -1;
60 static int hf_quakeworld_connectionless_rcon_password = -1;
61 static int hf_quakeworld_connectionless_rcon_command = -1;
62 static int hf_quakeworld_game_seq1 = -1;
63 static int hf_quakeworld_game_rel1 = -1;
64 static int hf_quakeworld_game_seq2 = -1;
65 static int hf_quakeworld_game_rel2 = -1;
66 static int hf_quakeworld_game_qport = -1;
68 static gint ett_quakeworld = -1;
69 static gint ett_quakeworld_connectionless = -1;
70 static gint ett_quakeworld_connectionless_text = -1;
71 static gint ett_quakeworld_connectionless_arguments = -1;
72 static gint ett_quakeworld_connectionless_connect_infostring = -1;
73 static gint ett_quakeworld_connectionless_connect_infostring_key_value = -1;
74 static gint ett_quakeworld_game = -1;
75 static gint ett_quakeworld_game_seq1 = -1;
76 static gint ett_quakeworld_game_seq2 = -1;
77 static gint ett_quakeworld_game_clc = -1;
78 static gint ett_quakeworld_game_svc = -1;
80 static dissector_handle_t data_handle;
83 helper functions, they may ave to go somewhere else
84 they are mostly copied without change from
85 quakeworldsource/client/cmd.c
86 quakeworldsource/client/common.c
89 #define MAX_TEXT_SIZE 2048
91 static char com_token[MAX_TEXT_SIZE+1];
92 static int com_token_start;
93 static int com_token_length;
96 COM_Parse (char *data)
104 com_token_length = 0;
109 /* skip whitespace */
111 while ( (c = *data) <= ' ') {
113 return NULL; /* end of file; */
118 /* skip // comments */
119 if (c=='/' && data[1] == '/') {
120 while (*data && *data != '\n')
126 /* handle quoted strings specially */
132 if (c=='\"' || c==0) {
142 /* parse a regular word */
157 static int cmd_argc = 0;
158 static char *cmd_argv[MAX_ARGS];
159 static char *cmd_null_string = "";
160 static int cmd_argv_start[MAX_ARGS];
161 static int cmd_argv_length[MAX_ARGS];
175 if ( arg >= cmd_argc )
176 return cmd_null_string;
177 return cmd_argv[arg];
182 Cmd_Argv_start(int arg)
184 if ( arg >= cmd_argc )
186 return cmd_argv_start[arg];
191 Cmd_Argv_length(int arg)
193 if ( arg >= cmd_argc )
195 return cmd_argv_length[arg];
200 Cmd_TokenizeString(char* text)
207 /* clear the args from the last string */
208 for (i=0 ; i<cmd_argc ; i++)
216 /* skip whitespace up to a \n */
217 while (*text && *text <= ' ' && *text != '\n') {
225 /* a newline seperates commands in the buffer */
233 text = COM_Parse (text);
237 if (cmd_argc < MAX_ARGS) {
238 cmd_argv[cmd_argc] = g_strdup(com_token);
239 cmd_argv_start[cmd_argc] = start + com_token_start;
240 cmd_argv_length[cmd_argc] = com_token_length;
244 start += com_token_start + com_token_length;
250 dissect_id_infostring(tvbuff_t *tvb, proto_tree* tree,
251 int offset, char* infostring,
252 gint ett_key_value, int hf_key_value, int hf_key, int hf_value)
254 char * newpos = infostring;
255 int end_of_info = FALSE;
257 /* to look at all the key/value pairs, we destroy infostring */
258 while(!end_of_info) {
267 if (*keypos == 0) break;
268 if (*keypos == '\\') keypos++;
272 *(keypos + keylength) != '\\' &&
273 *(keypos + keylength) != 0
276 keyvaluesep = keypos + keylength;
277 if (*keyvaluesep == 0) break;
278 valuepos = keyvaluesep+1;
281 *(valuepos + valuelength) != '\\' &&
282 *(valuepos + valuelength) != 0
285 valueend = valuepos + valuelength;
286 if (*valueend == 0) {
289 *(keyvaluesep) = '=';
293 proto_item* sub_item = NULL;
294 proto_tree* sub_tree = NULL;
296 sub_item = proto_tree_add_string(tree,
299 offset + (keypos-infostring),
300 keylength + 1 + valuelength, keypos);
303 proto_item_add_subtree(
308 proto_tree_add_string(sub_tree,
311 offset + (keypos-infostring),
313 proto_tree_add_string(sub_tree,
316 offset + (valuepos-infostring),
317 valuelength, valuepos);
320 newpos = valueend + 1;
325 static const value_string names_direction[] = {
327 { DIR_C2S, "Client to Server" },
329 { DIR_S2C, "Server to Client" },
334 /* I took this name and value directly out of the QW source. */
335 #define PORT_MASTER 27500
336 static unsigned int gbl_quakeworldServerPort=PORT_MASTER;
339 /* out of band message id bytes (taken out of quakeworldsource/client/protocol.h */
341 /* M = master, S = server, C = client, A = any */
342 /* the second character will allways be \n if the message isn't a single */
343 /* byte long (?? not true anymore?) */
345 #define S2C_CHALLENGE 'c'
346 #define S2C_CONNECTION 'j'
347 #define A2A_PING 'k' /* respond with an A2A_ACK */
348 #define A2A_ACK 'l' /* general acknowledgement without info */
349 #define A2A_NACK 'm' /* [+ comment] general failure */
350 #define A2A_ECHO 'e' /* for echoing */
351 #define A2C_PRINT 'n' /* print a message on client */
353 #define S2M_HEARTBEAT 'a' /* + serverinfo + userlist + fraglist */
354 #define A2C_CLIENT_COMMAND 'B' /* + command line */
355 #define S2M_SHUTDOWN 'C'
359 dissect_quakeworld_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo,
360 proto_tree *tree, int direction)
362 proto_tree *cl_tree = NULL;
363 proto_item *cl_item = NULL;
364 proto_item *text_item = NULL;
365 proto_tree *text_tree = NULL;
366 guint8 text[MAX_TEXT_SIZE+1];
372 char command[MAX_TEXT_SIZE+1];
373 int command_finished = FALSE;
375 marker = tvb_get_ntohl(tvb, 0);
377 cl_item = proto_tree_add_text(tree, tvb,
378 0, -1, "Connectionless");
380 cl_tree = proto_item_add_subtree(
381 cl_item, ett_quakeworld_connectionless);
385 proto_tree_add_uint(cl_tree, hf_quakeworld_connectionless_marker,
389 /* all the rest of the packet is just text */
392 maxbufsize = MIN((gint)MAX_TEXT_SIZE, tvb_length_remaining(tvb, offset));
393 len = tvb_get_nstringz0(tvb, offset, maxbufsize, text);
394 /* actually, we should look for a eol char and stop already there */
397 text_item = proto_tree_add_string(cl_tree, hf_quakeworld_connectionless_text,
398 tvb, offset, len + 1, text);
400 text_tree = proto_item_add_subtree(
401 text_item, ett_quakeworld_connectionless_text);
405 if (direction == DIR_C2S) {
406 /* client to sever commands */
409 Cmd_TokenizeString(text);
412 /* client to sever commands */
413 if (strcmp(c,"ping") == 0) {
414 strcpy(command, "Ping");
416 } else if (strcmp(c,"status") == 0) {
417 strcpy(command, "Status");
419 } else if (strcmp(c,"log") == 0) {
420 strcpy(command, "Status");
422 } else if (strcmp(c,"connect") == 0) {
427 proto_item *argument_item = NULL;
428 proto_tree *argument_tree = NULL;
429 proto_item *info_item = NULL;
430 proto_tree *info_tree = NULL;
431 strcpy(command, "Connect");
432 command_len = Cmd_Argv_length(0);
434 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
435 tvb, offset, command_len, command);
436 argument_item = proto_tree_add_string(text_tree,
437 hf_quakeworld_connectionless_arguments,
438 tvb, offset + Cmd_Argv_start(1), len + 1 - Cmd_Argv_start(1),
439 text + Cmd_Argv_start(1));
442 proto_item_add_subtree(argument_item,
443 ett_quakeworld_connectionless_arguments);
445 command_finished=TRUE;
447 version = atoi(Cmd_Argv(1));
448 qport = atoi(Cmd_Argv(2));
449 challenge = atoi(Cmd_Argv(3));
450 infostring = Cmd_Argv(4);
452 proto_tree_add_uint(argument_tree,
453 hf_quakeworld_connectionless_connect_version,
455 offset + Cmd_Argv_start(1),
456 Cmd_Argv_length(1), version);
457 proto_tree_add_uint(argument_tree,
458 hf_quakeworld_connectionless_connect_qport,
460 offset + Cmd_Argv_start(2),
461 Cmd_Argv_length(2), qport);
462 proto_tree_add_int(argument_tree,
463 hf_quakeworld_connectionless_connect_challenge,
465 offset + Cmd_Argv_start(3),
466 Cmd_Argv_length(3), challenge);
467 info_item = proto_tree_add_string(argument_tree,
468 hf_quakeworld_connectionless_connect_infostring,
470 offset + Cmd_Argv_start(4),
471 Cmd_Argv_length(4), infostring);
473 info_tree = proto_item_add_subtree(
474 info_item, ett_quakeworld_connectionless_connect_infostring);
475 dissect_id_infostring(tvb, info_tree, offset + Cmd_Argv_start(4),
477 ett_quakeworld_connectionless_connect_infostring_key_value,
478 hf_quakeworld_connectionless_connect_infostring_key_value,
479 hf_quakeworld_connectionless_connect_infostring_key,
480 hf_quakeworld_connectionless_connect_infostring_value);
482 } else if (strcmp(c,"getchallenge") == 0) {
483 strcpy(command, "Get Challenge");
484 command_len = Cmd_Argv_length(0);
485 } else if (strcmp(c,"rcon") == 0) {
488 char remaining[MAX_TEXT_SIZE+1];
489 proto_item *argument_item = NULL;
490 proto_tree *argument_tree = NULL;
491 strcpy(command, "Remote Command");
492 command_len = Cmd_Argv_length(0);
494 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
495 tvb, offset, command_len, command);
496 argument_item = proto_tree_add_string(text_tree,
497 hf_quakeworld_connectionless_arguments,
498 tvb, offset + Cmd_Argv_start(1), len + 1 - Cmd_Argv_start(1),
499 text + Cmd_Argv_start(1));
502 proto_item_add_subtree(argument_item,
503 ett_quakeworld_connectionless_arguments);
505 command_finished=TRUE;
507 password = Cmd_Argv(1);
509 proto_tree_add_string(argument_tree,
510 hf_quakeworld_connectionless_rcon_password,
512 offset + Cmd_Argv_start(1),
513 Cmd_Argv_length(1), password);
515 for (i=2; i<Cmd_Argc() ; i++) {
517 strcat (remaining, Cmd_Argv(i) );
518 strcat (remaining, " ");
521 proto_tree_add_string(argument_tree,
522 hf_quakeworld_connectionless_rcon_command,
523 tvb, offset + Cmd_Argv_start(2),
524 Cmd_Argv_start(Cmd_Argc()-1) + Cmd_Argv_length(Cmd_Argc()-1) -
528 } else if (c[0]==A2A_PING && ( c[1]==0 || c[1]=='\n')) {
529 strcpy(command, "Ping");
531 } else if (c[0]==A2A_ACK && ( c[1]==0 || c[1]=='\n')) {
532 strcpy(command, "Ack");
535 strcpy(command, "Unknown");
540 /* server to client commands */
541 if (text[0] == S2C_CONNECTION) {
542 strcpy(command, "Connected");
544 } else if (text[0] == A2C_CLIENT_COMMAND) {
545 strcpy(command, "Client Command");
547 /* stringz (command), stringz (localid) */
548 } else if (text[0] == A2C_PRINT) {
549 strcpy(command, "Print");
552 } else if (text[0] == A2A_PING) {
553 strcpy(command, "Ping");
555 } else if (text[0] == S2C_CHALLENGE) {
556 strcpy(command, "Challenge");
560 strcpy(command, "Unknown");
565 if (check_col(pinfo->cinfo, COL_INFO)) {
566 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", command);
569 if (text_tree && !command_finished) {
570 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
571 tvb, offset, command_len, command);
578 dissect_quakeworld_client_commands(tvbuff_t *tvb, packet_info *pinfo,
581 /* If I have too much time at hand, I'll fill it with all
582 the information from my QWD specs:
583 http://www.planetquake.com/demospecs/qwd/
585 call_dissector(data_handle,tvb, pinfo, tree);
590 dissect_quakeworld_server_commands(tvbuff_t *tvb, packet_info *pinfo,
593 /* If I have too much time at hand, I'll fill it with all
594 the information from my QWD specs:
595 http://www.planetquake.com/demospecs/qwd/
597 call_dissector(data_handle,tvb, pinfo, tree);
601 static const value_string names_reliable[] = {
602 { 0, "Non Reliable" },
609 dissect_quakeworld_GamePacket(tvbuff_t *tvb, packet_info *pinfo,
610 proto_tree *tree, int direction)
612 proto_tree *game_tree = NULL;
613 proto_item *game_item = NULL;
621 direction = (pinfo->destport == gbl_quakeworldServerPort) ?
625 game_item = proto_tree_add_text(tree, tvb,
628 game_tree = proto_item_add_subtree(
629 game_item, ett_quakeworld_game);
634 seq1 = tvb_get_letohl(tvb, offset);
635 rel1 = seq1 & 0x80000000 ? 1 : 0;
638 proto_item *seq1_item = proto_tree_add_text(game_tree,
639 tvb, offset, 4, "Current Sequence: %u (%s)",
640 seq1, val_to_str(rel1,names_reliable,"%u"));
642 proto_tree *seq1_tree = proto_item_add_subtree(
643 seq1_item, ett_quakeworld_game_seq1);
644 proto_tree_add_uint(seq1_tree, hf_quakeworld_game_seq1,
645 tvb, offset, 4, seq1);
646 proto_tree_add_boolean(seq1_tree, hf_quakeworld_game_rel1,
647 tvb, offset+3, 1, rel1);
652 seq2 = tvb_get_letohl(tvb, offset);
653 rel2 = seq2 & 0x80000000 ? 1 : 0;
656 proto_item *seq2_item = proto_tree_add_text(game_tree,
657 tvb, offset, 4, "Acknowledge Sequence: %u (%s)",
658 seq2, val_to_str(rel2,names_reliable,"%u"));;
660 proto_tree *seq2_tree = proto_item_add_subtree(
661 seq2_item, ett_quakeworld_game_seq2);
662 proto_tree_add_uint(seq2_tree, hf_quakeworld_game_seq2,
663 tvb, offset, 4, seq2);
664 proto_tree_add_boolean(seq2_tree, hf_quakeworld_game_rel2,
665 tvb, offset+3, 1, rel2);
670 if (direction == DIR_C2S) {
671 /* client to server */
672 guint16 qport = tvb_get_letohs(tvb, offset);
674 proto_tree_add_uint(game_tree, hf_quakeworld_game_qport,
675 tvb, offset, 2, qport);
680 /* all the rest is pure game data */
681 rest_length = tvb_reported_length(tvb) - offset;
684 tvb_new_subset(tvb, offset, rest_length , rest_length);
686 if (direction == DIR_C2S) {
687 proto_item *c_item = NULL;
688 proto_tree *c_tree = NULL;
690 c_item = proto_tree_add_text(game_tree, next_tvb,
691 0, -1, "Client Commands");
693 c_tree = proto_item_add_subtree(
694 c_item, ett_quakeworld_game_clc);
697 dissect_quakeworld_client_commands(next_tvb, pinfo, c_tree);
700 proto_item *c_item = NULL;
701 proto_tree *c_tree = NULL;
703 c_item = proto_tree_add_text(game_tree, next_tvb,
704 0, -1, "Server Commands");
706 c_tree = proto_item_add_subtree(
707 c_item, ett_quakeworld_game_svc);
710 dissect_quakeworld_server_commands(next_tvb, pinfo, c_tree);
717 dissect_quakeworld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
719 proto_tree *quakeworld_tree = NULL;
720 proto_item *quakeworld_item = NULL;
723 direction = (pinfo->destport == gbl_quakeworldServerPort) ?
726 if (check_col(pinfo->cinfo, COL_PROTOCOL))
727 col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKEWORLD");
728 if (check_col(pinfo->cinfo, COL_INFO))
729 col_set_str(pinfo->cinfo, COL_INFO, val_to_str(direction,
730 names_direction, "%u"));
733 quakeworld_item = proto_tree_add_item(tree, proto_quakeworld,
736 quakeworld_tree = proto_item_add_subtree(
737 quakeworld_item, ett_quakeworld);
738 if (quakeworld_tree) {
739 proto_tree_add_uint_format(quakeworld_tree,
740 direction == DIR_S2C ?
744 "Direction: %s", val_to_str(direction, names_direction, "%u"));
748 if (tvb_get_ntohl(tvb, 0) == 0xffffffff) {
749 if (check_col(pinfo->cinfo, COL_INFO)) {
750 col_append_str(pinfo->cinfo, COL_INFO, " Connectionless");
753 proto_tree_add_uint_format(quakeworld_tree,
754 hf_quakeworld_connectionless,
756 "Type: Connectionless");
757 dissect_quakeworld_ConnectionlessPacket(
758 tvb, pinfo, quakeworld_tree, direction);
761 if (check_col(pinfo->cinfo, COL_INFO)) {
762 col_append_str(pinfo->cinfo, COL_INFO, " Game");
765 proto_tree_add_uint_format(quakeworld_tree,
769 dissect_quakeworld_GamePacket(
770 tvb, pinfo, quakeworld_tree, direction);
776 proto_reg_handoff_quakeworld(void)
778 static int Initialized=FALSE;
779 static dissector_handle_t quakeworld_handle;
780 static int ServerPort=0;
783 quakeworld_handle = create_dissector_handle(dissect_quakeworld,
787 dissector_delete("udp.port", ServerPort, quakeworld_handle);
790 /* set port for future deletes */
791 ServerPort=gbl_quakeworldServerPort;
793 dissector_add("udp.port", gbl_quakeworldServerPort, quakeworld_handle);
794 data_handle = find_dissector("data");
799 proto_register_quakeworld(void)
801 static hf_register_info hf[] = {
802 { &hf_quakeworld_c2s,
803 { "Client to Server", "quakeworld.c2s",
804 FT_UINT32, BASE_DEC, NULL, 0x0,
805 "Client to Server", HFILL }},
806 { &hf_quakeworld_s2c,
807 { "Server to Client", "quakeworld.s2c",
808 FT_UINT32, BASE_DEC, NULL, 0x0,
809 "Server to Client", HFILL }},
810 { &hf_quakeworld_connectionless,
811 { "Connectionless", "quakeworld.connectionless",
812 FT_UINT32, BASE_DEC, NULL, 0x0,
813 "Connectionless", HFILL }},
814 { &hf_quakeworld_game,
815 { "Game", "quakeworld.game",
816 FT_UINT32, BASE_DEC, NULL, 0x0,
818 { &hf_quakeworld_connectionless_marker,
819 { "Marker", "quakeworld.connectionless.marker",
820 FT_UINT32, BASE_HEX, NULL, 0x0,
822 { &hf_quakeworld_connectionless_text,
823 { "Text", "quakeworld.connectionless.text",
824 FT_STRING, BASE_DEC, NULL, 0x0,
826 { &hf_quakeworld_connectionless_command,
827 { "Command", "quakeworld.connectionless.command",
828 FT_STRING, BASE_DEC, NULL, 0x0,
830 { &hf_quakeworld_connectionless_arguments,
831 { "Arguments", "quakeworld.connectionless.arguments",
832 FT_STRING, BASE_DEC, NULL, 0x0,
833 "Arguments", HFILL }},
834 { &hf_quakeworld_connectionless_connect_version,
835 { "Version", "quakeworld.connectionless.connect.version",
836 FT_UINT32, BASE_DEC, NULL, 0x0,
837 "Protocol Version", HFILL }},
838 { &hf_quakeworld_connectionless_connect_qport,
839 { "QPort", "quakeworld.connectionless.connect.qport",
840 FT_UINT32, BASE_DEC, NULL, 0x0,
841 "QPort of the client", HFILL }},
842 { &hf_quakeworld_connectionless_connect_challenge,
843 { "Challenge", "quakeworld.connectionless.connect.challenge",
844 FT_INT32, BASE_DEC, NULL, 0x0,
845 "Challenge from the server", HFILL }},
846 { &hf_quakeworld_connectionless_connect_infostring,
847 { "Infostring", "quakeworld.connectionless.connect.infostring",
848 FT_STRING, BASE_DEC, NULL, 0x0,
849 "Infostring with additional variables", HFILL }},
850 { &hf_quakeworld_connectionless_connect_infostring_key_value,
851 { "Key/Value", "quakeworld.connectionless.connect.infostring.key_value",
852 FT_STRING, BASE_DEC, NULL, 0x0,
853 "Key and Value", HFILL }},
854 { &hf_quakeworld_connectionless_connect_infostring_key,
855 { "Key", "quakeworld.connectionless.connect.infostring.key",
856 FT_STRING, BASE_DEC, NULL, 0x0,
857 "Infostring Key", HFILL }},
858 { &hf_quakeworld_connectionless_connect_infostring_value,
859 { "Value", "quakeworld.connectionless.connect.infostring.value",
860 FT_STRING, BASE_DEC, NULL, 0x0,
861 "Infostring Value", HFILL }},
862 { &hf_quakeworld_connectionless_rcon_password,
863 { "Password", "quakeworld.connectionless.rcon.password",
864 FT_STRING, BASE_DEC, NULL, 0x0,
865 "Rcon Password", HFILL }},
866 { &hf_quakeworld_connectionless_rcon_command,
867 { "Command", "quakeworld.connectionless.rcon.command",
868 FT_STRING, BASE_DEC, NULL, 0x0,
870 { &hf_quakeworld_game_seq1,
871 { "Sequence Number", "quakeworld.game.seq1",
872 FT_UINT32, BASE_DEC, NULL, 0x0,
873 "Sequence number of the current packet", HFILL }},
874 { &hf_quakeworld_game_rel1,
875 { "Reliable", "quakeworld.game.rel1",
876 FT_BOOLEAN, BASE_DEC, NULL, 0x0,
877 "Packet is reliable and may be retransmitted", HFILL }},
878 { &hf_quakeworld_game_seq2,
879 { "Sequence Number", "quakeworld.game.seq2",
880 FT_UINT32, BASE_DEC, NULL, 0x0,
881 "Sequence number of the last received packet", HFILL }},
882 { &hf_quakeworld_game_rel2,
883 { "Reliable", "quakeworld.game.rel2",
884 FT_BOOLEAN, BASE_DEC, NULL, 0x0,
885 "Packet was reliable and may be retransmitted", HFILL }},
886 { &hf_quakeworld_game_qport,
887 { "QPort", "quakeworld.game.qport",
888 FT_UINT32, BASE_DEC, NULL, 0x0,
889 "QuakeWorld Client Port", HFILL }}
891 static gint *ett[] = {
893 &ett_quakeworld_connectionless,
894 &ett_quakeworld_connectionless_text,
895 &ett_quakeworld_connectionless_arguments,
896 &ett_quakeworld_connectionless_connect_infostring,
897 &ett_quakeworld_connectionless_connect_infostring_key_value,
898 &ett_quakeworld_game,
899 &ett_quakeworld_game_seq1,
900 &ett_quakeworld_game_seq2,
901 &ett_quakeworld_game_clc,
902 &ett_quakeworld_game_svc
904 module_t *quakeworld_module;
906 proto_quakeworld = proto_register_protocol("QuakeWorld Network Protocol",
907 "QUAKEWORLD", "quakeworld");
908 proto_register_field_array(proto_quakeworld, hf, array_length(hf));
909 proto_register_subtree_array(ett, array_length(ett));
911 /* Register a configuration option for port */
912 quakeworld_module = prefs_register_protocol(proto_quakeworld,
913 proto_reg_handoff_quakeworld);
914 prefs_register_uint_preference(quakeworld_module, "udp.port",
915 "QuakeWorld Server UDP Port",
916 "Set the UDP port for the QuakeWorld Server",
917 10, &gbl_quakeworldServerPort);