* http://www.dgs.monash.edu.au/~timf/bottim/
* http://www.opt-sci.Arizona.EDU/Pandora/default.asp
*
- * $Id: packet-quake2.c,v 1.1 2001/06/21 15:15:57 girlich Exp $
+ * $Id: packet-quake2.c,v 1.9 2002/01/24 09:20:50 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
*
* Copied from packet-quakeworld.c
#endif
#include <glib.h>
-#include "packet.h"
+#include <epan/packet.h>
#include "prefs.h"
static int proto_quake2 = -1;
static gint ett_quake2_game_clc = -1;
static gint ett_quake2_game_svc = -1;
+static dissector_handle_t data_handle;
#define PORT_MASTER 27910
static unsigned int gbl_quake2ServerPort=PORT_MASTER;
marker = tvb_get_ntohl(tvb, 0);
if (tree) {
cl_item = proto_tree_add_text(tree, tvb,
- 0, tvb_length(tvb), "Connectionless");
+ 0, -1, "Connectionless");
if (cl_item)
cl_tree = proto_item_add_subtree(
cl_item, ett_quake2_connectionless);
maxbufsize = MIN((gint)sizeof(text), tvb_length_remaining(tvb, offset));
len = tvb_get_nstringz0(tvb, offset, maxbufsize, text);
- if (tree) {
+ if (cl_tree) {
proto_tree_add_string(cl_tree, hf_quake2_connectionless_text,
tvb, offset, len + 1, text);
}
the information from my DM2 specs:
http://www.planetquake.com/demospecs/dm2/
*/
- dissect_data(tvb, 0, pinfo, tree);
+ call_dissector(data_handle,tvb, pinfo, tree);
}
the information from my DM2 specs:
http://www.planetquake.com/demospecs/dm2/
*/
- dissect_data(tvb, 0, pinfo, tree);
+ call_dissector(data_handle,tvb, pinfo, tree);
}
if (tree) {
game_item = proto_tree_add_text(tree, tvb,
- 0, tvb_length(tvb), "Game");
+ 0, -1, "Game");
if (game_item)
game_tree = proto_item_add_subtree(
game_item, ett_quake2_game);
proto_tree *c_tree = NULL;
if (tree) {
c_item = proto_tree_add_text(game_tree, next_tvb,
- 0, tvb_length(next_tvb),
- "Client Commands");
+ 0, -1, "Client Commands");
if (c_item) {
c_tree = proto_item_add_subtree(
c_item, ett_quake2_game_clc);
proto_tree *c_tree = NULL;
if (tree) {
c_item = proto_tree_add_text(game_tree, next_tvb,
- 0, tvb_length(next_tvb),
- "Server Commands");
+ 0, -1, "Server Commands");
if (c_item) {
c_tree = proto_item_add_subtree(
c_item, ett_quake2_game_svc);
proto_item *quake2_item = NULL;
int direction;
- /*
- * XXX - this is a conversation dissector, and the code to
- * call a conversation dissector doesn't check for disabled
- * protocols or set "pinfo->current_proto".
- */
- CHECK_DISPLAY_AS_DATA(proto_quake2, tvb, pinfo, tree);
-
direction = (pinfo->destport == gbl_quake2ServerPort) ?
DIR_C2S : DIR_S2C;
- pinfo->current_proto = "QUAKE2";
-
- if (check_col(pinfo->fd, COL_PROTOCOL))
- col_set_str(pinfo->fd, COL_PROTOCOL, "QUAKE2");
- if (check_col(pinfo->fd, COL_INFO))
- col_set_str(pinfo->fd, COL_INFO, val_to_str(direction,
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKE2");
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_set_str(pinfo->cinfo, COL_INFO, val_to_str(direction,
names_direction, "%u"));
if (tree) {
quake2_item = proto_tree_add_item(tree, proto_quake2,
- tvb, 0, tvb_length(tvb), FALSE);
+ tvb, 0, -1, FALSE);
if (quake2_item)
quake2_tree = proto_item_add_subtree(
quake2_item, ett_quake2);
}
if (tvb_get_ntohl(tvb, 0) == 0xffffffff) {
- if (check_col(pinfo->fd, COL_INFO)) {
- col_append_str(pinfo->fd, COL_INFO, " Connectionless");
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_str(pinfo->cinfo, COL_INFO, " Connectionless");
}
if (quake2_tree)
proto_tree_add_uint_format(quake2_tree,
tvb, pinfo, quake2_tree, direction);
}
else {
- if (check_col(pinfo->fd, COL_INFO)) {
- col_append_str(pinfo->fd, COL_INFO, " Game");
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_append_str(pinfo->cinfo, COL_INFO, " Game");
}
if (quake2_tree)
proto_tree_add_uint_format(quake2_tree,
proto_reg_handoff_quake2(void)
{
static int Initialized=FALSE;
+ static dissector_handle_t quake2_handle;
static int ServerPort=0;
- if (Initialized) {
- dissector_delete("udp.port", ServerPort, dissect_quake2);
- } else {
+ if (!Initialized) {
+ quake2_handle = create_dissector_handle(dissect_quake2,
+ proto_quake2);
Initialized=TRUE;
+ } else {
+ dissector_delete("udp.port", ServerPort, quake2_handle);
}
/* set port for future deletes */
ServerPort=gbl_quake2ServerPort;
- dissector_add("udp.port", gbl_quake2ServerPort,
- dissect_quake2, proto_quake2);
+ dissector_add("udp.port", gbl_quake2ServerPort, quake2_handle);
+ data_handle = find_dissector("data");
}
"Set the UDP port for the Quake II Server",
10, &gbl_quake2ServerPort);
}
-