diff options
author | Michael Mann <mmann78@netscape.net> | 2015-02-08 20:36:03 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-02-09 03:49:13 +0000 |
commit | 8ff944d4ab892521c6a32fe40f6a410640a34d34 (patch) | |
tree | cb9bb5956a1073babc778b2f75fd2d83a52608e3 | |
parent | 2875cd382fdc0efd5d949f674a0328ecf918b7e9 (diff) |
Add fixed length function for address types.
This allows for even more cleanup with respect to how address types are handled, including removing address_to_str.c. Most of the functionality was folded into address_types.c, but the remainder was just dispersed because it didn't make sense to keep the file.
Change-Id: Id4e9391f0c3c26eff8c27b362e4f7a1970d718b4
Reviewed-on: https://code.wireshark.org/review/7038
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r-- | epan/CMakeLists.txt | 1 | ||||
-rw-r--r-- | epan/Makefile.common | 1 | ||||
-rw-r--r-- | epan/addr_resolv.c | 9 | ||||
-rw-r--r-- | epan/address.h | 3 | ||||
-rw-r--r-- | epan/address_to_str.c | 361 | ||||
-rw-r--r-- | epan/address_types.c | 290 | ||||
-rw-r--r-- | epan/address_types.h | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-arcnet.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-atalk.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-devicenet.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee80211.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-ieee802154.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-ismp.c | 19 | ||||
-rw-r--r-- | epan/dissectors/packet-j1939.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-jxta.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-mp2t.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-mstp.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-sna.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-tipc.c | 2 | ||||
-rw-r--r-- | epan/osi-utils.c | 2 | ||||
-rw-r--r-- | epan/to_str.c | 17 | ||||
-rw-r--r-- | epan/to_str.h | 3 |
22 files changed, 365 insertions, 412 deletions
diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt index c60373fdad..d3ada21533 100644 --- a/epan/CMakeLists.txt +++ b/epan/CMakeLists.txt @@ -1555,7 +1555,6 @@ ADD_CUSTOM_COMMAND( set(LIBWIRESHARK_FILES addr_and_mask.c addr_resolv.c - address_to_str.c address_types.c afn.c aftypes.c diff --git a/epan/Makefile.common b/epan/Makefile.common index 239751352d..28ace26330 100644 --- a/epan/Makefile.common +++ b/epan/Makefile.common @@ -24,7 +24,6 @@ LIBWIRESHARK_SRC = \ addr_and_mask.c \ addr_resolv.c \ - address_to_str.c \ address_types.c \ afn.c \ aftypes.c \ diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index 2d4b3f1878..6756acda79 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -3018,6 +3018,15 @@ add_ether_byip(const guint ip, const guint8 *eth) } /* add_ether_byip */ +gchar * +ipxnet_to_str_punct(wmem_allocator_t *scope, const guint32 ad, const char punct) +{ + gchar *buf = (gchar *)wmem_alloc(scope, 12); + + *dword_to_hex_punct(buf, ad, punct) = '\0'; + return buf; +} + const gchar * get_ipxnet_name(wmem_allocator_t *allocator, const guint32 addr) { diff --git a/epan/address.h b/epan/address.h index 841b9c6345..07d14360f1 100644 --- a/epan/address.h +++ b/epan/address.h @@ -37,9 +37,6 @@ extern "C" { * For dissector address types, just use the address_type_dissector_register function * from address_types.h */ -/* If a new address type is added here, a string representation procedure should also be */ -/* included in address_to_str_buf defined in address_to_str.c, for presentation purposes */ - typedef enum { AT_NONE, /* no link-layer address */ AT_ETHER, /* MAC (Ethernet, 802.x, FDDI) address */ diff --git a/epan/address_to_str.c b/epan/address_to_str.c deleted file mode 100644 index 74154e58b7..0000000000 --- a/epan/address_to_str.c +++ /dev/null @@ -1,361 +0,0 @@ -/* address_to_str.c - * Routines for utilities to convert addresses to strings. - * - * Wireshark - Network traffic analyzer - * By Gerald Combs <gerald@wireshark.org> - * Copyright 1998 Gerald Combs - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "config.h" - -#include <stdlib.h> -#include <string.h> - -#ifdef HAVE_SYS_TYPES_H -# include <sys/types.h> /* needed for <netinet/in.h> */ -#endif - -#ifdef HAVE_NETINET_IN_H -# include <netinet/in.h> /* needed for <arpa/inet.h> on some platforms */ -#endif - -#ifdef HAVE_ARPA_INET_H -#include <arpa/inet.h> -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include <sys/socket.h> /* needed to define AF_ values on UNIX */ -#endif - -#ifdef HAVE_WINSOCK2_H -#include <winsock2.h> /* needed to define AF_ values on Windows */ -#endif - -#ifdef NEED_INET_V6DEFS_H -# include "wsutil/inet_v6defs.h" -#endif - -#include "to_str-int.h" -#include "to_str.h" -#include "value_string.h" -#include "addr_resolv.h" -#include "address_types.h" -#include "wsutil/pint.h" -#include "wsutil/str_util.h" -#include "osi-utils.h" -#include <epan/dissectors/packet-mtp3.h> -#include <stdio.h> -#include "wmem/wmem.h" - -static void -ip6_to_str_buf_len(const guchar* src, char *buf, size_t buf_len); - -/* - * If a user _does_ pass in a too-small buffer, this is probably - * going to be too long to fit. However, even a partial string - * starting with "[Buf" should provide enough of a clue to be - * useful. - */ -#define BUF_TOO_SMALL_ERR "[Buffer too small]" - -#define IPV4_LENGTH 4 -#define IPV6_LENGTH 16 - -/* const char * - * inet_ntop6(src, dst, size) - * convert IPv6 binary address into presentation (printable) format - * author: - * Paul Vixie, 1996. - */ -static void -ip6_to_str_buf_len(const guchar* src, char *buf, size_t buf_len) -{ - struct { int base, len; } best, cur; - guint words[8]; - int i; - - if (buf_len < MAX_IP6_STR_LEN) { /* buf_len < 40 */ - g_strlcpy(buf, BUF_TOO_SMALL_ERR, buf_len); /* Let the unexpected value alert user */ - return; - } - - /* - * Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - for (i = 0; i < 16; i += 2) { - words[i / 2] = (src[i+1] << 0); - words[i / 2] |= (src[i] << 8); - } - best.base = -1; best.len = 0; - cur.base = -1; cur.len = 0; - for (i = 0; i < 8; i++) { - if (words[i] == 0) { - if (cur.base == -1) { - cur.base = i; - cur.len = 1; - } else - cur.len++; - } else { - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - } - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - } - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* Is this address an encapsulated IPv4? */ - /* XXX, - * Orginal code dated 1996 uses ::/96 as a valid IPv4-compatible addresses - * but since Feb 2006 ::/96 is deprecated one. - * Quoting wikipedia [0]: - * > The 96-bit zero-value prefix ::/96, originally known as IPv4-compatible - * > addresses, was mentioned in 1995[35] but first described in 1998.[41] - * > This class of addresses was used to represent IPv4 addresses within - * > an IPv6 transition technology. Such an IPv6 address has its first - * > (most significant) 96 bits set to zero, while its last 32 bits are the - * > IPv4 address that is represented. - * > In February 2006 the Internet Engineering Task Force (IETF) has deprecated - * > the use of IPv4-compatible addresses.[1] The only remaining use of this address - * > format is to represent an IPv4 address in a table or database with fixed size - * > members that must also be able to store an IPv6 address. - * - * If needed it can be fixed by changing next line: - * if (best.base == 0 && (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) - * to: - * if (best.base == 0 && best.len == 5 && words[5] == 0xffff) - * - * [0] http://en.wikipedia.org/wiki/IPv6_address#Historical_notes - */ - - if (best.base == 0 && (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) - { - /* best.len == 6 -> ::IPv4; 5 -> ::ffff:IPv4 */ - buf = g_stpcpy(buf, "::"); - if (best.len == 5) - buf = g_stpcpy(buf, "ffff:"); - ip_to_str_buf(src + 12, buf, MAX_IP_STR_LEN); - /* max: 2 + 5 + 16 == 23 bytes */ - return; - } - - /* - * Format the result. - */ - for (i = 0; i < 8; i++) { - /* Are we inside the best run of 0x00's? */ - if (i == best.base) { - *buf++ = ':'; - i += best.len; - - /* Was it a trailing run of 0x00's? */ - if (i == 8) { - *buf++ = ':'; - break; - } - } - /* Are we following an initial run of 0x00s or any real hex? */ - if (i != 0) - *buf++ = ':'; - - buf = word_to_hex_npad(buf, words[i]); /* max: 4B */ - /* max: 8 * 4 + 7 == 39 bytes */ - } - *buf = '\0'; /* 40 byte */ -} - -void -ip6_to_str_buf(const struct e_in6_addr *ad, gchar *buf) -{ - ip6_to_str_buf_len((const guchar*)ad, buf, MAX_IP6_STR_LEN); -} - -gchar* -ipx_addr_to_str(const guint32 net, const guint8 *ad) -{ - gchar *buf; - char *name; - - name = get_ether_name_if_known(ad); - - if (name) { - buf = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", get_ipxnet_name(wmem_packet_scope(), net), name); - } - else { - buf = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", get_ipxnet_name(wmem_packet_scope(), net), - bytestring_to_str(wmem_packet_scope(), ad, 6, '\0')); - } - return buf; -} - -gchar * -ipxnet_to_str_punct(wmem_allocator_t *scope, const guint32 ad, const char punct) -{ - gchar *buf = (gchar *)wmem_alloc(scope, 12); - - *dword_to_hex_punct(buf, ad, punct) = '\0'; - return buf; -} - -/* - This function is very fast and this function is called a lot. - XXX update the address_to_str stuff to use this function. -*/ -gchar * -eui64_to_str(wmem_allocator_t *scope, const guint64 ad) { - gchar *buf; - guint8 *p_eui64; - - p_eui64=(guint8 *)wmem_alloc(scope, 8); - buf=(gchar *)wmem_alloc(scope, EUI64_STR_LEN); - - /* Copy and convert the address to network byte order. */ - *(guint64 *)(void *)(p_eui64) = pntoh64(&(ad)); - - g_snprintf(buf, EUI64_STR_LEN, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", - p_eui64[0], p_eui64[1], p_eui64[2], p_eui64[3], - p_eui64[4], p_eui64[5], p_eui64[6], p_eui64[7] ); - return buf; -} - -gchar* -tvb_address_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, address_type type, const gint offset) -{ - address addr; - - addr.type = type; - - switch(type) - { - case AT_NONE: - addr.len = 0; - break; - case AT_ETHER: - addr.len = 6; - break; - case AT_IPv4: - addr.len = IPV4_LENGTH; - break; - case AT_IPv6: - addr.len = IPV6_LENGTH; - break; - case AT_IPX: - addr.len = 10; - break; - case AT_FC: - addr.len = 3; - break; - case AT_VINES: - addr.len = VINES_ADDR_LEN; - break; - case AT_FCWWN: - addr.len = FCWWN_ADDR_LEN; - break; - case AT_EUI64: - addr.len = 8; - break; - case AT_AX25: - addr.len = AX25_ADDR_LEN; - break; - case AT_SS7PC: - case AT_STRINGZ: - case AT_IB: - /* Have variable length fields, use tvb_address_var_to_str() */ - case AT_USB: - /* These addresses are not supported through tvb accessor */ - default: - /* XXX - Removed because of dynamic address type range - XXX - Should we check that range? - g_assert_not_reached(); - return NULL; - */ - break; - } - - switch (addr.len) { - case 0: - addr.data = NULL; - break; - case 1: - addr.data = GUINT_TO_POINTER((guint)tvb_get_guint8(tvb, offset)); - break; - default: - addr.data = tvb_get_ptr(tvb, offset, addr.len); - break; - } - - return address_to_str(scope, &addr); -} - -gchar* tvb_address_var_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, address_type type, const gint offset, int length) -{ - address addr; - - TVB_SET_ADDRESS(&addr, type, tvb, offset, length); - - return address_to_str(scope, &addr); -} - -/*XXX FIXME the code below may be called very very frequently in the future. - optimize it for speed and get rid of the slow sprintfs */ -/* XXX - perhaps we should have individual address types register - a table of routines to do operations such as address-to-name translation, - address-to-string translation, and the like, and have this call them, - and also have an address-to-string-with-a-name routine */ -/* convert an address struct into a printable string */ - -gchar* -address_to_str(wmem_allocator_t *scope, const address *addr) -{ - gchar *str; - int len = address_type_get_length(addr); - - if (len <= 0) - len = MAX_ADDR_STR_LEN; - - str=(gchar *)wmem_alloc(scope, len); - address_to_str_buf(addr, str, len); - return str; -} - -void -address_to_str_buf(const address *addr, gchar *buf, int buf_len) -{ - /* XXX - Keep this here for now to save changing all of the include headers */ - address_type_to_string(addr, buf, buf_len); -} - -/* - * Editor modelines - http://www.wireshark.org/tools/modelines.html - * - * Local variables: - * c-basic-offset: 4 - * tab-width: 8 - * indent-tabs-mode: nil - * End: - * - * vi: set shiftwidth=4 tabstop=8 expandtab: - * :indentSize=4:tabSize=8:noTabs=true: - */ diff --git a/epan/address_types.c b/epan/address_types.c index 48b0e26b74..61d3f52a2d 100644 --- a/epan/address_types.c +++ b/epan/address_types.c @@ -52,6 +52,7 @@ struct _address_type_t { AddrValueToString addr_to_str; AddrValueToStringLen addr_str_len; AddrColFilterString addr_col_filter; + AddrFixedLen addr_fixed_len; /* XXX - Some sort of compare functions (like ftype)? ***/ /* XXX - Include functions for name resolution? ***/ @@ -88,7 +89,7 @@ static void address_type_register(int addr_type, address_type_t *at) int address_type_dissector_register(const char* name, const char* pretty_name, AddrValueToString to_str_func, AddrValueToStringLen str_len_func, - AddrColFilterString col_filter_str_func) + AddrColFilterString col_filter_str_func, AddrFixedLen fixed_len_func) { int addr_type; @@ -108,8 +109,9 @@ int address_type_dissector_register(const char* name, const char* pretty_name, dissector_type_addresses[num_dissector_addr_type].addr_to_str = to_str_func; dissector_type_addresses[num_dissector_addr_type].addr_str_len = str_len_func; dissector_type_addresses[num_dissector_addr_type].addr_col_filter = col_filter_str_func; + dissector_type_addresses[num_dissector_addr_type].addr_fixed_len = fixed_len_func; - type_list[addr_type] = &dissector_type_addresses[num_dissector_addr_type]; + type_list[addr_type] = &dissector_type_addresses[num_dissector_addr_type]; num_dissector_addr_type++; @@ -130,6 +132,11 @@ int none_addr_str_len(const address* addr _U_) return 1; /* NULL character for empty string */ } +int none_addr_len(void) +{ + return 0; +} + /****************************************************************************** * AT_ETHER ******************************************************************************/ @@ -145,7 +152,7 @@ int ether_str_len(const address* addr _U_) return 18; } -const char* ether_col_filter_str(const address* addr _U_, gboolean is_src) +static const char* ether_col_filter_str(const address* addr _U_, gboolean is_src) { if (is_src) return "eth.src"; @@ -153,6 +160,11 @@ const char* ether_col_filter_str(const address* addr _U_, gboolean is_src) return "eth.dst"; } +int ether_len(void) +{ + return 6; +} + /****************************************************************************** * AT_IPv4 ******************************************************************************/ @@ -167,7 +179,7 @@ static int ipv4_str_len(const address* addr _U_) return MAX_IP_STR_LEN; } -const char* ipv4_col_filter_str(const address* addr _U_, gboolean is_src) +static const char* ipv4_col_filter_str(const address* addr _U_, gboolean is_src) { if (is_src) return "ip.src"; @@ -175,14 +187,134 @@ const char* ipv4_col_filter_str(const address* addr _U_, gboolean is_src) return "ip.dst"; } +static int ipv4_len(void) +{ + return 4; +} + /****************************************************************************** * AT_IPv6 ******************************************************************************/ -static gboolean ipv6_to_str(const address* addr, gchar *buf, int buf_len _U_) +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static void +ip6_to_str_buf_len(const guchar* src, char *buf, size_t buf_len) +{ + struct { int base, len; } best, cur; + guint words[8]; + int i; + + if (buf_len < MAX_IP6_STR_LEN) { /* buf_len < 40 */ + g_strlcpy(buf, BUF_TOO_SMALL_ERR, buf_len); /* Let the unexpected value alert user */ + return; + } + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + for (i = 0; i < 16; i += 2) { + words[i / 2] = (src[i+1] << 0); + words[i / 2] |= (src[i] << 8); + } + best.base = -1; best.len = 0; + cur.base = -1; cur.len = 0; + for (i = 0; i < 8; i++) { + if (words[i] == 0) { + if (cur.base == -1) { + cur.base = i; + cur.len = 1; + } else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* Is this address an encapsulated IPv4? */ + /* XXX, + * Orginal code dated 1996 uses ::/96 as a valid IPv4-compatible addresses + * but since Feb 2006 ::/96 is deprecated one. + * Quoting wikipedia [0]: + * > The 96-bit zero-value prefix ::/96, originally known as IPv4-compatible + * > addresses, was mentioned in 1995[35] but first described in 1998.[41] + * > This class of addresses was used to represent IPv4 addresses within + * > an IPv6 transition technology. Such an IPv6 address has its first + * > (most significant) 96 bits set to zero, while its last 32 bits are the + * > IPv4 address that is represented. + * > In February 2006 the Internet Engineering Task Force (IETF) has deprecated + * > the use of IPv4-compatible addresses.[1] The only remaining use of this address + * > format is to represent an IPv4 address in a table or database with fixed size + * > members that must also be able to store an IPv6 address. + * + * If needed it can be fixed by changing next line: + * if (best.base == 0 && (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) + * to: + * if (best.base == 0 && best.len == 5 && words[5] == 0xffff) + * + * [0] http://en.wikipedia.org/wiki/IPv6_address#Historical_notes + */ + + if (best.base == 0 && (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) + { + /* best.len == 6 -> ::IPv4; 5 -> ::ffff:IPv4 */ + buf = g_stpcpy(buf, "::"); + if (best.len == 5) + buf = g_stpcpy(buf, "ffff:"); + ip_to_str_buf(src + 12, buf, MAX_IP_STR_LEN); + /* max: 2 + 5 + 16 == 23 bytes */ + return; + } + + /* + * Format the result. + */ + for (i = 0; i < 8; i++) { + /* Are we inside the best run of 0x00's? */ + if (i == best.base) { + *buf++ = ':'; + i += best.len; + + /* Was it a trailing run of 0x00's? */ + if (i == 8) { + *buf++ = ':'; + break; + } + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) + *buf++ = ':'; + + buf = word_to_hex_npad(buf, words[i]); /* max: 4B */ + /* max: 8 * 4 + 7 == 39 bytes */ + } + *buf = '\0'; /* 40 byte */ +} + +void +ip6_to_str_buf(const struct e_in6_addr *ad, gchar *buf) { - /* XXX - pull in ip6_to_str_buf_len as this should be the module for it */ + ip6_to_str_buf_len((const guchar*)ad, buf, MAX_IP6_STR_LEN); +} - ip6_to_str_buf((const struct e_in6_addr*)addr->data, buf/*, buf_len*/); +static gboolean ipv6_to_str(const address* addr, gchar *buf, int buf_len) +{ + ip6_to_str_buf_len((const guchar*)addr->data, buf, buf_len); return TRUE; } @@ -191,7 +323,7 @@ static int ipv6_str_len(const address* addr _U_) return MAX_IP6_STR_LEN; } -const char* ipv6_col_filter_str(const address* addr _U_, gboolean is_src) +static const char* ipv6_col_filter_str(const address* addr _U_, gboolean is_src) { if (is_src) return "ipv6.src"; @@ -199,6 +331,11 @@ const char* ipv6_col_filter_str(const address* addr _U_, gboolean is_src) return "ipv6.dst"; } +static int ipv6_len(void) +{ + return 16; +} + /****************************************************************************** * AT_IPX ******************************************************************************/ @@ -218,6 +355,11 @@ static int ipx_str_len(const address* addr _U_) return 22; } +static int ipx_len(void) +{ + return 10; +} + /****************************************************************************** * AT_VINES * XXX - This functionality should really be in packet-vines.c as a dissector @@ -240,6 +382,11 @@ static int vines_str_len(const address* addr _U_) return 14; } +static int vines_len(void) +{ + return VINES_ADDR_LEN; +} + /****************************************************************************** * AT_FC ******************************************************************************/ @@ -256,6 +403,10 @@ static int fc_str_len(const address* addr _U_) return 9; } +static int fc_len(void) +{ + return 3; +} /****************************************************************************** * AT_FCWWN @@ -324,6 +475,11 @@ static int fcwwn_str_len(const address* addr _U_) return 200; } +static int fcwwn_len(void) +{ + return FCWWN_ADDR_LEN; +} + /****************************************************************************** * AT_SS7PC * XXX - This should really be a dissector address type as its address string @@ -366,7 +522,12 @@ static gboolean eui64_addr_to_str(const address* addr, gchar *buf, int buf_len _ static int eui64_str_len(const address* addr _U_) { - return 24; + return EUI64_STR_LEN; +} + +static int eui64_len(void) +{ + return 8; } /****************************************************************************** @@ -445,7 +606,7 @@ static int ax25_addr_str_len(const address* addr _U_) return 21; /* Leaves extra space (10 bytes) just for uint_to_str_back() */ } -const char* ax25_col_filter_str(const address* addr _U_, gboolean is_src) +static const char* ax25_col_filter_str(const address* addr _U_, gboolean is_src) { if (is_src) return "ax25.src"; @@ -453,6 +614,11 @@ const char* ax25_col_filter_str(const address* addr _U_, gboolean is_src) return "ax25.dst"; } +static int ax25_len(void) +{ + return AX25_ADDR_LEN; +} + /****************************************************************************** * END OF PROVIDED ADDRESS TYPES ******************************************************************************/ @@ -468,7 +634,8 @@ void address_types_initialize(void) "No address", /* pretty_name */ none_addr_to_str, /* addr_to_str */ none_addr_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + none_addr_len /* addr_fixed_len */ }; static address_type_t ether_address = { @@ -477,7 +644,8 @@ void address_types_initialize(void) "Ethernet address", /* pretty_name */ ether_to_str, /* addr_to_str */ ether_str_len, /* addr_str_len */ - ether_col_filter_str /* addr_col_filter */ + ether_col_filter_str, /* addr_col_filter */ + ether_len /* addr_fixed_len */ }; static address_type_t ipv4_address = { @@ -486,7 +654,8 @@ void address_types_initialize(void) "IPv4 address", /* pretty_name */ ipv4_to_str, /* addr_to_str */ ipv4_str_len, /* addr_str_len */ - ipv4_col_filter_str /* addr_col_filter */ + ipv4_col_filter_str, /* addr_col_filter */ + ipv4_len /* addr_fixed_len */ }; static address_type_t ipv6_address = { @@ -495,7 +664,8 @@ void address_types_initialize(void) "IPv6 address", /* pretty_name */ ipv6_to_str, /* addr_to_str */ ipv6_str_len, /* addr_str_len */ - ipv6_col_filter_str /* addr_col_filter */ + ipv6_col_filter_str, /* addr_col_filter */ + ipv6_len /* addr_fixed_len */ }; static address_type_t ipx_address = { @@ -504,7 +674,8 @@ void address_types_initialize(void) "IPX address", /* pretty_name */ ipx_to_str, /* addr_to_str */ ipx_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + ipx_len /* addr_fixed_len */ }; static address_type_t vines_address = { @@ -513,7 +684,8 @@ void address_types_initialize(void) "Banyan Vines address", /* pretty_name */ vines_to_str, /* addr_to_str */ vines_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + vines_len /*addr_fixed_len */ }; static address_type_t fc_address = { @@ -522,7 +694,8 @@ void address_types_initialize(void) "FC address", /* pretty_name */ fc_to_str, /* addr_to_str */ fc_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + fc_len /*addr_fixed_len */ }; static address_type_t fcwwn_address = { @@ -531,7 +704,8 @@ void address_types_initialize(void) "Fibre Channel WWN", /* pretty_name */ fcwwn_to_str, /* addr_to_str */ fcwwn_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + fcwwn_len /* addr_fixed_len */ }; static address_type_t ss7pc_address = { @@ -540,7 +714,8 @@ void address_types_initialize(void) "SS7 Point Code", /* pretty_name */ ss7pc_to_str, /* addr_to_str */ ss7pc_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + NULL /* addr_fixed_len */ }; static address_type_t stringz_address = { @@ -549,7 +724,8 @@ void address_types_initialize(void) "String address", /* pretty_name */ stringz_addr_to_str, /* addr_to_str */ stringz_addr_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + NULL /* addr_fixed_len */ }; static address_type_t eui64_address = { @@ -558,7 +734,8 @@ void address_types_initialize(void) "IEEE EUI-64", /* pretty_name */ eui64_addr_to_str, /* addr_to_str */ eui64_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + eui64_len /* addr_fixed_len */ }; static address_type_t ib_address = { @@ -567,7 +744,8 @@ void address_types_initialize(void) "Infiniband GID/LID", /* pretty_name */ ib_addr_to_str, /* addr_to_str */ ib_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + NULL /* addr_fixed_len */ }; static address_type_t usb_address = { @@ -576,7 +754,8 @@ void address_types_initialize(void) "USB Address", /* pretty_name */ usb_addr_to_str, /* addr_to_str */ usb_addr_str_len, /* addr_str_len */ - NULL /* addr_col_filter */ + NULL, /* addr_col_filter */ + NULL /* addr_fixed_len */ }; static address_type_t ax25_address = { @@ -585,7 +764,8 @@ void address_types_initialize(void) "AX.25 Address", /* pretty_name */ ax25_addr_to_str, /* addr_to_str */ ax25_addr_str_len,/* addr_str_len */ - ax25_col_filter_str /* addr_col_filter */ + ax25_col_filter_str, /* addr_col_filter */ + ax25_len /* addr_fixed_len */ }; num_dissector_addr_type = 0; @@ -616,8 +796,7 @@ void address_types_initialize(void) g_assert(addr_type < MAX_ADDR_TYPE_VALUE); \ result = type_list[addr_type]; -/* XXX - Temporary? Here at least until all of the address type handling is finalized */ -int address_type_get_length(const address* addr) +static int address_type_get_length(const address* addr) { address_type_t *at; @@ -629,7 +808,29 @@ int address_type_get_length(const address* addr) return at->addr_str_len(addr); } -void address_type_to_string(const address* addr, gchar *buf, int buf_len) +/*XXX FIXME the code below may be called very very frequently in the future. + optimize it for speed and get rid of the slow sprintfs */ +/* XXX - perhaps we should have individual address types register + a table of routines to do operations such as address-to-name translation, + address-to-string translation, and the like, and have this call them, + and also have an address-to-string-with-a-name routine */ +/* convert an address struct into a printable string */ + +gchar* +address_to_str(wmem_allocator_t *scope, const address *addr) +{ + gchar *str; + int len = address_type_get_length(addr); + + if (len <= 0) + len = MAX_ADDR_STR_LEN; + + str=(gchar *)wmem_alloc(scope, len); + address_to_str_buf(addr, str, len); + return str; +} + +void address_to_str_buf(const address* addr, gchar *buf, int buf_len) { address_type_t *at; @@ -661,6 +862,41 @@ const char* address_type_column_filter_string(const address* addr, gboolean src) return at->addr_col_filter(addr, src); } +gchar* +tvb_address_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_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_to_str(scope, &addr); +} + +gchar* tvb_address_var_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, address_type type, const gint offset, int length) +{ + address addr; + + TVB_SET_ADDRESS(&addr, type, tvb, offset, length); + + return address_to_str(scope, &addr); +} + /* * Editor modelines - http://www.wireshark.org/tools/modelines.html diff --git a/epan/address_types.h b/epan/address_types.h index ae699c86eb..e2cbe05ab1 100644 --- a/epan/address_types.h +++ b/epan/address_types.h @@ -1,4 +1,5 @@ /* address_types.h + * Definitions for address types * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> @@ -30,6 +31,7 @@ extern "C" { typedef gboolean (*AddrValueToString)(const address* addr, gchar *buf, int buf_len); typedef int (*AddrValueToStringLen)(const address* addr); +typedef int (*AddrFixedLen)(void); typedef const char* (*AddrColFilterString)(const address* addr, gboolean src); struct _address_type_t; @@ -37,23 +39,23 @@ typedef struct _address_type_t address_type_t; int address_type_dissector_register(const char* name, const char* pretty_name, AddrValueToString to_str_func, AddrValueToStringLen str_len_func, - AddrColFilterString col_filter_str_func); + AddrColFilterString col_filter_str_func, AddrFixedLen fixed_len_func); void address_types_initialize(void); /* Address type functions used by multiple (dissector) address types */ gboolean none_addr_to_str(const address* addr, gchar *buf, int buf_len); int none_addr_str_len(const address* addr); +int none_addr_len(void); gboolean ether_to_str(const address* addr, gchar *buf, int buf_len); int ether_str_len(const address* addr); +int ether_len(void); /* XXX - Temporary? Here at least until all of the address type handling is finalized * Otherwise should be folded into address_types.c or just be handled with function pointers */ -int address_type_get_length(const address* addr); -void address_type_to_string(const address* addr, gchar *buf, int buf_len); const char* address_type_column_filter_string(const address* addr, gboolean src); diff --git a/epan/dissectors/packet-arcnet.c b/epan/dissectors/packet-arcnet.c index a7a1b4e457..a09cc59469 100644 --- a/epan/dissectors/packet-arcnet.c +++ b/epan/dissectors/packet-arcnet.c @@ -76,6 +76,11 @@ static const char* arcnet_col_filter_str(const address* addr _U_, gboolean is_sr return "arcnet.dst"; } +static int arcnet_len(void) +{ + return 1; +} + void capture_arcnet (const guchar *pd, int len, packet_counts *ld, gboolean has_offset, gboolean has_exception) @@ -380,7 +385,7 @@ proto_register_arcnet (void) proto_register_field_array (proto_arcnet, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); - arcnet_address_type = address_type_dissector_register("AT_ARCNET", "ARCNET Address", arcnet_to_str, arcnet_str_len, arcnet_col_filter_str); + arcnet_address_type = address_type_dissector_register("AT_ARCNET", "ARCNET Address", arcnet_to_str, arcnet_str_len, arcnet_col_filter_str, arcnet_len); } diff --git a/epan/dissectors/packet-atalk.c b/epan/dissectors/packet-atalk.c index 9e1ca4cf70..0b97a667e6 100644 --- a/epan/dissectors/packet-atalk.c +++ b/epan/dissectors/packet-atalk.c @@ -1195,7 +1195,7 @@ static int atalk_str_len(const address* addr _U_) return 14; } -const char* atalk_col_filter_str(const address* addr _U_, gboolean is_src) +static const char* atalk_col_filter_str(const address* addr _U_, gboolean is_src) { if (is_src) return "ddp.src"; @@ -1203,6 +1203,10 @@ const char* atalk_col_filter_str(const address* addr _U_, gboolean is_src) return "ddp.dst"; } +static int atalk_len(void) +{ + return 3; +} static int dissect_atp_zip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) @@ -2063,7 +2067,7 @@ proto_register_atalk(void) ddp_dissector_table = register_dissector_table("ddp.type", "DDP packet type", FT_UINT8, BASE_HEX); - atalk_address_type = address_type_dissector_register("AT_ATALK", "Appletalk DDP", atalk_to_str, atalk_str_len, atalk_col_filter_str); + atalk_address_type = address_type_dissector_register("AT_ATALK", "Appletalk DDP", atalk_to_str, atalk_str_len, atalk_col_filter_str, atalk_len); } void diff --git a/epan/dissectors/packet-devicenet.c b/epan/dissectors/packet-devicenet.c index 58e7229565..5e7974c0d7 100644 --- a/epan/dissectors/packet-devicenet.c +++ b/epan/dissectors/packet-devicenet.c @@ -792,6 +792,11 @@ static int devicenet_addr_str_len(const address* addr _U_) return 11; /* Leaves required space (10 bytes) for uint_to_str_back() */ } +static int devicenet_addr_len(void) +{ + return 1; +} + void proto_register_devicenet(void) { module_t *devicenet_module; @@ -1022,7 +1027,7 @@ void proto_register_devicenet(void) new_register_dissector("devicenet", dissect_devicenet, proto_devicenet); - devicenet_address_type = address_type_dissector_register("AT_DEVICENET", "DeviceNet Address", devicenet_addr_to_str, devicenet_addr_str_len, NULL); + devicenet_address_type = address_type_dissector_register("AT_DEVICENET", "DeviceNet Address", devicenet_addr_to_str, devicenet_addr_str_len, NULL, devicenet_addr_len); devicenet_module = prefs_register_protocol(proto_devicenet, NULL); diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index a66e03ec5c..c90856c5a0 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -26553,8 +26553,8 @@ proto_register_ieee80211 (void) wlan_tap = register_tap("wlan"); register_conversation_table(proto_wlan, TRUE, wlan_conversation_packet, wlan_hostlist_packet); - wlan_address_type = address_type_dissector_register("AT_ETHER_WLAN", "WLAN Address", ether_to_str, ether_str_len, wlan_col_filter_str); - wlan_bssid_address_type = address_type_dissector_register("AT_ETHER_BSSID", "WLAN BSSID Address", ether_to_str, ether_str_len, wlan_bssid_col_filter_str); + wlan_address_type = address_type_dissector_register("AT_ETHER_WLAN", "WLAN Address", ether_to_str, ether_str_len, wlan_col_filter_str, ether_len); + wlan_bssid_address_type = address_type_dissector_register("AT_ETHER_BSSID", "WLAN BSSID Address", ether_to_str, ether_str_len, wlan_bssid_col_filter_str, ether_len); /* Register configuration options */ wlan_module = prefs_register_protocol(proto_wlan, init_wepkeys); diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index ff37f1aa36..58a458fb57 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -414,6 +414,11 @@ static int ieee802_15_4_short_address_str_len(const address* addr _U_) return 11; } +static int ieee802_15_4_short_address_len(void) +{ + return 2; +} + /*FUNCTION:------------------------------------------------------ * NAME @@ -2784,7 +2789,7 @@ void proto_register_ieee802154(void) expert_register_field_array(expert_ieee802154, ei, array_length(ei)); ieee802_15_4_short_address_type = address_type_dissector_register("AT_IEEE_802_15_4_SHORT", "IEEE 802.15.4 16-bit short address", - ieee802_15_4_short_address_to_str, ieee802_15_4_short_address_str_len, NULL); + ieee802_15_4_short_address_to_str, ieee802_15_4_short_address_str_len, NULL, ieee802_15_4_short_address_len); /* add a user preference to set the 802.15.4 ethertype */ ieee802154_module = prefs_register_protocol(proto_ieee802154, diff --git a/epan/dissectors/packet-ismp.c b/epan/dissectors/packet-ismp.c index debb8d869f..69b5f66caf 100644 --- a/epan/dissectors/packet-ismp.c +++ b/epan/dissectors/packet-ismp.c @@ -28,6 +28,7 @@ #include <epan/expert.h> #include <epan/to_str.h> #include <epan/etypes.h> +#include <epan/addr_resolv.h> void proto_register_ismp(void); void proto_reg_handoff_ismp(void); @@ -215,6 +216,24 @@ static const value_string edp_tuple_types[] = { 0,NULL } }; +static gchar* +ipx_addr_to_str(const guint32 net, const guint8 *ad) +{ + gchar *buf; + char *name; + + name = get_ether_name_if_known(ad); + + if (name) { + buf = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", get_ipxnet_name(wmem_packet_scope(), net), name); + } + else { + buf = wmem_strdup_printf(wmem_packet_scope(), "%s.%s", get_ipxnet_name(wmem_packet_scope(), net), + bytestring_to_str(wmem_packet_scope(), ad, 6, '\0')); + } + return buf; +} + /* Function to dissect EDP portion of ISMP message */ static void dissect_ismp_edp(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *ismp_tree) diff --git a/epan/dissectors/packet-j1939.c b/epan/dissectors/packet-j1939.c index 94f9b3d981..4fbe1017ae 100644 --- a/epan/dissectors/packet-j1939.c +++ b/epan/dissectors/packet-j1939.c @@ -273,6 +273,19 @@ static int J1939_addr_str_len(const address* addr _U_) return 11; /* Leaves required space (10 bytes) for uint_to_str_back() */ } +static const char* J1939_col_filter_str(const address* addr _U_, gboolean is_src) +{ + if (is_src) + return "j1939.src_addr"; + + return "j1939.dst_addr"; +} + +static int J1939_addr_len(void) +{ + return 1; +} + void proto_register_j1939(void) { static hf_register_info hf[] = { @@ -337,7 +350,7 @@ void proto_register_j1939(void) subdissector_pgn_table = register_dissector_table("j1939.pgn", "PGN Handle", FT_UINT32, BASE_DEC); - j1939_address_type = address_type_dissector_register("AT_J1939", "J1939 Address", J1939_addr_to_str, J1939_addr_str_len, NULL); + j1939_address_type = address_type_dissector_register("AT_J1939", "J1939 Address", J1939_addr_to_str, J1939_addr_str_len, J1939_col_filter_str, J1939_addr_len); } /* diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index 13c4cc442d..6a8d8ab59f 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -2368,7 +2368,7 @@ void proto_register_jxta(void) /* Register JXTA Sub-tree */ proto_register_subtree_array(ett, array_length(ett)); - uri_address_type = address_type_dissector_register("AT_URI", "URI/URL/URN", uri_to_str, uri_str_len, uri_col_filter_str); + uri_address_type = address_type_dissector_register("AT_URI", "URI/URL/URN", uri_to_str, uri_str_len, uri_col_filter_str, NULL); /* Register preferences */ /* register re-init routine */ diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c index 677a839bc1..6d3426b112 100644 --- a/epan/dissectors/packet-mp2t.c +++ b/epan/dissectors/packet-mp2t.c @@ -1513,7 +1513,7 @@ proto_register_mp2t(void) expert_mp2t = expert_register_protocol(proto_mp2t); expert_register_field_array(expert_mp2t, ei, array_length(ei)); - mp2t_no_address_type = address_type_dissector_register("AT_MP2T_NONE", "No MP2T Address", none_addr_to_str, none_addr_str_len, NULL); + mp2t_no_address_type = address_type_dissector_register("AT_MP2T_NONE", "No MP2T Address", none_addr_to_str, none_addr_str_len, NULL, none_addr_len); heur_subdissector_list = register_heur_dissector_list("mp2t.pid"); /* Register init of processing of fragmented DEPI packets */ diff --git a/epan/dissectors/packet-mstp.c b/epan/dissectors/packet-mstp.c index a4d6d43b7a..c8159c99aa 100644 --- a/epan/dissectors/packet-mstp.c +++ b/epan/dissectors/packet-mstp.c @@ -172,6 +172,11 @@ static const char* mstp_col_filter_str(const address* addr _U_, gboolean is_src) return "mstp.dst"; } +static int mstp_len(void) +{ + return 1; +} + /* dissects a BACnet MS/TP frame */ /* preamble 0x55 0xFF is not included in Cimetrics U+4 output */ void @@ -460,7 +465,7 @@ proto_register_mstp(void) "MSTP Vendor specific Frametypes", FT_UINT24, BASE_DEC); /* Table_type: (Vendor ID << 16) + Frametype */ - mstp_address_type = address_type_dissector_register("AT_MSTP", "BACnet MS/TP Address", mstp_to_str, mstp_str_len, mstp_col_filter_str); + mstp_address_type = address_type_dissector_register("AT_MSTP", "BACnet MS/TP Address", mstp_to_str, mstp_str_len, mstp_col_filter_str, mstp_len); } void diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c index be78e0e404..1f50007ac9 100644 --- a/epan/dissectors/packet-sna.c +++ b/epan/dissectors/packet-sna.c @@ -3481,7 +3481,7 @@ proto_register_sna(void) "Systems Network Architecture XID", "SNA XID", "sna_xid"); register_dissector("sna_xid", dissect_sna_xid, proto_sna_xid); - sna_address_type = address_type_dissector_register("AT_SNA", "SNA Address", sna_fid_to_str_buf, sna_address_str_len, NULL); + sna_address_type = address_type_dissector_register("AT_SNA", "SNA Address", sna_fid_to_str_buf, sna_address_str_len, NULL, NULL); /* Register configuration options */ sna_module = prefs_register_protocol(proto_sna, NULL); diff --git a/epan/dissectors/packet-tipc.c b/epan/dissectors/packet-tipc.c index 5086e82c48..a9dc4cb05c 100644 --- a/epan/dissectors/packet-tipc.c +++ b/epan/dissectors/packet-tipc.c @@ -2962,7 +2962,7 @@ proto_register_tipc(void) tipc_module = prefs_register_protocol(proto_tipc, proto_reg_handoff_tipc); tipc_address_type = address_type_dissector_register("tipc_address_type", "TIPC Address Zone,Subnetwork,Processor", - tipc_addr_to_str_buf, tipc_addr_str_len, NULL); + tipc_addr_to_str_buf, tipc_addr_str_len, NULL, NULL); /* Set default ports */ range_convert_str(&global_tipc_udp_port_range, DEFAULT_TIPC_PORT_RANGE, MAX_TCP_PORT); diff --git a/epan/osi-utils.c b/epan/osi-utils.c index 48691ecf79..95354c7d1b 100644 --- a/epan/osi-utils.c +++ b/epan/osi-utils.c @@ -241,7 +241,7 @@ void register_osi_address_type(void) if (osi_address_type != -1) return; - osi_address_type = address_type_dissector_register("AT_OSI", "OSI Address", osi_address_to_str, osi_address_str_len, NULL); + osi_address_type = address_type_dissector_register("AT_OSI", "OSI Address", osi_address_to_str, osi_address_str_len, NULL, NULL); } diff --git a/epan/to_str.c b/epan/to_str.c index b42ec5469a..923f5e3f44 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -32,6 +32,7 @@ #include "to_str.h" #include "to_str-int.h" #include "strutil.h" +#include <wsutil/pint.h> /* * If a user _does_ pass in a too-small buffer, this is probably @@ -1057,6 +1058,22 @@ guid_to_str_buf(const e_guid_t *guid, gchar *buf, int buf_len) return buf; } +gchar * +eui64_to_str(wmem_allocator_t *scope, const guint64 ad) { + gchar *buf, *tmp; + guint8 *p_eui64; + + p_eui64=(guint8 *)wmem_alloc(scope, 8); + buf=(gchar *)wmem_alloc(scope, EUI64_STR_LEN); + + /* Copy and convert the address to network byte order. */ + *(guint64 *)(void *)(p_eui64) = pntoh64(&(ad)); + + tmp = bytes_to_hexstr_punct(buf, p_eui64, 8, ':'); + *tmp = '\0'; /* NULL terminate */ + return buf; +} + const gchar * port_type_to_str (port_type type) { diff --git a/epan/to_str.h b/epan/to_str.h index 56570e87fd..1eb46e3791 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -65,7 +65,6 @@ WS_DLL_PUBLIC void address_to_str_buf(const address *addr, gchar *buf, int b void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len); void ip6_to_str_buf(const struct e_in6_addr *, gchar *); -extern gchar* ipx_addr_to_str(const guint32, const guint8 *); extern gchar* ipxnet_to_str_punct(wmem_allocator_t *scope, const guint32 ad, const char punct); WS_DLL_PUBLIC gchar* eui64_to_str(wmem_allocator_t *scope, const guint64 ad); @@ -104,7 +103,7 @@ WS_DLL_PUBLIC const gchar* port_type_to_str (port_type type); * @return A pointer to the formatted string * */ -WS_DLL_PUBLIC gchar* tvb_address_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, address_type type, const gint offset); +WS_DLL_PUBLIC gchar* tvb_address_to_str(wmem_allocator_t *scope, tvbuff_t *tvb, int type, const gint offset); /** Turn an address type retrieved from a tvb into a string. * |