gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r26173 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r26173 - gnunet/src/testbed
Date: Thu, 21 Feb 2013 12:32:53 +0100

Author: harsha
Date: 2013-02-21 12:32:53 +0100 (Thu, 21 Feb 2013)
New Revision: 26173

Modified:
   gnunet/src/testbed/gnunet-service-testbed.c
   gnunet/src/testbed/testbed.h
   gnunet/src/testbed/testbed_api.c
   gnunet/src/testbed/testbed_api.h
   gnunet/src/testbed/testbed_api_hosts.c
   gnunet/src/testbed/testbed_api_hosts.h
Log:
M    testbed/testbed.h
naming consistency
include uncompressed config size

M    testbed/testbed_api_hosts.c
pulled host registration functions from testbed_api.c

M    testbed/testbed_api_hosts.h
export handler to handle ADD_HOST confirmation messages

M    testbed/gnunet-service-testbed.c
parse the modified ADD_HOST message

M    testbed/testbed_api.c
lose host registration code
extract configuration from ADD_HOST messages

M    testbed/testbed_api.h
include hacks

Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2013-02-21 10:51:49 UTC (rev 
26172)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2013-02-21 11:32:53 UTC (rev 
26173)
@@ -967,9 +967,11 @@
   struct GNUNET_TESTBED_Host *host;
   const struct GNUNET_TESTBED_AddHostMessage *msg;
   struct GNUNET_TESTBED_HostConfirmedMessage *reply;
+  struct GNUNET_CONFIGURATION_Handle *host_cfg;
   char *username;
   char *hostname;
   char *emsg;
+  const void *ptr;
   uint32_t host_id;
   uint16_t username_length;
   uint16_t hostname_length;
@@ -978,38 +980,72 @@
 
   msg = (const struct GNUNET_TESTBED_AddHostMessage *) message;
   msize = ntohs (msg->header.size);
-  username = (char *) &msg[1];
-  username_length = ntohs (msg->user_name_length);
-  if (0 != username_length)
-    username_length++;
+  if (msize <= sizeof (struct GNUNET_TESTBED_AddHostMessage))
+  {
+    GNUNET_break_op (0);
+    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+    return;
+  }
+  username_length = ntohs (msg->username_length);
+  hostname_length = ntohs (msg->hostname_length);
   /* msg must contain hostname */
-  GNUNET_assert (msize >
-                 (sizeof (struct GNUNET_TESTBED_AddHostMessage) +
-                  username_length + 1));
+  if ((msize <= (sizeof (struct GNUNET_TESTBED_AddHostMessage) + 
+                 username_length))
+      || (0 == hostname_length))
+  {
+    GNUNET_break_op (0);
+    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+    return;
+  }
+  /* msg must contain configuration */
+  if (msize <= (sizeof (struct GNUNET_TESTBED_AddHostMessage) +
+                username_length + hostname_length))
+  {
+    GNUNET_break_op (0);
+    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+    return;
+  }
+  username = NULL;
+  hostname = NULL;
+  ptr = &msg[1];
   if (0 != username_length)
-    GNUNET_assert ('\0' == username[username_length - 1]);
-  hostname = username + username_length;
-  hostname_length =
-      msize - (sizeof (struct GNUNET_TESTBED_AddHostMessage) + 
username_length);
-  GNUNET_assert ('\0' == hostname[hostname_length - 1]);
-  GNUNET_assert (strlen (hostname) == hostname_length - 1);
+  {
+    username = GNUNET_malloc (username_length + 1);
+    strncpy (username, ptr, username_length);
+    ptr += username_length;
+  }
+  hostname = GNUNET_malloc (hostname_length + 1);
+  strncpy (hostname, ptr, hostname_length);
+  ptr += hostname_length;
+  if (NULL == (host_cfg = GNUNET_TESTBED_extract_config_ (message)))
+  {
+    GNUNET_free_non_null (username);
+    GNUNET_free_non_null (hostname);
+    GNUNET_break_op (0);
+    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+    return;
+  }
   host_id = ntohl (msg->host_id);
   LOG_DEBUG ("Received ADDHOST %u message\n", host_id);
   LOG_DEBUG ("-------host id: %u\n", host_id);
   LOG_DEBUG ("-------hostname: %s\n", hostname);
