2 * Routines for Quake II packet dissection
4 * Uwe Girlich <uwe@planetquake.com>
5 * http://www.idsoftware.com/q1source/q1source.zip
6 * http://www.planetquake.com/demospecs/dm2
7 * http://www.dgs.monash.edu.au/~timf/bottim/
8 * http://www.opt-sci.Arizona.EDU/Pandora/default.asp
12 * Wireshark - Network traffic analyzer
13 * By Gerald Combs <gerald@wireshark.org>
14 * Copyright 1998 Gerald Combs
16 * Copied from packet-quakeworld.c
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version 2
21 * of the License, or (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
38 #include <epan/packet.h>
39 #include <epan/prefs.h>
41 static int proto_quake2 = -1;
43 static int hf_quake2_s2c = -1;
44 static int hf_quake2_c2s = -1;
45 static int hf_quake2_connectionless = -1;
46 static int hf_quake2_game = -1;
47 static int hf_quake2_connectionless_marker = -1;
48 static int hf_quake2_connectionless_text = -1;
49 static int hf_quake2_game_seq1 = -1;
50 static int hf_quake2_game_rel1 = -1;
51 static int hf_quake2_game_seq2 = -1;
52 static int hf_quake2_game_rel2 = -1;
53 static int hf_quake2_game_qport = -1;
54 static int hf_quake2_game_client_command = -1;
55 static int hf_quake2_game_server_command = -1;
56 static int hf_quake2_game_client_command_move = -1;
57 static int hf_quake2_game_client_command_move_chksum = -1;
58 static int hf_quake2_game_client_command_move_lframe = -1;
59 static int hf_quake2_game_client_command_move_bitfield_angles1 = -1;
60 static int hf_quake2_game_client_command_move_bitfield_angles2 = -1;
61 static int hf_quake2_game_client_command_move_bitfield_angles3 = -1;
62 static int hf_quake2_game_client_command_move_bitfield_movement_fwd = -1;
63 static int hf_quake2_game_client_command_move_bitfield_movement_side = -1;
64 static int hf_quake2_game_client_command_move_bitfield_movement_up = -1;
65 static int hf_quake2_game_client_command_move_bitfield_buttons = -1;
66 static int hf_quake2_game_client_command_move_bitfield_impulse = -1;
67 static int hf_quake2_game_client_command_move_msec = -1;
68 static int hf_quake2_game_client_command_move_lightlevel = -1;
70 static gint ett_quake2 = -1;
71 static gint ett_quake2_connectionless = -1;
72 static gint ett_quake2_game = -1;
73 static gint ett_quake2_game_seq1 = -1;
74 static gint ett_quake2_game_seq2 = -1;
75 static gint ett_quake2_game_clc = -1;
76 static gint ett_quake2_game_svc = -1;
77 static gint ett_quake2_game_clc_cmd = -1;
78 static gint ett_quake2_game_svc_cmd = -1;
79 static gint ett_quake2_game_clc_cmd_move_bitfield = -1;
80 static gint ett_quake2_game_clc_cmd_move_moves = -1;
83 static dissector_handle_t data_handle;
85 #define PORT_MASTER 27910
86 static unsigned int gbl_quake2ServerPort=PORT_MASTER;
90 dissect_quake2_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo _U_,
91 proto_tree *tree, int direction _U_)
93 proto_tree *cl_tree = NULL;
94 proto_item *cl_item = NULL;
101 marker = tvb_get_ntohl(tvb, 0);
103 cl_item = proto_tree_add_text(tree, tvb,
104 0, -1, "Connectionless");
106 cl_tree = proto_item_add_subtree(
107 cl_item, ett_quake2_connectionless);
111 proto_tree_add_uint(cl_tree, hf_quake2_connectionless_marker,
115 /* all the rest of the packet is just text */
118 len = tvb_length_remaining(tvb, offset);
120 text = tvb_get_ephemeral_string(tvb, offset, len);
121 proto_tree_add_string(cl_tree, hf_quake2_connectionless_text,
122 tvb, offset, len, text);
126 /* we should analyse the result 'text' a bit further */
127 /* for this we need the direction parameter */
130 static const value_string hf_quake2_game_client_command_move_vals[] = {
137 dissect_quake2_client_commands_move(tvbuff_t *tvb, packet_info *pinfo _U_,
140 #define MOVES 3 /* 3 updates per command */
142 /* taken from qcommon.h */
143 #define CM_ANGLE1 (1<<0)
144 #define CM_ANGLE2 (1<<1)
145 #define CM_ANGLE3 (1<<2)
146 #define CM_FORWARD (1<<3)
147 #define CM_SIDE (1<<4)
149 #define CM_BUTTONS (1<<6)
150 #define CM_IMPULSE (1<<7)
152 #define BUTTON_ATTACK 1
154 #define BUTTON_ANY 128
159 enum { OFFSET, VALUE, SIZE };
162 guint16 angles[3][SIZE];
163 gint16 movement[3][SIZE];
164 guint8 buttons[SIZE];
165 guint8 lightlevel[SIZE];
167 guint8 impulse[SIZE];
170 chksum = tvb_get_guint8(tvb, offset);
172 lastframe = tvb_get_letohl(tvb, offset);
175 for (i=0; i < MOVES; i++) {
176 move[i].bits[VALUE] = tvb_get_guint8(tvb, offset);
177 move[i].bits[OFFSET] = offset;
179 if (move[i].bits[VALUE] & CM_ANGLE1) {
180 move[i].angles[0][VALUE] = tvb_get_letohs(tvb, offset);
181 move[i].angles[0][OFFSET] = offset;
184 if (move[i].bits[VALUE] & CM_ANGLE2) {
185 move[i].angles[1][VALUE] = tvb_get_letohs(tvb, offset);
186 move[i].angles[1][OFFSET] = offset;
189 if (move[i].bits[VALUE] & CM_ANGLE3) {
190 move[i].angles[2][VALUE] = tvb_get_letohs(tvb, offset);
191 move[i].angles[2][OFFSET] = offset;
194 if (move[i].bits[VALUE] & CM_FORWARD) {
195 move[i].movement[0][VALUE] = tvb_get_letohs(tvb, offset);
196 move[i].movement[0][OFFSET] = offset;
199 if (move[i].bits[VALUE] & CM_SIDE) {
200 move[i].movement[1][VALUE] = tvb_get_letohs(tvb, offset);
201 move[i].movement[1][OFFSET] = offset;
204 if (move[i].bits[VALUE] & CM_UP) {
205 move[i].movement[2][VALUE] = tvb_get_letohs(tvb, offset);
206 move[i].movement[2][OFFSET] = offset;
209 if (move[i].bits[VALUE] & CM_BUTTONS) {
210 move[i].buttons[VALUE] = tvb_get_guint8(tvb, offset);
211 move[i].buttons[OFFSET] = offset;
214 if (move[i].bits[VALUE] & CM_IMPULSE) {
215 move[i].impulse[VALUE] = tvb_get_guint8(tvb, offset);
216 move[i].impulse[OFFSET] = offset;
220 move[i].msec[VALUE] = tvb_get_guint8(tvb, offset);
221 move[i].msec[OFFSET] = offset;
223 move[i].lightlevel[VALUE] = tvb_get_guint8(tvb, offset);
224 move[i].lightlevel[OFFSET] = offset;
231 proto_tree_add_uint(tree, hf_quake2_game_client_command_move_chksum, tvb,
233 proto_tree_add_uint(tree, hf_quake2_game_client_command_move_lframe, tvb,
236 move[MOVES].bits[OFFSET] = offset;
237 for (i=0; i < MOVES; i++) {
238 proto_item *move_item, *movebits_item, *bit_item;
239 proto_item *sub_tree, *field_tree;
240 #define SHORT2ANGLE(x) ((float)x/65536.0*360.0)
242 move_item = proto_tree_add_text(tree,
244 move[i].bits[OFFSET],
245 move[i+1].bits[OFFSET]-move[i].bits[OFFSET],
247 sub_tree = proto_item_add_subtree(move_item,
248 ett_quake2_game_clc_cmd_move_moves);
251 proto_tree_add_uint(sub_tree, hf_quake2_game_client_command_move,
253 move[i].bits[OFFSET],
255 move[i].bits[VALUE]);
257 proto_tree_add_uint(sub_tree,
258 hf_quake2_game_client_command_move_msec,
259 tvb, move[i].msec[OFFSET], 1, move[i].msec[VALUE]);
260 proto_tree_add_uint(sub_tree,
261 hf_quake2_game_client_command_move_lightlevel,
262 tvb, move[i].lightlevel[OFFSET], 1, move[i].lightlevel[VALUE]);
264 if (move[i].bits[VALUE] == 0) {
265 proto_item_append_text(movebits_item, " (no moves)");
269 field_tree = proto_item_add_subtree(movebits_item,
270 ett_quake2_game_clc_cmd_move_bitfield);
272 if (move[i].bits[VALUE] & CM_ANGLE1) {
273 bit_item = proto_tree_add_uint(field_tree,
274 hf_quake2_game_client_command_move_bitfield_angles1, tvb,
275 move[i].angles[0][OFFSET], 2, move[i].bits[VALUE]);
276 proto_item_append_text(bit_item, " (%d", move[i].angles[0][VALUE]);
277 proto_item_append_text(bit_item, " = %.2f deg)",
278 SHORT2ANGLE(move[i].angles[0][VALUE]));
281 if (move[i].bits[VALUE] & CM_ANGLE2) {
282 bit_item = proto_tree_add_uint(field_tree,
283 hf_quake2_game_client_command_move_bitfield_angles2, tvb,
284 move[i].angles[1][OFFSET], 2, move[i].bits[VALUE]);
285 proto_item_append_text(bit_item, " (%d", move[i].angles[1][VALUE]);
286 proto_item_append_text(bit_item, " = %.2f deg)",
287 SHORT2ANGLE(move[i].angles[1][VALUE]));
289 if (move[i].bits[VALUE] & CM_ANGLE3) {
290 bit_item = proto_tree_add_uint(field_tree,
291 hf_quake2_game_client_command_move_bitfield_angles3, tvb,
292 move[i].angles[2][OFFSET], 2, move[i].bits[VALUE]);
293 proto_item_append_text(bit_item, " (%d", move[i].angles[2][VALUE]);
294 proto_item_append_text(bit_item, " = %.2f deg)",
295 SHORT2ANGLE(move[i].angles[2][VALUE]));
297 if (move[i].bits[VALUE] & CM_FORWARD) {
298 bit_item = proto_tree_add_uint(field_tree,
299 hf_quake2_game_client_command_move_bitfield_movement_fwd, tvb,
300 move[i].movement[0][OFFSET], 2, move[i].bits[VALUE]);
301 proto_item_append_text(bit_item, " (%hd)",
302 move[i].movement[0][VALUE]);
304 if (move[i].bits[VALUE] & CM_SIDE) {
305 bit_item = proto_tree_add_uint(field_tree,
306 hf_quake2_game_client_command_move_bitfield_movement_side, tvb,
307 move[i].movement[1][OFFSET], 2, move[i].bits[VALUE]);
308 proto_item_append_text(bit_item, " (%hd)",
309 move[i].movement[1][VALUE]);
311 if (move[i].bits[VALUE] & CM_UP) {
312 bit_item = proto_tree_add_uint(field_tree,
313 hf_quake2_game_client_command_move_bitfield_movement_up, tvb,
314 move[i].movement[2][OFFSET], 2, move[i].bits[VALUE]);
315 proto_item_append_text(bit_item, " (%hd)",
316 move[i].movement[2][VALUE]);
318 if (move[i].bits[VALUE] & CM_BUTTONS) {
319 bit_item = proto_tree_add_uint(field_tree,
320 hf_quake2_game_client_command_move_bitfield_buttons, tvb,
321 move[i].buttons[OFFSET], 1, move[i].bits[VALUE]);
322 proto_item_append_text(bit_item, " (%d)",
323 move[i].buttons[VALUE]);
324 if (move[i].buttons[VALUE] & BUTTON_ATTACK)
325 proto_item_append_text(bit_item, " (Attack)");
326 if (move[i].buttons[VALUE] & BUTTON_USE)
327 proto_item_append_text(bit_item, " (Use)");
328 if (move[i].buttons[VALUE] & BUTTON_ANY)
329 proto_item_append_text(bit_item, " (Any)");
331 if (move[i].bits[VALUE] & CM_IMPULSE) {
332 bit_item = proto_tree_add_uint(field_tree,
333 hf_quake2_game_client_command_move_bitfield_impulse, tvb,
334 move[i].impulse[OFFSET], 1, move[i].bits[VALUE]);
335 proto_item_append_text(bit_item, " (%d)",
336 move[i].impulse[VALUE]);
345 dissect_quake2_client_commands_uinfo(tvbuff_t *tvb, packet_info *pinfo _U_,
349 proto_item *userinfo_item;
351 len = tvb_strsize(tvb, 0);
354 userinfo_item = proto_tree_add_text(tree, tvb, 0, len, "Userinfo: %s",
355 tvb_get_ptr(tvb, 0, len));
362 dissect_quake2_client_commands_stringcmd(tvbuff_t *tvb, packet_info *pinfo _U_,
366 proto_item *stringcmd_item;
368 len = tvb_strsize(tvb, 0);
371 stringcmd_item = proto_tree_add_text(tree, tvb, 0, len, "Command: %s",
372 tvb_get_ptr(tvb, 0, len));
378 static const value_string names_client_cmd[] = {
381 { CLC_BAD, "clc_bad" },
383 { CLC_NOP, "clc_nop" },
385 { CLC_MOVE, "clc_move" },
386 #define CLC_USERINFO 3
387 { CLC_USERINFO, "clc_userinfo" },
388 #define CLC_STRINGCMD 4
389 { CLC_STRINGCMD, "clc_stringcmd" },
394 dissect_quake2_client_commands(tvbuff_t *tvb, packet_info *pinfo,
397 proto_tree *clc_tree = NULL;
398 tvbuff_t *next_tvb = NULL;
399 guint8 client_cmd_type;
400 guint rest_length = 0;
404 client_cmd_type = tvb_get_guint8(tvb, offset);
407 proto_item *cmd_type_item = proto_tree_add_uint(tree,
408 hf_quake2_game_client_command, tvb, offset, 1,
412 proto_item_append_text(cmd_type_item, " (%s)",
413 val_to_str(client_cmd_type, names_client_cmd, "%u"));
414 clc_tree = proto_item_add_subtree(
415 cmd_type_item, ett_quake2_game_clc_cmd);
420 rest_length = tvb_reported_length(tvb) - offset;
422 next_tvb = tvb_new_subset(tvb, offset,
423 rest_length, rest_length);
428 switch (client_cmd_type) {
435 dissect_quake2_client_commands_move(next_tvb,
440 dissect_quake2_client_commands_uinfo(next_tvb,
445 dissect_quake2_client_commands_stringcmd(next_tvb,
451 offset += rest_length;
452 } while (tvb_reported_length(tvb) - offset > 0);
455 static const value_string names_server_cmd[] = {
458 { SVC_BAD, "svc_bad" },
459 #define SVC_MUZZLEFLASH 1
460 { SVC_MUZZLEFLASH, "svc_muzzleflash" },
461 #define SVC_MUZZLEFLASH2 2
462 { SVC_MUZZLEFLASH2, "svc_muzzleflash2" },
463 #define SVC_TEMP_ENTITY 3
464 { SVC_TEMP_ENTITY, "svc_temp_entity" },
466 { SVC_LAYOUT, "svc_layout" },
467 #define SVC_INVENTORY 5
468 { SVC_INVENTORY, "svc_inventory" },
470 { SVC_NOP, "svc_nop" },
471 #define SVC_DISCONNECT 7
472 { SVC_DISCONNECT, "svc_disconnect" },
473 #define SVC_RECONNECT 8
474 { SVC_RECONNECT, "svc_reconnect" },
476 { SVC_SOUND, "svc_sound" },
478 { SVC_PRINT, "svc_print" },
479 #define SVC_STUFFTEXT 11
480 { SVC_STUFFTEXT, "svc_stufftext" },
481 #define SVC_SERVERDATA 12
482 { SVC_SERVERDATA, "svc_serverdata" },
483 #define SVC_CONFIGSTRING 13
484 { SVC_CONFIGSTRING, "svc_configstring" },
485 #define SVC_SPAWNBASELINE 14
486 { SVC_SPAWNBASELINE, "svc_spawnbaseline" },
487 #define SVC_CENTERPRINT 15
488 { SVC_CENTERPRINT, "svc_centerprint" },
489 #define SVC_DOWNLOAD 16
490 { SVC_DOWNLOAD, "svc_download" },
491 #define SVC_PLAYERINFO 17
492 { SVC_PLAYERINFO, "svc_playerinfo" },
493 #define SVC_PACKETENTITIES 18
494 { SVC_PACKETENTITIES, "svc_packetentities" },
495 #define SVC_DELTAPACKETENTITIES 19
496 { SVC_DELTAPACKETENTITIES, "svc_deltapacketentities" },
498 { SVC_FRAME, "svc_frame" },
503 dissect_quake2_server_commands(tvbuff_t *tvb, packet_info *pinfo,
506 tvbuff_t *next_tvb = NULL;
507 proto_item *cmd_type_item = NULL;
508 guint8 server_cmd_type;
509 guint rest_length = 0;
512 server_cmd_type = tvb_get_guint8(tvb, offset);
515 cmd_type_item = proto_tree_add_uint(tree,
516 hf_quake2_game_server_command, tvb, offset, 1, server_cmd_type);
519 proto_item_append_text(cmd_type_item, " (%s)",
520 val_to_str(server_cmd_type, names_server_cmd, "%u"));
525 rest_length = tvb_reported_length(tvb) - offset;
527 next_tvb = tvb_new_subset(tvb, offset, rest_length, rest_length);
532 switch (server_cmd_type) {
535 case SVC_MUZZLEFLASH:
537 case SVC_MUZZLEFLASH2:
539 case SVC_TEMP_ENTITY:
557 case SVC_CONFIGSTRING:
559 case SVC_SPAWNBASELINE:
561 case SVC_CENTERPRINT:
567 case SVC_PACKETENTITIES:
569 case SVC_DELTAPACKETENTITIES:
577 call_dissector(data_handle, next_tvb, pinfo, tree);
581 static const value_string names_reliable[] = {
582 { 0, "Non Reliable" },
588 static const value_string names_direction[] = {
590 { DIR_C2S, "Client to Server" },
592 { DIR_S2C, "Server to Client" },
598 dissect_quake2_GamePacket(tvbuff_t *tvb, packet_info *pinfo,
599 proto_tree *tree, int direction)
601 proto_tree *game_tree = NULL;
602 proto_item *game_item = NULL;
610 direction = (pinfo->destport == gbl_quake2ServerPort) ?
614 game_item = proto_tree_add_text(tree, tvb,
617 game_tree = proto_item_add_subtree(
618 game_item, ett_quake2_game);
623 seq1 = tvb_get_letohl(tvb, offset);
624 rel1 = seq1 & 0x80000000 ? 1 : 0;
627 proto_item *seq1_item = proto_tree_add_text(game_tree,
628 tvb, offset, 4, "Current Sequence: %u (%s)",
629 seq1, val_to_str(rel1,names_reliable,"%u"));
631 proto_tree *seq1_tree = proto_item_add_subtree(
632 seq1_item, ett_quake2_game_seq1);
633 proto_tree_add_uint(seq1_tree, hf_quake2_game_seq1,
634 tvb, offset, 4, seq1);
635 proto_tree_add_boolean(seq1_tree, hf_quake2_game_rel1,
636 tvb, offset+3, 1, rel1);
641 seq2 = tvb_get_letohl(tvb, offset);
642 rel2 = seq2 & 0x80000000 ? 1 : 0;
645 proto_item *seq2_item = proto_tree_add_text(game_tree,
646 tvb, offset, 4, "Acknowledge Sequence: %u (%s)",
647 seq2, val_to_str(rel2,names_reliable,"%u"));
649 proto_tree *seq2_tree = proto_item_add_subtree(
650 seq2_item, ett_quake2_game_seq2);
651 proto_tree_add_uint(seq2_tree, hf_quake2_game_seq2,
652 tvb, offset, 4, seq2);
653 proto_tree_add_boolean(seq2_tree, hf_quake2_game_rel2,
654 tvb, offset+3, 1, rel2);
659 if (direction == DIR_C2S) {
660 /* client to server */
661 guint16 qport = tvb_get_letohs(tvb, offset);
663 proto_tree_add_uint(game_tree, hf_quake2_game_qport,
664 tvb, offset, 2, qport);
669 /* all the rest is pure game data */
670 rest_length = tvb_reported_length(tvb) - offset;
673 tvb_new_subset(tvb, offset, rest_length , rest_length);
675 if (direction == DIR_C2S) {
676 proto_item *c_item = NULL;
677 proto_tree *c_tree = NULL;
679 c_item = proto_tree_add_text(game_tree, next_tvb,
680 0, -1, "Client Commands");
682 c_tree = proto_item_add_subtree(
683 c_item, ett_quake2_game_clc);
686 dissect_quake2_client_commands(next_tvb, pinfo, c_tree);
689 proto_item *c_item = NULL;
690 proto_tree *c_tree = NULL;
692 c_item = proto_tree_add_text(game_tree, next_tvb,
693 0, -1, "Server Commands");
695 c_tree = proto_item_add_subtree(
696 c_item, ett_quake2_game_svc);
699 dissect_quake2_server_commands(next_tvb, pinfo, c_tree);
706 dissect_quake2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
708 proto_tree *quake2_tree = NULL;
709 proto_item *quake2_item = NULL;
712 direction = (pinfo->destport == gbl_quake2ServerPort) ?
715 if (check_col(pinfo->cinfo, COL_PROTOCOL))
716 col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKE2");
717 if (check_col(pinfo->cinfo, COL_INFO))
718 col_add_str(pinfo->cinfo, COL_INFO, val_to_str(direction,
719 names_direction, "%u"));
722 quake2_item = proto_tree_add_item(tree, proto_quake2,
725 quake2_tree = proto_item_add_subtree(
726 quake2_item, ett_quake2);
728 proto_tree_add_uint_format(quake2_tree,
729 direction == DIR_S2C ?
733 "Direction: %s", val_to_str(direction, names_direction, "%u"));
737 if (tvb_get_ntohl(tvb, 0) == 0xffffffff) {
738 if (check_col(pinfo->cinfo, COL_INFO)) {
739 col_append_str(pinfo->cinfo, COL_INFO, " Connectionless");
742 proto_tree_add_uint_format(quake2_tree,
743 hf_quake2_connectionless,
745 "Type: Connectionless");
746 dissect_quake2_ConnectionlessPacket(
747 tvb, pinfo, quake2_tree, direction);
750 if (check_col(pinfo->cinfo, COL_INFO)) {
751 col_append_str(pinfo->cinfo, COL_INFO, " Game");
754 proto_tree_add_uint_format(quake2_tree,
758 dissect_quake2_GamePacket(
759 tvb, pinfo, quake2_tree, direction);
765 proto_reg_handoff_quake2(void)
767 static int Initialized=FALSE;
768 static dissector_handle_t quake2_handle;
769 static int ServerPort=0;
772 quake2_handle = create_dissector_handle(dissect_quake2,
776 dissector_delete("udp.port", ServerPort, quake2_handle);
779 /* set port for future deletes */
780 ServerPort=gbl_quake2ServerPort;
782 dissector_add("udp.port", gbl_quake2ServerPort, quake2_handle);
783 data_handle = find_dissector("data");
788 proto_register_quake2(void)
790 static hf_register_info hf[] = {
792 { "Client to Server", "quake2.c2s",
793 FT_UINT32, BASE_DEC, NULL, 0x0,
794 "Client to Server", HFILL }},
796 { "Server to Client", "quake2.s2c",
797 FT_UINT32, BASE_DEC, NULL, 0x0,
798 "Server to Client", HFILL }},
799 { &hf_quake2_connectionless,
800 { "Connectionless", "quake2.connectionless",
801 FT_UINT32, BASE_DEC, NULL, 0x0,
802 "Connectionless", HFILL }},
804 { "Game", "quake2.game",
805 FT_UINT32, BASE_DEC, NULL, 0x0,
807 { &hf_quake2_connectionless_marker,
808 { "Marker", "quake2.connectionless.marker",
809 FT_UINT32, BASE_HEX, NULL, 0x0,
811 { &hf_quake2_connectionless_text,
812 { "Text", "quake2.connectionless.text",
813 FT_STRING, BASE_DEC, NULL, 0x0,
815 { &hf_quake2_game_seq1,
816 { "Sequence Number", "quake2.game.seq1",
817 FT_UINT32, BASE_DEC, NULL, 0x0,
818 "Sequence number of the current packet", HFILL }},
819 { &hf_quake2_game_rel1,
820 { "Reliable", "quake2.game.rel1",
821 FT_BOOLEAN, BASE_DEC, NULL, 0x0,
822 "Packet is reliable and may be retransmitted", HFILL }},
823 { &hf_quake2_game_seq2,
824 { "Sequence Number", "quake2.game.seq2",
825 FT_UINT32, BASE_DEC, NULL, 0x0,
826 "Sequence number of the last received packet", HFILL }},
827 { &hf_quake2_game_rel2,
828 { "Reliable", "quake2.game.rel2",
829 FT_BOOLEAN, BASE_DEC, NULL, 0x0,
830 "Packet was reliable and may be retransmitted", HFILL }},
831 { &hf_quake2_game_qport,
832 { "QPort", "quake2.game.qport",
833 FT_UINT32, BASE_DEC, NULL, 0x0,
834 "Quake II Client Port", HFILL }},
835 { &hf_quake2_game_client_command,
836 { "Client Command Type", "quake2.game.client.command",
837 FT_UINT8, BASE_DEC, NULL, 0x0,
838 "Quake II Client Command", HFILL }},
839 { &hf_quake2_game_server_command,
840 { "Server Command", "quake2.game.server.command",
841 FT_UINT8, BASE_DEC, NULL, 0x0,
842 "Quake II Server Command", HFILL }},
843 { &hf_quake2_game_client_command_move_chksum,
844 { "Checksum", "quake2.game.client.command.move.chksum",
845 FT_UINT8, BASE_HEX, NULL, 0x0,
846 "Quake II Client Command Move", HFILL }},
847 { &hf_quake2_game_client_command_move_lframe,
848 { "Last Frame", "quake2.game.client.command.move.lframe",
849 FT_UINT32, BASE_DEC, NULL, 0x0,
850 "Quake II Client Command Move", HFILL }},
851 { &hf_quake2_game_client_command_move,
852 { "Bitfield", "quake2.game.client.command.move",
853 FT_UINT8, BASE_HEX, NULL, 0x0,
854 "Quake II Client Command Move", HFILL }},
855 { &hf_quake2_game_client_command_move_bitfield_angles1,
856 { "Angles (pitch)", "quake2.game.client.command.move.angles",
858 VALS(hf_quake2_game_client_command_move_vals),
859 CM_ANGLE1, "", HFILL }},
860 { &hf_quake2_game_client_command_move_bitfield_angles2,
861 { "Angles (yaw)", "quake2.game.client.command.move.angles",
863 VALS(hf_quake2_game_client_command_move_vals),
864 CM_ANGLE2, "", HFILL }},
865 { &hf_quake2_game_client_command_move_bitfield_angles3,
866 { "Angles (roll)", "quake2.game.client.command.move.angles",
868 VALS(hf_quake2_game_client_command_move_vals),
869 CM_ANGLE3, "", HFILL }},
870 { &hf_quake2_game_client_command_move_bitfield_movement_fwd,
871 { "Movement (fwd)", "quake2.game.client.command.move.movement",
873 VALS(hf_quake2_game_client_command_move_vals),
874 CM_FORWARD, "", HFILL }},
875 { &hf_quake2_game_client_command_move_bitfield_movement_side,
876 { "Movement (side)", "quake2.game.client.command.move.movement",
878 VALS(hf_quake2_game_client_command_move_vals),
879 CM_SIDE, "", HFILL }},
880 { &hf_quake2_game_client_command_move_bitfield_movement_up,
881 { "Movement (up)", "quake2.game.client.command.move.movement",
883 VALS(hf_quake2_game_client_command_move_vals),
885 { &hf_quake2_game_client_command_move_bitfield_buttons,
886 { "Buttons", "quake2.game.client.command.move.buttons",
888 VALS(hf_quake2_game_client_command_move_vals),
889 CM_BUTTONS, "", HFILL }},
890 { &hf_quake2_game_client_command_move_bitfield_impulse,
891 { "Impulse", "quake2.game.client.command.move.impulse",
893 VALS(hf_quake2_game_client_command_move_vals),
894 CM_IMPULSE, "", HFILL }},
895 { &hf_quake2_game_client_command_move_msec,
896 { "Msec", "quake2.game.client.command.move.msec",
897 FT_UINT8, BASE_DEC, NULL, 0x0,
898 "Quake II Client Command Move", HFILL }},
899 { &hf_quake2_game_client_command_move_lightlevel,
900 { "Lightlevel", "quake2.game.client.command.move.lightlevel",
901 FT_UINT8, BASE_DEC, NULL, 0x0,
902 "Quake II Client Command Move", HFILL }}
904 static gint *ett[] = {
906 &ett_quake2_connectionless,
908 &ett_quake2_game_seq1,
909 &ett_quake2_game_seq2,
910 &ett_quake2_game_clc,
911 &ett_quake2_game_svc,
912 &ett_quake2_game_clc_cmd,
913 &ett_quake2_game_svc_cmd,
914 &ett_quake2_game_clc_cmd_move_moves,
915 &ett_quake2_game_clc_cmd_move_bitfield
917 module_t *quake2_module;
919 proto_quake2 = proto_register_protocol("Quake II Network Protocol",
921 proto_register_field_array(proto_quake2, hf, array_length(hf));
922 proto_register_subtree_array(ett, array_length(ett));
924 /* Register a configuration option for port */
925 quake2_module = prefs_register_protocol(proto_quake2,
926 proto_reg_handoff_quake2);
927 prefs_register_uint_preference(quake2_module, "udp.port",
928 "Quake II Server UDP Port",
929 "Set the UDP port for the Quake II Server",
930 10, &gbl_quake2ServerPort);