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.
38 #include <epan/packet.h>
39 #include <epan/prefs.h>
40 #include <epan/strutil.h>
42 static int proto_quakeworld = -1;
44 static int hf_quakeworld_s2c = -1;
45 static int hf_quakeworld_c2s = -1;
46 static int hf_quakeworld_connectionless = -1;
47 static int hf_quakeworld_game = -1;
48 static int hf_quakeworld_connectionless_marker = -1;
49 static int hf_quakeworld_connectionless_text = -1;
50 static int hf_quakeworld_connectionless_command = -1;
51 static int hf_quakeworld_connectionless_arguments = -1;
52 static int hf_quakeworld_connectionless_connect_version = -1;
53 static int hf_quakeworld_connectionless_connect_qport = -1;
54 static int hf_quakeworld_connectionless_connect_challenge = -1;
55 static int hf_quakeworld_connectionless_connect_infostring = -1;
56 static int hf_quakeworld_connectionless_connect_infostring_key_value = -1;
57 static int hf_quakeworld_connectionless_connect_infostring_key = -1;
58 static int hf_quakeworld_connectionless_connect_infostring_value = -1;
59 static int hf_quakeworld_connectionless_rcon_password = -1;
60 static int hf_quakeworld_connectionless_rcon_command = -1;
61 static int hf_quakeworld_game_seq1 = -1;
62 static int hf_quakeworld_game_rel1 = -1;
63 static int hf_quakeworld_game_seq2 = -1;
64 static int hf_quakeworld_game_rel2 = -1;
65 static int hf_quakeworld_game_qport = -1;
67 static gint ett_quakeworld = -1;
68 static gint ett_quakeworld_connectionless = -1;
69 static gint ett_quakeworld_connectionless_text = -1;
70 static gint ett_quakeworld_connectionless_arguments = -1;
71 static gint ett_quakeworld_connectionless_connect_infostring = -1;
72 static gint ett_quakeworld_connectionless_connect_infostring_key_value = -1;
73 static gint ett_quakeworld_game = -1;
74 static gint ett_quakeworld_game_seq1 = -1;
75 static gint ett_quakeworld_game_seq2 = -1;
76 static gint ett_quakeworld_game_clc = -1;
77 static gint ett_quakeworld_game_svc = -1;
79 static dissector_handle_t data_handle;
82 helper functions, they may ave to go somewhere else
83 they are mostly copied without change from
84 quakeworldsource/client/cmd.c
85 quakeworldsource/client/common.c
88 #define MAX_TEXT_SIZE 2048
90 static char com_token[MAX_TEXT_SIZE+1];
91 static int com_token_start;
92 static int com_token_length;
95 COM_Parse (char *data)
103 com_token_length = 0;
108 /* skip whitespace */
113 return NULL; /* end of file; */
114 if ((c != ' ') && (!g_ascii_iscntrl(c)))
120 /* skip // comments */
121 if ((c=='/') && (data[1]=='/')) {
122 while (*data && *data != '\n')
128 /* handle quoted strings specially */
134 if ((c=='\"') || (c=='\0')) {
135 com_token[len] = '\0';
144 /* parse a regular word */
151 } while (( c != ' ') && (!g_ascii_iscntrl(c)));
153 com_token[len] = '\0';
159 static int cmd_argc = 0;
160 static char *cmd_argv[MAX_ARGS];
161 static const char *cmd_null_string = "";
162 static int cmd_argv_start[MAX_ARGS];
163 static int cmd_argv_length[MAX_ARGS];
177 if ( arg >= cmd_argc )
178 return cmd_null_string;
179 return cmd_argv[arg];
184 Cmd_Argv_start(int arg)
186 if ( arg >= cmd_argc )
188 return cmd_argv_start[arg];
193 Cmd_Argv_length(int arg)
195 if ( arg >= cmd_argc )
197 return cmd_argv_length[arg];
202 Cmd_TokenizeString(char* text)
209 /* clear the args from the last string */
210 for (i=0 ; i<cmd_argc ; i++)
218 /* skip whitespace up to a \n */
219 while (*text && *text <= ' ' && *text != '\n') {
227 /* a newline seperates commands in the buffer */
235 text = COM_Parse (text);
239 if (cmd_argc < MAX_ARGS) {
240 cmd_argv[cmd_argc] = g_strdup(com_token);
241 cmd_argv_start[cmd_argc] = start + com_token_start;
242 cmd_argv_length[cmd_argc] = com_token_length;
246 start += com_token_start + com_token_length;
252 dissect_id_infostring(tvbuff_t *tvb, proto_tree* tree,
253 int offset, char* infostring,
254 gint ett_key_value, int hf_key_value, int hf_key, int hf_value)
256 char *newpos = infostring;
257 gboolean end_of_info = FALSE;
259 /* to look at all the key/value pairs, we destroy infostring */
260 while(!end_of_info) {
269 if (*keypos == '\0') break;
270 if (*keypos == '\\') keypos++;
274 *(keypos + keylength) != '\\' &&
275 *(keypos + keylength) != '\0'
278 keyvaluesep = keypos + keylength;
279 if (*keyvaluesep == '\0') break;
280 valuepos = keyvaluesep+1;
283 *(valuepos + valuelength) != '\\' &&
284 *(valuepos + valuelength) != '\0'
287 valueend = valuepos + valuelength;
288 if (*valueend == '\0') {
291 *(keyvaluesep) = '=';
295 proto_item* sub_item;
296 proto_tree* sub_tree;
298 sub_item = proto_tree_add_string(tree,
301 offset + (gint)(keypos-infostring),
302 keylength + 1 + valuelength, keypos);
303 sub_tree = proto_item_add_subtree(
306 *(keyvaluesep) = '\0';
307 proto_tree_add_string(sub_tree,
310 offset + (gint)(keypos-infostring),
312 proto_tree_add_string(sub_tree,
315 offset + (gint)(valuepos-infostring),
316 valuelength, valuepos);
318 newpos = valueend + 1;
323 static const value_string names_direction[] = {
325 { DIR_C2S, "Client to Server" },
327 { DIR_S2C, "Server to Client" },
332 /* I took this name and value directly out of the QW source. */
333 #define PORT_MASTER 27500
334 static guint gbl_quakeworldServerPort=PORT_MASTER;
337 /* out of band message id bytes (taken out of quakeworldsource/client/protocol.h */
339 /* M = master, S = server, C = client, A = any */
340 /* the second character will allways be \n if the message isn't a single */
341 /* byte long (?? not true anymore?) */
343 #define S2C_CHALLENGE 'c'
344 #define S2C_CONNECTION 'j'
345 #define A2A_PING 'k' /* respond with an A2A_ACK */
346 #define A2A_ACK 'l' /* general acknowledgement without info */
347 #define A2A_NACK 'm' /* [+ comment] general failure */
348 #define A2A_ECHO 'e' /* for echoing */
349 #define A2C_PRINT 'n' /* print a message on client */
351 #define S2M_HEARTBEAT 'a' /* + serverinfo + userlist + fraglist */
352 #define A2C_CLIENT_COMMAND 'B' /* + command line */
353 #define S2M_SHUTDOWN 'C'
357 dissect_quakeworld_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo,
358 proto_tree *tree, int direction)
360 proto_tree *cl_tree = NULL;
361 proto_tree *text_tree = NULL;
362 guint8 text[MAX_TEXT_SIZE+1];
367 const char *command = "";
368 gboolean command_finished = FALSE;
370 marker = tvb_get_ntohl(tvb, 0);
373 cl_item = proto_tree_add_text(tree, tvb, 0, -1, "Connectionless");
374 cl_tree = proto_item_add_subtree(cl_item, ett_quakeworld_connectionless);
376 proto_tree_add_uint(cl_tree, hf_quakeworld_connectionless_marker,
380 /* all the rest of the packet is just text */
383 len = tvb_get_nstringz0(tvb, offset, sizeof(text), text);
384 /* actually, we should look for a eol char and stop already there */
387 proto_item *text_item;
388 text_item = proto_tree_add_string(cl_tree, hf_quakeworld_connectionless_text,
389 tvb, offset, len + 1, text);
390 text_tree = proto_item_add_subtree(text_item, ett_quakeworld_connectionless_text);
393 if (direction == DIR_C2S) {
394 /* client to server commands */
397 Cmd_TokenizeString(text);
400 /* client to sever commands */
401 if (strcmp(c,"ping") == 0) {
404 } else if (strcmp(c,"status") == 0) {
407 } else if (strcmp(c,"log") == 0) {
410 } else if (strcmp(c,"connect") == 0) {
414 const char *infostring;
415 proto_tree *argument_tree = NULL;
417 command_len = Cmd_Argv_length(0);
419 proto_item *argument_item;
420 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
421 tvb, offset, command_len, command);
422 argument_item = proto_tree_add_string(text_tree,
423 hf_quakeworld_connectionless_arguments,
424 tvb, offset + Cmd_Argv_start(1), len + 1 - Cmd_Argv_start(1),
425 text + Cmd_Argv_start(1));
426 argument_tree = proto_item_add_subtree(argument_item,
427 ett_quakeworld_connectionless_arguments);
428 command_finished=TRUE;
430 version = atoi(Cmd_Argv(1));
431 qport = atoi(Cmd_Argv(2));
432 challenge = atoi(Cmd_Argv(3));
433 infostring = Cmd_Argv(4);
435 proto_item *info_item;
436 proto_tree *info_tree;
437 proto_tree_add_uint(argument_tree,
438 hf_quakeworld_connectionless_connect_version,
440 offset + Cmd_Argv_start(1),
441 Cmd_Argv_length(1), version);
442 proto_tree_add_uint(argument_tree,
443 hf_quakeworld_connectionless_connect_qport,
445 offset + Cmd_Argv_start(2),
446 Cmd_Argv_length(2), qport);
447 proto_tree_add_int(argument_tree,
448 hf_quakeworld_connectionless_connect_challenge,
450 offset + Cmd_Argv_start(3),
451 Cmd_Argv_length(3), challenge);
452 info_item = proto_tree_add_string(argument_tree,
453 hf_quakeworld_connectionless_connect_infostring,
455 offset + Cmd_Argv_start(4),
456 Cmd_Argv_length(4), infostring);
457 info_tree = proto_item_add_subtree(
458 info_item, ett_quakeworld_connectionless_connect_infostring);
459 dissect_id_infostring(tvb, info_tree, offset + Cmd_Argv_start(4),
460 ep_strdup(infostring),
461 ett_quakeworld_connectionless_connect_infostring_key_value,
462 hf_quakeworld_connectionless_connect_infostring_key_value,
463 hf_quakeworld_connectionless_connect_infostring_key,
464 hf_quakeworld_connectionless_connect_infostring_value);
466 } else if (strcmp(c,"getchallenge") == 0) {
467 command = "Get Challenge";
468 command_len = Cmd_Argv_length(0);
469 } else if (strcmp(c,"rcon") == 0) {
470 const char* password;
472 char remaining[MAX_TEXT_SIZE+1];
473 proto_tree *argument_tree = NULL;
474 command = "Remote Command";
475 command_len = Cmd_Argv_length(0);
477 proto_item *argument_item;
478 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
479 tvb, offset, command_len, command);
480 argument_item = proto_tree_add_string(text_tree,
481 hf_quakeworld_connectionless_arguments,
482 tvb, offset + Cmd_Argv_start(1), len + 1 - Cmd_Argv_start(1),
483 text + Cmd_Argv_start(1));
484 argument_tree = proto_item_add_subtree(argument_item,
485 ett_quakeworld_connectionless_arguments);
486 command_finished=TRUE;
488 password = Cmd_Argv(1);
490 proto_tree_add_string(argument_tree,
491 hf_quakeworld_connectionless_rcon_password,
493 offset + Cmd_Argv_start(1),
494 Cmd_Argv_length(1), password);
497 for (i=2; i<Cmd_Argc() ; i++) {
498 g_strlcat (remaining, Cmd_Argv(i), MAX_TEXT_SIZE+1);
499 g_strlcat (remaining, " ", MAX_TEXT_SIZE+1);
502 proto_tree_add_string(argument_tree,
503 hf_quakeworld_connectionless_rcon_command,
504 tvb, offset + Cmd_Argv_start(2),
505 Cmd_Argv_start(Cmd_Argc()-1) + Cmd_Argv_length(Cmd_Argc()-1) -
509 } else if (c[0]==A2A_PING && ( c[1]=='\0' || c[1]=='\n')) {
512 } else if (c[0]==A2A_ACK && ( c[1]=='\0' || c[1]=='\n')) {
521 /* server to client commands */
522 if (text[0] == S2C_CONNECTION) {
523 command = "Connected";
525 } else if (text[0] == A2C_CLIENT_COMMAND) {
526 command = "Client Command";
528 /* stringz (command), stringz (localid) */
529 } else if (text[0] == A2C_PRINT) {
533 } else if (text[0] == A2A_PING) {
536 } else if (text[0] == S2C_CHALLENGE) {
537 command = "Challenge";
546 if (check_col(pinfo->cinfo, COL_INFO)) {
547 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", command);
550 if (text_tree && !command_finished) {
551 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
552 tvb, offset, command_len, command);
559 dissect_quakeworld_client_commands(tvbuff_t *tvb, packet_info *pinfo,
562 /* If I have too much time at hand, I'll fill it with all
563 the information from my QWD specs:
564 http://www.planetquake.com/demospecs/qwd/
566 call_dissector(data_handle,tvb, pinfo, tree);
571 dissect_quakeworld_server_commands(tvbuff_t *tvb, packet_info *pinfo,
574 /* If I have too much time at hand, I'll fill it with all
575 the information from my QWD specs:
576 http://www.planetquake.com/demospecs/qwd/
578 call_dissector(data_handle,tvb, pinfo, tree);
582 static const value_string names_reliable[] = {
583 { 0, "Non Reliable" },
590 dissect_quakeworld_GamePacket(tvbuff_t *tvb, packet_info *pinfo,
591 proto_tree *tree, int direction)
593 proto_tree *game_tree = NULL;
601 direction = (pinfo->destport == gbl_quakeworldServerPort) ?
605 proto_item *game_item;
606 game_item = proto_tree_add_text(tree, tvb, 0, -1, "Game");
607 game_tree = proto_item_add_subtree(game_item, ett_quakeworld_game);
612 seq1 = tvb_get_letohl(tvb, offset);
613 rel1 = seq1 & 0x80000000 ? 1 : 0;
616 proto_item *seq1_item = proto_tree_add_text(game_tree,
617 tvb, offset, 4, "Current Sequence: %u (%s)",
618 seq1, val_to_str(rel1,names_reliable,"%u"));
619 proto_tree *seq1_tree = proto_item_add_subtree(
620 seq1_item, ett_quakeworld_game_seq1);
621 proto_tree_add_uint(seq1_tree, hf_quakeworld_game_seq1,
622 tvb, offset, 4, seq1);
623 proto_tree_add_boolean(seq1_tree, hf_quakeworld_game_rel1,
624 tvb, offset+3, 1, rel1);
628 seq2 = tvb_get_letohl(tvb, offset);
629 rel2 = seq2 & 0x80000000 ? 1 : 0;
632 proto_item *seq2_item = proto_tree_add_text(game_tree,
633 tvb, offset, 4, "Acknowledge Sequence: %u (%s)",
634 seq2, val_to_str(rel2,names_reliable,"%u"));
635 proto_tree *seq2_tree = proto_item_add_subtree(seq2_item, ett_quakeworld_game_seq2);
636 proto_tree_add_uint(seq2_tree, hf_quakeworld_game_seq2, tvb, offset, 4, seq2);
637 proto_tree_add_boolean(seq2_tree, hf_quakeworld_game_rel2, tvb, offset+3, 1, rel2);
641 if (direction == DIR_C2S) {
642 /* client to server */
643 guint16 qport = tvb_get_letohs(tvb, offset);
645 proto_tree_add_uint(game_tree, hf_quakeworld_game_qport, tvb, offset, 2, qport);
650 /* all the rest is pure game data */
651 rest_length = tvb_reported_length(tvb) - offset;
654 tvb_new_subset(tvb, offset, rest_length , rest_length);
656 if (direction == DIR_C2S) {
657 proto_tree *c_tree = NULL;
660 c_item = proto_tree_add_text(game_tree, next_tvb,
661 0, -1, "Client Commands");
662 c_tree = proto_item_add_subtree(c_item, ett_quakeworld_game_clc);
664 dissect_quakeworld_client_commands(next_tvb, pinfo, c_tree);
667 proto_tree *c_tree = NULL;
670 c_item = proto_tree_add_text(game_tree, next_tvb,
671 0, -1, "Server Commands");
672 c_tree = proto_item_add_subtree(c_item, ett_quakeworld_game_svc);
674 dissect_quakeworld_server_commands(next_tvb, pinfo, c_tree);
681 dissect_quakeworld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
683 proto_tree *quakeworld_tree = NULL;
686 direction = (pinfo->destport == gbl_quakeworldServerPort) ?
689 col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKEWORLD");
690 if (check_col(pinfo->cinfo, COL_INFO))
691 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(direction,
692 names_direction, "%u"));
695 proto_item *quakeworld_item;
696 quakeworld_item = proto_tree_add_item(tree, proto_quakeworld,
698 quakeworld_tree = proto_item_add_subtree(quakeworld_item, ett_quakeworld);
699 proto_tree_add_uint_format(quakeworld_tree,
700 direction == DIR_S2C ?
704 "Direction: %s", val_to_str(direction, names_direction, "%u"));
707 if (tvb_get_ntohl(tvb, 0) == 0xffffffff) {
708 col_append_str(pinfo->cinfo, COL_INFO, " Connectionless");
710 proto_tree_add_uint_format(quakeworld_tree,
711 hf_quakeworld_connectionless,
713 "Type: Connectionless");
714 dissect_quakeworld_ConnectionlessPacket(
715 tvb, pinfo, quakeworld_tree, direction);
718 col_append_str(pinfo->cinfo, COL_INFO, " Game");
720 proto_tree_add_uint_format(quakeworld_tree,
724 dissect_quakeworld_GamePacket(
725 tvb, pinfo, quakeworld_tree, direction);
730 void proto_reg_handoff_quakeworld(void);
733 proto_register_quakeworld(void)
735 static hf_register_info hf[] = {
736 { &hf_quakeworld_c2s,
737 { "Client to Server", "quakeworld.c2s",
738 FT_UINT32, BASE_DEC, NULL, 0x0,
740 { &hf_quakeworld_s2c,
741 { "Server to Client", "quakeworld.s2c",
742 FT_UINT32, BASE_DEC, NULL, 0x0,
744 { &hf_quakeworld_connectionless,
745 { "Connectionless", "quakeworld.connectionless",
746 FT_UINT32, BASE_DEC, NULL, 0x0,
748 { &hf_quakeworld_game,
749 { "Game", "quakeworld.game",
750 FT_UINT32, BASE_DEC, NULL, 0x0,
752 { &hf_quakeworld_connectionless_marker,
753 { "Marker", "quakeworld.connectionless.marker",
754 FT_UINT32, BASE_HEX, NULL, 0x0,
756 { &hf_quakeworld_connectionless_text,
757 { "Text", "quakeworld.connectionless.text",
758 FT_STRING, BASE_NONE, NULL, 0x0,
760 { &hf_quakeworld_connectionless_command,
761 { "Command", "quakeworld.connectionless.command",
762 FT_STRING, BASE_NONE, NULL, 0x0,
764 { &hf_quakeworld_connectionless_arguments,
765 { "Arguments", "quakeworld.connectionless.arguments",
766 FT_STRING, BASE_NONE, NULL, 0x0,
768 { &hf_quakeworld_connectionless_connect_version,
769 { "Version", "quakeworld.connectionless.connect.version",
770 FT_UINT32, BASE_DEC, NULL, 0x0,
771 "Protocol Version", HFILL }},
772 { &hf_quakeworld_connectionless_connect_qport,
773 { "QPort", "quakeworld.connectionless.connect.qport",
774 FT_UINT32, BASE_DEC, NULL, 0x0,
775 "QPort of the client", HFILL }},
776 { &hf_quakeworld_connectionless_connect_challenge,
777 { "Challenge", "quakeworld.connectionless.connect.challenge",
778 FT_INT32, BASE_DEC, NULL, 0x0,
779 "Challenge from the server", HFILL }},
780 { &hf_quakeworld_connectionless_connect_infostring,
781 { "Infostring", "quakeworld.connectionless.connect.infostring",
782 FT_STRING, BASE_NONE, NULL, 0x0,
783 "Infostring with additional variables", HFILL }},
784 { &hf_quakeworld_connectionless_connect_infostring_key_value,
785 { "Key/Value", "quakeworld.connectionless.connect.infostring.key_value",
786 FT_STRING, BASE_NONE, NULL, 0x0,
787 "Key and Value", HFILL }},
788 { &hf_quakeworld_connectionless_connect_infostring_key,
789 { "Key", "quakeworld.connectionless.connect.infostring.key",
790 FT_STRING, BASE_NONE, NULL, 0x0,
791 "Infostring Key", HFILL }},
792 { &hf_quakeworld_connectionless_connect_infostring_value,
793 { "Value", "quakeworld.connectionless.connect.infostring.value",
794 FT_STRING, BASE_NONE, NULL, 0x0,
795 "Infostring Value", HFILL }},
796 { &hf_quakeworld_connectionless_rcon_password,
797 { "Password", "quakeworld.connectionless.rcon.password",
798 FT_STRING, BASE_NONE, NULL, 0x0,
799 "Rcon Password", HFILL }},
800 { &hf_quakeworld_connectionless_rcon_command,
801 { "Command", "quakeworld.connectionless.rcon.command",
802 FT_STRING, BASE_NONE, NULL, 0x0,
804 { &hf_quakeworld_game_seq1,
805 { "Sequence Number", "quakeworld.game.seq1",
806 FT_UINT32, BASE_DEC, NULL, 0x0,
807 "Sequence number of the current packet", HFILL }},
808 { &hf_quakeworld_game_rel1,
809 { "Reliable", "quakeworld.game.rel1",
810 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
811 "Packet is reliable and may be retransmitted", HFILL }},
812 { &hf_quakeworld_game_seq2,
813 { "Sequence Number", "quakeworld.game.seq2",
814 FT_UINT32, BASE_DEC, NULL, 0x0,
815 "Sequence number of the last received packet", HFILL }},
816 { &hf_quakeworld_game_rel2,
817 { "Reliable", "quakeworld.game.rel2",
818 FT_BOOLEAN, BASE_NONE, NULL, 0x0,
819 "Packet was reliable and may be retransmitted", HFILL }},
820 { &hf_quakeworld_game_qport,
821 { "QPort", "quakeworld.game.qport",
822 FT_UINT32, BASE_DEC, NULL, 0x0,
823 "QuakeWorld Client Port", HFILL }}
825 static gint *ett[] = {
827 &ett_quakeworld_connectionless,
828 &ett_quakeworld_connectionless_text,
829 &ett_quakeworld_connectionless_arguments,
830 &ett_quakeworld_connectionless_connect_infostring,
831 &ett_quakeworld_connectionless_connect_infostring_key_value,
832 &ett_quakeworld_game,
833 &ett_quakeworld_game_seq1,
834 &ett_quakeworld_game_seq2,
835 &ett_quakeworld_game_clc,
836 &ett_quakeworld_game_svc
838 module_t *quakeworld_module;
840 proto_quakeworld = proto_register_protocol("QuakeWorld Network Protocol",
841 "QUAKEWORLD", "quakeworld");
842 proto_register_field_array(proto_quakeworld, hf, array_length(hf));
843 proto_register_subtree_array(ett, array_length(ett));
845 /* Register a configuration option for port */
846 quakeworld_module = prefs_register_protocol(proto_quakeworld,
847 proto_reg_handoff_quakeworld);
848 prefs_register_uint_preference(quakeworld_module, "udp.port",
849 "QuakeWorld Server UDP Port",
850 "Set the UDP port for the QuakeWorld Server",
851 10, &gbl_quakeworldServerPort);
856 proto_reg_handoff_quakeworld(void)
858 static gboolean Initialized=FALSE;
859 static dissector_handle_t quakeworld_handle;
860 static guint ServerPort;
863 quakeworld_handle = create_dissector_handle(dissect_quakeworld,
865 data_handle = find_dissector("data");
868 dissector_delete("udp.port", ServerPort, quakeworld_handle);
871 /* set port for future deletes */
872 ServerPort=gbl_quakeworldServerPort;
874 dissector_add("udp.port", gbl_quakeworldServerPort, quakeworld_handle);