Wireshark-dev: Re: [Wireshark-dev] Question: dissector tree display construction
From: "Gilbert Ramirez" <[email protected]>
Date: Thu, 30 Nov 2006 14:02:23 -0600
You can always use proto_tree_add_text to add plain text to the dissection tree.

But I can tell you from experience that although you may not want to
filter on those fields now... in the future you might want to, and
another person might need them, too.


On 11/30/06, Eliot Blennerhassett <[email protected]> wrote:
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?
        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.


Eliot Blennerhassett
AudioScience Inc.
Wireshark-dev mailing list
[email protected]