Ethereal-dev: Re: [Ethereal-dev] add bit element to a tree

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Thu, 08 Dec 2005 11:03:22 -0800
david martinez wrote:
Lot of thanks,  but if i have, for example, a byte and
a the field that i want goes from 3rd bit to 5th bit
and i apply the bitmask 0x38 i must apply a shift for
obtain the value or that apply the shift for me too???

proto_tree_add_XXX() will figure out the necessary shift from the bitmask. proto_tree_add_item() will do all the work for you; proto_tree_add_uint() will extract the field from the value you supply to it, masking and shifting for you.