/* to_str.c
* Routines for utilities to convert various other types to strings.
*
- * $Id: to_str.c,v 1.25 2003/02/12 00:44:04 guy Exp $
+ * $Id: to_str.c,v 1.30 2003/08/23 13:56:39 sahlberg Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
#ifndef INET6_ADDRSTRLEN
#define INET6_ADDRSTRLEN 46
#endif
- static gchar buf[INET6_ADDRSTRLEN];
+ static int i=0;
+ static gchar *strp, str[4][INET6_ADDRSTRLEN];
- inet_ntop(AF_INET6, (const guchar*)ad, (gchar*)buf, sizeof(buf));
- return buf;
+ i++;
+ if(i>=4){
+ i=0;
+ }
+ strp=str[i];
+
+ inet_ntop(AF_INET6, (const guchar*)ad, (gchar*)strp, INET6_ADDRSTRLEN);
+ return strp;
}
gchar*
return cur;
}
+
gchar *
fc_to_str(const guint8 *ad)
{
return bytestring_to_str (ad, 3, '.');
}
+gchar *
+fc32_to_str(address *addr)
+{
+ static gchar *cur;
+ static gchar str[3][9];
+
+ if (cur == &str[0][0]) {
+ cur = &str[1][0];
+ } else if (cur == &str[1][0]) {
+ cur = &str[2][0];
+ } else {
+ cur = &str[0][0];
+ }
+
+ sprintf(cur,"%02x.%02x.%02x", addr->data[0], addr->data[1], addr->data[2]);
+ return cur;
+}
+
/* FC Network Header Network Address Authority Identifiers */
#define FC_NH_NAA_IEEE 1 /* IEEE 802.1a */