This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Adding multiple items to a tree

0

We have a temporary packet that we we're trying to do some quick dissecting on.

basically we read a field and its value determines what the next 10 or so fields are. Is there a way to overlay text for those next 10 fields, something like this:

some string { "first", "second", ....

}

proto_tree_add_item(some_tree, next_ten_fields, tvb, offset, 10, TRUE);

and have the following appear in the tree:

first: value second: value .... ten: value

If so the next question is probably how to adjust the size of each field (1 byte or 4 bytes).

Thanks, Brian

asked 11 Feb '13, 09:59

brwiese's gravatar image

brwiese
26111211
accept rate: 50%


One Answer:

0

tvb_get_guint8() / tvb_ntohs() / tvb_ntohl() and tvb_letohs() / tvb_letohl() are your friends here. Get that first fields value and branch based on that.

answered 11 Feb '13, 14:38

Jaap's gravatar image

Jaap ♦
11.7k16101
accept rate: 14%