aboutsummaryrefslogtreecommitdiff
path: root/src/testbed/testbed_api_peers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/testbed/testbed_api_peers.h')
-rw-r--r--src/testbed/testbed_api_peers.h311
1 files changed, 0 insertions, 311 deletions
diff --git a/src/testbed/testbed_api_peers.h b/src/testbed/testbed_api_peers.h
deleted file mode 100644
index db8ec9881..000000000
--- a/src/testbed/testbed_api_peers.h
+++ /dev/null
@@ -1,311 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008--2013 GNUnet e.V.
4
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.
9
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.
14
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/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
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
26 */
27
28#ifndef NEW_TESTING_API_PEERS_H
29#define NEW_TESTING_API_PEERS_H
30
31#include "gnunet_testbed_service.h"
32#include "gnunet_helper_lib.h"
33
34
35/**
36 * Enumeration of possible states a peer could be in
37 */
38enum PeerState
39{
40 /**
41 * State to signify that this peer is invalid
42 */
43 TESTBED_PS_INVALID,
44
45 /**
46 * The peer has been created
47 */
48 TESTBED_PS_CREATED,
49
50 /**
51 * The peer is running
52 */
53 TESTBED_PS_STARTED,
54
55 /**
56 * The peer is stopped
57 */
58 TESTBED_PS_STOPPED,
59};
60
61
62/**
63 * A peer controlled by the testing framework. A peer runs
64 * at a particular host.
65 */
66struct GNUNET_TESTBED_Peer
67{
68 /**
69 * peer list DLL
70 */
71 struct GNUNET_TESTBED_Peer *next;
72
73 /**
74 * peer list DLL
75 */
76 struct GNUNET_TESTBED_Peer *prev;
77
78 /**
79 * Our controller context (not necessarily the controller
80 * that is responsible for starting/running the peer!).
81 */
82 struct GNUNET_TESTBED_Controller *controller;
83
84 /**
85 * Which host does this peer run on?
86 */
87 struct GNUNET_TESTBED_Host *host;
88
89 /**
90 * Globally unique ID of the peer.
91 */
92 uint32_t unique_id;
93
94 /**
95 * Peer's state
96 */
97 enum PeerState state;
98
99 /**
100 * Has an underlay model already set for this peer?
101 */
102 uint8_t underlay_model_exists;
103};
104
105
106/**
107 * Data for the OperationType OP_PEER_CREATE
108 */
109struct PeerCreateData
110{
111 /**
112 * The host where the peer has to be created
113 */
114 struct GNUNET_TESTBED_Host *host;
115
116 /**
117 * The template configuration of the peer
118 */
119 const struct GNUNET_CONFIGURATION_Handle *cfg;
120
121 /**
122 * The call back to call when we receive peer create success message
123 */
124 GNUNET_TESTBED_PeerCreateCallback cb;
125
126 /**
127 * The closure for the above callback
128 */
129 void *cls;
130
131 /**
132 * The peer structure to return when we get success message
133 */
134 struct GNUNET_TESTBED_Peer *peer;
135};
136
137
138/**
139 * Data for OperationType OP_PEER_START and OP_PEER_STOP
140 */
141struct PeerEventData
142{
143 /**
144 * The handle of the peer to start
145 */
146 struct GNUNET_TESTBED_Peer *peer;
147
148 /**
149 * The Peer churn callback to call when this operation is completed
150 */
151 GNUNET_TESTBED_PeerChurnCallback pcc;
152
153 /**
154 * Closure for the above callback
155 */
156 void *pcc_cls;
157};
158
159
160/**
161 * Data for the OperationType OP_PEER_DESTROY;
162 */
163struct PeerDestroyData
164{
165 /**
166 * The peer structure
167 */
168 struct GNUNET_TESTBED_Peer *peer;
169
170 // PEERDESTROYDATA
171};
172
173
174/**
175 * Data for the OperationType OP_PEER_INFO
176 */
177struct PeerInfoData
178{
179 /**
180 * The peer whose information has been requested
181 */
182 struct GNUNET_TESTBED_Peer *peer;
183
184 /**
185 * The Peer info callback to call when this operation has completed
186 */
187 GNUNET_TESTBED_PeerInfoCallback cb;
188
189 /**
190 * The closure for peer info callback
191 */
192 void *cb_cls;
193
194 /**
195 * The type of peer information requested
196 */
197 enum GNUNET_TESTBED_PeerInformationType pit;
198};
199
200
201/**
202 * Data for the operations of type OP_PEER_RECONFIGURE
203 */
204struct PeerReconfigureData
205{
206 /**
207 * The peer whose information has been requested
208 */
209 struct GNUNET_TESTBED_Peer *peer;
210
211 /**
212 * The serialized new configuration template
213 */
214 char *config;
215
216 /**
217 * the size of the serialized configuration
218 */
219 uint16_t cfg_size;
220};
221
222
223/**
224 * Data structure for OperationType OP_OVERLAY_CONNECT
225 */
226struct OverlayConnectData
227{
228 /**
229 * Peer A to connect to peer B
230 */
231 struct GNUNET_TESTBED_Peer *p1;
232
233 /**
234 * Peer B
235 */
236 struct GNUNET_TESTBED_Peer *p2;
237
238 /**
239 * The operation completion callback to call once this operation is done
240 */
241 GNUNET_TESTBED_OperationCompletionCallback cb;
242
243 /**
244 * The closure for the above callback
245 */
246 void *cb_cls;
247
248 /**
249 * OperationContext for forwarded operations generated when peer1's controller doesn't have the
250 * configuration of peer2's controller for linking laterally to attempt an
251 * overlay connection between peer 1 and peer 2.
252 */
253 struct OperationContext *sub_opc;
254};
255
256
257struct ManageServiceData
258{
259 GNUNET_TESTBED_OperationCompletionCallback cb;
260
261 void *cb_cls;
262
263 struct GNUNET_TESTBED_Peer *peer;
264
265 char *service_name;
266
267 unsigned int start;
268
269 uint16_t msize;
270};
271
272
273/**
274 * Generate PeerGetConfigurationMessage
275 *
276 * @param peer_id the id of the peer whose information we have to get
277 * @param operation_id the ip of the operation that should be represented in
278 * the message
279 * @return the PeerGetConfigurationMessage
280 */
281struct GNUNET_TESTBED_PeerGetConfigurationMessage *
282GNUNET_TESTBED_generate_peergetconfig_msg_ (uint32_t peer_id,
283 uint64_t operation_id);
284
285
286/**
287 * Adds a peer to the peer list
288 *
289 * @param peer the peer to add to the peer list
290 */
291void
292GNUNET_TESTBED_peer_register_ (struct GNUNET_TESTBED_Peer *peer);
293
294
295/**
296 * Removes a peer from the peer list
297 *
298 * @param peer the peer to remove
299 */
300void
301GNUNET_TESTBED_peer_deregister_ (struct GNUNET_TESTBED_Peer *peer);
302
303
304/**
305 * Frees all peers
306 */
307void
308GNUNET_TESTBED_cleanup_peers_ (void);
309
310#endif
311/* end of testbed_api_peers.h */