aboutsummaryrefslogtreecommitdiff
path: root/src/transport/transport-testing-cmds.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/transport-testing-cmds.h')
-rw-r--r--src/transport/transport-testing-cmds.h253
1 files changed, 59 insertions, 194 deletions
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h
index 67e5723f5..f6e34df62 100644
--- a/src/transport/transport-testing-cmds.h
+++ b/src/transport/transport-testing-cmds.h
@@ -29,92 +29,71 @@
29#include "gnunet_testing_lib.h" 29#include "gnunet_testing_lib.h"
30 30
31 31
32struct StartPeerState_v2 32/**
33 * Struct to store information needed in callbacks.
34 *
35 */
36struct ConnectPeersState
33{ 37{
34 /** 38 /**
35 * The ip of a node. 39 * Context for our asynchronous completion.
36 */
37 char *node_ip;
38
39 /**
40 * Receive callback
41 */ 40 */
42 struct GNUNET_MQ_MessageHandler *handlers; 41 struct GNUNET_TESTING_AsyncContext ac;
43 42
44 const char *cfgname; 43 GNUNET_TRANSPORT_NotifyConnect notify_connect;
45 44
46 /** 45 /**
47 * Peer's configuration 46 * The testing system of this node.
48 */ 47 */
49 struct GNUNET_CONFIGURATION_Handle *cfg; 48 struct GNUNET_TESTING_System *tl_system;
50 49
51 struct GNUNET_TESTING_Peer *peer; 50 // Label of the cmd which started the test system.
51 const char *create_label;
52 52
53 /** 53 /**
54 * Peer identity 54 * Number globally identifying the node.
55 *
55 */ 56 */
56 struct GNUNET_PeerIdentity id; 57 uint32_t num;
57 58
58 /** 59 /**
59 * Peer's transport service handle 60 * Label of the cmd to start a peer.
61 *
60 */ 62 */
61 struct GNUNET_TRANSPORT_CoreHandle *th; 63 const char *start_peer_label;
62 64
63 /** 65 /**
64 * Application handle 66 * The peer identity of this peer.
67 *
65 */ 68 */
66 struct GNUNET_TRANSPORT_ApplicationHandle *ah; 69 struct GNUNET_PeerIdentity *id;
67 70
68 /** 71 /**
69 * Peer's PEERSTORE Handle 72 * The topology of the test setup.
70 */ 73 */
71 struct GNUNET_PEERSTORE_Handle *ph; 74 struct GNUNET_TESTING_NetjailTopology *topology;
72 75
73 /** 76 /**
74 * Hello get task 77 * Connections to other peers.
75 */ 78 */
76 struct GNUNET_SCHEDULER_Task *rh_task; 79 struct GNUNET_TESTING_NodeConnection *node_connections_head;
77 80
78 /** 81 struct GNUNET_TESTING_Interpreter *is;
79 * Peer's transport get hello handle to retrieve peer's HELLO message
80 */
81 struct GNUNET_PEERSTORE_IterateContext *pic;
82 82
83 /** 83 /**
84 * Hello 84 * Number of connections.
85 */ 85 */
86 char *hello; 86 unsigned int con_num;
87
88 /**
89 * Hello size
90 */
91 size_t hello_size;
92
93 char *m;
94
95 char *n;
96
97 char *local_m;
98
99 unsigned int finished;
100
101 const char *system_label;
102
103 /**
104 * An unique number to identify the peer
105 */
106 unsigned int no;
107
108 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
109
110 struct GNUNET_TESTING_System *tl_system;
111
112}; 87};
113 88
114
115struct StartPeerState 89struct StartPeerState
116{ 90{
117 /** 91 /**
92 * Context for our asynchronous completion.
93 */
94 struct GNUNET_TESTING_AsyncContext ac;
95
96 /**
118 * The ip of a node. 97 * The ip of a node.
119 */ 98 */
120 char *node_ip; 99 char *node_ip;
@@ -179,8 +158,6 @@ struct StartPeerState
179 158
180 char *local_m; 159 char *local_m;
181 160
182 unsigned int finished;
183
184 const char *system_label; 161 const char *system_label;
185 162
186 /** 163 /**
@@ -192,9 +169,24 @@ struct StartPeerState
192 169
193 struct GNUNET_TESTING_System *tl_system; 170 struct GNUNET_TESTING_System *tl_system;
194 171
172 GNUNET_TRANSPORT_NotifyConnect notify_connect;
173
195}; 174};
196 175
197 176
177/**
178 * Function to get the trait with the struct ConnectPeersState.
179 *
180 * @param[out] sps struct ConnectPeersState.
181 * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
182 *
183 */
184int
185GNUNET_TESTING_get_trait_connect_peer_state (
186 const struct GNUNET_TESTING_Command *cmd,
187 struct ConnectPeersState **cps);
188
189
198int 190int
199GNUNET_TRANSPORT_get_trait_state (const struct 191GNUNET_TRANSPORT_get_trait_state (const struct
200 GNUNET_TESTING_Command 192 GNUNET_TESTING_Command
@@ -203,30 +195,13 @@ GNUNET_TRANSPORT_get_trait_state (const struct
203 195
204 196
205struct GNUNET_TESTING_Command 197struct GNUNET_TESTING_Command
206GNUNET_TRANSPORT_cmd_start_peer_v2 (const char *label,
207 const char *system_label,
208 uint32_t no,
209 char *node_ip,
210 struct GNUNET_MQ_MessageHandler *handlers,
211 const char *cfgname);
212
213struct GNUNET_TESTING_Command
214GNUNET_TRANSPORT_cmd_start_peer_v3 (const char *label,
215 const char *system_label,
216 uint32_t no,
217 char *node_ip,
218 struct GNUNET_MQ_MessageHandler *handlers,
219 const char *cfgname);
220
221struct GNUNET_TESTING_Command
222GNUNET_TRANSPORT_cmd_start_peer (const char *label, 198GNUNET_TRANSPORT_cmd_start_peer (const char *label,
223 const char *system_label, 199 const char *system_label,
224 char *m, 200 uint32_t no,
225 char *n,
226 char *local_m,
227 char *node_ip, 201 char *node_ip,
228 struct GNUNET_MQ_MessageHandler *handlers, 202 struct GNUNET_MQ_MessageHandler *handlers,
229 const char *cfgname); 203 const char *cfgname,
204 GNUNET_TRANSPORT_NotifyConnect notify_connect);
230 205
231 206
232struct GNUNET_TESTING_Command 207struct GNUNET_TESTING_Command
@@ -238,56 +213,9 @@ struct GNUNET_TESTING_Command
238GNUNET_TRANSPORT_cmd_connect_peers (const char *label, 213GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
239 const char *start_peer_label, 214 const char *start_peer_label,
240 const char *create_label, 215 const char *create_label,
241 uint32_t num); 216 uint32_t num,
242 217 struct GNUNET_TESTING_NetjailTopology *
243 218 topology);
244struct GNUNET_TESTING_Command
245GNUNET_TRANSPORT_cmd_connect_peers_v2 (const char *label,
246 const char *start_peer_label,
247 const char *create_label,
248 uint32_t num);
249
250
251/**
252 * Create command.
253 *
254 * @param label name for command.
255 * @param start_peer_label Label of the cmd to start a peer.
256 * @param create_label Label of the cmd to create the testing system.
257 * @param num Number globally identifying the node.
258 * @param The topology for the test setup.
259 * @return command.
260 */
261struct GNUNET_TESTING_Command
262GNUNET_TRANSPORT_cmd_connect_peers_v3 (const char *label,
263 const char *start_peer_label,
264 const char *create_label,
265 uint32_t num,
266 struct GNUNET_TESTING_NetjailTopology *
267 topology);
268
269
270/**
271 * Create command.
272 *
273 * @param label name for command.
274 * @param start_peer_label Label of the cmd to start a peer.
275 * @param create_label Label of the cmd to create the testing system.
276 * @param num Number globally identifying the node.
277 * @param node_n The number of the node in a network namespace.
278 * @param namespace_n The number of the network namespace.
279 * @param The topology for the test setup.
280 * @return command.
281 */
282struct GNUNET_TESTING_Command
283GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
284 const char *start_peer_label,
285 const char *create_label,
286 uint32_t num,
287 unsigned int node_n,
288 unsigned int namespace_n,
289 struct GNUNET_TESTING_NetjailTopology *
290 topology);
291 219
292 220
293/** 221/**
@@ -302,42 +230,11 @@ GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
302 */ 230 */
303struct GNUNET_TESTING_Command 231struct GNUNET_TESTING_Command
304GNUNET_TRANSPORT_cmd_send_simple (const char *label, 232GNUNET_TRANSPORT_cmd_send_simple (const char *label,
305 char *m, 233 const char *start_peer_label,
306 char *n, 234 uint32_t num);
307 uint32_t num,
308 const char *start_peer_label);
309 235
310/**
311 * Create command.
312 *
313 * @param label name for command.
314 * @param start_peer_label Label of the cmd to start a peer.
315 * @param num Number globally identifying the node.
316 * @return command.
317 */
318struct GNUNET_TESTING_Command
319GNUNET_TRANSPORT_cmd_send_simple_v2 (const char *label,
320 const char *start_peer_label,
321 uint32_t num);
322 236
323 237
324/**
325 * Create command.
326 *
327 * @param label name for command.
328 * @param start_peer_label Label of the cmd to start a peer.
329 * @param start_peer_label Label of the cmd which started the test system.
330 * @param num Number globally identifying the node.
331 * @param The topology for the test setup.
332 * @return command.
333 */
334struct GNUNET_TESTING_Command
335GNUNET_TRANSPORT_cmd_send_simple_v3 (const char *label,
336 const char *start_peer_label,
337 const char *create_label,
338 uint32_t num,
339 struct GNUNET_TESTING_NetjailTopology *
340 topology);
341 238
342 239
343int 240int
@@ -345,34 +242,16 @@ GNUNET_TRANSPORT_get_trait_peer_id (const struct
345 GNUNET_TESTING_Command *cmd, 242 GNUNET_TESTING_Command *cmd,
346 struct GNUNET_PeerIdentity **id); 243 struct GNUNET_PeerIdentity **id);
347 244
245
348int 246int
349GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct 247GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct
350 GNUNET_TESTING_Command 248 GNUNET_TESTING_Command
351 *cmd, 249 *cmd,
352 struct 250 struct
353 GNUNET_CONTAINER_MultiShortmap * 251 GNUNET_CONTAINER_MultiShortmap
252 *
354 * 253 *
355 connected_peers_map); 254 connected_peers_map);
356
357int
358GNUNET_TRANSPORT_get_trait_connected_peers_map_v2 (const struct
359 GNUNET_TESTING_Command
360 *cmd,
361 struct
362 GNUNET_CONTAINER_MultiShortmap
363 *
364 *
365 connected_peers_map);
366
367int
368GNUNET_TRANSPORT_get_trait_connected_peers_map_v3 (const struct
369 GNUNET_TESTING_Command
370 *cmd,
371 struct
372 GNUNET_CONTAINER_MultiShortmap
373 *
374 *
375 connected_peers_map);
376int 255int
377GNUNET_TRANSPORT_get_trait_hello_size (const struct 256GNUNET_TRANSPORT_get_trait_hello_size (const struct
378 GNUNET_TESTING_Command 257 GNUNET_TESTING_Command
@@ -393,19 +272,5 @@ GNUNET_TRANSPORT_get_trait_application_handle (const struct
393 GNUNET_TRANSPORT_ApplicationHandle 272 GNUNET_TRANSPORT_ApplicationHandle
394 **ah); 273 **ah);
395 274
396int
397GNUNET_TRANSPORT_get_trait_application_handle_v2 (const struct
398 GNUNET_TESTING_Command *cmd,
399 struct
400 GNUNET_TRANSPORT_ApplicationHandle
401 **ah);
402
403int
404GNUNET_TRANSPORT_get_trait_application_handle_v3 (const struct
405 GNUNET_TESTING_Command *cmd,
406 struct
407 GNUNET_TRANSPORT_ApplicationHandle
408 **ah);
409
410#endif 275#endif
411/* end of transport_testing.h */ 276/* end of transport_testing.h */