diff options
Diffstat (limited to 'src/include/gnunet_testing_ng_lib.h')
-rw-r--r-- | src/include/gnunet_testing_ng_lib.h | 196 |
1 files changed, 90 insertions, 106 deletions
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h index 363c7ff0c..4ef9aac18 100644 --- a/src/include/gnunet_testing_ng_lib.h +++ b/src/include/gnunet_testing_ng_lib.h | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | |||
21 | /** | 20 | /** |
22 | * @brief API for writing an interpreter to test GNUnet components | 21 | * @brief API for writing an interpreter to test GNUnet components |
23 | * @author Christian Grothoff <christian@grothoff.org> | 22 | * @author Christian Grothoff <christian@grothoff.org> |
@@ -49,6 +48,7 @@ | |||
49 | 48 | ||
50 | /** | 49 | /** |
51 | * Router of a network namespace. | 50 | * Router of a network namespace. |
51 | * // FIXME: this does not belong here! | ||
52 | */ | 52 | */ |
53 | struct GNUNET_TESTING_NetjailRouter | 53 | struct GNUNET_TESTING_NetjailRouter |
54 | { | 54 | { |
@@ -63,8 +63,10 @@ struct GNUNET_TESTING_NetjailRouter | |||
63 | unsigned int udp_port; | 63 | unsigned int udp_port; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | |||
66 | /** | 67 | /** |
67 | * Enum for the different types of nodes. | 68 | * Enum for the different types of nodes. |
69 | * // FIXME: this does not belong here! | ||
68 | */ | 70 | */ |
69 | enum GNUNET_TESTING_NODE_TYPE | 71 | enum GNUNET_TESTING_NODE_TYPE |
70 | { | 72 | { |
@@ -79,6 +81,8 @@ enum GNUNET_TESTING_NODE_TYPE | |||
79 | GNUNET_TESTING_GLOBAL_NODE | 81 | GNUNET_TESTING_GLOBAL_NODE |
80 | }; | 82 | }; |
81 | 83 | ||
84 | |||
85 | // FIXME: this does not belong here! | ||
82 | struct GNUNET_TESTING_ADDRESS_PREFIX | 86 | struct GNUNET_TESTING_ADDRESS_PREFIX |
83 | { | 87 | { |
84 | /** | 88 | /** |
@@ -97,10 +101,13 @@ struct GNUNET_TESTING_ADDRESS_PREFIX | |||
97 | char *address_prefix; | 101 | char *address_prefix; |
98 | }; | 102 | }; |
99 | 103 | ||
104 | |||
105 | // FIXME: this does not belong here! | ||
100 | struct GNUNET_TESTING_NetjailNode; | 106 | struct GNUNET_TESTING_NetjailNode; |
101 | 107 | ||
102 | /** | 108 | /** |
103 | * Connection to another node. | 109 | * Connection to another node. |
110 | * // FIXME: this does not belong here! | ||
104 | */ | 111 | */ |
105 | struct GNUNET_TESTING_NodeConnection | 112 | struct GNUNET_TESTING_NodeConnection |
106 | { | 113 | { |
@@ -148,6 +155,7 @@ struct GNUNET_TESTING_NodeConnection | |||
148 | 155 | ||
149 | /** | 156 | /** |
150 | * Node in the netjail topology. | 157 | * Node in the netjail topology. |
158 | * // FIXME: this does not belong here! | ||
151 | */ | 159 | */ |
152 | struct GNUNET_TESTING_NetjailNode | 160 | struct GNUNET_TESTING_NetjailNode |
153 | { | 161 | { |
@@ -185,6 +193,7 @@ struct GNUNET_TESTING_NetjailNode | |||
185 | 193 | ||
186 | /** | 194 | /** |
187 | * Namespace in a topology. | 195 | * Namespace in a topology. |
196 | * // FIXME: this does not belong here! | ||
188 | */ | 197 | */ |
189 | struct GNUNET_TESTING_NetjailNamespace | 198 | struct GNUNET_TESTING_NetjailNamespace |
190 | { | 199 | { |
@@ -206,6 +215,7 @@ struct GNUNET_TESTING_NetjailNamespace | |||
206 | 215 | ||
207 | /** | 216 | /** |
208 | * Toplogy of our netjail setup. | 217 | * Toplogy of our netjail setup. |
218 | * // FIXME: this does not belong here! | ||
209 | */ | 219 | */ |
210 | struct GNUNET_TESTING_NetjailTopology | 220 | struct GNUNET_TESTING_NetjailTopology |
211 | { | 221 | { |
@@ -318,6 +328,9 @@ struct GNUNET_TESTING_Command | |||
318 | (*cleanup)(void *cls); | 328 | (*cleanup)(void *cls); |
319 | 329 | ||
320 | /** | 330 | /** |
331 | * FIXME: logic is often the same! | ||
332 | * => Think about refactoring API to reduce duplication! | ||
333 | * | ||
321 | * Extract information from a command that is useful for other | 334 | * Extract information from a command that is useful for other |
322 | * commands. | 335 | * commands. |
323 | * | 336 | * |
@@ -356,13 +369,6 @@ struct GNUNET_TESTING_Command | |||
356 | struct GNUNET_TIME_Absolute last_req_time; | 369 | struct GNUNET_TIME_Absolute last_req_time; |
357 | 370 | ||
358 | /** | 371 | /** |
359 | * How often did we try to execute this command? (In case it is a request | ||
360 | * that is repated.) Note that a command must have some built-in retry | ||
361 | * mechanism for this value to be useful. | ||
362 | */ | ||
363 | unsigned int num_tries; | ||
364 | |||
365 | /** | ||
366 | * In case @e asynchronous_finish is true, how long should we wait for this | 372 | * In case @e asynchronous_finish is true, how long should we wait for this |
367 | * command to complete? If @e finish did not complete after this amount of | 373 | * command to complete? If @e finish did not complete after this amount of |
368 | * time, the interpreter will fail. Should be set generously to ensure | 374 | * time, the interpreter will fail. Should be set generously to ensure |
@@ -371,6 +377,13 @@ struct GNUNET_TESTING_Command | |||
371 | struct GNUNET_TIME_Relative default_timeout; | 377 | struct GNUNET_TIME_Relative default_timeout; |
372 | 378 | ||
373 | /** | 379 | /** |
380 | * How often did we try to execute this command? (In case it is a request | ||
381 | * that is repated.) Note that a command must have some built-in retry | ||
382 | * mechanism for this value to be useful. | ||
383 | */ | ||
384 | unsigned int num_tries; | ||
385 | |||
386 | /** | ||
374 | * If "true", the interpreter should not immediately call | 387 | * If "true", the interpreter should not immediately call |
375 | * @e finish, even if @e finish is non-NULL. Otherwise, | 388 | * @e finish, even if @e finish is non-NULL. Otherwise, |
376 | * #TALER_TESTING_cmd_finish() must be used | 389 | * #TALER_TESTING_cmd_finish() must be used |
@@ -466,22 +479,32 @@ GNUNET_TESTING_cmd_rewind_ip (const char *label, | |||
466 | 479 | ||
467 | 480 | ||
468 | /** | 481 | /** |
482 | * Function called with the final result of the test. | ||
483 | * | ||
484 | * @param cls closure | ||
485 | * @param rv #GNUNET_OK if the test passed | ||
486 | */ | ||
487 | typedef void | ||
488 | (*GNUNET_TESTING_ResultCallback)(void *cls, | ||
489 | enum GNUNET_GenericReturnValue rv); | ||
490 | |||
491 | |||
492 | /** | ||
469 | * Run the testsuite. Note, CMDs are copied into | 493 | * Run the testsuite. Note, CMDs are copied into |
470 | * the interpreter state because they are _usually_ | 494 | * the interpreter state because they are _usually_ |
471 | * defined into the "run" method that returns after | 495 | * defined into the "run" method that returns after |
472 | * having scheduled the test interpreter. | 496 | * having scheduled the test interpreter. |
473 | * | 497 | * |
474 | * @param cfg_name name of configuration file to use | ||
475 | * @param commands the list of command to execute | 498 | * @param commands the list of command to execute |
476 | * @param timeout how long to wait for each command to execute | 499 | * @param timeout how long to wait for each command to execute |
477 | * @return #GNUNET_OK if all is okay, != #GNUNET_OK otherwise. | 500 | * @param rc function to call with the final result |
478 | * non-GNUNET_OK codes are #GNUNET_SYSERR most of the | 501 | * @param rc_cls closure for @a rc |
479 | * times. | ||
480 | */ | 502 | */ |
481 | enum GNUNET_GenericReturnValue | 503 | void |
482 | GNUNET_TESTING_run (const char *cfg_filename, | 504 | GNUNET_TESTING_run (struct GNUNET_TESTING_Command *commands, |
483 | struct GNUNET_TESTING_Command *commands, | 505 | struct GNUNET_TIME_Relative timeout, |
484 | struct GNUNET_TIME_Relative timeout); | 506 | GNUNET_TESTING_ResultCallback rc, |
507 | void *rc_cls); | ||
485 | 508 | ||
486 | 509 | ||
487 | /** | 510 | /** |
@@ -489,14 +512,12 @@ GNUNET_TESTING_run (const char *cfg_filename, | |||
489 | * run the testsuite. Return 0 upon success. | 512 | * run the testsuite. Return 0 upon success. |
490 | * Expected to be called directly from main(). | 513 | * Expected to be called directly from main(). |
491 | * | 514 | * |
492 | * @param cfg_name name of configuration file to use | ||
493 | * @param commands the list of command to execute | 515 | * @param commands the list of command to execute |
494 | * @param timeout how long to wait for each command to execute | 516 | * @param timeout how long to wait for each command to execute |
495 | * @return EXIT_SUCCESS on success, EXIT_FAILURE on failure | 517 | * @return EXIT_SUCCESS on success, EXIT_FAILURE on failure |
496 | */ | 518 | */ |
497 | int | 519 | int |
498 | GNUNET_TESTING_main (const char *cfg_filename, | 520 | GNUNET_TESTING_main (struct GNUNET_TESTING_Command *commands, |
499 | struct GNUNET_TESTING_Command *commands, | ||
500 | struct GNUNET_TIME_Relative timeout); | 521 | struct GNUNET_TIME_Relative timeout); |
501 | 522 | ||
502 | 523 | ||
@@ -505,6 +526,8 @@ GNUNET_TESTING_main (const char *cfg_filename, | |||
505 | * | 526 | * |
506 | * @param prog program's name to look into | 527 | * @param prog program's name to look into |
507 | * @param marker chunk to find in @a prog | 528 | * @param marker chunk to find in @a prog |
529 | * // FIXME: this does not belong here! => libgnunetutil, maybe? | ||
530 | * // FIXME: return bool? document return value! | ||
508 | */ | 531 | */ |
509 | int | 532 | int |
510 | GNUNET_TESTING_has_in_name (const char *prog, | 533 | GNUNET_TESTING_has_in_name (const char *prog, |
@@ -518,7 +541,7 @@ GNUNET_TESTING_has_in_name (const char *prog, | |||
518 | * | 541 | * |
519 | * @param label command label. | 542 | * @param label command label. |
520 | * @param process_label label of a command that has a process trait | 543 | * @param process_label label of a command that has a process trait |
521 | * @param process_index index of the process trait at @a process_label | 544 | * @param process_index index of the process trait at @a process_label // FIXME: enum? needed? |
522 | * @param signal signal to send to @a process. | 545 | * @param signal signal to send to @a process. |
523 | * @return the command. | 546 | * @return the command. |
524 | */ | 547 | */ |
@@ -557,49 +580,8 @@ GNUNET_TESTING_cmd_batch (const char *label, | |||
557 | 580 | ||
558 | 581 | ||
559 | /** | 582 | /** |
560 | * Test if this command is a batch command. | ||
561 | * | ||
562 | * @return false if not, true if it is a batch command | ||
563 | */ | ||
564 | // TODO: figure out if this needs to be exposed in the public API. | ||
565 | int | ||
566 | GNUNET_TESTING_cmd_is_batch (const struct GNUNET_TESTING_Command *cmd); | ||
567 | |||
568 | |||
569 | /** | ||
570 | * Advance internal pointer to next command. | ||
571 | * | ||
572 | * @param is interpreter state. | ||
573 | */ | ||
574 | // TODO: figure out if this needs to be exposed in the public API. | ||
575 | void | ||
576 | GNUNET_TESTING_cmd_batch_next (struct GNUNET_TESTING_Interpreter *is); | ||
577 | |||
578 | |||
579 | /** | ||
580 | * Obtain what command the batch is at. | ||
581 | * | ||
582 | * @return cmd current batch command | ||
583 | */ | ||
584 | // TODO: figure out if this needs to be exposed in the public API. | ||
585 | struct GNUNET_TESTING_Command * | ||
586 | GNUNET_TESTING_cmd_batch_get_current (const struct GNUNET_TESTING_Command *cmd); | ||
587 | |||
588 | |||
589 | /** | ||
590 | * Set what command the batch should be at. | ||
591 | * | ||
592 | * @param cmd current batch command | ||
593 | * @param new_ip where to move the IP | ||
594 | */ | ||
595 | // TODO: figure out if this needs to be exposed in the public API. | ||
596 | void | ||
597 | GNUNET_TESTING_cmd_batch_set_current (const struct GNUNET_TESTING_Command *cmd, | ||
598 | unsigned int new_ip); | ||
599 | |||
600 | |||
601 | /** | ||
602 | * Performance counter. | 583 | * Performance counter. |
584 | * // FIXME: this might not belong here! | ||
603 | */ | 585 | */ |
604 | struct GNUNET_TESTING_Timer | 586 | struct GNUNET_TESTING_Timer |
605 | { | 587 | { |
@@ -695,7 +677,7 @@ GNUNET_TESTING_trait_end (void); | |||
695 | * @param index index number of the trait to extract. | 677 | * @param index index number of the trait to extract. |
696 | * @return #GNUNET_OK when the trait is found. | 678 | * @return #GNUNET_OK when the trait is found. |
697 | */ | 679 | */ |
698 | int | 680 | enum GNUNET_GenericReturnValue |
699 | GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | 681 | GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, |
700 | const void **ret, | 682 | const void **ret, |
701 | const char *trait, | 683 | const char *trait, |
@@ -709,12 +691,12 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | |||
709 | * | 691 | * |
710 | * @param cmd command to extract trait from. | 692 | * @param cmd command to extract trait from. |
711 | * @param index which process to pick if @a cmd | 693 | * @param index which process to pick if @a cmd |
712 | * has multiple on offer. | 694 | * has multiple on offer. -- FIXME: remove? |
713 | * @param[out] processp set to the address of the pointer to the | 695 | * @param[out] processp set to the address of the pointer to the |
714 | * process. | 696 | * process. |
715 | * @return #GNUNET_OK on success. | 697 | * @return #GNUNET_OK on success. |
716 | */ | 698 | */ |
717 | int | 699 | enum GNUNET_GenericReturnValue |
718 | GNUNET_TESTING_get_trait_process (const struct GNUNET_TESTING_Command *cmd, | 700 | GNUNET_TESTING_get_trait_process (const struct GNUNET_TESTING_Command *cmd, |
719 | unsigned int index, | 701 | unsigned int index, |
720 | struct GNUNET_OS_Process ***processp); | 702 | struct GNUNET_OS_Process ***processp); |
@@ -724,7 +706,7 @@ GNUNET_TESTING_get_trait_process (const struct GNUNET_TESTING_Command *cmd, | |||
724 | * Offer location where a command stores a pointer to a process. | 706 | * Offer location where a command stores a pointer to a process. |
725 | * | 707 | * |
726 | * @param index offered location index number, in case there are | 708 | * @param index offered location index number, in case there are |
727 | * multiple on offer. | 709 | * multiple on offer. // FIXME: remove? |
728 | * @param processp process location to offer. | 710 | * @param processp process location to offer. |
729 | * @return the trait. | 711 | * @return the trait. |
730 | */ | 712 | */ |
@@ -736,7 +718,7 @@ GNUNET_TESTING_make_trait_process (unsigned int index, | |||
736 | /** | 718 | /** |
737 | * Offer number trait, 32-bit version. | 719 | * Offer number trait, 32-bit version. |
738 | * | 720 | * |
739 | * @param index the number's index number. | 721 | * @param index the number's index number. // FIXME: introduce enum? |
740 | * @param n number to offer. | 722 | * @param n number to offer. |
741 | */ | 723 | */ |
742 | struct GNUNET_TESTING_Trait | 724 | struct GNUNET_TESTING_Trait |
@@ -748,11 +730,11 @@ GNUNET_TESTING_make_trait_uint32 (unsigned int index, | |||
748 | * Obtain a "number" value from @a cmd, 32-bit version. | 730 | * Obtain a "number" value from @a cmd, 32-bit version. |
749 | * | 731 | * |
750 | * @param cmd command to extract the number from. | 732 | * @param cmd command to extract the number from. |
751 | * @param index the number's index number. | 733 | * @param index the number's index number. // FIXME: introduce enum? |
752 | * @param[out] n set to the number coming from @a cmd. | 734 | * @param[out] n set to the number coming from @a cmd. |
753 | * @return #GNUNET_OK on success. | 735 | * @return #GNUNET_OK on success. |
754 | */ | 736 | */ |
755 | int | 737 | enum GNUNET_GenericReturnValue |
756 | GNUNET_TESTING_get_trait_uint32 (const struct GNUNET_TESTING_Command *cmd, | 738 | GNUNET_TESTING_get_trait_uint32 (const struct GNUNET_TESTING_Command *cmd, |
757 | unsigned int index, | 739 | unsigned int index, |
758 | const uint32_t **n); | 740 | const uint32_t **n); |
@@ -761,7 +743,7 @@ GNUNET_TESTING_get_trait_uint32 (const struct GNUNET_TESTING_Command *cmd, | |||
761 | /** | 743 | /** |
762 | * Offer number trait, 64-bit version. | 744 | * Offer number trait, 64-bit version. |
763 | * | 745 | * |
764 | * @param index the number's index number. | 746 | * @param index the number's index number. // FIXME: introduce enum? |
765 | * @param n number to offer. | 747 | * @param n number to offer. |
766 | */ | 748 | */ |
767 | struct GNUNET_TESTING_Trait | 749 | struct GNUNET_TESTING_Trait |
@@ -773,11 +755,11 @@ GNUNET_TESTING_make_trait_uint64 (unsigned int index, | |||
773 | * Obtain a "number" value from @a cmd, 64-bit version. | 755 | * Obtain a "number" value from @a cmd, 64-bit version. |
774 | * | 756 | * |
775 | * @param cmd command to extract the number from. | 757 | * @param cmd command to extract the number from. |
776 | * @param index the number's index number. | 758 | * @param index the number's index number. // FIXME: introduce enum? |
777 | * @param[out] n set to the number coming from @a cmd. | 759 | * @param[out] n set to the number coming from @a cmd. |
778 | * @return #GNUNET_OK on success. | 760 | * @return #GNUNET_OK on success. |
779 | */ | 761 | */ |
780 | int | 762 | enum GNUNET_GenericReturnValue |
781 | GNUNET_TESTING_get_trait_uint64 (const struct GNUNET_TESTING_Command *cmd, | 763 | GNUNET_TESTING_get_trait_uint64 (const struct GNUNET_TESTING_Command *cmd, |
782 | unsigned int index, | 764 | unsigned int index, |
783 | const uint64_t **n); | 765 | const uint64_t **n); |
@@ -786,7 +768,7 @@ GNUNET_TESTING_get_trait_uint64 (const struct GNUNET_TESTING_Command *cmd, | |||
786 | /** | 768 | /** |
787 | * Offer number trait, 64-bit signed version. | 769 | * Offer number trait, 64-bit signed version. |
788 | * | 770 | * |
789 | * @param index the number's index number. | 771 | * @param index the number's index number. // FIXME: introduce enum? |
790 | * @param n number to offer. | 772 | * @param n number to offer. |
791 | */ | 773 | */ |
792 | struct GNUNET_TESTING_Trait | 774 | struct GNUNET_TESTING_Trait |
@@ -798,11 +780,11 @@ GNUNET_TESTING_make_trait_int64 (unsigned int index, | |||
798 | * Obtain a "number" value from @a cmd, 64-bit signed version. | 780 | * Obtain a "number" value from @a cmd, 64-bit signed version. |
799 | * | 781 | * |
800 | * @param cmd command to extract the number from. | 782 | * @param cmd command to extract the number from. |
801 | * @param index the number's index number. | 783 | * @param index the number's index number. // FIXME: introduce enum? |
802 | * @param[out] n set to the number coming from @a cmd. | 784 | * @param[out] n set to the number coming from @a cmd. |
803 | * @return #GNUNET_OK on success. | 785 | * @return #GNUNET_OK on success. |
804 | */ | 786 | */ |
805 | int | 787 | enum GNUNET_GenericReturnValue |
806 | GNUNET_TESTING_get_trait_int64 (const struct GNUNET_TESTING_Command *cmd, | 788 | GNUNET_TESTING_get_trait_int64 (const struct GNUNET_TESTING_Command *cmd, |
807 | unsigned int index, | 789 | unsigned int index, |
808 | const int64_t **n); | 790 | const int64_t **n); |
@@ -812,7 +794,7 @@ GNUNET_TESTING_get_trait_int64 (const struct GNUNET_TESTING_Command *cmd, | |||
812 | * Offer a number. | 794 | * Offer a number. |
813 | * | 795 | * |
814 | * @param index the number's index number. | 796 | * @param index the number's index number. |
815 | * @param n the number to offer. | 797 | * @param n the number to offer. // FIXME: introduce enum? |
816 | * @return #GNUNET_OK on success. | 798 | * @return #GNUNET_OK on success. |
817 | */ | 799 | */ |
818 | struct GNUNET_TESTING_Trait | 800 | struct GNUNET_TESTING_Trait |
@@ -824,11 +806,11 @@ GNUNET_TESTING_make_trait_uint (unsigned int index, | |||
824 | * Obtain a number from @a cmd. | 806 | * Obtain a number from @a cmd. |
825 | * | 807 | * |
826 | * @param cmd command to extract the number from. | 808 | * @param cmd command to extract the number from. |
827 | * @param index the number's index number. | 809 | * @param index the number's index number. // FIXME: introduce enum? |
828 | * @param[out] n set to the number coming from @a cmd. | 810 | * @param[out] n set to the number coming from @a cmd. |
829 | * @return #GNUNET_OK on success. | 811 | * @return #GNUNET_OK on success. |
830 | */ | 812 | */ |
831 | int | 813 | enum GNUNET_GenericReturnValue |
832 | GNUNET_TESTING_get_trait_uint (const struct GNUNET_TESTING_Command *cmd, | 814 | GNUNET_TESTING_get_trait_uint (const struct GNUNET_TESTING_Command *cmd, |
833 | unsigned int index, | 815 | unsigned int index, |
834 | const unsigned int **n); | 816 | const unsigned int **n); |
@@ -838,12 +820,12 @@ GNUNET_TESTING_get_trait_uint (const struct GNUNET_TESTING_Command *cmd, | |||
838 | * | 820 | * |
839 | * @param cmd command to extract the subject from. | 821 | * @param cmd command to extract the subject from. |
840 | * @param index index number associated with the transfer | 822 | * @param index index number associated with the transfer |
841 | * subject to offer. | 823 | * subject to offer. // FIXME: introduce enum? |
842 | * @param[out] s where to write the offered | 824 | * @param[out] s where to write the offered |
843 | * string. | 825 | * string. |
844 | * @return #GNUNET_OK on success. | 826 | * @return #GNUNET_OK on success. |
845 | */ | 827 | */ |
846 | int | 828 | enum GNUNET_GenericReturnValue |
847 | GNUNET_TESTING_get_trait_string ( | 829 | GNUNET_TESTING_get_trait_string ( |
848 | const struct GNUNET_TESTING_Command *cmd, | 830 | const struct GNUNET_TESTING_Command *cmd, |
849 | unsigned int index, | 831 | unsigned int index, |
@@ -854,7 +836,7 @@ GNUNET_TESTING_get_trait_string ( | |||
854 | * Offer string subject. | 836 | * Offer string subject. |
855 | * | 837 | * |
856 | * @param index index number associated with the transfer | 838 | * @param index index number associated with the transfer |
857 | * subject being offered. | 839 | * subject being offered. // FIXME: introduce enum? |
858 | * @param s string to offer. | 840 | * @param s string to offer. |
859 | * @return the trait. | 841 | * @return the trait. |
860 | */ | 842 | */ |
@@ -868,9 +850,8 @@ GNUNET_TESTING_make_trait_string (unsigned int index, | |||
868 | * @param index always zero. Commands offering this | 850 | * @param index always zero. Commands offering this |
869 | * kind of traits do not need this index. For | 851 | * kind of traits do not need this index. For |
870 | * example, a "meta" CMD returns always the | 852 | * example, a "meta" CMD returns always the |
871 | * CMD currently being executed. | 853 | * CMD currently being executed. FIXME: remove! |
872 | * @param cmd wire details to offer. | 854 | * @param cmd wire details to offer. |
873 | * | ||
874 | * @return the trait. | 855 | * @return the trait. |
875 | */ | 856 | */ |
876 | struct GNUNET_TESTING_Trait | 857 | struct GNUNET_TESTING_Trait |
@@ -885,11 +866,11 @@ GNUNET_TESTING_make_trait_cmd (unsigned int index, | |||
885 | * @param index always zero. Commands offering this | 866 | * @param index always zero. Commands offering this |
886 | * kind of traits do not need this index. For | 867 | * kind of traits do not need this index. For |
887 | * example, a "meta" CMD returns always the | 868 | * example, a "meta" CMD returns always the |
888 | * CMD currently being executed. | 869 | * CMD currently being executed. FIXME: remove! |
889 | * @param[out] _cmd where to write the wire details. | 870 | * @param[out] _cmd where to write the wire details. |
890 | * @return #GNUNET_OK on success. | 871 | * @return #GNUNET_OK on success. |
891 | */ | 872 | */ |
892 | int | 873 | enum GNUNET_GenericReturnValue |
893 | GNUNET_TESTING_get_trait_cmd (const struct GNUNET_TESTING_Command *cmd, | 874 | GNUNET_TESTING_get_trait_cmd (const struct GNUNET_TESTING_Command *cmd, |
894 | unsigned int index, | 875 | unsigned int index, |
895 | struct GNUNET_TESTING_Command **_cmd); | 876 | struct GNUNET_TESTING_Command **_cmd); |
@@ -900,11 +881,11 @@ GNUNET_TESTING_get_trait_cmd (const struct GNUNET_TESTING_Command *cmd, | |||
900 | * | 881 | * |
901 | * @param cmd command to extract the uuid from. | 882 | * @param cmd command to extract the uuid from. |
902 | * @param index which amount to pick if @a cmd has multiple | 883 | * @param index which amount to pick if @a cmd has multiple |
903 | * on offer | 884 | * on offer // FIXME: introduce enum? |
904 | * @param[out] uuid where to write the uuid. | 885 | * @param[out] uuid where to write the uuid. |
905 | * @return #GNUNET_OK on success. | 886 | * @return #GNUNET_OK on success. |
906 | */ | 887 | */ |
907 | int | 888 | enum GNUNET_GenericReturnValue |
908 | GNUNET_TESTING_get_trait_uuid (const struct GNUNET_TESTING_Command *cmd, | 889 | GNUNET_TESTING_get_trait_uuid (const struct GNUNET_TESTING_Command *cmd, |
909 | unsigned int index, | 890 | unsigned int index, |
910 | struct GNUNET_Uuid **uuid); | 891 | struct GNUNET_Uuid **uuid); |
@@ -914,9 +895,8 @@ GNUNET_TESTING_get_trait_uuid (const struct GNUNET_TESTING_Command *cmd, | |||
914 | * Offer a uuid in a trait. | 895 | * Offer a uuid in a trait. |
915 | * | 896 | * |
916 | * @param index which uuid to offer, in case there are | 897 | * @param index which uuid to offer, in case there are |
917 | * multiple available. | 898 | * multiple available. // FIXME: introduce enum? |
918 | * @param uuid the uuid to offer. | 899 | * @param uuid the uuid to offer. |
919 | * | ||
920 | * @return the trait. | 900 | * @return the trait. |
921 | */ | 901 | */ |
922 | struct GNUNET_TESTING_Trait | 902 | struct GNUNET_TESTING_Trait |
@@ -929,11 +909,11 @@ GNUNET_TESTING_make_trait_uuid (unsigned int index, | |||
929 | * | 909 | * |
930 | * @param cmd command to extract trait from | 910 | * @param cmd command to extract trait from |
931 | * @param index which time stamp to pick if | 911 | * @param index which time stamp to pick if |
932 | * @a cmd has multiple on offer. | 912 | * @a cmd has multiple on offer // FIXME: introduce enum? |
933 | * @param[out] time set to the wanted WTID. | 913 | * @param[out] time set to the wanted WTID. |
934 | * @return #GNUNET_OK on success | 914 | * @return #GNUNET_OK on success |
935 | */ | 915 | */ |
936 | int | 916 | enum GNUNET_GenericReturnValue |
937 | GNUNET_TESTING_get_trait_absolute_time ( | 917 | GNUNET_TESTING_get_trait_absolute_time ( |
938 | const struct GNUNET_TESTING_Command *cmd, | 918 | const struct GNUNET_TESTING_Command *cmd, |
939 | unsigned int index, | 919 | unsigned int index, |
@@ -982,6 +962,9 @@ GNUNET_TESTING_make_trait_relative_time ( | |||
982 | const struct GNUNET_TIME_Relative *time); | 962 | const struct GNUNET_TIME_Relative *time); |
983 | 963 | ||
984 | 964 | ||
965 | // FIXME: move these commands into a separate libgnunetestingnetjail lib or so! | ||
966 | |||
967 | |||
985 | /** | 968 | /** |
986 | * Create command. | 969 | * Create command. |
987 | * | 970 | * |
@@ -1133,7 +1116,9 @@ GNUNET_TESTING_cmd_stop_testing_system_v2 (const char *label, | |||
1133 | const char *topology_config); | 1116 | const char *topology_config); |
1134 | 1117 | ||
1135 | 1118 | ||
1136 | int | 1119 | |
1120 | // FIXME: document! | ||
1121 | enum GNUNET_GenericReturnValue | ||
1137 | GNUNET_TESTING_get_trait_helper_handles (const struct | 1122 | GNUNET_TESTING_get_trait_helper_handles (const struct |
1138 | GNUNET_TESTING_Command *cmd, | 1123 | GNUNET_TESTING_Command *cmd, |
1139 | struct GNUNET_HELPER_Handle ***helper); | 1124 | struct GNUNET_HELPER_Handle ***helper); |
@@ -1146,31 +1131,30 @@ GNUNET_TESTING_get_trait_helper_handles (const struct | |||
1146 | * @param pt pointer to message. | 1131 | * @param pt pointer to message. |
1147 | * @return #GNUNET_OK on success. | 1132 | * @return #GNUNET_OK on success. |
1148 | */ | 1133 | */ |
1149 | int | 1134 | enum GNUNET_GenericReturnValue |
1150 | GNUNET_TESTING_get_trait_helper_handles_v2 (const struct | 1135 | GNUNET_TESTING_get_trait_helper_handles_v2 ( |
1151 | GNUNET_TESTING_Command *cmd, | 1136 | const struct GNUNET_TESTING_Command *cmd, |
1152 | struct GNUNET_HELPER_Handle *** | 1137 | struct GNUNET_HELPER_Handle ***helper); |
1153 | helper); | ||
1154 | 1138 | ||
1155 | 1139 | ||
1156 | struct GNUNET_TESTING_Command | 1140 | struct GNUNET_TESTING_Command |
1157 | GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label, | 1141 | GNUNET_TESTING_cmd_block_until_all_peers_started ( |
1158 | unsigned int * | 1142 | const char *label, |
1159 | all_peers_started); | 1143 | unsigned int *all_peers_started); |
1160 | 1144 | ||
1161 | 1145 | ||
1162 | struct GNUNET_TESTING_Command | 1146 | struct GNUNET_TESTING_Command |
1163 | GNUNET_TESTING_cmd_block_until_external_trigger (const char *label, | 1147 | GNUNET_TESTING_cmd_block_until_external_trigger ( |
1164 | unsigned int * | 1148 | const char *label, |
1165 | stop_blocking); | 1149 | unsigned int *stop_blocking); |
1166 | 1150 | ||
1167 | struct GNUNET_TESTING_Command | 1151 | struct GNUNET_TESTING_Command |
1168 | GNUNET_TESTING_cmd_send_peer_ready (const char *label, | 1152 | GNUNET_TESTING_cmd_send_peer_ready (const char *label, |
1169 | TESTING_CMD_HELPER_write_cb write_message); | 1153 | TESTING_CMD_HELPER_write_cb write_message); |
1170 | 1154 | ||
1171 | struct GNUNET_TESTING_Command | 1155 | struct GNUNET_TESTING_Command |
1172 | GNUNET_TESTING_cmd_local_test_finished (const char *label, | 1156 | GNUNET_TESTING_cmd_local_test_finished ( |
1173 | TESTING_CMD_HELPER_write_cb | 1157 | const char *label, |
1174 | write_message); | 1158 | TESTING_CMD_HELPER_write_cb write_message); |
1175 | 1159 | ||
1176 | #endif | 1160 | #endif |