-testbed message types
[oweals/gnunet.git] / src / testbed / testbed.h
1 /*
2       This file is part of GNUnet
3       (C) 2012 Christian Grothoff (and other contributing authors)
4
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.
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       General Public License for more details.
14
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.
19  */
20
21 /**
22  * @file testbed/testbed.h
23  * @brief IPC messages between testing API and service ("controller")
24  * @author Christian Grothoff
25  */
26
27 #ifndef NEW_TESTING_H
28 #define NEW_TESTING_H
29
30 #include "gnunet_util_lib.h"
31
32
33 /**
34  * Initial message from a client to a testing control service.
35  */
36 struct GNUNET_TESTBED_Message
37 {
38
39   /**
40    * Type is GNUNET_MESSAGE_TYPE_TESTBED_INIT
41    */
42   struct GNUNET_MessageHeader header;
43
44   /**
45    * Host ID that the controller is either given (if this is the
46    * dominating client) or assumed to have (for peer-connections
47    * between controllers).  A controller must check that all 
48    * connections make consistent claims...
49    */
50   uint32_t host_id GNUNET_PACKED;
51
52   /**
53    * Event mask that specifies which events this client
54    * is interested in.  In NBO.
55    */
56   uint64_t event_mask GNUNET_PACKED;
57
58 };
59
60
61 /**
62  * Notify the service about a host that we intend to use.
63  */
64 struct GNUNET_TESTBED_AddHostMessage
65 {
66
67   /**
68    * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST
69    */
70   struct GNUNET_MessageHeader header;
71
72   /**
73    * Unique ID for the host (in NBO).
74    */
75   uint32_t host_id GNUNET_PACKED;
76
77   /**
78    * SSH port to use, 0 for default (in NBO).
79    */
80   uint16_t ssh_port GNUNET_PACKED;
81
82   /**
83    * Number of bytes in the user name that follows;
84    * 0 to use no user name; otherwise 'strlen (username)',
85    * excluding 0-termination!
86    */
87   uint16_t user_name_length GNUNET_PACKED;
88
89   /* followed by 0-terminated user name */
90
91   /* followed by 0-terminated host name */
92
93 };
94
95
96 /**
97  * Confirmation from the service that adding a host
98  * worked (or failed).
99  */
100 struct GNUNET_TESTBED_HostConfirmedMessage
101 {
102
103   /**
104    * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTSUCCESS
105    */
106   struct GNUNET_MessageHeader header;
107
108   /**
109    * Unique ID for the host (in NBO).
110    */
111   uint32_t host_id GNUNET_PACKED;
112
113   /* followed by the 0-terminated error message (on failure) 
114    (typical errors include failure to login and 
115    host-id already in use) */
116
117 };
118
119
120 /**
121  * Message to testing service: configure service sharing
122  * at a host.
123  */
124 struct GNUNET_TESTBED_ConfigureSharedServiceMessage
125 {
126
127   /**
128    * Type is GNUNET_MESSAGE_TYPE_TESTBED_SERVICESHARE
129    */
130   struct GNUNET_MessageHeader header;
131
132   /**
133    * Host that is being configured.
134    */
135   uint32_t host_id GNUNET_PACKED;
136
137   /**
138    * Number of peers that should share a service instance;
139    * 1 for no sharing, 0 to forcefully disable the service.
140    */
141   uint32_t num_peers GNUNET_PACKED;
142
143   /* followed by 0-terminated name of the service */
144
145 };
146
147
148 /**
149  * Client notifies controller that it should delegate
150  * requests for a particular client to a particular
151  * sub-controller.
152  */
153 struct GNUNET_TESTBED_ControllerLinkMessage
154 {
155
156   /**
157    * Type is GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS
158    */
159   struct GNUNET_MessageHeader header;
160
161   /**
162    * For which host should requests be delegated? NBO.
163    */
164   uint32_t delegated_host_id GNUNET_PACKED;
165
166   /**
167    * Which host is responsible for managing the delegation? NBO
168    */
169   uint32_t slave_host_id GNUNET_PACKED;
170
171   /**
172    * Is the receiving controller the master controller for
173    * the slave host (and thus responsible for starting it?). NBO.
174    */
175   int32_t is_subordinate GNUNET_PACKED;
176
177   /* followed by serialized slave configuration;
178      gzip'ed configuration file in INI format */
179
180 };
181
182
183 /**
184  * Message sent from client to testing service to 
185  * create (configure, but not start) a peer.
186  */
187 struct GNUNET_TESTBED_PeerCreateMessage
188 {
189
190   /**
191    * Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER
192    */
193   struct GNUNET_MessageHeader header;
194
195   /**
196    * On which host should the peer be started?
197    */
198   uint32_t host_id GNUNET_PACKED;
199
200   /**
201    * Unique ID for the peer.
202    */
203   uint32_t peer_id GNUNET_PACKED;
204
205   /* followed by serialized peer configuration;
206      gzip'ed configuration file in INI format */
207   
208 };
209
210
211 /**
212  * Message sent from client to testing service to 
213  * reconfigure a (stopped) a peer.
214  */
215 struct GNUNET_TESTBED_PeerReconfigureMessage
216 {
217
218   /**
219    * Type is GNUNET_MESSAGE_TYPDE_TESTBED_PEERRECONF
220    */
221   struct GNUNET_MessageHeader header;
222
223   /**
224    * Unique ID for the peer.
225    */
226   uint32_t peer_id GNUNET_PACKED;
227
228   /**
229    * Operation ID that is used to identify this operation.
230    */
231   uint64_t operation_id GNUNET_PACKED;
232
233   /* followed by serialized peer configuration;
234      gzip'ed configuration file in INI format */
235   
236 };
237
238
239 /**
240  * Message sent from client to testing service to
241  * start a peer.
242  */
243 struct GNUNET_TESTBED_PeerStartMessage
244 {
245
246   /**
247    * Type is GNUNET_MESSAGE_TYPE_TESTBED_STARTPEER
248    */
249   struct GNUNET_MessageHeader header;
250
251   /**
252    * Unique ID for the peer.
253    */
254   uint32_t peer_id GNUNET_PACKED;
255
256   /**
257    * Operation ID that is used to identify this operation.
258    */
259   uint64_t operation_id GNUNET_PACKED;
260
261 };
262
263
264 /**
265  * Message sent from client to testing service to
266  * stop a peer.
267  */
268 struct GNUNET_TESTBED_PeerStopMessage
269 {
270
271   /**
272    * Type is GNUNET_MESSAGE_TYPE_TESTBED_STOPPEER
273    */
274   struct GNUNET_MessageHeader header;
275
276   /**
277    * Unique ID for the peer.
278    */
279   uint32_t peer_id GNUNET_PACKED;
280
281   /**
282    * Operation ID that is used to identify this operation.
283    */
284   uint64_t operation_id GNUNET_PACKED;
285
286 };
287
288
289 /**
290  * Message sent from client to testing service to
291  * destroy a (stopped) peer.
292  */
293 struct GNUNET_TESTBED_PeerDestroyMessage
294 {
295
296   /**
297    * Type is GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER
298    */
299   struct GNUNET_MessageHeader header;
300
301   /**
302    * Unique ID for the peer.
303    */
304   uint32_t peer_id GNUNET_PACKED;
305
306   /**
307    * Operation ID that is used to identify this operation.
308    */
309   uint64_t operation_id GNUNET_PACKED;
310
311 };
312
313
314 /**
315  * Message sent from client to testing service to
316  * (re)configure a "physical" link between two peers.
317  */
318 struct GNUNET_TESTBED_ConfigureUnderlayLinkMessage
319 {
320
321   /**
322    * Type is GNUNET_MESSAGE_TYPE_TESTBED_CONFIGULLINK
323    */
324   struct GNUNET_MessageHeader header;
325
326   /**
327    * 'enum GNUNET_TESTBED_ConnectOption' of the option to change
328    */
329   int32_t connect_option GNUNET_PACKED;
330
331   /**
332    * Unique ID for the first peer.
333    */
334   uint32_t peer1 GNUNET_PACKED;
335
336   /**
337    * Unique ID for the second peer.
338    */
339   uint32_t peer2 GNUNET_PACKED;
340
341   /**
342    * Operation ID that is used to identify this operation.
343    */
344   uint64_t operation_id GNUNET_PACKED;
345
346   /* followed by option-dependent variable-size values */
347
348 };
349
350
351 /**
352  * Message sent from client to testing service to
353  * connect two peers.
354  */
355 struct GNUNET_TESTBED_OverlayConnectMessage
356 {
357
358   /**
359    * Type is GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT
360    */
361   struct GNUNET_MessageHeader header;
362
363   /**
364    * Unique ID for the first peer.
365    */
366   uint32_t peer1 GNUNET_PACKED;
367
368   /**
369    * Operation ID that is used to identify this operation.
370    */
371   uint64_t operation_id GNUNET_PACKED;
372
373   /**
374    * Unique ID for the second peer.
375    */
376   uint32_t peer2 GNUNET_PACKED;
377
378 };
379
380
381 /**
382  * Event notification from a controller to a client.
383  */
384 struct GNUNET_TESTBED_PeerEventMessage
385 {
386
387   /**
388    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT
389    */
390   struct GNUNET_MessageHeader header;
391
392   /**
393    * 'enum GNUNET_TESTBED_EventType' (in NBO);
394    * either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER_STOP.
395    */
396   int32_t event_type GNUNET_PACKED;
397   
398   /**
399    * Host where the peer is running.
400    */
401   uint32_t host_id GNUNET_PACKED;
402
403   /**
404    * Peer that was started or stopped.
405    */
406   uint32_t peer_id GNUNET_PACKED;
407
408   /**
409    * Operation ID that is used to identify this operation.
410    */
411   uint64_t operation_id GNUNET_PACKED;
412
413 };
414
415
416 /**
417  * Event notification from a controller to a client.
418  */
419 struct GNUNET_TESTBED_ConnectionEventMessage
420 {
421
422   /**
423    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT
424    */
425   struct GNUNET_MessageHeader header;
426
427   /**
428    * 'enum GNUNET_TESTBED_EventType' (in NBO);
429    * either GNUNET_TESTBED_ET_PEER_CONNECT or GNUNET_TESTBED_ET_PEER_DISCONNECT.
430    */
431   int32_t event_type GNUNET_PACKED;
432   
433   /**
434    * First peer.
435    */
436   uint32_t peer1 GNUNET_PACKED;
437
438   /**
439    * Second peer.
440    */
441   uint32_t peer2 GNUNET_PACKED;
442
443   /**
444    * Operation ID that is used to identify this operation.
445    */
446   uint64_t operation_id GNUNET_PACKED;
447
448 };
449
450
451 /**
452  * Event notification from a controller to a client.
453  */
454 struct GNUNET_TESTBED_OperationFailureEventMessage
455 {
456
457   /**
458    * Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONEVENT
459    */
460   struct GNUNET_MessageHeader header;
461
462   /**
463    * 'enum GNUNET_TESTBED_EventType' (in NBO);
464    * GNUNET_TESTBED_ET_OPERATION_FINISHED.
465    */
466   int32_t event_type GNUNET_PACKED;
467   
468   /**
469    * Operation ID of the operation that created this event.
470    */
471   uint64_t operation_id GNUNET_PACKED;
472
473   /* followed by 0-terminated error message */
474
475 };
476
477
478 /**
479  * Event notification from a controller to a client.
480  */
481 struct GNUNET_TESTBED_PeerCreateSuccessEventMessage
482 {
483
484   /**
485    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS
486    */
487   struct GNUNET_MessageHeader header;
488
489   /**
490    * Peer identity of the peer that was created.
491    */
492   uint32_t peer_id GNUNET_PACKED;
493   
494   /**
495    * Operation ID of the operation that created this event.
496    */
497   uint64_t operation_id GNUNET_PACKED;
498
499 };
500
501
502 /**
503  * Event notification from a controller to a client for
504  * a generic operational success where the operation does
505  * not return any data.
506  */
507 struct GNUNET_TESTBED_GenericOperationSuccessEventMessage
508 {
509
510   /**
511    * Type is GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS
512    */
513   struct GNUNET_MessageHeader header;
514
515   /**
516    * 'enum GNUNET_TESTBED_EventType' (in NBO);
517    * GNUNET_TESTBED_ET_OPERATION_FINISHED.
518    */
519   int32_t event_type GNUNET_PACKED;
520   
521   /**
522    * Operation ID of the operation that created this event.
523    */
524   uint64_t operation_id GNUNET_PACKED;
525
526 };
527
528
529
530
531 /**
532  * Message sent from client to testing service to 
533  * obtain the configuration of a peer.
534  */
535 struct GNUNET_TESTBED_PeerGetConfigurationMessage
536 {
537
538   /**
539    * Type is GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG
540    */
541   struct GNUNET_MessageHeader header;
542
543   /**
544    * Unique ID for the peer.
545    */
546   uint32_t peer_id GNUNET_PACKED;
547
548   /**
549    * Operation ID that is used to identify this operation.
550    */
551   uint64_t operation_id GNUNET_PACKED;
552
553 };
554
555
556
557 /**
558  * Event notification from a controller to a client.
559  */
560 struct GNUNET_TESTBED_PeerConfigurationInformationMessage
561 {
562
563   /**
564    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG
565    */
566   struct GNUNET_MessageHeader header;
567
568   /**
569    * Peer identity of the peer that was created.
570    */
571   uint32_t peer_id GNUNET_PACKED;
572   
573   /**
574    * Operation ID of the operation that created this event.
575    */
576   uint64_t operation_id GNUNET_PACKED;
577
578   /**
579    * Identity of the peer.
580    */
581   struct GNUNET_PeerIdentity peer_id;
582
583   /* followed by gzip-compressed configuration of the peer */
584
585 };
586
587 #endif