ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] What do you use to get a boolean

From: "Hal Lander" <hal_lander@xxxxxxxxxxx>
Date: Mon, 26 Feb 2007 01:58:34 -0900
Steve,

Its more what the documentation does not say that caused me the problem.

The function is called 'add_boolean' and it has a parameter 'value'.
I had assumed, incorrectly, that 'value' would be a 1 or a 0.
It is not, it is the value of the packet byte that requires to be masked and shifted to get the boolean. It would be helpful if the documentation defined 'value' more explicitly.

Also Wireshark has functions which do the masking and shifting to get the boolean value. It would be helpful if these functions were exposed in the API so that dissector writers can use them. If I want to find the actual boolean value of the field I have to write my own functions for masking and shifting. That is not a big issue, but it is duplicating existing code, requires testing and is another source of bugs - better to use the Wireshark functions if they could be made available.

I hope this is helpful, the effort required to generate documentation is much appreciated and how Wireshark works is gradually starting to clik into place in my mind.

Hal.


From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Reply-To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Subject: Re: [Wireshark-dev] What do you use to get a boolean
Date: Wed, 21 Feb 2007 23:25:44 -0800

On Mon, Feb 12, 2007 at 06:15:43AM -0900, Hal Lander wrote:
> It does look like the value you pass to
> proto_tree_add_boolean(tree, id, tvb, start, length, value);
> is not a 1 or a 0 it is the raw data byte containing the boolean at the
> position defined by the mask.
>
> If I am correct this makes the documentation a bit missleading.

As Guy said, you have to do the masking yourself.  What part of the
documentation did you find misleading?  I ask so that we can take a look
at improving it.


Steve

_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev

_________________________________________________________________
Play Flexicon: the crossword game that feeds your brain. PLAY now for FREE.� http://zone.msn.com/en/flexicon/default.htm?icid=flexicon_hmtagline