- stop using message types of payload on service side
[oweals/gnunet.git] / src / mesh / mesh2.h
index 39533e654de5b4d290a288107b1755f06518a3e2..c66a810a15580f31010787f8d2a116363935903f 100644 (file)
@@ -112,8 +112,7 @@ struct GNUNET_MESH_ClientConnect
      *       sizeof(uint16_t) * types
      */
   struct GNUNET_MessageHeader header;
-  uint16_t types GNUNET_PACKED;
-  /* uint16_t                 list_types[types]           */
+  /* uint32_t                 list_ports[]           */
 };
 
 
@@ -125,6 +124,7 @@ struct GNUNET_MESH_ClientConnect
  */
 typedef uint32_t MESH_TunnelNumber;
 
+
 /**
  * Message for a client to create and destroy tunnels.
  */
@@ -132,7 +132,6 @@ struct GNUNET_MESH_TunnelMessage
 {
     /**
      * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATE|DESTROY]
-     *       GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[MAX|MIN]
      *
      * Size: sizeof(struct GNUNET_MESH_TunnelMessage)
      */
@@ -147,6 +146,11 @@ struct GNUNET_MESH_TunnelMessage
      * Tunnel's peer
      */
   struct GNUNET_PeerIdentity peer;
+
+    /**
+     * Port of the tunnel.
+     */
+  uint32_t port GNUNET_PACKED;
 };
 
 
@@ -172,10 +176,15 @@ struct GNUNET_MESH_TunnelNotification
      */
   struct GNUNET_PeerIdentity peer;
 
+    /**
+     * Port for this tunnel
+     */
+  uint32_t port GNUNET_PACKED;
+
     /**
      * Tunnel options (speed, buffering)
      */
-  uint32_t opt;
+  uint32_t opt GNUNET_PACKED;
 };
 
 
@@ -217,11 +226,6 @@ struct GNUNET_MESH_LocalMonitor
    */
   MESH_TunnelNumber tunnel_id GNUNET_PACKED;
 
-  /**
-   * Number of peers in the tunnel.
-   */
-  uint32_t npeers GNUNET_PACKED;
-
   /**
    * Alignment.
    */
@@ -232,7 +236,10 @@ struct GNUNET_MESH_LocalMonitor
    */
   struct GNUNET_PeerIdentity owner;
 
-  /* struct GNUNET_PeerIdentity peers[npeers] */
+  /**
+   * ID of the destination of the tunnel (can be local peer).
+   */
+  struct GNUNET_PeerIdentity destination;
 };
 
 
@@ -243,44 +250,34 @@ GNUNET_NETWORK_STRUCT_END
 /******************************************************************************/
 
 /**
- * All the states a peer participating in a tunnel can be in.
+ * All the states a tunnel can be in.
  */
-enum MeshPeerState
+enum MeshTunnelState
 {
     /**
      * Uninitialized status, should never appear in operation.
      */
-  MESH_PEER_INVALID,
-
-    /**
-     * Peer is the root and owner of the tree
-     */
-  MESH_PEER_ROOT,
-
-    /**
-     * Peer only retransmits traffic, is not a final destination
-     */
-  MESH_PEER_RELAY,
+  MESH_TUNNEL_NEW,
 
     /**
      * Path to the peer not known yet
      */
-  MESH_PEER_SEARCHING,
+  MESH_TUNNEL_SEARCHING,
 
     /**
      * Request sent, not yet answered.
      */
-  MESH_PEER_WAITING,
+  MESH_TUNNEL_WAITING,
 
     /**
      * Peer connected and ready to accept data
      */
-  MESH_PEER_READY,
+  MESH_TUNNEL_READY,
 
     /**
      * Peer connected previosly but not responding
      */
-  MESH_PEER_RECONNECTING
+  MESH_TUNNEL_RECONNECTING
 };
 
 
@@ -320,6 +317,18 @@ uint32_t
 GMC_min_pid (uint32_t a, uint32_t b);
 
 
+/**
+ * Expand a 32 bit value (message type) into a hash for a MultiHashMap (fast).
+ * WARNING: do not use for anything other than MultiHashMap!
+ *          does not alter anything other than bits used by idx_of !
+ *
+ * @param i 32 bit integer value.
+ * @param h Hash code to fill.
+ */
+void
+GMC_hash32 (uint32_t i, struct GNUNET_HashCode *h);
+
+
 /**
  * Convert a message type into a string to help debug
  * Generated with: