aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/testbed_api.c')
-rw-r--r--src/testbed/testbed_api.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 3539eae03..2ee17c9e0 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -202,7 +202,7 @@ exop_insert (struct GNUNET_TESTBED_Operation *op)
202 202
203 entry = GNUNET_malloc (sizeof (struct ExpireOperationEntry)); 203 entry = GNUNET_malloc (sizeof (struct ExpireOperationEntry));
204 entry->op = op; 204 entry->op = op;
205 GNUNET_CONTAINER_DLL_insert_tail (exop_head, exop_tail, entry); 205 GNUNET_CONTAINER_DLL_insert_tail (exop_head, exop_tail, entry);
206} 206}
207 207
208 208
@@ -281,7 +281,7 @@ opc_search_iterator (void *cls, uint32_t key, void *value)
281{ 281{
282 struct SearchContext *sc = cls; 282 struct SearchContext *sc = cls;
283 struct OperationContext *opc = value; 283 struct OperationContext *opc = value;
284 284
285 GNUNET_assert (NULL != opc); 285 GNUNET_assert (NULL != opc);
286 GNUNET_assert (NULL == sc->opc); 286 GNUNET_assert (NULL == sc->opc);
287 if (opc->id != sc->id) 287 if (opc->id != sc->id)
@@ -307,7 +307,7 @@ find_opc (const struct GNUNET_TESTBED_Controller *c, const uint64_t id)
307 sc.id = id; 307 sc.id = id;
308 sc.opc = NULL; 308 sc.opc = NULL;
309 GNUNET_assert (NULL != c->opc_map); 309 GNUNET_assert (NULL != c->opc_map);
310 if (GNUNET_SYSERR != 310 if (GNUNET_SYSERR !=
311 GNUNET_CONTAINER_multihashmap32_get_multiple (c->opc_map, (uint32_t) id, 311 GNUNET_CONTAINER_multihashmap32_get_multiple (c->opc_map, (uint32_t) id,
312 &opc_search_iterator, &sc)) 312 &opc_search_iterator, &sc))
313 return NULL; 313 return NULL;
@@ -330,7 +330,7 @@ GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c,
330 if (NULL == c->opc_map) 330 if (NULL == c->opc_map)
331 c->opc_map = GNUNET_CONTAINER_multihashmap32_create (256); 331 c->opc_map = GNUNET_CONTAINER_multihashmap32_create (256);
332 GNUNET_assert (GNUNET_OK == 332 GNUNET_assert (GNUNET_OK ==
333 GNUNET_CONTAINER_multihashmap32_put (c->opc_map, 333 GNUNET_CONTAINER_multihashmap32_put (c->opc_map,
334 (uint32_t) opc->id, opc, 334 (uint32_t) opc->id, opc,
335 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); 335 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
336} 336}
@@ -341,7 +341,7 @@ GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c,
341 * given controller 341 * given controller
342 * 342 *
343 * @param c the controller 343 * @param c the controller
344 * @param opc the operation context to remove 344 * @param opc the operation context to remove
345 */ 345 */
346void 346void
347GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c, 347GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c,
@@ -465,7 +465,7 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c,
465 } 465 }
466 GNUNET_TESTBED_remove_opc_ (opc->c, opc); 466 GNUNET_TESTBED_remove_opc_ (opc->c, opc);
467 opc->state = OPC_STATE_FINISHED; 467 opc->state = OPC_STATE_FINISHED;
468 exop_insert (event.op); 468 exop_insert (event.op);
469 if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED))) 469 if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED)))
470 { 470 {
471 if (NULL != c->cc) 471 if (NULL != c->cc)
@@ -611,7 +611,7 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c,
611 if (0 != (mask & c->event_mask)) 611 if (0 != (mask & c->event_mask))
612 { 612 {
613 if (NULL != c->cc) 613 if (NULL != c->cc)
614 c->cc (c->cc_cls, &event); 614 c->cc (c->cc_cls, &event);
615 if (GNUNET_NO == exop_check (event.op)) 615 if (GNUNET_NO == exop_check (event.op))
616 return GNUNET_YES; 616 return GNUNET_YES;
617 } 617 }
@@ -689,7 +689,7 @@ handle_peer_conevent (struct GNUNET_TESTBED_Controller *c,
689 c->cc (c->cc_cls, &event); 689 c->cc (c->cc_cls, &event);
690 if (GNUNET_NO == exop_check (event.op)) 690 if (GNUNET_NO == exop_check (event.op))
691 return GNUNET_YES; 691 return GNUNET_YES;
692 } 692 }
693 if (NULL != cb) 693 if (NULL != cb)
694 cb (cb_cls, opc->op, NULL); 694 cb (cb_cls, opc->op, NULL);
695 /* You could have marked the operation as done by now */ 695 /* You could have marked the operation as done by now */
@@ -738,12 +738,12 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
738 GNUNET_assert (NULL != peer); 738 GNUNET_assert (NULL != peer);
739 GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id); 739 GNUNET_assert (ntohl (msg->peer_id) == peer->unique_id);
740 pinfo = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerInformation)); 740 pinfo = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerInformation));
741 pinfo->pit = data->pit; 741 pinfo->pit = data->pit;
742 cb = data->cb; 742 cb = data->cb;
743 cb_cls = data->cb_cls; 743 cb_cls = data->cb_cls;
744 GNUNET_assert (NULL != cb); 744 GNUNET_assert (NULL != cb);
745 GNUNET_free (data); 745 GNUNET_free (data);
746 opc->data = NULL; 746 opc->data = NULL;
747 switch (pinfo->pit) 747 switch (pinfo->pit)
748 { 748 {
749 case GNUNET_TESTBED_PIT_IDENTITY: 749 case GNUNET_TESTBED_PIT_IDENTITY:
@@ -760,7 +760,7 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
760 break; 760 break;
761 } 761 }
762 opc->data = pinfo; 762 opc->data = pinfo;
763 GNUNET_TESTBED_remove_opc_ (opc->c, opc); 763 GNUNET_TESTBED_remove_opc_ (opc->c, opc);
764 opc->state = OPC_STATE_FINISHED; 764 opc->state = OPC_STATE_FINISHED;
765 cb (cb_cls, opc->op, pinfo, NULL); 765 cb (cb_cls, opc->op, pinfo, NULL);
766 /* We dont check whether the operation is marked as done here as the 766 /* We dont check whether the operation is marked as done here as the
@@ -871,7 +871,7 @@ handle_op_fail_event (struct GNUNET_TESTBED_Controller *c,
871 case OP_FORWARDED: 871 case OP_FORWARDED:
872 GNUNET_assert (0); 872 GNUNET_assert (0);
873 case OP_LINK_CONTROLLERS: /* No secondary callback */ 873 case OP_LINK_CONTROLLERS: /* No secondary callback */
874 break; 874 break;
875 case OP_SHUTDOWN_PEERS: 875 case OP_SHUTDOWN_PEERS:
876 { 876 {
877 struct ShutdownPeersData *data; 877 struct ShutdownPeersData *data;
@@ -1156,7 +1156,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
1156 msg); 1156 msg);
1157 break; 1157 break;
1158 case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT: 1158 case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT:
1159 status = 1159 status =
1160 handle_link_controllers_result (c, 1160 handle_link_controllers_result (c,
1161 (const struct 1161 (const struct
1162 GNUNET_TESTBED_ControllerLinkResponse 1162 GNUNET_TESTBED_ControllerLinkResponse
@@ -1365,7 +1365,7 @@ oprelease_link_controllers (void *cls)
1365 switch (opc->state) 1365 switch (opc->state)
1366 { 1366 {
1367 case OPC_STATE_INIT: 1367 case OPC_STATE_INIT:
1368 GNUNET_free (data->msg); 1368 GNUNET_free (data->msg);
1369 break; 1369 break;
1370 case OPC_STATE_STARTED: 1370 case OPC_STATE_STARTED:
1371 GNUNET_TESTBED_remove_opc_ (opc->c, opc); 1371 GNUNET_TESTBED_remove_opc_ (opc->c, opc);
@@ -1543,7 +1543,7 @@ opc_free_iterator (void *cls, uint32_t key, void *value)
1543 1543
1544 GNUNET_assert (NULL != opc); 1544 GNUNET_assert (NULL != opc);
1545 GNUNET_break (0); 1545 GNUNET_break (0);
1546 GNUNET_assert (GNUNET_YES == 1546 GNUNET_assert (GNUNET_YES ==
1547 GNUNET_CONTAINER_multihashmap32_remove (map, key, value)); 1547 GNUNET_CONTAINER_multihashmap32_remove (map, key, value));
1548 GNUNET_free (opc); 1548 GNUNET_free (opc);
1549 return GNUNET_YES; 1549 return GNUNET_YES;
@@ -1638,7 +1638,7 @@ GNUNET_TESTBED_compress_cfg_ (const struct GNUNET_CONFIGURATION_Handle *cfg,
1638 char *xconfig; 1638 char *xconfig;
1639 size_t size_; 1639 size_t size_;
1640 size_t xsize_; 1640 size_t xsize_;
1641 1641
1642 config = GNUNET_CONFIGURATION_serialize (cfg, &size_); 1642 config = GNUNET_CONFIGURATION_serialize (cfg, &size_);
1643 xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig); 1643 xsize_ = GNUNET_TESTBED_compress_config_ (config, size_, &xconfig);
1644 GNUNET_free (config); 1644 GNUNET_free (config);
@@ -1689,7 +1689,7 @@ GNUNET_TESTBED_controller_link (void *op_cls,
1689 uint32_t slave_host_id; 1689 uint32_t slave_host_id;
1690 uint32_t delegated_host_id; 1690 uint32_t delegated_host_id;
1691 uint16_t msg_size; 1691 uint16_t msg_size;
1692 1692
1693 GNUNET_assert (GNUNET_YES == 1693 GNUNET_assert (GNUNET_YES ==
1694 GNUNET_TESTBED_is_host_registered_ (delegated_host, master)); 1694 GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
1695 slave_host_id = 1695 slave_host_id =
@@ -1875,7 +1875,7 @@ GNUNET_TESTBED_create_helper_init_msg_ (const char *trusted_ip,
1875 * cancels the operation, frees its resources and ensures the no event is 1875 * cancels the operation, frees its resources and ensures the no event is
1876 * generated with respect to this operation. Note that however cancelling an 1876 * generated with respect to this operation. Note that however cancelling an
1877 * operation does NOT guarantee that the operation will be fully undone (or that 1877 * operation does NOT guarantee that the operation will be fully undone (or that
1878 * nothing ever happened). 1878 * nothing ever happened).
1879 * 1879 *
1880 * This function MUST be called for every operation to fully remove the 1880 * This function MUST be called for every operation to fully remove the
1881 * operation from the operation queue. After calling this function, if 1881 * operation from the operation queue. After calling this function, if
@@ -1949,11 +1949,11 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
1949 { 1949 {
1950 const struct GNUNET_TESTBED_AddHostMessage *imsg; 1950 const struct GNUNET_TESTBED_AddHostMessage *imsg;
1951 uint16_t osize; 1951 uint16_t osize;
1952 1952
1953 imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg; 1953 imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg;
1954 data_len = (uLong) ntohs (imsg->config_size); 1954 data_len = (uLong) ntohs (imsg->config_size);
1955 osize = sizeof (struct GNUNET_TESTBED_AddHostMessage) + 1955 osize = sizeof (struct GNUNET_TESTBED_AddHostMessage) +
1956 ntohs (imsg->username_length) + ntohs (imsg->hostname_length); 1956 ntohs (imsg->username_length) + ntohs (imsg->hostname_length);
1957 xdata_len = ntohs (imsg->header.size) - osize; 1957 xdata_len = ntohs (imsg->header.size) - osize;
1958 xdata = (const Bytef *) ((const void *) imsg + osize); 1958 xdata = (const Bytef *) ((const void *) imsg + osize);
1959 } 1959 }
@@ -1961,10 +1961,10 @@ GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
1961 case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT: 1961 case GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT:
1962 { 1962 {
1963 const struct GNUNET_TESTBED_ControllerLinkResponse *imsg; 1963 const struct GNUNET_TESTBED_ControllerLinkResponse *imsg;
1964 1964
1965 imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg; 1965 imsg = (const struct GNUNET_TESTBED_ControllerLinkResponse *) msg;
1966 data_len = ntohs (imsg->config_size); 1966 data_len = ntohs (imsg->config_size);
1967 xdata_len = ntohs (imsg->header.size) - 1967 xdata_len = ntohs (imsg->header.size) -
1968 sizeof (const struct GNUNET_TESTBED_ControllerLinkResponse); 1968 sizeof (const struct GNUNET_TESTBED_ControllerLinkResponse);
1969 xdata = (const Bytef *) &imsg[1]; 1969 xdata = (const Bytef *) &imsg[1];
1970 } 1970 }
@@ -2077,7 +2077,7 @@ opstart_shutdown_peers (void *cls)
2077 2077
2078 opc->state = OPC_STATE_STARTED; 2078 opc->state = OPC_STATE_STARTED;
2079 msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage)); 2079 msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage));
2080 msg->header.size = 2080 msg->header.size =
2081 htons (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage)); 2081 htons (sizeof (struct GNUNET_TESTBED_ShutdownPeersMessage));
2082 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS); 2082 msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS);
2083 msg->operation_id = GNUNET_htonll (opc->id); 2083 msg->operation_id = GNUNET_htonll (opc->id);
@@ -2146,7 +2146,7 @@ GNUNET_TESTBED_shutdown_peers (struct GNUNET_TESTBED_Controller *c,
2146 opc->data = data; 2146 opc->data = data;
2147 opc->id = GNUNET_TESTBED_get_next_op_id (c); 2147 opc->id = GNUNET_TESTBED_get_next_op_id (c);
2148 opc->type = OP_SHUTDOWN_PEERS; 2148 opc->type = OP_SHUTDOWN_PEERS;
2149 opc->state = OPC_STATE_INIT; 2149 opc->state = OPC_STATE_INIT;
2150 opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_shutdown_peers, 2150 opc->op = GNUNET_TESTBED_operation_create_ (opc, &opstart_shutdown_peers,
2151 &oprelease_shutdown_peers); 2151 &oprelease_shutdown_peers);
2152 GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations, 2152 GNUNET_TESTBED_operation_queue_insert_ (opc->c->opq_parallel_operations,