aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_testing_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_testing_plugin.h')
-rw-r--r--src/include/gnunet_testing_plugin.h96
1 files changed, 84 insertions, 12 deletions
diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h
index 151827d4b..b030bc8a8 100644
--- a/src/include/gnunet_testing_plugin.h
+++ b/src/include/gnunet_testing_plugin.h
@@ -28,6 +28,8 @@
28#ifndef GNUNET_TESTING_PLUGIN_H 28#ifndef GNUNET_TESTING_PLUGIN_H
29#define GNUNET_TESTING_PLUGIN_H 29#define GNUNET_TESTING_PLUGIN_H
30 30
31#include "gnunet_common.h"
32
31#ifdef __cplusplus 33#ifdef __cplusplus
32extern "C" 34extern "C"
33{ 35{
@@ -36,31 +38,101 @@ extern "C"
36#endif 38#endif
37#endif 39#endif
38 40
41
42/**
43 * Callback function to write messages from the helper process running on a netjail node to the master process.
44 *
45 * @param message The message to write.
46 * @param msg_length The length of the message.
47 */
39typedef void 48typedef void
40(*TESTING_CMD_HELPER_write_cb) (struct GNUNET_MessageHeader *message, size_t 49(*GNUNET_TESTING_cmd_helper_write_cb) (struct GNUNET_MessageHeader *message,
41 msg_length); 50 size_t msg_length);
42 51
52/**
53 * Callback function which writes a message from the helper process running on a netjail node to the master process * signaling that the test case running on the netjail node finished.
54 */
43typedef void 55typedef void
44(*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTING_CMD_HELPER_write_cb 56(*GNUNET_TESTING_cmd_helper_finish_cb) ();
45 write_message, char *router_ip,
46 char *node_ip,
47 char *n,
48 char *m,
49 char *local_m);
50 57
58
59/**
60 * Function to be implemented for each test case plugin which starts the test case on a netjail node.
61 *
62 * @param write_message Callback function to write messages from the helper process running on a
63 * netjail node to the master process.
64 * @param router_ip Global address of the network namespace, if the helper process is for a node in a subnet.
65 * @param node_ip The IP address of the node.
66 * @param m The number of the node in a network namespace.
67 * @param n The number of the network namespace.
68 * @param local_m The number of nodes in a network namespace.
69 * @param topology_data A file name for the file containing the topology configuration, or a string containing
70 * the topology configuration.
71 * @param read_file If read_file is GNUNET_YES this string is the filename for the topology configuration,
72 * if read_file is GNUNET_NO the string contains the topology configuration.
73 * @param finish_cb Callback function which writes a message from the helper process running on a netjail
74 * node to the master process * signaling that the test case running on the netjail node finished.
75 * @return Returns The struct GNUNET_TESTING_Interpreter of the command loop running on this netjail node.
76 */
77typedef struct GNUNET_TESTING_Interpreter *
78(*GNUNET_TESTING_PLUGIN_StartTestCase) (
79 GNUNET_TESTING_cmd_helper_write_cb write_message,
80 const char *router_ip,
81 const char *node_ip,
82 const char *n,
83 const char *m,
84 const char *local_m,
85 const char *topology_data,
86 unsigned int *read_file,
87 GNUNET_TESTING_cmd_helper_finish_cb
88 finish_cb);
89
90/**
91 * DEPRECATED
92 * The helper process received a message of type
93 * GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED. This will finish the blocking command
94 * GNUNET_TESTING_cmd_block_until_external_trigger which was execute right after the command
95 * GNUNET_TESTING_cmd_send_peer_ready.
96 */
51typedef void 97typedef void
52(*GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED) (); 98(*GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED) ();
53 99
100/**
101 * DEPRECATED
102 * The helper process received a message of type
103 * GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED. This will finish the blocking command
104 * GNUNET_TESTING_cmd_local_test_prepared which was execute right after the command
105 * GNUNET_TRANSPORT_cmd_connect_peers.
106 * FIXME: do not use ALL CAPS
107 */
108typedef void
109(*GNUNET_TESTING_PLUGIN_ALL_LOCAL_TESTS_PREPARED) ();
110
111
112/**
113 * This function returns a struct GNUNET_TESTING_BarrierList, which is a list of all barriers
114 * this test case will wait for.
115 *
116 * @return A struct GNUNET_TESTING_BarrierList.
117 * FIXME: do not use ALL CAPS
118 */
119typedef struct GNUNET_TESTING_BarrierList*
120(*GNUNET_TESTING_PLUGIN_GET_WAITING_FOR_BARRIERS) (void);
121
122
123/**
124 * The plugin API every test case plugin has to implement.
125 */
54struct GNUNET_TESTING_PluginFunctions 126struct GNUNET_TESTING_PluginFunctions
55{ 127{
56 /**
57 * Closure for all of the callbacks.
58 */
59 void *cls;
60 128
61 GNUNET_TESTING_PLUGIN_StartTestCase start_testcase; 129 GNUNET_TESTING_PLUGIN_StartTestCase start_testcase;
62 130
63 GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED all_peers_started; 131 GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED all_peers_started;
132
133 GNUNET_TESTING_PLUGIN_ALL_LOCAL_TESTS_PREPARED all_local_tests_prepared;
134
135 GNUNET_TESTING_PLUGIN_GET_WAITING_FOR_BARRIERS get_waiting_for_barriers;
64}; 136};
65 137
66#if 0 /* keep Emacsens' auto-indent happy */ 138#if 0 /* keep Emacsens' auto-indent happy */