X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ftestbed%2Ftestbed_api_hosts.h;h=f83ffd148ba9299f47b733f49bac2499b4ffc69b;hb=27c12911f4f2aba2d90099270d70de846e83854f;hp=ea93579b0a3f31af4ca1ffdc66c5596ad74b4f18;hpb=a94a1861d123fe850d2ab5ae74cbb59b132a15ea;p=oweals%2Fgnunet.git diff --git a/src/testbed/testbed_api_hosts.h b/src/testbed/testbed_api_hosts.h index ea93579b0..f83ffd148 100644 --- a/src/testbed/testbed_api_hosts.h +++ b/src/testbed/testbed_api_hosts.h @@ -1,6 +1,6 @@ /* This file is part of GNUnet - (C) 2008--2012 Christian Grothoff (and other contributing authors) + (C) 2008--2013 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -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" /** @@ -49,10 +50,15 @@ GNUNET_TESTBED_host_lookup_by_id_ (uint32_t id); * * @param id global host ID assigned to the host; 0 is * reserved to always mean 'localhost' + * @param cfg the configuration to use as a template while starting a controller + * on this host. Operation queue sizes specific to a host are also + * read from this configuration handle * @return handle to the host, NULL on error */ struct GNUNET_TESTBED_Host * -GNUNET_TESTBED_host_create_by_id_ (uint32_t id); +GNUNET_TESTBED_host_create_by_id_ (uint32_t id, + const struct GNUNET_CONFIGURATION_Handle + *cfg); /** @@ -66,16 +72,6 @@ uint32_t GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host *host); -/** - * Obtain the host's hostname. - * - * @param host handle to the host, NULL means 'localhost' - * @return hostname of the host - */ -const char * -GNUNET_TESTBED_host_get_hostname_ (const struct GNUNET_TESTBED_Host *host); - - /** * Obtain the host's username * @@ -97,46 +93,24 @@ GNUNET_TESTBED_host_get_ssh_port_ (const struct GNUNET_TESTBED_Host *host); /** - * Opaque wrapper around GNUNET_HELPER_Handle + * Obtain the host's configuration template + * + * @param host handle to the host + * @return the host's configuration template */ -struct GNUNET_TESTBED_HelperHandle; - - -/* /\** */ -/* * Run a given helper process at the given host. Communication */ -/* * with the helper will be via GNUnet messages on stdin/stdout. */ -/* * Runs the process via 'ssh' at the specified host, or locally. */ -/* * Essentially an SSH-wrapper around the 'gnunet_helper_lib.h' API. */ -/* * */ -/* * @param controller_ip the ip address of the controller. Will be set as TRUSTED */ -/* * host when starting testbed controller at host */ -/* * @param host host to use, use "NULL" for localhost */ -/* * @param binary_argv binary name and command-line arguments to give to the */ -/* * binary */ -/* * @param cfg template configuration to use for the remote controller; the */ -/* * remote controller will be started with a slightly modified */ -/* * configuration (port numbers, unix domain sockets and service home */ -/* * values are changed as per TESTING library on the remote host) */ -/* * @param cb the callback to run when helper process dies; cannot be NULL */ -/* * @param cb_cls the closure for the above callback */ -/* * @return handle to terminate the command, NULL on error */ -/* *\/ */ -/* struct GNUNET_TESTBED_HelperHandle * */ -/* GNUNET_TESTBED_host_run_ (const char *controller_ip, */ -/* const struct GNUNET_TESTBED_Host *host, */ -/* const struct GNUNET_CONFIGURATION_Handle *cfg, */ -/* GNUNET_HELPER_ExceptionCallback cb, */ -/* void *cb_cls); */ +const struct GNUNET_CONFIGURATION_Handle * +GNUNET_TESTBED_host_get_cfg_ (const struct GNUNET_TESTBED_Host *host); - -/* /\** */ -/* * Stops a helper in the HelperHandle using GNUNET_HELPER_stop */ -/* * */ -/* * @param handle the handle returned from GNUNET_TESTBED_host_start_ */ -/* *\/ */ -/* void */ -/* GNUNET_TESTBED_host_stop_ (struct GNUNET_TESTBED_HelperHandle *handle); */ +/** + * Function to replace host's configuration + * + * @param host the host handle + * @param new_cfg the new configuration to replace the old one + */ +void +GNUNET_TESTBED_host_replace_cfg_ (struct GNUNET_TESTBED_Host *host, + const struct GNUNET_CONFIGURATION_Handle *new_cfg); /** @@ -151,6 +125,18 @@ GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host, *controller); +/** + * Unmarks a host registered at a controller + * + * @param host the host to unmark + * @param controller the controller at which this host has to be unmarked + */ +void +GNUNET_TESTBED_deregister_host_at_ (struct GNUNET_TESTBED_Host *host, + const struct GNUNET_TESTBED_Controller + *const controller); + + /** * Checks whether a host has been registered with the given controller * @@ -164,6 +150,62 @@ GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host, *controller); +/** + * Queues the given operation in the queue for parallel overlay connects of the + * given host + * + * @param h the host handle + * @param op the operation to queue in the given host's parally overlay connect + * queue + */ +void +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); + + +/** + * Sends termination signal to the controller's helper process + * + * @param cproc the handle to the controller's helper process + */ +void +GNUNET_TESTBED_controller_kill_ (struct GNUNET_TESTBED_ControllerProc *cproc); + + +/** + * Cleans-up the controller's helper process handle + * + * @param cproc the handle to the controller's helper process + */ +void +GNUNET_TESTBED_controller_destroy_ (struct GNUNET_TESTBED_ControllerProc + *cproc); + + +/** + * Resolves the hostname of the host to an ip address + * + * @param host the host whose hostname is to be resolved + */ +void +GNUNET_TESTBED_host_resolve_ (struct GNUNET_TESTBED_Host *host); + #endif /* end of testbed_api_hosts.h */