diff options
Diffstat (limited to 'src/transport/transport_api_cmd_connecting_peers.c')
-rw-r--r-- | src/transport/transport_api_cmd_connecting_peers.c | 482 |
1 files changed, 343 insertions, 139 deletions
diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c index 82194ff15..2e51363f6 100644 --- a/src/transport/transport_api_cmd_connecting_peers.c +++ b/src/transport/transport_api_cmd_connecting_peers.c | |||
@@ -36,40 +36,240 @@ | |||
36 | */ | 36 | */ |
37 | #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) | 37 | #define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) |
38 | 38 | ||
39 | /** | 39 | #define CONNECT_ADDRESS_TEMPLATE_TCP "tcp-192.168.15.%u:60002" |
40 | * Struct to store information needed in callbacks. | 40 | |
41 | * | 41 | #define CONNECT_ADDRESS_TEMPLATE_UDP "udp-192.168.15.%u:60002" |
42 | */ | 42 | |
43 | struct ConnectPeersState | 43 | #define ROUTER_CONNECT_ADDRESS_TEMPLATE_TCP "tcp-92.68.150.%u:60002" |
44 | |||
45 | #define ROUTER_CONNECT_ADDRESS_TEMPLATE_UDP "udp-92.68.150.%u:60002" | ||
46 | |||
47 | #define GLOBAL_CONNECT_ADDRESS_TEMPLATE_TCP "tcp-92.68.151.%u:60002" | ||
48 | |||
49 | #define GLOBAL_CONNECT_ADDRESS_TEMPLATE_UDP "udp-92.68.151.%u:60002" | ||
50 | |||
51 | #define PREFIX_TCP "tcp" | ||
52 | |||
53 | #define PREFIX_UDP "udp" | ||
54 | |||
55 | |||
56 | |||
57 | |||
58 | static struct GNUNET_PeerIdentity * | ||
59 | get_pub_key (unsigned int num, struct GNUNET_TESTING_System *tl_system) | ||
44 | { | 60 | { |
45 | /** | 61 | struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity); |
46 | * Context for our asynchronous completion. | 62 | struct GNUNET_CRYPTO_EddsaPublicKey *pub_key = GNUNET_new (struct |
47 | */ | 63 | GNUNET_CRYPTO_EddsaPublicKey); |
48 | struct GNUNET_TESTING_AsyncContext ac; | 64 | struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key = GNUNET_new (struct |
49 | 65 | GNUNET_CRYPTO_EddsaPrivateKey); | |
50 | // Label of the cmd which started the test system. | 66 | |
51 | const char *create_label; | 67 | priv_key = GNUNET_TESTING_hostkey_get (tl_system, |
52 | 68 | num, | |
53 | /** | 69 | peer); |
54 | * Number globally identifying the node. | 70 | |
55 | * | 71 | GNUNET_CRYPTO_eddsa_key_get_public (priv_key, |
56 | */ | 72 | pub_key); |
57 | uint32_t num; | 73 | peer->public_key = *pub_key; |
74 | return peer; | ||
75 | } | ||
76 | |||
77 | |||
78 | static int | ||
79 | log_nodes (void *cls, const struct GNUNET_ShortHashCode *id, void *value) | ||
80 | { | ||
81 | struct GNUNET_TESTING_NetjailNode *node = value; | ||
82 | struct GNUNET_TESTING_NodeConnection *pos_connection; | ||
83 | struct GNUNET_TESTING_ADDRESS_PREFIX *pos_prefix; | ||
84 | |||
85 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
86 | "plugin: %s space: %u node: %u global: %u\n", | ||
87 | node->plugin, | ||
88 | node->namespace_n, | ||
89 | node->node_n, | ||
90 | node->is_global); | ||
91 | |||
92 | for (pos_connection = node->node_connections_head; NULL != pos_connection; | ||
93 | pos_connection = pos_connection->next) | ||
94 | { | ||
95 | |||
96 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
97 | "namespace_n: %u node_n: %u node_type: %u\n", | ||
98 | pos_connection->namespace_n, | ||
99 | pos_connection->node_n, | ||
100 | pos_connection->node_type); | ||
101 | |||
102 | for (pos_prefix = pos_connection->address_prefixes_head; NULL != pos_prefix; | ||
103 | pos_prefix = | ||
104 | pos_prefix->next) | ||
105 | { | ||
106 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
107 | "prefix: %s\n", | ||
108 | pos_prefix->address_prefix); | ||
109 | } | ||
110 | } | ||
111 | return GNUNET_YES; | ||
112 | } | ||
113 | |||
114 | |||
115 | static int | ||
116 | log_namespaces (void *cls, const struct GNUNET_ShortHashCode *id, void *value) | ||
117 | { | ||
118 | struct GNUNET_TESTING_NetjailNamespace *namespace = value; | ||
119 | struct GNUNET_TESTING_NetjailRouter *router = namespace->router; | ||
120 | |||
121 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
122 | "router_tcp: %u router_udp: %u spaces: %u\n", | ||
123 | router->tcp_port, | ||
124 | router->udp_port, | ||
125 | namespace->namespace_n); | ||
126 | GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes, &log_nodes, NULL); | ||
127 | return GNUNET_YES; | ||
128 | } | ||
129 | |||
130 | |||
131 | static int | ||
132 | log_topo (struct GNUNET_TESTING_NetjailTopology *topology) | ||
133 | { | ||
134 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
135 | "plugin: %s spaces: %u nodes: %u known: %u\n", | ||
136 | topology->plugin, | ||
137 | topology->namespaces_n, | ||
138 | topology->nodes_m, | ||
139 | topology->nodes_x); | ||
140 | |||
141 | GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces, | ||
142 | log_namespaces, NULL); | ||
143 | GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals, &log_nodes, | ||
144 | NULL); | ||
145 | return GNUNET_YES; | ||
146 | } | ||
147 | |||
148 | |||
149 | static struct GNUNET_TESTING_NodeConnection * | ||
150 | get_connections (unsigned int num, struct | ||
151 | GNUNET_TESTING_NetjailTopology *topology) | ||
152 | { | ||
153 | struct GNUNET_TESTING_NetjailNode *node; | ||
154 | struct GNUNET_ShortHashCode *hkey; | ||
155 | struct GNUNET_HashCode hc; | ||
156 | struct GNUNET_TESTING_NetjailNamespace *namespace; | ||
157 | unsigned int namespace_n, node_m; | ||
158 | |||
159 | log_topo (topology); | ||
160 | |||
161 | hkey = GNUNET_new (struct GNUNET_ShortHashCode); | ||
162 | if (topology->nodes_x >= num) | ||
163 | { | ||
164 | |||
165 | GNUNET_CRYPTO_hash (&num, sizeof(num), &hc); | ||
166 | memcpy (hkey, | ||
167 | &hc, | ||
168 | sizeof (*hkey)); | ||
169 | node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals, | ||
170 | hkey); | ||
171 | } | ||
172 | else | ||
173 | { | ||
174 | namespace_n = (unsigned int) floor ((num - topology->nodes_x) | ||
175 | / topology->nodes_m); | ||
176 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
177 | "num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n", | ||
178 | num, | ||
179 | topology->nodes_x, | ||
180 | topology->nodes_m, | ||
181 | namespace_n); | ||
182 | hkey = GNUNET_new (struct GNUNET_ShortHashCode); | ||
183 | GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc); | ||
184 | memcpy (hkey, | ||
185 | &hc, | ||
186 | sizeof (*hkey)); | ||
187 | namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces, | ||
188 | hkey); | ||
189 | node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1); | ||
190 | hkey = GNUNET_new (struct GNUNET_ShortHashCode); | ||
191 | GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc); | ||
192 | memcpy (hkey, | ||
193 | &hc, | ||
194 | sizeof (*hkey)); | ||
195 | node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes, | ||
196 | hkey); | ||
197 | } | ||
198 | |||
199 | |||
200 | return node->node_connections_head; | ||
201 | } | ||
58 | 202 | ||
59 | /** | ||
60 | * Label of the cmd to start a peer. | ||
61 | * | ||
62 | */ | ||
63 | const char *start_peer_label; | ||
64 | 203 | ||
65 | /** | 204 | static unsigned int |
66 | * The peer identity of this peer. | 205 | calculate_num (struct GNUNET_TESTING_NodeConnection *node_connection, |
67 | * | 206 | struct GNUNET_TESTING_NetjailTopology *topology) |
68 | */ | 207 | { |
69 | struct GNUNET_PeerIdentity *id; | 208 | unsigned int n, m, num; |
209 | |||
210 | n = node_connection->namespace_n; | ||
211 | m = node_connection->node_n; | ||
70 | 212 | ||
71 | struct GNUNET_TESTING_Interpreter *is; | 213 | if (0 == n) |
72 | }; | 214 | num = m; |
215 | else | ||
216 | num = (n - 1) * topology->nodes_m + m + topology->nodes_x; | ||
217 | |||
218 | return num; | ||
219 | } | ||
220 | |||
221 | |||
222 | static char * | ||
223 | get_address (struct GNUNET_TESTING_NodeConnection *connection, | ||
224 | char *prefix) | ||
225 | { | ||
226 | struct GNUNET_TESTING_NetjailNode *node; | ||
227 | char *addr; | ||
228 | |||
229 | node = connection->node; | ||
230 | if (connection->namespace_n == node->namespace_n) | ||
231 | { | ||
232 | if (0 == strcmp (PREFIX_TCP, prefix)) | ||
233 | { | ||
234 | |||
235 | GNUNET_asprintf (&addr, | ||
236 | CONNECT_ADDRESS_TEMPLATE_TCP, | ||
237 | connection->node_n); | ||
238 | } | ||
239 | else if (0 == strcmp (PREFIX_UDP, prefix)) | ||
240 | { | ||
241 | GNUNET_asprintf (&addr, | ||
242 | CONNECT_ADDRESS_TEMPLATE_UDP, | ||
243 | connection->node_n); | ||
244 | } | ||
245 | else | ||
246 | { | ||
247 | GNUNET_break (0); | ||
248 | } | ||
249 | } | ||
250 | else | ||
251 | { | ||
252 | if (0 == strcmp (PREFIX_TCP, prefix)) | ||
253 | { | ||
254 | |||
255 | GNUNET_asprintf (&addr, | ||
256 | ROUTER_CONNECT_ADDRESS_TEMPLATE_TCP, | ||
257 | connection->namespace_n); | ||
258 | } | ||
259 | else if (0 == strcmp (PREFIX_UDP, prefix)) | ||
260 | { | ||
261 | GNUNET_asprintf (&addr, | ||
262 | ROUTER_CONNECT_ADDRESS_TEMPLATE_UDP, | ||
263 | connection->namespace_n); | ||
264 | } | ||
265 | else | ||
266 | { | ||
267 | GNUNET_break (0); | ||
268 | } | ||
269 | } | ||
270 | |||
271 | return addr; | ||
272 | } | ||
73 | 273 | ||
74 | 274 | ||
75 | /** | 275 | /** |
@@ -83,24 +283,17 @@ connect_peers_run (void *cls, | |||
83 | struct ConnectPeersState *cps = cls; | 283 | struct ConnectPeersState *cps = cls; |
84 | const struct GNUNET_TESTING_Command *system_cmd; | 284 | const struct GNUNET_TESTING_Command *system_cmd; |
85 | struct GNUNET_TESTING_System *tl_system; | 285 | struct GNUNET_TESTING_System *tl_system; |
86 | struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key = GNUNET_new (struct | 286 | |
87 | GNUNET_CRYPTO_EddsaPrivateKey); | 287 | |
88 | struct GNUNET_CRYPTO_EddsaPublicKey *pub_key = GNUNET_new (struct | ||
89 | GNUNET_CRYPTO_EddsaPublicKey); | ||
90 | ; | ||
91 | const struct GNUNET_TESTING_Command *peer1_cmd; | 288 | const struct GNUNET_TESTING_Command *peer1_cmd; |
92 | // const struct GNUNET_TESTING_Command *peer2_cmd; | ||
93 | struct GNUNET_TRANSPORT_ApplicationHandle *ah; | 289 | struct GNUNET_TRANSPORT_ApplicationHandle *ah; |
94 | struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity); | 290 | struct GNUNET_PeerIdentity *peer; |
95 | char *addr; | 291 | char *addr; |
96 | // struct GNUNET_TIME_Absolute t; | ||
97 | char *hello; | ||
98 | // size_t *hello_size; | ||
99 | enum GNUNET_NetworkType nt = 0; | 292 | enum GNUNET_NetworkType nt = 0; |
100 | char *peer_id; | ||
101 | struct GNUNET_PeerIdentity *id; | ||
102 | struct GNUNET_PeerIdentity *other = GNUNET_new (struct GNUNET_PeerIdentity); | ||
103 | uint32_t num; | 293 | uint32_t num; |
294 | struct GNUNET_TESTING_NodeConnection *pos_connection; | ||
295 | struct GNUNET_TESTING_ADDRESS_PREFIX *pos_prefix; | ||
296 | unsigned int con_num = 0; | ||
104 | 297 | ||
105 | cps->is = is; | 298 | cps->is = is; |
106 | peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is, | 299 | peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is, |
@@ -108,121 +301,82 @@ connect_peers_run (void *cls, | |||
108 | GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd, | 301 | GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd, |
109 | &ah); | 302 | &ah); |
110 | 303 | ||
111 | GNUNET_TRANSPORT_get_trait_hello (peer1_cmd, | ||
112 | &hello); | ||
113 | |||
114 | GNUNET_TRANSPORT_get_trait_peer_id (peer1_cmd, | ||
115 | &id); | ||
116 | |||
117 | system_cmd = GNUNET_TESTING_interpreter_lookup_command (is, | 304 | system_cmd = GNUNET_TESTING_interpreter_lookup_command (is, |
118 | cps->create_label); | 305 | cps->create_label); |
119 | GNUNET_TESTING_get_trait_test_system (system_cmd, | 306 | GNUNET_TESTING_get_trait_test_system (system_cmd, |
120 | &tl_system); | 307 | &tl_system); |
121 | 308 | ||
122 | if (2 == cps->num) | 309 | cps->tl_system = tl_system; |
123 | num = 1; | ||
124 | else | ||
125 | num = 2; | ||
126 | 310 | ||
311 | cps->node_connections_head = get_connections (cps->num, cps->topology); | ||
127 | 312 | ||
128 | // if (strstr (hello, "60002") != NULL) | 313 | for (pos_connection = cps->node_connections_head; NULL != pos_connection; |
129 | if (2 == num) | 314 | pos_connection = pos_connection->next) |
130 | { | ||
131 | addr = "tcp-192.168.15.2:60002"; | ||
132 | peer_id = "F2F3X9G1YNCTXKK7A4J6M4ZM4BBSKC9DEXZVHCWQ475M0C7PNWCG"; | ||
133 | } | ||
134 | else | ||
135 | { | 315 | { |
136 | addr = "tcp-192.168.15.1:60002"; | 316 | con_num++; |
137 | peer_id = "4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730"; | 317 | num = calculate_num (pos_connection, cps->topology); |
318 | for (pos_prefix = pos_connection->address_prefixes_head; NULL != pos_prefix; | ||
319 | pos_prefix = | ||
320 | pos_prefix->next) | ||
321 | { | ||
322 | |||
323 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
324 | "prefix: %s\n", | ||
325 | pos_prefix->address_prefix); | ||
326 | |||
327 | addr = get_address (pos_connection, pos_prefix->address_prefix); | ||
328 | |||
329 | peer = get_pub_key (num, tl_system); | ||
330 | |||
331 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
332 | "num: %u pub_key %s addr: %s\n", | ||
333 | num, | ||
334 | GNUNET_CRYPTO_eddsa_public_key_to_string (&(peer->public_key)), | ||
335 | addr); | ||
336 | |||
337 | cps->id = peer; | ||
338 | |||
339 | GNUNET_TRANSPORT_application_validate (ah, | ||
340 | peer, | ||
341 | nt, | ||
342 | addr); | ||
343 | } | ||
138 | } | 344 | } |
139 | 345 | cps->con_num = con_num; | |
140 | priv_key = GNUNET_TESTING_hostkey_get (tl_system, | ||
141 | num, | ||
142 | other); | ||
143 | |||
144 | GNUNET_CRYPTO_eddsa_key_get_public (priv_key, | ||
145 | pub_key); | ||
146 | |||
147 | GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id, | ||
148 | strlen (peer_id), | ||
149 | &peer->public_key); | ||
150 | |||
151 | peer->public_key = *pub_key; | ||
152 | |||
153 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
154 | "\nnum: %u\n peer_id: %s\n pub_key %s\n", | ||
155 | num, | ||
156 | peer_id, | ||
157 | GNUNET_CRYPTO_eddsa_public_key_to_string (pub_key)); | ||
158 | |||
159 | cps->id = peer; | ||
160 | |||
161 | // TODO This does not work, because the other peer is running in another local loop. We need to message between different local loops. For now we will create the hello manually with the known information about the other local peers. | ||
162 | // --------------------------------------------- | ||
163 | /*peer2_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer2_label); | ||
164 | GNUNET_TRANSPORT_get_trait_peer_id (peer2_cmd, | ||
165 | &id); | ||
166 | GNUNET_TRANSPORT_get_trait_hello (peer2_cmd, | ||
167 | &hello); | ||
168 | GNUNET_TRANSPORT_get_trait_hello_size (peer2_cmd, | ||
169 | &hello_size); | ||
170 | |||
171 | addr = GNUNET_HELLO_extract_address (hello, | ||
172 | *hello_size, | ||
173 | id, | ||
174 | &nt, | ||
175 | &t);*/ | ||
176 | |||
177 | // ---------------------------------------------- | ||
178 | |||
179 | |||
180 | GNUNET_TRANSPORT_application_validate (ah, | ||
181 | peer, | ||
182 | nt, | ||
183 | addr); | ||
184 | } | 346 | } |
185 | 347 | ||
186 | 348 | ||
187 | /** | 349 | /** |
188 | * The finish function of this cmd will check if the peer we are trying to connect to is in the connected peers map of the start peer cmd for this peer. | 350 | * Callback from start peer cmd for signaling a peer got connected. |
189 | * | 351 | * |
190 | */ | 352 | */ |
191 | // FIXME: this needs a complete rewrite! | 353 | static void * |
192 | static int | 354 | notify_connect (void *cls, |
193 | connect_peers_finish (void *cls, | 355 | const struct GNUNET_PeerIdentity *peer, |
194 | GNUNET_SCHEDULER_TaskCallback cont, | 356 | struct GNUNET_MQ_Handle *mq) |
195 | void *cont_cls) | ||
196 | { | 357 | { |
197 | struct ConnectPeersState *cps = cls; | 358 | struct ConnectPeersState *cps = cls; |
198 | const struct GNUNET_TESTING_Command *peer1_cmd; | 359 | struct GNUNET_PeerIdentity *peer_connection; |
199 | struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; | 360 | unsigned int con_num = 0; |
200 | unsigned int ret; | 361 | struct GNUNET_TESTING_NodeConnection *pos_connection; |
201 | struct GNUNET_ShortHashCode *key = GNUNET_new (struct GNUNET_ShortHashCode); | 362 | unsigned int num; |
202 | struct GNUNET_HashCode hc; | 363 | void *ret = NULL; |
203 | int node_number; | 364 | |
204 | 365 | for (pos_connection = cps->node_connections_head; NULL != pos_connection; | |
205 | peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->is, | 366 | pos_connection = pos_connection->next) |
206 | cps->start_peer_label); | 367 | { |
207 | GNUNET_TRANSPORT_get_trait_connected_peers_map (peer1_cmd, | 368 | num = calculate_num (pos_connection, cps->topology); |
208 | &connected_peers_map); | 369 | peer_connection = get_pub_key (num, cps->tl_system); |
209 | 370 | if (0 == GNUNET_memcmp (peer, | |
210 | node_number = 1; | 371 | peer_connection)) |
211 | GNUNET_CRYPTO_hash (&node_number, sizeof(node_number), &hc); | 372 | con_num++; |
373 | } | ||
212 | 374 | ||
213 | // TODO we need to store with a key identifying the netns node in the future. For now we have only one connecting node. | ||
214 | memcpy (key, | ||
215 | &hc, | ||
216 | sizeof (*key)); | ||
217 | ret = GNUNET_CONTAINER_multishortmap_contains (connected_peers_map, | ||
218 | key); | ||
219 | 375 | ||
220 | if (GNUNET_YES == ret) | 376 | if (cps->con_num == con_num) |
221 | { | 377 | { |
222 | cont (cont_cls); | 378 | GNUNET_TESTING_async_finish (&cps->ac); |
223 | } | 379 | } |
224 | |||
225 | GNUNET_free (key); | ||
226 | return ret; | 380 | return ret; |
227 | } | 381 | } |
228 | 382 | ||
@@ -241,11 +395,58 @@ connect_peers_cleanup (void *cls) | |||
241 | } | 395 | } |
242 | 396 | ||
243 | 397 | ||
398 | /** | ||
399 | * This function prepares an array with traits. | ||
400 | * | ||
401 | */ | ||
402 | static int | ||
403 | connect_peers_traits (void *cls, | ||
404 | const void **ret, | ||
405 | const char *trait, | ||
406 | unsigned int index) | ||
407 | { | ||
408 | struct StartPeerState *cps = cls; | ||
409 | struct GNUNET_TESTING_Trait traits[] = { | ||
410 | { | ||
411 | .index = 0, | ||
412 | .trait_name = "state", | ||
413 | .ptr = (const void *) cps, | ||
414 | }, | ||
415 | GNUNET_TESTING_trait_end () | ||
416 | }; | ||
417 | return GNUNET_TESTING_get_trait (traits, | ||
418 | ret, | ||
419 | trait, | ||
420 | index); | ||
421 | } | ||
422 | |||
423 | |||
424 | /** | ||
425 | * Function to get the trait with the struct ConnectPeersState. | ||
426 | * | ||
427 | * @param[out] sps struct ConnectPeersState. | ||
428 | * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. | ||
429 | * | ||
430 | */ | ||
431 | int | ||
432 | GNUNET_TESTING_get_trait_connect_peer_state ( | ||
433 | const struct GNUNET_TESTING_Command *cmd, | ||
434 | struct ConnectPeersState **cps) | ||
435 | { | ||
436 | return cmd->traits (cmd->cls, | ||
437 | (const void **) cps, | ||
438 | "state", | ||
439 | (unsigned int) 0); | ||
440 | } | ||
441 | |||
442 | |||
244 | struct GNUNET_TESTING_Command | 443 | struct GNUNET_TESTING_Command |
245 | GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | 444 | GNUNET_TRANSPORT_cmd_connect_peers (const char *label, |
246 | const char *start_peer_label, | 445 | const char *start_peer_label, |
247 | const char *create_label, | 446 | const char *create_label, |
248 | uint32_t num) | 447 | uint32_t num, |
448 | struct GNUNET_TESTING_NetjailTopology * | ||
449 | topology) | ||
249 | { | 450 | { |
250 | struct ConnectPeersState *cps; | 451 | struct ConnectPeersState *cps; |
251 | 452 | ||
@@ -253,6 +454,8 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | |||
253 | cps->start_peer_label = start_peer_label; | 454 | cps->start_peer_label = start_peer_label; |
254 | cps->num = num; | 455 | cps->num = num; |
255 | cps->create_label = create_label; | 456 | cps->create_label = create_label; |
457 | cps->topology = topology; | ||
458 | cps->notify_connect = ¬ify_connect; | ||
256 | 459 | ||
257 | { | 460 | { |
258 | struct GNUNET_TESTING_Command cmd = { | 461 | struct GNUNET_TESTING_Command cmd = { |
@@ -260,7 +463,8 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label, | |||
260 | .label = label, | 463 | .label = label, |
261 | .run = &connect_peers_run, | 464 | .run = &connect_peers_run, |
262 | .ac = &cps->ac, | 465 | .ac = &cps->ac, |
263 | .cleanup = &connect_peers_cleanup | 466 | .cleanup = &connect_peers_cleanup, |
467 | .traits = &connect_peers_traits | ||
264 | }; | 468 | }; |
265 | 469 | ||
266 | return cmd; | 470 | return cmd; |