Ask Your Question
0

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

asked 2017-11-03 16:03:14 +0000

mest112 gravatar image

updated 2017-11-03 16:19:38 +0000

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.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-11-03 16:37:15 +0000

grahamb gravatar image

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.

edit flag offensive delete link more

Comments

Thank you.

mest112 gravatar imagemest112 ( 2017-11-03 18:33:53 +0000 )edit

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

mest112 gravatar imagemest112 ( 2017-11-03 18:42:59 +0000 )edit

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

grahamb gravatar imagegrahamb ( 2017-11-03 19:08:28 +0000 )edit
0

answered 2017-11-03 16:17:40 +0000

sindy gravatar image

updated 2017-11-03 16:38:34 +0000

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,...)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2017-11-03 16:03:14 +0000

Seen: 1,938 times

Last updated: Nov 03 '17