Ethereal-dev: Re: [Ethereal-dev] Multi-width integers

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: Fri, 28 Feb 2003 14:09:46 -0800
On Fri, Feb 28, 2003 at 02:54:27PM +0100, Biot Olivier wrote:
> In some protocols, some fields can be ieither FT_UINT8, FT_UINT16, FT_UINT24
> or FT_UINT32 depending on the value. The WSP protocol has such fields.
> Should we define the protocol fields as FT_UINT32 then, so to avoid
> duplicate entries? One cannot register a protocol field more than once...

Actually, one can - see, for example, the X.25 dissector, which has
mod-8 and mod-128 versions of various fields, so that one can, for
example, refer to the packet receive sequence number as "x.25.p_r"
regardless of what bits it occupies in the byte in which it appears.

However, in the case of the WSP fields, you can make them FT_UINT32, as
long as

	1) you don't care whether, in the "Filter Expression" dialog
	   box, they're referred to as having an "(unsigned, 4 bytes)"
	   value;

	2) their values are displayed in decimal, or are displayed in
	   hex or octal and you don't care whether it displays more
	   digits than the field has (leading 0's).