- rename TOPOLOGY_FILE to OVERLAY_TOPOLOGY_FILE and remove GNUNET_TESTBED_create...
[oweals/gnunet.git] / src / include / gnunet_testbed_service.h
1 /*
2       This file is part of GNUnet
3       (C) 2008, 2009, 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 include/gnunet_testbed_service.h
23  * @brief API for writing tests and creating large-scale
24  *        emulation testbeds for GNUnet.
25  * @author Christian Grothoff
26  */
27
28 #ifndef GNUNET_TESTBED_SERVICE_H
29 #define GNUNET_TESTBED_SERVICE_H
30
31 #include "gnunet_util_lib.h"
32 #include "gnunet_testing_lib-new.h"
33
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #if 0                           /* keep Emacsens' auto-indent happy */
38 }
39 #endif
40 #endif
41
42
43 /**
44  * Opaque handle to a host running experiments managed by the testbed framework.
45  * The master process must be able to SSH to this host without password (via
46  * ssh-agent).
47  */
48 struct GNUNET_TESTBED_Host;
49
50 /**
51  * Opaque handle to a peer controlled by the testbed framework.  A peer runs
52  * at a particular host.
53  */
54 struct GNUNET_TESTBED_Peer;
55
56 /**
57  * Opaque handle to an abstract operation to be executed by the testbed framework.
58  */
59 struct GNUNET_TESTBED_Operation;
60
61 /**
62  * Handle to interact with a GNUnet testbed controller.  Each
63  * controller has at least one master handle which is created when the
64  * controller is created; this master handle interacts with the
65  * controller process, destroying it destroys the controller (by
66  * closing stdin of the controller process).  Additionally,
67  * controllers can interact with each other (in a P2P fashion); those
68  * links are established via TCP/IP on the controller's service port.
69  */
70 struct GNUNET_TESTBED_Controller;
71
72
73 /**
74  * Create a host to run peers and controllers on.
75  *
76  * @param hostname name of the host, use "NULL" for localhost
77  * @param username username to use for the login; may be NULL
78  * @param port port number to use for ssh; use 0 to let ssh decide
79  * @return handle to the host, NULL on error
80  */
81 struct GNUNET_TESTBED_Host *
82 GNUNET_TESTBED_host_create (const char *hostname,
83                             const char *username,
84                             uint16_t port);
85
86
87
88 /**
89  * Create a host to run peers and controllers on.  This function is used
90  * if a peer learns about a host via IPC between controllers (and thus
91  * some higher-level controller has already determined the unique IDs).
92  *
93  * @param id global host ID assigned to the host; 0 is
94  *        reserved to always mean 'localhost'
95  * @param hostname name of the host, use "NULL" for localhost
96  * @param username username to use for the login; may be NULL
97  * @param port port number to use for ssh; use 0 to let ssh decide
98  * @return handle to the host, NULL on error
99  */
100 struct GNUNET_TESTBED_Host *
101 GNUNET_TESTBED_host_create_with_id (uint32_t id,
102                                     const char *hostname,
103                                     const char *username,
104                                     uint16_t port);
105
106
107 /**
108  * Load a set of hosts from a configuration file.
109  *
110  * @param filename file with the host specification
111  * @param hosts set to the hosts found in the file; caller must free this if
112  *          number of hosts returned is greater than 0
113  * @return number of hosts returned in 'hosts', 0 on error
114  */
115 unsigned int
116 GNUNET_TESTBED_hosts_load_from_file (const char *filename,
117                                      struct GNUNET_TESTBED_Host ***hosts);
118
119
120 /**
121  * Destroy a host handle.  Must only be called once everything
122  * running on that host has been stopped.
123  *
124  * @param host handle to destroy
125  */
126 void
127 GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host);
128
129
130 /**
131  * The handle for whether a host is habitable or not
132  */
133 struct GNUNET_TESTBED_HostHabitableCheckHandle;
134
135
136 /**
137  * Callbacks of this type are called by GNUNET_TESTBED_is_host_habitable to
138  * inform whether the given host is habitable or not. The Handle returned by
139  * GNUNET_TESTBED_is_host_habitable() is invalid after this callback is called
140  *
141  * @param cls the closure given to GNUNET_TESTBED_is_host_habitable()
142  * @param host the host whose status is being reported; will be NULL if the host
143  *          given to GNUNET_TESTBED_is_host_habitable() is NULL
144  * @param status GNUNET_YES if it is habitable; GNUNET_NO if not
145  */
146 typedef void (*GNUNET_TESTBED_HostHabitableCallback) (void *cls,
147                                                       const struct
148                                                       GNUNET_TESTBED_Host
149                                                       *host,
150                                                       int status);
151
152
153 /**
154  * Checks whether a host can be used to start testbed service
155  *
156  * @param host the host to check
157  * @param config the configuration handle to lookup the path of the testbed
158  *          helper
159  * @param cb the callback to call to inform about habitability of the given host
160  * @param cb_cls the closure for the callback
161  * @return NULL upon any error or a handle which can be passed to
162  *           GNUNET_TESTBED_is_host_habitable_cancel()
163  */
164 struct GNUNET_TESTBED_HostHabitableCheckHandle *
165 GNUNET_TESTBED_is_host_habitable (const struct GNUNET_TESTBED_Host *host,
166                                   const struct GNUNET_CONFIGURATION_Handle
167                                   *config,
168                                   GNUNET_TESTBED_HostHabitableCallback cb,
169                                   void *cb_cls);
170
171
172 /**
173  * Function to cancel a request started using GNUNET_TESTBED_is_host_habitable()
174  *
175  * @param struct handle the habitability check handle
176  */
177 void
178 GNUNET_TESTBED_is_host_habitable_cancel (struct
179                                          GNUNET_TESTBED_HostHabitableCheckHandle
180                                          *handle);
181
182 /**
183  * Obtain the host's hostname.
184  *
185  * @param host handle to the host, NULL means 'localhost'
186  * @return hostname of the host
187  */
188 const char *
189 GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host);
190
191
192 /**
193  * Enumeration with (at most 64) possible event types that
194  * can be monitored using the testbed framework.
195  */
196 enum GNUNET_TESTBED_EventType
197 {
198   /**
199    * A peer has been started.
200    */
201   GNUNET_TESTBED_ET_PEER_START = 0,
202
203   /**
204    * A peer has been stopped.
205    */
206   GNUNET_TESTBED_ET_PEER_STOP = 1,
207
208   /**
209    * A connection between two peers was established.
210    */
211   GNUNET_TESTBED_ET_CONNECT = 2,
212
213   /**
214    * A connection between two peers was torn down.
215    */
216   GNUNET_TESTBED_ET_DISCONNECT = 3,
217
218   /**
219    * A requested testbed operation has been completed.
220    */
221   GNUNET_TESTBED_ET_OPERATION_FINISHED = 4,
222
223   /**
224    * The 'GNUNET_TESTBED_run' operation has been completed
225    */
226   GNUNET_TESTBED_ET_TESTBED_ONLINE = 5
227
228 };
229
230
231 /**
232  * Types of information that can be requested about a peer.
233  */
234 enum GNUNET_TESTBED_PeerInformationType
235 {
236
237   /**
238    * Special value (not valid for requesting information)
239    * that is used in the event struct if a 'generic' pointer
240    * is returned (for other operations not related to this
241    * enumeration).
242    */
243   GNUNET_TESTBED_PIT_GENERIC = 0,
244
245   /**
246    * What configuration is the peer using?  Returns a 'const struct
247    * GNUNET_CONFIGURATION_Handle *'.  Valid until
248    * 'GNUNET_TESTNIG_operation_done' is called.  However, the
249    * values may be inaccurate if the peer is reconfigured in
250    * the meantime.
251    */
252   GNUNET_TESTBED_PIT_CONFIGURATION,
253
254   /**
255    * What is the identity of the peer?  Returns a
256    * 'const struct GNUNET_PeerIdentity *'.  Valid until
257    * 'GNUNET_TESTNIG_operation_done' is called.
258    */
259   GNUNET_TESTBED_PIT_IDENTITY
260
261 };
262
263
264 /**
265  * Argument to GNUNET_TESTBED_ControllerCallback with details about
266  * the event.
267  */
268 struct GNUNET_TESTBED_EventInformation
269 {
270
271   /**
272    * Type of the event.
273    */
274   enum GNUNET_TESTBED_EventType type;
275
276   /**
277    * Details about the event.
278    */
279   union
280   {
281
282     /**
283      * Details about peer start event.
284      */
285     struct
286     {
287       /**
288        * Handle for the host where the peer
289        * was started.
290        */
291       struct GNUNET_TESTBED_Host *host;
292
293       /**
294        * Handle for the peer that was started.
295        */
296       struct GNUNET_TESTBED_Peer *peer;
297
298     } peer_start;
299
300     /**
301      * Details about peer stop event.
302      */
303     struct
304     {
305
306       /**
307        * Handle for the peer that was started.
308        */
309       struct GNUNET_TESTBED_Peer *peer;
310
311     } peer_stop;
312
313     /**
314      * Details about connect event.
315      */
316     struct
317     {
318       /**
319        * Handle for one of the connected peers.
320        */
321       struct GNUNET_TESTBED_Peer *peer1;
322
323       /**
324        * Handle for one of the connected peers.
325        */
326       struct GNUNET_TESTBED_Peer *peer2;
327
328     } peer_connect;
329
330     /**
331      * Details about disconnect event.
332      */
333     struct
334     {
335       /**
336        * Handle for one of the disconnected peers.
337        */
338       struct GNUNET_TESTBED_Peer *peer1;
339
340       /**
341        * Handle for one of the disconnected peers.
342        */
343       struct GNUNET_TESTBED_Peer *peer2;
344
345     } peer_disconnect;
346
347     /**
348      * Details about an operation finished event.
349      */
350     struct
351     {
352
353       /**
354        * Handle for the operation that was finished.
355        */
356       struct GNUNET_TESTBED_Operation *operation;
357
358       /**
359        * Closure that was passed in when the event was
360        * requested.
361        */
362       void *op_cls;
363
364       /**
365        * Error message for the operation, NULL on success.
366        */
367       const char *emsg;
368
369       /**
370        * No result (NULL pointer) or generic result
371        * (whatever the GNUNET_TESTBED_ConnectAdapter returned).
372        */
373       void *generic;
374
375     } operation_finished;
376
377     /**
378      * Details about an testbed run completed event.
379      */
380     struct
381     {
382
383       /**
384        * Error message for the operation, NULL on success.
385        */
386       const char *emsg;
387
388       /**
389        * Array of peers now running (valid until
390        * 'GNUNET_TESTBED_testbed_stop' is called).  Note that it is
391        * not allowed to call 'GNUNET_TESTBED_peer_destroy' on peers
392        * from this array.
393        */
394       struct GNUNET_TESTBED_Peer **peers;
395
396       /**
397        * Size of the 'peers' array.
398        */
399       unsigned int num_peers;
400
401     } testbed_run_finished;
402
403   } details;
404
405 };
406
407
408 /**
409  * Signature of the event handler function called by the
410  * respective event controller.
411  *
412  * @param cls closure
413  * @param event information about the event
414  */
415 typedef void (*GNUNET_TESTBED_ControllerCallback)(void *cls,
416                                                   const struct GNUNET_TESTBED_EventInformation *event);
417
418
419 /**
420  * Opaque Handle for Controller process
421  */
422 struct GNUNET_TESTBED_ControllerProc;
423
424
425 /**
426  * Callback to signal successfull startup of the controller process
427  *
428  * @param cls the closure from GNUNET_TESTBED_controller_start()
429  * @param cfg the configuration with which the controller has been started;
430  *          NULL if status is not GNUNET_OK
431  * @param status GNUNET_OK if the startup is successfull; GNUNET_SYSERR if not,
432  *          GNUNET_TESTBED_controller_stop() shouldn't be called in this case
433  */
434 typedef void (*GNUNET_TESTBED_ControllerStatusCallback) (void *cls,
435                                                         const struct GNUNET_CONFIGURATION_Handle *cfg,
436                                                         int status);
437
438
439 /**
440  * Starts a controller process at the host.
441  *
442  * @param controller_ip the ip address of the controller. Will be set as TRUSTED
443  *          host when starting testbed controller at host
444  * @param host the host where the controller has to be started; NULL for
445  *          localhost
446  * @param cfg template configuration to use for the remote controller; the
447  *          remote controller will be started with a slightly modified
448  *          configuration (port numbers, unix domain sockets and service home
449  *          values are changed as per TESTING library on the remote host)
450  * @param cb function called when the controller is successfully started or
451  *          dies unexpectedly; GNUNET_TESTBED_controller_stop shouldn't be
452  *          called if cb is called with GNUNET_SYSERR as status. Will never be
453  *          called in the same task as 'GNUNET_TESTBED_controller_start'
454  *          (synchronous errors will be signalled by returning NULL). This
455  *          parameter cannot be NULL.
456  * @param cls closure for above callbacks
457  * @return the controller process handle, NULL on errors
458  */
459 struct GNUNET_TESTBED_ControllerProc *
460 GNUNET_TESTBED_controller_start (const char *controller_ip,
461                                  struct GNUNET_TESTBED_Host *host,
462                                  const struct GNUNET_CONFIGURATION_Handle *cfg,
463                                  GNUNET_TESTBED_ControllerStatusCallback cb,
464                                  void *cls);
465
466
467 /**
468  * Stop the controller process (also will terminate all peers and controllers
469  * dependent on this controller).  This function blocks until the testbed has
470  * been fully terminated (!). The controller status cb from
471  * GNUNET_TESTBED_controller_start() will not be called.
472  *
473  * @param cproc the controller process handle
474  */
475 void
476 GNUNET_TESTBED_controller_stop (struct GNUNET_TESTBED_ControllerProc *cproc);
477
478
479 /**
480  * Connect to a controller process using the given configuration at the
481  * given host.
482  *
483  * @param cfg configuration to use
484  * @param host host to run the controller on; This should be the same host if
485  *          the controller was previously started with
486  *          GNUNET_TESTBED_controller_start; NULL for localhost
487  * @param host host where this controller is being run;
488  * @param event_mask bit mask with set of events to call 'cc' for;
489  *                   or-ed values of "1LL" shifted by the
490  *                   respective 'enum GNUNET_TESTBED_EventType'
491  *                   (i.e.  "(1LL << GNUNET_TESTBED_ET_CONNECT) | ...")
492  * @param cc controller callback to invoke on events
493  * @param cc_cls closure for cc
494  * @return handle to the controller
495  */
496 struct GNUNET_TESTBED_Controller *
497 GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
498                                    struct GNUNET_TESTBED_Host *host,
499                                    uint64_t event_mask,
500                                    GNUNET_TESTBED_ControllerCallback cc,
501                                    void *cc_cls);
502
503
504 /**
505  * Configure shared services at a controller.  Using this function,
506  * you can specify that certain services (such as "resolver")
507  * should not be run for each peer but instead be shared
508  * across N peers on the specified host.  This function
509  * must be called before any peers are created at the host.
510  *
511  * @param controller controller to configure
512  * @param service_name name of the service to share
513  * @param num_peers number of peers that should share one instance
514  *        of the specified service (1 for no sharing is the default),
515  *        use 0 to disable the service
516  */
517 void
518 GNUNET_TESTBED_controller_configure_sharing (struct GNUNET_TESTBED_Controller *controller,
519                                              const char *service_name,
520                                              uint32_t num_peers);
521
522
523 /**
524  * Stop the given controller (also will terminate all peers and
525  * controllers dependent on this controller).  This function
526  * blocks until the testbed has been fully terminated (!).
527  *
528  * @param controller handle to controller to stop
529  */
530 void
531 GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller *controller);
532
533
534 /**
535  * Opaque handle for host registration
536  */
537 struct GNUNET_TESTBED_HostRegistrationHandle;
538
539
540 /**
541  * Callback which will be called to after a host registration succeeded or failed
542  *
543  * @param cls the closure
544  * @param emsg the error message; NULL if host registration is successful
545  */
546 typedef void (* GNUNET_TESTBED_HostRegistrationCompletion) (void *cls,
547                                                             const char *emsg);
548
549
550 /**
551  * Register a host with the controller
552  *
553  * @param controller the controller handle
554  * @param host the host to register
555  * @param cc the completion callback to call to inform the status of
556  *          registration. After calling this callback the registration handle
557  *          will be invalid. Cannot be NULL
558  * @param cc_cls the closure for the cc
559  * @return handle to the host registration which can be used to cancel the
560  *           registration; NULL if another registration handle is present and
561  *           is not cancelled
562  */
563 struct GNUNET_TESTBED_HostRegistrationHandle *
564 GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller,
565                               struct GNUNET_TESTBED_Host *host,
566                               GNUNET_TESTBED_HostRegistrationCompletion cc,
567                               void *cc_cls);
568
569
570 /**
571  * Cancel the pending registration. Note that the registration message will
572  * already be queued to be sent to the service, cancellation has only the
573  * effect that the registration completion callback for the registration is
574  * never called and from our perspective the host is not registered until the
575  * completion callback is called.
576  *
577  * @param handle the registration handle to cancel
578  */
579 void
580 GNUNET_TESTBED_cancel_registration (struct GNUNET_TESTBED_HostRegistrationHandle
581                                     *handle);
582
583
584 /**
585  * Callback to be called when an operation is completed
586  *
587  * @param cls the callback closure from functions generating an operation
588  * @param op the operation that has been finished
589  * @param emsg error message in case the operation has failed; will be NULL if
590  *          operation has executed successfully.
591  */
592 typedef void (*GNUNET_TESTBED_OperationCompletionCallback) (void *cls,
593                                                             struct
594                                                             GNUNET_TESTBED_Operation
595                                                             *op,
596                                                             const char *emsg);
597
598
599 /**
600  * Create a link from slave controller to delegated controller. Whenever the
601  * master controller is asked to start a peer at the delegated controller the
602  * request will be routed towards slave controller (if a route exists). The
603  * slave controller will then route it to the delegated controller. The
604  * configuration of the delegated controller is given and is used to either
605  * create the delegated controller or to connect to an existing controller. Note
606  * that while starting the delegated controller the configuration will be
607  * modified to accommodate available free ports.  the 'is_subordinate' specifies
608  * if the given delegated controller should be started and managed by the slave
609  * controller, or if the delegated controller already has a master and the slave
610  * controller connects to it as a non master controller. The success or failure
611  * of this operation will be signalled through the
612  * GNUNET_TESTBED_ControllerCallback() with an event of type
613  * GNUNET_TESTBED_ET_OPERATION_FINISHED
614  *
615  * @param op_cls the operation closure for the event which is generated to
616  *          signal success or failure of this operation
617  * @param master handle to the master controller who creates the association
618  * @param delegated_host requests to which host should be delegated; cannot be NULL
619  * @param slave_host which host is used to run the slave controller; use NULL to
620  *          make the master controller connect to the delegated host
621  * @param slave_cfg configuration to use for the slave controller
622  * @param is_subordinate GNUNET_YES if the controller at delegated_host should
623  *          be started by the slave controller; GNUNET_NO if the slave
624  *          controller has to connect to the already started delegated
625  *          controller via TCP/IP
626  * @return the operation handle
627  */
628 struct GNUNET_TESTBED_Operation *
629 GNUNET_TESTBED_controller_link (void *op_cls,
630                                 struct GNUNET_TESTBED_Controller *master,
631                                 struct GNUNET_TESTBED_Host *delegated_host,
632                                 struct GNUNET_TESTBED_Host *slave_host,
633                                 const struct GNUNET_CONFIGURATION_Handle
634                                 *slave_cfg,
635                                 int is_subordinate);
636
637
638 /**
639  * Same as the GNUNET_TESTBED_controller_link, however expects configuration in
640  * serialized and compressed
641  *
642  * @param op_cls the operation closure for the event which is generated to
643  *          signal success or failure of this operation
644  * @param master handle to the master controller who creates the association
645  * @param delegated_host requests to which host should be delegated; cannot be NULL
646  * @param slave_host which host is used to run the slave controller; use NULL to
647  *          make the master controller connect to the delegated host
648  * @param sxcfg serialized and compressed configuration
649  * @param sxcfg_size the size sxcfg
650  * @param scfg_size the size of uncompressed serialized configuration
651  * @param is_subordinate GNUNET_YES if the controller at delegated_host should
652  *          be started by the slave controller; GNUNET_NO if the slave
653  *          controller has to connect to the already started delegated
654  *          controller via TCP/IP
655  * @return the operation handle
656  */
657 struct GNUNET_TESTBED_Operation *
658 GNUNET_TESTBED_controller_link_2 (void *op_cls,
659                                   struct GNUNET_TESTBED_Controller *master,
660                                   struct GNUNET_TESTBED_Host *delegated_host,
661                                   struct GNUNET_TESTBED_Host *slave_host,
662                                   const char *sxcfg,
663                                   size_t sxcfg_size,
664                                   size_t scfg_size,
665                                   int is_subordinate);
666
667
668 /**
669  * Function to acquire the configuration of a running slave controller. The
670  * completion of the operation is signalled through the controller_cb from
671  * GNUNET_TESTBED_controller_connect(). If the operation is successful the
672  * handle to the configuration is available in the generic pointer of
673  * operation_finished field of struct GNUNET_TESTBED_EventInformation.
674  *
675  * @param op_cls the closure for the operation
676  * @param master the handle to master controller
677  * @param slave_host the host where the slave controller is running; the handle
678  *          to the slave_host should remain valid until this operation is
679  *          cancelled or marked as finished
680  * @return the operation handle; NULL if the slave_host is not registered at
681  *           master
682  */
683 struct GNUNET_TESTBED_Operation *
684 GNUNET_TESTBED_get_slave_config (void *op_cls,
685                                  struct GNUNET_TESTBED_Controller *master,
686                                  struct GNUNET_TESTBED_Host *slave_host);
687
688
689 /**
690  * Functions of this signature are called when a peer has been successfully
691  * created
692  *
693  * @param cls the closure from GNUNET_TESTBED_peer_create()
694  * @param peer the handle for the created peer; NULL on any error during
695  *          creation
696  * @param emsg NULL if peer is not NULL; else MAY contain the error description
697  */
698 typedef void (*GNUNET_TESTBED_PeerCreateCallback) (void *cls,
699                                                    struct GNUNET_TESTBED_Peer *peer,
700                                                    const char *emsg);
701
702
703 /**
704  * Create the given peer at the specified host using the given
705  * controller.  If the given controller is not running on the target
706  * host, it should find or create a controller at the target host and
707  * delegate creating the peer.  Explicit delegation paths can be setup
708  * using 'GNUNET_TESTBED_controller_link'.  If no explicit delegation
709  * path exists, a direct link with a subordinate controller is setup
710  * for the first delegated peer to a particular host; the subordinate
711  * controller is then destroyed once the last peer that was delegated
712  * to the remote host is stopped.
713  *
714  * Creating the peer only creates the handle to manipulate and further
715  * configure the peer; use "GNUNET_TESTBED_peer_start" and
716  * "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's
717  * processes.
718  *
719  * Note that the given configuration will be adjusted by the
720  * controller to avoid port/path conflicts with other peers.
721  * The "final" configuration can be obtained using
722  * 'GNUNET_TESTBED_peer_get_information'.
723  *
724  * @param controller controller process to use
725  * @param host host to run the peer on; cannot be NULL
726  * @param cfg Template configuration to use for the peer. Should exist until
727  *          operation is cancelled or GNUNET_TESTBED_operation_done() is called
728  * @param cb the callback to call when the peer has been created
729  * @param cls the closure to the above callback
730  * @return the operation handle
731  */
732 struct GNUNET_TESTBED_Operation *
733 GNUNET_TESTBED_peer_create (struct GNUNET_TESTBED_Controller *controller,
734                             struct GNUNET_TESTBED_Host *host,
735                             const struct GNUNET_CONFIGURATION_Handle *cfg,
736                             GNUNET_TESTBED_PeerCreateCallback cb,
737                             void *cls);
738
739
740 /**
741  * Functions of this signature are called when a peer has been successfully
742  * started or stopped.
743  *
744  * @param cls the closure from GNUNET_TESTBED_peer_start/stop()
745  * @param emsg NULL on success; otherwise an error description
746  */
747 typedef void (*GNUNET_TESTBED_PeerChurnCallback) (void *cls,
748                                                   const char *emsg);
749
750
751 /**
752  * Start the given peer.
753  *
754  * @param op_cls the closure for this operation; will be set in
755  *          event->details.operation_finished.op_cls when this operation fails.
756  * @param peer peer to start
757  * @param pcc function to call upon completion
758  * @param pcc_cls closure for 'pcc'
759  * @return handle to the operation
760  */
761 struct GNUNET_TESTBED_Operation *
762 GNUNET_TESTBED_peer_start (void *op_cls,
763                            struct GNUNET_TESTBED_Peer *peer,
764                            GNUNET_TESTBED_PeerChurnCallback pcc,
765                            void *pcc_cls);
766
767
768 /**
769  * Stop the given peer.  The handle remains valid (use
770  * "GNUNET_TESTBED_peer_destroy" to fully clean up the
771  * state of the peer).
772  *
773  * @param peer peer to stop
774  * @param pcc function to call upon completion
775  * @param pcc_cls closure for 'pcc'
776  * @return handle to the operation
777  */
778 struct GNUNET_TESTBED_Operation *
779 GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer,
780                           GNUNET_TESTBED_PeerChurnCallback pcc,
781                           void *pcc_cls);
782
783
784 /**
785  * Data returned from GNUNET_TESTBED_peer_get_information
786  */
787 struct GNUNET_TESTBED_PeerInformation
788 {
789   /**
790    * Peer information type; captures which of the types
791    * in the 'op_result' is actually in use.
792    */
793   enum GNUNET_TESTBED_PeerInformationType pit;
794
795   /**
796    * The result of the get information operation; Choose according to the pit
797    */
798   union
799   {
800     /**
801      * The configuration of the peer
802      */
803     struct GNUNET_CONFIGURATION_Handle *cfg;
804
805     /**
806      * The identity of the peer
807      */
808     struct GNUNET_PeerIdentity *id;
809   } result;
810 };
811
812
813 /**
814  * Callback to be called when the requested peer information is available
815  *
816  * @param cb_cls the closure from GNUNET_TETSBED_peer_get_information()
817  * @param op the operation this callback corresponds to
818  * @param pinfo the result; will be NULL if the operation has failed
819  * @param emsg error message if the operation has failed; will be NULL if the
820  *          operation is successfull
821  */
822 typedef void (*GNUNET_TESTBED_PeerInfoCallback) (void *cb_cls,
823                                                  struct GNUNET_TESTBED_Operation
824                                                  *op,
825                                                  const struct
826                                                  GNUNET_TESTBED_PeerInformation
827                                                  *pinfo,
828                                                  const char *emsg);
829
830
831 /**
832  * Request information about a peer. The controller callback will not be called
833  * with event type GNUNET_TESTBED_ET_OPERATION_FINISHED when result for this
834  * operation is available. Instead, the GNUNET_TESTBED_PeerInfoCallback() will
835  * be called.
836  *
837  * @param peer peer to request information about
838  * @param pit desired information
839  * @param cb the convenience callback to be called when results for this
840  *          operation are available
841  * @param cb_cls the closure for the above callback
842  * @return handle to the operation
843  */
844 struct GNUNET_TESTBED_Operation *
845 GNUNET_TESTBED_peer_get_information (struct GNUNET_TESTBED_Peer *peer,
846                                      enum GNUNET_TESTBED_PeerInformationType
847                                      pit,
848                                      GNUNET_TESTBED_PeerInfoCallback cb,
849                                      void *cb_cls);
850
851
852 /**
853  * Change peer configuration.  Must only be called while the
854  * peer is stopped.  Ports and paths cannot be changed this
855  * way.
856  *
857  * @param peer peer to change configuration for
858  * @param cfg new configuration (differences to existing
859  *            configuration only)
860  * @return handle to the operation
861  */
862 struct GNUNET_TESTBED_Operation *
863 GNUNET_TESTBED_peer_update_configuration (struct GNUNET_TESTBED_Peer *peer,
864                                           const struct GNUNET_CONFIGURATION_Handle *cfg);
865
866
867 /**
868  * Destroy the given peer; the peer should have been
869  * stopped first (if it was started).
870  *
871  * @param peer peer to stop
872  * @return handle to the operation
873  */
874 struct GNUNET_TESTBED_Operation *
875 GNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer);
876
877
878 /**
879  * Options for peer connections.
880  */
881 enum GNUNET_TESTBED_ConnectOption
882 {
883   /**
884    * No option (not valid as an argument).
885    */
886   GNUNET_TESTBED_CO_NONE = 0,
887
888   /**
889    * Allow or disallow a connection between the specified peers.
890    * Followed by GNUNET_NO (int) if a connection is disallowed
891    * or GNUNET_YES if a connection is allowed.  Note that the
892    * default (all connections allowed or disallowed) is
893    * specified in the configuration of the controller.
894    */
895   GNUNET_TESTBED_CO_ALLOW = 1,
896
897   /**
898    * FIXME: add (and implement) options to limit connection to
899    * particular transports, force simulation of particular latencies
900    * or message loss rates, or set bandwidth limitations.
901    */
902
903 };
904
905
906 /**
907  * Manipulate the P2P underlay topology by configuring a link
908  * between two peers.
909  *
910  * @param op_cls closure argument to give with the operation event
911  * @param p1 first peer
912  * @param p2 second peer
913  * @param co option to change
914  * @param ap option-specific values
915  * @return handle to the operation, NULL if configuring the link at this
916  *         time is not allowed
917  */
918 struct GNUNET_TESTBED_Operation *
919 GNUNET_TESTBED_underlay_configure_link_va (void *op_cls,
920                                            struct GNUNET_TESTBED_Peer *p1,
921                                            struct GNUNET_TESTBED_Peer *p2,
922                                            enum GNUNET_TESTBED_ConnectOption co,
923                                            va_list ap);
924
925
926 /**
927  * Manipulate the P2P underlay topology by configuring a link
928  * between two peers.
929  *
930  * @param op_cls closure argument to give with the operation event
931  * @param p1 first peer
932  * @param p2 second peer
933  * @param co option to change
934  * @param ... option-specific values
935  * @return handle to the operation, NULL if configuring the link at this
936  *         time is not allowed
937  */
938 struct GNUNET_TESTBED_Operation *
939 GNUNET_TESTBED_underlay_configure_link (void *op_cls,
940                                         struct GNUNET_TESTBED_Peer *p1,
941                                         struct GNUNET_TESTBED_Peer *p2,
942                                         enum GNUNET_TESTBED_ConnectOption co, ...);
943
944
945
946 /**
947  * Topologies and topology options supported for testbeds. Options should always
948  * end with GNUNET_TESTBED_TOPOLOGY_OPTION_END
949  */
950 enum GNUNET_TESTBED_TopologyOption
951 {
952   /**
953    * A clique (everyone connected to everyone else).  No options. If there are N
954    * peers this topology results in (N * (N -1)) connections.
955    */
956   GNUNET_TESTBED_TOPOLOGY_CLIQUE,
957
958   /**
959    * Small-world network (2d torus plus random links).  Followed
960    * by the number of random links to add (unsigned int).
961    */
962   GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD,
963
964   /**
965    * Small-world network (ring plus random links).  Followed
966    * by the number of random links to add (unsigned int).
967    */
968   GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING,
969
970   /**
971    * Ring topology.  No options.
972    */
973   GNUNET_TESTBED_TOPOLOGY_RING,
974
975   /**
976    * 2-d torus.  No options.
977    */
978   GNUNET_TESTBED_TOPOLOGY_2D_TORUS,
979
980   /**
981    * Random graph.  Followed by the number of random links to be established
982    * (unsigned int)
983    */
984   GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI,
985
986   /**
987    * Certain percentage of peers are unable to communicate directly
988    * replicating NAT conditions.  Followed by the fraction of
989    * NAT'ed peers (float).
990    */
991   GNUNET_TESTBED_TOPOLOGY_INTERNAT,
992
993   /**
994    * Scale free topology. No options.
995    */
996   GNUNET_TESTBED_TOPOLOGY_SCALE_FREE,
997
998   /**
999    * Straight line topology.  No options.
1000    */
1001   GNUNET_TESTBED_TOPOLOGY_LINE,
1002
1003   /**
1004    * Read a topology from a given file.  Followed by the name of the file (const char *).
1005    */
1006   GNUNET_TESTBED_TOPOLOGY_FROM_FILE,
1007
1008   /**
1009    * All peers are disconnected.  No options.
1010    */
1011   GNUNET_TESTBED_TOPOLOGY_NONE,
1012
1013   /**
1014    * The options should always end with this
1015    */
1016   GNUNET_TESTBED_TOPOLOGY_OPTION_END,
1017
1018   /* The following are not topologies but influence how the topology has to be
1019      setup. These options should follow the topology specific options (if
1020      required by the chosen topology). Note that these should be given before
1021      GNUNET_TESTBED_TOPOLOGY_OPTION_END */
1022
1023   /**
1024    * Disable automatic retrying for failed overlay connections. The default is
1025    * to always retry failed overlay connections. This parameter takes no options.
1026    */
1027   GNUNET_TESTBED_TOPOLOGY_DISABLE_AUTO_RETRY
1028 };
1029
1030
1031 /**
1032  * Configure overall network topology to have a particular shape.
1033  *
1034  * @param op_cls closure argument to give with the operation event
1035  * @param num_peers number of peers in 'peers'
1036  * @param peers array of 'num_peers' with the peers to configure
1037  * @param topo desired underlay topology to use
1038  * @param ap topology-specific options
1039  * @return handle to the operation, NULL if configuring the topology
1040  *         is not allowed at this time
1041  */
1042 struct GNUNET_TESTBED_Operation *
1043 GNUNET_TESTBED_underlay_configure_topology_va (void *op_cls,
1044                                                unsigned int num_peers,
1045                                                struct GNUNET_TESTBED_Peer **peers,
1046                                                enum GNUNET_TESTBED_TopologyOption topo,
1047                                                va_list ap);
1048
1049
1050 /**
1051  * Configure overall network topology to have a particular shape.
1052  *
1053  * @param op_cls closure argument to give with the operation event
1054  * @param num_peers number of peers in 'peers'
1055  * @param peers array of 'num_peers' with the peers to configure
1056  * @param topo desired underlay topology to use
1057  * @param ... topology-specific options
1058  * @return handle to the operation, NULL if configuring the topology
1059  *         is not allowed at this time
1060  */
1061 struct GNUNET_TESTBED_Operation *
1062 GNUNET_TESTBED_underlay_configure_topology (void *op_cls,
1063                                             unsigned int num_peers,
1064                                             struct GNUNET_TESTBED_Peer **peers,
1065                                             enum GNUNET_TESTBED_TopologyOption topo,
1066                                             ...);
1067
1068
1069 /**
1070  * Both peers must have been started before calling this function.
1071  * This function then obtains a HELLO from 'p1', gives it to 'p2'
1072  * and asks 'p2' to connect to 'p1'.
1073  *
1074  * @param op_cls closure argument to give with the operation event
1075  * @param cb the callback to call when this operation has finished
1076  * @param cb_cls the closure for the above callback
1077  * @param p1 first peer
1078  * @param p2 second peer
1079  * @return handle to the operation, NULL if connecting these two
1080  *         peers is fundamentally not possible at this time (peers
1081  *         not running or underlay disallows)
1082  */
1083 struct GNUNET_TESTBED_Operation *
1084 GNUNET_TESTBED_overlay_connect (void *op_cls,
1085                                 GNUNET_TESTBED_OperationCompletionCallback cb,
1086                                 void *cb_cls,
1087                                 struct GNUNET_TESTBED_Peer *p1,
1088                                 struct GNUNET_TESTBED_Peer *p2);
1089
1090
1091 /**
1092  * All peers must have been started before calling this function.
1093  * This function then connects the given peers in the P2P overlay
1094  * using the given topology.
1095  *
1096  * @param op_cls closure argument to give with the operation event
1097  * @param num_peers number of peers in 'peers'
1098  * @param peers array of 'num_peers' with the peers to configure
1099  * @param max_connections the maximums number of overlay connections that will
1100  *          be made to achieve the given topology
1101  * @param topo desired underlay topology to use
1102  * @param va topology-specific options
1103  * @return handle to the operation, NULL if connecting these
1104  *         peers is fundamentally not possible at this time (peers
1105  *         not running or underlay disallows) or if num_peers is less than 2
1106  */
1107 struct GNUNET_TESTBED_Operation *
1108 GNUNET_TESTBED_overlay_configure_topology_va (void *op_cls,
1109                                               unsigned int num_peers,
1110                                               struct GNUNET_TESTBED_Peer **peers,
1111                                               unsigned int *max_connections,
1112                                               enum GNUNET_TESTBED_TopologyOption topo,
1113                                               va_list va);
1114
1115
1116 /**
1117  * All peers must have been started before calling this function.
1118  * This function then connects the given peers in the P2P overlay
1119  * using the given topology.
1120  *
1121  * @param op_cls closure argument to give with the operation event
1122  * @param num_peers number of peers in 'peers'
1123  * @param peers array of 'num_peers' with the peers to configure
1124  * @param max_connections the maximums number of overlay connections that will
1125  *          be made to achieve the given topology
1126  * @param topo desired underlay topology to use
1127  * @param ... topology-specific options
1128  * @return handle to the operation, NULL if connecting these
1129  *         peers is fundamentally not possible at this time (peers
1130  *         not running or underlay disallows) or if num_peers is less than 2
1131  */
1132 struct GNUNET_TESTBED_Operation *
1133 GNUNET_TESTBED_overlay_configure_topology (void *op_cls,
1134                                            unsigned int num_peers,
1135                                            struct GNUNET_TESTBED_Peer **peers,
1136                                            unsigned int *max_connections,
1137                                            enum GNUNET_TESTBED_TopologyOption topo,
1138                                            ...);
1139
1140
1141 /**
1142  * Ask the testbed controller to write the current overlay topology to
1143  * a file.  Naturally, the file will only contain a snapshot as the
1144  * topology may evolve all the time.
1145  * FIXME: needs continuation!?
1146  *
1147  * @param controller overlay controller to inspect
1148  * @param filename name of the file the topology should
1149  *        be written to.
1150  */
1151 void
1152 GNUNET_TESTBED_overlay_write_topology_to_file (struct GNUNET_TESTBED_Controller *controller,
1153                                                const char *filename);
1154
1155
1156 /**
1157  * Adapter function called to establish a connection to
1158  * a service.
1159  *
1160  * @param cls closure
1161  * @param cfg configuration of the peer to connect to; will be available until
1162  *          GNUNET_TESTBED_operation_done() is called on the operation returned
1163  *          from GNUNET_TESTBED_service_connect()
1164  * @return service handle to return in 'op_result', NULL on error
1165  */
1166 typedef void * (*GNUNET_TESTBED_ConnectAdapter)(void *cls,
1167                                                 const struct GNUNET_CONFIGURATION_Handle *cfg);
1168
1169
1170 /**
1171  * Adapter function called to destroy a connection to
1172  * a service.
1173  *
1174  * @param cls closure
1175  * @param op_result service handle returned from the connect adapter
1176  */
1177 typedef void (*GNUNET_TESTBED_DisconnectAdapter)(void *cls,
1178                                                  void *op_result);
1179
1180
1181 /**
1182  * Callback to be called when a service connect operation is completed
1183  *
1184  * @param cls the callback closure from functions generating an operation
1185  * @param op the operation that has been finished
1186  * @param ca_result the service handle returned from GNUNET_TESTBED_ConnectAdapter()
1187  * @param emsg error message in case the operation has failed; will be NULL if
1188  *          operation has executed successfully.
1189  */
1190 typedef void (*GNUNET_TESTBED_ServiceConnectCompletionCallback) (void *cls,
1191                                                                  struct
1192                                                                  GNUNET_TESTBED_Operation
1193                                                                  *op,
1194                                                                  void
1195                                                                  *ca_result,
1196                                                                  const char
1197                                                                  *emsg );
1198
1199
1200 /**
1201  * Connect to a service offered by the given peer.  Will ensure that
1202  * the request is queued to not overwhelm our ability to create and
1203  * maintain connections with other systems.  The actual service
1204  * handle is then returned via the 'op_result' member in the event
1205  * callback.  The 'ca' callback is used to create the connection
1206  * when the time is right; the 'da' callback will be used to
1207  * destroy the connection (upon 'GNUNET_TESTBED_operation_done').
1208  * 'GNUNET_TESTBED_operation_cancel' can be used to abort this
1209  * operation until the event callback has been called.
1210  *
1211  * @param op_cls closure to pass in operation event
1212  * @param peer peer that runs the service
1213  * @param service_name name of the service to connect to
1214  * @param cb the callback to call when this operation finishes
1215  * @param cb_cls closure for the above callback
1216  * @param ca helper function to establish the connection
1217  * @param da helper function to close the connection
1218  * @param cada_cls closure for ca and da
1219  * @return handle for the operation
1220  */
1221 struct GNUNET_TESTBED_Operation *
1222 GNUNET_TESTBED_service_connect (void *op_cls,
1223                                 struct GNUNET_TESTBED_Peer *peer,
1224                                 const char *service_name,
1225                                 GNUNET_TESTBED_ServiceConnectCompletionCallback cb,
1226                                 void *cb_cls,
1227                                 GNUNET_TESTBED_ConnectAdapter ca,
1228                                 GNUNET_TESTBED_DisconnectAdapter da,
1229                                 void *cada_cls);
1230
1231
1232 /**
1233  * This function is used to signal that the event information (struct
1234  * GNUNET_TESTBED_EventInformation) from an operation has been fully processed
1235  * i.e. if the event callback is ever called for this operation. If the event
1236  * callback for this operation has not yet been called, calling this function
1237  * cancels the operation, frees its resources and ensures the no event is
1238  * generated with respect to this operation. Note that however cancelling an
1239  * operation does NOT guarantee that the operation will be fully undone (or that
1240  * nothing ever happened). 
1241  *
1242  * This function MUST be called for every operation to fully remove the
1243  * operation from the operation queue.  After calling this function, if
1244  * operation is completed and its event information is of type
1245  * GNUNET_TESTBED_ET_OPERATION_FINISHED, the 'op_result' becomes invalid (!).
1246
1247  * If the operation is generated from GNUNET_TESTBED_service_connect() then
1248  * calling this function on such as operation calls the disconnect adapter if
1249  * the connect adapter was ever called.
1250  *
1251  * @param operation operation to signal completion or cancellation
1252  */
1253 void
1254 GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation);
1255
1256
1257 /**
1258  * Callback function to process statistic values from all peers.
1259  *
1260  * @param cls closure
1261  * @param peer the peer the statistic belong to
1262  * @param subsystem name of subsystem that created the statistic
1263  * @param name the name of the datum
1264  * @param value the current value
1265  * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
1266  * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
1267  */
1268 typedef int (*GNUNET_TESTBED_StatisticsIterator) (void *cls,
1269                                                   const struct GNUNET_TESTBED_Peer *peer,
1270                                                   const char *subsystem,
1271                                                   const char *name,
1272                                                   uint64_t value,
1273                                                   int is_persistent);
1274
1275
1276 /**
1277  * Convenience method that iterates over all (running) peers
1278  * and retrieves all statistics from each peer.
1279  *
1280  * @param num_peers number of peers to iterate over
1281  * @param peers array of peers to iterate over
1282  * @param proc processing function for each statistic retrieved
1283  * @param cont continuation to call once call is completed(?)
1284  * @param cls closure to pass to proc and cont
1285  * @return operation handle to cancel the operation
1286  */
1287 struct GNUNET_TESTBED_Operation *
1288 GNUNET_TESTBED_get_statistics (unsigned int num_peers,
1289                                struct GNUNET_TESTBED_Peer **peers,
1290                                GNUNET_TESTBED_StatisticsIterator proc,
1291                                GNUNET_TESTBED_OperationCompletionCallback cont,
1292                                void *cls);
1293
1294
1295 /**
1296  * Signature of a main function for a testcase.
1297  *
1298  * @param cls closure
1299  * @param num_peers number of peers in 'peers'
1300  * @param peers handle to peers run in the testbed
1301  */
1302 typedef void (*GNUNET_TESTBED_TestMaster)(void *cls,
1303                                           unsigned int num_peers,
1304                                           struct GNUNET_TESTBED_Peer **peers);
1305
1306
1307 /**
1308  * Convenience method for running a testbed with
1309  * a single call.  Underlay and overlay topology
1310  * are configured using the "UNDERLAY" and "OVERLAY"
1311  * options in the "[testbed]" section of the configuration\
1312  * (with possible options given in "UNDERLAY_XXX" and/or
1313  * "OVERLAY_XXX").
1314  *
1315  * The testbed is to be terminated using a call to
1316  * "GNUNET_SCHEDULER_shutdown".
1317  *
1318  * @param host_filename name of the file with the 'hosts', NULL
1319  *        to run everything on 'localhost'
1320  * @param cfg configuration to use (for testbed, controller and peers)
1321  * @param num_peers number of peers to start; FIXME: maybe put that ALSO into
1322  *        cfg?; should be greater than 0
1323  * @param event_mask bit mask with set of events to call 'cc' for;
1324  *                   or-ed values of "1LL" shifted by the
1325  *                   respective 'enum GNUNET_TESTBED_EventType'
1326  *                   (i.e.  "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
1327  * @param cc controller callback to invoke on events; This callback is called
1328  *        for all peer start events even if GNUNET_TESTBED_ET_PEER_START isn't
1329  *        set in the event_mask as this is the only way get access to the
1330  *        handle of each peer
1331  * @param cc_cls closure for cc
1332  * @param test_master this callback will be called once the test is ready
1333  * @param test_master_cls closure for 'test_master'.
1334  */
1335 void
1336 GNUNET_TESTBED_run (const char *host_filename,
1337                     const struct GNUNET_CONFIGURATION_Handle *cfg,
1338                     unsigned int num_peers,
1339                     uint64_t event_mask,
1340                     GNUNET_TESTBED_ControllerCallback cc,
1341                     void *cc_cls,
1342                     GNUNET_TESTBED_TestMaster test_master,
1343                     void *test_master_cls);
1344
1345
1346 /**
1347  * Convenience method for running a "simple" test on the local system
1348  * with a single call from 'main'.  Underlay and overlay topology are
1349  * configured using the "UNDERLAY" and "OVERLAY" options in the
1350  * "[testbed]" section of the configuration (with possible options
1351  * given in "UNDERLAY_XXX" and/or "OVERLAY_XXX").
1352  *
1353  * The test is to be terminated using a call to
1354  * "GNUNET_SCHEDULER_shutdown".  If starting the test fails,
1355  * the program is stopped without 'master' ever being run.
1356  *
1357  * NOTE: this function should be called from 'main', NOT from
1358  * within a GNUNET_SCHEDULER-loop.  This function will initialze
1359  * the scheduler loop, the testbed and then pass control to
1360  * 'master'.
1361  *
1362  * @param testname name of the testcase (to configure logging, etc.)
1363  * @param cfg_filename configuration filename to use
1364  *              (for testbed, controller and peers)
1365  * @param num_peers number of peers to start; should be greter than 0
1366  * @param event_mask bit mask with set of events to call 'cc' for;
1367  *                   or-ed values of "1LL" shifted by the
1368  *                   respective 'enum GNUNET_TESTBED_EventType'
1369  *                   (i.e.  "(1LL << GNUNET_TESTBED_ET_CONNECT) || ...")
1370  * @param cc controller callback to invoke on events; This callback is called
1371  *        for all peer start events even if GNUNET_TESTBED_ET_PEER_START isn't
1372  *        set in the event_mask as this is the only way get access to the
1373  *        handle of each peer
1374  * @param cc_cls closure for cc
1375  * @param test_master this callback will be called once the test is ready
1376  * @param test_master_cls closure for 'test_master'.
1377  * @param GNUNET_SYSERR on error, GNUNET_OK on success
1378  */
1379 int
1380 GNUNET_TESTBED_test_run (const char *testname,
1381                          const char *cfg_filename,
1382                          unsigned int num_peers,
1383                          uint64_t event_mask,
1384                          GNUNET_TESTBED_ControllerCallback cc,
1385                          void *cc_cls,
1386                          GNUNET_TESTBED_TestMaster test_master,
1387                          void *test_master_cls);
1388
1389
1390 #if 0                           /* keep Emacsens' auto-indent happy */
1391 {
1392 #endif
1393
1394
1395 #ifdef __cplusplus
1396 }
1397 #endif
1398
1399 #endif