diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-01-13 15:53:30 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-01-13 15:53:30 +0000 |
commit | a167206685d96ec2f601ddca81529e60a5822810 (patch) | |
tree | ab37d05388aa0483bd3c43e36ad614f9fee2863f | |
parent | d9520dc09c237743a11275c28d0c0c76ec051dc3 (diff) |
Introduce, and start using, tvb_ip_to_str() and tvb_ip6_to_str(). These
do the same as the non-tvb equivalents but take a TVB and an offset instead
of a pointer to an array of bytes.
Their purpose is to prevent (many) dissectors from doing:
ip_to_str(tvb_get_ptr(...)).
(About the names and the location: I like the names as they are but the names
imply that they should live in tvbuff.c. That would make some sense but
I didn't want to pull to_str.h into tvbuff.c...)
svn path=/trunk/; revision=35519
-rw-r--r-- | epan/address_to_str.c | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-3g-a11.c | 30 | ||||
-rw-r--r-- | epan/dissectors/packet-sctp.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-sua.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-wccp.c | 46 | ||||
-rw-r--r-- | epan/libwireshark.def | 2 | ||||
-rw-r--r-- | epan/to_str.h | 2 |
7 files changed, 71 insertions, 45 deletions
diff --git a/epan/address_to_str.c b/epan/address_to_str.c index 4aefbd523c..7f4691a66a 100644 --- a/epan/address_to_str.c +++ b/epan/address_to_str.c @@ -104,6 +104,17 @@ ip_to_str(const guint8 *ad) { return buf; } +#define IPV4_LENGTH 4 +const gchar * +tvb_ip_to_str(tvbuff_t *tvb, const gint offset) +{ + gchar *buf; + + buf=ep_alloc(MAX_IP_STR_LEN); + ip_to_str_buf(tvb_get_ptr(tvb, offset, IPV4_LENGTH), buf, MAX_IP_STR_LEN); + return buf; +} + /* XXX FIXME remove this one later when every call has been converted to ep_address_to_str() */ @@ -112,7 +123,7 @@ ip6_to_str(const struct e_in6_addr *ad) { #ifndef INET6_ADDRSTRLEN #define INET6_ADDRSTRLEN 46 #endif - static gchar *str; + gchar *str; str=ep_alloc(INET6_ADDRSTRLEN+1); @@ -120,6 +131,17 @@ ip6_to_str(const struct e_in6_addr *ad) { return str; } +#define IPV6_LENGTH 16 +gchar * +tvb_ip6_to_str(tvbuff_t *tvb, const gint offset) +{ + gchar *buf; + + buf=ep_alloc(INET6_ADDRSTRLEN+1); + ip6_to_str_buf((const struct e_in6_addr *)tvb_get_ptr(tvb, offset, IPV6_LENGTH), buf); + return buf; +} + void ip6_to_str_buf(const struct e_in6_addr *ad, gchar *buf) { diff --git a/epan/dissectors/packet-3g-a11.c b/epan/dissectors/packet-3g-a11.c index c0e0f35f5f..cc68b53770 100644 --- a/epan/dissectors/packet-3g-a11.c +++ b/epan/dissectors/packet-3g-a11.c @@ -724,7 +724,7 @@ dissect_a11_radius( tvbuff_t *tvb, int offset, proto_tree *tree, int app_len) case ATTR_TYPE_IPV4: proto_tree_add_text(radius_tree, tvb, offset + radius_offset, attribute_len, "3GPP2: %s (%s)", attrs[attribute_type].attrname, - ip_to_str(tvb_get_ptr(tvb,offset + radius_offset + 2,4))); + tvb_ip_to_str(tvb, offset + radius_offset + 2)); break; case ATTR_TYPE_TYPE: proto_tree_add_text(radius_tree, tvb, offset + radius_offset, @@ -883,8 +883,8 @@ static void dissect_fwd_qosinfo(tvbuff_t* tvb, int offset, proto_tree* ext_tree) guint8 flow_index; guint8 dscp_enabled = 0; - /* - * Starts with a length field + /* + * Starts with a length field * http://www.3gpp2.org/Public_html/specs/A.S0009-C_v1.0_070801.pdf */ proto_tree_add_item(ext_tree, hf_a11_fqi_length, tvb, offset+clen, 2, FALSE); @@ -967,8 +967,8 @@ static void dissect_rev_qosinfo(tvbuff_t* tvb, int offset, proto_tree* ext_tree) guint8 flow_count; guint8 flow_index; - /* - * Starts with a length field + /* + * Starts with a length field * http://www.3gpp2.org/Public_html/specs/A.S0009-C_v1.0_070801.pdf */ proto_tree_add_item(ext_tree, hf_a11_fqi_length, tvb, offset+clen, 2, FALSE); @@ -1400,8 +1400,8 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) switch (type) { case REGISTRATION_REQUEST: col_add_fstr(pinfo->cinfo, COL_INFO, "Reg Request: PDSN=%s PCF=%s", - ip_to_str(tvb_get_ptr(tvb, 8, 4)), - ip_to_str(tvb_get_ptr(tvb,12,4))); + tvb_ip_to_str(tvb, 8), + tvb_ip_to_str(tvb, 12)); if (tree) { ti = proto_tree_add_item(tree, proto_a11, tvb, offset, -1, FALSE); @@ -1453,7 +1453,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case REGISTRATION_REPLY: col_add_fstr(pinfo->cinfo, COL_INFO, "Reg Reply: PDSN=%s, Code=%u", - ip_to_str(tvb_get_ptr(tvb,8,4)), tvb_get_guint8(tvb,1)); + tvb_ip_to_str(tvb, 8), tvb_get_guint8(tvb,1)); if (tree) { /* Add Subtree */ @@ -1493,7 +1493,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case REGISTRATION_UPDATE: col_add_fstr(pinfo->cinfo, COL_INFO,"Reg Update: PDSN=%s", - ip_to_str(tvb_get_ptr(tvb,8,4))); + tvb_ip_to_str(tvb, 8)); if (tree) { /* Add Subtree */ ti = proto_tree_add_item(tree, proto_a11, tvb, offset, -1, FALSE); @@ -1527,7 +1527,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case REGISTRATION_ACK: col_add_fstr(pinfo->cinfo, COL_INFO, "Reg Ack: PCF=%s Status=%u", - ip_to_str(tvb_get_ptr(tvb, 8, 4)), + tvb_ip_to_str(tvb, 8), tvb_get_guint8(tvb,3)); if (tree) { /* Add Subtree */ @@ -1566,7 +1566,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case SESSION_UPDATE: /* IOS4.3 */ col_add_fstr(pinfo->cinfo, COL_INFO,"Ses Update: PDSN=%s", - ip_to_str(tvb_get_ptr(tvb,8,4))); + tvb_ip_to_str(tvb, 8)); if (tree) { /* Add Subtree */ ti = proto_tree_add_item(tree, proto_a11, tvb, offset, -1, FALSE); @@ -1600,7 +1600,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case SESSION_ACK: /* IOS4.3 */ col_add_fstr(pinfo->cinfo, COL_INFO, "Ses Upd Ack: PCF=%s, Status=%u", - ip_to_str(tvb_get_ptr(tvb, 8, 4)), + tvb_ip_to_str(tvb, 8), tvb_get_guint8(tvb,3)); if (tree) { /* Add Subtree */ @@ -1639,8 +1639,8 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case CAPABILITIES_INFO: /* IOS5.1 */ col_add_fstr(pinfo->cinfo, COL_INFO, "Cap Info: PDSN=%s, PCF=%s", - ip_to_str(tvb_get_ptr(tvb, 8, 4)), - ip_to_str(tvb_get_ptr(tvb,12,4))); + tvb_ip_to_str(tvb, 8), + tvb_ip_to_str(tvb, 12)); if (tree) { /* Add Subtree */ ti = proto_tree_add_item(tree, proto_a11, tvb, offset, -1, FALSE); @@ -1678,7 +1678,7 @@ dissect_a11( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case CAPABILITIES_INFO_ACK: /* IOS5.1 */ col_add_fstr(pinfo->cinfo, COL_INFO, "Cap Info Ack: PCF=%s", - ip_to_str(tvb_get_ptr(tvb, 8, 4))); + tvb_ip_to_str(tvb, 8)); if (tree) { /* Add Subtree */ ti = proto_tree_add_item(tree, proto_a11, tvb, offset, -1, FALSE); diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c index c887d910f0..49a5192e07 100644 --- a/epan/dissectors/packet-sctp.c +++ b/epan/dissectors/packet-sctp.c @@ -923,9 +923,9 @@ dissect_ipv4_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, prot { if (parameter_tree) { proto_tree_add_item(parameter_tree, hf_ipv4_address, parameter_tvb, IPV4_ADDRESS_OFFSET, IPV4_ADDRESS_LENGTH, ENC_BIG_ENDIAN); - proto_item_append_text(parameter_item, " (Address: %s)", ip_to_str((const guint8 *)tvb_get_ptr(parameter_tvb, IPV4_ADDRESS_OFFSET, IPV4_ADDRESS_LENGTH))); + proto_item_append_text(parameter_item, " (Address: %s)", tvb_ip_to_str(parameter_tvb, IPV4_ADDRESS_OFFSET)); if (additional_item) - proto_item_append_text(additional_item, "%s", ip_to_str((const guint8 *)tvb_get_ptr(parameter_tvb, IPV4_ADDRESS_OFFSET, IPV4_ADDRESS_LENGTH))); + proto_item_append_text(additional_item, "%s", tvb_ip_to_str(parameter_tvb, IPV4_ADDRESS_OFFSET)); } if (dissecting_init_init_ack_chunk) { if (sctp_info.number_of_tvbs < MAXIMUM_NUMBER_OF_TVBS) @@ -943,9 +943,9 @@ dissect_ipv6_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, prot { if (parameter_tree) { proto_tree_add_item(parameter_tree, hf_ipv6_address, parameter_tvb, IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH, ENC_BIG_ENDIAN); - proto_item_append_text(parameter_item, " (Address: %s)", ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(parameter_tvb, IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH))); + proto_item_append_text(parameter_item, " (Address: %s)", tvb_ip6_to_str(parameter_tvb, IPV6_ADDRESS_OFFSET)); if (additional_item) - proto_item_append_text(additional_item, "%s", ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(parameter_tvb, IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH))); + proto_item_append_text(additional_item, "%s", tvb_ip6_to_str(parameter_tvb, IPV6_ADDRESS_OFFSET)); } if (dissecting_init_init_ack_chunk) { if (sctp_info.number_of_tvbs < MAXIMUM_NUMBER_OF_TVBS) diff --git a/epan/dissectors/packet-sua.c b/epan/dissectors/packet-sua.c index 8d6868853b..a7b0a01801 100644 --- a/epan/dissectors/packet-sua.c +++ b/epan/dissectors/packet-sua.c @@ -1304,7 +1304,7 @@ static void dissect_ipv4_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { proto_tree_add_item(parameter_tree, hf_ipv4, parameter_tvb, IPV4_ADDRESS_OFFSET, IPV4_ADDRESS_LENGTH, ENC_BIG_ENDIAN); - proto_item_append_text(parameter_item, " (%s)", ip_to_str((const guint8 *)tvb_get_ptr(parameter_tvb, IPV4_ADDRESS_OFFSET, IPV4_ADDRESS_LENGTH))); + proto_item_append_text(parameter_item, " (%s)", tvb_ip_to_str(parameter_tvb, IPV4_ADDRESS_OFFSET)); } #define HOSTNAME_OFFSET PARAMETER_VALUE_OFFSET @@ -1327,7 +1327,7 @@ static void dissect_ipv6_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { proto_tree_add_item(parameter_tree, hf_ipv6, parameter_tvb, IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH, ENC_BIG_ENDIAN); - proto_item_append_text(parameter_item, " (%s)", ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(parameter_tvb, IPV6_ADDRESS_OFFSET, IPV6_ADDRESS_LENGTH))); + proto_item_append_text(parameter_item, " (%s)", tvb_ip6_to_str(parameter_tvb, IPV6_ADDRESS_OFFSET)); } static void diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c index 9b2ca4ef51..a14a6c9401 100644 --- a/epan/dissectors/packet-wccp.c +++ b/epan/dissectors/packet-wccp.c @@ -172,7 +172,7 @@ static gboolean dissect_wccp2_security_info(tvbuff_t *tvb, int offset, int length, packet_info *pinfo _U_, proto_tree *info_tree); static gboolean dissect_wccp2_service_info(tvbuff_t *tvb, int offset, int length, packet_info *pinfo, proto_tree *info_tree); -static gboolean dissect_wccp2_router_identity_info(tvbuff_t *tvb, int offset, +static gboolean dissect_wccp2_router_identity_info(tvbuff_t *tvb, int offset, int length, packet_info *pinfo _U_, proto_tree *info_tree); static gboolean dissect_wccp2_wc_identity_info(tvbuff_t *tvb, int offset, int length, packet_info *pinfo _U_, proto_tree *info_tree); @@ -724,7 +724,7 @@ dissect_wccp2_router_identity_element(tvbuff_t *tvb, int offset, proto_tree *tree) { proto_tree_add_text(tree, tvb, offset, 4, - "IP Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + "IP Address: %s", tvb_ip_to_str(tvb, offset)); proto_tree_add_text(tree, tvb, offset + 4, 4, "Receive ID: %u", tvb_get_ntohl(tvb, offset + 4)); } @@ -747,14 +747,14 @@ dissect_wccp2_router_identity_info(tvbuff_t *tvb, int offset, int length, te = proto_tree_add_text(info_tree, tvb, offset, 8, "Router Identity Element: IP address %s", - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); element_tree = proto_item_add_subtree(te, ett_router_identity_element); dissect_wccp2_router_identity_element(tvb, offset, element_tree); offset += 8; proto_tree_add_text(info_tree, tvb, offset, 4, - "Sent To IP Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + "Sent To IP Address: %s", tvb_ip_to_str(tvb, offset)); offset += 4; n_received_from = tvb_get_ntohl(tvb, offset); @@ -765,7 +765,7 @@ dissect_wccp2_router_identity_info(tvbuff_t *tvb, int offset, int length, for (i = 0; i < n_received_from; i++) { proto_tree_add_text(info_tree, tvb, offset, 4, "Received From IP Address %d: %s", i, - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); offset += 4; } @@ -788,7 +788,7 @@ dissect_wccp2_web_cache_identity_element(tvbuff_t *tvb, int offset, int n; proto_tree_add_text(tree, tvb, offset, 4, - "Web-Cache IP Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + "Web-Cache IP Address: %s", tvb_ip_to_str(tvb, offset)); offset += 4; proto_tree_add_text(tree, tvb, offset, 2, @@ -843,7 +843,7 @@ dissect_wccp2_wc_identity_info(tvbuff_t *tvb, int offset, int length, te = proto_tree_add_text(info_tree, tvb, offset, 4+2+2+32+2+2, "Web-Cache Identity Element: IP address %s", - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); element_tree = proto_item_add_subtree(te, ett_wc_identity_element); if (!dissect_wccp2_web_cache_identity_element(tvb, offset, element_tree)) @@ -860,7 +860,7 @@ dissect_wccp2_assignment_key(tvbuff_t *tvb, int offset, { proto_tree_add_text(info_tree, tvb, offset, 4, "Assignment Key IP Address: %s", - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); proto_tree_add_text(info_tree, tvb, offset + 4, 4, "Assignment Key Change Number: %u", tvb_get_ntohl(tvb, offset + 4)); } @@ -897,7 +897,7 @@ dissect_wccp2_router_view_info(tvbuff_t *tvb, int offset, int length, for (i = 0; i < n_routers; i++) { proto_tree_add_text(info_tree, tvb, offset, 4, "Router %d IP Address: %s", i, - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); offset += 4; } @@ -909,7 +909,7 @@ dissect_wccp2_router_view_info(tvbuff_t *tvb, int offset, int length, for (i = 0; i < n_web_caches; i++) { te = proto_tree_add_text(info_tree, tvb, offset, WC_ID_INFO_LEN, "Web-Cache Identity Element %d: IP address %s", i, - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); element_tree = proto_item_add_subtree(te, ett_wc_identity_element); if (!dissect_wccp2_web_cache_identity_element(tvb, @@ -952,7 +952,7 @@ dissect_wccp2_wc_view_info(tvbuff_t *tvb, int offset, int length, for (i = 0; i < n_routers; i++) { te = proto_tree_add_text(info_tree, tvb, offset, 8, "Router %d Identity Element: IP address %s", i, - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); element_tree = proto_item_add_subtree(te, ett_router_identity_element); dissect_wccp2_router_identity_element(tvb, offset, element_tree); @@ -967,7 +967,7 @@ dissect_wccp2_wc_view_info(tvbuff_t *tvb, int offset, int length, for (i = 0; i < n_web_caches; i++) { proto_tree_add_text(info_tree, tvb, offset, 4, "Web-Cache %d: IP address %s", i, - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); offset += 4; } @@ -981,7 +981,7 @@ dissect_wccp2_router_assignment_element(tvbuff_t *tvb, int offset, proto_tree *tree) { proto_tree_add_text(tree, tvb, offset, 4, - "IP Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + "IP Address: %s", tvb_ip_to_str(tvb, offset)); proto_tree_add_text(tree, tvb, offset + 4, 4, "Receive ID: %u", tvb_get_ntohl(tvb, offset + 4)); proto_tree_add_text(tree, tvb, offset + 8, 4, @@ -1030,7 +1030,7 @@ dissect_wccp2_assignment_info(tvbuff_t *tvb, int offset, int length, for (i = 0; i < n_routers; i++) { te = proto_tree_add_text(info_tree, tvb, offset, 4, "Router %d Assignment Element: IP address %s", i, - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); element_tree = proto_item_add_subtree(te, ett_router_assignment_element); dissect_wccp2_router_assignment_element(tvb, offset, @@ -1046,7 +1046,7 @@ dissect_wccp2_assignment_info(tvbuff_t *tvb, int offset, int length, for (i = 0; i < n_web_caches; i++) { proto_tree_add_text(info_tree, tvb, offset, 4, "Web-Cache %d: IP address %s", i, - ip_to_str(tvb_get_ptr(tvb, offset, 4))); + tvb_ip_to_str(tvb, offset)); offset += 4; } @@ -1077,7 +1077,7 @@ dissect_wccp2_router_query_info(tvbuff_t *tvb, int offset, int length, } proto_tree_add_text(info_tree, tvb, offset, 4, - "Router IP Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + "Router IP Address: %s", tvb_ip_to_str(tvb, offset)); offset += 4; proto_tree_add_text(info_tree, tvb, offset, 4, @@ -1085,11 +1085,11 @@ dissect_wccp2_router_query_info(tvbuff_t *tvb, int offset, int length, offset += 4; proto_tree_add_text(info_tree, tvb, offset, 4, - "Sent To IP Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + "Sent To IP Address: %s", tvb_ip_to_str(tvb, offset)); offset += 4; proto_tree_add_text(info_tree, tvb, offset, 4, - "Target IP Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + "Target IP Address: %s", tvb_ip_to_str(tvb, offset)); return TRUE; } @@ -1289,15 +1289,15 @@ dissect_wccp2_value_element(tvbuff_t *tvb, int offset, int idx, proto_tree *info tl = proto_tree_add_text(info_tree, tvb, offset, 16, "Value Element(%u)", idx); element_tree = proto_item_add_subtree(tl, ett_value_element); - proto_tree_add_text(element_tree, tvb, offset, 4, "Source Address value: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + proto_tree_add_text(element_tree, tvb, offset, 4, "Source Address value: %s", tvb_ip_to_str(tvb, offset)); offset += 4; - proto_tree_add_text(element_tree, tvb, offset, 4, "Destination Address value: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + proto_tree_add_text(element_tree, tvb, offset, 4, "Destination Address value: %s", tvb_ip_to_str(tvb, offset)); offset += 4; proto_tree_add_text(element_tree, tvb, offset, 2, "Source Port value: %u", tvb_get_ntohs(tvb, offset)); offset += 2; proto_tree_add_text(element_tree, tvb, offset, 2, "Source Port value: %u", tvb_get_ntohs(tvb, offset)); offset += 2; - proto_tree_add_text(element_tree, tvb, offset, 4, "Web Cache Address: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + proto_tree_add_text(element_tree, tvb, offset, 4, "Web Cache Address: %s", tvb_ip_to_str(tvb, offset)); } static guint @@ -1312,9 +1312,9 @@ dissect_wccp2_mask_value_set_element(tvbuff_t *tvb, int offset, int idx, proto_t "Mask/Value Set Element(%d)", idx); element_tree = proto_item_add_subtree(tl, ett_mv_set_element); - proto_tree_add_text(element_tree, tvb, offset, 4, "Source Address Mask: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + proto_tree_add_text(element_tree, tvb, offset, 4, "Source Address Mask: %s", tvb_ip_to_str(tvb, offset)); offset += 4; - proto_tree_add_text(element_tree, tvb, offset, 4, "Destination Address Mask: %s", ip_to_str(tvb_get_ptr(tvb, offset, 4))); + proto_tree_add_text(element_tree, tvb, offset, 4, "Destination Address Mask: %s", tvb_ip_to_str(tvb, offset)); offset += 4; proto_tree_add_text(element_tree, tvb, offset, 2, "Source Port Mask: %04x", tvb_get_ntohs(tvb, offset)); offset += 2; diff --git a/epan/libwireshark.def b/epan/libwireshark.def index f29e0dc3d9..27b13b5ee9 100644 --- a/epan/libwireshark.def +++ b/epan/libwireshark.def @@ -614,8 +614,10 @@ InfoRequestNakReason_vals DATA init_dissection init_progfile_dir ip6_to_str +tvb_ip6_to_str in_cksum ip_to_str +tvb_ip_to_str ipprotostr ipv4_get_net_order_addr is_big_endian diff --git a/epan/to_str.h b/epan/to_str.h index d1bb65f47c..c4528910d8 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -50,10 +50,12 @@ extern void address_to_str_buf(const address *addr, gchar *buf, int buf_len) extern gchar* bytestring_to_str(const guint8 *, const guint32, const char); extern gchar* ether_to_str(const guint8 *); extern const gchar* ip_to_str(const guint8 *); +extern const gchar* tvb_ip_to_str(tvbuff_t *tvb, const gint offset); extern void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len); extern gchar* fc_to_str(const guint8 *); extern gchar* fcwwn_to_str (const guint8 *); extern gchar* ip6_to_str(const struct e_in6_addr *); +extern gchar* tvb_ip6_to_str(tvbuff_t *tvb, const gint offset); extern 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_string(const guint8 *ad); |