aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api.c
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2012-08-27 09:10:37 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2012-08-27 09:10:37 +0000
commita4d753e8d938081ec51efa816966a2d6153d29c4 (patch)
tree0ecd659a201e4175b653f0b7e5d1ee3cc1a1e3ee /src/testbed/testbed_api.c
parent7476213458c4d38472250031c50c667e765a67f7 (diff)
downloadgnunet-a4d753e8d938081ec51efa816966a2d6153d29c4.tar.gz
gnunet-a4d753e8d938081ec51efa816966a2d6153d29c4.zip
service connect checkpoint save
Diffstat (limited to 'src/testbed/testbed_api.c')
-rw-r--r--src/testbed/testbed_api.c82
1 files changed, 58 insertions, 24 deletions
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c
index 1a779c3c1..f302cb57b 100644
--- a/src/testbed/testbed_api.c
+++ b/src/testbed/testbed_api.c
@@ -538,6 +538,18 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
538 LOG_DEBUG ("Operation not found\n"); 538 LOG_DEBUG ("Operation not found\n");
539 return GNUNET_YES; 539 return GNUNET_YES;
540 } 540 }
541 if (OP_FORWARDED == opc->type)
542 {
543 struct ForwardedOperationData *fo_data;
544
545 fo_data = opc->data;
546 if (NULL != fo_data->cc)
547 fo_data->cc (fo_data->cc_cls, (const struct GNUNET_MessageHeader *) msg);
548 GNUNET_CONTAINER_DLL_remove (c->ocq_head, c->ocq_tail, opc);
549 GNUNET_free (fo_data);
550 GNUNET_free (opc);
551 return GNUNET_YES;
552 }
541 data = opc->data; 553 data = opc->data;
542 GNUNET_assert (NULL != data); 554 GNUNET_assert (NULL != data);
543 peer = data->peer; 555 peer = data->peer;
@@ -571,29 +583,9 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
571 } 583 }
572 break; 584 break;
573 case GNUNET_TESTBED_PIT_CONFIGURATION: 585 case GNUNET_TESTBED_PIT_CONFIGURATION:
574 { 586 response_data->details.cfg = /* Freed in oprelease_peer_getinfo */
575 struct GNUNET_CONFIGURATION_Handle *cfg; 587 GNUNET_TESTBED_get_config_from_peerinfo_msg_ (msg);
576 char *config; 588 info.details.operation_finished.op_result.cfg = response_data->details.cfg;
577 uLong config_size;
578 int ret;
579 uint16_t msize;
580
581 config_size = (uLong) ntohs (msg->config_size);
582 config = GNUNET_malloc (config_size);
583 msize = ntohs (msg->header.size);
584 msize -= sizeof (struct GNUNET_TESTBED_PeerConfigurationInformationMessage);
585 if (Z_OK != (ret = uncompress ((Bytef *) config, &config_size,
586 (const Bytef *) &msg[1], (uLong) msize)))
587 GNUNET_assert (0);
588 cfg = GNUNET_CONFIGURATION_create (); /* Freed in oprelease_peer_getinfo */
589 GNUNET_assert (GNUNET_OK ==
590 GNUNET_CONFIGURATION_deserialize (cfg, config,
591 (size_t) config_size,
592 GNUNET_NO));
593 GNUNET_free (config);
594 response_data->details.cfg = cfg;
595 info.details.operation_finished.op_result.cfg = cfg;
596 }
597 break; 589 break;
598 case GNUNET_TESTBED_PIT_GENERIC: 590 case GNUNET_TESTBED_PIT_GENERIC:
599 GNUNET_assert (0); /* never reach here */ 591 GNUNET_assert (0); /* never reach here */
@@ -602,7 +594,13 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
602 opc->data = response_data; 594 opc->data = response_data;
603 GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc); 595 GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc);
604 opc->state = OPC_STATE_FINISHED; 596 opc->state = OPC_STATE_FINISHED;
605 c->cc (c->cc_cls, &info); 597 if (0 != ((GNUNET_TESTBED_ET_CONNECT | GNUNET_TESTBED_ET_DISCONNECT)
598 & c->event_mask))
599 {
600 if (NULL != c->cc)
601 c->cc (c->cc_cls, &info);
602 }
603
606 return GNUNET_YES; 604 return GNUNET_YES;
607} 605}
608 606
@@ -1292,6 +1290,8 @@ GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller *controll
1292 if (GNUNET_YES == controller->aux_host) 1290 if (GNUNET_YES == controller->aux_host)
1293 GNUNET_TESTBED_host_destroy (controller->host); 1291 GNUNET_TESTBED_host_destroy (controller->host);
1294 GNUNET_TESTBED_operation_queue_destroy_ (controller->opq_parallel_operations); 1292 GNUNET_TESTBED_operation_queue_destroy_ (controller->opq_parallel_operations);
1293 GNUNET_TESTBED_operation_queue_destroy_
1294 (controller->opq_parallel_service_connections);
1295 GNUNET_free (controller); 1295 GNUNET_free (controller);
1296} 1296}
1297 1297
@@ -1622,4 +1622,38 @@ GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
1622 } 1622 }
1623} 1623}
1624 1624
1625
1626/**
1627 * Generates configuration by parsing Peer configuration information reply message
1628 *
1629 * @param msg the peer configuration information message
1630 * @return handle to the parsed configuration
1631 */
1632struct GNUNET_CONFIGURATION_Handle *
1633GNUNET_TESTBED_get_config_from_peerinfo_msg_ (const struct
1634 GNUNET_TESTBED_PeerConfigurationInformationMessage
1635 *msg)
1636{
1637 struct GNUNET_CONFIGURATION_Handle *cfg;
1638 char *config;
1639 uLong config_size;
1640 int ret;
1641 uint16_t msize;
1642
1643 config_size = (uLong) ntohs (msg->config_size);
1644 config = GNUNET_malloc (config_size);
1645 msize = ntohs (msg->header.size);
1646 msize -= sizeof (struct GNUNET_TESTBED_PeerConfigurationInformationMessage);
1647 if (Z_OK != (ret = uncompress ((Bytef *) config, &config_size,
1648 (const Bytef *) &msg[1], (uLong) msize)))
1649 GNUNET_assert (0);
1650 cfg = GNUNET_CONFIGURATION_create ();
1651 GNUNET_assert (GNUNET_OK ==
1652 GNUNET_CONFIGURATION_deserialize (cfg, config,
1653 (size_t) config_size,
1654 GNUNET_NO));
1655 GNUNET_free (config);
1656 return cfg;
1657}
1658
1625/* end of testbed_api.c */ 1659/* end of testbed_api.c */