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

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 close merge delete

Sort by » oldest newest most voted

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).

more

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").

( 2021-11-24 19:48:45 +0000 )edit