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 testbed/testbed_api_testbed.c
23 * @brief high-level testbed management
24 * @author Christian Grothoff
27 #include "gnunet_testbed_service.h"
31 * Opaque handle to an abstract operation to be executed by the testing framework.
33 struct GNUNET_TESTBED_Testbed
40 * Configure and run a testbed using the given
41 * master controller on 'num_hosts' starting
42 * 'num_peers' using the given peer configuration.
44 * @param controller master controller for the testbed
45 * (must not be destroyed until after the
46 * testbed is destroyed).
47 * @param num_hosts number of hosts in 'hosts', 0 to only
49 * @param hosts list of hosts to use for the testbed
50 * @param num_peers number of peers to start
51 * @param peer_cfg peer configuration template to use
52 * @param underlay_topology underlay topology to create
53 * @param va topology-specific options
54 * @return handle to the testbed
56 struct GNUNET_TESTBED_Testbed *
57 GNUNET_TESTBED_create_va (struct GNUNET_TESTBED_Controller *controller,
58 unsigned int num_hosts,
59 struct GNUNET_TESTBED_Host **hosts,
60 unsigned int num_peers,
61 const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
62 enum GNUNET_TESTBED_TopologyOption underlay_topology,
71 * Configure and run a testbed using the given
72 * master controller on 'num_hosts' starting
73 * 'num_peers' using the given peer configuration.
75 * @param controller master controller for the testbed
76 * (must not be destroyed until after the
77 * testbed is destroyed).
78 * @param num_hosts number of hosts in 'hosts', 0 to only
80 * @param hosts list of hosts to use for the testbed
81 * @param num_peers number of peers to start
82 * @param peer_cfg peer configuration template to use
83 * @param underlay_topology underlay topology to create
84 * @param ... topology-specific options
86 struct GNUNET_TESTBED_Testbed *
87 GNUNET_TESTBED_create (struct GNUNET_TESTBED_Controller *controller,
88 unsigned int num_hosts,
89 struct GNUNET_TESTBED_Host **hosts,
90 unsigned int num_peers,
91 const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
92 enum GNUNET_TESTBED_TopologyOption underlay_topology,
101 * Destroy a testbed. Stops all running peers and then
102 * destroys all peers. Does NOT destroy the master controller.
104 * @param testbed testbed to destroy
107 GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed)
115 * Convenience method for running a testbed with
116 * a single call. Underlay and overlay topology
117 * are configured using the "UNDERLAY" and "OVERLAY"
118 * options in the "[testbed]" section of the configuration\
119 * (with possible options given in "UNDERLAY_XXX" and/or
122 * The testbed is to be terminated using a call to
123 * "GNUNET_SCHEDULER_shutdown".
125 * @param host_filename name of the file with the 'hosts', NULL
126 * to run everything on 'localhost'
127 * @param cfg configuration to use (for testbed, controller and peers)
128 * @param num_peers number of peers to start; FIXME: maybe put that ALSO into cfg?
129 * @param event_mask bit mask with set of events to call 'cc' for;
130 * or-ed values of "1LL" shifted by the
131 * respective 'enum GNUNET_TESTBED_EventType'
132 * (i.e. "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
133 * @param cc controller callback to invoke on events
134 * @param cc_cls closure for cc
135 * @param master task to run once the testbed is ready
136 * @param master_cls closure for 'task'.
139 GNUNET_TESTBED_run (const char *host_filename,
140 const struct GNUNET_CONFIGURATION_Handle *cfg,
141 unsigned int num_peers,
143 GNUNET_TESTBED_ControllerCallback cc,
145 GNUNET_SCHEDULER_Task master,
153 /* end of testbed_api_testbed.c */