diff options
author | t3sserakt <t3ss@posteo.de> | 2023-10-03 17:17:16 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2023-10-03 17:17:16 +0200 |
commit | 6f68c34aa3deed8e1b5df30d3de1342386523920 (patch) | |
tree | 940221996f82d1edd77530ac2b1abbb61ccf08ac /src/include/gnunet_testing_ng_lib.h | |
parent | ed76bf2ece671e9543477a9bb9130dfbe5fa5a4d (diff) | |
parent | 109f3188ba65b788990427d6d26ba8874a9b84f5 (diff) | |
download | gnunet-6f68c34aa3deed8e1b5df30d3de1342386523920.tar.gz gnunet-6f68c34aa3deed8e1b5df30d3de1342386523920.zip |
Merge branch 'master' into l20integration
Diffstat (limited to 'src/include/gnunet_testing_ng_lib.h')
-rw-r--r-- | src/include/gnunet_testing_ng_lib.h | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h index eff45498b..07cdac962 100644 --- a/src/include/gnunet_testing_ng_lib.h +++ b/src/include/gnunet_testing_ng_lib.h | |||
@@ -76,7 +76,7 @@ struct GNUNET_TESTING_AsyncContext | |||
76 | /** | 76 | /** |
77 | * Interpreter we are part of. | 77 | * Interpreter we are part of. |
78 | */ | 78 | */ |
79 | struct GNUNET_TESTING_Interpreter *is; | 79 | struct GNUNET_TESTING_Interpreter *is; // Why needed? When available? |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Function to call when done. | 82 | * Function to call when done. |
@@ -96,18 +96,21 @@ struct GNUNET_TESTING_AsyncContext | |||
96 | enum GNUNET_GenericReturnValue finished; | 96 | enum GNUNET_GenericReturnValue finished; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | |||
99 | typedef void | 100 | typedef void |
100 | (*GNUNET_TESTING_CommandRunRoutine)(void *cls, | 101 | (*GNUNET_TESTING_CommandRunRoutine)(void *cls, |
101 | struct GNUNET_TESTING_Interpreter *is); | 102 | struct GNUNET_TESTING_Interpreter *is); |
102 | 103 | ||
104 | |||
103 | typedef void | 105 | typedef void |
104 | (*GNUNET_TESTING_CommandCleanupRoutine)(void *cls); | 106 | (*GNUNET_TESTING_CommandCleanupRoutine)(void *cls); |
105 | 107 | ||
106 | typedef enum GNUNET_GenericReturnValue | 108 | |
107 | (*GNUNET_TESTING_CommandGetTraits)(void *cls, | 109 | typedef enum GNUNET_GenericReturnValue |
108 | const void **ret, | 110 | (*GNUNET_TESTING_CommandGetTraits) (void *cls, |
109 | const char *trait, | 111 | const void **ret, |
110 | unsigned int index); | 112 | const char *trait, |
113 | unsigned int index); | ||
111 | 114 | ||
112 | /** | 115 | /** |
113 | * Create a new command | 116 | * Create a new command |
@@ -246,6 +249,7 @@ struct GNUNET_TESTING_Command | |||
246 | * @param label label of the command to lookup. | 249 | * @param label label of the command to lookup. |
247 | * @return the command, if it is found, or NULL. | 250 | * @return the command, if it is found, or NULL. |
248 | */ | 251 | */ |
252 | // FIXME: think harder about whether this is actually needed, likely not. | ||
249 | const struct GNUNET_TESTING_Command * | 253 | const struct GNUNET_TESTING_Command * |
250 | GNUNET_TESTING_interpreter_lookup_future_command ( | 254 | GNUNET_TESTING_interpreter_lookup_future_command ( |
251 | struct GNUNET_TESTING_Interpreter *is, | 255 | struct GNUNET_TESTING_Interpreter *is, |
@@ -327,10 +331,13 @@ GNUNET_TESTING_cmd_end (void); | |||
327 | 331 | ||
328 | 332 | ||
329 | /** | 333 | /** |
330 | * Turn asynchronous command into non blocking command by setting asynchronous_finish to true. | 334 | * Turn asynchronous command into non blocking command by setting |
331 | * FIXME: what is this API doing? Is it returning a new cmd which is unblocking? | 335 | * asynchronous_finish to true. Modifies (and then returns) @a cmd simply |
332 | * Is it modifying cmd? | 336 | * setting the bit. By default, most commands are blocking, and by wrapping |
333 | * Looking at the code, it both modifying cmd AND returning a copy oO | 337 | * the command construction in this function a blocking command can be turned |
338 | * into an asynchronous command where the interpreter continues after | ||
339 | * initiating the asynchronous action. Does nothing if the command is | ||
340 | * fundamentally synchronous. | ||
334 | * | 341 | * |
335 | * @param cmd command to make synchronous. | 342 | * @param cmd command to make synchronous. |
336 | * @return a finish-command. | 343 | * @return a finish-command. |
@@ -894,11 +901,11 @@ struct GNUNET_TESTING_StartPeerState | |||
894 | */ | 901 | */ |
895 | #define GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(name,type) \ | 902 | #define GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(name,type) \ |
896 | enum GNUNET_GenericReturnValue \ | 903 | enum GNUNET_GenericReturnValue \ |
897 | GNUNET_TESTING_get_trait_ ## name ( \ | 904 | GNUNET_TESTING_get_trait_ ## name ( \ |
898 | const struct GNUNET_TESTING_Command *cmd, \ | 905 | const struct GNUNET_TESTING_Command *cmd, \ |
899 | type **ret); \ | 906 | type **ret); \ |
900 | struct GNUNET_TESTING_Trait \ | 907 | struct GNUNET_TESTING_Trait \ |
901 | GNUNET_TESTING_make_trait_ ## name ( \ | 908 | GNUNET_TESTING_make_trait_ ## name ( \ |
902 | type * value); | 909 | type * value); |
903 | 910 | ||
904 | 911 | ||
@@ -908,9 +915,9 @@ struct GNUNET_TESTING_StartPeerState | |||
908 | */ | 915 | */ |
909 | #define GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT(name,type) \ | 916 | #define GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT(name,type) \ |
910 | enum GNUNET_GenericReturnValue \ | 917 | enum GNUNET_GenericReturnValue \ |
911 | GNUNET_TESTING_get_trait_ ## name ( \ | 918 | GNUNET_TESTING_get_trait_ ## name ( \ |
912 | const struct GNUNET_TESTING_Command *cmd, \ | 919 | const struct GNUNET_TESTING_Command *cmd, \ |
913 | type **ret) \ | 920 | type * *ret) \ |
914 | { \ | 921 | { \ |
915 | if (NULL == cmd->traits) return GNUNET_SYSERR; \ | 922 | if (NULL == cmd->traits) return GNUNET_SYSERR; \ |
916 | return cmd->traits (cmd->cls, \ | 923 | return cmd->traits (cmd->cls, \ |
@@ -919,7 +926,7 @@ struct GNUNET_TESTING_StartPeerState | |||
919 | 0); \ | 926 | 0); \ |
920 | } \ | 927 | } \ |
921 | struct GNUNET_TESTING_Trait \ | 928 | struct GNUNET_TESTING_Trait \ |
922 | GNUNET_TESTING_make_trait_ ## name ( \ | 929 | GNUNET_TESTING_make_trait_ ## name ( \ |
923 | type * value) \ | 930 | type * value) \ |
924 | { \ | 931 | { \ |
925 | struct GNUNET_TESTING_Trait ret = { \ | 932 | struct GNUNET_TESTING_Trait ret = { \ |
@@ -936,14 +943,14 @@ struct GNUNET_TESTING_StartPeerState | |||
936 | */ | 943 | */ |
937 | #define GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT(name,type) \ | 944 | #define GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT(name,type) \ |
938 | enum GNUNET_GenericReturnValue \ | 945 | enum GNUNET_GenericReturnValue \ |
939 | GNUNET_TESTING_get_trait_ ## name ( \ | 946 | GNUNET_TESTING_get_trait_ ## name ( \ |
940 | const struct GNUNET_TESTING_Command *cmd, \ | 947 | const struct GNUNET_TESTING_Command *cmd, \ |
941 | unsigned int index, \ | 948 | unsigned int index, \ |
942 | type **ret); \ | 949 | type **ret); \ |
943 | struct GNUNET_TESTING_Trait \ | 950 | struct GNUNET_TESTING_Trait \ |
944 | GNUNET_TESTING_make_trait_ ## name ( \ | 951 | GNUNET_TESTING_make_trait_ ## name ( \ |
945 | unsigned int index, \ | 952 | unsigned int index, \ |
946 | type * value); | 953 | type *value); |
947 | 954 | ||
948 | 955 | ||
949 | /** | 956 | /** |
@@ -952,10 +959,10 @@ struct GNUNET_TESTING_StartPeerState | |||
952 | */ | 959 | */ |
953 | #define GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT(name,type) \ | 960 | #define GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT(name,type) \ |
954 | enum GNUNET_GenericReturnValue \ | 961 | enum GNUNET_GenericReturnValue \ |
955 | GNUNET_TESTING_get_trait_ ## name ( \ | 962 | GNUNET_TESTING_get_trait_ ## name ( \ |
956 | const struct GNUNET_TESTING_Command *cmd, \ | 963 | const struct GNUNET_TESTING_Command *cmd, \ |
957 | unsigned int index, \ | 964 | unsigned int index, \ |
958 | type **ret) \ | 965 | type * *ret) \ |
959 | { \ | 966 | { \ |
960 | if (NULL == cmd->traits) return GNUNET_SYSERR; \ | 967 | if (NULL == cmd->traits) return GNUNET_SYSERR; \ |
961 | return cmd->traits (cmd->cls, \ | 968 | return cmd->traits (cmd->cls, \ |
@@ -964,7 +971,7 @@ struct GNUNET_TESTING_StartPeerState | |||
964 | index); \ | 971 | index); \ |
965 | } \ | 972 | } \ |
966 | struct GNUNET_TESTING_Trait \ | 973 | struct GNUNET_TESTING_Trait \ |
967 | GNUNET_TESTING_make_trait_ ## name ( \ | 974 | GNUNET_TESTING_make_trait_ ## name ( \ |
968 | unsigned int index, \ | 975 | unsigned int index, \ |
969 | type * value) \ | 976 | type * value) \ |
970 | { \ | 977 | { \ |