ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: Re: [Ethereal-dev] "outputing" a uint as both Decimal and Hexadecimal ?

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Tue, 29 Jun 2004 01:00:54 -0700
On Tue, Jun 29, 2004 at 09:22:52AM +0200, Anders Broman (AL/EAB) wrote:
> I would like to output numbers both in hexadecmal and decimal like:
> %Offset: 512 ( 0x200), would it be possible to add a BASE_DEC_HEX

I guess we could, although, as I don't have 16 fingers, I'm not sure why
an offset would be displayed in hex. :-)

> and how to go about it ?

Add it to:

	epan/proto.h:
		add it to the "base_display_e" enum;

	epan/proto.c:
		add support for it to "fill_label_uint64()" and
		"fill_label_int64()";

		add support for it to the "hfinfo_uint_vals_format()",
		"hfinfo_uint_format()", "hfinfo_int_vals_format()",
		"hfinfo_int_format()", *and* their callers (as they currently
		assume that the format returned takes, as arguments, a field
		name, a symbolic name for the value, and a value);

		add support for it to "hfinfo_numeric_format()" (which
		is used to generate display filters, so you can't show
		it as both decimal *and* hex and it's not necessary to
		do so in any case)

		add support for it to "hfinfo_uint_format()" and
		"hfinfo_int_vals_format()" *and* their callers;

	gtk/dfilter_expr_dlg.c:
		add support for it to "value_list_sel_cb()" (it would
		have to pick either decimal or hex, as that's used to
		supply value strings corresponding to predefined
		descriptive values.