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.13 2002/04/14 23:04:04 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 static char com_token[1024];
90 static int com_token_start;
91 static int com_token_length;
94 COM_Parse (char *data)
102 com_token_length = 0;
107 /* skip whitespace */
109 while ( (c = *data) <= ' ') {
111 return NULL; /* end of file; */
116 /* skip // comments */
117 if (c=='/' && data[1] == '/') {
118 while (*data && *data != '\n')
124 /* handle quoted strings specially */
130 if (c=='\"' || c==0) {
140 /* parse a regular word */
155 static int cmd_argc = 0;
156 static char *cmd_argv[MAX_ARGS];
157 static char *cmd_null_string = "";
158 static int cmd_argv_start[MAX_ARGS];
159 static int cmd_argv_length[MAX_ARGS];
173 if ( arg >= cmd_argc )
174 return cmd_null_string;
175 return cmd_argv[arg];
180 Cmd_Argv_start(int arg)
182 if ( arg >= cmd_argc )
184 return cmd_argv_start[arg];
189 Cmd_Argv_length(int arg)
191 if ( arg >= cmd_argc )
193 return cmd_argv_length[arg];
198 Cmd_TokenizeString(char* text)
205 /* clear the args from the last string */
206 for (i=0 ; i<cmd_argc ; i++)
214 /* skip whitespace up to a \n */
215 while (*text && *text <= ' ' && *text != '\n') {
223 /* a newline seperates commands in the buffer */
231 text = COM_Parse (text);
235 if (cmd_argc < MAX_ARGS) {
236 cmd_argv[cmd_argc] = g_strdup(com_token);
237 cmd_argv_start[cmd_argc] = start + com_token_start;
238 cmd_argv_length[cmd_argc] = com_token_length;
242 start += com_token_start + com_token_length;
248 dissect_id_infostring(tvbuff_t *tvb, proto_tree* tree,
249 int offset, char* infostring,
250 gint ett_key_value, int hf_key_value, int hf_key, int hf_value)
252 char * newpos = infostring;
253 int end_of_info = FALSE;
255 /* to look at all the key/value pairs, we destroy infostring */
256 while(!end_of_info) {
265 if (*keypos == 0) break;
266 if (*keypos == '\\') keypos++;
270 *(keypos + keylength) != '\\' &&
271 *(keypos + keylength) != 0
274 keyvaluesep = keypos + keylength;
275 if (*keyvaluesep == 0) break;
276 valuepos = keyvaluesep+1;
279 *(valuepos + valuelength) != '\\' &&
280 *(valuepos + valuelength) != 0
283 valueend = valuepos + valuelength;
284 if (*valueend == 0) {
287 *(keyvaluesep) = '=';
291 proto_item* sub_item = NULL;
292 proto_tree* sub_tree = NULL;
294 sub_item = proto_tree_add_string(tree,
297 offset + (keypos-infostring),
298 keylength + 1 + valuelength, keypos);
301 proto_item_add_subtree(
306 proto_tree_add_string(sub_tree,
309 offset + (keypos-infostring),
311 proto_tree_add_string(sub_tree,
314 offset + (valuepos-infostring),
315 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 unsigned int 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_item *cl_item = NULL;
362 proto_item *text_item = NULL;
363 proto_tree *text_tree = NULL;
371 int command_finished = FALSE;
373 marker = tvb_get_ntohl(tvb, 0);
375 cl_item = proto_tree_add_text(tree, tvb,
376 0, -1, "Connectionless");
378 cl_tree = proto_item_add_subtree(
379 cl_item, ett_quakeworld_connectionless);
383 proto_tree_add_uint(cl_tree, hf_quakeworld_connectionless_marker,
387 /* all the rest of the packet is just text */
390 maxbufsize = MIN((gint)sizeof(text), tvb_length_remaining(tvb, offset));
391 len = tvb_get_nstringz0(tvb, offset, maxbufsize, text);
392 /* actually, we should look for a eol char and stop already there */
395 text_item = proto_tree_add_string(cl_tree, hf_quakeworld_connectionless_text,
396 tvb, offset, len + 1, text);
398 text_tree = proto_item_add_subtree(
399 text_item, ett_quakeworld_connectionless_text);
403 if (direction == DIR_C2S) {
404 /* client to sever commands */
407 Cmd_TokenizeString(text);
410 /* client to sever commands */
411 if (strcmp(c,"ping") == 0) {
412 strcpy(command, "Ping");
414 } else if (strcmp(c,"status") == 0) {
415 strcpy(command, "Status");
417 } else if (strcmp(c,"log") == 0) {
418 strcpy(command, "Status");
420 } else if (strcmp(c,"connect") == 0) {
425 proto_item *argument_item = NULL;
426 proto_tree *argument_tree = NULL;
427 proto_item *info_item = NULL;
428 proto_tree *info_tree = NULL;
429 strcpy(command, "Connect");
430 command_len = Cmd_Argv_length(0);
432 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
433 tvb, offset, command_len, command);
434 argument_item = proto_tree_add_string(text_tree,
435 hf_quakeworld_connectionless_arguments,
436 tvb, offset + Cmd_Argv_start(1), len + 1 - Cmd_Argv_start(1),
437 text + Cmd_Argv_start(1));
440 proto_item_add_subtree(argument_item,
441 ett_quakeworld_connectionless_arguments);
443 command_finished=TRUE;
445 version = atoi(Cmd_Argv(1));
446 qport = atoi(Cmd_Argv(2));
447 challenge = atoi(Cmd_Argv(3));
448 infostring = Cmd_Argv(4);
450 proto_tree_add_uint(argument_tree,
451 hf_quakeworld_connectionless_connect_version,
453 offset + Cmd_Argv_start(1),
454 Cmd_Argv_length(1), version);
455 proto_tree_add_uint(argument_tree,
456 hf_quakeworld_connectionless_connect_qport,
458 offset + Cmd_Argv_start(2),
459 Cmd_Argv_length(2), qport);
460 proto_tree_add_int(argument_tree,
461 hf_quakeworld_connectionless_connect_challenge,
463 offset + Cmd_Argv_start(3),
464 Cmd_Argv_length(3), challenge);
465 info_item = proto_tree_add_string(argument_tree,
466 hf_quakeworld_connectionless_connect_infostring,
468 offset + Cmd_Argv_start(4),
469 Cmd_Argv_length(4), infostring);
471 info_tree = proto_item_add_subtree(
472 info_item, ett_quakeworld_connectionless_connect_infostring);
473 dissect_id_infostring(tvb, info_tree, offset + Cmd_Argv_start(4),
475 ett_quakeworld_connectionless_connect_infostring_key_value,
476 hf_quakeworld_connectionless_connect_infostring_key_value,
477 hf_quakeworld_connectionless_connect_infostring_key,
478 hf_quakeworld_connectionless_connect_infostring_value);
480 } else if (strcmp(c,"getchallenge") == 0) {
481 strcpy(command, "Get Challenge");
482 command_len = Cmd_Argv_length(0);
483 } else if (strcmp(c,"rcon") == 0) {
486 char remaining[1024];
487 proto_item *argument_item = NULL;
488 proto_tree *argument_tree = NULL;
489 strcpy(command, "Remote Command");
490 command_len = Cmd_Argv_length(0);
492 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
493 tvb, offset, command_len, command);
494 argument_item = proto_tree_add_string(text_tree,
495 hf_quakeworld_connectionless_arguments,
496 tvb, offset + Cmd_Argv_start(1), len + 1 - Cmd_Argv_start(1),
497 text + Cmd_Argv_start(1));
500 proto_item_add_subtree(argument_item,
501 ett_quakeworld_connectionless_arguments);
503 command_finished=TRUE;
505 password = Cmd_Argv(1);
507 proto_tree_add_string(argument_tree,
508 hf_quakeworld_connectionless_rcon_password,
510 offset + Cmd_Argv_start(1),
511 Cmd_Argv_length(1), password);
513 for (i=2; i<Cmd_Argc() ; i++) {
515 strcat (remaining, Cmd_Argv(i) );
516 strcat (remaining, " ");
519 proto_tree_add_string(argument_tree,
520 hf_quakeworld_connectionless_rcon_command,
521 tvb, offset + Cmd_Argv_start(2),
522 Cmd_Argv_start(Cmd_Argc()-1) + Cmd_Argv_length(Cmd_Argc()-1) -
526 } else if (c[0]==A2A_PING && ( c[1]==0 || c[1]=='\n')) {
527 strcpy(command, "Ping");
529 } else if (c[0]==A2A_ACK && ( c[1]==0 || c[1]=='\n')) {
530 strcpy(command, "Ack");
533 strcpy(command, "Unknown");
538 /* server to client commands */
539 if (text[0] == S2C_CONNECTION) {
540 strcpy(command, "Connected");
542 } else if (text[0] == A2C_CLIENT_COMMAND) {
543 strcpy(command, "Client Command");
545 /* stringz (command), stringz (localid) */
546 } else if (text[0] == A2C_PRINT) {
547 strcpy(command, "Print");
550 } else if (text[0] == A2A_PING) {
551 strcpy(command, "Ping");
553 } else if (text[0] == S2C_CHALLENGE) {
554 strcpy(command, "Challenge");
558 strcpy(command, "Unknown");
563 if (check_col(pinfo->cinfo, COL_INFO)) {
564 col_append_fstr(pinfo->cinfo, COL_INFO, " %s", command);
567 if (text_tree && !command_finished) {
568 proto_tree_add_string(text_tree, hf_quakeworld_connectionless_command,
569 tvb, offset, command_len, command);
576 dissect_quakeworld_client_commands(tvbuff_t *tvb, packet_info *pinfo,
579 /* If I have too much time at hand, I'll fill it with all
580 the information from my QWD specs:
581 http://www.planetquake.com/demospecs/qwd/
583 call_dissector(data_handle,tvb, pinfo, tree);
588 dissect_quakeworld_server_commands(tvbuff_t *tvb, packet_info *pinfo,
591 /* If I have too much time at hand, I'll fill it with all
592 the information from my QWD specs:
593 http://www.planetquake.com/demospecs/qwd/
595 call_dissector(data_handle,tvb, pinfo, tree);
599 static const value_string names_reliable[] = {
600 { 0, "Non Reliable" },
607 dissect_quakeworld_GamePacket(tvbuff_t *tvb, packet_info *pinfo,
608 proto_tree *tree, int direction)
610 proto_tree *game_tree = NULL;
611 proto_item *game_item = NULL;
619 direction = (pinfo->destport == gbl_quakeworldServerPort) ?
623 game_item = proto_tree_add_text(tree, tvb,
626 game_tree = proto_item_add_subtree(
627 game_item, ett_quakeworld_game);
632 seq1 = tvb_get_letohl(tvb, offset);
633 rel1 = seq1 & 0x80000000 ? 1 : 0;
636 proto_item *seq1_item = proto_tree_add_text(game_tree,
637 tvb, offset, 4, "Current Sequence: %u (%s)",
638 seq1, val_to_str(rel1,names_reliable,"%u"));
640 proto_tree *seq1_tree = proto_item_add_subtree(
641 seq1_item, ett_quakeworld_game_seq1);
642 proto_tree_add_uint(seq1_tree, hf_quakeworld_game_seq1,
643 tvb, offset, 4, seq1);
644 proto_tree_add_boolean(seq1_tree, hf_quakeworld_game_rel1,
645 tvb, offset+3, 1, rel1);
650 seq2 = tvb_get_letohl(tvb, offset);
651 rel2 = seq2 & 0x80000000 ? 1 : 0;
654 proto_item *seq2_item = proto_tree_add_text(game_tree,
655 tvb, offset, 4, "Acknowledge Sequence: %u (%s)",
656 seq2, val_to_str(rel2,names_reliable,"%u"));;
658 proto_tree *seq2_tree = proto_item_add_subtree(
659 seq2_item, ett_quakeworld_game_seq2);
660 proto_tree_add_uint(seq2_tree, hf_quakeworld_game_seq2,
661 tvb, offset, 4, seq2);
662 proto_tree_add_boolean(seq2_tree, hf_quakeworld_game_rel2,
663 tvb, offset+3, 1, rel2);
668 if (direction == DIR_C2S) {
669 /* client to server */
670 guint16 qport = tvb_get_letohs(tvb, offset);
672 proto_tree_add_uint(game_tree, hf_quakeworld_game_qport,
673 tvb, offset, 2, qport);
678 /* all the rest is pure game data */
679 rest_length = tvb_reported_length(tvb) - offset;
682 tvb_new_subset(tvb, offset, rest_length , rest_length);
684 if (direction == DIR_C2S) {
685 proto_item *c_item = NULL;
686 proto_tree *c_tree = NULL;
688 c_item = proto_tree_add_text(game_tree, next_tvb,
689 0, -1, "Client Commands");
691 c_tree = proto_item_add_subtree(
692 c_item, ett_quakeworld_game_clc);
695 dissect_quakeworld_client_commands(next_tvb, pinfo, c_tree);
698 proto_item *c_item = NULL;
699 proto_tree *c_tree = NULL;
701 c_item = proto_tree_add_text(game_tree, next_tvb,
702 0, -1, "Server Commands");
704 c_tree = proto_item_add_subtree(
705 c_item, ett_quakeworld_game_svc);
708 dissect_quakeworld_server_commands(next_tvb, pinfo, c_tree);
715 dissect_quakeworld(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
717 proto_tree *quakeworld_tree = NULL;
718 proto_item *quakeworld_item = NULL;
721 direction = (pinfo->destport == gbl_quakeworldServerPort) ?
724 if (check_col(pinfo->cinfo, COL_PROTOCOL))
725 col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKEWORLD");
726 if (check_col(pinfo->cinfo, COL_INFO))
727 col_set_str(pinfo->cinfo, COL_INFO, val_to_str(direction,
728 names_direction, "%u"));
731 quakeworld_item = proto_tree_add_item(tree, proto_quakeworld,
734 quakeworld_tree = proto_item_add_subtree(
735 quakeworld_item, ett_quakeworld);
736 if (quakeworld_tree) {
737 proto_tree_add_uint_format(quakeworld_tree,
738 direction == DIR_S2C ?
742 "Direction: %s", val_to_str(direction, names_direction, "%u"));
746 if (tvb_get_ntohl(tvb, 0) == 0xffffffff) {
747 if (check_col(pinfo->cinfo, COL_INFO)) {
748 col_append_str(pinfo->cinfo, COL_INFO, " Connectionless");
751 proto_tree_add_uint_format(quakeworld_tree,
752 hf_quakeworld_connectionless,
754 "Type: Connectionless");
755 dissect_quakeworld_ConnectionlessPacket(
756 tvb, pinfo, quakeworld_tree, direction);
759 if (check_col(pinfo->cinfo, COL_INFO)) {
760 col_append_str(pinfo->cinfo, COL_INFO, " Game");
763 proto_tree_add_uint_format(quakeworld_tree,
767 dissect_quakeworld_GamePacket(
768 tvb, pinfo, quakeworld_tree, direction);
774 proto_reg_handoff_quakeworld(void)
776 static int Initialized=FALSE;
777 static dissector_handle_t quakeworld_handle;
778 static int ServerPort=0;
781 quakeworld_handle = create_dissector_handle(dissect_quakeworld,
785 dissector_delete("udp.port", ServerPort, quakeworld_handle);
788 /* set port for future deletes */
789 ServerPort=gbl_quakeworldServerPort;
791 dissector_add("udp.port", gbl_quakeworldServerPort, quakeworld_handle);
792 data_handle = find_dissector("data");
797 proto_register_quakeworld(void)
799 static hf_register_info hf[] = {
800 { &hf_quakeworld_c2s,
801 { "Client to Server", "quakeworld.c2s",
802 FT_UINT32, BASE_DEC, NULL, 0x0,
803 "Client to Server", HFILL }},
804 { &hf_quakeworld_s2c,
805 { "Server to Client", "quakeworld.s2c",
806 FT_UINT32, BASE_DEC, NULL, 0x0,
807 "Server to Client", HFILL }},
808 { &hf_quakeworld_connectionless,
809 { "Connectionless", "quakeworld.connectionless",
810 FT_UINT32, BASE_DEC, NULL, 0x0,
811 "Connectionless", HFILL }},
812 { &hf_quakeworld_game,
813 { "Game", "quakeworld.game",
814 FT_UINT32, BASE_DEC, NULL, 0x0,
816 { &hf_quakeworld_connectionless_marker,
817 { "Marker", "quakeworld.connectionless.marker",
818 FT_UINT32, BASE_HEX, NULL, 0x0,
820 { &hf_quakeworld_connectionless_text,
821 { "Text", "quakeworld.connectionless.text",
822 FT_STRING, BASE_DEC, NULL, 0x0,
824 { &hf_quakeworld_connectionless_command,
825 { "Command", "quakeworld.connectionless.command",
826 FT_STRING, BASE_DEC, NULL, 0x0,
828 { &hf_quakeworld_connectionless_arguments,
829 { "Arguments", "quakeworld.connectionless.arguments",
830 FT_STRING, BASE_DEC, NULL, 0x0,
831 "Arguments", HFILL }},
832 { &hf_quakeworld_connectionless_connect_version,
833 { "Version", "quakeworld.connectionless.connect.version",
834 FT_UINT32, BASE_DEC, NULL, 0x0,
835 "Protocol Version", HFILL }},
836 { &hf_quakeworld_connectionless_connect_qport,
837 { "QPort", "quakeworld.connectionless.connect.qport",
838 FT_UINT32, BASE_DEC, NULL, 0x0,
839 "QPort of the client", HFILL }},
840 { &hf_quakeworld_connectionless_connect_challenge,
841 { "Challenge", "quakeworld.connectionless.connect.challenge",
842 FT_INT32, BASE_DEC, NULL, 0x0,
843 "Challenge from the server", HFILL }},
844 { &hf_quakeworld_connectionless_connect_infostring,
845 { "Infostring", "quakeworld.connectionless.connect.infostring",
846 FT_STRING, BASE_DEC, NULL, 0x0,
847 "Infostring with additional variables", HFILL }},
848 { &hf_quakeworld_connectionless_connect_infostring_key_value,
849 { "Key/Value", "quakeworld.connectionless.connect.infostring.key_value",
850 FT_STRING, BASE_DEC, NULL, 0x0,
851 "Key and Value", HFILL }},
852 { &hf_quakeworld_connectionless_connect_infostring_key,
853 { "Key", "quakeworld.connectionless.connect.infostring.key",
854 FT_STRING, BASE_DEC, NULL, 0x0,
855 "Infostring Key", HFILL }},
856 { &hf_quakeworld_connectionless_connect_infostring_value,
857 { "Value", "quakeworld.connectionless.connect.infostring.value",
858 FT_STRING, BASE_DEC, NULL, 0x0,
859 "Infostring Value", HFILL }},
860 { &hf_quakeworld_connectionless_rcon_password,
861 { "Password", "quakeworld.connectionless.rcon.password",
862 FT_STRING, BASE_DEC, NULL, 0x0,
863 "Rcon Password", HFILL }},
864 { &hf_quakeworld_connectionless_rcon_command,
865 { "Command", "quakeworld.connectionless.rcon.command",
866 FT_STRING, BASE_DEC, NULL, 0x0,
868 { &hf_quakeworld_game_seq1,
869 { "Sequence Number", "quakeworld.game.seq1",
870 FT_UINT32, BASE_DEC, NULL, 0x0,
871 "Sequence number of the current packet", HFILL }},
872 { &hf_quakeworld_game_rel1,
873 { "Reliable", "quakeworld.game.rel1",
874 FT_BOOLEAN, BASE_DEC, NULL, 0x0,
875 "Packet is reliable and may be retransmitted", HFILL }},
876 { &hf_quakeworld_game_seq2,
877 { "Sequence Number", "quakeworld.game.seq2",
878 FT_UINT32, BASE_DEC, NULL, 0x0,
879 "Sequence number of the last received packet", HFILL }},
880 { &hf_quakeworld_game_rel2,
881 { "Reliable", "quakeworld.game.rel2",
882 FT_BOOLEAN, BASE_DEC, NULL, 0x0,
883 "Packet was reliable and may be retransmitted", HFILL }},
884 { &hf_quakeworld_game_qport,
885 { "QPort", "quakeworld.game.qport",
886 FT_UINT32, BASE_DEC, NULL, 0x0,
887 "QuakeWorld Client Port", HFILL }}
889 static gint *ett[] = {
891 &ett_quakeworld_connectionless,
892 &ett_quakeworld_connectionless_text,
893 &ett_quakeworld_connectionless_arguments,
894 &ett_quakeworld_connectionless_connect_infostring,
895 &ett_quakeworld_connectionless_connect_infostring_key_value,
896 &ett_quakeworld_game,
897 &ett_quakeworld_game_seq1,
898 &ett_quakeworld_game_seq2,
899 &ett_quakeworld_game_clc,
900 &ett_quakeworld_game_svc
902 module_t *quakeworld_module;
904 proto_quakeworld = proto_register_protocol("QuakeWorld Network Protocol",
905 "QUAKEWORLD", "quakeworld");
906 proto_register_field_array(proto_quakeworld, hf, array_length(hf));
907 proto_register_subtree_array(ett, array_length(ett));
909 /* Register a configuration option for port */
910 quakeworld_module = prefs_register_protocol(proto_quakeworld,
911 proto_reg_handoff_quakeworld);
912 prefs_register_uint_preference(quakeworld_module, "udp.port",
913 "QuakeWorld Server UDP Port",
914 "Set the UDP port for the QuakeWorld Server",
915 10, &gbl_quakeworldServerPort);