-  if (0 != username_length)
+  if (NULL != username)
     LOG_DEBUG ("-------username: %s\n", username);
   else
-  {
-    LOG_DEBUG ("-------username: NULL\n");
-    username = NULL;
-  }
+    LOG_DEBUG ("-------username: <not given>\n");
   LOG_DEBUG ("-------ssh port: %u\n", ntohs (msg->ssh_port));
-  /* FIXME: should use configuration from ADDHOST message */
   host =
       GNUNET_TESTBED_host_create_with_id (host_id, hostname, username,
-                                          our_config, ntohs (msg->ssh_port));
-  GNUNET_assert (NULL != host);
+                                          host_cfg, ntohs (msg->ssh_port));
+  GNUNET_free_non_null (username);
+  GNUNET_free (hostname);
+  GNUNET_CONFIGURATION_destroy (host_cfg);
+  if (NULL == host)
+  {
+    GNUNET_break_op (0);
+    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+    return;
+  }
   reply_size = sizeof (struct GNUNET_TESTBED_HostConfirmedMessage);
   if (GNUNET_OK != host_list_add (host))
   {

Modified: gnunet/src/testbed/testbed.h
===================================================================
--- gnunet/src/testbed/testbed.h        2013-02-21 10:51:49 UTC (rev 26172)
+++ gnunet/src/testbed/testbed.h        2013-02-21 11:32:53 UTC (rev 26173)
@@ -85,7 +85,7 @@
    * 0 to use no user name; otherwise 'strlen (username)',
    * excluding 0-termination!
    */
-  uint16_t user_name_length GNUNET_PACKED;
+  uint16_t username_length GNUNET_PACKED;
 
   /**
    * Number of bytes in the host name (excluding 0-termination) that follows 
the
@@ -93,6 +93,11 @@
    */
   uint16_t hostname_length GNUNET_PACKED;
 
+  /**
+   * The length of the uncompressed configuration
+   */
+  uint16_t config_size GNUNET_PACKED;
+
   /* followed by non 0-terminated user name */
 
   /* followed by non 0-terminated host name */

Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c    2013-02-21 10:51:49 UTC (rev 26172)
+++ gnunet/src/testbed/testbed_api.c    2013-02-21 11:32:53 UTC (rev 26173)
@@ -130,33 +130,6 @@
 
 
 /**
- * handle for host registration
- */
-struct GNUNET_TESTBED_HostRegistrationHandle
-{
-  /**
-   * The host being registered
-   */
-  struct GNUNET_TESTBED_Host *host;
-
-  /**
-   * The controller at which this host is being registered
-   */
-  struct GNUNET_TESTBED_Controller *c;
-
-  /**
-   * The Registartion completion callback
-   */
-  GNUNET_TESTBED_HostRegistrationCompletion cc;
-
-  /**
-   * The closure for above callback
-   */
-  void *cc_cls;
-};
-
-
-/**
  * Context data for forwarded Operation
  */
 struct ForwardedOperationData
@@ -236,61 +209,6 @@
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM 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_addhostconfirm (struct GNUNET_TESTBED_Controller *c,
-                       const struct GNUNET_TESTBED_HostConfirmedMessage *msg)
-{
-  struct GNUNET_TESTBED_HostRegistrationHandle *rh;
-  char *emsg;
-  uint16_t msg_size;
-
-  rh = c->rh;
-  if (NULL == rh)
-  {
-    return GNUNET_OK;
-  }
-  if (GNUNET_TESTBED_host_get_id_ (rh->host) != ntohl (msg->host_id))
-  {
-    LOG_DEBUG ("Mismatch in host id's %u, %u of host confirm msg\n",
-               GNUNET_TESTBED_host_get_id_ (rh->host), ntohl (msg->host_id));
-    return GNUNET_OK;
-  }
-  c->rh = NULL;
-  msg_size = ntohs (msg->header.size);
-  if (sizeof (struct GNUNET_TESTBED_HostConfirmedMessage) == msg_size)
-  {
-    LOG_DEBUG ("Host %u successfully registered\n", ntohl (msg->host_id));
-    GNUNET_TESTBED_mark_host_registered_at_ (rh->host, c);
-    rh->cc (rh->cc_cls, NULL);
-    GNUNET_free (rh);
-    return GNUNET_OK;
-  }
-  /* We have an error message */
-  emsg = (char *) &msg[1];
-  if ('\0' !=
-      emsg[msg_size - sizeof (struct GNUNET_TESTBED_HostConfirmedMessage)])
-  {
-    GNUNET_break (0);
-    GNUNET_free (rh);
-    return GNUNET_NO;
-  }
-  LOG (GNUNET_ERROR_TYPE_ERROR, _("Adding host %u failed with error: %s\n"),
-       ntohl (msg->host_id), emsg);
-  rh->cc (rh->cc_cls, emsg);
-  GNUNET_free (rh);
-  return GNUNET_OK;
-}
-
-
-/**
  * Handler for forwarded operations
  *
  * @param c the controller handle
@@ -857,9 +775,8 @@
     GNUNET_assert (msize >=
                    sizeof (struct GNUNET_TESTBED_HostConfirmedMessage));
     status =
-        handle_addhostconfirm (c,
-                               (const struct 
GNUNET_TESTBED_HostConfirmedMessage
-                                *) msg);
+        GNUNET_TESTBED_host_handle_addhostconfirm_
+        (c, (const struct GNUNET_TESTBED_HostConfirmedMessage*) msg);
     break;
   case GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS:
     GNUNET_assert (msize ==
@@ -1368,98 +1285,6 @@
 
 
 /**
- * Register a host with the controller
- *
- * @param controller the controller handle
- * @param host the host to register
- * @param cc the completion callback to call to inform the status of
- *          registration. After calling this callback the registration handle
- *          will be invalid. Cannot be NULL.
- * @param cc_cls the closure for the cc
- * @return handle to the host registration which can be used to cancel the
- *           registration
- */
-struct GNUNET_TESTBED_HostRegistrationHandle *
-GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller,
-                              struct GNUNET_TESTBED_Host *host,
-                              GNUNET_TESTBED_HostRegistrationCompletion cc,
-                              void *cc_cls)
-{
-  struct GNUNET_TESTBED_HostRegistrationHandle *rh;
-  struct GNUNET_TESTBED_AddHostMessage *msg;
-  const char *username;
-  const char *hostname;
-  uint16_t msg_size;
-  uint16_t user_name_length;
-
-  if (NULL != controller->rh)
-    return NULL;
-  hostname = GNUNET_TESTBED_host_get_hostname (host);
-  if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller))
-  {
-    LOG (GNUNET_ERROR_TYPE_WARNING, "Host hostname: %s already registered\n",
-         (NULL == hostname) ? "localhost" : hostname);
-    return NULL;
-  }
-  rh = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostRegistrationHandle));
-  rh->host = host;
-  rh->c = controller;
-  GNUNET_assert (NULL != cc);
-  rh->cc = cc;
-  rh->cc_cls = cc_cls;
-  controller->rh = rh;
-  username = GNUNET_TESTBED_host_get_username_ (host);
-  msg_size = (sizeof (struct GNUNET_TESTBED_AddHostMessage));
-  user_name_length = 0;
-  if (NULL != username)
-  {
-    user_name_length = strlen (username) + 1;
-    msg_size += user_name_length;
-  }
-  /* FIXME: what happens when hostname is NULL? localhost */
-  GNUNET_assert (NULL != hostname);
-  msg_size += strlen (hostname) + 1;
-  msg = GNUNET_malloc (msg_size);
-  msg->header.size = htons (msg_size);
-  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST);
-  msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host));
-  msg->ssh_port = htons (GNUNET_TESTBED_host_get_ssh_port_ (host));
-  if (NULL != username)
-  {
-    msg->user_name_length = htons (user_name_length - 1);
-    memcpy (&msg[1], username, user_name_length);
-  }
-  else
-    msg->user_name_length = htons (user_name_length);
-  strcpy (((void *) &msg[1]) + user_name_length, hostname);
-  GNUNET_TESTBED_queue_message_ (controller,
-                                 (struct GNUNET_MessageHeader *) msg);
-  return rh;
-}
-
-
-/**
- * Cancel the pending registration. Note that if the registration message is
- * already sent to the service the cancellation has only the effect that the
- * registration completion callback for the registration is never called.
- *
- * @param handle the registration handle to cancel
- */
-void
-GNUNET_TESTBED_cancel_registration (struct 
GNUNET_TESTBED_HostRegistrationHandle
-                                    *handle)
-{
-  if (handle != handle->c->rh)
-  {
-    GNUNET_break (0);
-    return;
-  }
-  handle->c->rh = NULL;
-  GNUNET_free (handle);
-}
-
-
-/**
  * Same as the GNUNET_TESTBED_controller_link_2, but with ids for delegated 
host
  * and slave host
  *
@@ -1870,11 +1695,12 @@
 /**
  * Generates configuration by uncompressing configuration in given message. The
  * given message should be of the following types:
- * GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG,
- * GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG
+ * GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONFIGURATION,
+ * GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION,
+ * GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST
  *
  * @param msg the message containing compressed configuration
- * @return handle to the parsed configuration
+ * @return handle to the parsed configuration; NULL upon error while parsing 
the message
  */
 struct GNUNET_CONFIGURATION_Handle *
 GNUNET_TESTBED_extract_config_ (const struct GNUNET_MessageHeader *msg)
