2 This file is part of GNUnet
3 (C) 2008--2012 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file testing/new_testing_api.c
23 * @brief API for accessing the GNUnet testing service.
24 * This library is supposed to make it easier to write
25 * testcases and script large-scale benchmarks.
26 * @author Christian Grothoff
29 #include "gnunet_testing_service.h"
30 #include "gnunet_core_service.h"
31 #include "gnunet_constants.h"
32 #include "gnunet_transport_service.h"
33 #include "gnunet_hello_lib.h"
39 * Start a controller process using the given configuration at the
42 * @param cfg configuration to use
43 * @param host host to run the controller on, NULL for 'localhost'
44 * @param event_mask bit mask with set of events to call 'cc' for;
45 * or-ed values of "1LL" shifted by the
46 * respective 'enum GNUNET_TESTING_EventType'
47 * (i.e. "(1LL << GNUNET_TESTING_ET_CONNECT) | ...")
48 * @param cc controller callback to invoke on events
49 * @param cc_cls closure for cc
50 * @return handle to the controller
52 struct GNUNET_TESTING_Controller *
53 GNUNET_TESTING_controller_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
54 struct GNUNET_TESTING_Host *host,
56 GNUNET_TESTING_ControllerCallback cc,
65 * Configure shared services at a controller. Using this function,
66 * you can specify that certain services (such as "resolver")
67 * should not be run for each peer but instead be shared
68 * across N peers on the specified host. This function
69 * must be called before any peers are created at the host.
71 * @param controller controller to configure
72 * @param service_name name of the service to share
73 * @param num_peers number of peers that should share one instance
74 * of the specified service (1 for no sharing is the default),
75 * use 0 to disable the service
78 GNUNET_TESTING_controller_configure_sharing (struct GNUNET_TESTING_Controller *controller,
79 const char *service_name,
87 * Stop the given controller (also will terminate all peers and
88 * controllers dependent on this controller). This function
89 * blocks until the testbed has been fully terminated (!).
91 * @param controller handle to controller to stop
94 GNUNET_TESTING_controller_stop (struct GNUNET_TESTING_Controller *controller)
101 * Create a link from a 'master' controller to a slave controller.
102 * Whenever the master controller is asked to start a peer at the
103 * given 'delegated_host', it will delegate the request to the
104 * specified slave controller. Note that the slave controller runs at
105 * the 'slave_host', which may or may not be the same host as the
106 * 'delegated_host' (for hierarchical delegations). The configuration
107 * of the slave controller is given and to be used to either create
108 * the slave controller or to connect to an existing slave controller
109 * process. 'is_subordinate' specifies if the given slave controller
110 * should be started and managed by the master controller, or if the
111 * slave already has a master and this is just a secondary master that
112 * is also allowed to use the existing slave.
114 * @param master handle to the master controller who creates the association
115 * @param delegated_host requests to which host should be delegated
116 * @param slave_host which host is used to run the slave controller
117 * @param slave_cfg configuration to use for the slave controller
118 * @param is_subordinate GNUNET_YES if the slave should be started (and stopped)
119 * by the master controller; GNUNET_NO if we are just
120 * allowed to use the slave via TCP/IP
123 GNUNET_TESTING_controller_link (struct GNUNET_TESTING_Controller *master,
124 struct GNUNET_TESTING_Host *delegated_host,
125 struct GNUNET_TESTING_Host *slave_host,
126 const struct GNUNET_CONFIGURATION_Handle *slave_cfg,
134 * Ask the testbed controller to write the current overlay topology to
135 * a file. Naturally, the file will only contain a snapshot as the
136 * topology may evolve all the time.
138 * @param controller overlay controller to inspect
139 * @param filename name of the file the topology should
143 GNUNET_TESTING_overlay_write_topology_to_file (struct GNUNET_TESTING_Controller *controller,
144 const char *filename)
150 /* end of new_testing_api.c */