ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: [Ethereal-dev] Can I reuse ett_xxxx variables for an arbitrary number of subtree

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Kelly Byrd" <kbyrd-ethereal@xxxxxxxxxx>
Date: Mon, 16 Aug 2004 08:58:55 -0700 (PDT)
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 variables 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?
- May I reuse them?
- How about the header fields? Am I using that mechanism incorrectly?

---
KB