Ask Your Question
0

Add values to a tree that aren't part of the tvb buffer

asked 2021-11-24 10:34:37 +0000

ju53 gravatar image

Good morning,

i have a question regarding dissector development in C. I have additional information that i would like to display in my tree but this data isn't part of the tvb buffer. Is there a way to add values to a tree analog to proto_tree_add_item(my_tree, hf_my_info, tvb, offset, 1, ENC_LITTLE_ENDIAN); but with a variable instead of the buffer?

Thanks, ju53

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-11-24 11:04:20 +0000

grahamb gravatar image

There are proto_tree_add_<objectType>(), proto_tree_add_<objectType>_format() and proto_tree_add_<objectType>_format_value() methods to add elements to a tree that are computed or in variables, e.g. proto_tree_add_bytes(). See README.dissector for more information.

When using these routines the tvb start argument should approximate the location in the tvb where the value is derived from and the length argument should be 0 (as it's not in the tvb).

edit flag offensive delete link more

Comments

When using these routines the tvb start argument should approximate the location in the tvb where the value is derived from

...or be 0 if it's not derived from any data in the tvbuff - for example, if this is a request/reply protocol, if it's the frame number of the frame associated with the other member of a request/reply pair (the request if this is a reply or the reply if this is a request), the time difference between the request and the reply, or the request code if the reply doesn't contain the request code (for example, if you have "get" and "put" requests, mark the reply as a reply to a "get" or a "put").

Guy Harris gravatar imageGuy Harris ( 2021-11-24 19:48:45 +0000 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-11-24 10:34:37 +0000

Seen: 18 times

Last updated: Nov 24