I am upgrading the plugin for 2.2 from 1.6. I am having Trouble with the conversion of proto_tree_add_text to proto_tree_add_item for such cases. How do I write the hf variable for the following case :
From the example souce codes, It seems to me that it should be like this:
is this correct way to do it? I cant understand how "match_strval()" is going to work on this. Thanks. asked 01 Feb '17, 03:24 xaheen |
One Answer:
Previous code was fetching 2 bits only, so use a bitmask in your hf_cidsifecmd_direct_pa declaration:
Or use proto_tree_add_bits_item like in your previous question:
answered 01 Feb '17, 04:13 Pascal Quantin |
Thanks a lot :)
@Pascal Quantin in the previous code, (as I have understood seeing the real wireshark output)
match_strval(getbits(tvb_get_guint8(tvb, 7), 1, 2), discrete_status_var));
makes sure that the value taken from two bits are compared with the index of "discrete_status_var" to Output the desired value from "discrete_status_var".
How is that done in the new code? Thanks
Have a look at proto_tree_add_item() and proto_tree_add_bit_item() source code (more specifically the proto_tree_add_uint() and fill_label_number() sub functions). fill_label_number() takes care of the value_string search.
Thanks :) will do