*
* $Id$
*
- * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@ethereal.com>
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* Copied from packet-quake2.c
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
-#include "prefs.h"
+#include <epan/prefs.h>
#include <epan/addr_resolv.h>
static int proto_quake3 = -1;
#define QUAKE3_SERVER_PORT 27960
#define QUAKE3_MASTER_PORT 27950
-static unsigned int gbl_quake3_server_port=QUAKE3_SERVER_PORT;
-static unsigned int gbl_quake3_master_port=QUAKE3_MASTER_PORT;
+static guint gbl_quake3_server_port=QUAKE3_SERVER_PORT;
+static guint gbl_quake3_master_port=QUAKE3_MASTER_PORT;
static const value_string names_direction[] = {
proto_item *server_item = NULL;
proto_tree *server_tree = NULL;
- tvb_memcpy(tvb, (guint8 *)&ip_addr, base + 1, 4);
+ ip_addr = tvb_get_ipv4(tvb, base + 1);
udp_port = tvb_get_ntohs(tvb, base + 5);
/* It may be a good idea to create a conversation for
direction = DIR_UNKNOWN;
- if (check_col(pinfo->cinfo, COL_PROTOCOL))
- col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKE3");
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "QUAKE3");
if (tree) {
quake3_item = proto_tree_add_item(tree, proto_quake3,
}
if (tvb_get_ntohl(tvb, 0) == 0xffffffff) {
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_set_str(pinfo->cinfo, COL_INFO, "Connectionless ");
- }
+ col_set_str(pinfo->cinfo, COL_INFO, "Connectionless ");
if (quake3_tree)
proto_tree_add_uint_format(quake3_tree,
hf_quake3_connectionless,
tvb, pinfo, quake3_tree, &direction);
}
else {
- if (check_col(pinfo->cinfo, COL_INFO)) {
- col_set_str(pinfo->cinfo, COL_INFO, "Game ");
- }
+ col_set_str(pinfo->cinfo, COL_INFO, "Game ");
if (quake3_tree)
proto_tree_add_uint_format(quake3_tree,
hf_quake3_game,
void
proto_reg_handoff_quake3(void)
{
- static int initialized=FALSE;
+ static gboolean initialized=FALSE;
static dissector_handle_t quake3_handle;
- static int server_port;
- static int master_port;
+ static guint server_port;
+ static guint master_port;
int i;
if (!initialized) {
quake3_handle = create_dissector_handle(dissect_quake3,
proto_quake3);
+ data_handle = find_dissector("data");
initialized=TRUE;
} else {
for (i=0;i<4;i++)
for (i=0;i<4;i++)
dissector_add("udp.port", gbl_quake3_master_port + i,
quake3_handle);
- data_handle = find_dissector("data");
}
static hf_register_info hf[] = {
{ &hf_quake3_direction,
{ "Direction", "quake3.direction",
- FT_NONE, BASE_DEC, NULL, 0x0,
+ FT_NONE, BASE_NONE, NULL, 0x0,
"Packet Direction", HFILL }},
{ &hf_quake3_connectionless,
{ "Connectionless", "quake3.connectionless",
FT_UINT32, BASE_DEC, NULL, 0x0,
- "Connectionless", HFILL }},
+ NULL, HFILL }},
{ &hf_quake3_game,
{ "Game", "quake3.game",
FT_UINT32, BASE_DEC, NULL, 0x0,
- "Game", HFILL }},
+ NULL, HFILL }},
{ &hf_quake3_connectionless_marker,
{ "Marker", "quake3.connectionless.marker",
FT_UINT32, BASE_HEX, NULL, 0x0,
- "Marker", HFILL }},
+ NULL, HFILL }},
{ &hf_quake3_connectionless_text,
{ "Text", "quake3.connectionless.text",
- FT_STRING, BASE_DEC, NULL, 0x0,
- "Text", HFILL }},
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_quake3_connectionless_command,
{ "Command", "quake3.connectionless.command",
- FT_STRING, BASE_DEC, NULL, 0x0,
- "Command", HFILL }},
+ FT_STRING, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }},
{ &hf_quake3_server_addr,
{ "Server Address", "quake3.server.addr",
- FT_IPv4, BASE_DEC, NULL, 0x0,
+ FT_IPv4, BASE_NONE, NULL, 0x0,
"Server IP Address", HFILL }},
{ &hf_quake3_server_port,
{ "Server Port", "quake3.server.port",
"Sequence number of the current packet", HFILL }},
{ &hf_quake3_game_rel1,
{ "Reliable", "quake3.game.rel1",
- FT_BOOLEAN, BASE_DEC, NULL, 0x0,
+ FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Packet is reliable and may be retransmitted", HFILL }},
{ &hf_quake3_game_seq2,
{ "Sequence Number", "quake3.game.seq2",
"Sequence number of the last received packet", HFILL }},
{ &hf_quake3_game_rel2,
{ "Reliable", "quake3.game.rel2",
- FT_BOOLEAN, BASE_DEC, NULL, 0x0,
+ FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"Packet was reliable and may be retransmitted", HFILL }},
{ &hf_quake3_game_qport,
{ "QPort", "quake3.game.qport",