diff options
Diffstat (limited to 'src/include/gnunet_testing_netjail_lib.h')
-rw-r--r-- | src/include/gnunet_testing_netjail_lib.h | 91 |
1 files changed, 78 insertions, 13 deletions
diff --git a/src/include/gnunet_testing_netjail_lib.h b/src/include/gnunet_testing_netjail_lib.h index 3a5e9f749..334f43c88 100644 --- a/src/include/gnunet_testing_netjail_lib.h +++ b/src/include/gnunet_testing_netjail_lib.h | |||
@@ -24,8 +24,8 @@ | |||
24 | * @author Marcello Stanisci | 24 | * @author Marcello Stanisci |
25 | * @author t3sserakt | 25 | * @author t3sserakt |
26 | */ | 26 | */ |
27 | #ifndef GNUNET_TESTING_NG_LIB_H | 27 | #ifndef GNUNET_TESTING_NETJAIL_LIB_H |
28 | #define GNUNET_TESTING_NG_LIB_H | 28 | #define GNUNET_TESTING_NETJAIL_LIB_H |
29 | 29 | ||
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_testing_plugin.h" | 31 | #include "gnunet_testing_plugin.h" |
@@ -301,6 +301,28 @@ GNUNET_TESTING_calculate_num (struct | |||
301 | 301 | ||
302 | 302 | ||
303 | /** | 303 | /** |
304 | * Struct with information for callbacks. | ||
305 | * | ||
306 | */ | ||
307 | struct BlockState | ||
308 | { | ||
309 | /** | ||
310 | * Context for our asynchronous completion. | ||
311 | */ | ||
312 | struct GNUNET_TESTING_AsyncContext ac; | ||
313 | |||
314 | /** | ||
315 | * The label of this command. | ||
316 | */ | ||
317 | const char *label; | ||
318 | |||
319 | /** | ||
320 | * If this command will block. | ||
321 | */ | ||
322 | unsigned int asynchronous_finish; | ||
323 | }; | ||
324 | |||
325 | /** | ||
304 | * Struct to hold information for callbacks. | 326 | * Struct to hold information for callbacks. |
305 | * | 327 | * |
306 | */ | 328 | */ |
@@ -309,7 +331,7 @@ struct LocalPreparedState | |||
309 | /** | 331 | /** |
310 | * Context for our asynchronous completion. | 332 | * Context for our asynchronous completion. |
311 | */ | 333 | */ |
312 | struct GNUNET_TESTING_AsyncContext *ac; | 334 | struct GNUNET_TESTING_AsyncContext ac; |
313 | 335 | ||
314 | /** | 336 | /** |
315 | * Callback to write messages to the master loop. | 337 | * Callback to write messages to the master loop. |
@@ -319,11 +341,28 @@ struct LocalPreparedState | |||
319 | }; | 341 | }; |
320 | 342 | ||
321 | 343 | ||
344 | struct GNUNET_TESTING_Command | ||
345 | GNUNET_TESTING_cmd_system_destroy (const char *label, | ||
346 | const char *create_label); | ||
347 | |||
348 | |||
349 | struct GNUNET_TESTING_Command | ||
350 | GNUNET_TESTING_cmd_system_create (const char *label, | ||
351 | const char *testdir); | ||
352 | |||
353 | |||
354 | int | ||
355 | GNUNET_TESTING_get_trait_test_system (const struct | ||
356 | GNUNET_TESTING_Command *cmd, | ||
357 | struct GNUNET_TESTING_System **test_system); | ||
358 | |||
359 | |||
322 | /** | 360 | /** |
323 | * Create command. | 361 | * Create command. |
324 | * | 362 | * |
325 | * @param label name for command. | 363 | * @param label name for command. |
326 | * @param topology_config Configuration file for the test topology. | 364 | * @param topology_config Configuration file for the test topology. |
365 | * @param read_file Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data. | ||
327 | * @return command. | 366 | * @return command. |
328 | */ | 367 | */ |
329 | struct GNUNET_TESTING_Command | 368 | struct GNUNET_TESTING_Command |
@@ -335,27 +374,32 @@ GNUNET_TESTING_cmd_netjail_start (const char *label, | |||
335 | /** | 374 | /** |
336 | * Create command. | 375 | * Create command. |
337 | * | 376 | * |
338 | * @param label Name for the command. | 377 | * @param label name for command. |
339 | * @param topology The complete topology information. | 378 | * @param topology_config Configuration file for the test topology. |
379 | * @param read_file Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data. | ||
340 | * @return command. | 380 | * @return command. |
341 | */ | 381 | */ |
342 | struct GNUNET_TESTING_Command | 382 | struct GNUNET_TESTING_Command |
343 | GNUNET_TESTING_cmd_netjail_start_testing_system ( | 383 | GNUNET_TESTING_cmd_netjail_stop (const char *label, |
344 | const char *label, | 384 | char *topology_config, |
345 | struct GNUNET_TESTING_NetjailTopology *topology); | 385 | unsigned int *read_file); |
346 | 386 | ||
347 | 387 | ||
348 | /** | 388 | /** |
349 | * Create command. | 389 | * Create command. |
350 | * | 390 | * |
351 | * @param label name for command. | 391 | * @param label Name for the command. |
352 | * @param topology_config Configuration file for the test topology. | 392 | * @param topology The complete topology information. |
393 | * @param read_file Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data. | ||
394 | * @param topology_data If read_file is GNUNET_NO, topology_data holds the string with the topology. | ||
353 | * @return command. | 395 | * @return command. |
354 | */ | 396 | */ |
355 | struct GNUNET_TESTING_Command | 397 | struct GNUNET_TESTING_Command |
356 | GNUNET_TESTING_cmd_netjail_stop (const char *label, | 398 | GNUNET_TESTING_cmd_netjail_start_testing_system ( |
357 | char *topology_config, | 399 | const char *label, |
358 | unsigned int *read_file); | 400 | struct GNUNET_TESTING_NetjailTopology *topology, |
401 | unsigned int *read_file, | ||
402 | char *topology_data); | ||
359 | 403 | ||
360 | 404 | ||
361 | /** | 405 | /** |
@@ -414,10 +458,19 @@ GNUNET_TESTING_cmd_block_until_all_peers_started ( | |||
414 | unsigned int *all_peers_started); | 458 | unsigned int *all_peers_started); |
415 | 459 | ||
416 | 460 | ||
461 | /** | ||
462 | * Create command. | ||
463 | * | ||
464 | * @param label name for command. | ||
465 | * @param all_peers_started Flag which will be set from outside. | ||
466 | * @param asynchronous_finish If GNUNET_YES this command will not block. | ||
467 | * @return command. | ||
468 | */ | ||
417 | struct GNUNET_TESTING_Command | 469 | struct GNUNET_TESTING_Command |
418 | GNUNET_TESTING_cmd_block_until_external_trigger ( | 470 | GNUNET_TESTING_cmd_block_until_external_trigger ( |
419 | const char *label); | 471 | const char *label); |
420 | 472 | ||
473 | |||
421 | struct GNUNET_TESTING_Command | 474 | struct GNUNET_TESTING_Command |
422 | GNUNET_TESTING_cmd_send_peer_ready (const char *label, | 475 | GNUNET_TESTING_cmd_send_peer_ready (const char *label, |
423 | TESTING_CMD_HELPER_write_cb write_message); | 476 | TESTING_CMD_HELPER_write_cb write_message); |
@@ -460,4 +513,16 @@ GNUNET_TESTING_get_trait_local_prepared_state ( | |||
460 | const struct GNUNET_TESTING_Command *cmd, | 513 | const struct GNUNET_TESTING_Command *cmd, |
461 | struct LocalPreparedState **lfs); | 514 | struct LocalPreparedState **lfs); |
462 | 515 | ||
516 | |||
517 | /** | ||
518 | * Function to get the trait with the internal command state BlockState. | ||
519 | * | ||
520 | * * @param[out] ac struct BlockState. | ||
521 | * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. | ||
522 | */ | ||
523 | int | ||
524 | GNUNET_TESTING_get_trait_block_state ( | ||
525 | const struct GNUNET_TESTING_Command *cmd, | ||
526 | struct BlockState **bs); | ||
527 | |||
463 | #endif | 528 | #endif |