2 This file is part of GNUnet
3 (C) 2008--2012 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file testbed/testbed_api_hosts.h
23 * @brief internal API to access the 'hosts' subsystem
24 * @author Christian Grothoff
27 #ifndef NEW_TESTING_API_HOSTS_H
28 #define NEW_TESTING_API_HOSTS_H
30 //#include "gnunet_testbed_service.h"
31 //#include "testbed_helper.h"
36 * Lookup a host by ID.
38 * @param id global host ID assigned to the host; 0 is
39 * reserved to always mean 'localhost'
40 * @return handle to the host, NULL on error
42 struct GNUNET_TESTBED_Host *
43 GNUNET_TESTBED_host_lookup_by_id_ (uint32_t id);
47 * Create a host by ID; given this host handle, we could not
48 * run peers at the host, but we can talk about the host
51 * @param id global host ID assigned to the host; 0 is
52 * reserved to always mean 'localhost'
53 * @param cfg the configuration to use as a template while starting a controller
54 * on this host. Operation queue sizes specific to a host are also
55 * read from this configuration handle
56 * @return handle to the host, NULL on error
58 struct GNUNET_TESTBED_Host *
59 GNUNET_TESTBED_host_create_by_id_ (uint32_t id,
60 const struct GNUNET_CONFIGURATION_Handle
65 * Obtain a host's unique global ID.
67 * @param host handle to the host, NULL means 'localhost'
68 * @return id global host ID assigned to the host (0 is
69 * 'localhost', but then obviously not globally unique)
72 GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host *host);
76 * Obtain the host's username
78 * @param host handle to the host, NULL means 'localhost'
79 * @return username to login to the host
82 GNUNET_TESTBED_host_get_username_ (const struct GNUNET_TESTBED_Host *host);
86 * Obtain the host's ssh port
88 * @param host handle to the host, NULL means 'localhost'
89 * @return username to login to the host
92 GNUNET_TESTBED_host_get_ssh_port_ (const struct GNUNET_TESTBED_Host *host);
96 * Obtain the host's configuration template
98 * @param host handle to the host
99 * @return the host's configuration template
101 const struct GNUNET_CONFIGURATION_Handle *
102 GNUNET_TESTBED_host_get_cfg_ (const struct GNUNET_TESTBED_Host *host);
106 * Function to replace host's configuration
108 * @param host the host handle
109 * @param new_cfg the new configuration to replace the old one
112 GNUNET_TESTBED_host_replace_cfg_ (struct GNUNET_TESTBED_Host *host,
113 const struct GNUNET_CONFIGURATION_Handle *new_cfg);
117 * Marks a host as registered with a controller
119 * @param host the host to mark
120 * @param controller the controller at which this host is registered
123 GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host,
124 const struct GNUNET_TESTBED_Controller
129 * Checks whether a host has been registered with the given controller
131 * @param host the host to check
132 * @param controller the controller at which host's registration is checked
133 * @return GNUNET_YES if registered; GNUNET_NO if not
136 GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host,
137 const struct GNUNET_TESTBED_Controller
142 * (re)sets the operation queue for parallel overlay connects
144 * @param h the host handle
145 * @param npoc the number of parallel overlay connects - the queue size
148 GNUNET_TESTBED_set_num_parallel_overlay_connects_ (struct
149 GNUNET_TESTBED_Host *h,
154 * Releases a time slot thus making it available for be used again
156 * @param h the host handle
157 * @param index the index of the the time slot
158 * @param key the key to prove ownership of the timeslot
159 * @return GNUNET_YES if the time slot is successfully removed; GNUNET_NO if the
160 * time slot cannot be removed - this could be because of the index
161 * greater than existing number of time slots or `key' being different
164 GNUNET_TESTBED_release_time_slot_ (struct GNUNET_TESTBED_Host *h,
165 unsigned int index, void *key);
169 * Function to update a time slot
171 * @param h the host handle
172 * @param index the index of the time slot to update
173 * @param key the key to identify ownership of the slot
174 * @param time the new time
175 * @param failed should this reading be treated as coming from a fail event
178 GNUNET_TESTBED_update_time_slot_ (struct GNUNET_TESTBED_Host *h,
179 unsigned int index, void *key,
180 struct GNUNET_TIME_Relative time, int failed);
184 * Returns a timing slot which will be exclusively locked
186 * @param h the host handle
187 * @param key a pointer which is associated to the returned slot; should not be
188 * NULL. It serves as a key to determine the correct owner of the slot
189 * @return the time slot index in the array of time slots in the controller
193 GNUNET_TESTBED_get_tslot_ (struct GNUNET_TESTBED_Host *h, void *key);
197 * Queues the given operation in the queue for parallel overlay connects of the
200 * @param h the host handle
201 * @param op the operation to queue in the given host's parally overlay connect
205 GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h,
206 struct GNUNET_TESTBED_Operation *op);
210 * Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message from
211 * controller (testbed service)
213 * @param c the controller handler
214 * @param msg message received
215 * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
219 GNUNET_TESTBED_host_handle_addhostconfirm_ (struct GNUNET_TESTBED_Controller *c,
221 GNUNET_TESTBED_HostConfirmedMessage
225 /* end of testbed_api_hosts.h */