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