diff options
Diffstat (limited to 'src/include/gnunet_testing_plugin.h')
-rw-r--r-- | src/include/gnunet_testing_plugin.h | 92 |
1 files changed, 77 insertions, 15 deletions
diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h index b59d2cea1..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 |
32 | extern "C" | 34 | extern "C" |
33 | { | 35 | { |
@@ -36,41 +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 | */ | ||
39 | typedef void | 48 | typedef 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 | */ | ||
43 | typedef void | 55 | typedef void |
44 | (*GNUNET_TESTING_PLUGIN_StartTestCase) (TESTING_CMD_HELPER_write_cb | 56 | (*GNUNET_TESTING_cmd_helper_finish_cb) (); |
45 | write_message, char *router_ip, | 57 | |
46 | char *node_ip, | ||
47 | char *n, | ||
48 | char *m, | ||
49 | char *local_m, | ||
50 | char *topology_data, | ||
51 | unsigned int *read_file); | ||
52 | 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 | */ | ||
77 | typedef 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); | ||
53 | 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 | */ | ||
54 | typedef void | 97 | typedef void |
55 | (*GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED) (); | 98 | (*GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED) (); |
56 | 99 | ||
57 | 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 | */ | ||
58 | typedef void | 108 | typedef void |
59 | (*GNUNET_TESTING_PLUGIN_ALL_LOCAL_TESTS_PREPARED) (); | 109 | (*GNUNET_TESTING_PLUGIN_ALL_LOCAL_TESTS_PREPARED) (); |
60 | 110 | ||
61 | 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 | */ | ||
119 | typedef 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 | */ | ||
62 | struct GNUNET_TESTING_PluginFunctions | 126 | struct GNUNET_TESTING_PluginFunctions |
63 | { | 127 | { |
64 | /** | ||
65 | * Closure for all of the callbacks. | ||
66 | */ | ||
67 | void *cls; | ||
68 | 128 | ||
69 | GNUNET_TESTING_PLUGIN_StartTestCase start_testcase; | 129 | GNUNET_TESTING_PLUGIN_StartTestCase start_testcase; |
70 | 130 | ||
71 | GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED all_peers_started; | 131 | GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED all_peers_started; |
72 | 132 | ||
73 | GNUNET_TESTING_PLUGIN_ALL_LOCAL_TESTS_PREPARED all_local_tests_prepared; | 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; | ||
74 | }; | 136 | }; |
75 | 137 | ||
76 | #if 0 /* keep Emacsens' auto-indent happy */ | 138 | #if 0 /* keep Emacsens' auto-indent happy */ |