aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_testing_lib.h
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2010-05-11 07:36:06 +0000
committerNathan S. Evans <evans@in.tum.de>2010-05-11 07:36:06 +0000
commitd97080fdb32694677dc765f213f9074c732d2574 (patch)
tree884f373b702150d941bef6a19faea7a04e56e52e /src/include/gnunet_testing_lib.h
parent673b8dadbe8cbc17d2c1391d16f15a0d7626b4fd (diff)
downloadgnunet-d97080fdb32694677dc765f213f9074c732d2574.tar.gz
gnunet-d97080fdb32694677dc765f213f9074c732d2574.zip
testing api change
Diffstat (limited to 'src/include/gnunet_testing_lib.h')
-rw-r--r--src/include/gnunet_testing_lib.h55
1 files changed, 54 insertions, 1 deletions
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h
index 51046c49a..9304a6135 100644
--- a/src/include/gnunet_testing_lib.h
+++ b/src/include/gnunet_testing_lib.h
@@ -305,6 +305,12 @@ struct GNUNET_TESTING_Daemon
305 * Set to GNUNET_YES once the peer is up. 305 * Set to GNUNET_YES once the peer is up.
306 */ 306 */
307 int running; 307 int running;
308
309 /**
310 * Used to tell shutdown not to remove configuration for the peer
311 * (if it's going to be restarted later)
312 */
313 int churn;
308}; 314};
309 315
310 316
@@ -387,6 +393,21 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d,
387 GNUNET_TESTING_NotifyDaemonRunning cb, void *cb_cls); 393 GNUNET_TESTING_NotifyDaemonRunning cb, void *cb_cls);
388 394
389/** 395/**
396 * Start a peer that has previously been stopped using the daemon_stop
397 * call (and files weren't deleted and the allow restart flag)
398 *
399 * @param daemon the daemon to start (has been previously stopped)
400 * @param timeout how long to wait for restart
401 * @param cb the callback for notification when the peer is running
402 * @param cb_cls closure for the callback
403 */
404void
405GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon,
406 struct GNUNET_TIME_Relative timeout,
407 GNUNET_TESTING_NotifyDaemonRunning cb,
408 void *cb_cls);
409
410/**
390 * Get a certain testing daemon handle. 411 * Get a certain testing daemon handle.
391 * 412 *
392 * @param pg handle to the set of running peers 413 * @param pg handle to the set of running peers
@@ -406,12 +427,14 @@ GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg, unsigned int pos
406 * @param delete_files GNUNET_YES to remove files, GNUNET_NO 427 * @param delete_files GNUNET_YES to remove files, GNUNET_NO
407 * to leave them (i.e. for restarting at a later time, 428 * to leave them (i.e. for restarting at a later time,
408 * or logfile inspection once finished) 429 * or logfile inspection once finished)
430 * @param allow_restart GNUNET_YES to restart peer later (using this API)
431 * GNUNET_NO to kill off and clean up for good
409 */ 432 */
410void 433void
411GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, 434GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
412 struct GNUNET_TIME_Relative timeout, 435 struct GNUNET_TIME_Relative timeout,
413 GNUNET_TESTING_NotifyCompletion cb, void *cb_cls, 436 GNUNET_TESTING_NotifyCompletion cb, void *cb_cls,
414 int delete_files); 437 int delete_files, int allow_restart);
415 438
416 439
417/** 440/**
@@ -518,6 +541,36 @@ GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg,
518void 541void
519GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, struct GNUNET_TIME_Relative timeout); 542GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, struct GNUNET_TIME_Relative timeout);
520 543
544/**
545 * Simulate churn by stopping some peers (and possibly
546 * re-starting others if churn is called multiple times). This
547 * function can only be used to create leave-join churn (peers "never"
548 * leave for good). First "voff" random peers that are currently
549 * online will be taken offline; then "von" random peers that are then
550 * offline will be put back online. No notifications will be
551 * generated for any of these operations except for the callback upon
552 * completion. Note that the implementation is at liberty to keep
553 * the ARM service itself (but none of the other services or daemons)
554 * running even though the "peer" is being varied offline.
555 *
556 * @param pg handle for the peer group
557 * @param voff number of peers that should go offline
558 * @param von number of peers that should come back online;
559 * must be zero on first call (since "testbed_start"
560 * always starts all of the peers)
561 * @param timeout how long to wait for operations to finish before
562 * giving up
563 * @param cb function to call at the end
564 * @param cb_cls closure for cb
565 */
566void
567GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg,
568 unsigned int voff,
569 unsigned int von,
570 struct GNUNET_TIME_Relative timeout,
571 GNUNET_TESTING_NotifyCompletion cb,
572 void *cb_cls);
573
521 574
522/** 575/**
523 * Topologies supported for testbeds. 576 * Topologies supported for testbeds.