controller hostname in init
[oweals/gnunet.git] / src / testbed / testbed_api_testbed.c
1 /*
2       This file is part of GNUnet
3       (C) 2008--2012 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19  */
20
21 /**
22  * @file testbed/testbed_api_testbed.c
23  * @brief high-level testbed management
24  * @author Christian Grothoff
25  */
26 #include "platform.h"
27 #include "gnunet_testbed_service.h"
28
29
30 /**
31  * Opaque handle to an abstract operation to be executed by the testing framework.
32  */
33 struct GNUNET_TESTBED_Testbed
34 {
35   // FIXME!
36 };
37
38
39 /**
40  * Configure and run a testbed using the given
41  * master controller on 'num_hosts' starting
42  * 'num_peers' using the given peer configuration.
43  *
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
48  *        use 'localhost'
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
55  */
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,
63                                   va_list va)
64 {
65   GNUNET_break (0);
66   return NULL;
67 }
68
69
70 /**
71  * Configure and run a testbed using the given
72  * master controller on 'num_hosts' starting
73  * 'num_peers' using the given peer configuration.
74  *
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
79  *        use 'localhost'
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
85  */
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,
93                                ...)
94 {
95   GNUNET_break (0);
96   return NULL;
97 }
98
99
100 /**
101  * Destroy a testbed.  Stops all running peers and then
102  * destroys all peers.  Does NOT destroy the master controller.
103  *
104  * @param testbed testbed to destroy
105  */
106 void
107 GNUNET_TESTBED_destroy (struct GNUNET_TESTBED_Testbed *testbed)
108 {
109   GNUNET_break (0);
110 }
111
112
113
114 /**
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
120  * "OVERLAY_XXX").
121  *
122  * The testbed is to be terminated using a call to
123  * "GNUNET_SCHEDULER_shutdown".
124  *
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'.
137  */
138 void
139 GNUNET_TESTBED_run (const char *host_filename,
140                             const struct GNUNET_CONFIGURATION_Handle *cfg,
141                             unsigned int num_peers,
142                             uint64_t event_mask,
143                             GNUNET_TESTBED_ControllerCallback cc,
144                             void *cc_cls,
145                             GNUNET_SCHEDULER_Task master,
146                             void *master_cls)
147 {
148   GNUNET_break (0);
149 }
150
151
152
153 /* end of testbed_api_testbed.c */