Ethereal-dev: Re: [ethereal-dev] Vines coded expanded

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

From: guy@xxxxxxxxxx (Guy Harris)
Date: Thu, 3 Dec 1998 01:17:06 -0800 (PST)
> - Has someone written some "standard" code to decode and display the values
>   from bitfields?

Decode and display in what fashion?

I have some code that can, for example, decode the "type of service"
bits in an IP header as

	Type of service: 0x00
	  000. .... = routine precedence
	  ...0 .... = normal delay
	  .... 0... = normal throughput
	  .... .0.. = normal reliability
	  .... ..0. = normal cost

(along the lines of what "snoop", Microsoft Network Monitor, and
possibly other packet-capture-and-display programs do) but, as the
detail display pane currently uses a variable-width font, it doesn't
look very good.

Does anybody have any objection to making the detail pane use a
fixed-width font?

(It consists of routines to decode "boolean", "enumerated", and
"numeric" bit fields; they take, as arguments:

	the number that contains the bitfield;

	a bitmask specifying which bits are in the bitfield;

	the width, in bits, of the number that contains the bitfield
	(typically 8, 16, or 32, but could be different);

and various values that tell it how to decode the bitfield:

	for Boolean, strings that indicate what it means if the bit is
	on and what it means if the bit is off;

	for enumerated, a "value_string" array giving names to the
	various values;

	for numeric, a format string;

and generate a string with the 0/1/. stuff, the "=", and the
description.  You make one call per bitfield.)