2 This file is part of GNUnet
3 (C) 2008, 2009, 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 include/gnunet_testing_service.h
23 * @brief API for writing tests and creating large-scale
24 * emulation testbeds for GNUnet.
25 * @author Christian Grothoff
28 #ifndef GNUNET_TESTING_LIB_H
29 #define GNUNET_TESTING_LIB_H
31 #include "gnunet_util_lib.h"
32 #include "gnunet_statistics_service.h"
37 #if 0 /* keep Emacsens' auto-indent happy */
44 * Opaque handle to a host running experiments managed by the testing framework.
45 * The master process must be able to SSH to this host without password (via
48 struct GNUNET_TESTING_Host;
51 * Opaque handle to a peer controlled by the testing framework. A peer runs
52 * at a particular host.
54 struct GNUNET_TESTING_Peer;
57 * Opaque handle to an abstract operation to be executed by the testing framework.
59 struct GNUNET_TESTING_Operation;
62 * Handle to interact with a GNUnet testing controller. Each controller has at
63 * least one master handle which is created when the controller is created; this
64 * master handle interacts with the controller via stdin/stdout of the controller
65 * process. Additionally, controllers can interact with each other (in a P2P
66 * fashion); those links are established via TCP/IP on the controller's service
69 struct GNUNET_TESTING_Controller;
72 * Handle to a large-scale testbed that is managed at a high level.
74 struct GNUNET_TESTING_Testbed;
78 * Create a host to run peers and controllers on.
80 * @param hostname name of the host, use "NULL" for localhost
81 * @param username username to use for the login; may be NULL
82 * @param port port number to use for ssh; use 0 to let ssh decide
83 * @return handle to the host, NULL on error
85 struct GNUNET_TESTING_Host *
86 GNUNET_TESTING_host_create (const char *hostname,
92 * Load a set of hosts from a configuration file.
94 * @param filename file with the host specification
95 * @param hosts set to the hosts found in the file
96 * @return number of hosts returned in 'hosts', 0 on error
99 GNUNET_TESTING_hosts_load_from_file (const char *filename,
100 struct GNUNET_TESTING_Host **hosts);
104 * Configure shared services at a peer. Using this function,
105 * you can specify that certain services (such as "resolver")
106 * should not be run for each peer but instead be shared
107 * across N peers on the specified host. This function
108 * must be called before any peers are created at the host.
110 * @param host host to configure
111 * @param service_name name of the service to share
112 * @param num_peers number of peers that should share one instance
113 * of the specified service (1 for no sharing is the default),
114 * use 0 to disable the service
117 GNUNET_TESTING_host_configure (struct GNUNET_TESTING_Host *host,
118 const char *service_name,
123 * Destroy a host handle. Must only be called once everything
124 * running on that host has been stopped.
126 * @param host handle to destroy
129 GNUNET_TESTING_host_destroy (struct GNUNET_TESTING_Host *host);
133 * Enumeration with (at most 64) possible event types that
134 * can be monitored using the testing framework.
136 enum GNUNET_TESTING_EventType
139 * A peer has been started.
141 GNUNET_TESTING_ET_PEER_START = 0,
144 * A peer has been stopped.
146 GNUNET_TESTING_ET_PEER_STOP = 1,
149 * A connection between two peers was established.
151 GNUNET_TESTING_ET_CONNECT = 2,
154 * A connection between two peers was torn down.
156 GNUNET_TESTING_ET_DISCONNECT = 3
159 * A requested testing operation has been completed.
161 GNUNET_TESTING_ET_OPERATION_FINISHED = 4,
164 * The 'GNUNET_TESTING_run' operation has been completed
166 GNUNET_TESTING_ET_TESTBED_ONLINE = 5
172 * Argument to GNUNET_TESTING_ControllerCallback with details about
175 struct GNUNET_TESTING_EventInformation
181 enum GNUNET_TESTING_EventType type;
184 * Details about the event.
190 * Details about peer start event.
195 * Handle for the peer that was started.
197 struct GNUNET_TESTING_Peer *peer;
202 * Details about peer stop event.
207 * Handle for the host where the peer
210 struct GNUNET_TESTING_Host *host;
213 * Handle for the peer that was started.
215 struct GNUNET_TESTING_Peer *peer;
220 * Details about connect event.
225 * Handle for one of the connected peers.
227 struct GNUNET_TESTING_Peer *peer1;
230 * Handle for one of the connected peers.
232 struct GNUNET_TESTING_Peer *peer2;
237 * Details about disconnect event.
242 * Handle for one of the disconnected peers.
244 struct GNUNET_TESTING_Peer *peer1;
247 * Handle for one of the disconnected peers.
249 struct GNUNET_TESTING_Peer *peer2;
254 * Details about an operation finished event.
260 * Handle for the operation that was finished.
262 struct GNUNET_TESTING_Operation *operation;
265 * Closure that was passed in when the event was
271 * Error message for the operation, NULL on success.
276 * Pointer to an operation-specific return value; NULL on error;
277 * can be NULL for certain operations. Valid until
278 * 'GNUNET_TESTNG_operation_done' is called.
282 } operation_finished;
286 * Details about an testbed run completed event.
292 * Error message for the operation, NULL on success.
297 * Array of peers now running (valid until
298 * 'GNUNET_TESTING_testbed_stop' is called). Note that it is
299 * not allowed to call 'GNUNET_TESTING_peer_destroy' on peers
302 struct GNUNET_TESTING_Peer **peers;
305 * Size of the 'peers' array.
307 unsigned int num_peers;
309 } testbed_run_finished;
317 * Signature of the event handler function called by the
318 * respective event controller.
321 * @param event information about the event
323 typedef void (*GNUNET_TESTING_ControllerCallback)(void *cls,
324 const struct GNUNET_TESTING_EventInformation *event);
328 * Start a controller process using the given configuration at the
331 * @param cfg configuration to use
332 * @param host host to run the controller on, NULL for 'localhost'
333 * @param event_mask bit mask with set of events to call 'cc' for;
334 * or-ed values of "1LL" shifted by the
335 * respective 'enum GNUNET_TESTING_EventType'
336 * (i.e. "(1LL << GNUNET_TESTING_ET_CONNECT) || ...")
337 * @param cc controller callback to invoke on events
338 * @param cc_cls closure for cc
339 * @return handle to the controller
341 struct GNUNET_TESTING_Controller *
342 GNUNET_TESTING_controller_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
343 struct GNUNET_TESTING_Host *host,
345 GNUNET_TESTING_ControllerCallback cc,
351 * Stop the given controller (also will terminate all peers and
352 * controllers dependent on this controller). This function
353 * blocks until the testbed has been fully terminated (!).
355 * @param controller handle to controller to stop
358 GNUNET_TESTING_controller_stop (struct GNUNET_TESTING_Controller *controller);
362 * Create a link from a 'master' controller to a slave controller.
363 * Whenever the master controller is asked to start a peer at the
364 * given 'delegated_host', it will delegate the request to the
365 * specified slave controller. Note that the slave controller runs at
366 * the 'slave_host', which may or may not be the same host as the
367 * 'delegated_host' (for hierarchical delegations). The configuration
368 * of the slave controller is given and to be used to either create
369 * the slave controller or to connect to an existing slave controller
370 * process. 'is_subordinate' specifies if the given slave controller
371 * should be started and managed by the master controller, or if the
372 * slave already has a master and this is just a secondary master that
373 * is also allowed to use the existing slave.
375 * @param master handle to the master controller who creates the association
376 * @param delegated_host requests to which host should be delegated
377 * @param slave_host which host is used to run the slave controller
378 * @param slave_cfg configuration to use for the slave controller
379 * @param is_subordinate GNUNET_YES if the slave should be started (and stopped)
380 * by the master controller; GNUNET_NO if we are just
381 * allowed to use the slave via TCP/IP
384 GNUNET_TESTING_controller_link (struct GNUNET_TESTING_Controller *master,
385 struct GNUNET_TESTING_Host *delegated_host,
386 struct GNUNET_TESTING_Host *slave_host,
387 const struct GNUNET_CONFIGURATION_Handle *slave_cfg,
392 * Create the given peer at the specified host using the given
393 * controller. If the given controller is not running on the target
394 * host, it should find or create a controller at the target host and
395 * delegate creating the peer. Explicit delegation paths can be setup
396 * using 'GNUNET_TESTING_controller_link'. If no explicit delegation
397 * path exists, a direct link with a subordinate controller is setup
398 * for the first delegated peer to a particular host; the subordinate
399 * controller is then destroyed once the last peer that was delegated
400 * to the remote host is stopped.
402 * Creating the peer only creates the handle to manipulate and further
403 * configure the peer; use "GNUNET_TESTING_peer_start" and
404 * "GNUNET_TESTING_peer_stop" to actually start/stop the peer's
407 * Note that the given configuration will be adjusted by the
408 * controller to avoid port/path conflicts with other peers.
409 * The "final" configuration can be obtained using
410 * 'GNUNET_TESTING_peer_get_information'.
412 * @param controller controller process to use
413 * @param host host to run the peer on
414 * @param cfg configuration to use for the peer
415 * @return handle to the peer (actual startup will happen asynchronously)
417 struct GNUNET_TESTING_Peer *
418 GNUNET_TESTING_peer_create (struct GNUNET_TESTING_Controller *controller,
419 struct GNUNET_TESTING_Host *host,
420 const struct GNUNET_CONFIGURATION_Handle *cfg);
424 * Start the given peer.
426 * @param peer peer to start
427 * @return handle to the operation
429 struct GNUNET_TESTING_Operation *
430 GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer);
434 * Stop the given peer. The handle remains valid (use
435 * "GNUNET_TESTING_peer_destroy" to fully clean up the
436 * state of the peer).
438 * @param peer peer to stop
439 * @return handle to the operation
441 struct GNUNET_TESTING_Operation *
442 GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer);
446 * Types of information that can be requested about a peer.
448 enum GNUNET_TESTING_PeerInformationType
452 * What host is the peer running on? Returns a 'const struct
453 * GNUNET_TESTING_Host *'. Valid until
454 * 'GNUNET_TESTNIG_operation_done' is called.
456 GNUNET_TESTING_PIT_HOST,
459 * What configuration is the peer using? Returns a 'const struct
460 * GNUNET_CONFIGURATION_Handle *'. Valid until
461 * 'GNUNET_TESTNIG_operation_done' is called. However, the
462 * values may be inaccurate if the peer is reconfigured in
465 GNUNET_TESTING_PIT_CONFIGURATION,
468 * What is the identity of the peer? Returns a
469 * 'const struct GNUNET_PeerIdentity *'. Valid until
470 * 'GNUNET_TESTNIG_operation_done' is called.
472 GNUNET_TESTING_PIT_IDENTITY
478 * Request information about a peer.
480 * @param peer peer to request information about
481 * @param pit desired information
482 * @return handle to the operation
484 struct GNUNET_TESTING_Operation *
485 GNUNET_TESTING_peer_get_information (struct GNUNET_TESTING_Peer *peer,
486 enum GNUNET_TESTING_PeerInformationType pit);
490 * Change peer configuration. Must only be called while the
491 * peer is stopped. Ports and paths cannot be changed this
494 * @param peer peer to change configuration for
495 * @param cfg new configuration (differences to existing
496 * configuration only)
497 * @return handle to the operation
499 struct GNUNET_TESTING_Operation *
500 GNUNET_TESTING_peer_update_configuration (struct GNUNET_TESTING_Peer *peer,
501 const struct GNUNET_CONFIGURATION_Handle *handle);
505 * Destroy the given peer; the peer should have been
506 * stopped first (if it was started).
508 * @param peer peer to stop
509 * @return handle to the operation
511 struct GNUNET_TESTING_Operation *
512 GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer);
516 * Options for peer connections.
518 enum GNUNET_TESTING_ConnectOption
521 * No option (not valid as an argument).
523 GNUNET_TESTING_CO_NONE = 0,
526 * Allow or disallow a connection between the specified peers.
527 * Followed by GNUNET_NO (int) if a connection is disallowed
528 * or GNUNET_YES if a connection is allowed. Note that the
529 * default (all connections allowed or disallowed) is
530 * specified in the configuration of the controller.
532 GNUNET_TESTING_CO_ALLOW = 1,
535 * FIXME: add (and implement) options to limit connection to
536 * particular transports, force simulation of particular latencies
537 * or message loss rates, or set bandwidth limitations.
544 * Manipulate the P2P underlay topology by configuring a link
547 * @param op_cls closure argument to give with the operation event
548 * @param p1 first peer
549 * @param p2 second peer
550 * @param co option to change
551 * @param ... option-specific values
552 * @return handle to the operation, NULL if configuring the link at this
553 * time is not allowed
555 struct GNUNET_TESTING_Operation *
556 GNUNET_TESTING_underlay_configure_link (void *op_cls,
557 struct GNUNET_TESTING_Peer *p1,
558 struct GNUNET_TESTING_Peer *p2,
559 enum GNUNET_TESTING_ConnectOption co, ...);
564 * Topologies supported for testbeds.
566 enum GNUNET_TESTING_Topology
569 * A clique (everyone connected to everyone else). No options.
571 GNUNET_TESTING_TOPOLOGY_CLIQUE,
574 * Small-world network (2d torus plus random links). Followed
575 * by the number of random links to add (unsigned int).
577 GNUNET_TESTING_TOPOLOGY_SMALL_WORLD,
580 * Small-world network (ring plus random links). Followed
581 * by the number of random links to add (unsigned int).
583 GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING,
586 * Ring topology. No options.
588 GNUNET_TESTING_TOPOLOGY_RING,
591 * 2-d torus. No options.
593 GNUNET_TESTING_TOPOLOGY_2D_TORUS,
596 * Random graph. Followed by the link density, that is the
597 * percentage of links present in relation to a clique
600 GNUNET_TESTING_TOPOLOGY_ERDOS_RENYI,
603 * Certain percentage of peers are unable to communicate directly
604 * replicating NAT conditions. Followed by the fraction of
605 * NAT'ed peers (float).
607 GNUNET_TESTING_TOPOLOGY_INTERNAT,
610 * Scale free topology. FIXME: options?
612 GNUNET_TESTING_TOPOLOGY_SCALE_FREE,
615 * Straight line topology. No options.
617 GNUNET_TESTING_TOPOLOGY_LINE,
620 * All peers are disconnected. No options.
622 GNUNET_TESTING_TOPOLOGY_NONE,
625 * Read a topology from a given file. Followed by the name of the file (const char *).
627 GNUNET_TESTING_TOPOLOGY_FROM_FILE
632 * Configure overall network topology to have a particular shape.
634 * @param op_cls closure argument to give with the operation event
635 * @param num_peers number of peers in 'peers'
636 * @param peers array of 'num_peers' with the peers to configure
637 * @param topo desired underlay topology to use
638 * @param ap topology-specific options
639 * @return handle to the operation, NULL if configuring the topology
640 * is not allowed at this time
642 struct GNUNET_TESTING_Operation *
643 GNUNET_TESTING_underlay_configure_topology_va (void *op_cls,
644 unsigned int num_peers,
645 struct GNUNET_TESTING_Peer **peers,
646 enum GNUNET_TESTING_TopologyOption topo,
651 * Configure overall network topology to have a particular shape.
653 * @param op_cls closure argument to give with the operation event
654 * @param num_peers number of peers in 'peers'
655 * @param peers array of 'num_peers' with the peers to configure
656 * @param topo desired underlay topology to use
657 * @param ... topology-specific options
658 * @return handle to the operation, NULL if configuring the topology
659 * is not allowed at this time
661 struct GNUNET_TESTING_Operation *
662 GNUNET_TESTING_underlay_configure_topology (void *op_cls,
663 unsigned int num_peers,
664 struct GNUNET_TESTING_Peer **peers,
665 enum GNUNET_TESTING_TopologyOption topo,
670 * Both peers must have been started before calling this function.
671 * This function then obtains a HELLO from 'p1', gives it to 'p2'
672 * and asks 'p2' to connect to 'p1'.
674 * @param op_cls closure argument to give with the operation event
675 * @param p1 first peer
676 * @param p2 second peer
677 * @return handle to the operation, NULL if connecting these two
678 * peers is fundamentally not possible at this time (peers
679 * not running or underlay disallows)
681 struct GNUNET_TESTING_Operation *
682 GNUNET_TESTING_overlay_connect (void *op_cls,
683 struct GNUNET_TESTING_Peer *p1,
684 struct GNUNET_TESTING_Peer *p2);
688 * All peers must have been started before calling this function.
689 * This function then connects the given peers in the P2P overlay
690 * using the given topology.
692 * @param op_cls closure argument to give with the operation event
693 * @param num_peers number of peers in 'peers'
694 * @param peers array of 'num_peers' with the peers to configure
695 * @param topo desired underlay topology to use
696 * @param va topology-specific options
697 * @return handle to the operation, NULL if connecting these
698 * peers is fundamentally not possible at this time (peers
699 * not running or underlay disallows)
701 struct GNUNET_TESTING_Operation *
702 GNUNET_TESTING_overlay_configure_topology_va (void *op_cls,
703 unsigned int num_peers,
704 struct GNUNET_TESTING_Peer *peers,
705 enum GNUNET_TESTING_TopologyOption topo,
710 * All peers must have been started before calling this function.
711 * This function then connects the given peers in the P2P overlay
712 * using the given topology.
714 * @param op_cls closure argument to give with the operation event
715 * @param num_peers number of peers in 'peers'
716 * @param peers array of 'num_peers' with the peers to configure
717 * @param topo desired underlay topology to use
718 * @param ... topology-specific options
719 * @return handle to the operation, NULL if connecting these
720 * peers is fundamentally not possible at this time (peers
721 * not running or underlay disallows)
723 struct GNUNET_TESTING_Operation *
724 GNUNET_TESTING_overlay_configure_topology (void *op_cls,
725 unsigned int num_peers,
726 struct GNUNET_TESTING_Peer *peers,
727 enum GNUNET_TESTING_TopologyOption topo,
733 * Ask the testbed controller to write the current overlay topology to
734 * a file. Naturally, the file will only contain a snapshot as the
735 * topology may evolve all the time.
737 * @param controller overlay controller to inspect
738 * @param filename name of the file the topology should
742 GNUNET_TESTING_overlay_write_topology_to_file (struct GNUNET_TESTING_Controller *controller,
743 const char *filename);
747 * Adapter function called to establish a connection to
751 * @param cfg configuration of the peer to connect to
752 * @return service handle to return in 'op_result', NULL on error
754 typedef void * (*GNUNET_TESTING_ConnectAdapter)(void *cls,
755 const struct GNUNET_CONFIGURATION_Handle *cfg);
759 * Adapter function called to destroy a connection to
763 * @param op_result service handle returned from the connect adapter
765 typedef void (*GNUNET_TESTING_DisconnectAdapter)(void *cls,
770 * Connect to a service offered by the given peer. Will ensure that
771 * the request is queued to not overwhelm our ability to create and
772 * maintain connections with other systems. The actual service
773 * handle is then returned via the 'op_result' member in the event
774 * callback. The 'ca' callback is used to create the connection
775 * when the time is right; the 'da' callback will be used to
776 * destroy the connection (upon 'GNUNET_TESTING_operation_done').
777 * 'GNUNET_TESTING_operation_cancel' can be used to abort this
778 * operation until the event callback has been called.
780 * @param peer peer that runs the service
781 * @param service_name name of the service to connect to
782 * @param ca helper function to establish the connection
783 * @param da helper function to close the connection
784 * @param cada_cls closure for ca and da
785 * @return handle for the operation
787 struct GNUNET_TESTING_Operation *
788 GNUNET_TESTING_service_connect (struct GNUNET_TESTING_Peer *peer,
789 const char *service_name,
790 GNUNET_TESTING_ConnectAdapter ca,
791 GNUNET_TESTING_DisconnectAdapter da,
796 * Cancel a pending operation. Releases all resources
797 * of the operation and will ensure that no event
798 * is generated for the operation. Does NOT guarantee
799 * that the operation will be fully undone (or that
800 * nothing ever happened).
802 * @param operation operation to cancel
805 GNUNET_TESTING_operation_cancel (struct GNUNET_TESTING_Operation *operation);
809 * Signal that the information from an operation has been fully
810 * processed. This function MUST be called for each event
811 * of type 'operation_finished' to fully remove the operation
812 * from the operation queue. After calling this function, the
813 * 'op_result' becomes invalid (!).
815 * @param operation operation to signal completion for
818 GNUNET_TESTING_operation_done (struct GNUNET_TESTING_Operation *operation);
822 * Configure and run a testbed using the given
823 * master controller on 'num_hosts' starting
824 * 'num_peers' using the given peer configuration.
826 * @param controller master controller for the testbed
827 * (must not be destroyed until after the
828 * testbed is destroyed).
829 * @param num_hosts number of hosts in 'hosts', 0 to only
831 * @param hosts list of hosts to use for the testbed
832 * @param num_peers number of peers to start
833 * @param peer_cfg peer configuration template to use
834 * @param underlay_topology underlay topology to create
835 * @param va topology-specific options
836 * @return handle to the testbed
838 struct GNUNET_TESTING_Testbed *
839 GNUNET_TESTING_testbed_create_va (struct GNUNET_TESTING_Controller *controller,
840 unsigned int num_hosts,
841 struct GNUNET_TESTING_Host **hosts,
842 unsigned int num_peers,
843 const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
844 enum GNUNET_TESTING_Topology topo,
849 * Configure and run a testbed using the given
850 * master controller on 'num_hosts' starting
851 * 'num_peers' using the given peer configuration.
853 * @param controller master controller for the testbed
854 * (must not be destroyed until after the
855 * testbed is destroyed).
856 * @param num_hosts number of hosts in 'hosts', 0 to only
858 * @param hosts list of hosts to use for the testbed
859 * @param num_peers number of peers to start
860 * @param peer_cfg peer configuration template to use
861 * @param underlay_topology underlay topology to create
862 * @param ... topology-specific options
864 struct GNUNET_TESTING_Testbed *
865 GNUNET_TESTING_testbed_create (struct GNUNET_TESTING_Controller *controller,
866 unsigned int num_hosts,
867 struct GNUNET_TESTING_Host **hosts,
868 unsigned int num_peers,
869 const struct GNUNET_CONFIGURATION_Handle *peer_cfg,
870 enum GNUNET_TESTING_Topology topo,
875 * Destroy a testbed. Stops all running peers and then
876 * destroys all peers. Does NOT destroy the master controller.
878 * @param testbed testbed to destroy
881 GNUNET_TESTING_testbed_destroy (struct GNUNET_TESTING_Testbed *testbed);
885 * Convenience method for running a testbed with
886 * a single call. Underlay and overlay topology
887 * are configured using the "UNDERLAY" and "OVERLAY"
888 * options in the "[testbed]" section of the configuration\
889 * (with possible options given in "UNDERLAY_XXX" and/or
892 * The testbed is to be terminated using a call to
893 * "GNUNET_SCHEDULER_shutdown".
895 * @param host_filename name of the file with the 'hosts', NULL
896 * to run everything on 'localhost'
897 * @param cfg configuration to use (for testbed, controller and peers)
898 * @param num_peers number of peers to start
899 * @param event_mask bit mask with set of events to call 'cc' for;
900 * or-ed values of "1LL" shifted by the
901 * respective 'enum GNUNET_TESTING_EventType'
902 * (i.e. "(1LL << GNUNET_TESTING_ET_CONNECT) || ...")
903 * @param cc controller callback to invoke on events
904 * @param cc_cls closure for cc
905 * @param master task to run once the testbed is ready
906 * @param master_cls closure for 'task'.
909 GNUNET_TESTING_testbed_run (const char *host_filename,
910 const struct GNUNET_CONFIGURATION_Handle *cfg,
911 unsigned int num_peers,
913 GNUNET_TESTING_ControllerCallback cc,
915 GNUNET_SCHEDULER_Task master,
920 * Signature of a main function for a testcase.
923 * @param num_peers number of peers in 'peers'
924 * @param peers handle to peers run in the testbed
926 typedef void (*GNUNET_TESTING_TestMaster)(void *cls,
927 unsigned int num_peers,
928 struct GNUNET_TESTING_Peer **peers);
932 * Convenience method for running a "simple" test on the local system
933 * with a single call from 'main'. Underlay and overlay topology are
934 * configured using the "UNDERLAY" and "OVERLAY" options in the
935 * "[testbed]" section of the configuration (with possible options
936 * given in "UNDERLAY_XXX" and/or "OVERLAY_XXX").
938 * The test is to be terminated using a call to
939 * "GNUNET_SCHEDULER_shutdown". If starting the test fails,
940 * the program is stopped without 'master' ever being run.
942 * NOTE: this function should be called from 'main', NOT from
943 * within a GNUNET_SCHEDULER-loop. This function will initialze
944 * the scheduler loop, the testbed and then pass control to
947 * @param testname name of the testcase (to configure logging, etc.)
948 * @param cfg_filename configuration filename to use
949 * (for testbed, controller and peers)
950 * @param num_peers number of peers to start
951 * @param test_master task to run once the test is ready
952 * @param test_master_cls closure for 'task'.
955 GNUNET_TESTING_test_run (const char *testname,
956 const char *cfg_filename,
957 unsigned int num_peers,
958 GNUNET_TESTING_TestMaster master,
962 #if 0 /* keep Emacsens' auto-indent happy */