diff options
author | t3sserakt <t3ss@posteo.de> | 2021-12-01 14:06:12 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-12-01 14:06:12 +0100 |
commit | 1408842544b1cbea01efc636bdcb6be73a4e20a9 (patch) | |
tree | 238ee0392d0597d297f6dcfa613ea0000a01d6d3 /src/transport/transport-testing-cmds.h | |
parent | 5b4c1620bb7ed90d7bb26484c0a39807bb7f1dd5 (diff) | |
download | gnunet-1408842544b1cbea01efc636bdcb6be73a4e20a9.tar.gz gnunet-1408842544b1cbea01efc636bdcb6be73a4e20a9.zip |
- using the big macrofication of the traits from GNU Taler now
Diffstat (limited to 'src/transport/transport-testing-cmds.h')
-rw-r--r-- | src/transport/transport-testing-cmds.h | 105 |
1 files changed, 52 insertions, 53 deletions
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h index d64279aeb..af6f47962 100644 --- a/src/transport/transport-testing-cmds.h +++ b/src/transport/transport-testing-cmds.h | |||
@@ -49,7 +49,7 @@ struct ConnectPeersState | |||
49 | /** | 49 | /** |
50 | * The testing system of this node. | 50 | * The testing system of this node. |
51 | */ | 51 | */ |
52 | struct GNUNET_TESTING_System *tl_system; | 52 | const struct GNUNET_TESTING_System *tl_system; |
53 | 53 | ||
54 | // Label of the cmd which started the test system. | 54 | // Label of the cmd which started the test system. |
55 | const char *create_label; | 55 | const char *create_label; |
@@ -180,7 +180,7 @@ struct StartPeerState | |||
180 | 180 | ||
181 | struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; | 181 | struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; |
182 | 182 | ||
183 | struct GNUNET_TESTING_System *tl_system; | 183 | const struct GNUNET_TESTING_System *tl_system; |
184 | 184 | ||
185 | GNUNET_TRANSPORT_notify_connect_cb notify_connect; | 185 | GNUNET_TRANSPORT_notify_connect_cb notify_connect; |
186 | 186 | ||
@@ -192,26 +192,6 @@ struct StartPeerState | |||
192 | 192 | ||
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Function to get the trait with the struct ConnectPeersState. | ||
196 | * | ||
197 | * @param[out] sps struct ConnectPeersState. | ||
198 | * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. | ||
199 | * | ||
200 | */ | ||
201 | int | ||
202 | GNUNET_TRANSPORT_get_trait_connect_peer_state ( | ||
203 | const struct GNUNET_TESTING_Command *cmd, | ||
204 | struct ConnectPeersState **cps); | ||
205 | |||
206 | |||
207 | int | ||
208 | GNUNET_TRANSPORT_get_trait_state (const struct | ||
209 | GNUNET_TESTING_Command | ||
210 | *cmd, | ||
211 | struct StartPeerState **sps); | ||
212 | |||
213 | |||
214 | /** | ||
215 | * Create command. | 195 | * Create command. |
216 | * | 196 | * |
217 | * @param label name for command. | 197 | * @param label name for command. |
@@ -305,43 +285,62 @@ GNUNET_TRANSPORT_cmd_backchannel_check (const char *label, | |||
305 | topology); | 285 | topology); |
306 | 286 | ||
307 | 287 | ||
288 | /** | ||
289 | * Create headers for a trait with name @a name for | ||
290 | * statically allocated data of type @a type. | ||
291 | */ | ||
292 | #define GNUNET_TRANSPORT_MAKE_DECL_SIMPLE_TRAIT(name,type) \ | ||
293 | enum GNUNET_GenericReturnValue \ | ||
294 | GNUNET_TRANSPORT_get_trait_ ## name ( \ | ||
295 | const struct GNUNET_TESTING_Command *cmd, \ | ||
296 | type **ret); \ | ||
297 | struct GNUNET_TESTING_Trait \ | ||
298 | GNUNET_TRANSPORT_make_trait_ ## name ( \ | ||
299 | type * value); | ||
308 | 300 | ||
309 | 301 | ||
302 | /** | ||
303 | * Create C implementation for a trait with name @a name for statically | ||
304 | * allocated data of type @a type. | ||
305 | */ | ||
306 | #define GNUNET_TRANSPORT_MAKE_IMPL_SIMPLE_TRAIT(name,type) \ | ||
307 | enum GNUNET_GenericReturnValue \ | ||
308 | GNUNET_TRANSPORT_get_trait_ ## name ( \ | ||
309 | const struct GNUNET_TESTING_Command *cmd, \ | ||
310 | type **ret) \ | ||
311 | { \ | ||
312 | if (NULL == cmd->traits) return GNUNET_SYSERR; \ | ||
313 | return cmd->traits (cmd->cls, \ | ||
314 | (const void **) ret, \ | ||
315 | GNUNET_S (name), \ | ||
316 | 0); \ | ||
317 | } \ | ||
318 | struct GNUNET_TESTING_Trait \ | ||
319 | GNUNET_TRANSPORT_make_trait_ ## name ( \ | ||
320 | type * value) \ | ||
321 | { \ | ||
322 | struct GNUNET_TESTING_Trait ret = { \ | ||
323 | .trait_name = GNUNET_S (name), \ | ||
324 | .ptr = (const void *) value \ | ||
325 | }; \ | ||
326 | return ret; \ | ||
327 | } | ||
310 | 328 | ||
311 | int | ||
312 | GNUNET_TRANSPORT_get_trait_peer_id (const struct | ||
313 | GNUNET_TESTING_Command *cmd, | ||
314 | struct GNUNET_PeerIdentity **id); | ||
315 | |||
316 | |||
317 | int | ||
318 | GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct | ||
319 | GNUNET_TESTING_Command | ||
320 | *cmd, | ||
321 | struct | ||
322 | GNUNET_CONTAINER_MultiShortmap | ||
323 | * | ||
324 | * | ||
325 | connected_peers_map); | ||
326 | int | ||
327 | GNUNET_TRANSPORT_get_trait_hello_size (const struct | ||
328 | GNUNET_TESTING_Command | ||
329 | *cmd, | ||
330 | size_t **hello_size); | ||
331 | 329 | ||
332 | int | 330 | /** |
333 | GNUNET_TRANSPORT_get_trait_hello (const struct | 331 | * Call #op on all simple traits. |
334 | GNUNET_TESTING_Command | 332 | */ |
335 | *cmd, | 333 | #define GNUNET_TRANSPORT_SIMPLE_TRAITS(op) \ |
336 | char **hello); | 334 | op (peer_id, const struct GNUNET_PeerIdentity) \ |
335 | op (connected_peers_map, const struct GNUNET_CONTAINER_MultiShortmap) \ | ||
336 | op (hello_size, const size_t) \ | ||
337 | op (hello, const char) \ | ||
338 | op (application_handle, const struct GNUNET_TRANSPORT_ApplicationHandle) \ | ||
339 | op (connect_peer_state, const struct ConnectPeersState) \ | ||
340 | op (state, const struct StartPeerState) | ||
337 | 341 | ||
342 | GNUNET_TRANSPORT_SIMPLE_TRAITS (GNUNET_TRANSPORT_MAKE_DECL_SIMPLE_TRAIT) | ||
338 | 343 | ||
339 | int | ||
340 | GNUNET_TRANSPORT_get_trait_application_handle (const struct | ||
341 | GNUNET_TESTING_Command *cmd, | ||
342 | struct | ||
343 | GNUNET_TRANSPORT_ApplicationHandle | ||
344 | **ah); | ||
345 | 344 | ||
346 | #endif | 345 | #endif |
347 | /* end of transport_testing.h */ | 346 | /* end of transport_testing.h */ |