On Mon, 16 Aug 2004 08:58:55 -0700 (PDT), Kelly Byrd wrote:
> The dissector I'm working on, daap, creates a number of nested subtrees
> during a dissection. The number of subtrees isn't known at compile time as
> it's determined by the contents of the packet. Daap data is a list of tags
> that each may contain data or other tags. My dissector recurses if it
> finds a container tag, creating a new subtree for each recursive call.
>
> I've got a static ett_daap that's passed to proto_item_add_subtree() for
> the top of the daap protocol tree. I've got another, ett_daap_sub, that I
> reuse when I create each recursive subtree. I also reuse my two static
> hf_daap_xxxx variablopen for each tag. This compiles and appears to work
> correctly (my limited testing), but I'm not sure it's the correct thing to
> do.
>
> - What are these static gints?
They keep track of which expansions have been expanded and which have
been compressed. So that if you select a different packet, ethereal
will remember which expansions to expand and which to leave
compressed.
> - May I reuse them?
Yes, you can reuse them. The only issue that might arise is that of
confusion.
Ethereal might no longer know exactly which expansions to expand and
which to compress any more when jumping between packets. Apart from
that, nothing
bad will happen if you reuse them.
> - How about the header fields? Am I using that mechanism incorrectly?
I cant answer that question without knowing how you use the header fields.