aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api_hosts.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-27 16:15:33 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-27 16:15:33 +0000
commitf27f46409ec33cef42379006d561d33a2ae44682 (patch)
tree0d32d879b31feb0d9aa0d19e44b41a2146cb1973 /src/testbed/testbed_api_hosts.c
parent3a4870624812ac4286624d3946981cac6aef4e67 (diff)
downloadgnunet-f27f46409ec33cef42379006d561d33a2ae44682.tar.gz
gnunet-f27f46409ec33cef42379006d561d33a2ae44682.zip
convert testbed_api to MQ (not perfect, but working)
Diffstat (limited to 'src/testbed/testbed_api_hosts.c')
-rw-r--r--src/testbed/testbed_api_hosts.c84
1 files changed, 0 insertions, 84 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index 5b1df615e..4e14a4d4d 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -1385,33 +1385,6 @@ GNUNET_TESTBED_is_host_habitable_cancel (struct
1385 1385
1386 1386
1387/** 1387/**
1388 * handle for host registration
1389 */
1390struct GNUNET_TESTBED_HostRegistrationHandle
1391{
1392 /**
1393 * The host being registered
1394 */
1395 struct GNUNET_TESTBED_Host *host;
1396
1397 /**
1398 * The controller at which this host is being registered
1399 */
1400 struct GNUNET_TESTBED_Controller *c;
1401
1402 /**
1403 * The Registartion completion callback
1404 */
1405 GNUNET_TESTBED_HostRegistrationCompletion cc;
1406
1407 /**
1408 * The closure for above callback
1409 */
1410 void *cc_cls;
1411};
1412
1413
1414/**
1415 * Register a host with the controller 1388 * Register a host with the controller
1416 * 1389 *
1417 * @param controller the controller handle 1390 * @param controller the controller handle
@@ -1537,63 +1510,6 @@ GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h,
1537 1510
1538 1511
1539/** 1512/**
1540 * Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message from
1541 * controller (testbed service)
1542 *
1543 * @param c the controller handler
1544 * @param msg message received
1545 * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
1546 * not
1547 */
1548int
1549GNUNET_TESTBED_host_handle_addhostconfirm_ (struct GNUNET_TESTBED_Controller *c,
1550 const struct
1551 GNUNET_TESTBED_HostConfirmedMessage
1552 *msg)
1553{
1554 struct GNUNET_TESTBED_HostRegistrationHandle *rh;
1555 char *emsg;
1556 uint16_t msg_size;
1557
1558 rh = c->rh;
1559 if (NULL == rh)
1560 {
1561 return GNUNET_OK;
1562 }
1563 if (GNUNET_TESTBED_host_get_id_ (rh->host) != ntohl (msg->host_id))
1564 {
1565 LOG_DEBUG ("Mismatch in host id's %u, %u of host confirm msg\n",
1566 GNUNET_TESTBED_host_get_id_ (rh->host), ntohl (msg->host_id));
1567 return GNUNET_OK;
1568 }
1569 c->rh = NULL;
1570 msg_size = ntohs (msg->header.size);
1571 if (sizeof (struct GNUNET_TESTBED_HostConfirmedMessage) == msg_size)
1572 {
1573 LOG_DEBUG ("Host %u successfully registered\n", ntohl (msg->host_id));
1574 GNUNET_TESTBED_mark_host_registered_at_ (rh->host, c);
1575 rh->cc (rh->cc_cls, NULL);
1576 GNUNET_free (rh);
1577 return GNUNET_OK;
1578 }
1579 /* We have an error message */
1580 emsg = (char *) &msg[1];
1581 if ('\0' !=
1582 emsg[msg_size - sizeof (struct GNUNET_TESTBED_HostConfirmedMessage)])
1583 {
1584 GNUNET_break (0);
1585 GNUNET_free (rh);
1586 return GNUNET_NO;
1587 }
1588 LOG (GNUNET_ERROR_TYPE_ERROR, _("Adding host %u failed with error: %s\n"),
1589 ntohl (msg->host_id), emsg);
1590 rh->cc (rh->cc_cls, emsg);
1591 GNUNET_free (rh);
1592 return GNUNET_OK;
1593}
1594
1595
1596/**
1597 * Resolves the hostname of the host to an ip address 1513 * Resolves the hostname of the host to an ip address
1598 * 1514 *
1599 * @param host the host whose hostname is to be resolved 1515 * @param host the host whose hostname is to be resolved