aboutsummaryrefslogtreecommitdiffstats
path: root/packet-tftp.c
diff options
context:
space:
mode:
authorLaurent Deniel <laurent.deniel@free.fr>1999-11-14 10:32:26 +0000
committerLaurent Deniel <laurent.deniel@free.fr>1999-11-14 10:32:26 +0000
commit095afe43dfef388929a451fd8825179ace688742 (patch)
tree4c101daed83153c247de7c940be38c1f3a410303 /packet-tftp.c
parente4ca79b93f301ed4c2bfd918ca9bc1fe6af1791f (diff)
Add display filters.
svn path=/trunk/; revision=1027
Diffstat (limited to 'packet-tftp.c')
-rw-r--r--packet-tftp.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/packet-tftp.c b/packet-tftp.c
index fd68155888..383558aaf1 100644
--- a/packet-tftp.c
+++ b/packet-tftp.c
@@ -3,7 +3,7 @@
*
* Richard Sharpe <rsharpe@ns.aus.com>
*
- * $Id: packet-tftp.c,v 1.5 1999/07/29 05:47:06 gram Exp $
+ * $Id: packet-tftp.c,v 1.6 1999/11/14 10:32:26 deniel Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@unicom.net>
@@ -42,6 +42,8 @@
#include "packet.h"
static int proto_tftp = -1;
+static int hf_tftp_type = -1;
+static int hf_tftp_error_code = -1;
#define RRQ 1
#define WRQ 2
@@ -93,7 +95,10 @@ dissect_tftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
ti = proto_tree_add_item(tree, proto_tftp, offset, END_OF_FRAME, NULL);
tftp_tree = proto_item_add_subtree(ti, ETT_TFTP);
- switch (i1 = pntohs(pd+offset)) {
+ i1 = pntohs(pd+offset);
+ proto_tree_add_item_hidden(tftp_tree, hf_tftp_type, offset, 2, i1);
+
+ switch (i1) {
case RRQ:
proto_tree_add_text(tftp_tree, offset, 2, "Read Request");
offset += 2;
@@ -129,6 +134,7 @@ dissect_tftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
proto_tree_add_text(tftp_tree, offset, 2, "Error Code");
offset += 2;
i1 = pntohs(pd+offset);
+ proto_tree_add_item_hidden(tftp_tree, hf_tftp_error_code, offset, 2, i1);
proto_tree_add_text(tftp_tree, offset, 2, "Code = %s", tftp_errors[i1 % 8]);
offset += 2;
proto_tree_add_text(tftp_tree, offset, END_OF_FRAME, "Error Message: %s", pd + offset);
@@ -147,11 +153,19 @@ dissect_tftp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
void
proto_register_tftp(void)
{
-/* static hf_register_info hf[] = {
- { &variable,
- { "Name", "tftp.abbreviation", TYPE, VALS_POINTER }},
- };*/
- proto_tftp = proto_register_protocol("Trivial File Transfer Protocol", "tftp");
- /* proto_register_field_array(proto_tftp, hf, array_length(hf));*/
+ static hf_register_info hf[] = {
+ { &hf_tftp_type,
+ { "Type", "tftp.type",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ "TFTP message type" }},
+
+ { &hf_tftp_error_code,
+ { "Error code", "tftp.error.code",
+ FT_UINT16, BASE_DEC, NULL, 0x0,
+ "Error code in case of TFTP error message" }}
+ };
+
+ proto_tftp = proto_register_protocol("Trivial File Transfer Protocol", "tftp");
+ proto_register_field_array(proto_tftp, hf, array_length(hf));
}