Ethereal-dev: Re: [Ethereal-dev] New: bitfield_string

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 9 Feb 2004 12:02:05 -0800

On Feb 9, 2004, at 11:57 AM, Peter J. Creath wrote:

This is a sister utility to value_string.[ch] that I whipped up to make dissecting bitfields a bit easier. It should probably live in epan/ if folks think it's worth adding to the tree. I've only attached the new .c/.h files (and didn't include the modified makefiles) so that people can look it over and see if it's even of interest.

Basically, it lets you generate both single-line and multi-line (tree) representations of bitfields by defining a table. It could probably be used to drastically simplify dissect_xdlc_control in xdlc.c.

You might want to check out the current CVS version of "dissect_xdlc_control()" - it now takes, as an argument, a structure containing hf_ values for named fields for the subfields of the control field, so it no longer directly calls the routines to format bitfields.

Your changes might still be useful for dissectors that have bitfields that aren't named fields, however.