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"
35 * Lookup a host by ID.
37 * @param id global host ID assigned to the host; 0 is
38 * reserved to always mean 'localhost'
39 * @return handle to the host, NULL on error
41 struct GNUNET_TESTBED_Host *
42 GNUNET_TESTBED_host_lookup_by_id_ (uint32_t id);
46 * Create a host by ID; given this host handle, we could not
47 * run peers at the host, but we can talk about the host
50 * @param id global host ID assigned to the host; 0 is
51 * reserved to always mean 'localhost'
52 * @return handle to the host, NULL on error
54 struct GNUNET_TESTBED_Host *
55 GNUNET_TESTBED_host_create_by_id_ (uint32_t id);
59 * Obtain a host's unique global ID.
61 * @param host handle to the host, NULL means 'localhost'
62 * @return id global host ID assigned to the host (0 is
63 * 'localhost', but then obviously not globally unique)
66 GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host *host);
70 * Obtain the host's username
72 * @param host handle to the host, NULL means 'localhost'
73 * @return username to login to the host
76 GNUNET_TESTBED_host_get_username_ (const struct GNUNET_TESTBED_Host *host);
80 * Obtain the host's ssh port
82 * @param host handle to the host, NULL means 'localhost'
83 * @return username to login to the host
86 GNUNET_TESTBED_host_get_ssh_port_ (const struct GNUNET_TESTBED_Host *host);
90 * Marks a host as registered with a controller
92 * @param host the host to mark
93 * @param controller the controller at which this host is registered
96 GNUNET_TESTBED_mark_host_registered_at_ (struct GNUNET_TESTBED_Host *host,
97 const struct GNUNET_TESTBED_Controller
102 * Checks whether a host has been registered with the given controller
104 * @param host the host to check
105 * @param controller the controller at which host's registration is checked
106 * @return GNUNET_YES if registered; GNUNET_NO if not
109 GNUNET_TESTBED_is_host_registered_ (const struct GNUNET_TESTBED_Host *host,
110 const struct GNUNET_TESTBED_Controller
115 * (re)sets the operation queue for parallel overlay connects
117 * @param h the host handle
118 * @param npoc the number of parallel overlay connects - the queue size
121 GNUNET_TESTBED_set_num_parallel_overlay_connects_ (struct
122 GNUNET_TESTBED_Host *h,
127 * Releases a time slot thus making it available for be used again
129 * @param h the host handle
130 * @param index the index of the the time slot
131 * @param key the key to prove ownership of the timeslot
132 * @return GNUNET_YES if the time slot is successfully removed; GNUNET_NO if the
133 * time slot cannot be removed - this could be because of the index
134 * greater than existing number of time slots or `key' being different
137 GNUNET_TESTBED_release_time_slot_ (struct GNUNET_TESTBED_Host *h,
138 unsigned int index, void *key);
142 * Function to update a time slot
144 * @param h the host handle
145 * @param index the index of the time slot to update
146 * @param key the key to identify ownership of the slot
147 * @param time the new time
148 * @param failed should this reading be treated as coming from a fail event
151 GNUNET_TESTBED_update_time_slot_ (struct GNUNET_TESTBED_Host *h,
152 unsigned int index, void *key,
153 struct GNUNET_TIME_Relative time, int failed);
157 * Returns a timing slot which will be exclusively locked
159 * @param h the host handle
160 * @param key a pointer which is associated to the returned slot; should not be
161 * NULL. It serves as a key to determine the correct owner of the slot
162 * @return the time slot index in the array of time slots in the controller
166 GNUNET_TESTBED_get_tslot_ (struct GNUNET_TESTBED_Host *h, void *key);
170 * Queues the given operation in the queue for parallel overlay connects of the
173 * @param h the host handle
174 * @param op the operation to queue in the given host's parally overlay connect
178 GNUNET_TESTBED_host_queue_oc_ (struct GNUNET_TESTBED_Host *h,
179 struct GNUNET_TESTBED_Operation *op);
182 /* end of testbed_api_hosts.h */