aboutsummaryrefslogtreecommitdiffstats
path: root/packet-quake.c
diff options
context:
space:
mode:
authorUwe Girlich <Uwe.Girlich@philosys.de>2000-07-31 12:59:51 +0000
committerUwe Girlich <Uwe.Girlich@philosys.de>2000-07-31 12:59:51 +0000
commit682f88aa5c817526480c00d1fb93777a67734645 (patch)
tree6e6c5fc51079c9310dae0ec0d3ab1370e1bbaa67 /packet-quake.c
parent3d20d56999e06c024135fcbc49e894b7de1f8991 (diff)
Dissector now knows the actual game data communication too.
svn path=/trunk/; revision=2191
Diffstat (limited to 'packet-quake.c')
-rw-r--r--packet-quake.c134
1 files changed, 88 insertions, 46 deletions
diff --git a/packet-quake.c b/packet-quake.c
index 08b863dc1d..dbf648c392 100644
--- a/packet-quake.c
+++ b/packet-quake.c
@@ -4,7 +4,7 @@
* Uwe Girlich <uwe@planetquake.com>
* http://www.idsoftware.com/q1source/q1source.zip
*
- * $Id: packet-quake.c,v 1.1 2000/07/27 10:57:12 girlich Exp $
+ * $Id: packet-quake.c,v 1.2 2000/07/31 12:59:51 girlich Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -41,6 +41,7 @@
#include <glib.h>
#include "packet.h"
+#include "conversation.h"
static int proto_quake = -1;
static int hf_quake_header_flags = -1;
@@ -76,6 +77,7 @@ static int hf_quake_CCREP_RULE_INFO_value = -1;
static gint ett_quake = -1;
static gint ett_quake_control = -1;
static gint ett_quake_control_colors = -1;
+static gint ett_quake_flags = -1;
/* I took these names directly out of the Q1 source. */
@@ -149,6 +151,13 @@ static const value_string names_colors[] = {
};
+#if 0
+static void dissect_quake(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
+#else
+static void dissect_quake(const u_char *pd, int offset, frame_data *fd, proto_tree *tree);
+#endif
+
+
static gint
tvb_get_stringz(tvbuff_t *tvb, gint offset, gint maxlength, guint8* buffer)
{
@@ -257,8 +266,13 @@ dissect_quake_CCREP_ACCEPT
(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint32 port;
+ conversation_t *c;
port = tvb_get_letohl(tvb, 0);
+ c = conversation_new( &pi.src, &pi.dst, PT_UDP, port, pi.destport, NULL);
+ if (c) {
+ c->dissector = dissect_quake;
+ }
if (tree) {
proto_tree_add_uint(tree, hf_quake_CCREP_ACCEPT_port,
tvb, 0, 4, port);
@@ -473,50 +487,50 @@ dissect_quake_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
ett_quake_control);
proto_tree_add_uint(control_tree, hf_quake_control_command,
tvb, 0, 1, command);
+ }
- rest_length = tvb_reported_length(tvb) - 1;
- next_tvb = tvb_new_subset(tvb, 1, rest_length , rest_length);
- switch (command) {
- case CCREQ_CONNECT:
- dissect_quake_CCREQ_CONNECT
- (next_tvb, pinfo, control_tree);
- break;
- case CCREQ_SERVER_INFO:
- dissect_quake_CCREQ_SERVER_INFO
- (next_tvb, pinfo, control_tree);
- break;
- case CCREQ_PLAYER_INFO:
- dissect_quake_CCREQ_PLAYER_INFO
- (next_tvb, pinfo, control_tree);
- break;
- case CCREQ_RULE_INFO:
- dissect_quake_CCREQ_RULE_INFO
- (next_tvb, pinfo, control_tree);
- break;
- case CCREP_ACCEPT:
- dissect_quake_CCREP_ACCEPT
- (next_tvb, pinfo, control_tree);
- break;
- case CCREP_REJECT:
- dissect_quake_CCREP_REJECT
- (next_tvb, pinfo, control_tree);
- break;
- case CCREP_SERVER_INFO:
- dissect_quake_CCREP_SERVER_INFO
- (next_tvb, pinfo, control_tree);
- break;
- case CCREP_PLAYER_INFO:
- dissect_quake_CCREP_PLAYER_INFO
- (next_tvb, pinfo, control_tree);
- break;
- case CCREP_RULE_INFO:
- dissect_quake_CCREP_RULE_INFO
- (next_tvb, pinfo, control_tree);
- break;
- default:
- dissect_data_tvb(next_tvb, pinfo, control_tree);
- break;
- }
+ rest_length = tvb_reported_length(tvb) - 1;
+ next_tvb = tvb_new_subset(tvb, 1, rest_length , rest_length);
+ switch (command) {
+ case CCREQ_CONNECT:
+ dissect_quake_CCREQ_CONNECT
+ (next_tvb, pinfo, control_tree);
+ break;
+ case CCREQ_SERVER_INFO:
+ dissect_quake_CCREQ_SERVER_INFO
+ (next_tvb, pinfo, control_tree);
+ break;
+ case CCREQ_PLAYER_INFO:
+ dissect_quake_CCREQ_PLAYER_INFO
+ (next_tvb, pinfo, control_tree);
+ break;
+ case CCREQ_RULE_INFO:
+ dissect_quake_CCREQ_RULE_INFO
+ (next_tvb, pinfo, control_tree);
+ break;
+ case CCREP_ACCEPT:
+ dissect_quake_CCREP_ACCEPT
+ (next_tvb, pinfo, control_tree);
+ break;
+ case CCREP_REJECT:
+ dissect_quake_CCREP_REJECT
+ (next_tvb, pinfo, control_tree);
+ break;
+ case CCREP_SERVER_INFO:
+ dissect_quake_CCREP_SERVER_INFO
+ (next_tvb, pinfo, control_tree);
+ break;
+ case CCREP_PLAYER_INFO:
+ dissect_quake_CCREP_PLAYER_INFO
+ (next_tvb, pinfo, control_tree);
+ break;
+ case CCREP_RULE_INFO:
+ dissect_quake_CCREP_RULE_INFO
+ (next_tvb, pinfo, control_tree);
+ break;
+ default:
+ dissect_data_tvb(next_tvb, pinfo, control_tree);
+ break;
}
}
@@ -557,8 +571,35 @@ dissect_quake(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
}
if (quake_tree) {
- proto_tree_add_uint(quake_tree, hf_quake_header_flags,
+ proto_item* flags_item = NULL;
+ proto_tree* flags_tree = NULL;
+
+ flags_item = proto_tree_add_uint(quake_tree, hf_quake_header_flags,
tvb, 0, 2, flags);
+ if (flags_item) {
+ flags_tree = proto_item_add_subtree(flags_item, ett_quake_flags);
+ }
+
+ if (flags_tree) {
+ proto_tree_add_text(flags_tree, tvb, 0, 2,
+ decode_boolean_bitfield(flags, NETFLAG_DATA, 32,
+ "Data","-"));
+ proto_tree_add_text(flags_tree, tvb, 0, 2,
+ decode_boolean_bitfield(flags, NETFLAG_ACK, 32,
+ "Acknowledgment","-"));
+ proto_tree_add_text(flags_tree, tvb, 0, 2,
+ decode_boolean_bitfield(flags, NETFLAG_NAK, 32,
+ "No Acknowledgment","-"));
+ proto_tree_add_text(flags_tree, tvb, 0, 2,
+ decode_boolean_bitfield(flags, NETFLAG_EOM, 32,
+ "End Of Message","-"));
+ proto_tree_add_text(flags_tree, tvb, 0, 2,
+ decode_boolean_bitfield(flags, NETFLAG_UNRELIABLE, 32,
+ "Unreliable","-"));
+ proto_tree_add_text(flags_tree, tvb, 0, 2,
+ decode_boolean_bitfield(flags, NETFLAG_CTL, 32,
+ "Control","-"));
+ }
proto_tree_add_uint(quake_tree, hf_quake_header_length,
tvb, 2, 2, length);
}
@@ -581,7 +622,7 @@ dissect_quake(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
rest_length = tvb_reported_length(tvb) - 8;
next_tvb = tvb_new_subset(tvb, 8, rest_length , rest_length);
- dissect_data_tvb(next_tvb, pinfo, tree);
+ dissect_data_tvb(next_tvb, pinfo, quake_tree);
}
void
@@ -698,6 +739,7 @@ proto_register_quake(void)
&ett_quake,
&ett_quake_control,
&ett_quake_control_colors,
+ &ett_quake_flags,
};
proto_quake = proto_register_protocol("Quake Network Protocol", "quake");