aboutsummaryrefslogtreecommitdiffstats
path: root/packet-ftp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2003-06-10 23:12:15 +0000
committerGuy Harris <guy@alum.mit.edu>2003-06-10 23:12:15 +0000
commitff6017292f66f0ec897e83c165b01d57759c415b (patch)
tree8ca8990b82b6e1afbd012407423a3b569c298248 /packet-ftp.c
parentdebac46b669f1212dd872a09106ed18d80e7493b (diff)
Put the FTP request or response line into the protocol tree, and put the
subfields of it under that item. svn path=/trunk/; revision=7835
Diffstat (limited to 'packet-ftp.c')
-rw-r--r--packet-ftp.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/packet-ftp.c b/packet-ftp.c
index d4dbb9b945..c0ae70eed7 100644
--- a/packet-ftp.c
+++ b/packet-ftp.c
@@ -3,7 +3,7 @@
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
* Copyright 2001, Juan Toledo <toledo@users.sourceforge.net> (Passive FTP)
*
- * $Id: packet-ftp.c,v 1.51 2003/04/30 02:35:19 gerald Exp $
+ * $Id: packet-ftp.c,v 1.52 2003/06/10 23:12:15 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -50,6 +50,7 @@ static int hf_ftp_response_code = -1;
static int hf_ftp_response_arg = -1;
static gint ett_ftp = -1;
+static gint ett_ftp_reqresp = -1;
static gint ett_ftp_data = -1;
static dissector_handle_t ftpdata_handle;
@@ -246,6 +247,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
gboolean is_request;
proto_tree *ftp_tree = NULL;
+ proto_tree *reqresp_tree = NULL;
proto_item *ti;
gint offset = 0;
const guchar *line;
@@ -301,6 +303,14 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_boolean_hidden(ftp_tree,
hf_ftp_response, tvb, 0, 0, TRUE);
}
+
+ /*
+ * Put the line into the protocol tree.
+ */
+ ti = proto_tree_add_text(ftp_tree, tvb, offset,
+ next_offset - offset, "%s",
+ tvb_format_text(tvb, offset, next_offset - offset));
+ reqresp_tree = proto_item_add_subtree(ti, ett_ftp_reqresp);
}
if (is_request) {
@@ -311,7 +321,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tokenlen = get_token_len(line, line + linelen, &next_token);
if (tokenlen != 0) {
if (tree) {
- proto_tree_add_item(ftp_tree,
+ proto_tree_add_item(reqresp_tree,
hf_ftp_request_command, tvb, offset,
tokenlen, FALSE);
}
@@ -339,7 +349,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
code = strtoul(code_str, NULL, 10);
if (tree) {
- proto_tree_add_uint(ftp_tree,
+ proto_tree_add_uint(reqresp_tree,
hf_ftp_response_code, tvb, offset, 3, code);
}
@@ -397,11 +407,11 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
if (linelen != 0) {
if (is_request) {
- proto_tree_add_item(ftp_tree,
+ proto_tree_add_item(reqresp_tree,
hf_ftp_request_arg, tvb, offset,
linelen, FALSE);
} else {
- proto_tree_add_item(ftp_tree,
+ proto_tree_add_item(reqresp_tree,
hf_ftp_response_arg, tvb, offset,
linelen, FALSE);
}
@@ -497,6 +507,7 @@ proto_register_ftp(void)
};
static gint *ett[] = {
&ett_ftp,
+ &ett_ftp_reqresp,
&ett_ftp_data,
};