struct GNUNET_HELLO_Message *hello;
struct MeshPeerPath *p;
struct MeshPeer *peer;
+ char *s;
p = path_build_from_dht (get_path, get_path_length,
put_path, put_path_length);
+ s = path_2s (p);
+ LOG (GNUNET_ERROR_TYPE_INFO, "Got path from DHT: %s\n", s);
+ GNUNET_free_non_null (s);
peer = GMP_get_short (p->peers[p->length - 1]);
LOG (GNUNET_ERROR_TYPE_DEBUG, "Got HELLO for %s\n", GMP_2s (peer));
h->callback (h->cls, p);
return GNUNET_OK;
}
+char *
+path_2s (struct MeshPeerPath *p)
+{
+ char *s;
+ char *old;
+ unsigned int i;
+
+ s = old = NULL;
+ for (i = 0; i < p->length; i++)
+ {
+ GNUNET_asprintf (&s, "%s %s",
+ old, GNUNET_i2s (GNUNET_PEER_resolve2 (p->peers[i])));
+ GNUNET_free_non_null (old);
+ old = s; old = "";
+ }
+ return s;
+}
+
void
path_debug (struct MeshPeerPath *p)
{
int
path_destroy (struct MeshPeerPath *p);
+/**
+ * Path -> allocated one line string. Caller must free.
+ *
+ * @param p Path.
+ */
+char *
+path_2s (struct MeshPeerPath *p);
/**
* Print info about the path for debug.