Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Problem with proto_tree_add_item...

From: "Maynard, Chris" <Christopher.Maynard@xxxxxxxxx>
Date: Sun, 15 Feb 2009 18:12:46 -0500
For FT_BOOLEAN, I think you want to use true_false_string instead of
value_string and TFS() instead of VALS(). e.g., 

Change this:
static const value_string rtp_midi_cs_flag_b[] =
{
	{ 0,"Short Header: 1 octet" },
	{ 1,"Long Header: 2 octets" },
	{ 0,NULL },
};

To this:
static const true_false_string rtp_midi_cs_flag_b = {
	"Long Header: 2 octets",
	"Short Header: 1 octet"
};

And this:
	&hf_rtp_midi_bflag,
	{
		"B-Flag",
		"rtpmidi.b_flag",
		FT_BOOLEAN,
		8,
		VALS(rtp_midi_cs_flag_b),
		RTP_MIDI_CS_FLAG_B,
		"", HFILL
	}

To this:
	&hf_rtp_midi_bflag,
	{
		"B-Flag",
		"rtpmidi.b_flag",
		FT_BOOLEAN,
		8,
		TFS(&rtp_midi_cs_flag_b),
		RTP_MIDI_CS_FLAG_B,
		"", HFILL
	}

(Refer to README.developer for more details ...)
- Chris


> -----Original Message-----
> From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-
> bounces@xxxxxxxxxxxxx] On Behalf Of Tobias Erichsen
> Sent: Sunday, February 15, 2009 5:39 PM
> To: wireshark-dev@xxxxxxxxxxxxx
> Subject: [Wireshark-dev] Problem with proto_tree_add_item...
> 
> Hi everyone,
> 
> I seem to have a little problem with calling proto_tree_add_item.  On
some
> packets,
> when I click on the entry to expand the tree, Wireshark crashes.  If I
> don't insert
> those add_items, everything is fine...
> 
> Some sniplets of the code are below.
> 
> Has anyone possibly got any insights what I am doing wrong?
> 
> Best regards,
> Tobias
> 
> 
[snip]
CONFIDENTIALITY NOTICE: The contents of this email are confidential
and for the exclusive use of the intended recipient. If you receive this
email in error, please delete it from your system immediately and 
notify us either by email, telephone or fax. You should not copy,
forward, or otherwise disclose the content of the email.