aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-data.c
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2007-09-28 19:16:05 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2007-09-28 19:16:05 +0000
commitf2bc8dd002801350464327a044d54ac3fe1af487 (patch)
tree583c362269b7329c48d14b3fc2850bdf86ee3c57 /epan/dissectors/packet-data.c
parent2697adeda44651702b38bf796454dfdbb66defbf (diff)
Why do I have to enable the Bytes View to see the (start of) data of the Data dissector?
Adding the data as a subtree to the Data dissector. svn path=/trunk/; revision=23018
Diffstat (limited to 'epan/dissectors/packet-data.c')
-rw-r--r--epan/dissectors/packet-data.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/epan/dissectors/packet-data.c b/epan/dissectors/packet-data.c
index 1847eb8a6e..a942cfb874 100644
--- a/epan/dissectors/packet-data.c
+++ b/epan/dissectors/packet-data.c
@@ -35,6 +35,8 @@
* print routines
*/
int proto_data = -1;
+int hf_data_data = -1;
+int ett_data = -1;
static void
dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
@@ -44,10 +46,13 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
if (tree) {
bytes = tvb_length_remaining(tvb, 0);
if (bytes > 0) {
- proto_tree_add_protocol_format(tree, proto_data, tvb,
+ proto_item *ti = proto_tree_add_protocol_format(tree, proto_data, tvb,
0,
bytes, "Data (%d byte%s)", bytes,
plurality(bytes, "", "s"));
+ proto_tree *data_tree = proto_item_add_subtree(ti, ett_data);
+
+ proto_tree_add_item(data_tree, hf_data_data, tvb, 0, bytes, FALSE);
}
}
}
@@ -55,6 +60,16 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
void
proto_register_data(void)
{
+ static hf_register_info hf[] = {
+ {&hf_data_data,
+ {"Data", "data.data", FT_BYTES, BASE_HEX, NULL, 0x0,
+ NULL, HFILL}}
+ };
+
+ static gint *ett[] = {
+ &ett_data
+ };
+
proto_data = proto_register_protocol (
"Data", /* name */
"Data", /* short name */
@@ -63,6 +78,9 @@ proto_register_data(void)
register_dissector("data", dissect_data, proto_data);
+ proto_register_field_array(proto_data, hf, array_length(hf));
+ proto_register_subtree_array(ett, array_length(ett));
+
/*
* "Data" is used to dissect something whose normal dissector
* is disabled, so it cannot itself be disabled.