#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.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 | WriteContext |
Context for a single write on a chunk of memory. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) |
Generic logging shortcut. More... | |
#define | LOG_DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) |
Debug logging shorthand. More... | |
Functions | |
static void | do_shutdown_later (void *cls) |
Task to shut down cleanly. More... | |
static void | do_shutdown (void *cls) |
Task to shut down cleanly. More... | |
static void | write_task (void *cls) |
Task to write to the standard out. More... | |
static void | write_message (const struct GNUNET_MessageHeader *message) |
Callback to write a message to the parent process. More... | |
static void | finished_cb (void *cls, enum GNUNET_GenericReturnValue rv) |
static enum GNUNET_GenericReturnValue | check_helper_init (void *cls, const struct GNUNET_TESTING_CommandHelperInit *msg) |
static void | handle_helper_init (void *cls, const struct GNUNET_TESTING_CommandHelperInit *msg) |
static void | handle_helper_barrier_crossable (void *cls, const struct GNUNET_TESTING_CommandBarrierSatisfied *cbs) |
static enum GNUNET_GenericReturnValue | tokenizer_cb (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 | read_task (void *cls) |
Task to read from stdin. More... | |
static void | run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
Main function that will be run. More... | |
int | main (int argc, char **argv) |
Main function. More... | |
Variables | |
static struct WriteContext * | wc_head |
static struct WriteContext * | wc_tail |
static struct GNUNET_TESTING_Interpreter * | is |
static const char * | my_node_id |
static struct GNUNET_TESTING_PluginFunctions * | plugin |
Plugin to dynamically load a test case. More... | |
static char * | plugin_name |
Name of our plugin. More... | |
struct GNUNET_TESTING_NetjailTopology * | njt |
The loaded topology. More... | |
static struct GNUNET_MessageStreamTokenizer * | tokenizer |
Our message stream tokenizer. More... | |
static struct GNUNET_DISK_FileHandle * | stdin_fd |
Disk handle from stdin. More... | |
static struct GNUNET_DISK_FileHandle * | stdout_fd |
Disk handle for stdout. More... | |
static struct GNUNET_SCHEDULER_Task * | read_task_id |
Task identifier for the read task. More... | |
static struct GNUNET_SCHEDULER_Task * | write_task_id |
Task identifier for the write task. More... | |
static int | global_ret |
Result to return in case we fail. More... | |
static bool | finished |
Set to true once we are finished and should exit after sending our final message to the parent. More... | |
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log (kind, __VA_ARGS__) |
Generic logging shortcut.
Definition at line 47 of file gnunet-cmds-helper.c.
#define LOG_DEBUG | ( | ... | ) | LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__) |
Debug logging shorthand.
Definition at line 52 of file gnunet-cmds-helper.c.
|
static |
Task to shut down cleanly.
cls | NULL |
Definition at line 147 of file gnunet-cmds-helper.c.
References WriteContext::data, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_MST_destroy(), GNUNET_PLUGIN_unload(), GNUNET_SCHEDULER_cancel(), GNUNET_TESTING_free_topology(), njt, plugin, plugin_name, read_task_id, tokenizer, wc_head, wc_tail, and write_task_id.
Referenced by do_shutdown().
|
static |
Task to shut down cleanly.
cls | NULL |
Definition at line 194 of file gnunet-cmds-helper.c.
References do_shutdown_later(), GNUNET_SCHEDULER_add_with_priority(), and GNUNET_SCHEDULER_PRIORITY_IDLE.
Referenced by run().
|
static |
Task to write to the standard out.
cls | the WriteContext |
Definition at line 208 of file gnunet-cmds-helper.c.
References WriteContext::data, finished, global_ret, GNUNET_CONTAINER_DLL_remove, GNUNET_DISK_file_write(), GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_log_strerror, GNUNET_SCHEDULER_add_write_file(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, WriteContext::length, WriteContext::pos, stdout_fd, wc_head, wc_tail, write_task(), and write_task_id.
Referenced by write_message(), and write_task().
|
static |
Callback to write a message to the parent process.
Definition at line 256 of file gnunet-cmds-helper.c.
References WriteContext::data, GNUNET_assert, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_memdup, GNUNET_new, GNUNET_SCHEDULER_add_write_file(), GNUNET_TIME_UNIT_FOREVER_REL, WriteContext::length, GNUNET_MessageHeader::size, stdout_fd, wc_head, wc_tail, write_task(), and write_task_id.
Referenced by finished_cb(), and handle_helper_init().
|
static |
Definition at line 282 of file gnunet-cmds-helper.c.
References finished, GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED, GNUNET_TESTING_CommandLocalFinished::header, GNUNET_TESTING_CommandLocalFinished::rv, GNUNET_MessageHeader::type, and write_message().
Referenced by GDS_u_send(), GNUNET_NAMESTORE_record_set_edit_cancel(), gnunet_send(), handle_helper_init(), and ip_send().
|
static |
Definition at line 298 of file gnunet-cmds-helper.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, msg, and GNUNET_MessageHeader::size.
|
static |
Definition at line 325 of file gnunet-cmds-helper.c.
References GNUNET_TESTING_PluginFunctions::cls, commands, finished_cb(), global_ret, GNUNET_assert, GNUNET_break_op, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_PLUGIN_load(), GNUNET_SCHEDULER_shutdown(), GNUNET_TESTING_get_plugin_from_topo(), GNUNET_TESTING_get_topo_from_string_(), is, GNUNET_TESTING_Command::label, msg, my_node_id, njt, plugin, plugin_name, GNUNET_MessageHeader::size, GNUNET_TESTING_PluginFunctions::start_testcase, GNUNET_TESTING_CommandLabel::value, and write_message().
|
static |
Definition at line 392 of file gnunet-cmds-helper.c.
References GNUNET_TESTING_CommandBarrierSatisfied::barrier_key, GNUNET_TESTING_Barrier::cnt_waiting, global_ret, GNUNET_array_grow, GNUNET_break_op, GNUNET_SCHEDULER_shutdown(), GNUNET_TESTING_async_finish(), GNUNET_TESTING_get_barrier2_(), GNUNET_TESTING_loop_notify_children_(), GNUNET_TESTING_CommandBarrierSatisfied::header, is, GNUNET_TESTING_Barrier::satisfied, and GNUNET_TESTING_Barrier::waiting.
|
static |
Functions with this signature are called whenever a complete message is received by the tokenizer.
Do not call #GNUNET_mst_destroy() in this callback
cls | identification of the client |
message | the actual message |
Definition at line 440 of file gnunet-cmds-helper.c.
References GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE, GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT, GNUNET_MQ_handle_message(), GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, and handlers.
Referenced by run().
|
static |
Task to read from stdin.
cls | NULL |
Definition at line 468 of file gnunet-cmds-helper.c.
References global_ret, GNUNET_break, GNUNET_DISK_file_read(), GNUNET_MAX_MESSAGE_SIZE, GNUNET_MST_from_buffer(), GNUNET_NO, GNUNET_OK, GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_shutdown(), GNUNET_SYSERR, GNUNET_TIME_UNIT_FOREVER_REL, LOG_DEBUG, read_task(), read_task_id, stdin_fd, and tokenizer.
Referenced by read_task(), and run().
|
static |
Main function that will be run.
cls | closure |
args | remaining command-line arguments |
cfgfile | name of the configuration file used (for saving, can be NULL!) |
cfg | configuration |
Definition at line 519 of file gnunet-cmds-helper.c.
References consensus-simulation::args, do_shutdown(), EXIT_INVALIDARGUMENT, global_ret, GNUNET_break_op, GNUNET_DISK_get_handle_from_native(), GNUNET_MST_create(), GNUNET_SCHEDULER_add_read_file(), GNUNET_SCHEDULER_add_shutdown(), GNUNET_TIME_UNIT_FOREVER_REL, my_node_id, read_task(), read_task_id, stdin_fd, stdout_fd, tokenizer, and tokenizer_cb().
Referenced by main().
int main | ( | int | argc, |
char ** | argv | ||
) |
Main function.
argc | the number of command line arguments |
argv | command line arg array |
Definition at line 553 of file gnunet-cmds-helper.c.
References global_ret, GNUNET_GETOPT_OPTION_END, GNUNET_OK, GNUNET_PROGRAM_run(), options, ret, and run().
|
static |
Definition at line 81 of file gnunet-cmds-helper.c.
Referenced by do_shutdown_later(), write_message(), and write_task().
|
static |
Definition at line 83 of file gnunet-cmds-helper.c.
Referenced by do_shutdown_later(), write_message(), and write_task().
|
static |
Definition at line 85 of file gnunet-cmds-helper.c.
Referenced by backchannel_check_run(), barrier_reached_run(), barrier_run(), batch_run(), check_backchannel_encapsulation(), check_communicator_backchannel(), connect_peers_run(), delete_networks(), do_timeout(), finish_test(), get_addresses(), GNUNET_NT_scanner_done(), GNUNET_NT_scanner_get_type(), GNUNET_NT_scanner_init(), GNUNET_TESTING_add_barrier_(), GNUNET_TESTING_add_netjail_helper_(), GNUNET_TESTING_barrier_count_(), GNUNET_TESTING_barrier_iterate_(), GNUNET_TESTING_get_barrier2_(), GNUNET_TESTING_get_barrier_(), GNUNET_TESTING_interpreter_commands_iterate(), GNUNET_TESTING_interpreter_current_cmd_get_label(), GNUNET_TESTING_interpreter_current_cmd_inc_tries(), GNUNET_TESTING_interpreter_current_cmd_touch(), GNUNET_TESTING_interpreter_fail(), GNUNET_TESTING_interpreter_get_command(), GNUNET_TESTING_interpreter_lookup_command(), GNUNET_TESTING_interpreter_next_(), GNUNET_TESTING_interpreter_run_cmd_(), GNUNET_TESTING_interpreter_skip(), GNUNET_TESTING_loop_notify_children_(), GNUNET_TESTING_loop_notify_parent_(), GNUNET_TESTING_run(), handle_communicator_backchannel(), handle_helper_barrier_crossable(), handle_helper_init(), interface_proc(), interpreter_run(), join_room_run(), netjail_exec_run(), netjail_start_run(), notify_connect(), rewind_ip_run(), run(), run_finish(), seek_batch(), send_finished(), send_simple_run(), setup_is(), signal_run(), start_peer_run(), start_service_run(), start_testcase(), stat_run(), stop_peer_run(), and stop_service_run().
|
static |
Definition at line 87 of file gnunet-cmds-helper.c.
Referenced by GNUNET_TESTBED_cmd_system_create(), handle_helper_init(), and run().
|
static |
Plugin to dynamically load a test case.
Definition at line 92 of file gnunet-cmds-helper.c.
Referenced by __attribute__(), add_addr(), add_plugin(), core_connect_cb(), core_disconnect_cb(), core_init_cb(), create_source(), create_target(), database_connect(), database_prepare(), database_setup(), database_shutdown(), delete_by_rowid(), delete_old_block(), delete_value(), DHTU_gnunet_done(), DHTU_gnunet_init(), DHTU_ip_done(), DHTU_ip_init(), do_shutdown_later(), execute_get(), expire_blocks(), find_plugin(), find_source(), find_target(), free_value(), get_any(), get_records_and_call_iterator(), get_typed(), GNUNET_BLOCK_check_block(), GNUNET_BLOCK_check_query(), GNUNET_BLOCK_check_reply(), GNUNET_BLOCK_context_destroy(), GNUNET_BLOCK_get_key(), GNUNET_BLOCK_group_create(), gnunet_drop(), GNUNET_GNSRECORD_is_critical(), GNUNET_GNSRECORD_number_to_typename(), GNUNET_GNSRECORD_string_to_value(), GNUNET_GNSRECORD_typename_to_number(), GNUNET_GNSRECORD_value_to_string(), gnunet_hold(), GNUNET_RECLAIM_attribute_number_to_typename(), GNUNET_RECLAIM_attribute_string_to_value(), GNUNET_RECLAIM_attribute_typename_to_number(), GNUNET_RECLAIM_attribute_value_to_string(), GNUNET_RECLAIM_credential_get_attributes(), GNUNET_RECLAIM_credential_get_expiration(), GNUNET_RECLAIM_credential_get_issuer(), GNUNET_RECLAIM_credential_get_presentation(), GNUNET_RECLAIM_credential_number_to_typename(), GNUNET_RECLAIM_credential_string_to_value(), GNUNET_RECLAIM_credential_typename_to_number(), GNUNET_RECLAIM_credential_value_to_string(), GNUNET_RECLAIM_presentation_get_attributes(), GNUNET_RECLAIM_presentation_get_expiration(), GNUNET_RECLAIM_presentation_get_issuer(), GNUNET_RECLAIM_presentation_number_to_typename(), GNUNET_RECLAIM_presentation_string_to_value(), GNUNET_RECLAIM_presentation_typename_to_number(), GNUNET_RECLAIM_presentation_value_to_string(), gnunet_try_connect(), handle_core_message(), handle_helper_init(), heap_get_keys(), heap_plugin_del(), heap_plugin_estimate_size(), heap_plugin_get(), heap_plugin_get_closest(), heap_plugin_get_expiration(), heap_plugin_get_key(), heap_plugin_get_replication(), heap_plugin_get_zero_anonymity(), heap_plugin_put(), heap_plugin_remove_key(), init_connection(), ip_send(), ip_try_connect(), libgnunet_plugin_datacache_heap_done(), libgnunet_plugin_datacache_heap_init(), libgnunet_plugin_datacache_postgres_done(), libgnunet_plugin_datacache_postgres_init(), libgnunet_plugin_datacache_sqlite_done(), libgnunet_plugin_datacache_sqlite_init(), libgnunet_plugin_datacache_template_done(), libgnunet_plugin_datacache_template_init(), libgnunet_plugin_datastore_heap_done(), libgnunet_plugin_datastore_heap_init(), libgnunet_plugin_datastore_postgres_done(), libgnunet_plugin_datastore_postgres_init(), libgnunet_plugin_datastore_sqlite_done(), libgnunet_plugin_datastore_sqlite_init(), libgnunet_plugin_datastore_template_done(), libgnunet_plugin_datastore_template_init(), libgnunet_plugin_namecache_flat_done(), libgnunet_plugin_namecache_flat_init(), libgnunet_plugin_namecache_postgres_done(), libgnunet_plugin_namecache_postgres_init(), libgnunet_plugin_namecache_sqlite_done(), libgnunet_plugin_namecache_sqlite_init(), libgnunet_plugin_namestore_flat_done(), libgnunet_plugin_namestore_flat_init(), libgnunet_plugin_namestore_postgres_done(), libgnunet_plugin_namestore_postgres_init(), libgnunet_plugin_namestore_sqlite_done(), libgnunet_plugin_namestore_sqlite_init(), libgnunet_plugin_peerstore_sqlite_done(), libgnunet_plugin_peerstore_sqlite_init(), libgnunet_plugin_rest_pabc_init(), libgnunet_plugin_rest_reclaim_done(), lookup_records(), namecache_cache_block(), namecache_expire_blocks(), namecache_lookup_block(), namecache_postgres_cache_block(), namecache_postgres_expire_blocks(), namecache_postgres_lookup_block(), namecache_sqlite_cache_block(), namecache_sqlite_expire_blocks(), namecache_sqlite_lookup_block(), namestore_flat_iterate_records(), namestore_flat_lookup_records(), namestore_flat_store_records(), namestore_flat_zone_to_name(), namestore_postgres_begin_tx(), namestore_postgres_clear_editor_hint(), namestore_postgres_commit_tx(), namestore_postgres_create_tables(), namestore_postgres_drop_tables(), namestore_postgres_edit_records(), namestore_postgres_iterate_records(), namestore_postgres_lookup_records(), namestore_postgres_rollback_tx(), namestore_postgres_store_records(), namestore_postgres_zone_to_name(), namestore_sqlite_begin_tx(), namestore_sqlite_commit_tx(), namestore_sqlite_create_tables(), namestore_sqlite_drop_tables(), namestore_sqlite_editor_hint_clear(), namestore_sqlite_iterate_records(), namestore_sqlite_rollback_tx(), namestore_sqlite_store_records(), namestore_sqlite_zone_to_name(), nse_cb(), peerinfo_cb(), peerstore_sqlite_delete_records(), peerstore_sqlite_expire_records(), peerstore_sqlite_iterate_records(), peerstore_sqlite_store_record(), postgres_plugin_del(), postgres_plugin_drop(), postgres_plugin_estimate_size(), postgres_plugin_get(), postgres_plugin_get_closest(), postgres_plugin_get_expiration(), postgres_plugin_get_key(), postgres_plugin_get_keys(), postgres_plugin_get_replication(), postgres_plugin_get_zero_anonymity(), postgres_plugin_put(), postgres_plugin_remove_key(), process_ifcs(), process_result(), read_cb(), repl_proc(), REST_config_done(), REST_config_init(), REST_config_process_request(), REST_copying_done(), REST_copying_init(), REST_gns_done(), REST_gns_init(), REST_identity_done(), REST_identity_init(), REST_namestore_done(), REST_namestore_init(), REST_openid_done(), REST_openid_init(), REST_reclaim_done(), REST_reclaim_init(), run(), scan(), sqlite_plugin_del(), sqlite_plugin_drop(), sqlite_plugin_estimate_size(), sqlite_plugin_get_closest(), sqlite_plugin_get_expiration(), sqlite_plugin_get_key(), sqlite_plugin_get_keys(), sqlite_plugin_get_replication(), sqlite_plugin_get_zero_anonymity(), sqlite_plugin_put(), and sqlite_plugin_remove_key().
|
static |
Name of our plugin.
Definition at line 97 of file gnunet-cmds-helper.c.
Referenced by add_to_meta_counter(), do_shutdown_later(), GNUNET_FS_meta_data_deserialize(), GNUNET_FS_meta_data_insert(), handle_helper_init(), item_printer(), and merge_helper().
struct GNUNET_TESTING_NetjailTopology* njt |
The loaded topology.
Definition at line 102 of file gnunet-cmds-helper.c.
Referenced by do_shutdown_later(), GNUNET_TESTING_get_plugin_from_topo(), and handle_helper_init().
|
static |
Our message stream tokenizer.
Definition at line 107 of file gnunet-cmds-helper.c.
Referenced by do_shutdown_later(), read_task(), and run().
|
static |
Disk handle from stdin.
Definition at line 112 of file gnunet-cmds-helper.c.
Referenced by read_task(), and run().
|
static |
Disk handle for stdout.
Definition at line 117 of file gnunet-cmds-helper.c.
Referenced by run(), write_message(), and write_task().
|
static |
Task identifier for the read task.
Definition at line 122 of file gnunet-cmds-helper.c.
Referenced by do_shutdown_later(), read_task(), and run().
|
static |
Task identifier for the write task.
Definition at line 127 of file gnunet-cmds-helper.c.
Referenced by do_shutdown_later(), write_message(), and write_task().
|
static |
Result to return in case we fail.
Definition at line 132 of file gnunet-cmds-helper.c.
Referenced by handle_helper_barrier_crossable(), handle_helper_init(), main(), read_task(), run(), and write_task().
|
static |
Set to true once we are finished and should exit after sending our final message to the parent.
Definition at line 138 of file gnunet-cmds-helper.c.
Referenced by finished_cb(), GNUNET_TIME_calculate_eta(), process_command_stdin(), and write_task().