diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-05-11 07:36:06 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-05-11 07:36:06 +0000 |
commit | d97080fdb32694677dc765f213f9074c732d2574 (patch) | |
tree | 884f373b702150d941bef6a19faea7a04e56e52e /src/include/gnunet_testing_lib.h | |
parent | 673b8dadbe8cbc17d2c1391d16f15a0d7626b4fd (diff) | |
download | gnunet-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.h | 55 |
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 | */ | ||
404 | void | ||
405 | GNUNET_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 | */ |
410 | void | 433 | void |
411 | GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | 434 | GNUNET_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, | |||
518 | void | 541 | void |
519 | GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, struct GNUNET_TIME_Relative timeout); | 542 | GNUNET_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 | */ | ||
566 | void | ||
567 | GNUNET_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. |