- debug
[oweals/gnunet.git] / src / mesh / mesh_protocol_enc.h
index fef6479e22008bbb8b383169972951a7a3945c70..78c3666b148b764ce980def80616e4a12a7003c3 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "mesh_enc.h"
 
 #ifdef __cplusplus
 
@@ -61,14 +62,9 @@ struct GNUNET_MESH_ConnectionCreate
   struct GNUNET_MessageHeader header;
 
     /**
-     * ID of the connection for that tunnel.
-     */
-  uint32_t cid GNUNET_PACKED;
-
-    /**
-     * ID of the tunnel
+     * ID of the connection
      */
-  struct GNUNET_HashCode tid;
+  struct GNUNET_HashCode cid;
 
     /**
      * path_length structs defining the *whole* path from the origin [0] to the
@@ -88,14 +84,14 @@ struct GNUNET_MESH_ConnectionACK
   struct GNUNET_MessageHeader header;
 
     /**
-     * ID of the connection
+     * Always 0.
      */
-  uint32_t cid GNUNET_PACKED;
+  uint32_t reserved GNUNET_PACKED;
 
     /**
-     * ID of the tunnel
+     * ID of the connection.
      */
-  struct GNUNET_HashCode tid;
+  struct GNUNET_HashCode cid;
 
   /* TODO: signature */
 };
@@ -111,19 +107,19 @@ struct GNUNET_MESH_Encrypted
   struct GNUNET_MessageHeader header;
 
   /**
-   * ID of the connection.
+   * ID of the packet (hop by hop).
    */
-  uint32_t cid GNUNET_PACKED;
+  uint32_t pid GNUNET_PACKED;
 
   /**
-   * ID of the tunnel.
+   * ID of the connection.
    */
-  struct GNUNET_HashCode tid;
+  struct GNUNET_HashCode cid;
 
   /**
-   * ID of the packet (hop by hop).
+   * Initialization Vector for payload encryption.
    */
-  uint32_t pid GNUNET_PACKED;
+  uint64_t iv GNUNET_PACKED;
 
   /**
    * Number of hops to live.
@@ -131,9 +127,9 @@ struct GNUNET_MESH_Encrypted
   uint32_t ttl GNUNET_PACKED;
 
   /**
-   * Initialization Vector for payload encryption.
+   * Always 0.
    */
-  uint64_t iv;
+  uint32_t reserved GNUNET_PACKED;
 
   /**
    * Encrypted content follows.
@@ -150,7 +146,12 @@ struct GNUNET_MESH_ChannelCreate
   /**
    * ID of the channel
    */
-  uint32_t chid GNUNET_PACKED;
+  MESH_ChannelNumber chid GNUNET_PACKED;
+
+  /**
+   * Destination port.
+   */
+  uint32_t port GNUNET_PACKED;
 
   /**
    * Channel options.
@@ -158,17 +159,17 @@ struct GNUNET_MESH_ChannelCreate
   uint32_t opt GNUNET_PACKED;
 };
 
-struct GNUNET_MESH_ChannelDestroy
+struct GNUNET_MESH_ChannelManage
 {
   /**
-   * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_DESTROY
+   * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_{ACK|DESTROY}
    */
   struct GNUNET_MessageHeader header;
 
   /**
    * ID of the channel
    */
-  uint32_t chid GNUNET_PACKED;
+  MESH_ChannelNumber chid GNUNET_PACKED;
 };
 
 /**
@@ -190,7 +191,7 @@ struct GNUNET_MESH_Data
     /**
      * ID of the channel
      */
-  uint32_t chid GNUNET_PACKED;
+  MESH_ChannelNumber chid GNUNET_PACKED;
 
     /**
      * Payload follows
@@ -211,7 +212,7 @@ struct GNUNET_MESH_DataACK
   /**
    * ID of the channel
    */
-  uint32_t chid GNUNET_PACKED;
+  MESH_ChannelNumber chid GNUNET_PACKED;
 
   /**
    * Bitfield of already-received newer messages
@@ -228,7 +229,7 @@ struct GNUNET_MESH_DataACK
 
 
 /**
- * Message to acknowledge mesh data traffic.
+ * Message to acknowledge mesh encrypted traffic.
  */
 struct GNUNET_MESH_ACK
 {
@@ -241,6 +242,11 @@ struct GNUNET_MESH_ACK
      * Maximum packet ID authorized.
      */
   uint32_t ack GNUNET_PACKED;
+
+    /**
+     * ID of the connection.
+     */
+  struct GNUNET_HashCode cid;
 };
 
 
@@ -258,6 +264,12 @@ struct GNUNET_MESH_Poll
    * Last packet sent.
    */
   uint32_t pid GNUNET_PACKED;
+
+    /**
+     * ID of the connection.
+     */
+  struct GNUNET_HashCode cid;
+
 };
 
 
@@ -272,14 +284,14 @@ struct GNUNET_MESH_ConnectionBroken
   struct GNUNET_MessageHeader header;
 
     /**
-     * ID of the connection.
+     * Always 0.
      */
-  uint32_t cid GNUNET_PACKED;
+  uint32_t reserved GNUNET_PACKED;
 
     /**
-     * ID of the tunnel
+     * ID of the connection.
      */
-  struct GNUNET_HashCode tid;
+  struct GNUNET_HashCode cid;
 
     /**
      * ID of the endpoint
@@ -306,14 +318,14 @@ struct GNUNET_MESH_ConnectionDestroy
   struct GNUNET_MessageHeader header;
 
     /**
-     * ID of the connection.
+     * Always 0.
      */
-  uint32_t cid GNUNET_PACKED;
+  uint32_t reserved GNUNET_PACKED;
 
     /**
-     * ID of the tunnel
+     * ID of the connection.
      */
-  struct GNUNET_HashCode tid;
+  struct GNUNET_HashCode cid;
 
   /* TODO: signature */
 };
@@ -330,14 +342,14 @@ struct GNUNET_MESH_ConnectionKeepAlive
   struct GNUNET_MessageHeader header;
 
   /**
-   * ID of the connection
+   * Always 0.
    */
-  uint32_t cid GNUNET_PACKED;
+  uint32_t reserved GNUNET_PACKED;
 
   /**
-   * ID of the tunnel
+   * ID of the connection.
    */
-  struct GNUNET_HashCode tid;
+  struct GNUNET_HashCode cid;
 };