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/>.
20 * @file testbed/testbed_api_peers.h
21 * @brief internal API to access the 'peers' subsystem
22 * @author Christian Grothoff
23 * @author Sree Harsha Totakura
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
69 struct GNUNET_TESTBED_Peer *next;
74 struct GNUNET_TESTBED_Peer *prev;
77 * Our controller context (not necessarily the controller
78 * that is responsible for starting/running the peer!).
80 struct GNUNET_TESTBED_Controller *controller;
83 * Which host does this peer run on?
85 struct GNUNET_TESTBED_Host *host;
88 * Globally unique ID of the peer.
98 * Has an underlay model already set for this peer?
100 uint8_t underlay_model_exists;
105 * Data for the OperationType OP_PEER_CREATE
107 struct PeerCreateData
110 * The host where the peer has to be created
112 struct GNUNET_TESTBED_Host *host;
115 * The template configuration of the peer
117 const struct GNUNET_CONFIGURATION_Handle *cfg;
120 * The call back to call when we receive peer create success message
122 GNUNET_TESTBED_PeerCreateCallback cb;
125 * The closure for the above callback
130 * The peer structure to return when we get success message
132 struct GNUNET_TESTBED_Peer *peer;
138 * Data for OperationType OP_PEER_START and OP_PEER_STOP
143 * The handle of the peer to start
145 struct GNUNET_TESTBED_Peer *peer;
148 * The Peer churn callback to call when this operation is completed
150 GNUNET_TESTBED_PeerChurnCallback pcc;
153 * Closure for the above callback
161 * Data for the OperationType OP_PEER_DESTROY;
163 struct PeerDestroyData
168 struct GNUNET_TESTBED_Peer *peer;
175 * Data for the OperationType OP_PEER_INFO
180 * The peer whose information has been requested
182 struct GNUNET_TESTBED_Peer *peer;
185 * The Peer info callback to call when this operation has completed
187 GNUNET_TESTBED_PeerInfoCallback cb;
190 * The closure for peer info callback
195 * The type of peer information requested
197 enum GNUNET_TESTBED_PeerInformationType pit;
202 * Data for the operations of type OP_PEER_RECONFIGURE
204 struct PeerReconfigureData
207 * The peer whose information has been requested
209 struct GNUNET_TESTBED_Peer *peer;
212 * The serialized new configuration template
217 * the size of the serialized configuration
224 * Data structure for OperationType OP_OVERLAY_CONNECT
226 struct OverlayConnectData
230 * Peer A to connect to peer B
232 struct GNUNET_TESTBED_Peer *p1;
237 struct GNUNET_TESTBED_Peer *p2;
240 * The operation completion callback to call once this operation is done
242 GNUNET_TESTBED_OperationCompletionCallback cb;
245 * The closure for the above callback
250 * OperationContext for forwarded operations generated when peer1's controller doesn't have the
251 * configuration of peer2's controller for linking laterally to attemp an
252 * overlay connection between peer 1 and peer 2.
254 struct OperationContext *sub_opc;
259 struct ManageServiceData {
260 GNUNET_TESTBED_OperationCompletionCallback cb;
264 struct GNUNET_TESTBED_Peer *peer;
276 * Generate PeerGetConfigurationMessage
278 * @param peer_id the id of the peer whose information we have to get
279 * @param operation_id the ip of the operation that should be represented in
281 * @return the PeerGetConfigurationMessage
283 struct GNUNET_TESTBED_PeerGetConfigurationMessage *
284 GNUNET_TESTBED_generate_peergetconfig_msg_ (uint32_t peer_id,
285 uint64_t operation_id);
289 * Adds a peer to the peer list
291 * @param peer the peer to add to the peer list
294 GNUNET_TESTBED_peer_register_ (struct GNUNET_TESTBED_Peer *peer);
298 * Removes a peer from the peer list
300 * @param peer the peer to remove
303 GNUNET_TESTBED_peer_deregister_ (struct GNUNET_TESTBED_Peer *peer);
310 GNUNET_TESTBED_cleanup_peers_ (void);
313 /* end of testbed_api_peers.h */