aboutsummaryrefslogtreecommitdiffstats
path: root/epan/to_str.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-02-08 20:36:03 -0500
committerMichael Mann <mmann78@netscape.net>2015-02-09 03:49:13 +0000
commit8ff944d4ab892521c6a32fe40f6a410640a34d34 (patch)
treecb9bb5956a1073babc778b2f75fd2d83a52608e3 /epan/to_str.c
parent2875cd382fdc0efd5d949f674a0328ecf918b7e9 (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>
Diffstat (limited to 'epan/to_str.c')
-rw-r--r--epan/to_str.c17
1 files changed, 17 insertions, 0 deletions
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)
{