diff options
Diffstat (limited to 'src/include/gnunet_testing_lib.h')
-rw-r--r-- | src/include/gnunet_testing_lib.h | 329 |
1 files changed, 155 insertions, 174 deletions
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index cd673a082..5bedc406c 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h | |||
@@ -466,22 +466,15 @@ typedef void (*GNUNET_TESTING_NotifyTopology) (void *cls, | |||
466 | * @param cb_cls closure for cb | 466 | * @param cb_cls closure for cb |
467 | * @return handle to the daemon (actual start will be completed asynchronously) | 467 | * @return handle to the daemon (actual start will be completed asynchronously) |
468 | */ | 468 | */ |
469 | struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_start (const struct | 469 | struct GNUNET_TESTING_Daemon * |
470 | GNUNET_CONFIGURATION_Handle | 470 | GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
471 | *cfg, | 471 | struct GNUNET_TIME_Relative timeout, int pretend, |
472 | struct | 472 | const char *hostname, const char *ssh_username, |
473 | GNUNET_TIME_Relative | 473 | uint16_t sshport, const char *hostkey, |
474 | timeout, int pretend, | 474 | GNUNET_TESTING_NotifyHostkeyCreated |
475 | const char *hostname, | 475 | hostkey_callback, void *hostkey_cls, |
476 | const char | 476 | GNUNET_TESTING_NotifyDaemonRunning cb, |
477 | *ssh_username, | 477 | void *cb_cls); |
478 | uint16_t sshport, | ||
479 | const char *hostkey, | ||
480 | GNUNET_TESTING_NotifyHostkeyCreated | ||
481 | hostkey_callback, | ||
482 | void *hostkey_cls, | ||
483 | GNUNET_TESTING_NotifyDaemonRunning | ||
484 | cb, void *cb_cls); | ||
485 | 478 | ||
486 | /** | 479 | /** |
487 | * Continues GNUnet daemon startup when user wanted to be notified | 480 | * Continues GNUnet daemon startup when user wanted to be notified |
@@ -490,8 +483,8 @@ struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_start (const struct | |||
490 | * | 483 | * |
491 | * @param daemon the daemon to finish starting | 484 | * @param daemon the daemon to finish starting |
492 | */ | 485 | */ |
493 | void GNUNET_TESTING_daemon_continue_startup (struct GNUNET_TESTING_Daemon | 486 | void |
494 | *daemon); | 487 | GNUNET_TESTING_daemon_continue_startup (struct GNUNET_TESTING_Daemon *daemon); |
495 | 488 | ||
496 | /** | 489 | /** |
497 | * Check whether the given daemon is running. | 490 | * Check whether the given daemon is running. |
@@ -501,7 +494,8 @@ void GNUNET_TESTING_daemon_continue_startup (struct GNUNET_TESTING_Daemon | |||
501 | * @return GNUNET_YES if the daemon is up, GNUNET_NO if the | 494 | * @return GNUNET_YES if the daemon is up, GNUNET_NO if the |
502 | * daemon is down, GNUNET_SYSERR on error. | 495 | * daemon is down, GNUNET_SYSERR on error. |
503 | */ | 496 | */ |
504 | int GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon); | 497 | int |
498 | GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon); | ||
505 | 499 | ||
506 | /** | 500 | /** |
507 | * Restart (stop and start) a GNUnet daemon. | 501 | * Restart (stop and start) a GNUnet daemon. |
@@ -510,9 +504,10 @@ int GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon); | |||
510 | * @param cb function called once the daemon is (re)started | 504 | * @param cb function called once the daemon is (re)started |
511 | * @param cb_cls closure for cb | 505 | * @param cb_cls closure for cb |
512 | */ | 506 | */ |
513 | void GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | 507 | void |
514 | GNUNET_TESTING_NotifyDaemonRunning cb, | 508 | GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, |
515 | void *cb_cls); | 509 | GNUNET_TESTING_NotifyDaemonRunning cb, |
510 | void *cb_cls); | ||
516 | 511 | ||
517 | /** | 512 | /** |
518 | * Start a peer that has previously been stopped using the daemon_stop | 513 | * Start a peer that has previously been stopped using the daemon_stop |
@@ -523,10 +518,11 @@ void GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, | |||
523 | * @param cb the callback for notification when the peer is running | 518 | * @param cb the callback for notification when the peer is running |
524 | * @param cb_cls closure for the callback | 519 | * @param cb_cls closure for the callback |
525 | */ | 520 | */ |
526 | void GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon, | 521 | void |
527 | struct GNUNET_TIME_Relative timeout, | 522 | GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon, |
528 | GNUNET_TESTING_NotifyDaemonRunning cb, | 523 | struct GNUNET_TIME_Relative timeout, |
529 | void *cb_cls); | 524 | GNUNET_TESTING_NotifyDaemonRunning cb, |
525 | void *cb_cls); | ||
530 | 526 | ||
531 | /** | 527 | /** |
532 | * Starts a GNUnet daemon's service. | 528 | * Starts a GNUnet daemon's service. |
@@ -537,11 +533,12 @@ void GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon, | |||
537 | * @param cb function called once gnunet-arm returns | 533 | * @param cb function called once gnunet-arm returns |
538 | * @param cb_cls closure for cb | 534 | * @param cb_cls closure for cb |
539 | */ | 535 | */ |
540 | void GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, | 536 | void |
541 | char *service, | 537 | GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, |
542 | struct GNUNET_TIME_Relative timeout, | 538 | char *service, |
543 | GNUNET_TESTING_NotifyDaemonRunning cb, | 539 | struct GNUNET_TIME_Relative timeout, |
544 | void *cb_cls); | 540 | GNUNET_TESTING_NotifyDaemonRunning cb, |
541 | void *cb_cls); | ||
545 | 542 | ||
546 | /** | 543 | /** |
547 | * Starts a GNUnet daemon's service which has been previously turned off. | 544 | * Starts a GNUnet daemon's service which has been previously turned off. |
@@ -552,12 +549,13 @@ void GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, | |||
552 | * @param cb function called once gnunet-arm returns | 549 | * @param cb function called once gnunet-arm returns |
553 | * @param cb_cls closure for cb | 550 | * @param cb_cls closure for cb |
554 | */ | 551 | */ |
555 | void GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon | 552 | void |
556 | *d, char *service, | 553 | GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d, |
557 | struct GNUNET_TIME_Relative | 554 | char *service, |
558 | timeout, | 555 | struct GNUNET_TIME_Relative |
559 | GNUNET_TESTING_NotifyDaemonRunning | 556 | timeout, |
560 | cb, void *cb_cls); | 557 | GNUNET_TESTING_NotifyDaemonRunning |
558 | cb, void *cb_cls); | ||
561 | 559 | ||
562 | /** | 560 | /** |
563 | * Get a certain testing daemon handle. | 561 | * Get a certain testing daemon handle. |
@@ -565,10 +563,9 @@ void GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon | |||
565 | * @param pg handle to the set of running peers | 563 | * @param pg handle to the set of running peers |
566 | * @param position the number of the peer to return | 564 | * @param position the number of the peer to return |
567 | */ | 565 | */ |
568 | struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_get (struct | 566 | struct GNUNET_TESTING_Daemon * |
569 | GNUNET_TESTING_PeerGroup | 567 | GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg, |
570 | *pg, | 568 | unsigned int position); |
571 | unsigned int position); | ||
572 | 569 | ||
573 | /* | 570 | /* |
574 | * Get a daemon by peer identity, so callers can | 571 | * Get a daemon by peer identity, so callers can |
@@ -579,12 +576,9 @@ struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_get (struct | |||
579 | * | 576 | * |
580 | * @return the daemon on success, or NULL if no such peer identity is found | 577 | * @return the daemon on success, or NULL if no such peer identity is found |
581 | */ | 578 | */ |
582 | struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_get_by_id (struct | 579 | struct GNUNET_TESTING_Daemon * |
583 | GNUNET_TESTING_PeerGroup | 580 | GNUNET_TESTING_daemon_get_by_id (struct GNUNET_TESTING_PeerGroup *pg, |
584 | *pg, | 581 | struct GNUNET_PeerIdentity *peer_id); |
585 | struct | ||
586 | GNUNET_PeerIdentity | ||
587 | *peer_id); | ||
588 | 582 | ||
589 | /** | 583 | /** |
590 | * Stops a GNUnet daemon. | 584 | * Stops a GNUnet daemon. |
@@ -599,11 +593,11 @@ struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_get_by_id (struct | |||
599 | * @param allow_restart GNUNET_YES to restart peer later (using this API) | 593 | * @param allow_restart GNUNET_YES to restart peer later (using this API) |
600 | * GNUNET_NO to kill off and clean up for good | 594 | * GNUNET_NO to kill off and clean up for good |
601 | */ | 595 | */ |
602 | void GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | 596 | void |
603 | struct GNUNET_TIME_Relative timeout, | 597 | GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, |
604 | GNUNET_TESTING_NotifyCompletion cb, | 598 | struct GNUNET_TIME_Relative timeout, |
605 | void *cb_cls, int delete_files, | 599 | GNUNET_TESTING_NotifyCompletion cb, void *cb_cls, |
606 | int allow_restart); | 600 | int delete_files, int allow_restart); |
607 | 601 | ||
608 | 602 | ||
609 | /** | 603 | /** |
@@ -614,10 +608,11 @@ void GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, | |||
614 | * @param cb function called once the configuration was changed | 608 | * @param cb function called once the configuration was changed |
615 | * @param cb_cls closure for cb | 609 | * @param cb_cls closure for cb |
616 | */ | 610 | */ |
617 | void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d, | 611 | void |
618 | struct GNUNET_CONFIGURATION_Handle *cfg, | 612 | GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d, |
619 | GNUNET_TESTING_NotifyCompletion cb, | 613 | struct GNUNET_CONFIGURATION_Handle *cfg, |
620 | void *cb_cls); | 614 | GNUNET_TESTING_NotifyCompletion cb, |
615 | void *cb_cls); | ||
621 | 616 | ||
622 | /** | 617 | /** |
623 | * Stops a single service of a GNUnet daemon. Used like daemon_stop, | 618 | * Stops a single service of a GNUnet daemon. Used like daemon_stop, |
@@ -631,11 +626,12 @@ void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d, | |||
631 | * @param cb function called once the service was stopped | 626 | * @param cb function called once the service was stopped |
632 | * @param cb_cls closure for cb | 627 | * @param cb_cls closure for cb |
633 | */ | 628 | */ |
634 | void GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | 629 | void |
635 | char *service, | 630 | GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, |
636 | struct GNUNET_TIME_Relative timeout, | 631 | char *service, |
637 | GNUNET_TESTING_NotifyCompletion cb, | 632 | struct GNUNET_TIME_Relative timeout, |
638 | void *cb_cls); | 633 | GNUNET_TESTING_NotifyCompletion cb, |
634 | void *cb_cls); | ||
639 | 635 | ||
640 | /** | 636 | /** |
641 | * Read a testing hosts file based on a configuration. | 637 | * Read a testing hosts file based on a configuration. |
@@ -646,9 +642,8 @@ void GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, | |||
646 | * | 642 | * |
647 | * @return DLL of hosts on success, NULL on failure | 643 | * @return DLL of hosts on success, NULL on failure |
648 | */ | 644 | */ |
649 | struct GNUNET_TESTING_Host *GNUNET_TESTING_hosts_load (const struct | 645 | struct GNUNET_TESTING_Host * |
650 | GNUNET_CONFIGURATION_Handle | 646 | GNUNET_TESTING_hosts_load (const struct GNUNET_CONFIGURATION_Handle *cfg); |
651 | *cfg); | ||
652 | 647 | ||
653 | 648 | ||
654 | /** | 649 | /** |
@@ -678,31 +673,19 @@ struct GNUNET_TESTING_Host *GNUNET_TESTING_hosts_load (const struct | |||
678 | * | 673 | * |
679 | * @return NULL on error, otherwise handle to control peer group | 674 | * @return NULL on error, otherwise handle to control peer group |
680 | */ | 675 | */ |
681 | struct GNUNET_TESTING_PeerGroup *GNUNET_TESTING_daemons_start (const struct | 676 | struct GNUNET_TESTING_PeerGroup * |
682 | GNUNET_CONFIGURATION_Handle | 677 | GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
683 | *cfg, | 678 | unsigned int total, |
684 | unsigned int | 679 | unsigned int max_concurrent_connections, |
685 | total, | 680 | unsigned int max_concurrent_ssh, |
686 | unsigned int | 681 | struct GNUNET_TIME_Relative timeout, |
687 | max_concurrent_connections, | 682 | GNUNET_TESTING_NotifyHostkeyCreated |
688 | unsigned int | 683 | hostkey_callback, void *hostkey_cls, |
689 | max_concurrent_ssh, | 684 | GNUNET_TESTING_NotifyDaemonRunning cb, |
690 | struct | 685 | void *cb_cls, |
691 | GNUNET_TIME_Relative | 686 | GNUNET_TESTING_NotifyConnection connect_callback, |
692 | timeout, | 687 | void *connect_callback_cls, |
693 | GNUNET_TESTING_NotifyHostkeyCreated | 688 | const struct GNUNET_TESTING_Host *hostnames); |
694 | hostkey_callback, | ||
695 | void | ||
696 | *hostkey_cls, | ||
697 | GNUNET_TESTING_NotifyDaemonRunning | ||
698 | cb, void *cb_cls, | ||
699 | GNUNET_TESTING_NotifyConnection | ||
700 | connect_callback, | ||
701 | void | ||
702 | *connect_callback_cls, | ||
703 | const struct | ||
704 | GNUNET_TESTING_Host | ||
705 | *hostnames); | ||
706 | 689 | ||
707 | /** | 690 | /** |
708 | * Function which continues a peer group starting up | 691 | * Function which continues a peer group starting up |
@@ -710,8 +693,8 @@ struct GNUNET_TESTING_PeerGroup *GNUNET_TESTING_daemons_start (const struct | |||
710 | * | 693 | * |
711 | * @param pg the peer group to continue starting | 694 | * @param pg the peer group to continue starting |
712 | */ | 695 | */ |
713 | void GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup | 696 | void |
714 | *pg); | 697 | GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup *pg); |
715 | 698 | ||
716 | 699 | ||
717 | /** | 700 | /** |
@@ -728,13 +711,14 @@ void GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup | |||
728 | * @param cb function to call at the end | 711 | * @param cb function to call at the end |
729 | * @param cb_cls closure for cb | 712 | * @param cb_cls closure for cb |
730 | */ | 713 | */ |
731 | void GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | 714 | void |
732 | struct GNUNET_TESTING_Daemon *d2, | 715 | GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, |
733 | struct GNUNET_TIME_Relative timeout, | 716 | struct GNUNET_TESTING_Daemon *d2, |
734 | unsigned int max_connect_attempts, | 717 | struct GNUNET_TIME_Relative timeout, |
735 | int send_hello, | 718 | unsigned int max_connect_attempts, |
736 | GNUNET_TESTING_NotifyConnection cb, | 719 | int send_hello, |
737 | void *cb_cls); | 720 | GNUNET_TESTING_NotifyConnection cb, |
721 | void *cb_cls); | ||
738 | 722 | ||
739 | 723 | ||
740 | /** | 724 | /** |
@@ -744,9 +728,10 @@ void GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, | |||
744 | * @param callback function to call on completion (or failure) | 728 | * @param callback function to call on completion (or failure) |
745 | * @param callback_cls closure for the callback function | 729 | * @param callback_cls closure for the callback function |
746 | */ | 730 | */ |
747 | void GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg, | 731 | void |
748 | GNUNET_TESTING_NotifyCompletion callback, | 732 | GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg, |
749 | void *callback_cls); | 733 | GNUNET_TESTING_NotifyCompletion callback, |
734 | void *callback_cls); | ||
750 | 735 | ||
751 | 736 | ||
752 | /** | 737 | /** |
@@ -757,10 +742,10 @@ void GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg, | |||
757 | * @param cb callback to notify upon success or failure | 742 | * @param cb callback to notify upon success or failure |
758 | * @param cb_cls closure for cb | 743 | * @param cb_cls closure for cb |
759 | */ | 744 | */ |
760 | void GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, | 745 | void |
761 | struct GNUNET_TIME_Relative timeout, | 746 | GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, |
762 | GNUNET_TESTING_NotifyCompletion cb, | 747 | struct GNUNET_TIME_Relative timeout, |
763 | void *cb_cls); | 748 | GNUNET_TESTING_NotifyCompletion cb, void *cb_cls); |
764 | 749 | ||
765 | 750 | ||
766 | /** | 751 | /** |
@@ -770,8 +755,8 @@ void GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, | |||
770 | * | 755 | * |
771 | * @return the number of currently running peers in the peer group | 756 | * @return the number of currently running peers in the peer group |
772 | */ | 757 | */ |
773 | unsigned int GNUNET_TESTING_daemons_running (struct GNUNET_TESTING_PeerGroup | 758 | unsigned int |
774 | *pg); | 759 | GNUNET_TESTING_daemons_running (struct GNUNET_TESTING_PeerGroup *pg); |
775 | 760 | ||
776 | /** | 761 | /** |
777 | * Simulate churn by stopping some peers (and possibly | 762 | * Simulate churn by stopping some peers (and possibly |
@@ -796,12 +781,12 @@ unsigned int GNUNET_TESTING_daemons_running (struct GNUNET_TESTING_PeerGroup | |||
796 | * @param cb function to call at the end | 781 | * @param cb function to call at the end |
797 | * @param cb_cls closure for cb | 782 | * @param cb_cls closure for cb |
798 | */ | 783 | */ |
799 | void GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg, | 784 | void |
800 | char *service, unsigned int voff, | 785 | GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg, |
801 | unsigned int von, | 786 | char *service, unsigned int voff, |
802 | struct GNUNET_TIME_Relative timeout, | 787 | unsigned int von, |
803 | GNUNET_TESTING_NotifyCompletion cb, | 788 | struct GNUNET_TIME_Relative timeout, |
804 | void *cb_cls); | 789 | GNUNET_TESTING_NotifyCompletion cb, void *cb_cls); |
805 | /* | 790 | /* |
806 | * Start a given service for each of the peers in the peer group. | 791 | * Start a given service for each of the peers in the peer group. |
807 | * | 792 | * |
@@ -813,11 +798,12 @@ void GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg, | |||
813 | * @param cb_cls closure for cb | 798 | * @param cb_cls closure for cb |
814 | * | 799 | * |
815 | */ | 800 | */ |
816 | void GNUNET_TESTING_daemons_start_service (struct GNUNET_TESTING_PeerGroup *pg, | 801 | void |
817 | char *service, | 802 | GNUNET_TESTING_daemons_start_service (struct GNUNET_TESTING_PeerGroup *pg, |
818 | struct GNUNET_TIME_Relative timeout, | 803 | char *service, |
819 | GNUNET_TESTING_NotifyCompletion cb, | 804 | struct GNUNET_TIME_Relative timeout, |
820 | void *cb_cls); | 805 | GNUNET_TESTING_NotifyCompletion cb, |
806 | void *cb_cls); | ||
821 | 807 | ||
822 | /** | 808 | /** |
823 | * Callback function to process statistic values. | 809 | * Callback function to process statistic values. |
@@ -847,10 +833,11 @@ typedef int (*GNUNET_TESTING_STATISTICS_Iterator) (void *cls, | |||
847 | * @param proc processing function for each statistic retrieved | 833 | * @param proc processing function for each statistic retrieved |
848 | * @param cls closure to pass to proc | 834 | * @param cls closure to pass to proc |
849 | */ | 835 | */ |
850 | void GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg, | 836 | void |
851 | GNUNET_STATISTICS_Callback cont, | 837 | GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg, |
852 | GNUNET_TESTING_STATISTICS_Iterator proc, | 838 | GNUNET_STATISTICS_Callback cont, |
853 | void *cls); | 839 | GNUNET_TESTING_STATISTICS_Iterator proc, |
840 | void *cls); | ||
854 | 841 | ||
855 | /** | 842 | /** |
856 | * Topologies supported for testbeds. | 843 | * Topologies supported for testbeds. |
@@ -965,8 +952,9 @@ enum GNUNET_TESTING_TopologyOption | |||
965 | * @return GNUNET_YES if topology string matched a | 952 | * @return GNUNET_YES if topology string matched a |
966 | * known topology, GNUNET_NO if not | 953 | * known topology, GNUNET_NO if not |
967 | */ | 954 | */ |
968 | int GNUNET_TESTING_topology_get (enum GNUNET_TESTING_Topology *topology, | 955 | int |
969 | const char *topology_string); | 956 | GNUNET_TESTING_topology_get (enum GNUNET_TESTING_Topology *topology, |
957 | const char *topology_string); | ||
970 | 958 | ||
971 | /** | 959 | /** |
972 | * Get connect topology option from string input. | 960 | * Get connect topology option from string input. |
@@ -977,9 +965,10 @@ int GNUNET_TESTING_topology_get (enum GNUNET_TESTING_Topology *topology, | |||
977 | * @return GNUNET_YES if topology string matched a | 965 | * @return GNUNET_YES if topology string matched a |
978 | * known topology, GNUNET_NO if not | 966 | * known topology, GNUNET_NO if not |
979 | */ | 967 | */ |
980 | int GNUNET_TESTING_topology_option_get (enum GNUNET_TESTING_TopologyOption | 968 | int |
981 | *topology_option, | 969 | GNUNET_TESTING_topology_option_get (enum GNUNET_TESTING_TopologyOption |
982 | const char *topology_string); | 970 | *topology_option, |
971 | const char *topology_string); | ||
983 | 972 | ||
984 | 973 | ||
985 | /** | 974 | /** |
@@ -1018,13 +1007,11 @@ int GNUNET_TESTING_topology_option_get (enum GNUNET_TESTING_TopologyOption | |||
1018 | * @return the maximum number of connections were all allowed peers | 1007 | * @return the maximum number of connections were all allowed peers |
1019 | * connected to each other | 1008 | * connected to each other |
1020 | */ | 1009 | */ |
1021 | unsigned int GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup | 1010 | unsigned int |
1022 | *pg, | 1011 | GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg, |
1023 | enum GNUNET_TESTING_Topology | 1012 | enum GNUNET_TESTING_Topology topology, |
1024 | topology, | 1013 | enum GNUNET_TESTING_Topology restrict_topology, |
1025 | enum GNUNET_TESTING_Topology | 1014 | const char *restrict_transports); |
1026 | restrict_topology, | ||
1027 | const char *restrict_transports); | ||
1028 | 1015 | ||
1029 | /** | 1016 | /** |
1030 | * Iterate over all (running) peers in the peer group, retrieve | 1017 | * Iterate over all (running) peers in the peer group, retrieve |
@@ -1034,22 +1021,25 @@ unsigned int GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup | |||
1034 | * @param cb callback for topology information | 1021 | * @param cb callback for topology information |
1035 | * @param cls closure for callback | 1022 | * @param cls closure for callback |
1036 | */ | 1023 | */ |
1037 | void GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg, | 1024 | void |
1038 | GNUNET_TESTING_NotifyTopology cb, void *cls); | 1025 | GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg, |
1026 | GNUNET_TESTING_NotifyTopology cb, void *cls); | ||
1039 | 1027 | ||
1040 | /** | 1028 | /** |
1041 | * Stop the connection process temporarily. | 1029 | * Stop the connection process temporarily. |
1042 | * | 1030 | * |
1043 | * @param pg the peer group to stop connecting | 1031 | * @param pg the peer group to stop connecting |
1044 | */ | 1032 | */ |
1045 | void GNUNET_TESTING_stop_connections (struct GNUNET_TESTING_PeerGroup *pg); | 1033 | void |
1034 | GNUNET_TESTING_stop_connections (struct GNUNET_TESTING_PeerGroup *pg); | ||
1046 | 1035 | ||
1047 | /** | 1036 | /** |
1048 | * Resume the connection process. | 1037 | * Resume the connection process. |
1049 | * | 1038 | * |
1050 | * @param pg the peer group to resume connecting | 1039 | * @param pg the peer group to resume connecting |
1051 | */ | 1040 | */ |
1052 | void GNUNET_TESTING_resume_connections (struct GNUNET_TESTING_PeerGroup *pg); | 1041 | void |
1042 | GNUNET_TESTING_resume_connections (struct GNUNET_TESTING_PeerGroup *pg); | ||
1053 | 1043 | ||
1054 | /** | 1044 | /** |
1055 | * There are many ways to connect peers that are supported by this function. | 1045 | * There are many ways to connect peers that are supported by this function. |
@@ -1073,15 +1063,15 @@ void GNUNET_TESTING_resume_connections (struct GNUNET_TESTING_PeerGroup *pg); | |||
1073 | * | 1063 | * |
1074 | * @return the number of connections that will be attempted, GNUNET_SYSERR on error | 1064 | * @return the number of connections that will be attempted, GNUNET_SYSERR on error |
1075 | */ | 1065 | */ |
1076 | int GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg, | 1066 | int |
1077 | enum GNUNET_TESTING_Topology topology, | 1067 | GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg, |
1078 | enum GNUNET_TESTING_TopologyOption options, | 1068 | enum GNUNET_TESTING_Topology topology, |
1079 | double option_modifier, | 1069 | enum GNUNET_TESTING_TopologyOption options, |
1080 | struct GNUNET_TIME_Relative | 1070 | double option_modifier, |
1081 | connect_timeout, | 1071 | struct GNUNET_TIME_Relative connect_timeout, |
1082 | unsigned int connect_attempts, | 1072 | unsigned int connect_attempts, |
1083 | GNUNET_TESTING_NotifyCompletion | 1073 | GNUNET_TESTING_NotifyCompletion |
1084 | notify_callback, void *notify_cls); | 1074 | notify_callback, void *notify_cls); |
1085 | 1075 | ||
1086 | /** | 1076 | /** |
1087 | * Start or stop an individual peer from the given group. | 1077 | * Start or stop an individual peer from the given group. |
@@ -1093,11 +1083,11 @@ int GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
1093 | * @param cb function to call at the end | 1083 | * @param cb function to call at the end |
1094 | * @param cb_cls closure for cb | 1084 | * @param cb_cls closure for cb |
1095 | */ | 1085 | */ |
1096 | void GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, | 1086 | void |
1097 | unsigned int offset, int desired_status, | 1087 | GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, |
1098 | struct GNUNET_TIME_Relative timeout, | 1088 | unsigned int offset, int desired_status, |
1099 | GNUNET_TESTING_NotifyCompletion cb, | 1089 | struct GNUNET_TIME_Relative timeout, |
1100 | void *cb_cls); | 1090 | GNUNET_TESTING_NotifyCompletion cb, void *cb_cls); |
1101 | 1091 | ||
1102 | /** | 1092 | /** |
1103 | * Start a peer group with a given number of peers. Notify | 1093 | * Start a peer group with a given number of peers. Notify |
@@ -1116,23 +1106,14 @@ void GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, | |||
1116 | * | 1106 | * |
1117 | * @return NULL on error, otherwise handle to control peer group | 1107 | * @return NULL on error, otherwise handle to control peer group |
1118 | */ | 1108 | */ |
1119 | struct GNUNET_TESTING_PeerGroup *GNUNET_TESTING_peergroup_start (const struct | 1109 | struct GNUNET_TESTING_PeerGroup * |
1120 | GNUNET_CONFIGURATION_Handle | 1110 | GNUNET_TESTING_peergroup_start (const struct GNUNET_CONFIGURATION_Handle *cfg, |
1121 | *cfg, | 1111 | unsigned int total, |
1122 | unsigned int | 1112 | struct GNUNET_TIME_Relative timeout, |
1123 | total, | 1113 | GNUNET_TESTING_NotifyConnection connect_cb, |
1124 | struct | 1114 | GNUNET_TESTING_NotifyCompletion peergroup_cb, |
1125 | GNUNET_TIME_Relative | 1115 | void *peergroup_cls, |
1126 | timeout, | 1116 | const struct GNUNET_TESTING_Host *hostnames); |
1127 | GNUNET_TESTING_NotifyConnection | ||
1128 | connect_cb, | ||
1129 | GNUNET_TESTING_NotifyCompletion | ||
1130 | peergroup_cb, | ||
1131 | void | ||
1132 | *peergroup_cls, | ||
1133 | const struct | ||
1134 | GNUNET_TESTING_Host | ||
1135 | *hostnames); | ||
1136 | 1117 | ||
1137 | /** | 1118 | /** |
1138 | * Print current topology to a graphviz readable file. | 1119 | * Print current topology to a graphviz readable file. |
@@ -1143,11 +1124,11 @@ struct GNUNET_TESTING_PeerGroup *GNUNET_TESTING_peergroup_start (const struct | |||
1143 | * @param notify_cb_cls closure for notify_cb | 1124 | * @param notify_cb_cls closure for notify_cb |
1144 | * | 1125 | * |
1145 | */ | 1126 | */ |
1146 | void GNUNET_TESTING_peergroup_topology_to_file (struct GNUNET_TESTING_PeerGroup | 1127 | void |
1147 | *pg, | 1128 | GNUNET_TESTING_peergroup_topology_to_file (struct GNUNET_TESTING_PeerGroup *pg, |
1148 | const char *output_filename, | 1129 | const char *output_filename, |
1149 | GNUNET_TESTING_NotifyCompletion | 1130 | GNUNET_TESTING_NotifyCompletion |
1150 | notify_cb, void *notify_cb_cls); | 1131 | notify_cb, void *notify_cb_cls); |
1151 | 1132 | ||
1152 | 1133 | ||
1153 | #if 0 /* keep Emacsens' auto-indent happy */ | 1134 | #if 0 /* keep Emacsens' auto-indent happy */ |