@@ -1912,13 +1738,29 @@
         sizeof (struct GNUNET_TESTBED_SlaveConfiguration);
     xdata = (const Bytef *) &imsg[1];
   }
+  break;
+  case GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST:
+    {
+      const struct GNUNET_TESTBED_AddHostMessage *imsg;
+      uint16_t osize;
+      
+      imsg = (const struct GNUNET_TESTBED_AddHostMessage *) msg;
+      data_len = (uLong) ntohs (imsg->config_size);
+      osize = sizeof (struct GNUNET_TESTBED_AddHostMessage) +
+          ntohs (imsg->username_length) + ntohs (imsg->hostname_length); 
+      xdata_len = ntohs (imsg->header.size) - osize;
+      xdata = (const Bytef *) ((const void *) imsg + osize);
+    }
     break;
   default:
     GNUNET_assert (0);
   }
   data = GNUNET_malloc (data_len);
   if (Z_OK != (ret = uncompress (data, &data_len, xdata, xdata_len)))
-    GNUNET_assert (0);
+  {
+    GNUNET_free (data);
+    return NULL;
+  }
   cfg = GNUNET_CONFIGURATION_create ();
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_CONFIGURATION_deserialize (cfg, (const char *) data,

Modified: gnunet/src/testbed/testbed_api.h
===================================================================
--- gnunet/src/testbed/testbed_api.h    2013-02-21 10:51:49 UTC (rev 26172)
+++ gnunet/src/testbed/testbed_api.h    2013-02-21 11:32:53 UTC (rev 26173)
@@ -29,8 +29,8 @@
 
 #include "gnunet_testbed_service.h"
 #include "testbed.h"
+#include "testbed_helper.h"
 
-
 /**
  * Testbed Helper binary name
  */

Modified: gnunet/src/testbed/testbed_api_hosts.c
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.c      2013-02-21 10:51:49 UTC (rev 
26172)
+++ gnunet/src/testbed/testbed_api_hosts.c      2013-02-21 11:32:53 UTC (rev 
26173)
@@ -33,6 +33,7 @@
 
 #include "testbed_api.h"
 #include "testbed_api_hosts.h"
+#include "testbed_helper.h"
 #include "testbed_api_operations.h"
 #include "testbed_api_sd.h"
 
@@ -1208,6 +1209,138 @@
 
 
 /**
+ * handle for host registration
+ */
+struct GNUNET_TESTBED_HostRegistrationHandle
+{
+  /**
+   * The host being registered
+   */
+  struct GNUNET_TESTBED_Host *host;
+
+  /**
+   * The controller at which this host is being registered
+   */
+  struct GNUNET_TESTBED_Controller *c;
+
+  /**
+   * The Registartion completion callback
+   */
+  GNUNET_TESTBED_HostRegistrationCompletion cc;
+
+  /**
+   * The closure for above callback
+   */
+  void *cc_cls;
+};
+
+
+/**
+ * Register a host with the controller
+ *
+ * @param controller the controller handle
+ * @param host the host to register
+ * @param cc the completion callback to call to inform the status of
+ *          registration. After calling this callback the registration handle
+ *          will be invalid. Cannot be NULL.
+ * @param cc_cls the closure for the cc
+ * @return handle to the host registration which can be used to cancel the
+ *           registration
+ */
+struct GNUNET_TESTBED_HostRegistrationHandle *
+GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller,
+                              struct GNUNET_TESTBED_Host *host,
+                              GNUNET_TESTBED_HostRegistrationCompletion cc,
+                              void *cc_cls)
+{
+  struct GNUNET_TESTBED_HostRegistrationHandle *rh;
+  struct GNUNET_TESTBED_AddHostMessage *msg;
+  const char *username;
+  const char *hostname;
+  char *config;
+  char *cconfig;
+  void *ptr;
+  size_t cc_size;
+  size_t config_size;
+  uint16_t msg_size;
+  uint16_t username_length;
+  uint16_t hostname_length;
+
+  if (NULL != controller->rh)
+    return NULL;
+  hostname = GNUNET_TESTBED_host_get_hostname (host);
+  if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller))
+  {
+    LOG (GNUNET_ERROR_TYPE_WARNING, "Host hostname: %s already registered\n",
+         (NULL == hostname) ? "localhost" : hostname);
+    return NULL;
+  }
+  rh = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostRegistrationHandle));
+  rh->host = host;
+  rh->c = controller;
+  GNUNET_assert (NULL != cc);
+  rh->cc = cc;
+  rh->cc_cls = cc_cls;
+  controller->rh = rh;
+  username = GNUNET_TESTBED_host_get_username_ (host);
+  username_length = 0;
+  if (NULL != username)
+    username_length = strlen (username);
+  GNUNET_assert (NULL != hostname); /* Hostname must be present */
+  hostname_length = strlen (hostname);
+  GNUNET_assert (NULL != host->cfg);
+  config = GNUNET_CONFIGURATION_serialize (host->cfg, &config_size);
+  cc_size = GNUNET_TESTBED_compress_config_ (config, config_size, &cconfig);
+  GNUNET_free (config);
+  msg_size = (sizeof (struct GNUNET_TESTBED_AddHostMessage));
+  msg_size += username_length;
+  msg_size += hostname_length;
+  msg_size += cc_size;
+  msg = GNUNET_malloc (msg_size);
+  msg->header.size = htons (msg_size);
+  msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST);
+  msg->host_id = htonl (GNUNET_TESTBED_host_get_id_ (host));
+  msg->ssh_port = htons (GNUNET_TESTBED_host_get_ssh_port_ (host));
+  ptr = &msg[1];
+  if (NULL != username)
+  {
+    msg->username_length = htons (username_length);
+    ptr = mempcpy (ptr, username, username_length);
+  }
+  msg->hostname_length = htons (hostname_length);
+  ptr = mempcpy (ptr, hostname, hostname_length);
+  msg->config_size = htons (config_size);
+  ptr = mempcpy (ptr, cconfig, cc_size);
+  GNUNET_assert ((ptr - (void *) msg) == msg_size);
+  GNUNET_free (cconfig);
+  GNUNET_TESTBED_queue_message_ (controller,
+                                 (struct GNUNET_MessageHeader *) msg);
+  return rh;
+}
+
+
+/**
+ * Cancel the pending registration. Note that if the registration message is
+ * already sent to the service the cancellation has only the effect that the
+ * registration completion callback for the registration is never called.
+ *
+ * @param handle the registration handle to cancel
+ */
+void
+GNUNET_TESTBED_cancel_registration (struct 
GNUNET_TESTBED_HostRegistrationHandle
+                                    *handle)
+{
+  if (handle != handle->c->rh)
+  {
+    GNUNET_break (0);
+    return;
+  }
+  handle->c->rh = NULL;
+  GNUNET_free (handle);
+}
+
+
+/**
  * Initializes the operation queue for parallel overlay connects
  *
  * @param h the host handle
@@ -1409,4 +1542,61 @@
       (h->opq_parallel_overlay_connect_operations, op);
 }
 
+
+/**
+ * Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM 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
+ */
+int
+GNUNET_TESTBED_host_handle_addhostconfirm_ (struct GNUNET_TESTBED_Controller 
*c,
+                                            const struct
+                                            GNUNET_TESTBED_HostConfirmedMessage
+                                            *msg)
+{
+  struct GNUNET_TESTBED_HostRegistrationHandle *rh;
+  char *emsg;
+  uint16_t msg_size;
+
+  rh = c->rh;
+  if (NULL == rh)
+  {
+    return GNUNET_OK;
+  }
+  if (GNUNET_TESTBED_host_get_id_ (rh->host) != ntohl (msg->host_id))
+  {
+    LOG_DEBUG ("Mismatch in host id's %u, %u of host confirm msg\n",
+               GNUNET_TESTBED_host_get_id_ (rh->host), ntohl (msg->host_id));
+    return GNUNET_OK;
+  }
+  c->rh = NULL;
+  msg_size = ntohs (msg->header.size);
+  if (sizeof (struct GNUNET_TESTBED_HostConfirmedMessage) == msg_size)
+  {
+    LOG_DEBUG ("Host %u successfully registered\n", ntohl (msg->host_id));
+    GNUNET_TESTBED_mark_host_registered_at_ (rh->host, c);
+    rh->cc (rh->cc_cls, NULL);
+    GNUNET_free (rh);
+    return GNUNET_OK;
+  }
+  /* We have an error message */
+  emsg = (char *) &msg[1];
+  if ('\0' !=
+      emsg[msg_size - sizeof (struct GNUNET_TESTBED_HostConfirmedMessage)])
+  {
+    GNUNET_break (0);
+    GNUNET_free (rh);
+    return GNUNET_NO;
+  }
+  LOG (GNUNET_ERROR_TYPE_ERROR, _("Adding host %u failed with error: %s\n"),
+       ntohl (msg->host_id), emsg);
+  rh->cc (rh->cc_cls, emsg);
+  GNUNET_free (rh);
+  return GNUNET_OK;
+}
+
 /* end of testbed_api_hosts.c */

Modified: gnunet/src/testbed/testbed_api_hosts.h
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.h      2013-02-21 10:51:49 UTC (rev 
26172)
+++ gnunet/src/testbed/testbed_api_hosts.h      2013-02-21 11:32:53 UTC (rev 
26173)
@@ -27,8 +27,9 @@
 #ifndef NEW_TESTING_API_HOSTS_H
 #define NEW_TESTING_API_HOSTS_H
 
-#include "gnunet_testbed_service.h"
-#include "testbed_helper.h"
+//#include "gnunet_testbed_service.h"
+//#include "testbed_helper.h"
+#include "testbed.h"
 
 
 /**
@@ -193,5 +194,21 @@
 GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h, 
                                struct GNUNET_TESTBED_Operation *op);
 
+
+/**
+ * Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM 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
+ */
+int
+GNUNET_TESTBED_host_handle_addhostconfirm_ (struct GNUNET_TESTBED_Controller 
*c,
+                                            const struct
+                                            GNUNET_TESTBED_HostConfirmedMessage
+                                            *msg);
+
 #endif
 /* end of testbed_api_hosts.h */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]