+/**
+ * Function called for a quick conversion of the binary address to
+ * a numeric address. Note that the caller must not free the
+ * address and that the next call to this function is allowed
+ * to override the address again.
+ *
+ * @param cls closure
+ * @param addr binary address
+ * @param addrlen length of the address
+ * @return string representing the same address
+ */
+static const char *
+unix_address_to_string (void *cls, const void *addr, size_t addrlen)
+{
+ static char rbuf[1024];
+ struct UnixAddress *ua = (struct UnixAddress *) addr;
+ char *addrstr;
+ char *tmp;
+ size_t addr_str_len;
+
+ if ((NULL == addr) || (0 == addrlen) || (sizeof (struct UnixAddress) > addrlen))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ addrstr = (char *) &ua[1];
+ addr_str_len = ntohl (ua->addrlen);
+
+ if (addr_str_len != addrlen - sizeof (struct UnixAddress *))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+
+ if ('\0' != addrstr[addr_str_len - 1])
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ if (strlen (addrstr) + 1 != addr_str_len)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+
+ GNUNET_asprintf(&tmp, "%s.%u.%s", PLUGIN_NAME, ntohl (ua->options), addrstr);
+ memcpy (rbuf, tmp, strlen (tmp) + 1);
+ GNUNET_free (tmp);
+ return rbuf;
+}
+