Ethereal-dev: Re: [Ethereal-dev] HF? or proto_add_tree_XXX?

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Sun, 27 Oct 2002 13:49:50 -0800
On Sat, Oct 26, 2002 at 02:09:19PM -0700, Jaime Fournier wrote:
> I am working on cleaning my code in
> packet-dcerpc-afs4int.c.
> So farI have made a macros header  file to house all
> the common dissection structures.
> This will allow me to complete all the dissectors for 
> afs4int, and keep it very clean.
> Now I am stuck at weather to choose the method of
> using a generic var for hf, e.g.
> hf_afs4int_gen_uint32, or to choose the
> proto_tree_add_xxx functions, which will give more
> descriptive names. Was not sure the direction I should
> go. Any help is greatly appreciated!

I would vote for using specific hf_ values for specific fields, rather
than, for example, using the same hf_ value for all 32-bit unsigned
integer fields.  If you use the same hf_ value for multiple fields, then

	1) either they all get listed in the protocol tree as "Unsigned
	   32-bit integer" or something such as that, or you have to use
	   the "proto_tree_add_xxx_format()" functions to make them
	   display meaningfully;

	2) you can't filter on specific fields.

(Those would mean there'd be no point in giving them hf_ values at all,
as

	1) you'd have to use a format string anyway;

	2) you can't filter on them individually.)