2 This file is part of GNUnet
3 (C) 2008, 2009 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_lib.h
23 * @brief convenience API for writing testcases for GNUnet
24 * Many testcases need to start and stop gnunetd,
25 * and this library is supposed to make that easier
26 * for TESTCASES. Normal programs should always
27 * use functions from gnunet_{util,arm}_lib.h. This API is
28 * ONLY for writing testcases!
29 * @author Christian Grothoff
32 #ifndef GNUNET_TESTING_LIB_H
33 #define GNUNET_TESTING_LIB_H
35 #include "gnunet_util_lib.h"
36 #include "gnunet_statistics_service.h"
41 #if 0 /* keep Emacsens' auto-indent happy */
46 #define HOSTKEYFILESIZE 914
49 * Handle for a GNUnet daemon (technically a set of
50 * daemons; the handle is really for the master ARM
51 * daemon) started by the testing library.
53 struct GNUNET_TESTING_Daemon;
56 * Linked list of hostnames and ports to use for starting daemons.
58 struct GNUNET_TESTING_Host
61 * Pointer to next item in the list.
63 struct GNUNET_TESTING_Host *next;
66 * Hostname to connect to.
71 * Username to use when connecting (may be null).
76 * Port to use for SSH connection (used for ssh
77 * connection forwarding, 0 to let ssh decide)
83 * Prototype of a function that will be called whenever
84 * a daemon was started by the testing library.
87 * @param id identifier for the daemon, NULL on error
88 * @param d handle for the daemon
89 * @param emsg error message (NULL on success)
91 typedef void (*GNUNET_TESTING_NotifyHostkeyCreated)(void *cls,
92 const struct GNUNET_PeerIdentity *id,
93 struct GNUNET_TESTING_Daemon *d,
97 * Prototype of a function that will be called whenever
98 * a daemon was started by the testing library.
101 * @param id identifier for the daemon, NULL on error
102 * @param cfg configuration used by this daemon
103 * @param d handle for the daemon
104 * @param emsg error message (NULL on success)
106 typedef void (*GNUNET_TESTING_NotifyDaemonRunning)(void *cls,
107 const struct GNUNET_PeerIdentity *id,
108 const struct GNUNET_CONFIGURATION_Handle *cfg,
109 struct GNUNET_TESTING_Daemon *d,
114 * Handle to an entire testbed of GNUnet peers.
116 struct GNUNET_TESTING_Testbed;
119 * Phases of starting GNUnet on a system.
121 enum GNUNET_TESTING_StartPhase
124 * Copy the configuration file to the target system.
129 * Configuration file has been copied, generate hostkey.
134 * Create the hostkey for the peer.
139 * Hostkey generated, wait for topology to be finished.
144 * Topology has been created, now start ARM.
149 * ARM has been started, check that it has properly daemonized and
150 * then try to connect to the CORE service (which should be
151 * auto-started by ARM).
156 * We're waiting for CORE to start.
161 * CORE is up, now make sure we get the HELLO for this peer.
166 * Core has notified us that we've established a connection to the service.
167 * The main FSM halts here and waits to be moved to UPDATE or CLEANUP.
172 * We've been asked to terminate the instance and are now waiting for
173 * the remote command to stop the gnunet-arm process and delete temporary
179 * We've received a configuration update and are currently waiting for
180 * the copy process for the update to complete. Once it is, we will
181 * return to "SP_START_DONE" (and rely on ARM to restart all affected
188 * Prototype of a function that will be called when a
189 * particular operation was completed the testing library.
192 * @param emsg NULL on success
194 typedef void (*GNUNET_TESTING_NotifyCompletion)(void *cls,
198 * Prototype of a function that will be called with the
199 * number of connections created for a particular topology.
202 * @param num_connections the number of connections created
204 typedef void (*GNUNET_TESTING_NotifyConnections)(void *cls,
205 unsigned int num_connections);
208 * Handle for a GNUnet daemon (technically a set of
209 * daemons; the handle is really for the master ARM
210 * daemon) started by the testing library.
212 struct GNUNET_TESTING_Daemon
217 struct GNUNET_CONFIGURATION_Handle *cfg;
220 * At what time to give up starting the peer
222 struct GNUNET_TIME_Absolute max_timeout;
225 * Host to run GNUnet on.
230 * Port to use for ssh, NULL to let system choose default.
235 * Result of GNUNET_i2s of this peer,
241 * Username we are using.
246 * Name of the configuration file
251 * Callback to inform initiator that the peer's
252 * hostkey has been created.
254 GNUNET_TESTING_NotifyHostkeyCreated hostkey_callback;
257 * Closure for hostkey creation callback.
262 * Function to call when the peer is running.
264 GNUNET_TESTING_NotifyDaemonRunning cb;
272 * Arguments from "daemon_stop" call.
274 GNUNET_TESTING_NotifyCompletion dead_cb;
277 * Closure for 'dead_cb'.
282 * Arguments from "daemon_stop" call.
284 GNUNET_TESTING_NotifyCompletion update_cb;
287 * Closure for 'update_cb'.
292 * Identity of this peer (once started).
294 struct GNUNET_PeerIdentity id;
297 * Flag to indicate that we've already been asked
298 * to terminate (but could not because some action
299 * was still pending).
304 * GNUNET_YES if the hostkey has been created
305 * for this peer, GNUNET_NO otherwise.
310 * PID of the process that we started last.
312 struct GNUNET_OS_Process *proc;
315 * In which phase are we during the start of
318 enum GNUNET_TESTING_StartPhase phase;
321 * ID of the current task.
323 GNUNET_SCHEDULER_TaskIdentifier task;
326 * Handle to the server.
328 struct GNUNET_CORE_Handle *server;
331 * Handle to the transport service of this peer
333 struct GNUNET_TRANSPORT_Handle *th;
336 * HELLO message for this peer
338 struct GNUNET_HELLO_Message *hello;
341 * Handle to a pipe for reading the hostkey.
343 struct GNUNET_DISK_PipeHandle *pipe_stdout;
346 * Output from gnunet-peerinfo is read into this buffer.
348 char hostkeybuf[105];
351 * Current position in 'hostkeybuf' (for reading from gnunet-peerinfo)
353 unsigned int hostkeybufpos;
356 * Set to GNUNET_YES once the peer is up.
361 * Used to tell shutdown not to remove configuration for the peer
362 * (if it's going to be restarted later)
369 * Handle to a group of GNUnet peers.
371 struct GNUNET_TESTING_PeerGroup;
375 * Prototype of a function that will be called whenever
376 * two daemons are connected by the testing library.
379 * @param first peer id for first daemon
380 * @param second peer id for the second daemon
381 * @param distance distance between the connected peers
382 * @param first_cfg config for the first daemon
383 * @param second_cfg config for the second daemon
384 * @param first_daemon handle for the first daemon
385 * @param second_daemon handle for the second daemon
386 * @param emsg error message (NULL on success)
388 typedef void (*GNUNET_TESTING_NotifyConnection)(void *cls,
389 const struct GNUNET_PeerIdentity *first,
390 const struct GNUNET_PeerIdentity *second,
392 const struct GNUNET_CONFIGURATION_Handle *first_cfg,
393 const struct GNUNET_CONFIGURATION_Handle *second_cfg,
394 struct GNUNET_TESTING_Daemon *first_daemon,
395 struct GNUNET_TESTING_Daemon *second_daemon,
399 * Prototype of a callback function indicating that two peers
400 * are currently connected.
403 * @param first peer id for first daemon
404 * @param second peer id for the second daemon
405 * @param distance distance between the connected peers
406 * @param emsg error message (NULL on success)
408 typedef void (*GNUNET_TESTING_NotifyTopology)(void *cls,
409 const struct GNUNET_PeerIdentity *first,
410 const struct GNUNET_PeerIdentity *second,
414 * Starts a GNUnet daemon. GNUnet must be installed on the target
415 * system and available in the PATH. The machine must furthermore be
416 * reachable via "ssh" (unless the hostname is "NULL") without the
417 * need to enter a password.
419 * @param cfg configuration to use
420 * @param timeout how long to wait starting up peers
421 * @param hostname name of the machine where to run GNUnet
422 * (use NULL for localhost).
423 * @param ssh_username ssh username to use when connecting to hostname
424 * @param sshport port to pass to ssh process when connecting to hostname
425 * @param hostkey pointer to a hostkey to be written to disk (instead of being generated)
426 * @param hostkey_callback function to call once the hostkey has been
427 * generated for this peer, but it hasn't yet been started
428 * (NULL to start immediately, otherwise waits on GNUNET_TESTING_daemon_continue_start)
429 * @param hostkey_cls closure for hostkey callback
430 * @param cb function to call once peer is up, or failed to start
431 * @param cb_cls closure for cb
432 * @return handle to the daemon (actual start will be completed asynchronously)
434 struct GNUNET_TESTING_Daemon *
435 GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
436 struct GNUNET_TIME_Relative timeout,
437 const char *hostname,
438 const char *ssh_username,
441 GNUNET_TESTING_NotifyHostkeyCreated
442 hostkey_callback, void *hostkey_cls,
443 GNUNET_TESTING_NotifyDaemonRunning cb,
447 * Continues GNUnet daemon startup when user wanted to be notified
448 * once a hostkey was generated (for creating friends files, blacklists,
451 * @param daemon the daemon to finish starting
454 GNUNET_TESTING_daemon_continue_startup(struct GNUNET_TESTING_Daemon *daemon);
457 * Check whether the given daemon is running.
459 * @param daemon the daemon to check
461 * @return GNUNET_YES if the daemon is up, GNUNET_NO if the
462 * daemon is down, GNUNET_SYSERR on error.
465 GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon);
468 * Restart (stop and start) a GNUnet daemon.
470 * @param d the daemon that should be restarted
471 * @param cb function called once the daemon is (re)started
472 * @param cb_cls closure for cb
475 GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d,
476 GNUNET_TESTING_NotifyDaemonRunning cb, void *cb_cls);
479 * Start a peer that has previously been stopped using the daemon_stop
480 * call (and files weren't deleted and the allow restart flag)
482 * @param daemon the daemon to start (has been previously stopped)
483 * @param timeout how long to wait for restart
484 * @param cb the callback for notification when the peer is running
485 * @param cb_cls closure for the callback
488 GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon,
489 struct GNUNET_TIME_Relative timeout,
490 GNUNET_TESTING_NotifyDaemonRunning cb,
494 * Get a certain testing daemon handle.
496 * @param pg handle to the set of running peers
497 * @param position the number of the peer to return
499 struct GNUNET_TESTING_Daemon *
500 GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg,
501 unsigned int position);
504 * Get a daemon by peer identity, so callers can
505 * retrieve the daemon without knowing it's offset.
507 * @param pg the peer group to retrieve the daemon from
508 * @param peer_id the peer identity of the daemon to retrieve
510 * @return the daemon on success, or NULL if no such peer identity is found
512 struct GNUNET_TESTING_Daemon *
513 GNUNET_TESTING_daemon_get_by_id (struct GNUNET_TESTING_PeerGroup *pg,
514 struct GNUNET_PeerIdentity *peer_id);
517 * Stops a GNUnet daemon.
519 * @param d the daemon that should be stopped
520 * @param timeout how long to wait for process for shutdown to complete
521 * @param cb function called once the daemon was stopped
522 * @param cb_cls closure for cb
523 * @param delete_files GNUNET_YES to remove files, GNUNET_NO
524 * to leave them (i.e. for restarting at a later time,
525 * or logfile inspection once finished)
526 * @param allow_restart GNUNET_YES to restart peer later (using this API)
527 * GNUNET_NO to kill off and clean up for good
530 GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
531 struct GNUNET_TIME_Relative timeout,
532 GNUNET_TESTING_NotifyCompletion cb, void *cb_cls,
533 int delete_files, int allow_restart);
537 * Changes the configuration of a GNUnet daemon.
539 * @param d the daemon that should be modified
540 * @param cfg the new configuration for the daemon
541 * @param cb function called once the configuration was changed
542 * @param cb_cls closure for cb
544 void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
545 struct GNUNET_CONFIGURATION_Handle *cfg,
546 GNUNET_TESTING_NotifyCompletion cb,
551 * Establish a connection between two GNUnet daemons.
553 * @param d1 handle for the first daemon
554 * @param d2 handle for the second daemon
555 * @param timeout how long is the connection attempt
557 * @param max_connect_attempts how many times should we try to reconnect
559 * @param send_hello GNUNET_YES to send the HELLO, GNUNET_NO to assume
560 * the HELLO has already been exchanged
561 * @param cb function to call at the end
562 * @param cb_cls closure for cb
565 GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
566 struct GNUNET_TESTING_Daemon *d2,
567 struct GNUNET_TIME_Relative timeout,
568 unsigned int max_connect_attempts,
570 GNUNET_TESTING_NotifyConnection cb,
577 * Start count gnunet instances with the same set of transports and
578 * applications. The port numbers (any option called "PORT") will be
579 * adjusted to ensure that no two peers running on the same system
580 * have the same port(s) in their respective configurations.
582 * @param cfg configuration template to use
583 * @param total number of daemons to start
584 * @param max_concurrent_connections for testing, how many peers can
585 * we connect to simultaneously
586 * @param max_concurrent_ssh when starting with ssh, how many ssh
587 * connections will we allow at once (based on remote hosts allowed!)
588 * @param timeout total time allowed for peers to start
589 * @param hostkey_callback function to call on each peers hostkey generation
590 * if NULL, peers will be started by this call, if non-null,
591 * GNUNET_TESTING_daemons_continue_startup must be called after
592 * successful hostkey generation
593 * @param hostkey_cls closure for hostkey callback
594 * @param cb function to call on each daemon that was started
595 * @param cb_cls closure for cb
596 * @param connect_callback function to call each time two hosts are connected
597 * @param connect_callback_cls closure for connect_callback
598 * @param hostnames linked list of host structs to use to start peers on
599 * (NULL to run on localhost only)
601 * @return NULL on error, otherwise handle to control peer group
603 struct GNUNET_TESTING_PeerGroup *
604 GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
606 unsigned int max_concurrent_connections,
607 unsigned int max_concurrent_ssh,
608 struct GNUNET_TIME_Relative timeout,
609 GNUNET_TESTING_NotifyHostkeyCreated
610 hostkey_callback, void *hostkey_cls,
611 GNUNET_TESTING_NotifyDaemonRunning cb,
613 GNUNET_TESTING_NotifyConnection
614 connect_callback, void *connect_callback_cls,
615 const struct GNUNET_TESTING_Host *hostnames);
618 * Function which continues a peer group starting up
619 * after successfully generating hostkeys for each peer.
621 * @param pg the peer group to continue starting
624 GNUNET_TESTING_daemons_continue_startup(struct GNUNET_TESTING_PeerGroup *pg);
627 * Restart all peers in the given group.
629 * @param pg the handle to the peer group
630 * @param callback function to call on completion (or failure)
631 * @param callback_cls closure for the callback function
634 GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg,
635 GNUNET_TESTING_NotifyCompletion callback,
640 * Shutdown all peers started in the given group.
642 * @param pg handle to the peer group
643 * @param timeout how long to wait for shutdown
644 * @param cb callback to notify upon success or failure
645 * @param cb_cls closure for cb
648 GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg,
649 struct GNUNET_TIME_Relative timeout,
650 GNUNET_TESTING_NotifyCompletion cb,
655 * Count the number of running peers.
657 * @param pg handle for the peer group
659 * @return the number of currently running peers in the peer group
662 GNUNET_TESTING_daemons_running (struct GNUNET_TESTING_PeerGroup *pg);
665 * Simulate churn by stopping some peers (and possibly
666 * re-starting others if churn is called multiple times). This
667 * function can only be used to create leave-join churn (peers "never"
668 * leave for good). First "voff" random peers that are currently
669 * online will be taken offline; then "von" random peers that are then
670 * offline will be put back online. No notifications will be
671 * generated for any of these operations except for the callback upon
672 * completion. Note that the implementation is at liberty to keep
673 * the ARM service itself (but none of the other services or daemons)
674 * running even though the "peer" is being varied offline.
676 * @param pg handle for the peer group
677 * @param voff number of peers that should go offline
678 * @param von number of peers that should come back online;
679 * must be zero on first call (since "testbed_start"
680 * always starts all of the peers)
681 * @param timeout how long to wait for operations to finish before
683 * @param cb function to call at the end
684 * @param cb_cls closure for cb
687 GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg,
690 struct GNUNET_TIME_Relative timeout,
691 GNUNET_TESTING_NotifyCompletion cb,
695 * Callback function to process statistic values.
698 * @param peer the peer the statistics belong to
699 * @param subsystem name of subsystem that created the statistic
700 * @param name the name of the datum
701 * @param value the current value
702 * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
703 * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
705 typedef int (*GNUNET_TESTING_STATISTICS_Iterator) (void *cls,
706 const struct GNUNET_PeerIdentity *peer,
707 const char *subsystem,
713 * Iterate over all (running) peers in the peer group, retrieve
714 * all statistics from each.
717 GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg,
718 GNUNET_STATISTICS_Callback cont,
719 GNUNET_TESTING_STATISTICS_Iterator proc, void *cls);
722 * Topologies supported for testbeds.
724 enum GNUNET_TESTING_Topology
727 * A clique (everyone connected to everyone else).
729 GNUNET_TESTING_TOPOLOGY_CLIQUE,
732 * Small-world network (2d torus plus random links).
734 GNUNET_TESTING_TOPOLOGY_SMALL_WORLD,
737 * Small-world network (ring plus random links).
739 GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING,
744 GNUNET_TESTING_TOPOLOGY_RING,
749 GNUNET_TESTING_TOPOLOGY_2D_TORUS,
754 GNUNET_TESTING_TOPOLOGY_ERDOS_RENYI,
757 * Certain percentage of peers are unable to communicate directly
758 * replicating NAT conditions
760 GNUNET_TESTING_TOPOLOGY_INTERNAT,
763 * Scale free topology.
765 GNUNET_TESTING_TOPOLOGY_SCALE_FREE,
768 * Straight line topology.
770 GNUNET_TESTING_TOPOLOGY_LINE,
773 * All peers are disconnected.
775 GNUNET_TESTING_TOPOLOGY_NONE,
778 * Read a topology from a given file.
780 GNUNET_TESTING_TOPOLOGY_FROM_FILE
784 * Options for connecting a topology.
786 enum GNUNET_TESTING_TopologyOption
789 * Try to connect all peers specified in the topology.
791 GNUNET_TESTING_TOPOLOGY_OPTION_ALL,
794 * Choose a random subset of connections to create.
796 GNUNET_TESTING_TOPOLOGY_OPTION_RANDOM,
799 * Create at least X connections for each peer.
801 GNUNET_TESTING_TOPOLOGY_OPTION_MINIMUM,
804 * Using a depth first search, create one connection
805 * per peer. If any are missed (graph disconnected)
806 * start over at those peers until all have at least one
809 GNUNET_TESTING_TOPOLOGY_OPTION_DFS,
812 * Find the N closest peers to each allowed peer in the
813 * topology and make sure a connection to those peers
814 * exists in the connect topology.
816 GNUNET_TESTING_TOPOLOGY_OPTION_ADD_CLOSEST,
819 * No options specified.
821 GNUNET_TESTING_TOPOLOGY_OPTION_NONE
826 * Get a topology from a string input.
828 * @param topology where to write the retrieved topology
829 * @param topology_string The string to attempt to
830 * get a configuration value from
831 * @return GNUNET_YES if topology string matched a
832 * known topology, GNUNET_NO if not
835 GNUNET_TESTING_topology_get(enum GNUNET_TESTING_Topology *topology,
836 const char * topology_string);
839 * Get connect topology option from string input.
841 * @param topology_option where to write the retrieved topology
842 * @param topology_string The string to attempt to
843 * get a configuration value from
844 * @return GNUNET_YES if topology string matched a
845 * known topology, GNUNET_NO if not
848 GNUNET_TESTING_topology_option_get(enum GNUNET_TESTING_TopologyOption *topology_option,
849 const char * topology_string);
853 * Takes a peer group and creates a topology based on the
854 * one specified. Creates a topology means generates friend
855 * files for the peers so they can only connect to those allowed
856 * by the topology. This will only have an effect once peers
857 * are started if the FRIENDS_ONLY option is set in the base
860 * Also takes an optional restrict topology which
861 * disallows direct connections UNLESS they are specified in
862 * the restricted topology.
864 * A simple example; if the topology option is set to LINE
865 * peers can ONLY connect in a LINE. However, if the topology
866 * option is set to 2D-torus and the restrict option is set to
867 * line with restrict_transports equal to "tcp udp", then peers
868 * may connect in a 2D-torus, but will be restricted to tcp and
869 * udp connections only in a LINE. Generally it only makes
870 * sense to do this if restrict_topology is a subset of topology.
872 * For testing peer discovery, etc. it is generally better to
873 * leave restrict_topology as GNUNET_TESTING_TOPOLOGY_NONE and
874 * then use the connect_topology function to restrict the initial
877 * @param pg the peer group struct representing the running peers
878 * @param topology which topology to connect the peers in
879 * @param restrict_topology allow only direct connections in this topology,
880 * based on those listed in restrict_transports, set to
881 * GNUNET_TESTING_TOPOLOGY_NONE for no restrictions
882 * @param restrict_transports space delimited list of transports to blacklist
883 * to create restricted topology, NULL for none
885 * @return the maximum number of connections were all allowed peers
886 * connected to each other
889 GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
890 enum GNUNET_TESTING_Topology topology,
891 enum GNUNET_TESTING_Topology restrict_topology,
892 const char *restrict_transports);
895 * Iterate over all (running) peers in the peer group, retrieve
896 * all connections that each currently has.
898 * @param pg the peer group we are concerned with
899 * @param cb callback for topology information
900 * @param cls closure for callback
903 GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg,
904 GNUNET_TESTING_NotifyTopology cb, void *cls);
907 * Stop the connection process temporarily.
909 * @param pg the peer group to stop connecting
911 void GNUNET_TESTING_stop_connections(struct GNUNET_TESTING_PeerGroup *pg);
914 * Resume the connection process.
916 * @param pg the peer group to resume connecting
918 void GNUNET_TESTING_resume_connections(struct GNUNET_TESTING_PeerGroup *pg);
921 * There are many ways to connect peers that are supported by this function.
922 * To connect peers in the same topology that was created via the
923 * GNUNET_TESTING_create_topology, the topology variable must be set to
924 * GNUNET_TESTING_TOPOLOGY_NONE. If the topology variable is specified,
925 * a new instance of that topology will be generated and attempted to be
926 * connected. This could result in some connections being impossible,
927 * because some topologies are non-deterministic.
929 * @param pg the peer group struct representing the running peers
930 * @param topology which topology to connect the peers in
931 * @param options options for connecting the topology
932 * @param option_modifier modifier for options that take a parameter
933 * @param connect_timeout how long to wait before giving up on connecting
935 * @param connect_attempts how many times to attempt to connect two peers
936 * over the connect_timeout duration
937 * @param notify_callback notification to be called once all connections completed
938 * @param notify_cls closure for notification callback
940 * @return the number of connections that will be attempted, GNUNET_SYSERR on error
943 GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg,
944 enum GNUNET_TESTING_Topology topology,
945 enum GNUNET_TESTING_TopologyOption options,
946 double option_modifier,
947 struct GNUNET_TIME_Relative connect_timeout,
948 unsigned int connect_attempts,
949 GNUNET_TESTING_NotifyCompletion
950 notify_callback, void *notify_cls);
953 * Start or stop an individual peer from the given group.
955 * @param pg handle to the peer group
956 * @param offset which peer to start or stop
957 * @param desired_status GNUNET_YES to have it running, GNUNET_NO to stop it
958 * @param timeout how long to wait for shutdown
959 * @param cb function to call at the end
960 * @param cb_cls closure for cb
963 GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg,
966 struct GNUNET_TIME_Relative timeout,
967 GNUNET_TESTING_NotifyCompletion cb,
971 #if 0 /* keep Emacsens' auto-indent happy */