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] How to modify hf_register_info hf[] ?

From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Mon, 22 Jan 2007 16:22:12 +0100 (CET)
Hi,

There's no way to change a registered array. Therefore I suggested to use
FT_BYTES, which has a variable length given in the proto_tree_add_*
function.

Thanx,
Jaap

On Mon, 22 Jan 2007, Jan Kokott wrote:

> Hi,
>
> I have a little problem with the hf [] array.
> In the subtree "frame" are two fields defining the length of my subtree "Adressing Field".
>
> The Field could varry between 4 and 20 byte. The total length is a problem I have already solved. My problem is, that 2 of the 4 fields in those 4-20 byte have a variable length(0,2 or 8 Byte).
>
> The dissector (if (tree)) was solved with an switch/case, for every possibility.
> But how do I change the hf [], so that it could have 2 or 4 fields with 0-8 Byte ?
> I could use a switch/case again but therefore I would need to write 6 different hf_register with 14-16 entrys.
>
> Any ideas on how I could do that a bit smoother ?
>
> Regards
> Jan Kokott
>