-build issues'
[oweals/gnunet.git] / src / testbed / testbed_api.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 testing/testbed_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
27  */
28 #include "platform.h"
29 #include "gnunet_testbed_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"
34
35
36
37
38 /**
39  * Start a controller process using the given configuration at the
40  * given host.
41  *
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_TESTBED_EventType'
47  *                   (i.e.  "(1LL << GNUNET_TESTBED_ET_CONNECT) | ...")
48  * @param cc controller callback to invoke on events
49  * @param cc_cls closure for cc
50  * @return handle to the controller
51  */
52 struct GNUNET_TESTBED_Controller *
53 GNUNET_TESTBED_controller_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
54                                  struct GNUNET_TESTBED_Host *host,
55                                  uint64_t event_mask,
56                                  GNUNET_TESTBED_ControllerCallback cc,
57                                  void *cc_cls)
58 {
59   GNUNET_break (0);
60   return NULL;
61 }
62
63
64 /**
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.
70  * 
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
76  */
77 void
78 GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controller *controller,
79                                              const char *service_name,
80                                              uint32_t num_peers)
81 {
82   GNUNET_break (0);
83 }
84
85
86 /**
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 (!).
90  *
91  * @param controller handle to controller to stop
92  */
93 void
94 GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_Controller *controller)
95 {
96   GNUNET_break (0);
97 }
98
99
100 /**
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.
113  *
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
121  */
122 void
123 GNUNET_TESTBED_controller_link (struct GNUNET_TESTBED_Controller *master,
124                                 struct GNUNET_TESTBED_Host *delegated_host,
125                                 struct GNUNET_TESTBED_Host *slave_host,
126                                 const struct GNUNET_CONFIGURATION_Handle *slave_cfg,
127                                 int is_subordinate)
128 {
129   GNUNET_break (0);
130 }
131
132
133 /**
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.
137  *
138  * @param controller overlay controller to inspect
139  * @param filename name of the file the topology should
140  *        be written to.
141  */
142 void
143 GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Controller *controller,
144                                                const char *filename)
145 {
146 }
147
148
149
150 /* end of testbed_api.c */