2001-06-21 15:15:57 +00:00
|
|
|
/* packet-quake2.c
|
|
|
|
* Routines for Quake II packet dissection
|
|
|
|
*
|
|
|
|
* Uwe Girlich <uwe@planetquake.com>
|
|
|
|
* http://www.idsoftware.com/q1source/q1source.zip
|
|
|
|
* http://www.planetquake.com/demospecs/dm2
|
|
|
|
* http://www.dgs.monash.edu.au/~timf/bottim/
|
|
|
|
* http://www.opt-sci.Arizona.EDU/Pandora/default.asp
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2001-06-21 15:15:57 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2001-06-21 15:15:57 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-quakeworld.c
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-06-21 15:15:57 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-06-21 15:15:57 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
2001-06-21 15:15:57 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2001-06-21 15:15:57 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
2004-09-27 22:55:15 +00:00
|
|
|
#include <epan/prefs.h>
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
static int proto_quake2 = -1;
|
|
|
|
|
|
|
|
static int hf_quake2_s2c = -1;
|
|
|
|
static int hf_quake2_c2s = -1;
|
|
|
|
static int hf_quake2_connectionless = -1;
|
|
|
|
static int hf_quake2_game = -1;
|
|
|
|
static int hf_quake2_connectionless_marker = -1;
|
|
|
|
static int hf_quake2_connectionless_text = -1;
|
|
|
|
static int hf_quake2_game_seq1 = -1;
|
|
|
|
static int hf_quake2_game_rel1 = -1;
|
|
|
|
static int hf_quake2_game_seq2 = -1;
|
|
|
|
static int hf_quake2_game_rel2 = -1;
|
|
|
|
static int hf_quake2_game_qport = -1;
|
2002-07-29 09:28:28 +00:00
|
|
|
static int hf_quake2_game_client_command = -1;
|
|
|
|
static int hf_quake2_game_server_command = -1;
|
|
|
|
static int hf_quake2_game_client_command_move = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_chksum = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_lframe = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_bitfield_angles1 = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_bitfield_angles2 = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_bitfield_angles3 = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_bitfield_movement_fwd = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_bitfield_movement_side = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_bitfield_movement_up = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_bitfield_buttons = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_bitfield_impulse = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_msec = -1;
|
|
|
|
static int hf_quake2_game_client_command_move_lightlevel = -1;
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
static gint ett_quake2 = -1;
|
|
|
|
static gint ett_quake2_connectionless = -1;
|
|
|
|
static gint ett_quake2_game = -1;
|
|
|
|
static gint ett_quake2_game_seq1 = -1;
|
|
|
|
static gint ett_quake2_game_seq2 = -1;
|
|
|
|
static gint ett_quake2_game_clc = -1;
|
|
|
|
static gint ett_quake2_game_svc = -1;
|
2002-07-29 09:28:28 +00:00
|
|
|
static gint ett_quake2_game_clc_cmd = -1;
|
|
|
|
static gint ett_quake2_game_svc_cmd = -1;
|
|
|
|
static gint ett_quake2_game_clc_cmd_move_bitfield = -1;
|
|
|
|
static gint ett_quake2_game_clc_cmd_move_moves = -1;
|
|
|
|
|
2001-06-21 15:15:57 +00:00
|
|
|
|
2001-11-25 22:19:25 +00:00
|
|
|
static dissector_handle_t data_handle;
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
#define PORT_MASTER 27910
|
2008-09-23 01:10:45 +00:00
|
|
|
static guint gbl_quake2ServerPort=PORT_MASTER;
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2002-04-02 06:28:16 +00:00
|
|
|
dissect_quake2_ConnectionlessPacket(tvbuff_t *tvb, packet_info *pinfo _U_,
|
|
|
|
proto_tree *tree, int direction _U_)
|
2001-06-21 15:15:57 +00:00
|
|
|
{
|
|
|
|
proto_tree *cl_tree = NULL;
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
guint8 *text;
|
2001-06-21 15:15:57 +00:00
|
|
|
int len;
|
|
|
|
int offset;
|
|
|
|
|
|
|
|
guint32 marker;
|
|
|
|
|
|
|
|
marker = tvb_get_ntohl(tvb, 0);
|
|
|
|
if (tree) {
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_item *cl_item = NULL;
|
2001-06-21 15:15:57 +00:00
|
|
|
cl_item = proto_tree_add_text(tree, tvb,
|
2002-01-24 09:20:54 +00:00
|
|
|
0, -1, "Connectionless");
|
2010-06-09 17:16:33 +00:00
|
|
|
cl_tree = proto_item_add_subtree(cl_item, ett_quake2_connectionless);
|
2001-06-21 15:15:57 +00:00
|
|
|
proto_tree_add_uint(cl_tree, hf_quake2_connectionless_marker,
|
|
|
|
tvb, 0, 4, marker);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* all the rest of the packet is just text */
|
|
|
|
offset = 4;
|
|
|
|
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
len = tvb_length_remaining(tvb, offset);
|
2001-07-22 18:52:38 +00:00
|
|
|
if (cl_tree) {
|
2005-08-10 13:41:13 +00:00
|
|
|
text = tvb_get_ephemeral_string(tvb, offset, len);
|
2001-06-21 15:15:57 +00:00
|
|
|
proto_tree_add_string(cl_tree, hf_quake2_connectionless_text,
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
tvb, offset, len, text);
|
2001-06-21 15:15:57 +00:00
|
|
|
}
|
2012-10-21 14:53:51 +00:00
|
|
|
/*offset += len;*/
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
/* we should analyse the result 'text' a bit further */
|
|
|
|
/* for this we need the direction parameter */
|
|
|
|
}
|
|
|
|
|
2002-07-29 09:28:28 +00:00
|
|
|
static const value_string hf_quake2_game_client_command_move_vals[] = {
|
|
|
|
{ 0x00, "-" },
|
|
|
|
{ 0x01, "set" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
static int
|
|
|
|
dissect_quake2_client_commands_move(tvbuff_t *tvb, packet_info *pinfo _U_,
|
2002-07-29 09:28:28 +00:00
|
|
|
proto_tree *tree)
|
|
|
|
{
|
|
|
|
#define MOVES 3 /* 3 updates per command */
|
|
|
|
|
|
|
|
/* taken from qcommon.h */
|
|
|
|
#define CM_ANGLE1 (1<<0)
|
|
|
|
#define CM_ANGLE2 (1<<1)
|
|
|
|
#define CM_ANGLE3 (1<<2)
|
|
|
|
#define CM_FORWARD (1<<3)
|
|
|
|
#define CM_SIDE (1<<4)
|
|
|
|
#define CM_UP (1<<5)
|
|
|
|
#define CM_BUTTONS (1<<6)
|
|
|
|
#define CM_IMPULSE (1<<7)
|
|
|
|
/* qshared.h */
|
|
|
|
#define BUTTON_ATTACK 1
|
2010-06-09 17:16:33 +00:00
|
|
|
#define BUTTON_USE 2
|
|
|
|
#define BUTTON_ANY 128
|
2002-07-29 09:28:28 +00:00
|
|
|
|
|
|
|
guint8 chksum;
|
|
|
|
guint32 lastframe;
|
|
|
|
int i, offset = 0;
|
2010-02-01 19:01:56 +00:00
|
|
|
enum { Q_OFFSET, Q_VALUE, Q_SIZE };
|
2002-07-29 09:28:28 +00:00
|
|
|
struct movement {
|
2010-02-01 19:01:56 +00:00
|
|
|
guint8 bits[Q_SIZE];
|
|
|
|
guint16 angles[3][Q_SIZE];
|
|
|
|
gint16 movement[3][Q_SIZE];
|
|
|
|
guint8 buttons[Q_SIZE];
|
|
|
|
guint8 lightlevel[Q_SIZE];
|
|
|
|
guint8 msec[Q_SIZE];
|
|
|
|
guint8 impulse[Q_SIZE];
|
2002-07-29 09:28:28 +00:00
|
|
|
} move[MOVES+1];
|
|
|
|
|
|
|
|
chksum = tvb_get_guint8(tvb, offset);
|
|
|
|
offset++;
|
|
|
|
lastframe = tvb_get_letohl(tvb, offset);
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
for (i=0; i < MOVES; i++) {
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].bits[Q_VALUE] = tvb_get_guint8(tvb, offset);
|
|
|
|
move[i].bits[Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset++;
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_ANGLE1) {
|
|
|
|
move[i].angles[0][Q_VALUE] = tvb_get_letohs(tvb, offset);
|
|
|
|
move[i].angles[0][Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset += 2;
|
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_ANGLE2) {
|
|
|
|
move[i].angles[1][Q_VALUE] = tvb_get_letohs(tvb, offset);
|
|
|
|
move[i].angles[1][Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset += 2;
|
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_ANGLE3) {
|
|
|
|
move[i].angles[2][Q_VALUE] = tvb_get_letohs(tvb, offset);
|
|
|
|
move[i].angles[2][Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset += 2;
|
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_FORWARD) {
|
|
|
|
move[i].movement[0][Q_VALUE] = tvb_get_letohs(tvb, offset);
|
|
|
|
move[i].movement[0][Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset += 2;
|
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_SIDE) {
|
|
|
|
move[i].movement[1][Q_VALUE] = tvb_get_letohs(tvb, offset);
|
|
|
|
move[i].movement[1][Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset += 2;
|
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_UP) {
|
|
|
|
move[i].movement[2][Q_VALUE] = tvb_get_letohs(tvb, offset);
|
|
|
|
move[i].movement[2][Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset += 2;
|
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_BUTTONS) {
|
|
|
|
move[i].buttons[Q_VALUE] = tvb_get_guint8(tvb, offset);
|
|
|
|
move[i].buttons[Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset++;
|
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_IMPULSE) {
|
|
|
|
move[i].impulse[Q_VALUE] = tvb_get_guint8(tvb, offset);
|
|
|
|
move[i].impulse[Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset++;
|
|
|
|
}
|
|
|
|
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].msec[Q_VALUE] = tvb_get_guint8(tvb, offset);
|
|
|
|
move[i].msec[Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset++;
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].lightlevel[Q_VALUE] = tvb_get_guint8(tvb, offset);
|
|
|
|
move[i].lightlevel[Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
offset++;
|
|
|
|
}
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
if (!tree)
|
2002-07-29 09:28:28 +00:00
|
|
|
return offset;
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_uint(tree, hf_quake2_game_client_command_move_chksum, tvb,
|
2002-07-29 09:28:28 +00:00
|
|
|
0, 1, chksum);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_uint(tree, hf_quake2_game_client_command_move_lframe, tvb,
|
2002-07-29 09:28:28 +00:00
|
|
|
1, 4, lastframe);
|
|
|
|
|
2010-02-01 19:01:56 +00:00
|
|
|
move[MOVES].bits[Q_OFFSET] = offset;
|
2002-07-29 09:28:28 +00:00
|
|
|
for (i=0; i < MOVES; i++) {
|
|
|
|
proto_item *move_item, *movebits_item, *bit_item;
|
|
|
|
proto_item *sub_tree, *field_tree;
|
|
|
|
#define SHORT2ANGLE(x) ((float)x/65536.0*360.0)
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
move_item = proto_tree_add_text(tree,
|
|
|
|
tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].bits[Q_OFFSET],
|
|
|
|
move[i+1].bits[Q_OFFSET]-move[i].bits[Q_OFFSET],
|
2002-07-29 09:28:28 +00:00
|
|
|
"Move %u", i+1);
|
2002-08-28 21:04:11 +00:00
|
|
|
sub_tree = proto_item_add_subtree(move_item,
|
2002-07-29 09:28:28 +00:00
|
|
|
ett_quake2_game_clc_cmd_move_moves);
|
|
|
|
|
|
|
|
movebits_item =
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_uint(sub_tree, hf_quake2_game_client_command_move,
|
2002-07-29 09:28:28 +00:00
|
|
|
tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].bits[Q_OFFSET],
|
2002-07-29 09:28:28 +00:00
|
|
|
1,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].bits[Q_VALUE]);
|
2002-07-29 09:28:28 +00:00
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_uint(sub_tree,
|
2002-07-29 09:28:28 +00:00
|
|
|
hf_quake2_game_client_command_move_msec,
|
2010-02-01 19:01:56 +00:00
|
|
|
tvb, move[i].msec[Q_OFFSET], 1, move[i].msec[Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_uint(sub_tree,
|
2002-07-29 09:28:28 +00:00
|
|
|
hf_quake2_game_client_command_move_lightlevel,
|
2010-02-01 19:01:56 +00:00
|
|
|
tvb, move[i].lightlevel[Q_OFFSET], 1, move[i].lightlevel[Q_VALUE]);
|
2002-07-29 09:28:28 +00:00
|
|
|
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] == 0) {
|
2002-07-29 09:28:28 +00:00
|
|
|
proto_item_append_text(movebits_item, " (no moves)");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
field_tree = proto_item_add_subtree(movebits_item,
|
2002-07-29 09:28:28 +00:00
|
|
|
ett_quake2_game_clc_cmd_move_bitfield);
|
|
|
|
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_ANGLE1) {
|
2002-08-28 21:04:11 +00:00
|
|
|
bit_item = proto_tree_add_uint(field_tree,
|
|
|
|
hf_quake2_game_client_command_move_bitfield_angles1, tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].angles[0][Q_OFFSET], 2, move[i].bits[Q_VALUE]);
|
|
|
|
proto_item_append_text(bit_item, " (%d", move[i].angles[0][Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_item_append_text(bit_item, " = %.2f deg)",
|
2010-02-01 19:01:56 +00:00
|
|
|
SHORT2ANGLE(move[i].angles[0][Q_VALUE]));
|
2002-08-28 21:04:11 +00:00
|
|
|
}
|
|
|
|
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_ANGLE2) {
|
2002-08-28 21:04:11 +00:00
|
|
|
bit_item = proto_tree_add_uint(field_tree,
|
|
|
|
hf_quake2_game_client_command_move_bitfield_angles2, tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].angles[1][Q_OFFSET], 2, move[i].bits[Q_VALUE]);
|
|
|
|
proto_item_append_text(bit_item, " (%d", move[i].angles[1][Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_item_append_text(bit_item, " = %.2f deg)",
|
2010-02-01 19:01:56 +00:00
|
|
|
SHORT2ANGLE(move[i].angles[1][Q_VALUE]));
|
2002-08-28 21:04:11 +00:00
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_ANGLE3) {
|
2002-08-28 21:04:11 +00:00
|
|
|
bit_item = proto_tree_add_uint(field_tree,
|
|
|
|
hf_quake2_game_client_command_move_bitfield_angles3, tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].angles[2][Q_OFFSET], 2, move[i].bits[Q_VALUE]);
|
|
|
|
proto_item_append_text(bit_item, " (%d", move[i].angles[2][Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_item_append_text(bit_item, " = %.2f deg)",
|
2010-02-01 19:01:56 +00:00
|
|
|
SHORT2ANGLE(move[i].angles[2][Q_VALUE]));
|
2002-08-28 21:04:11 +00:00
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_FORWARD) {
|
2002-08-28 21:04:11 +00:00
|
|
|
bit_item = proto_tree_add_uint(field_tree,
|
|
|
|
hf_quake2_game_client_command_move_bitfield_movement_fwd, tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].movement[0][Q_OFFSET], 2, move[i].bits[Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_item_append_text(bit_item, " (%hd)",
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].movement[0][Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_SIDE) {
|
2002-08-28 21:04:11 +00:00
|
|
|
bit_item = proto_tree_add_uint(field_tree,
|
|
|
|
hf_quake2_game_client_command_move_bitfield_movement_side, tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].movement[1][Q_OFFSET], 2, move[i].bits[Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_item_append_text(bit_item, " (%hd)",
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].movement[1][Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_UP) {
|
2002-08-28 21:04:11 +00:00
|
|
|
bit_item = proto_tree_add_uint(field_tree,
|
|
|
|
hf_quake2_game_client_command_move_bitfield_movement_up, tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].movement[2][Q_OFFSET], 2, move[i].bits[Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_item_append_text(bit_item, " (%hd)",
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].movement[2][Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_BUTTONS) {
|
2002-08-28 21:04:11 +00:00
|
|
|
bit_item = proto_tree_add_uint(field_tree,
|
|
|
|
hf_quake2_game_client_command_move_bitfield_buttons, tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].buttons[Q_OFFSET], 1, move[i].bits[Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_item_append_text(bit_item, " (%d)",
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].buttons[Q_VALUE]);
|
|
|
|
if (move[i].buttons[Q_VALUE] & BUTTON_ATTACK)
|
2002-07-29 09:28:28 +00:00
|
|
|
proto_item_append_text(bit_item, " (Attack)");
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].buttons[Q_VALUE] & BUTTON_USE)
|
2002-07-29 09:28:28 +00:00
|
|
|
proto_item_append_text(bit_item, " (Use)");
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].buttons[Q_VALUE] & BUTTON_ANY)
|
2002-07-29 09:28:28 +00:00
|
|
|
proto_item_append_text(bit_item, " (Any)");
|
|
|
|
}
|
2010-02-01 19:01:56 +00:00
|
|
|
if (move[i].bits[Q_VALUE] & CM_IMPULSE) {
|
2002-08-28 21:04:11 +00:00
|
|
|
bit_item = proto_tree_add_uint(field_tree,
|
|
|
|
hf_quake2_game_client_command_move_bitfield_impulse, tvb,
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].impulse[Q_OFFSET], 1, move[i].bits[Q_VALUE]);
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_item_append_text(bit_item, " (%d)",
|
2010-02-01 19:01:56 +00:00
|
|
|
move[i].impulse[Q_VALUE]);
|
2002-07-29 09:28:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
static int
|
|
|
|
dissect_quake2_client_commands_uinfo(tvbuff_t *tvb, packet_info *pinfo _U_,
|
2002-07-29 09:28:28 +00:00
|
|
|
proto_tree *tree)
|
|
|
|
{
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
guint len;
|
2002-07-29 09:28:28 +00:00
|
|
|
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
len = tvb_strsize(tvb, 0);
|
2002-07-29 09:28:28 +00:00
|
|
|
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
if (tree) {
|
2011-05-18 00:59:24 +00:00
|
|
|
proto_tree_add_text(tree, tvb, 0, len, "Userinfo: %s",
|
|
|
|
tvb_get_ephemeral_string(tvb, 0, len));
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
}
|
2002-07-29 09:28:28 +00:00
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
2002-08-28 21:04:11 +00:00
|
|
|
static int
|
|
|
|
dissect_quake2_client_commands_stringcmd(tvbuff_t *tvb, packet_info *pinfo _U_,
|
2002-07-29 09:28:28 +00:00
|
|
|
proto_tree *tree)
|
|
|
|
{
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
guint len;
|
2002-07-29 09:28:28 +00:00
|
|
|
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
len = tvb_strsize(tvb, 0);
|
2002-07-29 09:28:28 +00:00
|
|
|
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
if (tree) {
|
2011-05-18 00:59:24 +00:00
|
|
|
proto_tree_add_text(tree, tvb, 0, len, "Command: %s",
|
|
|
|
tvb_get_ephemeral_string(tvb, 0, len));
|
For the "all the rest of the packet is just text" case, just allocate a
buffer big enough to hold all of it, copy it all, and put in a null
terminator, rather than using "tvb_get_nstringz0()".
Don't use fixed-length buffers for null-terminated strings (even if the
code that generates those packets has a #define to limit the length of
the string). Use "tvb_strsize()", and dynamically-allocated buffers,
instead (even if there's a nominal maximum packet size; that way you
don't have to remember that the argument to "tvb_get_nstringz0()" is the
size of the buffer into which you're copying the string, which might be
the length of the string to be copied *plus 1*, or remember that, if the
null terminator is found in the buffer, the return value of
"tvb_get_nstringz0()" doesn't include the null terminator).
svn path=/trunk/; revision=7858
2003-06-12 08:29:39 +00:00
|
|
|
}
|
2002-07-29 09:28:28 +00:00
|
|
|
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const value_string names_client_cmd[] = {
|
|
|
|
/* qcommon.h */
|
|
|
|
#define CLC_BAD 0
|
|
|
|
{ CLC_BAD, "clc_bad" },
|
|
|
|
#define CLC_NOP 1
|
|
|
|
{ CLC_NOP, "clc_nop" },
|
|
|
|
#define CLC_MOVE 2
|
|
|
|
{ CLC_MOVE, "clc_move" },
|
|
|
|
#define CLC_USERINFO 3
|
|
|
|
{ CLC_USERINFO, "clc_userinfo" },
|
|
|
|
#define CLC_STRINGCMD 4
|
|
|
|
{ CLC_STRINGCMD, "clc_stringcmd" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_quake2_client_commands(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
|
proto_tree *tree)
|
|
|
|
{
|
2002-07-29 09:28:28 +00:00
|
|
|
proto_tree *clc_tree = NULL;
|
|
|
|
tvbuff_t *next_tvb = NULL;
|
|
|
|
guint8 client_cmd_type;
|
|
|
|
guint rest_length = 0;
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
client_cmd_type = tvb_get_guint8(tvb, offset);
|
|
|
|
|
|
|
|
if (tree) {
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_item *cmd_type_item = proto_tree_add_uint(tree,
|
|
|
|
hf_quake2_game_client_command, tvb, offset, 1,
|
2002-07-29 09:28:28 +00:00
|
|
|
client_cmd_type);
|
|
|
|
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_item_append_text(cmd_type_item, " (%s)",
|
|
|
|
val_to_str(client_cmd_type, names_client_cmd, "%u"));
|
|
|
|
clc_tree = proto_item_add_subtree(cmd_type_item, ett_quake2_game_clc_cmd);
|
2002-07-29 09:28:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
offset++;
|
|
|
|
rest_length = tvb_reported_length(tvb) - offset;
|
2002-08-28 21:04:11 +00:00
|
|
|
if (rest_length)
|
2002-07-29 09:28:28 +00:00
|
|
|
next_tvb = tvb_new_subset(tvb, offset,
|
|
|
|
rest_length, rest_length);
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
rest_length = 0;
|
|
|
|
switch (client_cmd_type) {
|
|
|
|
case CLC_BAD:
|
|
|
|
break;
|
|
|
|
case CLC_NOP:
|
|
|
|
break;
|
|
|
|
case CLC_MOVE:
|
|
|
|
rest_length =
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_quake2_client_commands_move(next_tvb,
|
2002-07-29 09:28:28 +00:00
|
|
|
pinfo, clc_tree);
|
|
|
|
break;
|
|
|
|
case CLC_USERINFO:
|
|
|
|
rest_length =
|
|
|
|
dissect_quake2_client_commands_uinfo(next_tvb,
|
|
|
|
pinfo, clc_tree);
|
|
|
|
break;
|
|
|
|
case CLC_STRINGCMD:
|
|
|
|
rest_length =
|
2002-08-28 21:04:11 +00:00
|
|
|
dissect_quake2_client_commands_stringcmd(next_tvb,
|
2002-07-29 09:28:28 +00:00
|
|
|
pinfo, clc_tree);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
offset += rest_length;
|
|
|
|
} while (tvb_reported_length(tvb) - offset > 0);
|
2001-06-21 15:15:57 +00:00
|
|
|
}
|
|
|
|
|
2002-07-29 09:28:28 +00:00
|
|
|
static const value_string names_server_cmd[] = {
|
|
|
|
/* qcommon.h */
|
|
|
|
#define SVC_BAD 0
|
|
|
|
{ SVC_BAD, "svc_bad" },
|
|
|
|
#define SVC_MUZZLEFLASH 1
|
|
|
|
{ SVC_MUZZLEFLASH, "svc_muzzleflash" },
|
|
|
|
#define SVC_MUZZLEFLASH2 2
|
|
|
|
{ SVC_MUZZLEFLASH2, "svc_muzzleflash2" },
|
|
|
|
#define SVC_TEMP_ENTITY 3
|
|
|
|
{ SVC_TEMP_ENTITY, "svc_temp_entity" },
|
|
|
|
#define SVC_LAYOUT 4
|
|
|
|
{ SVC_LAYOUT, "svc_layout" },
|
|
|
|
#define SVC_INVENTORY 5
|
|
|
|
{ SVC_INVENTORY, "svc_inventory" },
|
|
|
|
#define SVC_NOP 6
|
|
|
|
{ SVC_NOP, "svc_nop" },
|
|
|
|
#define SVC_DISCONNECT 7
|
|
|
|
{ SVC_DISCONNECT, "svc_disconnect" },
|
|
|
|
#define SVC_RECONNECT 8
|
|
|
|
{ SVC_RECONNECT, "svc_reconnect" },
|
|
|
|
#define SVC_SOUND 9
|
|
|
|
{ SVC_SOUND, "svc_sound" },
|
|
|
|
#define SVC_PRINT 10
|
|
|
|
{ SVC_PRINT, "svc_print" },
|
|
|
|
#define SVC_STUFFTEXT 11
|
|
|
|
{ SVC_STUFFTEXT, "svc_stufftext" },
|
|
|
|
#define SVC_SERVERDATA 12
|
|
|
|
{ SVC_SERVERDATA, "svc_serverdata" },
|
|
|
|
#define SVC_CONFIGSTRING 13
|
|
|
|
{ SVC_CONFIGSTRING, "svc_configstring" },
|
|
|
|
#define SVC_SPAWNBASELINE 14
|
|
|
|
{ SVC_SPAWNBASELINE, "svc_spawnbaseline" },
|
|
|
|
#define SVC_CENTERPRINT 15
|
|
|
|
{ SVC_CENTERPRINT, "svc_centerprint" },
|
|
|
|
#define SVC_DOWNLOAD 16
|
|
|
|
{ SVC_DOWNLOAD, "svc_download" },
|
|
|
|
#define SVC_PLAYERINFO 17
|
|
|
|
{ SVC_PLAYERINFO, "svc_playerinfo" },
|
|
|
|
#define SVC_PACKETENTITIES 18
|
|
|
|
{ SVC_PACKETENTITIES, "svc_packetentities" },
|
|
|
|
#define SVC_DELTAPACKETENTITIES 19
|
|
|
|
{ SVC_DELTAPACKETENTITIES, "svc_deltapacketentities" },
|
|
|
|
#define SVC_FRAME 20
|
|
|
|
{ SVC_FRAME, "svc_frame" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_quake2_server_commands(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
|
proto_tree *tree)
|
|
|
|
{
|
2002-07-29 09:28:28 +00:00
|
|
|
tvbuff_t *next_tvb = NULL;
|
|
|
|
guint8 server_cmd_type;
|
|
|
|
guint rest_length = 0;
|
|
|
|
int offset = 0;
|
|
|
|
|
|
|
|
server_cmd_type = tvb_get_guint8(tvb, offset);
|
|
|
|
|
|
|
|
if (tree) {
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_item *cmd_type_item;
|
2002-08-28 21:04:11 +00:00
|
|
|
cmd_type_item = proto_tree_add_uint(tree,
|
2002-07-29 09:28:28 +00:00
|
|
|
hf_quake2_game_server_command, tvb, offset, 1, server_cmd_type);
|
|
|
|
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_item_append_text(cmd_type_item, " (%s)",
|
|
|
|
val_to_str(server_cmd_type, names_server_cmd, "%u"));
|
2002-07-29 09:28:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
offset++;
|
|
|
|
rest_length = tvb_reported_length(tvb) - offset;
|
2002-08-28 21:04:11 +00:00
|
|
|
if (rest_length)
|
2002-07-29 09:28:28 +00:00
|
|
|
next_tvb = tvb_new_subset(tvb, offset, rest_length, rest_length);
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
switch (server_cmd_type) {
|
|
|
|
case SVC_BAD:
|
|
|
|
break;
|
|
|
|
case SVC_MUZZLEFLASH:
|
|
|
|
break;
|
|
|
|
case SVC_MUZZLEFLASH2:
|
|
|
|
break;
|
|
|
|
case SVC_TEMP_ENTITY:
|
|
|
|
break;
|
|
|
|
case SVC_LAYOUT:
|
|
|
|
break;
|
|
|
|
case SVC_NOP:
|
|
|
|
break;
|
|
|
|
case SVC_DISCONNECT:
|
|
|
|
break;
|
|
|
|
case SVC_RECONNECT:
|
|
|
|
break;
|
|
|
|
case SVC_SOUND:
|
|
|
|
break;
|
|
|
|
case SVC_PRINT:
|
|
|
|
break;
|
|
|
|
case SVC_STUFFTEXT:
|
|
|
|
break;
|
|
|
|
case SVC_SERVERDATA:
|
|
|
|
break;
|
|
|
|
case SVC_CONFIGSTRING:
|
|
|
|
break;
|
|
|
|
case SVC_SPAWNBASELINE:
|
|
|
|
break;
|
|
|
|
case SVC_CENTERPRINT:
|
|
|
|
break;
|
|
|
|
case SVC_DOWNLOAD:
|
|
|
|
break;
|
|
|
|
case SVC_PLAYERINFO:
|
|
|
|
break;
|
|
|
|
case SVC_PACKETENTITIES:
|
|
|
|
break;
|
|
|
|
case SVC_DELTAPACKETENTITIES:
|
|
|
|
break;
|
|
|
|
case SVC_FRAME:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
call_dissector(data_handle, next_tvb, pinfo, tree);
|
2001-06-21 15:15:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const value_string names_reliable[] = {
|
|
|
|
{ 0, "Non Reliable" },
|
|
|
|
{ 1, "Reliable" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string names_direction[] = {
|
|
|
|
#define DIR_C2S 0
|
|
|
|
{ DIR_C2S, "Client to Server" },
|
|
|
|
#define DIR_S2C 1
|
|
|
|
{ DIR_S2C, "Server to Client" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_quake2_GamePacket(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
|
proto_tree *tree, int direction)
|
|
|
|
{
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_tree *game_tree = NULL;
|
|
|
|
guint32 seq1;
|
|
|
|
guint32 seq2;
|
|
|
|
int rel1;
|
|
|
|
int rel2;
|
|
|
|
int offset;
|
|
|
|
guint rest_length;
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
direction = (pinfo->destport == gbl_quake2ServerPort) ?
|
|
|
|
DIR_C2S : DIR_S2C;
|
|
|
|
|
|
|
|
if (tree) {
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_item *game_item;
|
2001-06-21 15:15:57 +00:00
|
|
|
game_item = proto_tree_add_text(tree, tvb,
|
2002-01-24 09:20:54 +00:00
|
|
|
0, -1, "Game");
|
2010-06-09 17:16:33 +00:00
|
|
|
game_tree = proto_item_add_subtree(game_item, ett_quake2_game);
|
2001-06-21 15:15:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
offset = 0;
|
|
|
|
|
|
|
|
seq1 = tvb_get_letohl(tvb, offset);
|
|
|
|
rel1 = seq1 & 0x80000000 ? 1 : 0;
|
|
|
|
seq1 &= ~0x80000000;
|
|
|
|
if (game_tree) {
|
|
|
|
proto_item *seq1_item = proto_tree_add_text(game_tree,
|
|
|
|
tvb, offset, 4, "Current Sequence: %u (%s)",
|
|
|
|
seq1, val_to_str(rel1,names_reliable,"%u"));
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_tree *seq1_tree = proto_item_add_subtree(
|
|
|
|
seq1_item, ett_quake2_game_seq1);
|
|
|
|
proto_tree_add_uint(seq1_tree, hf_quake2_game_seq1,
|
|
|
|
tvb, offset, 4, seq1);
|
|
|
|
proto_tree_add_boolean(seq1_tree, hf_quake2_game_rel1,
|
|
|
|
tvb, offset+3, 1, rel1);
|
2001-06-21 15:15:57 +00:00
|
|
|
}
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
seq2 = tvb_get_letohl(tvb, offset);
|
|
|
|
rel2 = seq2 & 0x80000000 ? 1 : 0;
|
|
|
|
seq2 &= ~0x80000000;
|
|
|
|
if (game_tree) {
|
|
|
|
proto_item *seq2_item = proto_tree_add_text(game_tree,
|
|
|
|
tvb, offset, 4, "Acknowledge Sequence: %u (%s)",
|
2003-09-21 20:06:02 +00:00
|
|
|
seq2, val_to_str(rel2,names_reliable,"%u"));
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_tree *seq2_tree = proto_item_add_subtree(
|
|
|
|
seq2_item, ett_quake2_game_seq2);
|
|
|
|
proto_tree_add_uint(seq2_tree, hf_quake2_game_seq2,
|
|
|
|
tvb, offset, 4, seq2);
|
|
|
|
proto_tree_add_boolean(seq2_tree, hf_quake2_game_rel2,
|
|
|
|
tvb, offset+3, 1, rel2);
|
2001-06-21 15:15:57 +00:00
|
|
|
}
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
if (direction == DIR_C2S) {
|
|
|
|
/* client to server */
|
|
|
|
guint16 qport = tvb_get_letohs(tvb, offset);
|
|
|
|
if (game_tree) {
|
2002-08-28 21:04:11 +00:00
|
|
|
proto_tree_add_uint(game_tree, hf_quake2_game_qport,
|
2001-06-21 15:15:57 +00:00
|
|
|
tvb, offset, 2, qport);
|
|
|
|
}
|
|
|
|
offset +=2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* all the rest is pure game data */
|
|
|
|
rest_length = tvb_reported_length(tvb) - offset;
|
|
|
|
if (rest_length) {
|
|
|
|
tvbuff_t *next_tvb =
|
|
|
|
tvb_new_subset(tvb, offset, rest_length , rest_length);
|
|
|
|
|
|
|
|
if (direction == DIR_C2S) {
|
|
|
|
proto_tree *c_tree = NULL;
|
|
|
|
if (tree) {
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_item *c_item;
|
2001-06-21 15:15:57 +00:00
|
|
|
c_item = proto_tree_add_text(game_tree, next_tvb,
|
2010-06-09 17:16:33 +00:00
|
|
|
0, -1, "Client Commands");
|
|
|
|
c_tree = proto_item_add_subtree(c_item, ett_quake2_game_clc);
|
2001-06-21 15:15:57 +00:00
|
|
|
}
|
|
|
|
dissect_quake2_client_commands(next_tvb, pinfo, c_tree);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
proto_tree *c_tree = NULL;
|
|
|
|
if (tree) {
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_item *c_item;
|
2001-06-21 15:15:57 +00:00
|
|
|
c_item = proto_tree_add_text(game_tree, next_tvb,
|
2010-06-09 17:16:33 +00:00
|
|
|
0, -1, "Server Commands");
|
|
|
|
c_tree = proto_item_add_subtree(c_item, ett_quake2_game_svc);
|
2001-06-21 15:15:57 +00:00
|
|
|
}
|
|
|
|
dissect_quake2_server_commands(next_tvb, pinfo, c_tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
dissect_quake2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
proto_tree *quake2_tree = NULL;
|
|
|
|
int direction;
|
|
|
|
|
|
|
|
direction = (pinfo->destport == gbl_quake2ServerPort) ?
|
|
|
|
DIR_C2S : DIR_S2C;
|
|
|
|
|
2009-08-09 06:26:46 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKE2");
|
2001-12-10 00:26:21 +00:00
|
|
|
if (check_col(pinfo->cinfo, COL_INFO))
|
2007-11-08 22:49:03 +00:00
|
|
|
col_add_str(pinfo->cinfo, COL_INFO, val_to_str(direction,
|
2001-06-21 15:15:57 +00:00
|
|
|
names_direction, "%u"));
|
|
|
|
|
|
|
|
if (tree) {
|
2010-06-09 17:16:33 +00:00
|
|
|
proto_item *quake2_item;
|
2001-06-21 15:15:57 +00:00
|
|
|
quake2_item = proto_tree_add_item(tree, proto_quake2,
|
2011-10-21 02:10:19 +00:00
|
|
|
tvb, 0, -1, ENC_NA);
|
2010-06-09 17:16:33 +00:00
|
|
|
quake2_tree = proto_item_add_subtree(quake2_item, ett_quake2);
|
|
|
|
proto_tree_add_uint_format(quake2_tree,
|
|
|
|
direction == DIR_S2C ?
|
|
|
|
hf_quake2_s2c :
|
|
|
|
hf_quake2_c2s,
|
|
|
|
tvb, 0, 0, 1,
|
|
|
|
"Direction: %s", val_to_str(direction, names_direction, "%u"));
|
2001-06-21 15:15:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (tvb_get_ntohl(tvb, 0) == 0xffffffff) {
|
2009-09-24 20:00:21 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, " Connectionless");
|
2001-06-21 15:15:57 +00:00
|
|
|
if (quake2_tree)
|
|
|
|
proto_tree_add_uint_format(quake2_tree,
|
|
|
|
hf_quake2_connectionless,
|
|
|
|
tvb, 0, 0, 1,
|
|
|
|
"Type: Connectionless");
|
|
|
|
dissect_quake2_ConnectionlessPacket(
|
|
|
|
tvb, pinfo, quake2_tree, direction);
|
|
|
|
}
|
|
|
|
else {
|
2009-09-24 20:00:21 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, " Game");
|
2001-06-21 15:15:57 +00:00
|
|
|
if (quake2_tree)
|
|
|
|
proto_tree_add_uint_format(quake2_tree,
|
|
|
|
hf_quake2_game,
|
|
|
|
tvb, 0, 0, 1,
|
|
|
|
"Type: Game");
|
|
|
|
dissect_quake2_GamePacket(
|
|
|
|
tvb, pinfo, quake2_tree, direction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-09 17:16:33 +00:00
|
|
|
void proto_reg_handoff_quake2(void);
|
2001-06-21 15:15:57 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_quake2(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_quake2_c2s,
|
|
|
|
{ "Client to Server", "quake2.c2s",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2001-06-21 15:15:57 +00:00
|
|
|
{ &hf_quake2_s2c,
|
|
|
|
{ "Server to Client", "quake2.s2c",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2001-06-21 15:15:57 +00:00
|
|
|
{ &hf_quake2_connectionless,
|
|
|
|
{ "Connectionless", "quake2.connectionless",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2001-06-21 15:15:57 +00:00
|
|
|
{ &hf_quake2_game,
|
|
|
|
{ "Game", "quake2.game",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2001-06-21 15:15:57 +00:00
|
|
|
{ &hf_quake2_connectionless_marker,
|
|
|
|
{ "Marker", "quake2.connectionless.marker",
|
|
|
|
FT_UINT32, BASE_HEX, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }},
|
2001-06-21 15:15:57 +00:00
|
|
|
{ &hf_quake2_connectionless_text,
|
|
|
|
{ "Text", "quake2.connectionless.text",
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
FT_STRING, BASE_NONE, NULL, 0x0,
|
|
|
|
NULL, HFILL }},
|
2001-06-21 15:15:57 +00:00
|
|
|
{ &hf_quake2_game_seq1,
|
|
|
|
{ "Sequence Number", "quake2.game.seq1",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Sequence number of the current packet", HFILL }},
|
|
|
|
{ &hf_quake2_game_rel1,
|
|
|
|
{ "Reliable", "quake2.game.rel1",
|
2009-05-08 20:35:57 +00:00
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
2001-06-21 15:15:57 +00:00
|
|
|
"Packet is reliable and may be retransmitted", HFILL }},
|
|
|
|
{ &hf_quake2_game_seq2,
|
|
|
|
{ "Sequence Number", "quake2.game.seq2",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Sequence number of the last received packet", HFILL }},
|
|
|
|
{ &hf_quake2_game_rel2,
|
|
|
|
{ "Reliable", "quake2.game.rel2",
|
2009-05-08 20:35:57 +00:00
|
|
|
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
2001-06-21 15:15:57 +00:00
|
|
|
"Packet was reliable and may be retransmitted", HFILL }},
|
|
|
|
{ &hf_quake2_game_qport,
|
|
|
|
{ "QPort", "quake2.game.qport",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
2002-07-29 09:28:28 +00:00
|
|
|
"Quake II Client Port", HFILL }},
|
|
|
|
{ &hf_quake2_game_client_command,
|
|
|
|
{ "Client Command Type", "quake2.game.client.command",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Quake II Client Command", HFILL }},
|
|
|
|
{ &hf_quake2_game_server_command,
|
|
|
|
{ "Server Command", "quake2.game.server.command",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Quake II Server Command", HFILL }},
|
|
|
|
{ &hf_quake2_game_client_command_move_chksum,
|
|
|
|
{ "Checksum", "quake2.game.client.command.move.chksum",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
|
|
|
"Quake II Client Command Move", HFILL }},
|
|
|
|
{ &hf_quake2_game_client_command_move_lframe,
|
|
|
|
{ "Last Frame", "quake2.game.client.command.move.lframe",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
"Quake II Client Command Move", HFILL }},
|
|
|
|
{ &hf_quake2_game_client_command_move,
|
|
|
|
{ "Bitfield", "quake2.game.client.command.move",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
|
|
|
"Quake II Client Command Move", HFILL }},
|
|
|
|
{ &hf_quake2_game_client_command_move_bitfield_angles1,
|
|
|
|
{ "Angles (pitch)", "quake2.game.client.command.move.angles",
|
2002-08-28 21:04:11 +00:00
|
|
|
FT_UINT8, BASE_HEX,
|
2002-07-29 09:28:28 +00:00
|
|
|
VALS(hf_quake2_game_client_command_move_vals),
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
CM_ANGLE1, NULL, HFILL }},
|
2002-07-29 09:28:28 +00:00
|
|
|
{ &hf_quake2_game_client_command_move_bitfield_angles2,
|
|
|
|
{ "Angles (yaw)", "quake2.game.client.command.move.angles",
|
2002-08-28 21:04:11 +00:00
|
|
|
FT_UINT8, BASE_HEX,
|
2002-07-29 09:28:28 +00:00
|
|
|
VALS(hf_quake2_game_client_command_move_vals),
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
CM_ANGLE2, NULL, HFILL }},
|
2002-07-29 09:28:28 +00:00
|
|
|
{ &hf_quake2_game_client_command_move_bitfield_angles3,
|
|
|
|
{ "Angles (roll)", "quake2.game.client.command.move.angles",
|
2002-08-28 21:04:11 +00:00
|
|
|
FT_UINT8, BASE_HEX,
|
2002-07-29 09:28:28 +00:00
|
|
|
VALS(hf_quake2_game_client_command_move_vals),
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
CM_ANGLE3, NULL, HFILL }},
|
2002-07-29 09:28:28 +00:00
|
|
|
{ &hf_quake2_game_client_command_move_bitfield_movement_fwd,
|
|
|
|
{ "Movement (fwd)", "quake2.game.client.command.move.movement",
|
2002-08-28 21:04:11 +00:00
|
|
|
FT_UINT8, BASE_HEX,
|
2002-07-29 09:28:28 +00:00
|
|
|
VALS(hf_quake2_game_client_command_move_vals),
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
CM_FORWARD, NULL, HFILL }},
|
2002-07-29 09:28:28 +00:00
|
|
|
{ &hf_quake2_game_client_command_move_bitfield_movement_side,
|
|
|
|
{ "Movement (side)", "quake2.game.client.command.move.movement",
|
|
|
|
FT_UINT8, BASE_HEX,
|
|
|
|
VALS(hf_quake2_game_client_command_move_vals),
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
CM_SIDE, NULL, HFILL }},
|
2002-07-29 09:28:28 +00:00
|
|
|
{ &hf_quake2_game_client_command_move_bitfield_movement_up,
|
|
|
|
{ "Movement (up)", "quake2.game.client.command.move.movement",
|
2002-08-28 21:04:11 +00:00
|
|
|
FT_UINT8, BASE_HEX,
|
2002-07-29 09:28:28 +00:00
|
|
|
VALS(hf_quake2_game_client_command_move_vals),
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
CM_UP, NULL, HFILL }},
|
2002-07-29 09:28:28 +00:00
|
|
|
{ &hf_quake2_game_client_command_move_bitfield_buttons,
|
|
|
|
{ "Buttons", "quake2.game.client.command.move.buttons",
|
2002-08-28 21:04:11 +00:00
|
|
|
FT_UINT8, BASE_HEX,
|
2002-07-29 09:28:28 +00:00
|
|
|
VALS(hf_quake2_game_client_command_move_vals),
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
CM_BUTTONS, NULL, HFILL }},
|
2002-07-29 09:28:28 +00:00
|
|
|
{ &hf_quake2_game_client_command_move_bitfield_impulse,
|
|
|
|
{ "Impulse", "quake2.game.client.command.move.impulse",
|
2002-08-28 21:04:11 +00:00
|
|
|
FT_UINT8, BASE_HEX,
|
2002-07-29 09:28:28 +00:00
|
|
|
VALS(hf_quake2_game_client_command_move_vals),
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
CM_IMPULSE, NULL, HFILL }},
|
2002-07-29 09:28:28 +00:00
|
|
|
{ &hf_quake2_game_client_command_move_msec,
|
|
|
|
{ "Msec", "quake2.game.client.command.move.msec",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Quake II Client Command Move", HFILL }},
|
|
|
|
{ &hf_quake2_game_client_command_move_lightlevel,
|
|
|
|
{ "Lightlevel", "quake2.game.client.command.move.lightlevel",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
|
|
|
"Quake II Client Command Move", HFILL }}
|
2001-06-21 15:15:57 +00:00
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_quake2,
|
|
|
|
&ett_quake2_connectionless,
|
|
|
|
&ett_quake2_game,
|
|
|
|
&ett_quake2_game_seq1,
|
|
|
|
&ett_quake2_game_seq2,
|
|
|
|
&ett_quake2_game_clc,
|
2002-07-29 09:28:28 +00:00
|
|
|
&ett_quake2_game_svc,
|
|
|
|
&ett_quake2_game_clc_cmd,
|
|
|
|
&ett_quake2_game_svc_cmd,
|
|
|
|
&ett_quake2_game_clc_cmd_move_moves,
|
|
|
|
&ett_quake2_game_clc_cmd_move_bitfield
|
2001-06-21 15:15:57 +00:00
|
|
|
};
|
|
|
|
module_t *quake2_module;
|
|
|
|
|
|
|
|
proto_quake2 = proto_register_protocol("Quake II Network Protocol",
|
|
|
|
"QUAKE2", "quake2");
|
|
|
|
proto_register_field_array(proto_quake2, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
/* Register a configuration option for port */
|
|
|
|
quake2_module = prefs_register_protocol(proto_quake2,
|
|
|
|
proto_reg_handoff_quake2);
|
|
|
|
prefs_register_uint_preference(quake2_module, "udp.port",
|
|
|
|
"Quake II Server UDP Port",
|
|
|
|
"Set the UDP port for the Quake II Server",
|
|
|
|
10, &gbl_quake2ServerPort);
|
|
|
|
}
|
2010-06-09 17:16:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_quake2(void)
|
|
|
|
{
|
|
|
|
static gboolean Initialized=FALSE;
|
|
|
|
static dissector_handle_t quake2_handle;
|
|
|
|
static guint ServerPort;
|
|
|
|
|
|
|
|
if (!Initialized) {
|
|
|
|
quake2_handle = create_dissector_handle(dissect_quake2,
|
|
|
|
proto_quake2);
|
|
|
|
data_handle = find_dissector("data");
|
|
|
|
Initialized=TRUE;
|
|
|
|
} else {
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_delete_uint("udp.port", ServerPort, quake2_handle);
|
2010-06-09 17:16:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* set port for future deletes */
|
|
|
|
ServerPort=gbl_quake2ServerPort;
|
|
|
|
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("udp.port", gbl_quake2ServerPort, quake2_handle);
|
2010-06-09 17:16:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|