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
10 * $Id: packet-quake2.c,v 1.15 2003/06/12 08:29:39 guy Exp $
12 * Ethereal - Network traffic analyzer
13 * By Gerald Combs <gerald@ethereal.com>
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>
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 = g_malloc(len + 1);
121 tvb_memcpy(tvb, text, offset, len);
123 proto_tree_add_string(cl_tree, hf_quake2_connectionless_text,
124 tvb, offset, len, text);
129 /* we should analyse the result 'text' a bit further */
130 /* for this we need the direction parameter */
133 static const value_string hf_quake2_game_client_command_move_vals[] = {
140 dissect_quake2_client_commands_move(tvbuff_t *tvb, packet_info *pinfo _U_,
143 #define MOVES 3 /* 3 updates per command */
145 /* taken from qcommon.h */
146 #define CM_ANGLE1 (1<<0)
147 #define CM_ANGLE2 (1<<1)
148 #define CM_ANGLE3 (1<<2)
149 #define CM_FORWARD (1<<3)
150 #define CM_SIDE (1<<4)
152 #define CM_BUTTONS (1<<6)
153 #define CM_IMPULSE (1<<7)
155 #define BUTTON_ATTACK 1
157 #define BUTTON_ANY 128
162 enum { OFFSET, VALUE, SIZE };
165 guint16 angles[3][SIZE];
166 gint16 movement[3][SIZE];
167 guint8 buttons[SIZE];
168 guint8 lightlevel[SIZE];
170 guint8 impulse[SIZE];
173 chksum = tvb_get_guint8(tvb, offset);
175 lastframe = tvb_get_letohl(tvb, offset);
178 for (i=0; i < MOVES; i++) {
179 move[i].bits[VALUE] = tvb_get_guint8(tvb, offset);
180 move[i].bits[OFFSET] = offset;
182 if (move[i].bits[VALUE] & CM_ANGLE1) {
183 move[i].angles[0][VALUE] = tvb_get_letohs(tvb, offset);
184 move[i].angles[0][OFFSET] = offset;
187 if (move[i].bits[VALUE] & CM_ANGLE2) {
188 move[i].angles[1][VALUE] = tvb_get_letohs(tvb, offset);
189 move[i].angles[1][OFFSET] = offset;
192 if (move[i].bits[VALUE] & CM_ANGLE3) {
193 move[i].angles[2][VALUE] = tvb_get_letohs(tvb, offset);
194 move[i].angles[2][OFFSET] = offset;
197 if (move[i].bits[VALUE] & CM_FORWARD) {
198 move[i].movement[0][VALUE] = tvb_get_letohs(tvb, offset);
199 move[i].movement[0][OFFSET] = offset;
202 if (move[i].bits[VALUE] & CM_SIDE) {
203 move[i].movement[1][VALUE] = tvb_get_letohs(tvb, offset);
204 move[i].movement[1][OFFSET] = offset;
207 if (move[i].bits[VALUE] & CM_UP) {
208 move[i].movement[2][VALUE] = tvb_get_letohs(tvb, offset);
209 move[i].movement[2][OFFSET] = offset;
212 if (move[i].bits[VALUE] & CM_BUTTONS) {
213 move[i].buttons[VALUE] = tvb_get_guint8(tvb, offset);
214 move[i].buttons[OFFSET] = offset;
217 if (move[i].bits[VALUE] & CM_IMPULSE) {
218 move[i].impulse[VALUE] = tvb_get_guint8(tvb, offset);
219 move[i].impulse[OFFSET] = offset;
223 move[i].msec[VALUE] = tvb_get_guint8(tvb, offset);
224 move[i].msec[OFFSET] = offset;
226 move[i].lightlevel[VALUE] = tvb_get_guint8(tvb, offset);
227 move[i].lightlevel[OFFSET] = offset;
234 proto_tree_add_uint(tree, hf_quake2_game_client_command_move_chksum, tvb,
236 proto_tree_add_uint(tree, hf_quake2_game_client_command_move_lframe, tvb,
239 move[MOVES].bits[OFFSET] = offset;
240 for (i=0; i < MOVES; i++) {
241 proto_item *move_item, *movebits_item, *bit_item;
242 proto_item *sub_tree, *field_tree;
243 #define SHORT2ANGLE(x) ((float)x/65536.0*360.0)
245 move_item = proto_tree_add_text(tree,
247 move[i].bits[OFFSET],
248 move[i+1].bits[OFFSET]-move[i].bits[OFFSET],
250 sub_tree = proto_item_add_subtree(move_item,
251 ett_quake2_game_clc_cmd_move_moves);
254 proto_tree_add_uint(sub_tree, hf_quake2_game_client_command_move,
256 move[i].bits[OFFSET],
258 move[i].bits[VALUE]);
260 proto_tree_add_uint(sub_tree,
261 hf_quake2_game_client_command_move_msec,
262 tvb, move[i].msec[OFFSET], 1, move[i].msec[VALUE]);
263 proto_tree_add_uint(sub_tree,
264 hf_quake2_game_client_command_move_lightlevel,
265 tvb, move[i].lightlevel[OFFSET], 1, move[i].lightlevel[VALUE]);
267 if (move[i].bits[VALUE] == 0) {
268 proto_item_append_text(movebits_item, " (no moves)");
272 field_tree = proto_item_add_subtree(movebits_item,
273 ett_quake2_game_clc_cmd_move_bitfield);
275 if (move[i].bits[VALUE] & CM_ANGLE1) {
276 bit_item = proto_tree_add_uint(field_tree,
277 hf_quake2_game_client_command_move_bitfield_angles1, tvb,
278 move[i].angles[0][OFFSET], 2, move[i].bits[VALUE]);
279 proto_item_append_text(bit_item, " (%d", move[i].angles[0][VALUE]);
280 proto_item_append_text(bit_item, " = %.2f deg)",
281 SHORT2ANGLE(move[i].angles[0][VALUE]));
284 if (move[i].bits[VALUE] & CM_ANGLE2) {
285 bit_item = proto_tree_add_uint(field_tree,
286 hf_quake2_game_client_command_move_bitfield_angles2, tvb,
287 move[i].angles[1][OFFSET], 2, move[i].bits[VALUE]);
288 proto_item_append_text(bit_item, " (%d", move[i].angles[1][VALUE]);
289 proto_item_append_text(bit_item, " = %.2f deg)",
290 SHORT2ANGLE(move[i].angles[1][VALUE]));
292 if (move[i].bits[VALUE] & CM_ANGLE3) {
293 bit_item = proto_tree_add_uint(field_tree,
294 hf_quake2_game_client_command_move_bitfield_angles3, tvb,
295 move[i].angles[2][OFFSET], 2, move[i].bits[VALUE]);
296 proto_item_append_text(bit_item, " (%d", move[i].angles[2][VALUE]);
297 proto_item_append_text(bit_item, " = %.2f deg)",
298 SHORT2ANGLE(move[i].angles[2][VALUE]));
300 if (move[i].bits[VALUE] & CM_FORWARD) {
301 bit_item = proto_tree_add_uint(field_tree,
302 hf_quake2_game_client_command_move_bitfield_movement_fwd, tvb,
303 move[i].movement[0][OFFSET], 2, move[i].bits[VALUE]);
304 proto_item_append_text(bit_item, " (%hd)",
305 move[i].movement[0][VALUE]);
307 if (move[i].bits[VALUE] & CM_SIDE) {
308 bit_item = proto_tree_add_uint(field_tree,
309 hf_quake2_game_client_command_move_bitfield_movement_side, tvb,
310 move[i].movement[1][OFFSET], 2, move[i].bits[VALUE]);
311 proto_item_append_text(bit_item, " (%hd)",
312 move[i].movement[1][VALUE]);
314 if (move[i].bits[VALUE] & CM_UP) {
315 bit_item = proto_tree_add_uint(field_tree,
316 hf_quake2_game_client_command_move_bitfield_movement_up, tvb,
317 move[i].movement[2][OFFSET], 2, move[i].bits[VALUE]);
318 proto_item_append_text(bit_item, " (%hd)",
319 move[i].movement[2][VALUE]);
321 if (move[i].bits[VALUE] & CM_BUTTONS) {
322 bit_item = proto_tree_add_uint(field_tree,
323 hf_quake2_game_client_command_move_bitfield_buttons, tvb,
324 move[i].buttons[OFFSET], 1, move[i].bits[VALUE]);
325 proto_item_append_text(bit_item, " (%d)",
326 move[i].buttons[VALUE]);
327 if (move[i].buttons[VALUE] & BUTTON_ATTACK)
328 proto_item_append_text(bit_item, " (Attack)");
329 if (move[i].buttons[VALUE] & BUTTON_USE)
330 proto_item_append_text(bit_item, " (Use)");
331 if (move[i].buttons[VALUE] & BUTTON_ANY)
332 proto_item_append_text(bit_item, " (Any)");
334 if (move[i].bits[VALUE] & CM_IMPULSE) {
335 bit_item = proto_tree_add_uint(field_tree,
336 hf_quake2_game_client_command_move_bitfield_impulse, tvb,
337 move[i].impulse[OFFSET], 1, move[i].bits[VALUE]);
338 proto_item_append_text(bit_item, " (%d)",
339 move[i].impulse[VALUE]);
348 dissect_quake2_client_commands_uinfo(tvbuff_t *tvb, packet_info *pinfo _U_,
353 proto_item *userinfo_item;
355 len = tvb_strsize(tvb, 0);
358 message = g_malloc(len);
359 tvb_memcpy(tvb, message, 0, len);
360 userinfo_item = proto_tree_add_text(tree, tvb, 0, len, "Userinfo: %s", message);
368 dissect_quake2_client_commands_stringcmd(tvbuff_t *tvb, packet_info *pinfo _U_,
373 proto_item *stringcmd_item;
375 len = tvb_strsize(tvb, 0);
378 message = g_malloc(len);
379 tvb_memcpy(tvb, message, 0, len);
380 stringcmd_item = proto_tree_add_text(tree, tvb, 0, len, "Command: %s",
388 static const value_string names_client_cmd[] = {
391 { CLC_BAD, "clc_bad" },
393 { CLC_NOP, "clc_nop" },
395 { CLC_MOVE, "clc_move" },
396 #define CLC_USERINFO 3
397 { CLC_USERINFO, "clc_userinfo" },
398 #define CLC_STRINGCMD 4
399 { CLC_STRINGCMD, "clc_stringcmd" },
404 dissect_quake2_client_commands(tvbuff_t *tvb, packet_info *pinfo,
407 proto_tree *clc_tree = NULL;
408 tvbuff_t *next_tvb = NULL;
409 guint8 client_cmd_type;
410 guint rest_length = 0;
414 client_cmd_type = tvb_get_guint8(tvb, offset);
417 proto_item *cmd_type_item = proto_tree_add_uint(tree,
418 hf_quake2_game_client_command, tvb, offset, 1,
422 proto_item_append_text(cmd_type_item, " (%s)",
423 val_to_str(client_cmd_type, names_client_cmd, "%u"));
424 clc_tree = proto_item_add_subtree(
425 cmd_type_item, ett_quake2_game_clc_cmd);
430 rest_length = tvb_reported_length(tvb) - offset;
432 next_tvb = tvb_new_subset(tvb, offset,
433 rest_length, rest_length);
438 switch (client_cmd_type) {
445 dissect_quake2_client_commands_move(next_tvb,
450 dissect_quake2_client_commands_uinfo(next_tvb,
455 dissect_quake2_client_commands_stringcmd(next_tvb,
461 offset += rest_length;
462 } while (tvb_reported_length(tvb) - offset > 0);
465 static const value_string names_server_cmd[] = {
468 { SVC_BAD, "svc_bad" },
469 #define SVC_MUZZLEFLASH 1
470 { SVC_MUZZLEFLASH, "svc_muzzleflash" },
471 #define SVC_MUZZLEFLASH2 2
472 { SVC_MUZZLEFLASH2, "svc_muzzleflash2" },
473 #define SVC_TEMP_ENTITY 3
474 { SVC_TEMP_ENTITY, "svc_temp_entity" },
476 { SVC_LAYOUT, "svc_layout" },
477 #define SVC_INVENTORY 5
478 { SVC_INVENTORY, "svc_inventory" },
480 { SVC_NOP, "svc_nop" },
481 #define SVC_DISCONNECT 7
482 { SVC_DISCONNECT, "svc_disconnect" },
483 #define SVC_RECONNECT 8
484 { SVC_RECONNECT, "svc_reconnect" },
486 { SVC_SOUND, "svc_sound" },
488 { SVC_PRINT, "svc_print" },
489 #define SVC_STUFFTEXT 11
490 { SVC_STUFFTEXT, "svc_stufftext" },
491 #define SVC_SERVERDATA 12
492 { SVC_SERVERDATA, "svc_serverdata" },
493 #define SVC_CONFIGSTRING 13
494 { SVC_CONFIGSTRING, "svc_configstring" },
495 #define SVC_SPAWNBASELINE 14
496 { SVC_SPAWNBASELINE, "svc_spawnbaseline" },
497 #define SVC_CENTERPRINT 15
498 { SVC_CENTERPRINT, "svc_centerprint" },
499 #define SVC_DOWNLOAD 16
500 { SVC_DOWNLOAD, "svc_download" },
501 #define SVC_PLAYERINFO 17
502 { SVC_PLAYERINFO, "svc_playerinfo" },
503 #define SVC_PACKETENTITIES 18
504 { SVC_PACKETENTITIES, "svc_packetentities" },
505 #define SVC_DELTAPACKETENTITIES 19
506 { SVC_DELTAPACKETENTITIES, "svc_deltapacketentities" },
508 { SVC_FRAME, "svc_frame" },
513 dissect_quake2_server_commands(tvbuff_t *tvb, packet_info *pinfo,
516 tvbuff_t *next_tvb = NULL;
517 proto_item *cmd_type_item = NULL;
518 guint8 server_cmd_type;
519 guint rest_length = 0;
522 server_cmd_type = tvb_get_guint8(tvb, offset);
525 cmd_type_item = proto_tree_add_uint(tree,
526 hf_quake2_game_server_command, tvb, offset, 1, server_cmd_type);
529 proto_item_append_text(cmd_type_item, " (%s)",
530 val_to_str(server_cmd_type, names_server_cmd, "%u"));
535 rest_length = tvb_reported_length(tvb) - offset;
537 next_tvb = tvb_new_subset(tvb, offset, rest_length, rest_length);
542 switch (server_cmd_type) {
545 case SVC_MUZZLEFLASH:
547 case SVC_MUZZLEFLASH2:
549 case SVC_TEMP_ENTITY:
567 case SVC_CONFIGSTRING:
569 case SVC_SPAWNBASELINE:
571 case SVC_CENTERPRINT:
577 case SVC_PACKETENTITIES:
579 case SVC_DELTAPACKETENTITIES:
587 call_dissector(data_handle, next_tvb, pinfo, tree);
591 static const value_string names_reliable[] = {
592 { 0, "Non Reliable" },
598 static const value_string names_direction[] = {
600 { DIR_C2S, "Client to Server" },
602 { DIR_S2C, "Server to Client" },
608 dissect_quake2_GamePacket(tvbuff_t *tvb, packet_info *pinfo,
609 proto_tree *tree, int direction)
611 proto_tree *game_tree = NULL;
612 proto_item *game_item = NULL;
620 direction = (pinfo->destport == gbl_quake2ServerPort) ?
624 game_item = proto_tree_add_text(tree, tvb,
627 game_tree = proto_item_add_subtree(
628 game_item, ett_quake2_game);
633 seq1 = tvb_get_letohl(tvb, offset);
634 rel1 = seq1 & 0x80000000 ? 1 : 0;
637 proto_item *seq1_item = proto_tree_add_text(game_tree,
638 tvb, offset, 4, "Current Sequence: %u (%s)",
639 seq1, val_to_str(rel1,names_reliable,"%u"));
641 proto_tree *seq1_tree = proto_item_add_subtree(
642 seq1_item, ett_quake2_game_seq1);
643 proto_tree_add_uint(seq1_tree, hf_quake2_game_seq1,
644 tvb, offset, 4, seq1);
645 proto_tree_add_boolean(seq1_tree, hf_quake2_game_rel1,
646 tvb, offset+3, 1, rel1);
651 seq2 = tvb_get_letohl(tvb, offset);
652 rel2 = seq2 & 0x80000000 ? 1 : 0;
655 proto_item *seq2_item = proto_tree_add_text(game_tree,
656 tvb, offset, 4, "Acknowledge Sequence: %u (%s)",
657 seq2, val_to_str(rel2,names_reliable,"%u"));;
659 proto_tree *seq2_tree = proto_item_add_subtree(
660 seq2_item, ett_quake2_game_seq2);
661 proto_tree_add_uint(seq2_tree, hf_quake2_game_seq2,
662 tvb, offset, 4, seq2);
663 proto_tree_add_boolean(seq2_tree, hf_quake2_game_rel2,
664 tvb, offset+3, 1, rel2);
669 if (direction == DIR_C2S) {
670 /* client to server */
671 guint16 qport = tvb_get_letohs(tvb, offset);
673 proto_tree_add_uint(game_tree, hf_quake2_game_qport,
674 tvb, offset, 2, qport);
679 /* all the rest is pure game data */
680 rest_length = tvb_reported_length(tvb) - offset;
683 tvb_new_subset(tvb, offset, rest_length , rest_length);
685 if (direction == DIR_C2S) {
686 proto_item *c_item = NULL;
687 proto_tree *c_tree = NULL;
689 c_item = proto_tree_add_text(game_tree, next_tvb,
690 0, -1, "Client Commands");
692 c_tree = proto_item_add_subtree(
693 c_item, ett_quake2_game_clc);
696 dissect_quake2_client_commands(next_tvb, pinfo, c_tree);
699 proto_item *c_item = NULL;
700 proto_tree *c_tree = NULL;
702 c_item = proto_tree_add_text(game_tree, next_tvb,
703 0, -1, "Server Commands");
705 c_tree = proto_item_add_subtree(
706 c_item, ett_quake2_game_svc);
709 dissect_quake2_server_commands(next_tvb, pinfo, c_tree);
716 dissect_quake2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
718 proto_tree *quake2_tree = NULL;
719 proto_item *quake2_item = NULL;
722 direction = (pinfo->destport == gbl_quake2ServerPort) ?
725 if (check_col(pinfo->cinfo, COL_PROTOCOL))
726 col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKE2");
727 if (check_col(pinfo->cinfo, COL_INFO))
728 col_set_str(pinfo->cinfo, COL_INFO, val_to_str(direction,
729 names_direction, "%u"));
732 quake2_item = proto_tree_add_item(tree, proto_quake2,
735 quake2_tree = proto_item_add_subtree(
736 quake2_item, ett_quake2);
738 proto_tree_add_uint_format(quake2_tree,
739 direction == DIR_S2C ?
743 "Direction: %s", val_to_str(direction, names_direction, "%u"));
747 if (tvb_get_ntohl(tvb, 0) == 0xffffffff) {
748 if (check_col(pinfo->cinfo, COL_INFO)) {
749 col_append_str(pinfo->cinfo, COL_INFO, " Connectionless");
752 proto_tree_add_uint_format(quake2_tree,
753 hf_quake2_connectionless,
755 "Type: Connectionless");
756 dissect_quake2_ConnectionlessPacket(
757 tvb, pinfo, quake2_tree, direction);
760 if (check_col(pinfo->cinfo, COL_INFO)) {
761 col_append_str(pinfo->cinfo, COL_INFO, " Game");
764 proto_tree_add_uint_format(quake2_tree,
768 dissect_quake2_GamePacket(
769 tvb, pinfo, quake2_tree, direction);
775 proto_reg_handoff_quake2(void)
777 static int Initialized=FALSE;
778 static dissector_handle_t quake2_handle;
779 static int ServerPort=0;
782 quake2_handle = create_dissector_handle(dissect_quake2,
786 dissector_delete("udp.port", ServerPort, quake2_handle);
789 /* set port for future deletes */
790 ServerPort=gbl_quake2ServerPort;
792 dissector_add("udp.port", gbl_quake2ServerPort, quake2_handle);
793 data_handle = find_dissector("data");
798 proto_register_quake2(void)
800 static hf_register_info hf[] = {
802 { "Client to Server", "quake2.c2s",
803 FT_UINT32, BASE_DEC, NULL, 0x0,
804 "Client to Server", HFILL }},
806 { "Server to Client", "quake2.s2c",
807 FT_UINT32, BASE_DEC, NULL, 0x0,
808 "Server to Client", HFILL }},
809 { &hf_quake2_connectionless,
810 { "Connectionless", "quake2.connectionless",
811 FT_UINT32, BASE_DEC, NULL, 0x0,
812 "Connectionless", HFILL }},
814 { "Game", "quake2.game",
815 FT_UINT32, BASE_DEC, NULL, 0x0,
817 { &hf_quake2_connectionless_marker,
818 { "Marker", "quake2.connectionless.marker",
819 FT_UINT32, BASE_HEX, NULL, 0x0,
821 { &hf_quake2_connectionless_text,
822 { "Text", "quake2.connectionless.text",
823 FT_STRING, BASE_DEC, NULL, 0x0,
825 { &hf_quake2_game_seq1,
826 { "Sequence Number", "quake2.game.seq1",
827 FT_UINT32, BASE_DEC, NULL, 0x0,
828 "Sequence number of the current packet", HFILL }},
829 { &hf_quake2_game_rel1,
830 { "Reliable", "quake2.game.rel1",
831 FT_BOOLEAN, BASE_DEC, NULL, 0x0,
832 "Packet is reliable and may be retransmitted", HFILL }},
833 { &hf_quake2_game_seq2,
834 { "Sequence Number", "quake2.game.seq2",
835 FT_UINT32, BASE_DEC, NULL, 0x0,
836 "Sequence number of the last received packet", HFILL }},
837 { &hf_quake2_game_rel2,
838 { "Reliable", "quake2.game.rel2",
839 FT_BOOLEAN, BASE_DEC, NULL, 0x0,
840 "Packet was reliable and may be retransmitted", HFILL }},
841 { &hf_quake2_game_qport,
842 { "QPort", "quake2.game.qport",
843 FT_UINT32, BASE_DEC, NULL, 0x0,
844 "Quake II Client Port", HFILL }},
845 { &hf_quake2_game_client_command,
846 { "Client Command Type", "quake2.game.client.command",
847 FT_UINT8, BASE_DEC, NULL, 0x0,
848 "Quake II Client Command", HFILL }},
849 { &hf_quake2_game_server_command,
850 { "Server Command", "quake2.game.server.command",
851 FT_UINT8, BASE_DEC, NULL, 0x0,
852 "Quake II Server Command", HFILL }},
853 { &hf_quake2_game_client_command_move_chksum,
854 { "Checksum", "quake2.game.client.command.move.chksum",
855 FT_UINT8, BASE_HEX, NULL, 0x0,
856 "Quake II Client Command Move", HFILL }},
857 { &hf_quake2_game_client_command_move_lframe,
858 { "Last Frame", "quake2.game.client.command.move.lframe",
859 FT_UINT32, BASE_DEC, NULL, 0x0,
860 "Quake II Client Command Move", HFILL }},
861 { &hf_quake2_game_client_command_move,
862 { "Bitfield", "quake2.game.client.command.move",
863 FT_UINT8, BASE_HEX, NULL, 0x0,
864 "Quake II Client Command Move", HFILL }},
865 { &hf_quake2_game_client_command_move_bitfield_angles1,
866 { "Angles (pitch)", "quake2.game.client.command.move.angles",
868 VALS(hf_quake2_game_client_command_move_vals),
869 CM_ANGLE1, "", HFILL }},
870 { &hf_quake2_game_client_command_move_bitfield_angles2,
871 { "Angles (yaw)", "quake2.game.client.command.move.angles",
873 VALS(hf_quake2_game_client_command_move_vals),
874 CM_ANGLE2, "", HFILL }},
875 { &hf_quake2_game_client_command_move_bitfield_angles3,
876 { "Angles (roll)", "quake2.game.client.command.move.angles",
878 VALS(hf_quake2_game_client_command_move_vals),
879 CM_ANGLE3, "", HFILL }},
880 { &hf_quake2_game_client_command_move_bitfield_movement_fwd,
881 { "Movement (fwd)", "quake2.game.client.command.move.movement",
883 VALS(hf_quake2_game_client_command_move_vals),
884 CM_FORWARD, "", HFILL }},
885 { &hf_quake2_game_client_command_move_bitfield_movement_side,
886 { "Movement (side)", "quake2.game.client.command.move.movement",
888 VALS(hf_quake2_game_client_command_move_vals),
889 CM_SIDE, "", HFILL }},
890 { &hf_quake2_game_client_command_move_bitfield_movement_up,
891 { "Movement (up)", "quake2.game.client.command.move.movement",
893 VALS(hf_quake2_game_client_command_move_vals),
895 { &hf_quake2_game_client_command_move_bitfield_buttons,
896 { "Buttons", "quake2.game.client.command.move.buttons",
898 VALS(hf_quake2_game_client_command_move_vals),
899 CM_BUTTONS, "", HFILL }},
900 { &hf_quake2_game_client_command_move_bitfield_impulse,
901 { "Impulse", "quake2.game.client.command.move.impulse",
903 VALS(hf_quake2_game_client_command_move_vals),
904 CM_IMPULSE, "", HFILL }},
905 { &hf_quake2_game_client_command_move_msec,
906 { "Msec", "quake2.game.client.command.move.msec",
907 FT_UINT8, BASE_DEC, NULL, 0x0,
908 "Quake II Client Command Move", HFILL }},
909 { &hf_quake2_game_client_command_move_lightlevel,
910 { "Lightlevel", "quake2.game.client.command.move.lightlevel",
911 FT_UINT8, BASE_DEC, NULL, 0x0,
912 "Quake II Client Command Move", HFILL }}
914 static gint *ett[] = {
916 &ett_quake2_connectionless,
918 &ett_quake2_game_seq1,
919 &ett_quake2_game_seq2,
920 &ett_quake2_game_clc,
921 &ett_quake2_game_svc,
922 &ett_quake2_game_clc_cmd,
923 &ett_quake2_game_svc_cmd,
924 &ett_quake2_game_clc_cmd_move_moves,
925 &ett_quake2_game_clc_cmd_move_bitfield
927 module_t *quake2_module;
929 proto_quake2 = proto_register_protocol("Quake II Network Protocol",
931 proto_register_field_array(proto_quake2, hf, array_length(hf));
932 proto_register_subtree_array(ett, array_length(ett));
934 /* Register a configuration option for port */
935 quake2_module = prefs_register_protocol(proto_quake2,
936 proto_reg_handoff_quake2);
937 prefs_register_uint_preference(quake2_module, "udp.port",
938 "Quake II Server UDP Port",
939 "Set the UDP port for the Quake II Server",
940 10, &gbl_quake2ServerPort);