*
* @param cls closure
* @param id identifier for the daemon, NULL on error
- * @param d handle to the daemon, NULL if starting the daemon failed
+ * @param cfg configuration used by this daemon
+ * @param d handle for the daemon
+ * @param emsg error message (NULL on success)
*/
typedef void (*GNUNET_TESTING_NotifyDaemonRunning)(void *cls,
const struct GNUNET_PeerIdentity *id,
- struct GNUNET_TESTING_Daemon *d);
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTING_Daemon *d,
+ const char *emsg);
/**
- * Starts a GNUnet daemon.
+ * Starts a GNUnet daemon. GNUnet must be installed on the target
+ * system and available in the PATH. The machine must furthermore be
+ * reachable via "ssh" (unless the hostname is "NULL") without the
+ * need to enter a password.
*
- * @param service_home directory to use as the service home directory
- * @param transports transport services that should be loaded
- * @param applications application services and daemons that should be started
- * @param port_offset offset to add to all ports for all services
+ * @param sched scheduler to use
+ * @param cfg configuration to use
* @param hostname name of the machine where to run GNUnet
* (use NULL for localhost).
* @param cb function to call with the result
* @param cb_cls closure for cb
+ * @return handle to the daemon (actual start will be completed asynchronously)
*/
-void
+struct GNUNET_TESTING_Daemon *
GNUNET_TESTING_daemon_start (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *service_home,
- const char *transports,
- const char *applications,
- uint16_t port_offset,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *hostname,
GNUNET_TESTING_NotifyDaemonRunning cb,
void *cb_cls);
* particular operation was completed the testing library.
*
* @param cls closure
- * @param success GNUNET_YES on success
+ * @param emsg NULL on success
*/
typedef void (*GNUNET_TESTING_NotifyCompletion)(void *cls,
- int success);
+ const char *emsg);
/**
void * cb_cls);
+/**
+ * Changes the configuration of a GNUnet daemon.
+ *
+ * @param d the daemon that should be modified
+ * @param cfg the new configuration for the daemon
+ * @param cb function called once the configuration was changed
+ * @param cb_cls closure for cb
+ */
+void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
+ struct GNUNET_CONFIGURATION_Handle *cfg,
+ GNUNET_TESTING_NotifyCompletion cb,
+ void * cb_cls);
+
/**
* Establish a connection between two GNUnet daemons.
*
* @param d1 handle for the first daemon
* @param d2 handle for the second daemon
+ * @param timeout how long is the connection attempt
+ * allowed to take?
* @param cb function to call at the end
* @param cb_cls closure for cb
*/
void GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
struct GNUNET_TESTING_Daemon *d2,
+ struct GNUNET_TIME_Relative timeout,
GNUNET_TESTING_NotifyCompletion cb,
void *cb_cls);
/**
- * Start count gnunetd processes with the same set of
- * transports and applications. The port numbers will
- * be computed by adding delta each time (zero
- * times for the first peer).
+ * Handle to a group of GNUnet peers.
+ */
+struct GNUNET_TESTING_PeerGroup;
+
+
+/**
+ * Start count gnunetd processes with the same set of transports and
+ * applications. The port numbers (any option called "PORT") will be
+ * adjusted to ensure that no two peers running on the same system
+ * have the same port(s) in their respective configurations.
*
+ * @param sched scheduler to use
+ * @param cfg configuration template to use
* @param total number of daemons to start
- * @param service_home_prefix path to use as the prefix for the home of the services
- * @param transports which transports should all peers use
- * @param applications which applications should be used?
- * @param timeout how long is this allowed to take?
* @param cb function to call on each daemon that was started
* @param cb_cls closure for cb
- * @param cbe function to call at the end
- * @param cbe_cls closure for cbe
- * @param hostname where to run the peers; can be NULL (to run
- * everything on localhost). Additional
- * hosts can be specified using a NULL-terminated list of
- * varargs, hosts will then be used round-robin from that
- * list.
+ * @param hostnames space-separated list of hostnames to use,
+ * NULL to use localhost only
+ * @return NULL on error, otherwise handle to control peer group
*/
-void
+struct GNUNET_TESTING_PeerGroup *
GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
unsigned int total,
- const char *service_home_prefix,
- const char *transports,
- const char *applications,
GNUNET_TESTING_NotifyDaemonRunning cb,
void *cb_cls,
- GNUNET_TESTING_NotifyCompletion cbe,
- void *cbe_cls,
- const char *hostname,
- ...);
+ const char *hostnames);
/**
- * Handle to an entire testbed of GNUnet peers.
+ * Shutdown all peers started in the given group.
+ *
+ * @param pg handle to the peer group
*/
-struct GNUNET_TESTING_Testbed;
+void
+GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg);
+
/**
- * Prototype of a function that will be called when
- * a testbed is being created.
- *
- * @param cls closure
- * @param tb NULL on error
+ * Handle to an entire testbed of GNUnet peers.
*/
-typedef void (*GNUNET_TESTING_NotifyTestbedRunning)(void *cls,
- struct GNUNET_TESTING_Testbed *tb);
+struct GNUNET_TESTING_Testbed;
/**
};
-
/**
- * Start count GNUnet daemons with a particular
- * topology.
+ * Start "count" GNUnet daemons with a particular topology.
*
- * @param size number of peers the testbed should have
+ * @param sched scheduler to use
+ * @param cfg configuration template to use
+ * @param count number of peers the testbed should have
* @param topology desired topology (enforced via F2F)
- * @param service_home_prefix path to use as the prefix for the home of the services
- * @param transports which transports should all peers use
- * @param applications which applications should be used?
- * @param timeout how long is this allowed to take?
* @param cb function to call on each daemon that was started
* @param cb_cls closure for cb
- * @param cte function to call at the end
- * @param cte_cls closure for cbe
* @param hostname where to run the peers; can be NULL (to run
* everything on localhost). Additional
* hosts can be specified using a NULL-terminated list of
* varargs, hosts will then be used round-robin from that
* list.
+ * @return handle to control the testbed
*/
-void
+struct GNUNET_TESTING_Testbed *
GNUNET_TESTING_testbed_start (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
- unsigned int size,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ unsigned int count,
enum GNUNET_TESTING_Topology topology,
- const char *service_home_prefix,
- const char *transports,
- const char *applications,
GNUNET_TESTING_NotifyDaemonRunning cb,
void *cb_cls,
- GNUNET_TESTING_NotifyTestbedRunning cte,
- void *cte_cls,
const char *hostname,
...);
-/**
- * Start count GNUnet daemons with a particular
- * topology.
- *
- * @param size number of peers the testbed should have
- * @param topology desired topology (enforced via F2F)
- * @param service_home_prefix path to use as the prefix for the home of the services
- * @param transports which transports should all peers use
- * @param applications which applications should be used?
- * @param timeout how long is this allowed to take?
- * @param cb function to call on each daemon that was started
- * @param cb_cls closure for cb
- * @param cte function to call at the end
- * @param cte_cls closure for cbe
- * @param hostname where to run the peers; can be NULL (to run
- * everything on localhost).
- * @param va Additional hosts can be specified using a NULL-terminated list of
- * varargs, hosts will then be used round-robin from that
- * list; va only contains anything if hostname != NULL.
- */
-void
-GNUNET_TESTING_testbed_start_va (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
- unsigned int size,
- enum GNUNET_TESTING_Topology topology,
- const char *service_home_prefix,
- const char *transports,
- const char *applications,
- GNUNET_TESTING_NotifyDaemonRunning cb,
- void *cb_cls,
- GNUNET_TESTING_NotifyTestbedRunning cte,
- void *cte_cls,
- const char *hostname,
- va_list ap);
-
-
/**
* Stop all of the daemons started with the start function.
*
* @param tb handle for the testbed
- * @param cb function to call at the end
+ * @param cb function to call when done
* @param cb_cls closure for cb
*/
void
void *cb_cls );
-
/**
* Simulate churn in the testbed by stopping some peers (and possibly
* re-starting others if churn is called multiple times). This
void *cb_cls);
-
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif