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