if (sizeof (struct GNUNET_TESTBED_HostConfirmedMessage) == msg_size)
{
LOG_DEBUG ("Host %u successfully registered\n", ntohl (msg->host_id));
- GNUNET_TESTBED_mark_host_as_registered_ (rh->host);
+ GNUNET_TESTBED_mark_host_as_registered_ (rh->host, c);
rh->cc (rh->cc_cls, NULL);
GNUNET_free (rh);
return GNUNET_OK;
if (NULL != controller->rh)
return NULL;
hostname = GNUNET_TESTBED_host_get_hostname_ (host);
- if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host))
+ if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
"Host hostname: %s already registered\n",
uint16_t msg_size;
GNUNET_assert (GNUNET_YES ==
- GNUNET_TESTBED_is_host_registered_ (delegated_host));
+ GNUNET_TESTBED_is_host_registered_ (delegated_host, master));
GNUNET_assert (GNUNET_YES ==
- GNUNET_TESTBED_is_host_registered_ (slave_host));
+ GNUNET_TESTBED_is_host_registered_ (slave_host, master));
config = GNUNET_CONFIGURATION_serialize (slave_cfg, &config_size);
cc_size = compressBound ((uLong) config_size);
cconfig = GNUNET_malloc (cc_size);
*/
const char *username;
+ /**
+ * The controller at which this host is registered
+ */
+ const struct GNUNET_TESTBED_Controller *controller;
+
/**
* Global ID we use to refer to a host on the network
*/
*/
uint16_t port;
- /**
- * Set this flag to 1 if host is registered with a controller; 0 if not
- */
- uint8_t is_registered;
};
* Marks a host as registered with a controller
*
* @param host the host to mark
+ * @param controller the controller at which this host is registered
*/
void
-GNUNET_TESTBED_mark_host_as_registered_ (struct GNUNET_TESTBED_Host *host)
+GNUNET_TESTBED_mark_host_as_registered_ (struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_TESTBED_Controller
+ *controller)
{
- host->is_registered = 1;
+ host->controller = controller;
}
* Checks whether a host has been registered
*
* @param host the host to check
+ * @param controller the controller at which host's registration is checked
* @return GNUNET_YES if registered; GNUNET_NO if not
*/
int
-GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host)
+GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_TESTBED_Controller
+ *controller)
{
- return (1 == host->is_registered) ? GNUNET_YES : GNUNET_NO;
+ return (controller == host->controller) ? GNUNET_YES : GNUNET_NO;
}
* Marks a host as registered with a controller
*
* @param host the host to mark
+ * @param controller the controller at which this host is registered
*/
void
-GNUNET_TESTBED_mark_host_as_registered_ (struct GNUNET_TESTBED_Host *host);
+GNUNET_TESTBED_mark_host_as_registered_ (struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_TESTBED_Controller
+ *controller);
/**
- * Checks whether a host has been registered
+ * Checks whether a host has been registered with the given controller
*
* @param host the host to check
+ * @param controller the controller at which host's registration is checked
* @return GNUNET_YES if registered; GNUNET_NO if not
*/
int
-GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host);
+GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host,
+ const struct GNUNET_TESTBED_Controller
+ *controller);
#endif
/* end of testbed_api_hosts.h */