/**
* ID of the connection.
*/
- struct GNUNET_HashCode id;
+ struct GNUNET_MeshHash id;
/**
* State of the connection.
* @param cid Connection ID.
*/
static struct MeshConnection *
-connection_get (const struct GNUNET_HashCode *cid)
+connection_get (const struct GNUNET_MeshHash *cid)
{
- return GNUNET_CONTAINER_multihashmap_get (connections, cid);
+ return GNUNET_CONTAINER_multihashmap_get (connections, GM_h2hc (cid));
}
* @param peer Peer to notify (neighbor who sent the connection).
*/
static void
-send_broken2 (struct GNUNET_HashCode *connection_id,
+send_broken2 (struct GNUNET_MeshHash *connection_id,
const struct GNUNET_PeerIdentity *id1,
const struct GNUNET_PeerIdentity *id2,
GNUNET_PEER_Id peer_id)
struct GNUNET_MESH_ConnectionBroken *msg;
struct MeshPeer *neighbor;
- LOG (GNUNET_ERROR_TYPE_INFO,
- "Send BROKEN on unknown connection %s\n", GNUNET_h2s (connection_id));
+ LOG (GNUNET_ERROR_TYPE_INFO, "=> BROKEN on unknown connection %s\n",
+ GNUNET_h2s (GM_h2hc (connection_id)));
msg = GNUNET_new (struct GNUNET_MESH_ConnectionBroken);
msg->header.size = htons (sizeof (struct GNUNET_MESH_ConnectionBroken));
static void
log_message (const struct GNUNET_MessageHeader *message,
const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HashCode *hash)
+ const struct GNUNET_MeshHash *hash)
{
LOG (GNUNET_ERROR_TYPE_INFO, "<- %s on connection %s from %s\n",
- GM_m2s (ntohs (message->type)), GNUNET_h2s (hash), GNUNET_i2s (peer));
+ GM_m2s (ntohs (message->type)), GNUNET_h2s (GM_h2hc (hash)),
+ GNUNET_i2s (peer));
}
/******************************************************************************/
{
struct GNUNET_MESH_ConnectionCreate *msg;
struct GNUNET_PeerIdentity *id;
- struct GNUNET_HashCode *cid;
+ struct GNUNET_MeshHash *cid;
struct MeshPeerPath *path;
struct MeshPeer *dest_peer;
struct MeshPeer *orig_peer;
if (NULL == c)
{
GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "WARNING enc on unknown connection %s\n",
- GNUNET_h2s (&msg->cid));
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "enc on unknown connection %s\n",
+ GNUNET_h2s (GM_h2hc (&msg->cid)));
return GNUNET_OK;
}
{
GNUNET_STATISTICS_update (stats, "# unknown connection", 1, GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG, "kx on unknown connection %s\n",
- GNUNET_h2s (&msg->cid));
+ GNUNET_h2s (GM_h2hc (&msg->cid)));
return GNUNET_OK;
}
LOG (GNUNET_ERROR_TYPE_DEBUG, " on connection %s\n", GMC_2s (c));
GNUNET_NO);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"WARNING POLL message on unknown connection %s!\n",
- GNUNET_h2s (&msg->cid));
+ GNUNET_h2s (GM_h2hc (&msg->cid)));
return GNUNET_OK;
}
struct MeshConnection *
-GMC_new (const struct GNUNET_HashCode *cid,
+GMC_new (const struct GNUNET_MeshHash *cid,
struct MeshTunnel3 *t,
struct MeshPeerPath *p,
unsigned int own_pos)
c->id = *cid;
GNUNET_assert (GNUNET_OK ==
GNUNET_CONTAINER_multihashmap_put (connections,
- &c->id, c,
+ GMC_get_h (c), c,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
fc_init (&c->fwd_fc);
fc_init (&c->bck_fc);
}
GNUNET_break (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (connections, &c->id, c));
+ GNUNET_CONTAINER_multihashmap_remove (connections,
+ GMC_get_h (c), c));
GNUNET_STATISTICS_update (stats, "# connections", -1, GNUNET_NO);
GNUNET_free (c);
*
* @return ID of the connection.
*/
-const struct GNUNET_HashCode *
+const struct GNUNET_MeshHash *
GMC_get_id (const struct MeshConnection *c)
{
return &c->id;
}
+/**
+ * Get the connection ID.
+ *
+ * @param c Connection to get the ID from.
+ *
+ * @return ID of the connection.
+ */
+const struct GNUNET_HashCode *
+GMC_get_h (const struct MeshConnection *c)
+{
+ return GM_h2hc (&c->id);
+}
+
+
/**
* Get the connection path.
*
{
static char buf[128];
- sprintf (buf, "%s (->%s)", GNUNET_h2s (&c->id), GMT_2s (c->t));
+ sprintf (buf, "%s (->%s)", GNUNET_h2s (GM_h2hc (GMC_get_id(c))), GMT_2s (c->t));
return buf;
}
- return GNUNET_h2s (&c->id);
+ return GNUNET_h2s (GM_h2hc (&c->id));
}