testbed service build system
authorSree Harsha Totakura <totakura@in.tum.de>
Tue, 12 Jun 2012 20:23:00 +0000 (20:23 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Tue, 12 Jun 2012 20:23:00 +0000 (20:23 +0000)
configure.ac
src/testbed/Makefile.am
src/testbed/gnunet-service-testbed.c [new file with mode: 0644]
src/testbed/testbed.conf [deleted file]
src/testbed/testbed.conf.in [new file with mode: 0644]
src/testbed/testbed.h

index de4817a0c203e3184fe84763df9286fe1577c384..ececc8e711fe3afcb11a07daeaa18a1a51a68961 100644 (file)
@@ -1091,6 +1091,7 @@ src/statistics/statistics.conf
 src/stream/Makefile
 src/template/Makefile
 src/testbed/Makefile
+src/testbed/testbed.conf
 src/testing/Makefile
 src/testing_old/Makefile
 src/topology/Makefile
index a1b290e1b115d26f781e103b3102f800ecfc68e9..3f613b0d6c3b5f1132bbb7bd6ed078f741d53ff4 100644 (file)
@@ -11,6 +11,18 @@ endif
 
 pkgcfgdir= $(pkgdatadir)/config.d/
 
+pkgcfg_DATA = \
+  testbed.conf
+
+bin_PROGRAMS = \
+  gnunet-service-testbed
+
+gnunet_service_testbed_SOURCES = \
+  gnunet-service-testbed.c
+gnunet_service_testbed_LDADD = $(XLIB) \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(LTLIBINTL)
+
 dist_pkgcfg_DATA = \
   testbed.conf
 
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c
new file mode 100644 (file)
index 0000000..5863938
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+  This file is part of GNUnet.
+  (C) 2012 Christian Grothoff (and other contributing authors)
+
+  GNUnet is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published
+  by the Free Software Foundation; either version 2, or (at your
+  option) any later version.
+
+  GNUnet is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with GNUnet; see the file COPYING.  If not, write to the
+  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+  Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file testbed/gnunet-service-testbed.c
+ * @brief implementation of the TESTBED service
+ * @author Sree Harsha Totakura
+ */
+
+#include "platform.h"
+#include "gnunet_service_lib.h"
+#include "gnunet_server_lib.h"
+
+#include "testbed.h"
+
+
+#define LOG(kind,...)                           \
+  GNUNET_log (kind, __VA_ARGS__)
+
+
+/**
+ * Message handler for GNUNET_MESSAGE_TYPE_TESTBED_INIT messages
+ *
+ * @param cls NULL
+ * @param client identification of the client
+ * @param message the actual message
+ */
+static void 
+handle_init (void *cls,
+             struct GNUNET_SERVER_Client *client,
+             const struct GNUNET_MessageHeader *message)
+{
+  GNUNET_break (0);
+}
+
+
+/**
+ * Callback for client disconnect
+ *
+ * @param cls NULL
+ * @param client the client which has disconnected
+ */
+static void
+client_disconnect_cb (void *cls, struct GNUNET_SERVER_Client *client)
+{
+  GNUNET_break (0);
+}
+
+
+/**
+ * Task to clean up and shutdown nicely
+ *
+ * @param cls NULL
+ * @param tc the TaskContext from scheduler
+ */
+static void
+shutdown_task (void *cls,
+               const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+  GNUNET_break (0);
+}
+
+
+/**
+ * Testbed setup
+ *
+ * @param cls closure
+ * @param server the initialized server
+ * @param cfg configuration to use
+ */
+static void 
+testbed_run (void *cls,
+             struct GNUNET_SERVER_Handle * server,
+             const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+  static const struct GNUNET_SERVER_MessageHandler message_handlers[] =
+    {
+      {&handle_init, NULL, GNUNET_MESSAGE_TYPE_TESTBED_INIT, 0},
+      {NULL}
+    };
+  GNUNET_SERVER_add_handlers (server,
+                              message_handlers);
+  GNUNET_SERVER_disconnect_notify (server,
+                                   &client_disconnect_cb,
+                                   NULL);
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+                                &shutdown_task,
+                                NULL);
+}
+
+
+/**
+ * The starting point of execution
+ */
+int main (int argc, char *const *argv)
+{
+  return
+    (GNUNET_OK ==
+     GNUNET_SERVICE_run (argc,
+                         argv,
+                         "testbed",
+                         GNUNET_SERVICE_OPTION_NONE,
+                         &testbed_run,
+                         NULL)) ? 0 : 1;
+}
diff --git a/src/testbed/testbed.conf b/src/testbed/testbed.conf
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/src/testbed/testbed.conf.in b/src/testbed/testbed.conf.in
new file mode 100644 (file)
index 0000000..2f658fd
--- /dev/null
@@ -0,0 +1,12 @@
+[testbed]
+AUTOSTART = NO
+@UNIXONLY@ PORT = 2101
+HOSTNAME = localhost
+HOME = $SERVICEHOME
+CONFIG = $DEFAULTCONFIG
+BINARY = gnunet-service-testbed
+ACCEPT_FROM = 127.0.0.1;
+ACCEPT_FROM6 = ::1;
+UNIXPATH = /tmp/gnunet-service-testbed.sock
+UNIX_MATCH_UID = YES
+UNIX_MATCH_GID = YES
index 703ca0308276a2d27980923650c66027cbfcdd4b..3c096399a394b9ebb66a080061c28277b90a21bf 100644 (file)
@@ -566,9 +566,9 @@ struct GNUNET_TESTBED_PeerConfigurationInformationMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Peer identity of the peer that was created.
+   * Peer number of the peer that was created.
    */
-  uint32_t peer_id GNUNET_PACKED;
+  uint32_t peer_number GNUNET_PACKED;
   
   /**
    * Operation ID of the operation that created this event.