From df5a315048e9b318f7862901c1bd40fa2c08dad5 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 2 Jul 2015 16:17:20 -0700 Subject: Fix address resolution for columns. Have address_to_name() be a routine that takes an address and returns a string with a "sufficiently long" lifetime for use in columns, using the address type's addr_name_res_str routine for most address types, rather than having a too-small set of address types wired into it. It replaces both the internal solve_address_to_name() routine and get_addr_name(), and can, for example, handle the special WLAN address types rather than leaving them unresolved even with an ethers file. Change-Id: Id09bc412adf5d2752155650a14a77c5378af2e42 Reviewed-on: https://code.wireshark.org/review/9475 Reviewed-by: Guy Harris --- epan/to_str.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'epan/to_str.h') diff --git a/epan/to_str.h b/epan/to_str.h index 56ac29b9cd..082aea99c4 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -55,6 +55,33 @@ WS_DLL_PUBLIC gchar* address_to_str(wmem_allocator_t *scope, const address *addr WS_DLL_PUBLIC gchar* address_with_resolution_to_str(wmem_allocator_t *scope, const address *addr); WS_DLL_PUBLIC gchar* tvb_address_with_resolution_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int type, const gint offset); +/* + * address_to_name takes as input an "address", as defined in address.h. + * + * If the address is of a type that can be translated into a name, and the + * user has activated name resolution, and the name can be resolved, it + * returns a string containing the translated name. + * + * Otherwise, it returns NULL. + */ +const gchar *address_to_name(const address *addr); + +/* + * address_to_display takes as input an "address", as defined in address.h . + * + * If the address is of a type that can be translated into a name, and the + * user has activated name resolution, and the name can be resolved, it + * returns a string containing the translated name. + * + * Otherwise, if the address is of type AT_NONE, it returns "NONE". + * + * Otherwise, it returns a string containing the result of address_to_str + * on the argument, which should be a string representation for the address, + * e.g. "10.10.10.10" for IPv4 address 10.10.10.10. + */ +WS_DLL_PUBLIC +const gchar *address_to_display(wmem_allocator_t *allocator, const address *addr); + WS_DLL_PUBLIC void address_to_str_buf(const address *addr, gchar *buf, int buf_len); #define tvb_ether_to_str(tvb, offset) tvb_address_to_str(wmem_packet_scope(), tvb, AT_ETHER, offset) -- cgit v1.2.3