Wireshark mailing list archives
Re: BASE_CUSTOM and 64-bit values
From: Jeff Morriss <jeff.morriss.ws () gmail com>
Date: Mon, 25 Mar 2013 17:23:58 -0400
On 03/17/13 11:58, David Arnold wrote:
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)?
The advantage of BASE_CUSTOM is that the presentation is built only if/when it is needed (whereas the code you've done there obviously builds the presentation--and stores it--well before it is used).
___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- BASE_CUSTOM and 64-bit values David Arnold (Mar 14)
- Re: BASE_CUSTOM and 64-bit values Guy Harris (Mar 14)
- Re: BASE_CUSTOM and 64-bit values David Arnold (Mar 14)
- Re: BASE_CUSTOM and 64-bit values Guy Harris (Mar 14)
- Re: BASE_CUSTOM and 64-bit values David Arnold (Mar 17)
- Re: BASE_CUSTOM and 64-bit values Jeff Morriss (Mar 25)
- Re: BASE_CUSTOM and 64-bit values David Arnold (Mar 26)
- Re: BASE_CUSTOM and 64-bit values Jakub Zawadzki (Mar 26)
- Re: BASE_CUSTOM and 64-bit values Evan Huus (Mar 26)
- Re: BASE_CUSTOM and 64-bit values Guy Harris (Mar 26)
- Re: BASE_CUSTOM and 64-bit values Evan Huus (Mar 26)
- Re: BASE_CUSTOM and 64-bit values David Arnold (Mar 14)
- Re: BASE_CUSTOM and 64-bit values Guy Harris (Mar 14)