Update the UDP and the TCP conversation list tool so that it can handle IPv6 as well.
[obnox/wireshark/wip.git] / epan / to_str.c
index 5819d2b4f7545ec35c77afe298e893e5d11919b3..3588da8f7edbb59b7c1502a1d723cdf6273824b2 100644 (file)
@@ -1,7 +1,7 @@
 /* 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>
@@ -183,10 +183,17 @@ ip6_to_str(const struct e_in6_addr *ad) {
 #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*
@@ -575,12 +582,31 @@ rel_time_to_secs_str(nstime_t *rel_time)
         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 */