- start test only after warmup
[oweals/gnunet.git] / src / mesh / mesh.h
index bb71d16680d1cb9df0d8c1af77109a0ce413e824..42d3e6462d4a5c0fab04491d38656344123fd8e7 100644 (file)
@@ -89,6 +89,17 @@ struct GNUNET_MESH_ClientConnect
 typedef uint32_t MESH_ChannelNumber;
 
 
+/**
+ * Hash to be used in Mesh communication. Only 256 bits needed,
+ * instead of the 512 from @c GNUNET_HashCode.
+ *
+ */
+struct GNUNET_MeshHash
+{
+  unsigned char bits[256 / 8];
+};
+
+
 /**
  * Message for a client to create and destroy channels.
  */
@@ -169,7 +180,7 @@ struct GNUNET_MESH_LocalAck
 struct GNUNET_MESH_LocalInfo
 {
   /**
-     * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO[_TUNNEL]
+     * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO[_TUNNEL,_PEER]
    */
   struct GNUNET_MessageHeader header;
 
@@ -181,12 +192,42 @@ struct GNUNET_MESH_LocalInfo
   /**
    * ID of the owner of the channel (can be local peer).
    */
-  struct GNUNET_PeerIdentity owner;
+//   struct GNUNET_PeerIdentity owner;
 
   /**
    * ID of the destination of the channel (can be local peer).
    */
+  struct GNUNET_PeerIdentity peer;
+};
+
+
+/**
+ * Message to inform the client about one of the peers in the service.
+ */
+struct GNUNET_MESH_LocalInfoPeer
+{
+  /**
+   * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_INFO_PEER[S]
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Number of paths.
+   */
+  uint16_t paths GNUNET_PACKED;
+
+  /**
+   * Do we have a tunnel toward this peer?
+   */
+  int16_t tunnel GNUNET_PACKED;
+
+  /**
+   * ID of the destination of the tunnel (can be local peer).
+   */
   struct GNUNET_PeerIdentity destination;
+
+  /* If type == PEER (no 'S'): GNUNET_PeerIdentity paths[]
+   * (each path ends in destination) */
 };
 
 /**
@@ -280,6 +321,17 @@ uint32_t
 GM_min_pid (uint32_t a, uint32_t b);
 
 
+/**
+ * Convert a 256 bit MeshHash into a 512 HashCode to use in GNUNET_h2s,
+ * multihashmap, and other HashCode-based functions.
+ *
+ * @param id A 256 bit hash to expand.
+ *
+ * @return A HashCode containing the original 256 bit hash right-padded with 0.
+ */
+const struct GNUNET_HashCode *
+GM_h2hc (const struct GNUNET_MeshHash *id);
+
 /**
  * Convert a message type into a string to help debug
  * Generated with: