diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-07-02 16:17:20 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-07-03 02:21:20 +0000 |
commit | df5a315048e9b318f7862901c1bd40fa2c08dad5 (patch) | |
tree | 5a098c4f335fcdf485aa3e9f150f44aff92f8166 /epan/to_str.h | |
parent | ed21afa9521a930c96c69ff11b13b54ca006767e (diff) |
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 <guy@alum.mit.edu>
Diffstat (limited to 'epan/to_str.h')
-rw-r--r-- | epan/to_str.h | 27 |
1 files changed, 27 insertions, 0 deletions
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) |