}
-/**
- * Same as the GNUNET_TESTBED_controller_link_2, but with ids for delegated host
- * and slave host
- *
- * @param op_cls the operation closure for the event which is generated to
- * signal success or failure of this operation
- * @param master handle to the master controller who creates the association
- * @param delegated_host_id id of the host to which requests should be delegated
- * @param slave_host_id id of the host which is used to run the slave controller
- * @param sxcfg serialized and compressed configuration
- * @param sxcfg_size the size sxcfg
- * @param scfg_size the size of uncompressed serialized configuration
- * @param is_subordinate GNUNET_YES if the controller at delegated_host should
- * be started by the slave controller; GNUNET_NO if the slave
- * controller has to connect to the already started delegated
- * controller via TCP/IP
- * @return the operation handle
- */
-struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_controller_link_2_ (void *op_cls,
- struct GNUNET_TESTBED_Controller *master,
- uint32_t delegated_host_id,
- uint32_t slave_host_id, const char *sxcfg,
- size_t sxcfg_size, size_t scfg_size,
- int is_subordinate)
-{
- struct OperationContext *opc;
- struct GNUNET_TESTBED_ControllerLinkRequest *msg;
- struct ControllerLinkData *data;
- uint16_t msg_size;
-
- msg_size = sxcfg_size + sizeof (struct GNUNET_TESTBED_ControllerLinkRequest);
- msg = GNUNET_malloc (msg_size);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS);
- msg->header.size = htons (msg_size);
- msg->delegated_host_id = htonl (delegated_host_id);
- msg->slave_host_id = htonl (slave_host_id);
- msg->config_size = htons ((uint16_t) scfg_size);
- msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;
- memcpy (&msg[1], sxcfg, sxcfg_size);
- data = GNUNET_malloc (sizeof (struct ControllerLinkData));
- data->msg = msg;
- data->host_id = delegated_host_id;
- opc = GNUNET_malloc (sizeof (struct OperationContext));
- opc->c = master;
- opc->data = data;
- opc->type = OP_LINK_CONTROLLERS;
- opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
- opc->state = OPC_STATE_INIT;
- opc->op_cls = op_cls;
- msg->operation_id = GNUNET_htonll (opc->id);
- opc->op =
- GNUNET_TESTBED_operation_create_ (opc, &opstart_link_controllers,
- &oprelease_link_controllers);
- GNUNET_TESTBED_operation_queue_insert_ (master->opq_parallel_operations,
- opc->op);
- GNUNET_TESTBED_operation_begin_wait_ (opc->op);
- return opc->op;
-}
-
-
-/**
- * Same as the GNUNET_TESTBED_controller_link, however expects configuration in
- * serialized and compressed
- *
- * @param op_cls the operation closure for the event which is generated to
- * signal success or failure of this operation
- * @param master handle to the master controller who creates the association
- * @param delegated_host requests to which host should be delegated; cannot be NULL
- * @param slave_host which host is used to run the slave controller; use NULL to
- * make the master controller connect to the delegated host
- * @param sxcfg serialized and compressed configuration
- * @param sxcfg_size the size sxcfg
- * @param scfg_size the size of uncompressed serialized configuration
- * @param is_subordinate GNUNET_YES if the controller at delegated_host should
- * be started by the slave controller; GNUNET_NO if the slave
- * controller has to connect to the already started delegated
- * controller via TCP/IP
- * @return the operation handle
- */
-struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_controller_link_2 (void *op_cls,
- struct GNUNET_TESTBED_Controller *master,
- struct GNUNET_TESTBED_Host *delegated_host,
- struct GNUNET_TESTBED_Host *slave_host,
- const char *sxcfg, size_t sxcfg_size,
- size_t scfg_size, int is_subordinate)
-{
- uint32_t delegated_host_id;
- uint32_t slave_host_id;
-
- GNUNET_assert (GNUNET_YES ==
- GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
- delegated_host_id = GNUNET_TESTBED_host_get_id_ (delegated_host);
- slave_host_id =
- GNUNET_TESTBED_host_get_id_ ((NULL !=
- slave_host) ? slave_host : master->host);
- if ((NULL != slave_host) && (0 != GNUNET_TESTBED_host_get_id_ (slave_host)))
- GNUNET_assert (GNUNET_YES ==
- GNUNET_TESTBED_is_host_registered_ (slave_host, master));
-
- return GNUNET_TESTBED_controller_link_2_ (op_cls, master, delegated_host_id,
- slave_host_id, sxcfg, sxcfg_size,
- scfg_size, is_subordinate);
-}
-
-
/**
* Compresses given configuration using zlib compress
*
*size = size_;
*xsize = xsize_;
return xconfig;
-}
-
-
-/**
- * Same as the GNUNET_TESTBED_controller_link, but with ids for delegated host
- * and slave host
- *
- * @param op_cls the operation closure for the event which is generated to
- * signal success or failure of this operation
- * @param master handle to the master controller who creates the association
- * @param delegated_host_id id of the host to which requests should be
- * delegated; cannot be NULL
- * @param slave_host_id id of the host which should connect to controller
- * running on delegated host ; use NULL to make the master controller
- * connect to the delegated host
- * @param slave_cfg configuration to use for the slave controller
- * @param is_subordinate GNUNET_YES if the controller at delegated_host should
- * be started by the slave controller; GNUNET_NO if the slave
- * controller has to connect to the already started delegated
- * controller via TCP/IP
- * @return the operation handle
- */
-struct GNUNET_TESTBED_Operation *
-GNUNET_TESTBED_controller_link_ (void *op_cls,
- struct GNUNET_TESTBED_Controller *master,
- uint32_t delegated_host_id,
- uint32_t slave_host_id,
- const struct GNUNET_CONFIGURATION_Handle
- *slave_cfg, int is_subordinate)
-{
- struct GNUNET_TESTBED_Operation *op;
- char *config;
- char *cconfig;
- size_t cc_size;
- size_t config_size;
-
- config = GNUNET_CONFIGURATION_serialize (slave_cfg, &config_size);
- cc_size = GNUNET_TESTBED_compress_config_ (config, config_size, &cconfig);
- GNUNET_free (config);
- /* Configuration doesn't fit in 1 message */
- GNUNET_assert ((UINT16_MAX -
- sizeof (struct GNUNET_TESTBED_ControllerLinkRequest)) >=
- cc_size);
- op = GNUNET_TESTBED_controller_link_2_ (op_cls, master, delegated_host_id,
- slave_host_id, (const char *) cconfig,
- cc_size, config_size, is_subordinate);
- GNUNET_free (cconfig);
- return op;
}
const struct GNUNET_CONFIGURATION_Handle
*slave_cfg, int is_subordinate)
{
+ struct OperationContext *opc;
+ struct GNUNET_TESTBED_ControllerLinkRequest *msg;
+ struct ControllerLinkData *data;
uint32_t slave_host_id;
uint32_t delegated_host_id;
+ uint16_t msg_size;
GNUNET_assert (GNUNET_YES ==
GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
if ((NULL != slave_host) && (0 != slave_host_id))
GNUNET_assert (GNUNET_YES ==
GNUNET_TESTBED_is_host_registered_ (slave_host, master));
- return GNUNET_TESTBED_controller_link_ (op_cls, master, delegated_host_id,
- slave_host_id,
- GNUNET_TESTBED_host_get_cfg_ (delegated_host),
- is_subordinate);
-
+ msg_size = sizeof (struct GNUNET_TESTBED_ControllerLinkRequest);
+ msg = GNUNET_malloc (msg_size);
+ msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS);
+ msg->header.size = htons (msg_size);
+ msg->delegated_host_id = htonl (delegated_host_id);
+ msg->slave_host_id = htonl (slave_host_id);
+ msg->is_subordinate = (GNUNET_YES == is_subordinate) ? 1 : 0;data = GNUNET_malloc (sizeof (struct ControllerLinkData));
+ data->msg = msg;
+ data->host_id = delegated_host_id;
+ opc = GNUNET_malloc (sizeof (struct OperationContext));
+ opc->c = master;
+ opc->data = data;
+ opc->type = OP_LINK_CONTROLLERS;
+ opc->id = GNUNET_TESTBED_get_next_op_id (opc->c);
+ opc->state = OPC_STATE_INIT;
+ opc->op_cls = op_cls;
+ msg->operation_id = GNUNET_htonll (opc->id);
+ opc->op =
+ GNUNET_TESTBED_operation_create_ (opc, &opstart_link_controllers,
+ &oprelease_link_controllers);
+ GNUNET_TESTBED_operation_queue_insert_ (master->opq_parallel_operations,
+ opc->op);
+ GNUNET_TESTBED_operation_begin_wait_ (opc->op);
+ return opc->op;
}
xdata = (const Bytef *) &imsg[1];
}
break;
- case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS:
- {
- const struct GNUNET_TESTBED_ControllerLinkRequest *imsg;
- imsg = (const struct GNUNET_TESTBED_ControllerLinkRequest *) msg;
- data_len = ntohs (imsg->config_size);
- xdata_len = ntohs (imsg->header.size) - sizeof (const struct
- GNUNET_TESTBED_ControllerLinkRequest);
- xdata = (const Bytef *) &imsg[1];
- }
- break;
default:
GNUNET_assert (0);
}