WiP (adding paths)
[oweals/gnunet.git] / src / mesh / mesh.h
index 609d35ec7c8ca2b2c9c4ccbc7d6fc5645f41e26b..bbfad3225f56c9e26fd5ca8885b45e5b7cd246d8 100644 (file)
@@ -39,7 +39,7 @@
  * 
  * API CALL (GNUNET_MESH_*)             MESSAGE USED
  * ------------------------             ------------
- * connect                              GNUNET_MESH_Connect
+ * connect                              GNUNET_MESH_ClientConnect
  * disconnect                           None (network level disconnect)
  *
  * tunnel_create                        GNUNET_MESH_TunnelMessage
  * EVENT                                MESSAGE USED
  * -----                                ------------
  * notify_transmit_ready reply          GNUNET_MESH_TransmitReady
- * notify_transmit_ready data           GNUNET_MESH_Data or
+ * notify_transmit_ready data           GNUNET_MESH_Data OR
  *                                      GNUNET_MESH_DataBroadcast
  * new incoming tunnel                  GNUNET_MESH_PeerControl
  * peer connects to a tunnel            GNUNET_MESH_PeerControl
  * peer disconnects from a tunnel       GNUNET_MESH_PeerControl
  */
 
-/**
- * Type for tunnel numbering.
- * - Local tunnel numbers are >= 0x80000000
- * - Global tunnel numbers are < 0x80000000
- */
-typedef uint32_t MESH_TunnelID;
+/******************************************************************************/
+/**************************       CONSTANTS      ******************************/
+/******************************************************************************/
+
+#define GNUNET_MESH_LOCAL_TUNNEL_ID_MARK 0x80000000
+
 
+/******************************************************************************/
+/**************************        MESSAGES      ******************************/
+/******************************************************************************/
 
 /**
- * Message for connecting to the msh service. Specifies the messages the client
- * is interested in.
+ * Message for a client to register to the service
  */
-struct GNUNET_MESH_Connect {
+struct GNUNET_MESH_ClientConnect {
     /**
      * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT
-     * Size: sizeof(struct GNUNET_MESH_Connect) +
-     *       messages_subscribed * sizeof (message_type)
+     *
+     * Size: sizeof(struct GNUNET_MESH_ClientConnect) +
+     *       sizeof(uint16_t) * types +
+     *       sizeof(MESH_ApplicationType) * applications
      */
     struct GNUNET_MessageHeader header;
-
-    /* GNUNET_MESH_ApplicationType messages_subscribed[] */
+    uint16_t                    types           GNUNET_PACKED;
+    uint16_t                    applications    GNUNET_PACKED;
+    /* uint16_t                 list_types[types]           */
+    /* uint16_t                 list_apps[applications]     */
 };
 
 
+/**
+ * Type for tunnel numbering.
+ * - Local tunnel numbers are >= 0x80000000
+ * - Global tunnel numbers are < 0x80000000
+ */
+typedef uint32_t MESH_TunnelNumber;
+
 /**
  * Message for a client to create and destroy tunnels.
  */
 struct GNUNET_MESH_TunnelMessage {
     /**
      * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATE|DESTROY]
+     *
+     * Size: sizeof(struct GNUNET_MESH_TunnelMessage)
      */
     struct GNUNET_MessageHeader header;
 
     /**
      * ID of a tunnel controlled by this client.
      */
-    MESH_TunnelID               tunnel_id GNUNET_PACKED;
+    MESH_TunnelNumber           tunnel_id GNUNET_PACKED;
 };
 
 /**
@@ -116,7 +131,7 @@ struct GNUNET_MESH_PeerControl {
   /**
    * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_[ADD|DEL]
    *       (client to service, client created tunnel)
-   *       GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_NOTIFY[CONNECT|DISCONNECT]
+   *       GNUNET_MESSAGE_TYPE_MESH_LOCAL_PEER_[CONNECTED|DISCONNECTED]
    *       (service to client)
    * 
    * Size: sizeof(struct GNUNET_MESH_PeerControl) 
@@ -126,7 +141,7 @@ struct GNUNET_MESH_PeerControl {
   /**
    * ID of a tunnel controlled by this client.
    */
-   MESH_TunnelID                tunnel_id GNUNET_PACKED;
+   MESH_TunnelNumber            tunnel_id GNUNET_PACKED;
   
   /**
    * Peer to connect/disconnect.
@@ -147,7 +162,7 @@ struct GNUNET_MESH_ConnectPeerByType {
   /**
    * ID of a tunnel controlled by this client.
    */
-   MESH_TunnelID                tunnel_id GNUNET_PACKED;
+   MESH_TunnelNumber            tunnel_id GNUNET_PACKED;
  
   /**
    * Type specification 
@@ -170,7 +185,7 @@ struct GNUNET_MESH_TransmitReady {
     /**
      * ID of a tunnel controlled by this client.
      */
-    MESH_TunnelID               tunnel_id GNUNET_PACKED;
+    MESH_TunnelNumber           tunnel_id GNUNET_PACKED;
 
     /**
      * Size of message we would like to transmit to this tunnel
@@ -193,7 +208,7 @@ struct GNUNET_MESH_Data {
     /**
      * ID of a tunnel controlled by this client.
      */
-    MESH_TunnelID               tunnel_id GNUNET_PACKED;
+    MESH_TunnelNumber           tunnel_id GNUNET_PACKED;
 
     /**
      * Source or destination of the message (depending on direction).
@@ -217,7 +232,7 @@ struct GNUNET_MESH_DataBroadcast {
     /**
      * ID of a tunnel controlled by this client.
      */
-    MESH_TunnelID               tunnel_id GNUNET_PACKED;
+    MESH_TunnelNumber           tunnel_id GNUNET_PACKED;
 
     /* uint8_t data[] */
 };