Make mesh service compile
authorBart Polot <bart@net.in.tum.de>
Tue, 5 Apr 2011 18:08:47 +0000 (18:08 +0000)
committerBart Polot <bart@net.in.tum.de>
Tue, 5 Apr 2011 18:08:47 +0000 (18:08 +0000)
src/mesh/Makefile.am
src/mesh/gnunet-service-mesh.c
src/mesh/mesh.h

index d731db8adaf00a71e611024ab4d12bbd80c2699d..81b1278835c5426e78172f557aea3b01d3a15023 100644 (file)
@@ -9,6 +9,8 @@ if USE_COVERAGE
   XLIB = -lgcov
 endif
 
+bin_PROGRAMS = $(STUD_PROGS) \
+ gnunet-service-mesh
 
 lib_LTLIBRARIES = \
   libgnunetmesh.la
@@ -22,3 +24,11 @@ libgnunetmesh_la_LIBADD = \
 libgnunetmesh_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS) $(WINFLAGS) \
   -version-info 0:0:0
+
+gnunet_service_mesh_SOURCES = \
+ gnunet-service-mesh.c         
+
+gnunet_service_mesh_LDADD = \
+  $(top_builddir)/src/core/libgnunetcore.la
+#  $(top_builddir)/src/transport/libgnunettransport.la \
+#  $(top_builddir)/src/util/libgnunetutil.la
index 20c2315be484bd445317fbbeec49ad0e93cc1351..fce2d1406dbac69c3f3fd959b8417b1aef5db03f 100644 (file)
  * - speed requirement specification (change?) in mesh API -- API call
  */
 
-#include <stdint.h>
+#include "platform.h"
 #include "gnunet_common.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_core_service.h"
-#include <netinet/in.h>
+#include "gnunet_protocols.h"
+#include "mesh.h"
 
 
 /******************************************************************************/
@@ -244,7 +245,7 @@ struct PeerInfo
     /**
      * Is the peer reachable? Is the peer even connected?
      */
-    struct PeerState state;
+    enum PeerState state;
 
     /**
      * Who to send the data to
@@ -275,7 +276,7 @@ struct Path
     /**
      * List of all the peers that form the path from origin to target
      */
-    PeerInfo *peers;
+    struct PeerInfo *peers;
 };
 
 /**
@@ -356,35 +357,11 @@ struct Clients
     int fixme;
 };
 
-/**
- * Handler for requests of creating new path
- * type: struct GNUNET_CORE_MessageHandler
- *
- * @param cls closure
- * @param client the client this message is from
- * @param message the message received
- */
-static void
-handle_mesh_path_create (void *cls,
-                         struct GNUNET_SERVER_Client *client,
-                         const struct GNUNET_MessageHeader *message)
-{
-    return;
-}
 
-/**
- * Handler for client disconnection
- *
- * @param cls closure
- * @param client identification of the client; NULL
- *        for the last call when the server is destroyed
- */
-static void
-handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
-{
-    /* Remove client from list, delete all timers and queues associated */
-    return;
-}
+
+/******************************************************************************/
+/********************      MESH NETWORK HANDLERS     **************************/
+/******************************************************************************/
 
 /**
  * Core handler for path creation
@@ -394,6 +371,8 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
  * @param message message
  * @param peer peer identity this notification is about
  * @param atsi performance data
+ * @return GNUNET_OK to keep the connection open,
+ *         GNUNET_SYSERR to close it (signal serious error)
  *
  */
 static int
