-breaking testbed again...
authorChristian Grothoff <christian@grothoff.org>
Wed, 11 Jul 2012 13:10:26 +0000 (13:10 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 11 Jul 2012 13:10:26 +0000 (13:10 +0000)
src/include/gnunet_testbed_service.h
src/testbed/test_testbed_api.c

index e6997db1fee6959b7a1e8c3c2c876efcfc36358c..46be98b79c2c398409879efc3524bfe1c4bbbd3a 100644 (file)
@@ -401,14 +401,40 @@ typedef void (*GNUNET_TESTBED_ControllerCallback)(void *cls,
 struct GNUNET_TESTBED_ControllerProc;
 
 
+/**
+ * Function called on errors with the controller.
+ *
+ * @param cls closure
+ * @param emsg error message if available; can be NULL, which does NOT mean
+ *             that there was no error
+ */
+typedef void (*GNUNET_TESTBED_ControllerErrorCallback)(void *cls,
+                                                      const char *emsg);
+
+
 /**
  * Starts a controller process at the host
  *
+ * @param system used for reserving ports if host is NULL and to determine
+ *               which 'host' to set as TRUSTED ('controller') when starting testbed remotely
  * @param host the host where the controller has to be started; NULL for localhost
- * @return the controller process handle
+ * @param cfg template configuration to use for the remote controller; will
+ *            be modified to contain the actual host/port/unixpath used for
+ *            the testbed service
+ * @param cec function called if the contoller dies unexpectedly; will not be 
+ *            invoked after GNUNET_TESTBED_controller_stop, if 'cec' was called,
+ *            GNUNET_TESTBED_controller_stop must no longer be called; will
+ *            never be called in the same task as 'GNUNET_TESTBED_controller_start'
+ *            (synchronous errors will be signalled by returning NULL)
+ * @param cec_cls closure for 'cec'
+ * @return the controller process handle, NULL on errors
  */
 struct GNUNET_TESTBED_ControllerProc *
-GNUNET_TESTBED_controller_start (struct GNUNET_TESTBED_Host *host);
+GNUNET_TESTBED_controller_start (struct GNUNET_TESTING_System *system,
+                                struct GNUNET_TESTBED_Host *host,
+                                struct GNUNET_CONFIGURATION_Handle *cfg,
+                                GNUNET_TESTBED_ControllerErrorCallback cec,
+                                void *cec_cls);
 
 
 /**
index 6c50c93d7bf3eb52f9aa28d3bc185aff94ce70c3..1fdb7169a58782d551bc80d3db7d901c5f68dd0d 100644 (file)
@@ -182,11 +182,13 @@ run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *config)
 {
   uint64_t event_mask;
+  struct GNUNET_CONFIGURATION_Handle *cdup;
 
   cfg = config;
   host = GNUNET_TESTBED_host_create (NULL, NULL, 0);
   GNUNET_assert (NULL != host);
-  cp = GNUNET_TESTBED_controller_start (host);
+  cdup = GNUNET_CONFIGURATION_dup (config);
+  cp = GNUNET_TESTBED_controller_start (system, host, cdup, NULL, NULL);
   event_mask = 0;
   event_mask |= (1L << GNUNET_TESTBED_ET_PEER_START);
   event_mask |= (1L << GNUNET_TESTBED_ET_PEER_STOP);