Ethereal-dev: Re: [Ethereal-dev] corrected graphing patch

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

From: Guy Harris <gharris@xxxxxxxxxxxx>
Date: Thu, 8 Mar 2001 01:34:12 -0800
On Tue, Feb 27, 2001 at 09:01:56PM +0100, Pavel Mores wrote:
> Oh, I'm sorry. I'll port it to 0.8.15.

It actually applied pretty well to a current CVS tree, so it should
apply to 0.8.15 - or 0.8.16, the current release.

Why does the left mouse button move the graph rather than selecting a
packet?  The left mouse button tends to mean "select" in most GUIs (at
least on systems with mice with more than one button... :-)).

You might want to avoid using bitfields in headers that are supposed to
match packet headers; for one thing, you'd have to do something such as
what the BSD header files do:

	#if BYTE_ORDER == LITTLE_ENDIAN
		u_int	ip_hl:4,		/* header length */
			ip_v:4;			/* version */
	#endif
	#if BYTE_ORDER == BIG_ENDIAN
		u_int	ip_v:4,			/* version */
			ip_hl:4;		/* header length */
	#endif

in order to handle both big-endian and little-endian machines, and, even
then, there's no *guarantee* that the bit fields will be put into the
header in the obvious order, as I remember.

(There might also be compilers that would object to

	guint16 doff:4;

for example, as that'd declare a bitfield that's an "unsigned short",
although I don't have my ANSI C standard handy and don't know whether
ANSI C specifically allows "unsigned short" rather than "unsigned int"
bitfields.)

Using bitmasks and shifts might be better.