@@ -418,7 +397,8 @@ handle_mesh_path_create (void *cls,
  * @param message message
  * @param peer peer identity this notification is about
  * @param atsi performance data
- *
+ * @return GNUNET_OK to keep the connection open,
+ *         GNUNET_SYSERR to close it (signal serious error)
  */
 static int
 handle_mesh_network_traffic (void *cls,
@@ -440,12 +420,77 @@ handle_mesh_network_traffic (void *cls,
  * Functions to handle messages from core
  */
 static struct GNUNET_CORE_MessageHandler core_handlers[] = {
-  {&handle_mesh_path_create, NULL, GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE, 0},
+  {&handle_mesh_path_create, GNUNET_MESSAGE_TYPE_MESH_PATH_CREATE, 0},
   {&handle_mesh_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_GO, 0},
   {&handle_mesh_network_traffic, GNUNET_MESSAGE_TYPE_MESH_DATA_BACK, 0},
   {NULL, 0, 0}
 };
 
+
+
+/******************************************************************************/
+/*********************       MESH LOCAL HANDLES      **************************/
+/******************************************************************************/
+
+/**
+ * Handler for client disconnection
+ *
+ * @param cls closure
+ * @param client identification of the client; NULL
+ *        for the last call when the server is destroyed
+ */
+static void
+handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
+{
+    /* Remove client from list, delete all timers and queues associated */
+    return;
+}
+
+/**
+ * Handler for new clients
+ * 
+ * @param cls closure
+ * @param client identification of the client
+ * @param message the actual message, which includes messages the client wants
+ */
+static void
+handle_local_new_client (void *cls,
+                         struct GNUNET_SERVER_Client *client,
+                         const struct GNUNET_MessageHeader *message)
+{
+    return;
+}
+
+/**
+ * Handler for connection requests
+ * 
+ * @param cls closure
+ * @param client identification of the client
+ * @param message the actual message
+ */
+static void
+handle_local_connect (void *cls,
+                         struct GNUNET_SERVER_Client *client,
+                         const struct GNUNET_MessageHeader *message)
+{
+    return;
+}
+
+/**
+ * Handler for client traffic
+ * 
+ * @param cls closure
+ * @param client identification of the client
+ * @param message the actual message
+ */
+static void
+handle_local_network_traffic (void *cls,
+                         struct GNUNET_SERVER_Client *client,
+                         const struct GNUNET_MessageHeader *message)
+{
+    return;
+}
+
 /**
  * Functions to handle messages from clients
  */
@@ -464,16 +509,16 @@ static struct GNUNET_CORE_MessageHandler core_handlers[] = {
 #define GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST       283
  */
 static struct GNUNET_SERVER_MessageHandler plugin_handlers[] = {
-  {&handle_local_new_client, NULL, GNUNET_MESSAGE_TYPE_LOCAL_CONNECT, 0},
+  {&handle_local_new_client, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT, 0},
   {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ANY, 0},
   {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ALL, 0},
   {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_ADD, 0},
   {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_DEL, 0},
   {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_BY_TYPE, sizeof(struct GNUNET_MESH_ConnectPeerByType)},
   {&handle_local_connect, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_CONNECT_PEER_CANCEL, sizeof(struct GNUNET_MESH_Control)},
-  {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_LOCAL_TRANSMIT_READY, sizeof(struct GNUNET_MESH_Control)},
-  {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_LOCAL_DATA, 0}, /* FIXME needed? */
-  {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_LOCAL_DATA_BROADCAST, 0}, /* FIXME needed? */
+  {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_TRANSMIT_READY, sizeof(struct GNUNET_MESH_Control)},
+  {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA, 0}, /* FIXME needed? */
+  {&handle_local_network_traffic, NULL, GNUNET_MESSAGE_TYPE_MESH_LOCAL_DATA_BROADCAST, 0}, /* FIXME needed? */
   {NULL, NULL, 0, 0}
 };
 
@@ -525,7 +570,7 @@ core_disconnect (void *cls,
 }
 
 /**
- * Process mesh requests. FIXME NON FUNCTIONAL, COPIED FROM DHT!!
+ * Process mesh requests. FIXME NON FUNCTIONAL, SKELETON
  *
  * @param cls closure
  * @param server the initialized server
@@ -536,10 +581,7 @@ run (void *cls,
      struct GNUNET_SERVER_Handle *server,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  struct GNUNET_TIME_Relative next_send_time;
-  unsigned long long temp_config_num;
-  char *converge_modifier_buf;
-  GNUNET_CORE_Handle *core;
+  struct GNUNET_CORE_Handle *core;
 
   GNUNET_SERVER_add_handlers (server, plugin_handlers);
   GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, NULL);
index 5d404c88dd896dbf4ad367b4b584a24ee5f026b1..2c260030d110fe3cc877e2037c527b44e5918da2 100644 (file)
@@ -112,7 +112,7 @@ struct GNUNET_MESH_Data {
 
     uint32_t tunnel_id GNUNET_PACKED;
 
-    struct GNUNET_PeerIdentity destination GNUNET_PACKED;
+    struct GNUNET_PeerIdentity destination;
 
     /* uint8_t data[] */
 };