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

Wireshark-dev: Re: [Wireshark-dev] Custom formatter for 64bit field

From: "Maynard, Chris" <Christopher.Maynard@xxxxxxxxx>
Date: Thu, 11 Mar 2010 17:53:48 -0500
I think the problem is that the custom format function takes a guint32 as its 2nd argument and you need a guint64, so unless this is changed to a guint64, you will have to modify your declaration to some other BASE_ supported by FT_UINT64 and then use one of the other proto_tree_add_XYZ() routines such as proto_tree_add_uint64_format().

>From README.developer:
BASE_CUSTOM allows one to specify a callback function pointer that will
format the value. The function pointer of the same type as defined by
custom_fmt_func_t in epan/proto.h, specifically:

  void func(gchar *, guint32);

- Chris

-----Original Message-----
From: wireshark-dev-bounces@xxxxxxxxxxxxx [mailto:wireshark-dev-bounces@xxxxxxxxxxxxx] On Behalf Of David Arnold
Sent: Thursday, March 11, 2010 5:25 PM
To: wireshark-dev@xxxxxxxxxxxxx
Subject: [Wireshark-dev] Custom formatter for 64bit field

Hi!

I'm writing a dissector for a protocol that uses a 64-bit time field
which is not in the format required for FT_ABSOLUTE_TIME.

So, I declared the hfinfo like

        { &hf_prot_pkthdr_time,
          { "Transmit Time", "prot.time",
            FT_UINT64, BASE_CUSTOM,
            prot_fmt_time, 0x0,
            "Transmission timestamp",
            HFILL }
        }

However, this causes an abort from the assertion in proto.c:4182
(trunk), which checks that hfinfo->strings is NULL (no, because of the
custom formatter), or the type matches a set that doesn't include
FT_UINT64.

This is my first attempt at writing a dissector, so I'm sure I'm missing
something.  Can someone point me in the right direction?

Thanks,




d

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
CONFIDENTIALITY NOTICE: The contents of this email are confidential
and for the exclusive use of the intended recipient. If you receive this
email in error, please delete it from your system immediately and 
notify us either by email, telephone or fax. You should not copy,
forward, or otherwise disclose the content of the email.