From 93cf4031938ca0f3d13ce491ba9be2c77763ffae Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 25 Jun 2016 20:33:57 +0000 Subject: remove global variable for barriers, move into controller --- src/testbed/testbed_api.h | 76 ++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 30 deletions(-) (limited to 'src/testbed/testbed_api.h') 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 * * @param cls closure */ -typedef void (*TESTBED_opcq_empty_cb) (void *cls); +typedef void +(*TESTBED_opcq_empty_cb) (void *cls); /** @@ -273,6 +274,12 @@ struct GNUNET_TESTBED_Controller */ struct OperationQueue *opq_parallel_topology_config_operations; + /** + * handle for hashtable of barrier handles, values are + * of type `struct GNUNET_TESTBED_Barrier`. + */ + struct GNUNET_CONTAINER_MultiHashMap *barrier_map; + /** * The controller event mask */ @@ -291,6 +298,44 @@ struct GNUNET_TESTBED_Controller }; +/** + * Handle for barrier + */ +struct GNUNET_TESTBED_Barrier +{ + /** + * hashcode identifying this barrier in the hashmap + */ + struct GNUNET_HashCode key; + + /** + * The controller handle given while initiliasing this barrier + */ + struct GNUNET_TESTBED_Controller *c; + + /** + * The name of the barrier + */ + char *name; + + /** + * The continuation callback to call when we have a status update on this + */ + GNUNET_TESTBED_barrier_status_cb cb; + + /** + * the closure for the above callback + */ + void *cls; + + /** + * Should the barrier crossed status message be echoed back to the controller? + */ + int echo; +}; + + + /** * Queues a message in send queue for sending to the service * @@ -460,34 +505,5 @@ GNUNET_TESTBED_get_slave_config_ (void *op_cls, uint32_t slave_host_id); -/** - * Validate #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS message. - * - * @param cls the controller handle to determine the connection this message - * belongs to - * @param msg the barrier status message - * @return #GNUNET_OK if the message is valid; #GNUNET_SYSERR to tear it - * down signalling an error (message malformed) - */ -int -check_barrier_status_ (struct GNUNET_TESTBED_Controller *c, - const struct GNUNET_TESTBED_BarrierStatusMsg *msg); - - -/** - * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS messages. This - * function is defined in @file testbed_api_barriers.c - * - * @param c the controller handle to determine the connection this message - * belongs to - * @param msg the barrier status message - */ -void -handle_barrier_status_ (struct GNUNET_TESTBED_Controller *c, - const struct GNUNET_TESTBED_BarrierStatusMsg *msg); - - - - #endif /* end of testbed_api.h */ -- cgit v1.2.3