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

Wireshark-dev: [Wireshark-dev] Question: dissector tree display construction

From: Eliot Blennerhassett <linux@xxxxxxxxxxxxxxxx>
Date: Fri, 1 Dec 2006 08:56:16 +1300
I have made a start on writing dissector plugins for a couple of protocols

My question is whether it is possible to add an item to the protocol tree 
without registering it.

Standard code for an item looks something like this
/**********************************************************/
static int hf_hpi_hdrsize = -1;

static hf_register_info hf[] = {
	{ &hf_hpi_hdrsize,
	{ "HPI PDU size",      "hpi.hdrsize",
	FT_UINT16, BASE_DEC, NULL, 0x0,
	"", HFILL }
	},
...

{
	proto_tree_add_item(tree, hf_hpi_hdrsize, 
				tvb, offset, 2, BYTE_ORDER_LITTLE_ENDIAN); 
	offset += 2;
}
/**********************************************************/
Is there a way to do this in one step without having related hf_register_info 
and static int?
E.g.
{
	proto_tree_add_somehow(tree,"HPI PDU size %d", 
              tvb, offset, 2, BYTE_ORDER_LITTLE_ENDIAN); 
	offset += 2;
}
 
My protocol has about 200 different commands + responses, each with different 
field interpretation.  I don't need to filter on most of these, so I'm 
looking for a more succinct way of generating the tree.

thanks

--
Eliot Blennerhassett
AudioScience Inc.