From 8a0c060308e16374c16c5c5456b3dd2604398b5b Mon Sep 17 00:00:00 2001 From: Sree Harsha Totakura Date: Tue, 9 Oct 2012 14:03:19 +0000 Subject: towards on-demand configuration retrival for remote controllers during overlay connect operations --- src/testbed/testbed_api.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/testbed/testbed_api.c') diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index 1d99c7e3f..35956f852 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c @@ -858,6 +858,46 @@ handle_slave_config (struct GNUNET_TESTBED_Controller *c, } +/** + * Handler for GNUNET_MESSAGE_TYPE_TESTBED_NEEDCONTROLLERCONFIG message from + * controller (testbed service) + * + * @param c the controller handler + * @param msg message received + * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if + * not + */ +static int +handle_need_controller_config (struct GNUNET_TESTBED_Controller *c, + const struct GNUNET_TESTBED_NeedControllerConfig * msg) +{ + struct OperationContext *opc; + struct OverlayConnectData *oc_data; + uint64_t op_id; + + op_id = GNUNET_ntohll (msg->operation_id); + if (NULL == (opc = find_opc (c, op_id))) + { + LOG_DEBUG ("Operation not found\n"); + return GNUNET_YES; + } + if (OP_FORWARDED == opc->type) + { + handle_forwarded_operation_msg (c, opc, + (const struct GNUNET_MessageHeader *) msg); + return GNUNET_YES; + } + oc_data = opc->data; + /* FIXME: Should spawn operations to: + 1. Acquire configuration of peer2's controller, + 2. link peer1's controller to peer2's controller + 3. ask them to attempt overlay connect on peer1 and peer2 again */ + GNUNET_break (NULL == oc_data); + GNUNET_break (0); + return GNUNET_YES; +} + + /** * Handler for messages from controller (testbed service) * @@ -952,6 +992,14 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg) handle_slave_config (c, (const struct GNUNET_TESTBED_SlaveConfiguration *) msg); break; + case GNUNET_MESSAGE_TYPE_TESTBED_NEEDCONTROLLERCONFIG: + GNUNET_assert (msize == sizeof (struct + GNUNET_TESTBED_NeedControllerConfig)); + status = + handle_need_controller_config (c, (const struct + GNUNET_TESTBED_NeedControllerConfig + *) msg); + break; default: GNUNET_assert (0); } -- cgit v1.2.3