return buf;
}
+/*
+ This function is very fast and this function is called a lot.
+ XXX update the ep_address_to_str stuff to use this function.
+*/
+gchar *
+eui64_to_str(const guint64 ad) {
+ gchar *buf;
+ guint8 *p_eui64;
+
+ p_eui64 = ep_alloc(8);
+ buf=ep_alloc(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_eui64_to_str(tvbuff_t *tvb, const gint offset, const guint encoding)
+{
+ if(encoding)
+ {
+ return eui64_to_str(tvb_get_letoh64(tvb, offset));
+ }else {
+ return eui64_to_str(tvb_get_ntoh64(tvb, offset));
+ }
+}
+
static void
usb_addr_to_str_buf(const guint8 *addrp, gchar *buf, int buf_len)
{
buf_len - PREAMBLE_STR_LEN) == NULL ) /* Returns NULL if no space and does not touch buf */
g_snprintf ( buf, buf_len, BUF_TOO_SMALL_ERR ); /* Let the unexpected value alert user */
} else { /* this is a LID (16 bits) */
- guint16 lid_number = *((guint16*) addr->data);
+ guint16 lid_number;
+
+ memcpy((void *)&lid_number, addr->data, sizeof lid_number);
g_snprintf(buf,buf_len,"LID: %u",lid_number);
}
}