Ethereal-dev: Re: [Ethereal-dev] Regarding Memory allocation

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

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Fri, 4 Mar 2005 12:09:51 +0100 (CET)
On Fri, 4 Mar 2005, harshas wrote:

> Hello sir,
>   I want to display the contents of the hex byte in form of protocol tree.I
> could able to print it in the form of hex  and decimal.But I want to print
> the value of hex byte
>   getting from the tvbuff in the form of bits.(FF = 1111 1111 ) and so on.
>     Is there ant method to print in the protocol tree the binary values of
> the hex byte.?If so please tell me which routne to use ?
>     Regards
>          harsha

>From README.developer

  bitmask
  -------
  If the field is a bitfield, then the bitmask is the mask which will
  leave only the bits needed to make the field when ANDed with a value.
  The proto_tree routines will calculate 'bitshift' automatically
  from 'bitmask', by finding the rightmost set bit in the bitmask.
  If the field is not a bitfield, then bitmask should be set to 0.

>From what I understand in your question you'll need something like

    { &hf_field,
      { "Field", "field",
        FT_UINT8, BASE_DEC, NULL, 0xFF,
        "Field", HFILL
      }
    },

Maybe you should read the developer manual more thoroughly. Also take a
peak at all the other decoders in the source tree.

Good luck,
Jaap