2 * Routines for QuakeWorld packet dissection
4 * Uwe Girlich <uwe@planetquake.com>
5 * http://www.idsoftware.com/q1source/q1source.zip
9 * Wireshark - Network traffic analyzer
10 * By Gerald Combs <gerald@wireshark.org>
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.
36 #include <epan/packet.h>
37 #include <epan/prefs.h>
38 #include <epan/strutil.h>
40 static int proto_quakeworld = -1;
42 static int hf_quakeworld_s2c = -1;
43 static int hf_quakeworld_c2s = -1;
44 static int hf_quakeworld_connectionless = -1;
45 static int hf_quakeworld_game = -1;
46 static int hf_quakeworld_connectionless_marker = -1;
47 static int hf_quakeworld_connectionless_text = -1;
48 static int hf_quakeworld_connectionless_command = -1;
49 static int hf_quakeworld_connectionless_arguments = -1;
50 static int hf_quakeworld_connectionless_connect_version = -1;
51 static int hf_quakeworld_connectionless_connect_qport = -1;
52 static int hf_quakeworld_connectionless_connect_challenge = -1;
53 static int hf_quakeworld_connectionless_connect_infostring = -1;
54 static int hf_quakeworld_connectionless_connect_infostring_key_value = -1;
55 static int hf_quakeworld_connectionless_connect_infostring_key = -1;
56 static int hf_quakeworld_connectionless_connect_infostring_value = -1;
57 static int hf_quakeworld_connectionless_rcon_password = -1;
58 static int hf_quakeworld_connectionless_rcon_command = -1;
59 static int hf_quakeworld_game_seq1 = -1;
60 static int hf_quakeworld_game_rel1 = -1;
61 static int hf_quakeworld_game_seq2 = -1;
62 static int hf_quakeworld_game_rel2 = -1;
63 static int hf_quakeworld_game_qport = -1;
65 static gint ett_quakeworld = -1;
66 static gint ett_quakeworld_connectionless = -1;
67 static gint ett_quakeworld_connectionless_text = -1;
68 static gint ett_quakeworld_connectionless_arguments = -1;
69 static gint ett_quakeworld_connectionless_connect_infostring = -1;
70 static gint ett_quakeworld_connectionless_connect_infostring_key_value = -1;
71 static gint ett_quakeworld_game = -1;
72 static gint ett_quakeworld_game_seq1 = -1;
73 static gint ett_quakeworld_game_seq2 = -1;
74 static gint ett_quakeworld_game_clc = -1;
75 static gint ett_quakeworld_game_svc = -1;
77 static dissector_handle_t data_handle;
80 helper functions, they may ave to go somewhere else
81 they are mostly copied without change from
82 quakeworldsource/client/cmd.c
83 quakeworldsource/client/common.c
86 #define MAX_TEXT_SIZE 2048
88 static char com_token[MAX_TEXT_SIZE+1];
89 static int com_token_start;
90 static int com_token_length;
93 COM_Parse (char *data)
101 com_token_length = 0;
106 /* skip whitespace */
108 while ( (c = *data) <= ' ') {
110 return NULL; /* end of file; */
115 /* skip // comments */
116 if (c=='/' && data[1] == '/') {
117 while (*data && *data != '\n')
123 /* handle quoted strings specially */
129 if (c=='\"' || c==0) {
139 /* parse a regular word */
154 static int cmd_argc = 0;
155 static char *cmd_argv[MAX_ARGS];
156 static const char *cmd_null_string = "";
157 static int cmd_argv_start[MAX_ARGS];
158 static int cmd_argv_length[MAX_ARGS];
172 if ( arg >= cmd_argc )
173 return cmd_null_string;
174 return cmd_argv[arg];
179 Cmd_Argv_start(int arg)
181 if ( arg >= cmd_argc )
183 return cmd_argv_start[arg];
188 Cmd_Argv_length(int arg)
190 if ( arg >= cmd_argc )
192 return cmd_argv_length[arg];
197 Cmd_TokenizeString(char* text)
204 /* clear the args from the last string */
205 for (i=0 ; i<cmd_argc ; i++)
213 /* skip whitespace up to a \n */
214 while (*text && *text <= ' ' && *text != '\n') {
222 /* a newline seperates commands in the buffer */
230 text = COM_Parse (text);
234 if (cmd_argc < MAX_ARGS) {
235 cmd_argv[cmd_argc] = g_strdup(com_token);
236 cmd_argv_start[cmd_argc] = start + com_token_start;
237 cmd_argv_length[cmd_argc] = com_token_length;
241 start += com_token_start + com_token_length;
247 dissect_id_infostring(tvbuff_t *tvb, proto_tree* tree,
248 int offset, char* infostring,
249 gint ett_key_value, int hf_key_value, int hf_key, int hf_value)
251 char * newpos = infostring;
252 int end_of_info = FALSE;
254 /* to look at all the key/value pairs, we destroy infostring */
255 while(!end_of_info) {
264 if (*keypos == 0) break;
265 if (*keypos == '\\') keypos++;
269 *(keypos + keylength) != '\\' &&
270 *(keypos + keylength) != 0
273 keyvaluesep = keypos + keylength;
274 if (*keyvaluesep == 0) break;
275 valuepos = keyvaluesep+1;
278 *(valuepos + valuelength) != '\\' &&
279 *(valuepos + valuelength) != 0
282 valueend = valuepos + valuelength;
283 if (*valueend == 0) {
286 *(keyvaluesep) = '=';
290 proto_item* sub_item = NULL;
291 proto_tree* sub_tree = NULL;
293 sub_item = proto_tree_add_string(tree,
296 offset + (gint)(keypos-infostring),
297 keylength + 1 + valuelength, keypos);
300 proto_item_add_subtree(
305 proto_tree_add_string(sub_tree,
308 offset + (gint)(keypos-infostring),
310 proto_tree_add_string(sub_tree,
313 offset + (gint)(valuepos-infostring),
314 valuelength, valuepos);
317 newpos = valueend + 1;
322 static const value_string names_direction[] = {
324 { DIR_C2S, "Client to Server" },
326 { DIR_S2C, "Server to Client" },
331 /* I took this name and value directly out of the QW source. */
332 #define PORT_MASTER 27500
333 static guint gbl_quakeworldServerPort=PORT_MASTER;
336 /* out of band message id bytes (taken out of quakeworldsource/client/protocol.h */
338 /* M = master, S = server, C = client, A = any */
339 /* the second character will allways be \n if the message isn't a single */
340 /* byte long (?? not true anymore?) */
342 #define S2C_CHALLENGE 'c'
343 #define S2C_CONNECTION 'j'
344 #define A2A_PING 'k' /* respond with an A2A_ACK */
345 #define A2A_ACK 'l' /* general acknowledgement without info */
346 #define A2A_NACK 'm' /* [+ comment] general failure */
347 #define A2A_ECHO 'e' /* for echoing */
348 #define A2C_PRINT 'n' /* print a message on client */
350 #define S2M_HEARTBEAT 'a' /* + serverinfo + userlist + fraglist */
351 #define A2C_CLIENT_COMMAND 'B' /* + command line */
352 #define S2M_SHUTDOWN 'C'
356 dissect_quakeworld_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo,
357 proto_tree *tree, int direction)
359 proto_tree *cl_tree = NULL;
360 proto_item *cl_item = NULL;
361 proto_item *text_item = NULL;
362 proto_tree *text_tree = NULL;
363 guint8 text[MAX_TEXT_SIZE+1];
369 int command_finished = FALSE;
372 marker = tvb_get_ntohl(tvb, 0);
374 cl_item = proto_tree_add_text(tree, tvb,
375 0, -1, "Connectionless");
377 cl_tree = proto_item_add_subtree(
378 cl_item, ett_quakeworld_connectionless);
382 proto_tree_add_uint(cl_tree, hf_quakeworld_connectionless_marker,
386 /* all the rest of the packet is just text */
389 len = tvb_get_nstringz0(tvb, offset, sizeof(text), text);
390 /* actually, we should look for a eol char and stop already there */
393 text_item = proto_tree_add_string(cl_tree, hf_quakeworld_connectionless_text,
394 tvb, offset, len + 1, text);
396 text_tree = proto_item_add_subtree(
397 text_item, ett_quakeworld_connectionless_text);
401 if (direction == DIR_C2S) {
402 /* client to server commands */
405 Cmd_TokenizeString(text);
408 /* client to sever commands */
409 if (strcmp(c,"ping") == 0) {
412 } else if (strcmp(c,"status") == 0) {
415 } else if (strcmp(c,"log") == 0) {
418 } else if (strcmp(c,"connect") == 0) {
422 const char *infostring;
423 proto_item *argument_item = NULL;
424 proto_tree *argument_tree = NULL;
425 proto_item *info_item = NULL;
426 proto_tree *info_tree = NULL;
428 command_len = Cmd_Argv_length(0);
430 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
431 tvb, offset, command_len, command);
432 argument_item = proto_tree_add_string(text_tree,
433 hf_quakeworld_connectionless_arguments,
434 tvb, offset + Cmd_Argv_start(1), len + 1 - Cmd_Argv_start(1),
435 text + Cmd_Argv_start(1));
438 proto_item_add_subtree(argument_item,
439 ett_quakeworld_connectionless_arguments);
441 command_finished=TRUE;
443 version = atoi(Cmd_Argv(1));
444 qport = atoi(Cmd_Argv(2));
445 challenge = atoi(Cmd_Argv(3));
446 infostring = Cmd_Argv(4);
448 proto_tree_add_uint(argument_tree,
449 hf_quakeworld_connectionless_connect_version,
451 offset + Cmd_Argv_start(1),
452 Cmd_Argv_length(1), version);
453 proto_tree_add_uint(argument_tree,
454 hf_quakeworld_connectionless_connect_qport,
456 offset + Cmd_Argv_start(2),
457 Cmd_Argv_length(2), qport);
458 proto_tree_add_int(argument_tree,
459 hf_quakeworld_connectionless_connect_challenge,
461 offset + Cmd_Argv_start(3),
462 Cmd_Argv_length(3), challenge);
463 info_item = proto_tree_add_string(argument_tree,
464 hf_quakeworld_connectionless_connect_infostring,
466 offset + Cmd_Argv_start(4),
467 Cmd_Argv_length(4), infostring);
469 info_tree = proto_item_add_subtree(
470 info_item, ett_quakeworld_connectionless_connect_infostring);
471 dissect_id_infostring(tvb, info_tree, offset + Cmd_Argv_start(4),
472 ep_strdup(infostring),
473 ett_quakeworld_connectionless_connect_infostring_key_value,
474 hf_quakeworld_connectionless_connect_infostring_key_value,
475 hf_quakeworld_connectionless_connect_infostring_key,
476 hf_quakeworld_connectionless_connect_infostring_value);
478 } else if (strcmp(c,"getchallenge") == 0) {
479 command="Get Challenge";
480 command_len = Cmd_Argv_length(0);
481 } else if (strcmp(c,"rcon") == 0) {
482 const char* password;
484 char remaining[MAX_TEXT_SIZE+1];
485 proto_item *argument_item = NULL;
486 proto_tree *argument_tree = NULL;
487 command="Remote Command";
488 command_len = Cmd_Argv_length(0);
490 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
491 tvb, offset, command_len, command);
492 argument_item = proto_tree_add_string(text_tree,
493 hf_quakeworld_connectionless_arguments,
494 tvb, offset + Cmd_Argv_start(1), len + 1 - Cmd_Argv_start(1),
495 text + Cmd_Argv_start(1));
498 proto_item_add_subtree(argument_item,
499 ett_quakeworld_connectionless_arguments);
501 command_finished=TRUE;
503 password = Cmd_Argv(1);
505 proto_tree_add_string(argument_tree,
506 hf_quakeworld_connectionless_rcon_password,
508 offset + Cmd_Argv_start(1),
509 Cmd_Argv_length(1), password);
512 for (i=2; i<Cmd_Argc() ; i++) {
513 g_strlcat (remaining, Cmd_Argv(i), MAX_TEXT_SIZE+1);
514 g_strlcat (remaining, " ", MAX_TEXT_SIZE+1);
517 proto_tree_add_string(argument_tree,
518 hf_quakeworld_connectionless_rcon_command,
519 tvb, offset + Cmd_Argv_start(2),
520 Cmd_Argv_start(Cmd_Argc()-1) + Cmd_Argv_length(Cmd_Argc()-1) -
524 } else if (c[0]==A2A_PING && ( c[1]==0 || c[1]=='\n')) {
527 } else if (c[0]==A2A_ACK && ( c[1]==0 || c[1]=='\n')) {
536 /* server to client commands */
537 if (text[0] == S2C_CONNECTION) {
540 } else if (text[0] == A2C_CLIENT_COMMAND) {
541 command="Client Command";
543 /* stringz (command), stringz (localid) */
544 } else if (text[0] == A2C_PRINT) {
548 } else if (text[0] == A2A_PING) {
551 } else if (text[0] == S2C_CHALLENGE) {
561 if (check_col(pinfo->cinfo, COL_INFO)) {
562 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", command);
565 if (text_tree && !command_finished) {
566 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
567 tvb, offset, command_len, command);
574 dissect_quakeworld_client_commands(tvbuff_t *tvb, packet_info *pinfo,
577 /* If I have too much time at hand, I'll fill it with all
578 the information from my QWD specs:
579 http://www.planetquake.com/demospecs/qwd/
581 call_dissector(data_handle,tvb, pinfo, tree);
586 dissect_quakeworld_server_commands(tvbuff_t *tvb, packet_info *pinfo,
589 /* If I have too much time at hand, I'll fill it with all
590 the information from my QWD specs:
591 http://www.planetquake.com/demospecs/qwd/
593 call_dissector(data_handle,tvb, pinfo, tree);
597 static const value_string names_reliable[] = {
598 { 0, "Non Reliable" },
605 dissect_quakeworld_GamePacket(tvbuff_t *tvb, packet_info *pinfo,
606 proto_tree *tree, int direction)
608 proto_tree *game_tree = NULL;
609 proto_item *game_item = NULL;
617 direction = (pinfo->destport == gbl_quakeworldServerPort) ?
621 game_item = proto_tree_add_text(tree, tvb,
624 game_tree = proto_item_add_subtree(
625 game_item, ett_quakeworld_game);
630 seq1 = tvb_get_letohl(tvb, offset);
631 rel1 = seq1 & 0x80000000 ? 1 : 0;
634 proto_item *seq1_item = proto_tree_add_text(game_tree,
635 tvb, offset, 4, "Current Sequence: %u (%s)",
636 seq1, val_to_str(rel1,names_reliable,"%u"));
638 proto_tree *seq1_tree = proto_item_add_subtree(
639 seq1_item, ett_quakeworld_game_seq1);
640 proto_tree_add_uint(seq1_tree, hf_quakeworld_game_seq1,
641 tvb, offset, 4, seq1);
642 proto_tree_add_boolean(seq1_tree, hf_quakeworld_game_rel1,
643 tvb, offset+3, 1, rel1);
648 seq2 = tvb_get_letohl(tvb, offset);
649 rel2 = seq2 & 0x80000000 ? 1 : 0;
652 proto_item *seq2_item = proto_tree_add_text(game_tree,
653 tvb, offset, 4, "Acknowledge Sequence: %u (%s)",
654 seq2, val_to_str(rel2,names_reliable,"%u"));
656 proto_tree *seq2_tree = proto_item_add_subtree(
657 seq2_item, ett_quakeworld_game_seq2);
658 proto_tree_add_uint(seq2_tree, hf_quakeworld_game_seq2,
659 tvb, offset, 4, seq2);
660 proto_tree_add_boolean(seq2_tree, hf_quakeworld_game_rel2,
661 tvb, offset+3, 1, rel2);
666 if (direction == DIR_C2S) {
667 /* client to server */
668 guint16 qport = tvb_get_letohs(tvb, offset);
670 proto_tree_add_uint(game_tree, hf_quakeworld_game_qport,
671 tvb, offset, 2, qport);
676 /* all the rest is pure game data */
677 rest_length = tvb_reported_length(tvb) - offset;
680 tvb_new_subset(tvb, offset, rest_length , rest_length);
682 if (direction == DIR_C2S) {
683 proto_item *c_item = NULL;
684 proto_tree *c_tree = NULL;
686 c_item = proto_tree_add_text(game_tree, next_tvb,
687 0, -1, "Client Commands");
689 c_tree = proto_item_add_subtree(
690 c_item, ett_quakeworld_game_clc);
693 dissect_quakeworld_client_commands(next_tvb, pinfo, c_tree);
696 proto_item *c_item = NULL;
697 proto_tree *c_tree = NULL;
699 c_item = proto_tree_add_text(game_tree, next_tvb,
700 0, -1, "Server Commands");
702 c_tree = proto_item_add_subtree(
703 c_item, ett_quakeworld_game_svc);
706 dissect_quakeworld_server_commands(next_tvb, pinfo, c_tree);
713 dissect_quakeworld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
715 proto_tree *quakeworld_tree = NULL;
716 proto_item *quakeworld_item = NULL;
719 direction = (pinfo->destport == gbl_quakeworldServerPort) ?
722 col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKEWORLD");
723 if (check_col(pinfo->cinfo, COL_INFO))
724 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(direction,
725 names_direction, "%u"));
728 quakeworld_item = proto_tree_add_item(tree, proto_quakeworld,
731 quakeworld_tree = proto_item_add_subtree(
732 quakeworld_item, ett_quakeworld);
733 if (quakeworld_tree) {
734 proto_tree_add_uint_format(quakeworld_tree,
735 direction == DIR_S2C ?
739 "Direction: %s", val_to_str(direction, names_direction, "%u"));
743 if (tvb_get_ntohl(tvb, 0) == 0xffffffff) {
744 if (check_col(pinfo->cinfo, COL_INFO)) {
745 col_append_str(pinfo->cinfo, COL_INFO, " Connectionless");
748 proto_tree_add_uint_format(quakeworld_tree,
749 hf_quakeworld_connectionless,
751 "Type: Connectionless");
752 dissect_quakeworld_ConnectionlessPacket(
753 tvb, pinfo, quakeworld_tree, direction);
756 if (check_col(pinfo->cinfo, COL_INFO)) {
757 col_append_str(pinfo->cinfo, COL_INFO, " Game");
760 proto_tree_add_uint_format(quakeworld_tree,
764 dissect_quakeworld_GamePacket(
765 tvb, pinfo, quakeworld_tree, direction);
771 proto_reg_handoff_quakeworld(void)
773 static gboolean Initialized=FALSE;
774 static dissector_handle_t quakeworld_handle;
775 static guint ServerPort;
778 quakeworld_handle = create_dissector_handle(dissect_quakeworld,
780 data_handle = find_dissector("data");
783 dissector_delete("udp.port", ServerPort, quakeworld_handle);
786 /* set port for future deletes */
787 ServerPort=gbl_quakeworldServerPort;
789 dissector_add("udp.port", gbl_quakeworldServerPort, quakeworld_handle);
794 proto_register_quakeworld(void)
796 static hf_register_info hf[] = {
797 { &hf_quakeworld_c2s,
798 { "Client to Server", "quakeworld.c2s",
799 FT_UINT32, BASE_DEC, NULL, 0x0,
801 { &hf_quakeworld_s2c,
802 { "Server to Client", "quakeworld.s2c",
803 FT_UINT32, BASE_DEC, NULL, 0x0,
805 { &hf_quakeworld_connectionless,
806 { "Connectionless", "quakeworld.connectionless",
807 FT_UINT32, BASE_DEC, NULL, 0x0,
809 { &hf_quakeworld_game,
810 { "Game", "quakeworld.game",
811 FT_UINT32, BASE_DEC, NULL, 0x0,
813 { &hf_quakeworld_connectionless_marker,
814 { "Marker", "quakeworld.connectionless.marker",
815 FT_UINT32, BASE_HEX, NULL, 0x0,
817 { &hf_quakeworld_connectionless_text,
818 { "Text", "quakeworld.connectionless.text",
819 FT_STRING, BASE_NONE, NULL, 0x0,
821 { &hf_quakeworld_connectionless_command,
822 { "Command", "quakeworld.connectionless.command",
823 FT_STRING, BASE_NONE, NULL, 0x0,
825 { &hf_quakeworld_connectionless_arguments,
826 { "Arguments", "quakeworld.connectionless.arguments",
827 FT_STRING, BASE_NONE, NULL, 0x0,
829 { &hf_quakeworld_connectionless_connect_version,
830 { "Version", "quakeworld.connectionless.connect.version",
831 FT_UINT32, BASE_DEC, NULL, 0x0,
832 "Protocol Version", HFILL }},
833 { &hf_quakeworld_connectionless_connect_qport,
834 { "QPort", "quakeworld.connectionless.connect.qport",
835 FT_UINT32, BASE_DEC, NULL, 0x0,
836 "QPort of the client", HFILL }},
837 { &hf_quakeworld_connectionless_connect_challenge,
838 { "Challenge", "quakeworld.connectionless.connect.challenge",
839 FT_INT32, BASE_DEC, NULL, 0x0,
840 "Challenge from the server", HFILL }},
841 { &hf_quakeworld_connectionless_connect_infostring,
842 { "Infostring", "quakeworld.connectionless.connect.infostring",
843 FT_STRING, BASE_NONE, NULL, 0x0,
844 "Infostring with additional variables", HFILL }},
845 { &hf_quakeworld_connectionless_connect_infostring_key_value,
846 { "Key/Value", "quakeworld.connectionless.connect.infostring.key_value",
847 FT_STRING, BASE_NONE, NULL, 0x0,
848 "Key and Value", HFILL }},
849 { &hf_quakeworld_connectionless_connect_infostring_key,
850 { "Key", "quakeworld.connectionless.connect.infostring.key",
851 FT_STRING, BASE_NONE, NULL, 0x0,
852 "Infostring Key", HFILL }},
853 { &hf_quakeworld_connectionless_connect_infostring_value,
854 { "Value", "quakeworld.connectionless.connect.infostring.value",
855 FT_STRING, BASE_NONE, NULL, 0x0,
856 "Infostring Value", HFILL }},
857 { &hf_quakeworld_connectionless_rcon_password,
858 { "Password", "quakeworld.connectionless.rcon.password",
859 FT_STRING, BASE_NONE, NULL, 0x0,
860 "Rcon Password", HFILL }},
861 { &hf_quakeworld_connectionless_rcon_command,
862 { "Command", "quakeworld.connectionless.rcon.command",
863 FT_STRING, BASE_NONE, NULL, 0x0,
865 { &hf_quakeworld_game_seq1,
866 { "Sequence Number", "quakeworld.game.seq1",
867 FT_UINT32, BASE_DEC, NULL, 0x0,
868 "Sequence number of the current packet", HFILL }},
869 { &hf_quakeworld_game_rel1,
870 { "Reliable", "quakeworld.game.rel1",
871 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
872 "Packet is reliable and may be retransmitted", HFILL }},
873 { &hf_quakeworld_game_seq2,
874 { "Sequence Number", "quakeworld.game.seq2",
875 FT_UINT32, BASE_DEC, NULL, 0x0,
876 "Sequence number of the last received packet", HFILL }},
877 { &hf_quakeworld_game_rel2,
878 { "Reliable", "quakeworld.game.rel2",
879 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
880 "Packet was reliable and may be retransmitted", HFILL }},
881 { &hf_quakeworld_game_qport,
882 { "QPort", "quakeworld.game.qport",
883 FT_UINT32, BASE_DEC, NULL, 0x0,
884 "QuakeWorld Client Port", HFILL }}
886 static gint *ett[] = {
888 &ett_quakeworld_connectionless,
889 &ett_quakeworld_connectionless_text,
890 &ett_quakeworld_connectionless_arguments,
891 &ett_quakeworld_connectionless_connect_infostring,
892 &ett_quakeworld_connectionless_connect_infostring_key_value,
893 &ett_quakeworld_game,
894 &ett_quakeworld_game_seq1,
895 &ett_quakeworld_game_seq2,
896 &ett_quakeworld_game_clc,
897 &ett_quakeworld_game_svc
899 module_t *quakeworld_module;
901 proto_quakeworld = proto_register_protocol("QuakeWorld Network Protocol",
902 "QUAKEWORLD", "quakeworld");
903 proto_register_field_array(proto_quakeworld, hf, array_length(hf));
904 proto_register_subtree_array(ett, array_length(ett));
906 /* Register a configuration option for port */
907 quakeworld_module = prefs_register_protocol(proto_quakeworld,
908 proto_reg_handoff_quakeworld);
909 prefs_register_uint_preference(quakeworld_module, "udp.port",
910 "QuakeWorld Server UDP Port",
911 "Set the UDP port for the QuakeWorld Server",
912 10, &gbl_quakeworldServerPort);