aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_testing_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_testing_lib.h')
-rw-r--r--src/include/gnunet_testing_lib.h204
1 files changed, 96 insertions, 108 deletions
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h
index 1111f576c..cd673a082 100644
--- a/src/include/gnunet_testing_lib.h
+++ b/src/include/gnunet_testing_lib.h
@@ -490,8 +490,8 @@ struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_start (const struct
490 * 490 *
491 * @param daemon the daemon to finish starting 491 * @param daemon the daemon to finish starting
492 */ 492 */
493void 493void GNUNET_TESTING_daemon_continue_startup (struct GNUNET_TESTING_Daemon
494GNUNET_TESTING_daemon_continue_startup (struct GNUNET_TESTING_Daemon *daemon); 494 *daemon);
495 495
496/** 496/**
497 * Check whether the given daemon is running. 497 * Check whether the given daemon is running.
@@ -510,10 +510,9 @@ int GNUNET_TESTING_daemon_running (struct GNUNET_TESTING_Daemon *daemon);
510 * @param cb function called once the daemon is (re)started 510 * @param cb function called once the daemon is (re)started
511 * @param cb_cls closure for cb 511 * @param cb_cls closure for cb
512 */ 512 */
513void 513void GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d,
514GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d, 514 GNUNET_TESTING_NotifyDaemonRunning cb,
515 GNUNET_TESTING_NotifyDaemonRunning cb, 515 void *cb_cls);
516 void *cb_cls);
517 516
518/** 517/**
519 * Start a peer that has previously been stopped using the daemon_stop 518 * Start a peer that has previously been stopped using the daemon_stop
@@ -524,11 +523,10 @@ GNUNET_TESTING_daemon_restart (struct GNUNET_TESTING_Daemon *d,
524 * @param cb the callback for notification when the peer is running 523 * @param cb the callback for notification when the peer is running
525 * @param cb_cls closure for the callback 524 * @param cb_cls closure for the callback
526 */ 525 */
527void 526void GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon,
528GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon, 527 struct GNUNET_TIME_Relative timeout,
529 struct GNUNET_TIME_Relative timeout, 528 GNUNET_TESTING_NotifyDaemonRunning cb,
530 GNUNET_TESTING_NotifyDaemonRunning cb, 529 void *cb_cls);
531 void *cb_cls);
532 530
533/** 531/**
534 * Starts a GNUnet daemon's service. 532 * Starts a GNUnet daemon's service.
@@ -539,12 +537,11 @@ GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon,
539 * @param cb function called once gnunet-arm returns 537 * @param cb function called once gnunet-arm returns
540 * @param cb_cls closure for cb 538 * @param cb_cls closure for cb
541 */ 539 */
542void 540void GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d,
543GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d, 541 char *service,
544 char *service, 542 struct GNUNET_TIME_Relative timeout,
545 struct GNUNET_TIME_Relative timeout, 543 GNUNET_TESTING_NotifyDaemonRunning cb,
546 GNUNET_TESTING_NotifyDaemonRunning cb, 544 void *cb_cls);
547 void *cb_cls);
548 545
549/** 546/**
550 * Starts a GNUnet daemon's service which has been previously turned off. 547 * Starts a GNUnet daemon's service which has been previously turned off.
@@ -555,13 +552,12 @@ GNUNET_TESTING_daemon_start_service (struct GNUNET_TESTING_Daemon *d,
555 * @param cb function called once gnunet-arm returns 552 * @param cb function called once gnunet-arm returns
556 * @param cb_cls closure for cb 553 * @param cb_cls closure for cb
557 */ 554 */
558void 555void GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon
559GNUNET_TESTING_daemon_start_stopped_service (struct GNUNET_TESTING_Daemon *d, 556 *d, char *service,
560 char *service, 557 struct GNUNET_TIME_Relative
561 struct GNUNET_TIME_Relative 558 timeout,
562 timeout, 559 GNUNET_TESTING_NotifyDaemonRunning
563 GNUNET_TESTING_NotifyDaemonRunning 560 cb, void *cb_cls);
564 cb, void *cb_cls);
565 561
566/** 562/**
567 * Get a certain testing daemon handle. 563 * Get a certain testing daemon handle.
@@ -603,11 +599,11 @@ struct GNUNET_TESTING_Daemon *GNUNET_TESTING_daemon_get_by_id (struct
603 * @param allow_restart GNUNET_YES to restart peer later (using this API) 599 * @param allow_restart GNUNET_YES to restart peer later (using this API)
604 * GNUNET_NO to kill off and clean up for good 600 * GNUNET_NO to kill off and clean up for good
605 */ 601 */
606void 602void GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
607GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, 603 struct GNUNET_TIME_Relative timeout,
608 struct GNUNET_TIME_Relative timeout, 604 GNUNET_TESTING_NotifyCompletion cb,
609 GNUNET_TESTING_NotifyCompletion cb, void *cb_cls, 605 void *cb_cls, int delete_files,
610 int delete_files, int allow_restart); 606 int allow_restart);
611 607
612 608
613/** 609/**
@@ -635,12 +631,11 @@ void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
635 * @param cb function called once the service was stopped 631 * @param cb function called once the service was stopped
636 * @param cb_cls closure for cb 632 * @param cb_cls closure for cb
637 */ 633 */
638void 634void GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d,
639GNUNET_TESTING_daemon_stop_service (struct GNUNET_TESTING_Daemon *d, 635 char *service,
640 char *service, 636 struct GNUNET_TIME_Relative timeout,
641 struct GNUNET_TIME_Relative timeout, 637 GNUNET_TESTING_NotifyCompletion cb,
642 GNUNET_TESTING_NotifyCompletion cb, 638 void *cb_cls);
643 void *cb_cls);
644 639
645/** 640/**
646 * Read a testing hosts file based on a configuration. 641 * Read a testing hosts file based on a configuration.
@@ -715,8 +710,8 @@ struct GNUNET_TESTING_PeerGroup *GNUNET_TESTING_daemons_start (const struct
715 * 710 *
716 * @param pg the peer group to continue starting 711 * @param pg the peer group to continue starting
717 */ 712 */
718void 713void GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup
719GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup *pg); 714 *pg);
720 715
721 716
722/** 717/**
@@ -733,14 +728,13 @@ GNUNET_TESTING_daemons_continue_startup (struct GNUNET_TESTING_PeerGroup *pg);
733 * @param cb function to call at the end 728 * @param cb function to call at the end
734 * @param cb_cls closure for cb 729 * @param cb_cls closure for cb
735 */ 730 */
736void 731void GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
737GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1, 732 struct GNUNET_TESTING_Daemon *d2,
738 struct GNUNET_TESTING_Daemon *d2, 733 struct GNUNET_TIME_Relative timeout,
739 struct GNUNET_TIME_Relative timeout, 734 unsigned int max_connect_attempts,
740 unsigned int max_connect_attempts, 735 int send_hello,
741 int send_hello, 736 GNUNET_TESTING_NotifyConnection cb,
742 GNUNET_TESTING_NotifyConnection cb, 737 void *cb_cls);
743 void *cb_cls);
744 738
745 739
746/** 740/**
@@ -750,10 +744,9 @@ GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
750 * @param callback function to call on completion (or failure) 744 * @param callback function to call on completion (or failure)
751 * @param callback_cls closure for the callback function 745 * @param callback_cls closure for the callback function
752 */ 746 */
753void 747void GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg,
754GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg, 748 GNUNET_TESTING_NotifyCompletion callback,
755 GNUNET_TESTING_NotifyCompletion callback, 749 void *callback_cls);
756 void *callback_cls);
757 750
758 751
759/** 752/**
@@ -764,10 +757,10 @@ GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg,
764 * @param cb callback to notify upon success or failure 757 * @param cb callback to notify upon success or failure
765 * @param cb_cls closure for cb 758 * @param cb_cls closure for cb
766 */ 759 */
767void 760void GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg,
768GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, 761 struct GNUNET_TIME_Relative timeout,
769 struct GNUNET_TIME_Relative timeout, 762 GNUNET_TESTING_NotifyCompletion cb,
770 GNUNET_TESTING_NotifyCompletion cb, void *cb_cls); 763 void *cb_cls);
771 764
772 765
773/** 766/**
@@ -777,8 +770,8 @@ GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg,
777 * 770 *
778 * @return the number of currently running peers in the peer group 771 * @return the number of currently running peers in the peer group
779 */ 772 */
780unsigned int 773unsigned int GNUNET_TESTING_daemons_running (struct GNUNET_TESTING_PeerGroup
781GNUNET_TESTING_daemons_running (struct GNUNET_TESTING_PeerGroup *pg); 774 *pg);
782 775
783/** 776/**
784 * Simulate churn by stopping some peers (and possibly 777 * Simulate churn by stopping some peers (and possibly
@@ -803,13 +796,12 @@ GNUNET_TESTING_daemons_running (struct GNUNET_TESTING_PeerGroup *pg);
803 * @param cb function to call at the end 796 * @param cb function to call at the end
804 * @param cb_cls closure for cb 797 * @param cb_cls closure for cb
805 */ 798 */
806void 799void GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg,
807GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg, 800 char *service, unsigned int voff,
808 char *service, 801 unsigned int von,
809 unsigned int voff, 802 struct GNUNET_TIME_Relative timeout,
810 unsigned int von, 803 GNUNET_TESTING_NotifyCompletion cb,
811 struct GNUNET_TIME_Relative timeout, 804 void *cb_cls);
812 GNUNET_TESTING_NotifyCompletion cb, void *cb_cls);
813/* 805/*
814 * Start a given service for each of the peers in the peer group. 806 * Start a given service for each of the peers in the peer group.
815 * 807 *
@@ -821,12 +813,11 @@ GNUNET_TESTING_daemons_churn (struct GNUNET_TESTING_PeerGroup *pg,
821 * @param cb_cls closure for cb 813 * @param cb_cls closure for cb
822 * 814 *
823 */ 815 */
824void 816void GNUNET_TESTING_daemons_start_service (struct GNUNET_TESTING_PeerGroup *pg,
825GNUNET_TESTING_daemons_start_service (struct GNUNET_TESTING_PeerGroup *pg, 817 char *service,
826 char *service, 818 struct GNUNET_TIME_Relative timeout,
827 struct GNUNET_TIME_Relative timeout, 819 GNUNET_TESTING_NotifyCompletion cb,
828 GNUNET_TESTING_NotifyCompletion cb, 820 void *cb_cls);
829 void *cb_cls);
830 821
831/** 822/**
832 * Callback function to process statistic values. 823 * Callback function to process statistic values.
@@ -856,11 +847,10 @@ typedef int (*GNUNET_TESTING_STATISTICS_Iterator) (void *cls,
856 * @param proc processing function for each statistic retrieved 847 * @param proc processing function for each statistic retrieved
857 * @param cls closure to pass to proc 848 * @param cls closure to pass to proc
858 */ 849 */
859void 850void GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg,
860GNUNET_TESTING_get_statistics (struct GNUNET_TESTING_PeerGroup *pg, 851 GNUNET_STATISTICS_Callback cont,
861 GNUNET_STATISTICS_Callback cont, 852 GNUNET_TESTING_STATISTICS_Iterator proc,
862 GNUNET_TESTING_STATISTICS_Iterator proc, 853 void *cls);
863 void *cls);
864 854
865/** 855/**
866 * Topologies supported for testbeds. 856 * Topologies supported for testbeds.
@@ -975,9 +965,8 @@ enum GNUNET_TESTING_TopologyOption
975 * @return GNUNET_YES if topology string matched a 965 * @return GNUNET_YES if topology string matched a
976 * known topology, GNUNET_NO if not 966 * known topology, GNUNET_NO if not
977 */ 967 */
978int 968int GNUNET_TESTING_topology_get (enum GNUNET_TESTING_Topology *topology,
979GNUNET_TESTING_topology_get (enum GNUNET_TESTING_Topology *topology, 969 const char *topology_string);
980 const char *topology_string);
981 970
982/** 971/**
983 * Get connect topology option from string input. 972 * Get connect topology option from string input.
@@ -988,10 +977,9 @@ GNUNET_TESTING_topology_get (enum GNUNET_TESTING_Topology *topology,
988 * @return GNUNET_YES if topology string matched a 977 * @return GNUNET_YES if topology string matched a
989 * known topology, GNUNET_NO if not 978 * known topology, GNUNET_NO if not
990 */ 979 */
991int 980int GNUNET_TESTING_topology_option_get (enum GNUNET_TESTING_TopologyOption
992GNUNET_TESTING_topology_option_get (enum GNUNET_TESTING_TopologyOption 981 *topology_option,
993 *topology_option, 982 const char *topology_string);
994 const char *topology_string);
995 983
996 984
997/** 985/**
@@ -1030,11 +1018,13 @@ GNUNET_TESTING_topology_option_get (enum GNUNET_TESTING_TopologyOption
1030 * @return the maximum number of connections were all allowed peers 1018 * @return the maximum number of connections were all allowed peers
1031 * connected to each other 1019 * connected to each other
1032 */ 1020 */
1033unsigned int 1021unsigned int GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup
1034GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg, 1022 *pg,
1035 enum GNUNET_TESTING_Topology topology, 1023 enum GNUNET_TESTING_Topology
1036 enum GNUNET_TESTING_Topology restrict_topology, 1024 topology,
1037 const char *restrict_transports); 1025 enum GNUNET_TESTING_Topology
1026 restrict_topology,
1027 const char *restrict_transports);
1038 1028
1039/** 1029/**
1040 * Iterate over all (running) peers in the peer group, retrieve 1030 * Iterate over all (running) peers in the peer group, retrieve
@@ -1044,9 +1034,8 @@ GNUNET_TESTING_create_topology (struct GNUNET_TESTING_PeerGroup *pg,
1044 * @param cb callback for topology information 1034 * @param cb callback for topology information
1045 * @param cls closure for callback 1035 * @param cls closure for callback
1046 */ 1036 */
1047void 1037void GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg,
1048GNUNET_TESTING_get_topology (struct GNUNET_TESTING_PeerGroup *pg, 1038 GNUNET_TESTING_NotifyTopology cb, void *cls);
1049 GNUNET_TESTING_NotifyTopology cb, void *cls);
1050 1039
1051/** 1040/**
1052 * Stop the connection process temporarily. 1041 * Stop the connection process temporarily.
@@ -1084,15 +1073,15 @@ void GNUNET_TESTING_resume_connections (struct GNUNET_TESTING_PeerGroup *pg);
1084 * 1073 *
1085 * @return the number of connections that will be attempted, GNUNET_SYSERR on error 1074 * @return the number of connections that will be attempted, GNUNET_SYSERR on error
1086 */ 1075 */
1087int 1076int GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg,
1088GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg, 1077 enum GNUNET_TESTING_Topology topology,
1089 enum GNUNET_TESTING_Topology topology, 1078 enum GNUNET_TESTING_TopologyOption options,
1090 enum GNUNET_TESTING_TopologyOption options, 1079 double option_modifier,
1091 double option_modifier, 1080 struct GNUNET_TIME_Relative
1092 struct GNUNET_TIME_Relative connect_timeout, 1081 connect_timeout,
1093 unsigned int connect_attempts, 1082 unsigned int connect_attempts,
1094 GNUNET_TESTING_NotifyCompletion 1083 GNUNET_TESTING_NotifyCompletion
1095 notify_callback, void *notify_cls); 1084 notify_callback, void *notify_cls);
1096 1085
1097/** 1086/**
1098 * Start or stop an individual peer from the given group. 1087 * Start or stop an individual peer from the given group.
@@ -1104,12 +1093,11 @@ GNUNET_TESTING_connect_topology (struct GNUNET_TESTING_PeerGroup *pg,
1104 * @param cb function to call at the end 1093 * @param cb function to call at the end
1105 * @param cb_cls closure for cb 1094 * @param cb_cls closure for cb
1106 */ 1095 */
1107void 1096void GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg,
1108GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg, 1097 unsigned int offset, int desired_status,
1109 unsigned int offset, 1098 struct GNUNET_TIME_Relative timeout,
1110 int desired_status, 1099 GNUNET_TESTING_NotifyCompletion cb,
1111 struct GNUNET_TIME_Relative timeout, 1100 void *cb_cls);
1112 GNUNET_TESTING_NotifyCompletion cb, void *cb_cls);
1113 1101
1114/** 1102/**
1115 * Start a peer group with a given number of peers. Notify 1103 * Start a peer group with a given number of peers. Notify
@@ -1155,11 +1143,11 @@ struct GNUNET_TESTING_PeerGroup *GNUNET_TESTING_peergroup_start (const struct
1155 * @param notify_cb_cls closure for notify_cb 1143 * @param notify_cb_cls closure for notify_cb
1156 * 1144 *
1157 */ 1145 */
1158void 1146void GNUNET_TESTING_peergroup_topology_to_file (struct GNUNET_TESTING_PeerGroup
1159GNUNET_TESTING_peergroup_topology_to_file (struct GNUNET_TESTING_PeerGroup *pg, 1147 *pg,
1160 const char *output_filename, 1148 const char *output_filename,
1161 GNUNET_TESTING_NotifyCompletion 1149 GNUNET_TESTING_NotifyCompletion
1162 notify_cb, void *notify_cb_cls); 1150 notify_cb, void *notify_cb_cls);
1163 1151
1164 1152
1165#if 0 /* keep Emacsens' auto-indent happy */ 1153#if 0 /* keep Emacsens' auto-indent happy */