if (NULL == starting_host)
return 0;
*hosts = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * count);
- memcpy (*hosts, &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)],
- sizeof (struct GNUNET_TESTBED_Host *) * count);
+ GNUNET_memcpy (*hosts,
+ &host_list[GNUNET_TESTBED_host_get_id_ (starting_host)],
+ sizeof (struct GNUNET_TESTBED_Host *) * count);
return count;
}
* @param client identification of the client
* @param message the actual message
*
- * @return GNUNET_OK on success, GNUNET_SYSERR to stop further processing
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
*/
static int
-helper_mst (void *cls, void *client, const struct GNUNET_MessageHeader *message)
+helper_mst (void *cls,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_TESTBED_ControllerProc *cp = cls;
const struct GNUNET_TESTBED_HelperReply *msg;
}
-/**
- * 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
*
if (NULL != username)
{
msg->username_length = htons (username_length);
- ptr = memcpy (ptr, username, username_length);
+ GNUNET_memcpy (ptr, username, username_length);
ptr += username_length;
}
msg->hostname_length = htons (hostname_length);
- ptr = memcpy (ptr, hostname, hostname_length);
+ GNUNET_memcpy (ptr, hostname, hostname_length);
ptr += hostname_length;
msg->config_size = htons (config_size);
- ptr = memcpy (ptr, cconfig, cc_size);
+ GNUNET_memcpy (ptr, cconfig, cc_size);
ptr += cc_size;
GNUNET_assert ((ptr - (void *) msg) == msg_size);
GNUNET_free (cconfig);
}
-/**
- * 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;
-}
-
-
/**
* Resolves the hostname of the host to an ip address
*