This is a static, read-only archive of Wireshark Q&A. Older questions and answers from October 2017 and earlier can be found at osqa-ask.wireshark.org.
0

How do I add "child item" to an item in the subtree?

asked Nov 03 '17

updated Nov 03 '17

For example, if I have the item:

VarData: Active (0x90)

How do I add details under this item? I would like to add some text under it. I use C to make my dissector.

2 Answers

1

answered Nov 03 '17

In C, when you add the item, usually with proto_tree_add_item(...), then that returns a proto_item that can be used in a call to proto_item_add_subtree(item, ...) which returns a proto_tree for your subtree which can be used in subsequent proto_tree_add_item calls.

See section 1.5.2 of doc\README.dissector.

Comments

Thank you.

User 96912 ( Nov 03 '17 )

One more thing, how do I add text as an item?

User 96912 ( Nov 03 '17 )

text that's in the packet data or text "generated" by your dissector?

User 98587 ( Nov 03 '17 )
0

answered Nov 03 '17

updated Nov 03 '17

In Lua: when adding your item using

my_subtree:add(VarData,...)

you just assign that to a variable, like

local varDataSubtree = my_subtree:add(VarData,...)

Then, you add the details using

varDataSubtree:add(Detail1,...)
cc-by-sa Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.