adhering to indentation standard
[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  * Event notification from a controller to a client.
405  */
406 struct GNUNET_TESTBED_PeerEventMessage
407 {
408
409   /**
410    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT
411    */
412   struct GNUNET_MessageHeader header;
413
414   /**
415    * 'enum GNUNET_TESTBED_EventType' (in NBO);
416    * either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER_STOP.
417    */
418   int32_t event_type GNUNET_PACKED;
419
420   /**
421    * Host where the peer is running.
422    */
423   uint32_t host_id GNUNET_PACKED;
424
425   /**
426    * Peer that was started or stopped.
427    */
428   uint32_t peer_id GNUNET_PACKED;
429
430   /**
431    * Operation ID that is used to identify this operation.
432    */
433   uint64_t operation_id GNUNET_PACKED;
434
435 };
436
437
438 /**
439  * Event notification from a controller to a client.
440  */
441 struct GNUNET_TESTBED_ConnectionEventMessage
442 {
443
444   /**
445    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT
446    */
447   struct GNUNET_MessageHeader header;
448
449   /**
450    * 'enum GNUNET_TESTBED_EventType' (in NBO);
451    * either GNUNET_TESTBED_ET_CONNECT or GNUNET_TESTBED_ET_DISCONNECT.
452    */
453   int32_t event_type GNUNET_PACKED;
454
455   /**
456    * First peer.
457    */
458   uint32_t peer1 GNUNET_PACKED;
459
460   /**
461    * Second peer.
462    */
463   uint32_t peer2 GNUNET_PACKED;
464
465   /**
466    * Operation ID that is used to identify this operation.
467    */
468   uint64_t operation_id GNUNET_PACKED;
469
470 };
471
472
473 /**
474  * Event notification from a controller to a client.
475  */
476 struct GNUNET_TESTBED_OperationFailureEventMessage
477 {
478
479   /**
480    * Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONEVENT
481    */
482   struct GNUNET_MessageHeader header;
483
484   /**
485    * 'enum GNUNET_TESTBED_EventType' (in NBO);
486    * GNUNET_TESTBED_ET_OPERATION_FINISHED.
487    */
488   int32_t event_type GNUNET_PACKED;
489
490   /**
491    * Operation ID of the operation that created this event.
492    */
493   uint64_t operation_id GNUNET_PACKED;
494
495   /* followed by 0-terminated error message */
496
497 };
498
499
500 /**
501  * Event notification from a controller to a client.
502  */
503 struct GNUNET_TESTBED_PeerCreateSuccessEventMessage
504 {
505
506   /**
507    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS
508    */
509   struct GNUNET_MessageHeader header;
510
511   /**
512    * Peer identity of the peer that was created.
513    */
514   uint32_t peer_id GNUNET_PACKED;
515
516   /**
517    * Operation ID of the operation that created this event.
518    */
519   uint64_t operation_id GNUNET_PACKED;
520
521 };
522
523
524 /**
525  * Event notification from a controller to a client for
526  * a generic operational success where the operation does
527  * not return any data.
528  */
529 struct GNUNET_TESTBED_GenericOperationSuccessEventMessage
530 {
531
532   /**
533    * Type is GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS
534    */
535   struct GNUNET_MessageHeader header;
536
537   /**
538    * 'enum GNUNET_TESTBED_EventType' (in NBO);
539    * GNUNET_TESTBED_ET_OPERATION_FINISHED.
540    */
541   int32_t event_type GNUNET_PACKED;
542
543   /**
544    * Operation ID of the operation that created this event.
545    */
546   uint64_t operation_id GNUNET_PACKED;
547
548 };
549
550
551
552
553 /**
554  * Message sent from client to testing service to
555  * obtain the configuration of a peer.
556  */
557 struct GNUNET_TESTBED_PeerGetConfigurationMessage
558 {
559
560   /**
561    * Type is GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG
562    */
563   struct GNUNET_MessageHeader header;
564
565   /**
566    * Unique ID for the peer.
567    */
568   uint32_t peer_id GNUNET_PACKED;
569
570   /**
571    * Operation ID that is used to identify this operation.
572    */
573   uint64_t operation_id GNUNET_PACKED;
574
575 };
576
577
578
579 /**
580  * Event notification from a controller to a client.
581  */
582 struct GNUNET_TESTBED_PeerConfigurationInformationMessage
583 {
584
585   /**
586    * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG
587    */
588   struct GNUNET_MessageHeader header;
589
590   /**
591    * The id of the peer relevant to this information
592    */
593   uint32_t peer_id GNUNET_PACKED;
594
595   /**
596    * Operation ID of the operation that created this event.
597    */
598   uint64_t operation_id GNUNET_PACKED;
599
600   /**
601    * Identity of the peer.
602    */
603   struct GNUNET_PeerIdentity peer_identity;
604
605   /**
606    * The size of configuration when uncompressed
607    */
608   uint16_t config_size;
609
610   /* followed by gzip-compressed configuration of the peer */
611
612 };
613
614
615 #endif