Hi,
The array is used to track expanded/collapsed state of the subtree.
What you need to do is the following:
proto_item item = proto_tree_add_item(tree, hf_my_tree, tvb, 0, -1,
ENC_NA)
proto_tree my_tree = proto_item_add_subtree(item, ett_my_tree);
proto_item my_field = proto_tree_add_item(my_tree, hf_my_field, tvb,
0, 1, ENC_NA);
This uses the 'item' (showing hf_my_tree) as anchor for the subtree
'my_tree'.
To this subtree 'my_field' is added.
Given the hf_my_tree and hf_my_field are FT_BYTES, this shows something
like this
(collapsed):
+ My tree: 010203040506
(expanded):
- My tree: 010203040506
Field: 01
Thanks,
Jaap
On 2011-12-06 12:48, Teto wrote:
hi everybody,
I've trouble understanding what's the role of
proto_register_subtree_array. Each time I create a subtree, there is
the same message appending on top of the subtree ("Energywise v2")
and I wish it would remain blank. I create my subtrees like this:
proto_item_add_subtree( uuid_item, ett_ew_uuid); for instance.
In the function which registers the plugin, I've got that:
gint *ett[] = {
&ett_ew_main_tree,
&ett_ew_header_tree,
&ett_energywise_tlv,
&ett_ew_uuid,
&ett_ew_list_of_answers
};
proto_energywise = proto_register_protocol("Energywise v2",
"EnergyWise", "ew");
proto_register_field_array(proto_energywise, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
What's the aim of those tree identifiers ? Doxygen doc isn't clear
about
them.
Regards
Matt