- debug
[oweals/gnunet.git] / src / mesh / mesh_protocol_enc.h
index 9a49cea4a942550fc91d1225404c120c76791a3b..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,15 +127,51 @@ 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.
    */
 };
 
+struct GNUNET_MESH_ChannelCreate
+{
+  /**
+   * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_CREATE
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * ID of the channel
+   */
+  MESH_ChannelNumber chid GNUNET_PACKED;
+
+  /**
+   * Destination port.
+   */
+  uint32_t port GNUNET_PACKED;
+
+  /**
+   * Channel options.
+   */
+  uint32_t opt GNUNET_PACKED;
+};
+
+struct GNUNET_MESH_ChannelManage
+{
+  /**
+   * Type: GNUNET_MESSAGE_TYPE_MESH_CHANNEL_{ACK|DESTROY}
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * ID of the channel
+   */
+  MESH_ChannelNumber chid GNUNET_PACKED;
+};
+
 /**
  * Message for mesh data traffic.
  */
@@ -159,7 +191,7 @@ struct GNUNET_MESH_Data
     /**
      * ID of the channel
      */
-  uint32_t chid GNUNET_PACKED;
+  MESH_ChannelNumber chid GNUNET_PACKED;
 
     /**
      * Payload follows
@@ -180,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
@@ -197,7 +229,7 @@ struct GNUNET_MESH_DataACK
 
 
 /**
- * Message to acknowledge mesh data traffic.
+ * Message to acknowledge mesh encrypted traffic.
  */
 struct GNUNET_MESH_ACK
 {
@@ -210,6 +242,11 @@ struct GNUNET_MESH_ACK
      * Maximum packet ID authorized.
      */
   uint32_t ack GNUNET_PACKED;
+
+    /**
+     * ID of the connection.
+     */
+  struct GNUNET_HashCode cid;
 };
 
 
@@ -227,6 +264,12 @@ struct GNUNET_MESH_Poll
    * Last packet sent.
    */
   uint32_t pid GNUNET_PACKED;
+
+    /**
+     * ID of the connection.
+     */
+  struct GNUNET_HashCode cid;
+
 };
 
 
@@ -241,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
@@ -275,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 */
 };
@@ -299,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;
 };