is there any function other than proto_tree_add_item() in the new API, which could easily be implemented as a replacement of proto_tree_add_text()? especially for printf style implementation of proto_tree_add_text() for example :
asked 14 Dec '16, 03:46 xaheen edited 14 Dec '16, 05:20 grahamb ♦ |
One Answer:
What's wrong with proto_tree_add_bits_item(command_tree, hf_roof_shed, tvb, 14<<3+5, 2, ENC_BIG_ENDIAN);
answered 14 Dec '16, 04:35 Anders ♦ |
Thanks. I will try it. But it seems almost similar to proto_tree_add_item.
@anders Could you please explain the reason for writing "14<<3+5, 2"? Thanks
proto_tree_add_bits_item takas an offset and length in bits and not bytes.
So 14<<3+5 = 14*8+5 = 117 bits since the beginning of the tvb. 2 is the number of bits to be read from the offset.
And that was a shot in the dark at what I assumed the previous code tried to do :-)