On 14/03/2013, at 10:36 PM, Guy Harris wrote:

> You could use proto_tree_add_uint64_format_value().

I ended up writing a 

    static void
    foo_tree_add_timestamp(
        proto_tree *tree,
        const int hf,
        tvbuff_t *tvb,
        gint offset);

which extracts the value using tvb_get_ntoh64(), splits it into hours, minutes, 
seconds and nanoseconds, writes it to a wmem_packet_scope() buffer using 
g_snprintf(), and calls proto_tree_add_string() to populate the FT_STRING, 
BASE_NONE element from my header_field_info array.  It's only a few more lines 
of code than the BASE_CUSTOM formatting function would have been.

My question then becomes one of consistency: should I do this for all my 
BASE_CUSTOM cases?   Or is there some advantage in using BASE_CUSTOM that I've 
missed (beyond saving a couple of lines of code)?

Thanks,




d



___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:[email protected]?subject=unsubscribe

Reply via email to