2 This file is part of GNUnet
3 Copyright (C) 2008--2013 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
22 * @file testbed/testbed_api_hosts.h
23 * @brief internal API to access the 'hosts' subsystem
24 * @author Christian Grothoff
27 #ifndef TESTBED_API_HOSTS_H
28 #define TESTBED_API_HOSTS_H
30 //#include "gnunet_testbed_service.h"
31 //#include "testbed_helper.h"
36 * handle for host registration
38 struct GNUNET_TESTBED_HostRegistrationHandle {
40 * The host being registered
42 struct GNUNET_TESTBED_Host *host;
45 * The controller at which this host is being registered
47 struct GNUNET_TESTBED_Controller *c;
50 * The Registartion completion callback
52 GNUNET_TESTBED_HostRegistrationCompletion cc;
55 * The closure for above callback
62 * Lookup a host by ID.
64 * @param id global host ID assigned to the host; 0 is
65 * reserved to always mean 'localhost'
66 * @return handle to the host, NULL on error
68 struct GNUNET_TESTBED_Host *
69 GNUNET_TESTBED_host_lookup_by_id_(uint32_t id);
73 * Create a host by ID; given this host handle, we could not
74 * run peers at the host, but we can talk about the host
77 * @param id global host ID assigned to the host; 0 is
78 * reserved to always mean 'localhost'
79 * @param cfg the configuration to use as a template while starting a controller
80 * on this host. Operation queue sizes specific to a host are also
81 * read from this configuration handle
82 * @return handle to the host, NULL on error
84 struct GNUNET_TESTBED_Host *
85 GNUNET_TESTBED_host_create_by_id_(uint32_t id,
86 const struct GNUNET_CONFIGURATION_Handle
91 * Obtain a host's unique global ID.
93 * @param host handle to the host, NULL means 'localhost'
94 * @return id global host ID assigned to the host (0 is
95 * 'localhost', but then obviously not globally unique)
98 GNUNET_TESTBED_host_get_id_(const struct GNUNET_TESTBED_Host *host);
102 * Obtain the host's username
104 * @param host handle to the host, NULL means 'localhost'
105 * @return username to login to the host
108 GNUNET_TESTBED_host_get_username_(const struct GNUNET_TESTBED_Host *host);
112 * Obtain the host's ssh port
114 * @param host handle to the host, NULL means 'localhost'
115 * @return username to login to the host
118 GNUNET_TESTBED_host_get_ssh_port_(const struct GNUNET_TESTBED_Host *host);
122 * Obtain the host's configuration template
124 * @param host handle to the host
125 * @return the host's configuration template
127 const struct GNUNET_CONFIGURATION_Handle *
128 GNUNET_TESTBED_host_get_cfg_(const struct GNUNET_TESTBED_Host *host);
132 * Function to replace host's configuration
134 * @param host the host handle
135 * @param new_cfg the new configuration to replace the old one
138 GNUNET_TESTBED_host_replace_cfg_(struct GNUNET_TESTBED_Host *host,
139 const struct GNUNET_CONFIGURATION_Handle *new_cfg);
143 * Marks a host as registered with a controller
145 * @param host the host to mark
146 * @param controller the controller at which this host is registered
149 GNUNET_TESTBED_mark_host_registered_at_(struct GNUNET_TESTBED_Host *host,
150 const struct GNUNET_TESTBED_Controller
155 * Unmarks a host registered at a controller
157 * @param host the host to unmark
158 * @param controller the controller at which this host has to be unmarked
161 GNUNET_TESTBED_deregister_host_at_(struct GNUNET_TESTBED_Host *host,
162 const struct GNUNET_TESTBED_Controller
167 * Checks whether a host has been registered with the given controller
169 * @param host the host to check
170 * @param controller the controller at which host's registration is checked
171 * @return GNUNET_YES if registered; GNUNET_NO if not
174 GNUNET_TESTBED_is_host_registered_(const struct GNUNET_TESTBED_Host *host,
175 const struct GNUNET_TESTBED_Controller
180 * Queues the given operation in the queue for parallel overlay connects of the
183 * @param h the host handle
184 * @param op the operation to queue in the given host's parally overlay connect
188 GNUNET_TESTBED_host_queue_oc_(struct GNUNET_TESTBED_Host *h,
189 struct GNUNET_TESTBED_Operation *op);
193 * Sends termination signal to the controller's helper process
195 * @param cproc the handle to the controller's helper process
198 GNUNET_TESTBED_controller_kill_(struct GNUNET_TESTBED_ControllerProc *cproc);
202 * Cleans-up the controller's helper process handle
204 * @param cproc the handle to the controller's helper process
207 GNUNET_TESTBED_controller_destroy_(struct GNUNET_TESTBED_ControllerProc
212 * Resolves the hostname of the host to an ip address
214 * @param host the host whose hostname is to be resolved
217 GNUNET_TESTBED_host_resolve_(struct GNUNET_TESTBED_Host *host);
221 /* end of testbed_api_hosts.h */