summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2014-12-19 18:13:17 -0500
committerMichael Mann <mmann78@netscape.net>2014-12-21 15:12:58 +0000
commitcdaa6698297a9e14ae9b321f0c6ee536afa917b6 (patch)
treef0b8c6bb54bf44840ce4779f8b154b268a04df69
parent6f8de873c7bd3f93fe01c349b41e80e4956c5a33 (diff)
downloadwireshark-cdaa6698297a9e14ae9b321f0c6ee536afa917b6.tar.gz
Replace ax25_to_str and get_ax25_name with address_to_str.
Change-Id: I74ddb6fc629ef32b217dede7a3ba652cbbf5ab12 Reviewed-on: https://code.wireshark.org/review/5932 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/address_to_str.c24
-rw-r--r--epan/column-utils.c2
-rw-r--r--epan/dissectors/packet-aprs.c4
-rw-r--r--epan/dissectors/packet-arp.c11
-rw-r--r--epan/dissectors/packet-ax25.c9
-rw-r--r--epan/dissectors/packet-netrom.c10
-rw-r--r--epan/proto.c11
-rw-r--r--epan/to_str.h3
8 files changed, 27 insertions, 47 deletions
diff --git a/epan/address_to_str.c b/epan/address_to_str.c
index de02c5dc4d..32f1fb45e2 100644
--- a/epan/address_to_str.c
+++ b/epan/address_to_str.c
@@ -485,30 +485,6 @@ tvb_fcwwn_to_str(tvbuff_t *tvb, const gint offset)
return fcwwn_to_str (tvb_get_ptr(tvb, offset, 8));
}
-/* XXX FIXME
-remove this one later when every call has been converted to address_to_str()
-*/
-const gchar *
-ax25_to_str(const guint8 *ad)
-{
- return bytestring_to_ep_str(ad, 7, ':');
-}
-
-/* XXX FIXME
-remove this one later when every call has been converted to address_to_str()
-*/
-gchar *
-get_ax25_name(const guint8 *ad)
-{
- address addr;
-
- addr.type = AT_AX25;
- addr.len = 7;
- addr.data = ad;
-
- return ep_address_to_str( &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
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 23b94d6e83..fe74a3ff0c 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -1862,7 +1862,7 @@ col_set_addr(packet_info *pinfo, const int col, const address *addr, const gbool
pinfo->cinfo->col_expr.col_expr[col] = "ax25.src";
else
pinfo->cinfo->col_expr.col_expr[col] = "ax25.dst";
- g_strlcpy(pinfo->cinfo->col_expr.col_expr_val[col], ax25_to_str((const guint8 *)addr->data), COL_MAX_LEN);
+ address_to_str_buf(addr, pinfo->cinfo->col_expr.col_expr_val[col], COL_MAX_LEN);
break;
case AT_ETHER:
diff --git a/epan/dissectors/packet-aprs.c b/epan/dissectors/packet-aprs.c
index ed589b400d..ae867f2ab7 100644
--- a/epan/dissectors/packet-aprs.c
+++ b/epan/dissectors/packet-aprs.c
@@ -44,7 +44,9 @@
#include <epan/packet.h>
#include <epan/prefs.h>
-#define AX25_ADDR_LEN 7 /* length of an AX.25 address */
+#include <epan/wmem/wmem.h>
+#include <epan/to_str.h>
+
#define STRLEN 100
void proto_register_aprs(void);
diff --git a/epan/dissectors/packet-arp.c b/epan/dissectors/packet-arp.c
index 68fab05bae..85aac851ae 100644
--- a/epan/dissectors/packet-arp.c
+++ b/epan/dissectors/packet-arp.c
@@ -388,9 +388,16 @@ arpproaddr_to_str(const guint8 *ad, int ad_len, guint16 type)
return ip_to_str(ad);
}
if (ARP_HW_IS_AX25(type, ad_len)) {
+ {
/* AX.25 address */
- return get_ax25_name(ad);
- /*return ax25_to_str(ad);*/
+ address addr;
+
+ addr.type = AT_AX25;
+ addr.len = AX25_ADDR_LEN;
+ addr.data = ad;
+
+ return address_to_str(wmem_packet_scope(), &addr);
+ }
}
return bytes_to_ep_str(ad, ad_len);
}
diff --git a/epan/dissectors/packet-ax25.c b/epan/dissectors/packet-ax25.c
index e51ed64d18..cd02623769 100644
--- a/epan/dissectors/packet-ax25.c
+++ b/epan/dissectors/packet-ax25.c
@@ -56,7 +56,6 @@
#define STRLEN 80
-#define AX25_ADDR_LEN 7 /* length of an AX.25 address */
#define AX25_HEADER_SIZE 15 /* length of src_addr + dst_addr + cntl */
#define AX25_MAX_DIGIS 8
@@ -177,11 +176,9 @@ dissect_ax25( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree )
/* step over src addr point at either 1st via addr or control byte */
offset += AX25_ADDR_LEN;
- proto_item_append_text( ti, ", Src: %s (%s), Dst: %s (%s)",
- get_ax25_name( src_addr ),
- ax25_to_str( src_addr ),
- get_ax25_name( dst_addr ),
- ax25_to_str( dst_addr ) );
+ proto_item_append_text( ti, ", Src: %s, Dst: %s",
+ address_to_str(wmem_packet_scope(), &pinfo->src),
+ address_to_str(wmem_packet_scope(), &pinfo->dst));
/* decode the cmd/resp field */
/* v2cmdresp = '.'; */
diff --git a/epan/dissectors/packet-netrom.c b/epan/dissectors/packet-netrom.c
index da03a7353d..cfd341901a 100644
--- a/epan/dissectors/packet-netrom.c
+++ b/epan/dissectors/packet-netrom.c
@@ -54,8 +54,6 @@ void proto_reg_handoff_netrom(void);
#define STRLEN 80
-#define AX25_ADDR_LEN 7 /* length of an AX.25 address */
-
#define NETROM_MIN_SIZE 7 /* minumum payload for a routing packet */
#define NETROM_HEADER_SIZE 20 /* minumum payload for a normal packet */
@@ -244,11 +242,9 @@ dissect_netrom_proto(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* create display subtree for the protocol */
ti = proto_tree_add_protocol_format( tree, proto_netrom, tvb, 0, NETROM_HEADER_SIZE,
- "NET/ROM, Src: %s (%s), Dst: %s (%s)",
- get_ax25_name( src_addr ),
- ax25_to_str( src_addr ),
- get_ax25_name( dst_addr ),
- ax25_to_str( dst_addr ) );
+ "NET/ROM, Src: %s, Dst: %s",
+ address_to_str(wmem_packet_scope(), &pinfo->src),
+ address_to_str(wmem_packet_scope(), &pinfo->dst));
netrom_tree = proto_item_add_subtree( ti, ett_netrom );
diff --git a/epan/proto.c b/epan/proto.c
index eef7ab8f2b..c6ff126982 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -6032,10 +6032,13 @@ proto_item_fill_label(field_info *fi, gchar *label_str)
break;
case FT_AX25:
- bytes = (guint8 *)fvalue_get(&fi->value);
- label_fill_descr(label_str, 0, hfinfo,
- get_ax25_name(bytes),
- ax25_to_str(bytes));
+ addr.type = AT_AX25;
+ addr.len = AX25_ADDR_LEN;
+ addr.data = (guint8 *)fvalue_get(&fi->value);
+
+ g_snprintf(label_str, ITEM_LABEL_LENGTH,
+ "%s: %s", hfinfo->name,
+ ep_address_to_str( &addr ));
break;
case FT_VINES:
diff --git a/epan/to_str.h b/epan/to_str.h
index 2b6f8debd9..5ba856c826 100644
--- a/epan/to_str.h
+++ b/epan/to_str.h
@@ -37,6 +37,7 @@
#define MAX_ADDR_STR_LEN 256
#define VINES_ADDR_LEN 6
#define EUI64_STR_LEN 24
+#define AX25_ADDR_LEN 7
#ifdef __cplusplus
extern "C" {
@@ -54,8 +55,6 @@ WS_DLL_PUBLIC gchar* ep_address_to_str(const address *);
WS_DLL_PUBLIC void address_to_str_buf(const address *addr, gchar *buf, int buf_len);
WS_DLL_PUBLIC const gchar* ether_to_str(const guint8 *);
WS_DLL_PUBLIC const gchar* tvb_ether_to_str(tvbuff_t *tvb, const gint offset);
-extern const gchar* ax25_to_str(const guint8 *);
-extern gchar* get_ax25_name(const guint8 *);
WS_DLL_PUBLIC const gchar* ip_to_str(const guint8 *);
WS_DLL_PUBLIC const gchar* tvb_ip_to_str(tvbuff_t *tvb, const gint offset);
void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len);