aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-01-04 21:40:05 -0500
committerMichael Mann <mmann78@netscape.net>2015-01-05 13:55:04 +0000
commit22b4ec91c006fec65e655ccbb0dbbc32438f820b (patch)
tree033dc9de28b8a79550a4dd769fcfb249df4be38c /epan
parent9a7318a184e25e08d1c8449e3f826e0a5c66ca3b (diff)
Replace ep_display_to_address with wmem equivalent display_to_address.
Almost all instances require using "manual" memory management, but it gets some ep_ calls out of the GUI. Change-Id: Ifa7303766b08d09442ccf3d7063cbe061578ecd9 Reviewed-on: https://code.wireshark.org/review/6318 Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r--epan/addr_resolv.c32
-rw-r--r--epan/addr_resolv.h20
-rw-r--r--epan/conversation_table.c6
-rw-r--r--epan/conversation_table.h2
-rw-r--r--epan/dissectors/packet-ipv6.c4
-rw-r--r--epan/wslua/wslua_pinfo.c2
6 files changed, 11 insertions, 55 deletions
diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c
index f78b6f7044..e352952cd9 100644
--- a/epan/addr_resolv.c
+++ b/epan/addr_resolv.c
@@ -2882,28 +2882,7 @@ ep_sctp_port_to_display(guint port)
} /* ep_sctp_port_to_display */
const gchar *
-ep_address_to_display(const address *addr)
-{
- const gchar *result;
-
- result = solve_address_to_name(addr);
-
- if (result != NULL)
- return result;
-
- /* if it gets here, either it is of type AT_NONE, */
- /* or it should be solvable in address_to_str -unless addr->type is wrongly defined */
-
- if (addr->type == AT_NONE){
- return "NONE";
- }
-
- /* We need an ephemeral allocated string */
- return ep_address_to_str(addr);
-}
-
-const gchar *
-wmem_address_to_display(wmem_allocator_t *allocator, const address *addr)
+address_to_display(wmem_allocator_t *allocator, const address *addr)
{
gchar *str = NULL;
const gchar *result = solve_address_to_name(addr);
@@ -2955,15 +2934,6 @@ get_addr_name(const address *addr)
}
}
-void
-get_addr_name_buf(const address *addr, gchar *buf, gsize size)
-{
- const gchar *result = ep_address_to_display(addr);
-
- g_strlcpy(buf, result, size);
-} /* get_addr_name_buf */
-
-
gchar *
get_ether_name(const guint8 *addr)
{
diff --git a/epan/addr_resolv.h b/epan/addr_resolv.h
index 140cc8703c..9051362f2a 100644
--- a/epan/addr_resolv.h
+++ b/epan/addr_resolv.h
@@ -132,7 +132,8 @@ extern gchar *ep_dccp_port_to_display(guint port);
*/
WS_DLL_PUBLIC gchar *ep_sctp_port_to_display(guint port);
-/* ep_address_to_display takes as input an "address", as defined in address.h */
+/*
+ * address_to_display takes as input an "address", as defined in address.h */
/* it returns a string that contains: */
/* - if the address is of a type that can be translated into a name, and the user */
/* has activated name resolution, the translated name */
@@ -140,23 +141,8 @@ WS_DLL_PUBLIC gchar *ep_sctp_port_to_display(guint port);
/* - if the address is of any other type, the result of ep_address_to_str on the argument, */
/* which should be a string representation for the answer -e.g. "10.10.10.10" for IPv4 */
/* address 10.10.10.10 */
-
-WS_DLL_PUBLIC
-const gchar *ep_address_to_display(const address *addr);
-
-/*
- * wmem_address_to_display is the same as ep_address_to_display above, but
- * using the wmem scope for memory management.
- */
WS_DLL_PUBLIC
-const gchar *wmem_address_to_display(wmem_allocator_t *allocator, const address *addr);
-
-/* get_addr_name_buf solves an address in the same way as ep_address_to_display above */
-/* The difference is that get_addr_name_buf takes as input a buffer, into which it puts */
-/* the result which is always NUL ('\0') terminated. The buffer should be large enough to */
-/* contain size characters including the terminator */
-
-void get_addr_name_buf(const address *addr, gchar *buf, gsize size);
+const gchar *address_to_display(wmem_allocator_t *allocator, const address *addr);
const gchar *get_addr_name(const address *addr);
diff --git a/epan/conversation_table.c b/epan/conversation_table.c
index 38171a0527..52e5bf43c8 100644
--- a/epan/conversation_table.c
+++ b/epan/conversation_table.c
@@ -332,12 +332,12 @@ void reset_hostlist_table_data(conv_hash_t *ch)
ch->hashtable=NULL;
}
-const char *get_conversation_address(address *addr, gboolean resolve_names)
+const char *get_conversation_address(wmem_allocator_t *allocator, address *addr, gboolean resolve_names)
{
if (resolve_names) {
- return ep_address_to_display(addr);
+ return address_to_display(allocator, addr);
} else {
- return ep_address_to_str(addr);
+ return address_to_str(allocator, addr);
}
}
diff --git a/epan/conversation_table.h b/epan/conversation_table.h
index b36184717f..536a237487 100644
--- a/epan/conversation_table.h
+++ b/epan/conversation_table.h
@@ -257,7 +257,7 @@ WS_DLL_PUBLIC void dissector_hostlist_init(const char *opt_arg, void* userdata);
* @param resolve_names Enable name resolution.
* @return An ep_allocated string representing the address.
*/
-WS_DLL_PUBLIC const char *get_conversation_address(address *addr, gboolean resolve_names);
+WS_DLL_PUBLIC const char *get_conversation_address(wmem_allocator_t *allocator, address *addr, gboolean resolve_names);
/** Get the string representation of a port.
*
diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c
index d682bb6e41..e38a848448 100644
--- a/epan/dissectors/packet-ipv6.c
+++ b/epan/dissectors/packet-ipv6.c
@@ -1925,7 +1925,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset + (int)offsetof(struct ip6_hdr, ip6_src),
16, (guint8 *)&ipv6->ip6_src);
PROTO_ITEM_SET_HIDDEN(ti);
- name = ep_address_to_display(&pinfo->src);
+ name = address_to_display(wmem_packet_scope(), &pinfo->src);
if (ipv6_summary_in_tree) {
SET_ADDRESS(&addr, AT_IPv6, 16, ipv6->ip6_src.bytes);
proto_item_append_text(ipv6_item, ", Src: %s (%s)", name, address_to_str(wmem_packet_scope(), &addr));
@@ -2013,7 +2013,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset + (int)offsetof(struct ip6_hdr, ip6_dst),
16, (guint8 *)&ipv6->ip6_dst);
PROTO_ITEM_SET_HIDDEN(ti);
- name = ep_address_to_display(&pinfo->dst);
+ name = address_to_display(wmem_packet_scope(), &pinfo->dst);
if (ipv6_summary_in_tree) {
SET_ADDRESS(&addr, AT_IPv6, 16, ipv6->ip6_dst.bytes);
proto_item_append_text(ipv6_item, ", Dst: %s (%s)", name, address_to_str(wmem_packet_scope(), &addr));
diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c
index 98bdee9ce4..6ea031d689 100644
--- a/epan/wslua/wslua_pinfo.c
+++ b/epan/wslua/wslua_pinfo.c
@@ -380,7 +380,7 @@ WSLUA_METHODS Address_methods[] = {
WSLUA_METAMETHOD Address__tostring(lua_State* L) {
Address addr = checkAddress(L,1);
- const gchar *str = wmem_address_to_display(NULL, addr);
+ const gchar *str = address_to_display(NULL, addr);
lua_pushstring(L, str);