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
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @file testbed/testbed_api_peers.h
23 * @brief internal API to access the 'peers' subsystem
24 * @author Christian Grothoff
25 * @author Sree Harsha Totakura
28 #ifndef NEW_TESTING_API_PEERS_H
29 #define NEW_TESTING_API_PEERS_H
31 #include "gnunet_testbed_service.h"
32 #include "gnunet_helper_lib.h"
36 * Enumeration of possible states a peer could be in
41 * State to signify that this peer is invalid
46 * The peer has been created
63 * A peer controlled by the testing framework. A peer runs
64 * at a particular host.
66 struct GNUNET_TESTBED_Peer
71 struct GNUNET_TESTBED_Peer *next;
76 struct GNUNET_TESTBED_Peer *prev;
79 * Our controller context (not necessarily the controller
80 * that is responsible for starting/running the peer!).
82 struct GNUNET_TESTBED_Controller *controller;
85 * Which host does this peer run on?
87 struct GNUNET_TESTBED_Host *host;
90 * Globally unique ID of the peer.
100 * Has an underlay model already set for this peer?
102 uint8_t underlay_model_exists;
107 * Data for the OperationType OP_PEER_CREATE
109 struct PeerCreateData
112 * The host where the peer has to be created
114 struct GNUNET_TESTBED_Host *host;
117 * The template configuration of the peer
119 const struct GNUNET_CONFIGURATION_Handle *cfg;
122 * The call back to call when we receive peer create success message
124 GNUNET_TESTBED_PeerCreateCallback cb;
127 * The closure for the above callback
132 * The peer structure to return when we get success message
134 struct GNUNET_TESTBED_Peer *peer;
140 * Data for OperationType OP_PEER_START and OP_PEER_STOP
145 * The handle of the peer to start
147 struct GNUNET_TESTBED_Peer *peer;
150 * The Peer churn callback to call when this operation is completed
152 GNUNET_TESTBED_PeerChurnCallback pcc;
155 * Closure for the above callback
163 * Data for the OperationType OP_PEER_DESTROY;
165 struct PeerDestroyData
170 struct GNUNET_TESTBED_Peer *peer;
177 * Data for the OperationType OP_PEER_INFO
182 * The peer whose information has been requested
184 struct GNUNET_TESTBED_Peer *peer;
187 * The Peer info callback to call when this operation has completed
189 GNUNET_TESTBED_PeerInfoCallback cb;
192 * The closure for peer info callback
197 * The type of peer information requested
199 enum GNUNET_TESTBED_PeerInformationType pit;
204 * Data for the operations of type OP_PEER_RECONFIGURE
206 struct PeerReconfigureData
209 * The peer whose information has been requested
211 struct GNUNET_TESTBED_Peer *peer;
214 * The serialized new configuration template
219 * the size of the serialized configuration
226 * Data structure for OperationType OP_OVERLAY_CONNECT
228 struct OverlayConnectData
232 * Peer A to connect to peer B
234 struct GNUNET_TESTBED_Peer *p1;
239 struct GNUNET_TESTBED_Peer *p2;
242 * The operation completion callback to call once this operation is done
244 GNUNET_TESTBED_OperationCompletionCallback cb;
247 * The closure for the above callback
252 * OperationContext for forwarded operations generated when peer1's controller doesn't have the
253 * configuration of peer2's controller for linking laterally to attemp an
254 * overlay connection between peer 1 and peer 2.
256 struct OperationContext *sub_opc;
261 struct ManageServiceData {
262 GNUNET_TESTBED_OperationCompletionCallback cb;
266 struct GNUNET_TESTBED_Peer *peer;
278 * Generate PeerGetConfigurationMessage
280 * @param peer_id the id of the peer whose information we have to get
281 * @param operation_id the ip of the operation that should be represented in
283 * @return the PeerGetConfigurationMessage
285 struct GNUNET_TESTBED_PeerGetConfigurationMessage *
286 GNUNET_TESTBED_generate_peergetconfig_msg_ (uint32_t peer_id,
287 uint64_t operation_id);
291 * Adds a peer to the peer list
293 * @param peer the peer to add to the peer list
296 GNUNET_TESTBED_peer_register_ (struct GNUNET_TESTBED_Peer *peer);
300 * Removes a peer from the peer list
302 * @param peer the peer to remove
305 GNUNET_TESTBED_peer_deregister_ (struct GNUNET_TESTBED_Peer *peer);
312 GNUNET_TESTBED_cleanup_peers_ (void);
315 /* end of testbed_api_peers.h */