Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-bugs: [Wireshark-bugs] [Bug 2191] New: Implement BASE_CUSTOM display type

Date: Mon, 14 Jan 2008 06:21:52 +0000 (GMT)
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2191

           Summary: Implement BASE_CUSTOM display type
           Product: Wireshark
           Version: SVN
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Enhancement
          Priority: Medium
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: avn@xxxxxxxxxxxxxxx


Build Information:
TShark 0.99.8 (SVN Rev 24082)

Copyright 1998-2007 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled with GLib 2.14.4, with libpcap 0.9.7, with libz 1.2.3, without
libpcre,
without SMI, without ADNS, without Lua, with GnuTLS 1.6.3, with Gcrypt 1.2.4,
with MIT Kerberos.
NOTE: this build doesn't support the "matches" operator for Wireshark filter
syntax.

Running on Linux 2.6.23.9-85.fc8, with libpcap version 0.9.7.

Built using gcc 4.1.2 20070925 (Red Hat 4.1.2-33).
--
The suggested enhancement was first made in context of bug #2048.

This feature will be useful for protocols that specify some values in
increments differing from 1. E.g., IPMI/ATCA specifications often specify time
in increments of 0.5s, or power in increments of 0.1W.

Also, this feature will be helpful where there is a value that commonly needs
to be displayed in some non-orthogonal fashion. E.g., IPMI/ATCA specifications
use the following representation of version: the least-significant nibble is a
major part of the version and the most-significant nibble is a minor part. That
is, a version of 1.5 is encoded as 0x51.

It may be possible to avoid using BASE_CUSTOM by writing a code like the
following (e.g. for the version example below):

   guint8 version;
   ...
   version = tvb_get_guint8(tvb, offs);
   proto_tree_add_uint_format_value(tree, hf_version, tvb, offs, 1,
          version, "%d.%d", version & 0xf, version >> 4);

This code, of course, can be put to a wrapper function in order to avoid
writing it over and over again. However, such approach would prevent one from
using proto_tree_add_bitmask() function if the field being parsed is a part of
bitmask - since proto_tree_add_bitmask() uses proto_tree_add_item() to create
items for each part of a bitfield. The BASE_CUSTOM feature is intended to lift
this limitation.

The usage of this feature is documented in the doc/README.developer changes
which are also part of the patch.

To avoid proliferation of fill_label_* function (that is, to avoid adding a set
of functions fill_label_custom_int, fill_label_custom_uint and
fill_label_custom_bitfield), some of the existing fill_label_* functions have
been merged:

* fill_label_enumerated_bitfield and fill_label_numeric_bitfield => into
fill_label_bitfield
* fill_label_enumerated_uint => into fill_label_uint
* fill_label_enumerated_int => into fill_label_int

Actually, these functions only differed a couple of lines: choosing the format
string and calling the g_snprintf() function.


-- 
Configure bugmail: http://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.