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_peers.h
23 * @brief internal API to access the 'peers' subsystem
24 * @author Christian Grothoff
26 #ifndef NEW_TESTING_API_PEERS_H
27 #define NEW_TESTING_API_PEERS_H
29 #include "gnunet_testbed_service.h"
30 #include "gnunet_helper_lib.h"
34 * Enumeration of possible states a peer could be in
39 * State to signify that this peer is invalid
44 * The peer has been created
61 * A peer controlled by the testing framework. A peer runs
62 * at a particular host.
64 struct GNUNET_TESTBED_Peer
67 * Our controller context (not necessarily the controller
68 * that is responsible for starting/running the peer!).
70 struct GNUNET_TESTBED_Controller *controller;
73 * Which host does this peer run on?
75 struct GNUNET_TESTBED_Host *host;
78 * Globally unique ID of the peer.
90 * Data for the OperationType OP_PEER_CREATE
95 * The host where the peer has to be created
97 struct GNUNET_TESTBED_Host *host;
100 * The template configuration of the peer
102 const struct GNUNET_CONFIGURATION_Handle *cfg;
105 * The call back to call when we receive peer create success message
107 GNUNET_TESTBED_PeerCreateCallback cb;
110 * The closure for the above callback
115 * The peer structure to return when we get success message
117 struct GNUNET_TESTBED_Peer *peer;
123 * Data for the OperationType OP_PEER_DESTROY;
125 struct PeerDestroyData
130 struct GNUNET_TESTBED_Peer *peer;
137 * Data for the OperationType OP_PEER_INFO
142 * The peer whose information has been requested
144 struct GNUNET_TESTBED_Peer *peer;
147 * The type of peer information requested
149 enum GNUNET_TESTBED_PeerInformationType pit;
154 * Data for the OperationType OP_PEER_INFO
159 * The type of peer information requested
161 enum GNUNET_TESTBED_PeerInformationType pit;
164 * The data from reply
169 * Configuration handle
171 struct GNUNET_CONFIGURATION_Handle *cfg;
176 struct GNUNET_PeerIdentity *peer_identity;
182 * Data structure for OperationType OP_OVERLAY_CONNECT
184 struct OverlayConnectData
187 * Peer A to connect to peer B
189 struct GNUNET_TESTBED_Peer *p1;
194 struct GNUNET_TESTBED_Peer *p2;
201 * Create the given peer at the specified host using the given
202 * controller. If the given controller is not running on the target
203 * host, it should find or create a controller at the target host and
204 * delegate creating the peer. Explicit delegation paths can be setup
205 * using 'GNUNET_TESTBED_controller_link'. If no explicit delegation
206 * path exists, a direct link with a subordinate controller is setup
207 * for the first delegated peer to a particular host; the subordinate
208 * controller is then destroyed once the last peer that was delegated
209 * to the remote host is stopped. This function is used in particular
210 * if some other controller has already assigned a unique ID to the
213 * Creating the peer only creates the handle to manipulate and further
214 * configure the peer; use "GNUNET_TESTBED_peer_start" and
215 * "GNUNET_TESTBED_peer_stop" to actually start/stop the peer's
218 * Note that the given configuration will be adjusted by the
219 * controller to avoid port/path conflicts with other peers.
220 * The "final" configuration can be obtained using
221 * 'GNUNET_TESTBED_peer_get_information'.
223 * @param unique_id unique ID for this peer
224 * @param controller controller process to use
225 * @param host host to run the peer on
226 * @param cfg configuration to use for the peer
227 * @param cb the callback to call when the peer has been created
228 * @param cls the closure to the above callback
229 * @return the operation handle
231 struct GNUNET_TESTBED_Operation *
232 GNUNET_TESTBED_peer_create_with_id_ (uint32_t unique_id,
233 struct GNUNET_TESTBED_Controller *controller,
234 struct GNUNET_TESTBED_Host *host,
235 const struct GNUNET_CONFIGURATION_Handle *cfg,
236 GNUNET_TESTBED_PeerCreateCallback cb,
242 /* end of testbed_api_peers.h */