- indent
[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 TESTBED_H
28 #define TESTBED_H
29
30 #include "gnunet_util_lib.h"
31
32 GNUNET_NETWORK_STRUCT_BEGIN
33 /**
34  * Initial message from a client to a testing control service.
35  */
36 struct GNUNET_TESTBED_InitMessage
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   /* Followed by 0-terminated hostname of the controller */
59 };
60
61
62 /**
63  * Notify the service about a host that we intend to use.
64  */
65 struct GNUNET_TESTBED_AddHostMessage
66 {
67
68   /**
69    * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST
70    */
71   struct GNUNET_MessageHeader header;
72
73   /**
74    * Unique ID for the host (in NBO).
75    */
76   uint32_t host_id GNUNET_PACKED;
77
78   /**
79    * SSH port to use, 0 for default (in NBO).
80    */
81   uint16_t ssh_port GNUNET_PACKED;
82
83   /**
84    * Number of bytes in the user name that follows;
85    * 0 to use no user name; otherwise 'strlen (username)',
86    * excluding 0-termination!
87    */
88   uint16_t user_name_length GNUNET_PACKED;
89
90   /* followed by 0-terminated user name */
91
92   /* followed by 0-terminated host name */
93
94 };
95
96
97 /**
98  * Confirmation from the service that adding a host
99  * worked (or failed).
100  * FIXME: Where is this required?
101  */
102 struct GNUNET_TESTBED_HostConfirmedMessage
103 {
104
105   /**
106    * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRMED
107    */
108   struct GNUNET_MessageHeader header;
109
110   /**
111    * Unique ID for the host (in NBO).
112    */
113   uint32_t host_id GNUNET_PACKED;
114
115   /* followed by the 0-terminated error message (on failure)
116    * (typical errors include host-id already in use) */
117
118 };
119
120
121 /**
122  * Message to testing service: configure service sharing
123  * at a host.
124  */
125 struct GNUNET_TESTBED_ConfigureSharedServiceMessage
126 {
127
128   /**
129    * Type is GNUNET_MESSAGE_TYPE_TESTBED_SERVICESHARE
130    */
131   struct GNUNET_MessageHeader header;
132
133   /**
134    * Host that is being configured.
135    */
136   uint32_t host_id GNUNET_PACKED;
137
138   /**
139    * Number of peers that should share a service instance;
140    * 1 for no sharing, 0 to forcefully disable the service.
141    */
142   uint32_t num_peers GNUNET_PACKED;
143
144   /* followed by 0-terminated name of the service */
145
146 };
147
148
149 /**
150  * Client notifies controller that it should delegate
151  * requests for a particular client to a particular
152  * sub-controller.
153  */
154 struct GNUNET_TESTBED_ControllerLinkMessage
155 {
156
157   /**
158    * Type is GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS
159    */
160   struct GNUNET_MessageHeader header;
161
162   /**
163    * For which host should requests be delegated? NBO.
164    */
165   uint32_t delegated_host_id GNUNET_PACKED;
166
167   /**
168    * The id of the operation which created this message
169    */
170   uint64_t operation_id GNUNET_PACKED;
171
172   /**
173    * Which host is responsible for managing the delegation? NBO
174    */
175   uint32_t slave_host_id GNUNET_PACKED;
176
177   /**
178    * The size of the uncompressed configuration
179    */
180   uint16_t config_size GNUNET_PACKED;
181
182   /**
183    * Set to 1 if the receiving controller is the master controller for
184    * the slave host (and thus responsible for starting it?). 0 if not
185    */
186   uint8_t is_subordinate;
187
188   /* followed by serialized slave configuration;
189    * gzip'ed configuration file in INI format */
190
191 };
192
193
194 /**
195  * Message sent from client to testing service to
196  * create (configure, but not start) a peer.
197  */
198 struct GNUNET_TESTBED_PeerCreateMessage
199 {
200
201   /**
202    * Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER
203    */
204   struct GNUNET_MessageHeader header;
205
206   /**
207    * Unique operation id
208    */
209   uint64_t operation_id GNUNET_PACKED;
210
211   /**
212    * On which host should the peer be started?
213    */
214   uint32_t host_id GNUNET_PACKED;
215
216   /**
217    * Unique ID for the peer.
218    */
219   uint32_t peer_id GNUNET_PACKED;
220
221   /**
222    * Size of the uncompressed configuration
223    */
224   uint32_t config_size GNUNET_PACKED;
225
226   /* followed by serialized peer configuration;
227    * gzip'ed configuration file in INI format */
228
229 };
230
231
232 /**
233  * Message sent from client to testing service to
234  * reconfigure a (stopped) a peer.
235  */
236 struct GNUNET_TESTBED_PeerReconfigureMessage
237 {
238
239   /**
240    * Type is GNUNET_MESSAGE_TYPDE_TESTBED_PEERRECONF
241    */
242   struct GNUNET_MessageHeader header;
243
244   /**
245    * Unique ID for the peer.
246    */
247   uint32_t peer_id GNUNET_PACKED;
248
249   /**
250    * Operation ID that is used to identify this operation.
251    */
252   uint64_t operation_id GNUNET_PACKED;
253
254   /* followed by serialized peer configuration;
255    * gzip'ed configuration file in INI format */
256
257 };
258
259
260 /**
261  * Message sent from client to testing service to
262  * start a peer.
263  */
264 struct GNUNET_TESTBED_PeerStartMessage
265 {
266
267   /**
268    * Type is GNUNET_MESSAGE_TYPE_TESTBED_STARTPEER
269    */
270   struct GNUNET_MessageHeader header;
271
272   /**
273    * Unique ID for the peer.
274    */
275   uint32_t peer_id GNUNET_PACKED;
276
277   /**
278    * Operation ID that is used to identify this operation.
279    */
280   uint64_t operation_id GNUNET_PACKED;
281
282 };
283
284
285 /**
286  * Message sent from client to testing service to
287  * stop a peer.
288  */
289 struct GNUNET_TESTBED_PeerStopMessage
290 {
291
292   /**
293    * Type is GNUNET_MESSAGE_TYPE_TESTBED_STOPPEER
294    */
295   struct GNUNET_MessageHeader header;
296
297   /**
298    * Unique ID for the peer.
299    */
300   uint32_t peer_id GNUNET_PACKED;
301
302   /**
303    * Operation ID that is used to identify this operation.
304    */
305   uint64_t operation_id GNUNET_PACKED;
306
307 };
308
309
310 /**
311  * Message sent from client to testing service to
312  * destroy a (stopped) peer.
313  */
314 struct GNUNET_TESTBED_PeerDestroyMessage
315 {
316
317   /**
318    * Type is GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER
319    */
320   struct GNUNET_MessageHeader header;
321
322   /**
323    * Unique ID for the peer.
324    */
325   uint32_t peer_id GNUNET_PACKED;
326
327   /**
328    * Operation ID that is used to identify this operation.
329    */
330   uint64_t operation_id GNUNET_PACKED;
331
332 };
333
334
335 /**
336  * Message sent from client to testing service to
337  * (re)configure a "physical" link between two peers.
338  */
339 struct GNUNET_TESTBED_ConfigureUnderlayLinkMessage
340 {
341
342   /**
343    * Type is GNUNET_MESSAGE_TYPE_TESTBED_CONFIGULLINK
344    */
345   struct GNUNET_MessageHeader header;
346
347   /**
348    * 'enum GNUNET_TESTBED_ConnectOption' of the option to change
349    */
350   int32_t connect_option GNUNET_PACKED;
351
352   /**
353    * Unique ID for the first peer.
354    */
355   uint32_t peer1 GNUNET_PACKED;
356
357   /**
358    * Unique ID for the second peer.
359    */
360   uint32_t peer2 GNUNET_PACKED;
361
362   /**
363    * Operation ID that is used to identify this operation.
364    */
365   uint64_t operation_id GNUNET_PACKED;
366
367   /* followed by option-dependent variable-size values */
368
369 };
370
371
372 /**
373  * Message sent from client to testing service to
374  * connect two peers.
375  */
376 struct GNUNET_TESTBED_OverlayConnectMessage
377 {
378
379   /**
380    * Type is GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT
381    */
382   struct GNUNET_MessageHeader header;
383
384   /**
385    * Unique ID for the first peer.
386    */
387   uint32_t peer1 GNUNET_PACKED;
388
389   /**
390    * Operation ID that is used to identify this operation.
391    */
392   uint64_t operation_id GNUNET_PACKED;
393
394   /**
395    * Unique ID for the second peer.
396    */
397   uint32_t peer2 GNUNET_PACKED;
398
399   /**
400    * The ID of the host which runs peer2
401    */
402   uint32_t peer2_host_id GNUNET_PACKED;
403
404 };
405
406
407 /**
408  * Message sent from host controller of a peer(A) to the host controller of
409  * another peer(B) to request B to connect to A
410  */
411 struct GNUNET_TESTBED_RequestConnectMessage
412 {
413   /**
414    * Type is GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT
415    */
416   struct GNUNET_MessageHeader header;
417
418   /**
419    * The Unique ID of B
420    */
421   uint32_t peer GNUNET_PACKED;
422
423   /**
424    * The Operation ID that is used to identify this operation
425    */
426   uint64_t operation_id GNUNET_PACKED;
427
428   /**
429    * Identity of A
430    */
431   struct GNUNET_PeerIdentity peer_identity;
432
433   /**
434    * To be followed by the HELLO message of A
435    */
436   struct GNUNET_MessageHeader hello[0];
437
438 };
439
440
441 /**
442  * Event notification from a controller to a client.
443  */
444 struct GNUNET_TESTBED_PeerEventMessage
445 {
446
447   /**
448    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT
449    */
450   struct GNUNET_MessageHeader header;
451
452   /**
453    * 'enum GNUNET_TESTBED_EventType' (in NBO);
454    * either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER_STOP.
455    */
456   int32_t event_type GNUNET_PACKED;
457
458   /**
459    * Host where the peer is running.
460    */
461   uint32_t host_id GNUNET_PACKED;
462
463   /**
464    * Peer that was started or stopped.
465    */
466   uint32_t peer_id GNUNET_PACKED;
467
468   /**
469    * Operation ID that is used to identify this operation.
470    */
471   uint64_t operation_id GNUNET_PACKED;
472
473 };
474
475
476 /**
477  * Event notification from a controller to a client.
478  */
479 struct GNUNET_TESTBED_ConnectionEventMessage
480 {
481
482   /**
483    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT
484    */
485   struct GNUNET_MessageHeader header;
486
487   /**
488    * 'enum GNUNET_TESTBED_EventType' (in NBO);
489    * either GNUNET_TESTBED_ET_CONNECT or GNUNET_TESTBED_ET_DISCONNECT.
490    */
491   int32_t event_type GNUNET_PACKED;
492
493   /**
494    * First peer.
495    */
496   uint32_t peer1 GNUNET_PACKED;
497
498   /**
499    * Second peer.
500    */
501   uint32_t peer2 GNUNET_PACKED;
502
503   /**
504    * Operation ID that is used to identify this operation.
505    */
506   uint64_t operation_id GNUNET_PACKED;
507
508 };
509
510
511 /**
512  * Event notification from a controller to a client.
513  */
514 struct GNUNET_TESTBED_OperationFailureEventMessage
515 {
516
517   /**
518    * Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT
519    */
520   struct GNUNET_MessageHeader header;
521
522   /**
523    * 'enum GNUNET_TESTBED_EventType' (in NBO);
524    * GNUNET_TESTBED_ET_OPERATION_FINISHED.
525    */
526   int32_t event_type GNUNET_PACKED;
527
528   /**
529    * Operation ID of the operation that created this event.
530    */
531   uint64_t operation_id GNUNET_PACKED;
532
533   /* followed by 0-terminated error message */
534
535 };
536
537
538 /**
539  * Event notification from a controller to a client.
540  */
541 struct GNUNET_TESTBED_PeerCreateSuccessEventMessage
542 {
543
544   /**
545    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS
546    */
547   struct GNUNET_MessageHeader header;
548
549   /**
550    * Peer identity of the peer that was created.
551    */
552   uint32_t peer_id GNUNET_PACKED;
553
554   /**
555    * Operation ID of the operation that created this event.
556    */
557   uint64_t operation_id GNUNET_PACKED;
558
559 };
560
561
562 /**
563  * Event notification from a controller to a client for
564  * a generic operational success where the operation does
565  * not return any data.
566  */
567 struct GNUNET_TESTBED_GenericOperationSuccessEventMessage
568 {
569
570   /**
571    * Type is GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS
572    */
573   struct GNUNET_MessageHeader header;
574
575   /**
576    * 'enum GNUNET_TESTBED_EventType' (in NBO);
577    * GNUNET_TESTBED_ET_OPERATION_FINISHED.
578    */
579   int32_t event_type GNUNET_PACKED;
580
581   /**
582    * Operation ID of the operation that created this event.
583    */
584   uint64_t operation_id GNUNET_PACKED;
585
586 };
587
588
589 /**
590  * Message sent from client to testing service to
591  * obtain the configuration of a peer.
592  */
593 struct GNUNET_TESTBED_PeerGetConfigurationMessage
594 {
595
596   /**
597    * Type is GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG
598    */
599   struct GNUNET_MessageHeader header;
600
601   /**
602    * Unique ID for the peer.
603    */
604   uint32_t peer_id GNUNET_PACKED;
605
606   /**
607    * Operation ID that is used to identify this operation.
608    */
609   uint64_t operation_id GNUNET_PACKED;
610
611 };
612
613
614 /**
615  * Peer configuration and identity reply from controller to a client.
616  */
617 struct GNUNET_TESTBED_PeerConfigurationInformationMessage
618 {
619
620   /**
621    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG
622    */
623   struct GNUNET_MessageHeader header;
624
625   /**
626    * The id of the peer relevant to this information
627    */
628   uint32_t peer_id GNUNET_PACKED;
629
630   /**
631    * Operation ID of the operation that created this event.
632    */
633   uint64_t operation_id GNUNET_PACKED;
634
635   /**
636    * Identity of the peer.
637    */
638   struct GNUNET_PeerIdentity peer_identity;
639
640   /**
641    * The size of configuration when uncompressed
642    */
643   uint16_t config_size GNUNET_PACKED;
644
645   /* followed by gzip-compressed configuration of the peer */
646
647 };
648
649
650 /**
651  * Message to request configuration of a slave controller
652  */
653 struct GNUNET_TESTBED_SlaveGetConfigurationMessage
654 {
655   /**
656    * Type is GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG
657    */
658   struct GNUNET_MessageHeader header;
659
660   /**
661    * The id of the slave host
662    */
663   uint32_t slave_id GNUNET_PACKED;
664
665   /**
666    * Operation ID
667    */
668   uint64_t operation_id GNUNET_PACKED;
669
670 };
671
672
673 /**
674  * Reply to GETSLAVECONFIG message
675  */
676 struct GNUNET_TESTBED_SlaveConfiguration
677 {
678   /**
679    * Type is GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG
680    */
681   struct GNUNET_MessageHeader header;
682
683   /**
684    * The id of the host where the slave is running
685    */
686   uint32_t slave_id GNUNET_PACKED;
687
688   /**
689    * Operation ID
690    */
691   uint64_t operation_id GNUNET_PACKED;
692
693   /**
694    * The size of the configuration when uncompressed
695    */
696   uint16_t config_size GNUNET_PACKED;
697
698   /* followed by gzip-compressed configuration of the peer */
699
700 };
701
702
703 GNUNET_NETWORK_STRUCT_END
704 #endif
705 /* end of testbed.h */