#include "platform.h"
#include "gnunet_testing_lib.h"
#include "gnunet_util_lib.h"
#include "gnunet_transport_application_service.h"
#include "transport-testing2.h"
#include "transport-testing-cmds.h"
Go to the source code of this file.
Macros | |
#define | LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) |
Generic logging shortcut. More... | |
#define | BASE_DIR "testdir" |
#define | TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf" |
#define | TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600) |
Functions | |
static int | check_test (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
Function called to check a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being received. More... | |
static void | handle_test (void *cls, const struct GNUNET_TRANSPORT_TESTING_TestMessage *message) |
Function called to handle a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being received. More... | |
struct GNUNET_TESTING_BarrierList * | get_waiting_for_barriers () |
static void | all_peers_started () |
Callback to set the flag indicating all peers started. More... | |
static void | handle_result (void *cls, enum GNUNET_GenericReturnValue rv) |
Function called with the final result of the test. More... | |
static void * | notify_connect (struct GNUNET_TESTING_Interpreter *is, const struct GNUNET_PeerIdentity *peer) |
Callback from start peer cmd for signaling a peer got connected. More... | |
static void | all_local_tests_prepared () |
Callback to set the flag indicating all peers are prepared to finish. More... | |
static struct GNUNET_TESTING_Interpreter * | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, const char *router_ip, const char *node_ip, const char *m, const char *n, const char *local_m, const char *topology_data, unsigned int *read_file, GNUNET_TESTING_cmd_helper_finish_cb finished_cb) |
Function to start a local test case. More... | |
void * | libgnunet_test_transport_plugin_cmd_simple_send_broadcast_init (void *cls) |
Entry point for the plugin. More... | |
void * | libgnunet_test_transport_plugin_cmd_simple_send_broadcast_done (void *cls) |
Exit point from the plugin. More... | |
Variables | |
static struct GNUNET_TESTING_Command | block_send |
static struct GNUNET_TESTING_Command | block_receive |
static struct GNUNET_TESTING_Command | connect_peers |
static struct GNUNET_TESTING_Command | local_prepared |
static struct GNUNET_TESTING_Interpreter * | is |
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log (kind, __VA_ARGS__) |
Generic logging shortcut.
Definition at line 36 of file plugin_testing_transport_simple_send_broadcast.c.
#define BASE_DIR "testdir" |
Definition at line 38 of file plugin_testing_transport_simple_send_broadcast.c.
#define TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf" |
Definition at line 40 of file plugin_testing_transport_simple_send_broadcast.c.
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600) |
Definition at line 42 of file plugin_testing_transport_simple_send_broadcast.c.
|
static |
Function called to check a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being received.
Definition at line 60 of file plugin_testing_transport_simple_send_broadcast.c.
References GNUNET_OK.
|
static |
Function called to handle a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being received.
Definition at line 73 of file plugin_testing_transport_simple_send_broadcast.c.
References block_receive, GNUNET_TESTING_AsyncContext::finished, GNUNET_assert, GNUNET_NO, GNUNET_TESTING_async_fail(), and GNUNET_TESTING_async_finish().
struct GNUNET_TESTING_BarrierList * get_waiting_for_barriers | ( | ) |
Definition at line 89 of file plugin_testing_transport_simple_send_broadcast.c.
References GNUNET_new.
Referenced by libgnunet_test_transport_plugin_cmd_simple_send_broadcast_init().
|
static |
Callback to set the flag indicating all peers started.
Will be called via the plugin api.
Definition at line 101 of file plugin_testing_transport_simple_send_broadcast.c.
References block_send, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_TESTING_async_fail(), and GNUNET_TESTING_async_finish().
Referenced by libgnunet_test_transport_plugin_cmd_simple_send_broadcast_init().
|
static |
Function called with the final result of the test.
cls | the struct MainParams |
rv | GNUNET_OK if the test passed |
Definition at line 124 of file plugin_testing_transport_simple_send_broadcast.c.
References TestState::cfgname, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_TESTING_free_topology(), TestState::testdir, and TestState::topology.
Referenced by start_testcase().
|
static |
Callback from start peer cmd for signaling a peer got connected.
Definition at line 145 of file plugin_testing_transport_simple_send_broadcast.c.
References connect_peers, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_TESTING_async_fail(), GNUNET_TESTING_async_finish(), GNUNET_YES, GNUNET_TESTING_AsyncContext::is, is, GNUNET_TESTING_Command::label, LOG, ret, and GNUNET_TESTING_CommandLabel::value.
Referenced by start_testcase().
|
static |
Callback to set the flag indicating all peers are prepared to finish.
Will be called via the plugin api.
Definition at line 195 of file plugin_testing_transport_simple_send_broadcast.c.
References GNUNET_assert, GNUNET_TESTING_async_fail(), GNUNET_TESTING_async_finish(), and local_prepared.
Referenced by libgnunet_test_transport_plugin_cmd_simple_send_broadcast_init().
|
static |
Function to start a local test case.
write_message | Callback to send a message to the master loop. |
router_ip | Global address of the network namespace. |
node_ip | The IP address of the node. |
m | The number of the node in a network namespace. |
n | The number of the network namespace. |
local_m | The number of nodes in a network namespace. |
Definition at line 221 of file plugin_testing_transport_simple_send_broadcast.c.
References BASE_DIR, block_receive, block_send, TestState::cfgname, commands, connect_peers, finished_cb(), GNUNET_asprintf(), GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log_strerror, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_new, GNUNET_TESTING_cmd_end(), GNUNET_TESTING_run(), GNUNET_TRANSPORT_cmd_send_simple(), GNUNET_TRANSPORT_cmd_start_peer(), GNUNET_TRANSPORT_cmd_stop_peer(), GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE, GNUNET_YES, handle_result(), handlers, is, local_prepared, LOG, m, GNUNET_TESTING_NetjailTopology::nodes_x, notify_connect(), read_file(), TestState::testdir, TIMEOUT, TestState::topology, and write_message().
Referenced by libgnunet_test_transport_plugin_cmd_simple_send_broadcast_init().
void * libgnunet_test_transport_plugin_cmd_simple_send_broadcast_init | ( | void * | cls | ) |
Entry point for the plugin.
cls | NULL |
Definition at line 364 of file plugin_testing_transport_simple_send_broadcast.c.
References all_local_tests_prepared(), all_peers_started(), get_waiting_for_barriers(), GNUNET_log_setup(), GNUNET_new, start_testcase(), and GNUNET_TESTING_PluginFunctions::start_testcase.
void * libgnunet_test_transport_plugin_cmd_simple_send_broadcast_done | ( | void * | cls | ) |
Exit point from the plugin.
cls | the return value from #libgnunet_test_transport_plugin_block_test_init |
Definition at line 388 of file plugin_testing_transport_simple_send_broadcast.c.
References GNUNET_TESTING_PluginFunctions::cls, and GNUNET_free.
|
static |
Definition at line 44 of file plugin_testing_transport_simple_send_broadcast.c.
Referenced by all_peers_started(), and start_testcase().
|
static |
Definition at line 46 of file plugin_testing_transport_simple_send_broadcast.c.
Referenced by handle_test(), and start_testcase().
|
static |
Definition at line 48 of file plugin_testing_transport_simple_send_broadcast.c.
Referenced by notify_connect(), and start_testcase().
|
static |
Definition at line 50 of file plugin_testing_transport_simple_send_broadcast.c.
Referenced by all_local_tests_prepared(), and start_testcase().
|
static |
Definition at line 52 of file plugin_testing_transport_simple_send_broadcast.c.
Referenced by notify_connect(), and start_testcase().