Use "proto_tree_add_item()" to add strings to the protocol tree; this
simplifies the code (and makes the name in the protocol tree match the name in the dialog box for constructing filter expressions), and also fixes a bug where the item for the request command contained the entire request, not just the request command. svn path=/trunk/; revision=5257
This commit is contained in:
parent
92e90d3fae
commit
51ce720e55
38
packet-ftp.c
38
packet-ftp.c
|
@ -3,7 +3,7 @@
|
||||||
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
|
* Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com>
|
||||||
* Copyright 2001, Juan Toledo <toledo@users.sourceforge.net> (Passive FTP)
|
* Copyright 2001, Juan Toledo <toledo@users.sourceforge.net> (Passive FTP)
|
||||||
*
|
*
|
||||||
* $Id: packet-ftp.c,v 1.42 2002/04/03 22:35:08 guy Exp $
|
* $Id: packet-ftp.c,v 1.43 2002/04/26 20:59:42 guy Exp $
|
||||||
*
|
*
|
||||||
* Ethereal - Network traffic analyzer
|
* Ethereal - Network traffic analyzer
|
||||||
* By Gerald Combs <gerald@ethereal.com>
|
* By Gerald Combs <gerald@ethereal.com>
|
||||||
|
@ -53,9 +53,9 @@ static int proto_ftp_data = -1;
|
||||||
static int hf_ftp_response = -1;
|
static int hf_ftp_response = -1;
|
||||||
static int hf_ftp_request = -1;
|
static int hf_ftp_request = -1;
|
||||||
static int hf_ftp_request_command = -1;
|
static int hf_ftp_request_command = -1;
|
||||||
static int hf_ftp_request_data = -1;
|
static int hf_ftp_request_arg = -1;
|
||||||
static int hf_ftp_response_code = -1;
|
static int hf_ftp_response_code = -1;
|
||||||
static int hf_ftp_response_data = -1;
|
static int hf_ftp_response_arg = -1;
|
||||||
|
|
||||||
static gint ett_ftp = -1;
|
static gint ett_ftp = -1;
|
||||||
static gint ett_ftp_data = -1;
|
static gint ett_ftp_data = -1;
|
||||||
|
@ -274,10 +274,9 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
if (tokenlen != 0) {
|
if (tokenlen != 0) {
|
||||||
if (is_request) {
|
if (is_request) {
|
||||||
if (tree) {
|
if (tree) {
|
||||||
proto_tree_add_string_format(ftp_tree,
|
proto_tree_add_item(ftp_tree,
|
||||||
hf_ftp_request_command, tvb, offset,
|
hf_ftp_request_command, tvb, offset,
|
||||||
tokenlen, line, "Request: %s",
|
tokenlen, FALSE);
|
||||||
format_text(line, tokenlen));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
|
@ -294,10 +293,9 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
strncmp("227", line, tokenlen) == 0)
|
strncmp("227", line, tokenlen) == 0)
|
||||||
is_pasv_response = TRUE;
|
is_pasv_response = TRUE;
|
||||||
if (tree) {
|
if (tree) {
|
||||||
proto_tree_add_uint_format(ftp_tree,
|
proto_tree_add_uint(ftp_tree,
|
||||||
hf_ftp_response_code, tvb, offset,
|
hf_ftp_response_code, tvb, offset,
|
||||||
tokenlen, atoi(line), "Response: %s",
|
tokenlen, atoi(line));
|
||||||
format_text(line, tokenlen));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset += next_token - line;
|
offset += next_token - line;
|
||||||
|
@ -325,15 +323,13 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
||||||
*/
|
*/
|
||||||
if (linelen != 0) {
|
if (linelen != 0) {
|
||||||
if (is_request) {
|
if (is_request) {
|
||||||
proto_tree_add_string_format(ftp_tree,
|
proto_tree_add_item(ftp_tree,
|
||||||
hf_ftp_request_data, tvb, offset,
|
hf_ftp_request_arg, tvb, offset,
|
||||||
linelen, line, "Request Arg: %s",
|
linelen, FALSE);
|
||||||
format_text(line, linelen));
|
|
||||||
} else {
|
} else {
|
||||||
proto_tree_add_string_format(ftp_tree,
|
proto_tree_add_item(ftp_tree,
|
||||||
hf_ftp_response_data, tvb, offset,
|
hf_ftp_response_arg, tvb, offset,
|
||||||
linelen, line, "Response Arg: %s",
|
linelen, FALSE);
|
||||||
format_text(line, linelen));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset = next_offset;
|
offset = next_offset;
|
||||||
|
@ -409,8 +405,8 @@ proto_register_ftp(void)
|
||||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||||
"", HFILL }},
|
"", HFILL }},
|
||||||
|
|
||||||
{ &hf_ftp_request_data,
|
{ &hf_ftp_request_arg,
|
||||||
{ "Request data", "ftp.request.data",
|
{ "Request arg", "ftp.request.arg",
|
||||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||||
"", HFILL }},
|
"", HFILL }},
|
||||||
|
|
||||||
|
@ -419,8 +415,8 @@ proto_register_ftp(void)
|
||||||
FT_UINT8, BASE_DEC, NULL, 0x0,
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
||||||
"", HFILL }},
|
"", HFILL }},
|
||||||
|
|
||||||
{ &hf_ftp_response_data,
|
{ &hf_ftp_response_arg,
|
||||||
{ "Response data", "ftp.reponse.data",
|
{ "Response arg", "ftp.reponse.arg",
|
||||||
FT_STRING, BASE_NONE, NULL, 0x0,
|
FT_STRING, BASE_NONE, NULL, 0x0,
|
||||||
"", HFILL }}
|
"", HFILL }}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue