First time here? Check out the FAQ!
THIS IS A TEST INSTANCE. Feel free to ask and answer questions, but take care to avoid triggering too many notifications.
0

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

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.

mest112's avatar
7
mest112
asked 2017-11-03 16:03:14 +0000, updated 2017-11-03 16:19:38 +0000
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

1

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.

grahamb's avatar
23.8k
grahamb
answered 2017-11-03 16:37:15 +0000
edit flag offensive 0 remove flag delete link

Comments

Thank you.

mest112's avatar mest112 (2017-11-03 18:33:53 +0000) edit

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

mest112's avatar mest112 (2017-11-03 18:42:59 +0000) edit

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

grahamb's avatar grahamb (2017-11-03 19:08:28 +0000) edit
add a comment see more comments
0

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,...)
sindy's avatar
6.2k
sindy
answered 2017-11-03 16:17:40 +0000, updated 2017-11-03 16:38:34 +0000
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer