gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14760 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r14760 - gnunet/src/mesh
Date: Tue, 29 Mar 2011 11:36:22 +0200

Author: bartpolot
Date: 2011-03-29 11:36:22 +0200 (Tue, 29 Mar 2011)
New Revision: 14760

Modified:
   gnunet/src/mesh/gnunet-service-mesh.c
   gnunet/src/mesh/mesh.h
Log:
Changed message declaration location, added api messages


Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c       2011-03-29 09:02:06 UTC (rev 
14759)
+++ gnunet/src/mesh/gnunet-service-mesh.c       2011-03-29 09:36:22 UTC (rev 
14760)
@@ -22,6 +22,13 @@
  * @file mesh/gnunet-service-mesh.c
  * @brief GNUnet MESH service
  * @author Bartlomiej Polot
+ *
+ * TODO:
+ * - soft stateing (keep-alive (CHANGE?) / timeout / disconnect) -- not a 
message issue
+ * - error reporting (CREATE/CHANGE/ADD/DEL?) -- new message!
+ * - partial disconnect reporting -- same as error reporting?
+ * - add vs create? change vs. keep-alive? same msg or different ones? -- 
thinking...
+ * - speed requirement specification (change?) in mesh API -- API call
  */
 
 #include <stdint.h>
@@ -30,7 +37,175 @@
 #include "gnunet_core_service.h"
 #include <netinet/in.h>
 
+
+/******************************************************************************/
+/********************      MESH NETWORK MESSAGES     
**************************/
+/******************************************************************************/
+
 /**
+ * Message for mesh path management
+ */
+struct GNUNET_MESH_ManipulatePath
+{
+    /**
+     * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_[CREATE|CHANGE|ADD|DEL]
+     *
+     * Size: sizeof(struct GNUNET_MESH_ManipulatePath) + path_length * sizeof 
(struct GNUNET_PeerIdentity)
+     */
+    struct GNUNET_MessageHeader header;
+
+    /**
+     * Id of the tunnel this path belongs to, unique in conjunction with the 
origin.
+     */
+    uint32_t tid GNUNET_PACKED;
+
+    /**
+     * Information about speed requirements.  If the tunnel cannot sustain the 
+     * minimum bandwidth, packets are to be dropped.
+     */
+    uint32_t speed_min GNUNET_PACKED;
+
+    /**
+     * path_length structs defining the *whole* path from the origin [0] to the
+     * final destination [path_length-1].
+     */
+  // struct GNUNET_PeerIdentity peers[path_length];
+};
+
+/**
+ * Message for mesh data traffic to all tunnel targets.
+ */
+struct GNUNET_MESH_OriginMulticast
+{
+    /**
+     * Type: GNUNET_MESSAGE_TYPE_DATA_MULTICAST
+     */
+    struct GNUNET_MessageHeader header;
+
+    /**
+     * TID of the tunnel
+     */
+    uint32_t tid GNUNET_PACKED;
+
+    /**
+     * OID of the tunnel
+     */
+    struct GNUNET_PeerIdentity oid;
+
+    /**
+     * FIXME: Some form of authentication
+     */
+    // uint32_t token;
+
+    /**
+     * Payload follows
+     */
+};
+
+
+/**
+ * Message for mesh data traffic to a particular destination from origin.
+ */
+struct GNUNET_MESH_DataMessageFromOrigin
+{
+    /**
+     * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN
+     */
+    struct GNUNET_MessageHeader header;
+
+    /**
+     * TID of the tunnel
+     */
+    uint32_t tid GNUNET_PACKED;
+
+    /**
+     * OID of the tunnel
+     */
+    struct GNUNET_PeerIdentity oid;
+
+    /**
+     * Destination.
+     */
+    struct GNUNET_PeerIdentity destination;
+
+    /**
+     * FIXME: Some form of authentication
+     */
+    // uint32_t token;
+
+    /**
+     * Payload follows
+     */
+};
+
+
+/**
+ * Message for mesh data traffic from a tunnel participant to origin.
+ */
+struct GNUNET_MESH_DataMessageToOrigin
+{
+    /**
+     * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_TO_ORIGIN
+     */
+    struct GNUNET_MessageHeader header;
+
+    /**
+     * TID of the tunnel
+     */
+    uint32_t tid GNUNET_PACKED;
+
+    /**
+     * OID of the tunnel
+     */
+    struct GNUNET_PeerIdentity oid;
+
+    /**
+     * Sender of the message.
+     */
+    struct GNUNET_PeerIdentity sender;
+
+    /**
+     * FIXME: Some form of authentication
+     */
+    // uint32_t token;
+
+    /**
+     * Payload follows
+     */
+};
+
+/**
+ * Message for mesh flow control
+ */
+struct GNUNET_MESH_SpeedNotify
+{
+    /**
+     * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
+     */
+    struct GNUNET_MessageHeader header;
+
+    /**
+     * TID of the tunnel
+     */
+    uint32_t tid GNUNET_PACKED;
+
+    /**
+     * OID of the tunnel
+     */
+    struct GNUNET_PeerIdentity oid;
+
+    /**
+     * Slowest link down the path (above minimum speed requirement).
+     */
+    uint32_t speed_min;
+
+};
+
+/******************************************************************************/
+/************************      DATA STRUCTURES     
****************************/
+/******************************************************************************/
+
+/**
  * All the states a peer participating in a tunnel can be in.
  */
 enum PeerState
@@ -183,6 +358,7 @@
 
 /**
  * Handler for requests of creating new path
+ * type: struct GNUNET_CORE_MessageHandler
  *
  * @param cls closure
  * @param client the client this message is from
@@ -212,6 +388,7 @@
 
 /**
  * Core handler for path creation
+ * struct GNUNET_CORE_MessageHandler
  *
  * @param cls closure
  * @param message message
@@ -227,6 +404,10 @@
                               *atsi)
 {
     /* Extract path */
+    /* Find origin & self */
+    /* Search for origin in local tunnels */
+    /* Create tunnel / add path */
+    /* Retransmit to next link in chain, if any (core_notify + callback) */
     return GNUNET_OK;
 }
 
@@ -269,9 +450,9 @@
  * Functions to handle messages from clients
  */
 static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = {
-  {&handle_local_path_create, NULL, GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE, 0},
-  {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_GO, 0},
-  {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_BACK, 0},
+  {&handle_local_path_create, NULL, GNUNET_MESSAGE_TYPE_LOCAL_PATH_CREATE, 0},
+  {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_LOCAL_DATA_GO, 0},
+  {&handle_local_network_traffic, GNUNET_MESSAGE_TYPE_LOCAL_DATA_BACK, 0},
   {NULL, NULL, 0, 0}
 };
 

Modified: gnunet/src/mesh/mesh.h
===================================================================
--- gnunet/src/mesh/mesh.h      2011-03-29 09:02:06 UTC (rev 14759)
+++ gnunet/src/mesh/mesh.h      2011-03-29 09:36:22 UTC (rev 14760)
@@ -23,178 +23,109 @@
  * @file mesh/mesh.h
  *
  * TODO:
- * - soft stateing (keep-alive (CHANGE?) / timeout / disconnect) -- not a 
message issue
- * - error reporting (CREATE/CHANGE/ADD/DEL?) -- new message!
- * - partial disconnect reporting -- same as error reporting?
- * - add vs create? change vs. keep-alive? same msg or different ones? -- 
thinking...
- * - speed requirement specification (change?) in mesh API -- API call
- *
  * - API messages!
  */
 
-
 #ifndef MESH_H_
 #define MESH_H_
 #include <stdint.h>
 #include "gnunet_common.h"
 
-/**
- * Message for mesh path management
+/******************************************************************************/
+/********************      MESH NETWORK MESSAGES     
**************************/
+/******************************************************************************/
+/* API CALL                         MESSAGE USED
+ * --------                         ------------
+ * connect                          GNUNET_MESH_Connect    / Server_connect? 
FIXME
+ * disconnect                       GNUNET_MESH_Disconnect / 
Server_disconnect? FIXME
+ * 
+ * peer_request_connect_any         GNUNET_MESH_ConnectPeer
+ * peer_request_connect_all         GNUNET_MESH_ConnectPeer
+ * peer_request_connect_add         GNUNET_MESH_ConnectPeer
+ * peer_request_connect_del         GNUNET_MESH_ConnectPeer
+ * peer_request_connect_by_type     GNUNET_MESH_ConnectPeerByType
+ * peer_request_connect_cancel      GNUNET_MESH_Control
+ * 
+ * notify_tranmit_ready             GNUNET_MESH_Control? FIXME
+ * notify_tranmit_ready_cancel      GNUNET_MESH_Control? FIXME
  */
-struct GNUNET_MESH_ManipulatePath
-{
-    /**
-     * Type: GNUNET_MESSAGE_TYPE_MESH_PATH_[CREATE|CHANGE|ADD|DEL]
-     *
-     * Size: sizeof(struct GNUNET_MESH_ManipulatePath) + path_length * sizeof 
(struct GNUNET_PeerIdentity)
-     */
-    struct GNUNET_MessageHeader header;
 
-    /**
-     * Id of the tunnel this path belongs to, unique in conjunction with the 
origin.
-     */
-    uint32_t tid GNUNET_PACKED;
+// struct GNUNET_MESH_Connect {
+//     /**
+//      * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT
+//      *
+//      * Size: sizeof(struct GNUNET_MESH_Connect) + messages_subscribed * 
sizeof (message_type)
+//      */
+//     struct GNUNET_MessageHeader header;
+// 
+//     /* uint16_t messages_subscribed[] */
+// };
+//
+// struct GNUNET_MESH_Disconnect {
+//     /**
+//      * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DISCONNECT
+//      */
+//     struct GNUNET_MessageHeader header;
+//
+// };
 
+struct GNUNET_MESH_ConnectPeer {
     /**
-     * Information about speed requirements.  If the tunnel cannot sustain the 
-     * minimum bandwidth, packets are to be dropped.
+     * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_[ANY|ALL|ADD|DEL]
+     * 
+     * Size: sizeof(struct GNUNET_MESH_ConnectPeer) + npeers * sizeof (struct 
GNUNET_PeerIdentity)
      */
-    uint32_t speed_min GNUNET_PACKED;
+    struct GNUNET_MessageHeader header;
 
-    /**
-     * path_length structs defining the *whole* path from the origin [0] to the
-     * final destination [path_length-1].
-     */
-  // struct GNUNET_PeerIdentity peers[path_length];
+    /* struct GNUNET_PeerIdentity peers[] */
 };
 
-/**
- * Message for mesh data traffic to all tunnel targets.
- */
-struct GNUNET_MESH_OriginMulticast
-{
+struct GNUNET_MESH_ConnectPeerByType {
     /**
-     * Type: GNUNET_MESSAGE_TYPE_DATA_MULTICAST
+     * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE
      */
     struct GNUNET_MessageHeader header;
 
-    /**
-     * TID of the tunnel
-     */
-    uint32_t tid GNUNET_PACKED;
-
-    /**
-     * OID of the tunnel
-     */
-    struct GNUNET_PeerIdentity oid;
-
-    /**
-     * FIXME: Some form of authentication
-     */
-    // uint32_t token;
-
-    /**
-     * Payload follows
-     */
+    /* FIXME Type specification */
+    uint32_t type;
 };
 
-
-/**
- * Message for mesh data traffic to a particular destination from origin.
- */
-struct GNUNET_MESH_DataMessageFromOrigin
-{
+struct GNUNET_MESH_Control {
     /**
-     * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_FROM_ORIGIN
+     * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL
+     *       more? transmit_ready?
      */
     struct GNUNET_MessageHeader header;
 
-    /**
-     * TID of the tunnel
-     */
-    uint32_t tid GNUNET_PACKED;
-
-    /**
-     * OID of the tunnel
-     */
-    struct GNUNET_PeerIdentity oid;
-
-    /**
-     * Destination.
-     */
-    struct GNUNET_PeerIdentity destination;
-
-    /**
-     * FIXME: Some form of authentication
-     */
-    // uint32_t token;
-
-    /**
-     * Payload follows
-     */
+    uint32_t tunnel_id GNUNET_PACKED;
+    uint32_t variable GNUNET_PACKED; /* Size of data to transmit? */
 };
 
-
-/**
- * Message for mesh data traffic from a tunnel participant to origin.
- */
-struct GNUNET_MESH_DataMessageToOrigin
-{
+struct GNUNET_MESH_TunnelEvent {
     /**
-     * Type: GNUNET_MESSAGE_TYPE_DATA_MESSAGE_TO_ORIGIN
+     * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_TUNNEL_[CREATED\DESTROYED]
      */
     struct GNUNET_MessageHeader header;
 
-    /**
-     * TID of the tunnel
-     */
-    uint32_t tid GNUNET_PACKED;
-
-    /**
-     * OID of the tunnel
-     */
-    struct GNUNET_PeerIdentity oid;
-
-    /**
-     * Sender of the message.
-     */
-    struct GNUNET_PeerIdentity sender;
-
-    /**
-     * FIXME: Some form of authentication
-     */
-    // uint32_t token;
-
-    /**
-     * Payload follows
-     */
+    uint32_t tunnel_id GNUNET_PACKED;
+    uint32_t reason GNUNET_PACKED; /* incoming, connect, timeout, disconnect */
 };
 
-/**
- * Message for mesh flow control
- */
-struct GNUNET_MESH_SpeedNotify
-{
+struct GNUNET_MESH_Data {
     /**
-     * Type: GNUNET_MESSAGE_TYPE_DATA_SPEED_NOTIFY
+     * Type: GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA
+     *
+     * Size: sizeof(struct GNUNET_MESH_Data) + sizeof (data)
      */
     struct GNUNET_MessageHeader header;
 
-    /**
-     * TID of the tunnel
-     */
-    uint32_t tid GNUNET_PACKED;
+    uint32_t tunnel_id GNUNET_PACKED;
 
-    /**
-     * OID of the tunnel
-     */
-    struct GNUNET_PeerIdentity oid;
+    /* FIXME: Broadcast? New Type / NULL destination ? */
+    /* FIXME: Reverese order for alignment? 1st ID, 2nd t_id? */
+    struct GNUNET_PeerIdentity destination GNUNET_PACKED;
 
-    /**
-     * Slowest link down the path (above minimum speed requirement).
-     */
-    uint32_t speed_min;
-
+    /* uint8_t data[] */
 };
 
 #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]