Command to start the netjail peers. More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
#include "testing_api_barrier.h"
#include "testing_api_loop.h"
#include "testing_cmds.h"
#include "testing_api_topology.h"
Go to the source code of this file.
Data Structures | |
struct | NetJailState |
Struct to hold information for callbacks. More... | |
struct | HelperState |
struct | TestingSystemCount |
Struct containing the number of the netjail node and the NetJailState which will be handed to callbacks specific to a test environment. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) |
Generic logging shortcut. More... | |
Functions | |
static void | clear_msg (void *cls, enum GNUNET_GenericReturnValue result) |
Continuation function from GNUNET_HELPER_send() More... | |
static void | handle_helper_barrier_reached (void *cls, const struct GNUNET_TESTING_CommandBarrierReached *rm) |
static void | handle_helper_local_finished (void *cls, const struct GNUNET_TESTING_CommandLocalFinished *lf) |
static enum GNUNET_GenericReturnValue | helper_mst (void *cls, const struct GNUNET_MessageHeader *message) |
Functions with this signature are called whenever a complete message is received by the tokenizer. More... | |
static void | exp_cb (void *cls) |
Callback called if there was an exception during execution of the helper. More... | |
static enum GNUNET_GenericReturnValue | add_barrier (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static bool | send_start_messages (struct NetJailState *ns, struct GNUNET_HELPER_Handle *helper) |
static bool | start_helper (struct NetJailState *ns, unsigned int script_num) |
Function which start a single helper process. More... | |
static void | do_timeout (void *cls) |
Function run when the cmd terminates (good or bad) with timeout. More... | |
static int | start_peer (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static int | start_subnets (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static int | start_carriers (void *cls, const struct GNUNET_ShortHashCode *key, void *value) |
static void | netjail_exec_run (void *cls, struct GNUNET_TESTING_Interpreter *is) |
This function starts a helper process for each node. More... | |
static void | netjail_exec_cleanup (void *cls) |
Code to clean up resource this cmd used. More... | |
static enum GNUNET_GenericReturnValue | netjail_exec_traits (void *cls, const void **ret, const char *trait, unsigned int index) |
This function prepares an array with traits. More... | |
struct GNUNET_TESTING_Command | GNUNET_TESTING_cmd_netjail_start_helpers (const char *label, const char *topology_cmd_label, struct GNUNET_TIME_Relative timeout) |
Create command. More... | |
Variables | |
unsigned int | node_number |
The network namespace number of a node. More... | |
Command to start the netjail peers.
Definition in file testing_api_cmd_netjail_start_cmds_helper.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log (kind, __VA_ARGS__) |
Generic logging shortcut.
Definition at line 37 of file testing_api_cmd_netjail_start_cmds_helper.c.
|
static |
Continuation function from GNUNET_HELPER_send()
cls | closure |
result | GNUNET_OK on success, GNUNET_NO if helper process died GNUNET_SYSERR during GNUNET_HELPER_stop |
Definition at line 178 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_assert, GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_OK, GNUNET_TESTING_FAIL, ns, TestingSystemCount::ns, result, and TestingSystemCount::shandle.
Referenced by send_start_messages().
|
static |
Definition at line 202 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_TESTING_CommandBarrierReached::barrier_key, GNUNET_TESTING_Barrier::cnt_waiting, GNUNET_TESTING_Barrier::expected_reaches, GNUNET_array_grow, GNUNET_assert, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE, GNUNET_TESTING_async_fail(), GNUNET_TESTING_async_finish(), GNUNET_TESTING_get_barrier2_(), GNUNET_TESTING_loop_notify_children_(), GNUNET_TESTING_loop_notify_parent_(), GNUNET_TESTING_CommandBarrierReached::header, GNUNET_TESTING_CommandBarrierSatisfied::header, GNUNET_TESTING_Barrier::inherited, ns, HelperState::ns, GNUNET_TESTING_Barrier::reached, GNUNET_TESTING_Barrier::satisfied, GNUNET_MessageHeader::size, and GNUNET_TESTING_Barrier::waiting.
|
static |
Definition at line 260 of file testing_api_cmd_netjail_start_cmds_helper.c.
References HelperState::finished, GNUNET_ERROR_TYPE_ERROR, GNUNET_HELPER_stop(), GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_cancel(), GNUNET_TESTING_async_fail(), GNUNET_TESTING_async_finish(), GNUNET_YES, HelperState::helper, lf(), ns, and HelperState::ns.
|
static |
Functions with this signature are called whenever a complete message is received by the tokenizer.
Do not call GNUNET_SERVER_mst_destroy in callback
cls | closure |
message | the actual message |
Definition at line 299 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED, GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED, GNUNET_MQ_handle_message(), GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_OK, GNUNET_TESTING_async_fail(), handlers, ns, HelperState::ns, and ret.
Referenced by start_helper().
|
static |
Callback called if there was an exception during execution of the helper.
Definition at line 340 of file testing_api_cmd_netjail_start_cmds_helper.c.
References HelperState::finished, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SCHEDULER_cancel(), GNUNET_TESTING_async_fail(), GNUNET_YES, HelperState::helper, ns, and HelperState::ns.
Referenced by GNUNET_HELPER_start(), and start_helper().
|
static |
Definition at line 361 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_OK, and key.
Referenced by send_start_messages().
|
static |
Definition at line 378 of file testing_api_cmd_netjail_start_cmds_helper.c.
References add_barrier(), clear_msg(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_HELPER_send(), GNUNET_log, GNUNET_malloc, GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT, GNUNET_new, GNUNET_NO, GNUNET_TESTING_barrier_count_(), GNUNET_TESTING_barrier_iterate_(), msg, ns, TestingSystemCount::ns, TestingSystemCount::shandle, GNUNET_MessageHeader::size, SIZE_MAX, and GNUNET_MessageHeader::type.
Referenced by start_helper().
|
static |
Function which start a single helper process.
Definition at line 448 of file testing_api_cmd_netjail_start_cmds_helper.c.
References exp_cb(), GNUNET_array_append, GNUNET_asprintf(), GNUNET_break, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_HELPER_start(), GNUNET_log, GNUNET_new, GNUNET_OS_get_libexec_binary_path(), GNUNET_OS_installation_get_path(), GNUNET_OS_IPK_DATADIR, GNUNET_OS_project_data_gnunet(), GNUNET_snprintf(), GNUNET_TESTING_add_netjail_helper_(), GNUNET_YES, HelperState::helper, HELPER_CMDS_BINARY, helper_mst(), NETJAIL_EXEC_SCRIPT, ns, HelperState::ns, and send_start_messages().
Referenced by start_peer().
|
static |
Function run when the cmd terminates (good or bad) with timeout.
cls | the interpreter state |
Definition at line 519 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_TESTING_async_finish(), and ns.
Referenced by netjail_exec_run().
|
static |
Definition at line 531 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, node_number, ns, and start_helper().
Referenced by netjail_exec_run(), start_carriers(), and start_subnets().
|
static |
Definition at line 551 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, node_number, ns, GNUNET_TESTING_NetjailSubnet::peers, start_peer(), and value.
Referenced by start_carriers().
|
static |
Definition at line 573 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, node_number, ns, GNUNET_TESTING_NetjailCarrier::peers, start_peer(), start_subnets(), GNUNET_TESTING_NetjailCarrier::subnets, and value.
Referenced by netjail_exec_run().
|
static |
This function starts a helper process for each node.
cls | closure. |
cmd | CMD being run. |
is | interpreter state. |
Definition at line 607 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_TESTING_NetjailTopology::carriers, do_timeout(), GNUNET_CONTAINER_multishortmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SCHEDULER_add_delayed(), GNUNET_SYSERR, GNUNET_TESTING_FAIL, GNUNET_TESTING_free_topology(), GNUNET_TESTING_get_topo_from_string_(), GNUNET_TESTING_interpreter_lookup_command(), is, LOG, ns, start_carriers(), start_peer(), and GNUNET_TESTING_NetjailTopology::total.
Referenced by GNUNET_TESTING_cmd_netjail_start_helpers().
|
static |
Code to clean up resource this cmd used.
cls | closure |
Definition at line 664 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_free, GNUNET_HELPER_stop(), GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_YES, and ns.
Referenced by GNUNET_TESTING_cmd_netjail_start_helpers().
|
static |
This function prepares an array with traits.
Definition at line 688 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_TESTING_get_trait(), GNUNET_TESTING_trait_end(), GNUNET_TESTING_Trait::index, ns, ret, and traits().
Referenced by GNUNET_TESTING_cmd_netjail_start_helpers().
struct GNUNET_TESTING_Command GNUNET_TESTING_cmd_netjail_start_helpers | ( | const char * | label, |
const char * | topology_cmd_label, | ||
struct GNUNET_TIME_Relative | timeout | ||
) |
Create command.
label | Name for the command. |
topology_data | topology data |
timeout | Before this timeout is reached this cmd MUST finish. |
Definition at line 715 of file testing_api_cmd_netjail_start_cmds_helper.c.
References GNUNET_new, GNUNET_TESTING_command_new_ac(), netjail_exec_cleanup(), netjail_exec_run(), netjail_exec_traits(), ns, timeout, and NetJailState::topology_cmd_label.
Referenced by main().
unsigned int node_number |
The network namespace number of a node.
Definition at line 166 of file testing_api_cmd_netjail_start_cmds_helper.c.
Referenced by start_carriers(), start_peer(), and start_subnets().