diff options
author | Michael Mann <mmann78@netscape.net> | 2015-02-14 18:01:53 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-02-22 02:53:48 +0000 |
commit | 8d5da72ff9255a3fd494fb2d842a7ecb9d2c7c14 (patch) | |
tree | 3e48036d26dedf29361132faec1682c9aa6fb24a /epan/address_types.c | |
parent | ddafa7e381c188f0f282908003518be44130a3b6 (diff) | |
download | wireshark-8d5da72ff9255a3fd494fb2d842a7ecb9d2c7c14.tar.gz |
Add tvb_address_with_resolution_to_str.
Convert dissectors to using the API where appropriate.
Change-Id: I059582f73a75635d4a0338d02d4c4b212162480b
Reviewed-on: https://code.wireshark.org/review/7296
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/address_types.c')
-rw-r--r-- | epan/address_types.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/epan/address_types.c b/epan/address_types.c index 0239399670..7de9850cde 100644 --- a/epan/address_types.c +++ b/epan/address_types.c @@ -1051,6 +1051,32 @@ gchar* tvb_address_var_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, address_ty return address_to_str(scope, &addr); } +gchar* +tvb_address_with_resolution_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int type, const gint offset) +{ + address addr; + address_type_t *at; + + ADDR_TYPE_LOOKUP(type, at); + + if (at == NULL) + { + return NULL; + } + + /* The address type must have a fixed length to use this function */ + /* For variable length fields, use tvb_address_var_with_resolution_to_str() */ + if (at->addr_fixed_len == NULL) + { + g_assert_not_reached(); + return NULL; + } + + TVB_SET_ADDRESS(&addr, type, tvb, offset, at->addr_fixed_len()); + + return address_with_resolution_to_str(scope, &addr); +} + /* * Editor modelines - http://www.wireshark.org/tools/modelines.html |