Ethereal-dev: Re: [Ethereal-dev] Filtering formatted items

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Mon, 17 Sep 2001 12:31:37 -0700 (PDT)
>         Cut and paste errors will get you (me at least) everytime.
>         The fifth parameter to proto_tree_add_XXX_format is "guint32
>         value", but for proto_tree_add_XXX the fifth parameter is
>         "gboolean little_endian".

No, it's not, unless XXX == item.  (And it's "guint32 value" in
"proto_tree_add_XXX_format()" only for some types; it's a "const char *"
for "proto_tree_add_string()" and "proto_tree_add_string_format()", for
example.)

The endianness argument is only for "proto_tree_add_item()", as
"proto_tree_add_item()" fetches the value for you;
"proto_tree_add_uint()", etc., don't fetch the item for you (they're for
use if either

	1) you've already fetched the item's value because you need it,
	   for example, to decide how to dissect the rest of the packet
	   - although I'm not sure whether it saves a significant number
	   of cycles to skip the fetching done by
	   "proto_tree_add_item()"

or

	2) the value to be put into the tree isn't the value extracted
	   from the packet (e.g., if the value is a count of 32-bit
	   words and you want it to appear in the display and be seen by
	   display filters as a count of bytes).