diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-06-25 20:33:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-06-25 20:33:57 +0000 |
commit | 93cf4031938ca0f3d13ce491ba9be2c77763ffae (patch) | |
tree | f19ff21d13772eedc42d4f86d1b844891c3e3055 /src/testbed/testbed_api.h | |
parent | 98764c99d4e56c8520ac5d1f3a056649fa2137fc (diff) | |
download | gnunet-93cf4031938ca0f3d13ce491ba9be2c77763ffae.tar.gz gnunet-93cf4031938ca0f3d13ce491ba9be2c77763ffae.zip |
remove global variable for barriers, move into controller
Diffstat (limited to 'src/testbed/testbed_api.h')
-rw-r--r-- | src/testbed/testbed_api.h | 76 |
1 files changed, 46 insertions, 30 deletions
diff --git a/src/testbed/testbed_api.h b/src/testbed/testbed_api.h index cf39e3415..7a8e6539a 100644 --- a/src/testbed/testbed_api.h +++ b/src/testbed/testbed_api.h | |||
@@ -183,7 +183,8 @@ struct OperationContext | |||
183 | * | 183 | * |
184 | * @param cls closure | 184 | * @param cls closure |
185 | */ | 185 | */ |
186 | typedef void (*TESTBED_opcq_empty_cb) (void *cls); | 186 | typedef void |
187 | (*TESTBED_opcq_empty_cb) (void *cls); | ||
187 | 188 | ||
188 | 189 | ||
189 | /** | 190 | /** |
@@ -274,6 +275,12 @@ struct GNUNET_TESTBED_Controller | |||
274 | struct OperationQueue *opq_parallel_topology_config_operations; | 275 | struct OperationQueue *opq_parallel_topology_config_operations; |
275 | 276 | ||
276 | /** | 277 | /** |
278 | * handle for hashtable of barrier handles, values are | ||
279 | * of type `struct GNUNET_TESTBED_Barrier`. | ||
280 | */ | ||
281 | struct GNUNET_CONTAINER_MultiHashMap *barrier_map; | ||
282 | |||
283 | /** | ||
277 | * The controller event mask | 284 | * The controller event mask |
278 | */ | 285 | */ |
279 | uint64_t event_mask; | 286 | uint64_t event_mask; |
@@ -292,6 +299,44 @@ struct GNUNET_TESTBED_Controller | |||
292 | 299 | ||
293 | 300 | ||
294 | /** | 301 | /** |
302 | * Handle for barrier | ||
303 | */ | ||
304 | struct GNUNET_TESTBED_Barrier | ||
305 | { | ||
306 | /** | ||
307 | * hashcode identifying this barrier in the hashmap | ||
308 | */ | ||
309 | struct GNUNET_HashCode key; | ||
310 | |||
311 | /** | ||
312 | * The controller handle given while initiliasing this barrier | ||
313 | */ | ||
314 | struct GNUNET_TESTBED_Controller *c; | ||
315 | |||
316 | /** | ||
317 | * The name of the barrier | ||
318 | */ | ||
319 | char *name; | ||
320 | |||
321 | /** | ||
322 | * The continuation callback to call when we have a status update on this | ||
323 | */ | ||
324 | GNUNET_TESTBED_barrier_status_cb cb; | ||
325 | |||
326 | /** | ||
327 | * the closure for the above callback | ||
328 | */ | ||
329 | void *cls; | ||
330 | |||
331 | /** | ||
332 | * Should the barrier crossed status message be echoed back to the controller? | ||
333 | */ | ||
334 | int echo; | ||
335 | }; | ||
336 | |||
337 | |||
338 | |||
339 | /** | ||
295 | * Queues a message in send queue for sending to the service | 340 | * Queues a message in send queue for sending to the service |
296 | * | 341 | * |
297 | * @param controller the handle to the controller | 342 | * @param controller the handle to the controller |
@@ -460,34 +505,5 @@ GNUNET_TESTBED_get_slave_config_ (void *op_cls, | |||
460 | uint32_t slave_host_id); | 505 | uint32_t slave_host_id); |
461 | 506 | ||
462 | 507 | ||
463 | /** | ||
464 | * Validate #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS message. | ||
465 | * | ||
466 | * @param cls the controller handle to determine the connection this message | ||
467 | * belongs to | ||
468 | * @param msg the barrier status message | ||
469 | * @return #GNUNET_OK if the message is valid; #GNUNET_SYSERR to tear it | ||
470 | * down signalling an error (message malformed) | ||
471 | */ | ||
472 | int | ||
473 | check_barrier_status_ (struct GNUNET_TESTBED_Controller *c, | ||
474 | const struct GNUNET_TESTBED_BarrierStatusMsg *msg); | ||
475 | |||
476 | |||
477 | /** | ||
478 | * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS messages. This | ||
479 | * function is defined in @file testbed_api_barriers.c | ||
480 | * | ||
481 | * @param c the controller handle to determine the connection this message | ||
482 | * belongs to | ||
483 | * @param msg the barrier status message | ||
484 | */ | ||
485 | void | ||
486 | handle_barrier_status_ (struct GNUNET_TESTBED_Controller *c, | ||
487 | const struct GNUNET_TESTBED_BarrierStatusMsg *msg); | ||
488 | |||
489 | |||
490 | |||
491 | |||
492 | #endif | 508 | #endif |
493 | /* end of testbed_api.h */ | 509 | /* end of testbed_api.h */ |