- hide temp config file, show config template
[oweals/gnunet.git] / src / mesh / mesh_protocol.h
index c36fa9f93e7e0081a8da36afafac84b7d902645b..5618360b741a685294611bc7be82c2817e27e7c7 100644 (file)
@@ -49,22 +49,21 @@ GNUNET_NETWORK_STRUCT_BEGIN
 
 /**
  * Message for mesh connection creation.
- * TODO onionify path, add random tunnel ID
  */
 struct GNUNET_MESH_ConnectionCreate
 {
     /**
      * Type: GNUNET_MESSAGE_TYPE_MESH_CONNECTION_CREATE
      *
-     * Size: sizeof(struct GNUNET_MESH_ManipulatePath) +
-     *              path_length * sizeof (struct GNUNET_PeerIdentity)
+     * Size: sizeof (struct GNUNET_MESH_ConnectionCreate) +
+     *       path_length * sizeof (struct GNUNET_PeerIdentity)
      */
   struct GNUNET_MessageHeader header;
 
     /**
      * ID of the connection
      */
-  struct GNUNET_HashCode cid;
+  struct GNUNET_MeshHash cid;
 
     /**
      * path_length structs defining the *whole* path from the origin [0] to the
@@ -83,17 +82,11 @@ struct GNUNET_MESH_ConnectionACK
      */
   struct GNUNET_MessageHeader header;
 
-    /**
-     * Always 0.
-     */
-  uint32_t reserved GNUNET_PACKED;
-
     /**
      * ID of the connection.
      */
-  struct GNUNET_HashCode cid;
+  struct GNUNET_MeshHash cid;
 
-  /* TODO: signature */
 };
 
 
@@ -107,15 +100,10 @@ struct GNUNET_MESH_KX
      */
   struct GNUNET_MessageHeader header;
 
-    /**
-     * Always 0.
-     */
-  uint32_t reserved GNUNET_PACKED;
-
     /**
      * ID of the connection.
      */
-  struct GNUNET_HashCode cid;
+  struct GNUNET_MeshHash cid;
 
   /* Specific KX message follows. */
 };
@@ -236,15 +224,10 @@ struct GNUNET_MESH_Encrypted
    */
   struct GNUNET_MessageHeader header;
 
-  /**
-   * Initialization Vector for payload encryption.
-   */
-  uint32_t iv GNUNET_PACKED;
-
   /**
    * ID of the connection.
    */
-  struct GNUNET_HashCode cid;
+  struct GNUNET_MeshHash cid;
 
   /**
    * ID of the packet (hop by hop).
@@ -256,11 +239,26 @@ struct GNUNET_MESH_Encrypted
    */
   uint32_t ttl GNUNET_PACKED;
 
+  /**
+   * Initialization Vector for payload encryption.
+   */
+  uint32_t iv GNUNET_PACKED;
+
+  /**
+   * MAC of the encrypted message, used to verify message integrity.
+   * Everything after this value  will be encrypted and authenticated.
+   */
+  struct GNUNET_MeshHash hmac;
+
   /**
    * Encrypted content follows.
    */
 };
 
+
+/**
+ * Message to create a Channel.
+ */
 struct GNUNET_MESH_ChannelCreate
 {
   /**
@@ -284,6 +282,10 @@ struct GNUNET_MESH_ChannelCreate
   uint32_t opt GNUNET_PACKED;
 };
 
+
+/**
+ * Message to manage a Channel (ACK, NACK, Destroy).
+ */
 struct GNUNET_MESH_ChannelManage
 {
   /**
@@ -297,6 +299,7 @@ struct GNUNET_MESH_ChannelManage
   MESH_ChannelNumber chid GNUNET_PACKED;
 };
 
+
 /**
  * Message for mesh data traffic.
  */
@@ -371,7 +374,7 @@ struct GNUNET_MESH_ACK
     /**
      * ID of the connection.
      */
-  struct GNUNET_HashCode cid;
+  struct GNUNET_MeshHash cid;
 };
 
 
@@ -380,20 +383,20 @@ struct GNUNET_MESH_ACK
  */
 struct GNUNET_MESH_Poll
 {
-  /**
-   * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
-   */
+    /**
+     * Type: GNUNET_MESSAGE_TYPE_MESH_POLL
+     */
   struct GNUNET_MessageHeader header;
 
-  /**
-   * Last packet sent.
-   */
+    /**
+     * Last packet sent.
+     */
   uint32_t pid GNUNET_PACKED;
 
     /**
      * ID of the connection.
      */
-  struct GNUNET_HashCode cid;
+  struct GNUNET_MeshHash cid;
 
 };
 
@@ -408,15 +411,10 @@ struct GNUNET_MESH_ConnectionBroken
      */
   struct GNUNET_MessageHeader header;
 
-    /**
-     * Always 0.
-     */
-  uint32_t reserved GNUNET_PACKED;
-
     /**
      * ID of the connection.
      */
-  struct GNUNET_HashCode cid;
+  struct GNUNET_MeshHash cid;
 
     /**
      * ID of the endpoint
@@ -427,8 +425,6 @@ struct GNUNET_MESH_ConnectionBroken
      * ID of the endpoint
      */
   struct GNUNET_PeerIdentity peer2;
-
-  /* TODO: signature */
 };
 
 
@@ -442,43 +438,13 @@ struct GNUNET_MESH_ConnectionDestroy
      */
   struct GNUNET_MessageHeader header;
 
-    /**
-     * Always 0.
-     */
-  uint32_t reserved GNUNET_PACKED;
-
     /**
      * ID of the connection.
      */
-  struct GNUNET_HashCode cid;
-
-  /* TODO: signature */
+  struct GNUNET_MeshHash cid;
 };
 
 
-/**
- * Message to keep a connection alive.
- */
-struct GNUNET_MESH_ConnectionKeepAlive
-{
-  /**
-   * Type: GNUNET_MESSAGE_TYPE_MESH_(FWD|BCK)_KEEPALIVE
-   */
-  struct GNUNET_MessageHeader header;
-
-  /**
-   * Always 0.
-   */
-  uint32_t reserved GNUNET_PACKED;
-
-  /**
-   * ID of the connection.
-   */
-  struct GNUNET_HashCode cid;
-};
-
-
-
 GNUNET_NETWORK_STRUCT_END
 
 #if 0                           /* keep Emacsens' auto-indent happy */