2 This file is part of GNUnet
3 (C) 2012 Christian Grothoff (and other contributing authors)
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.
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.
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.
22 * @file testbed/testbed.h
23 * @brief IPC messages between testing API and service ("controller")
24 * @author Christian Grothoff
30 #include "gnunet_util_lib.h"
32 GNUNET_NETWORK_STRUCT_BEGIN
34 * Initial message from a client to a testing control service.
36 struct GNUNET_TESTBED_InitMessage
40 * Type is GNUNET_MESSAGE_TYPE_TESTBED_INIT
42 struct GNUNET_MessageHeader header;
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...
50 uint32_t host_id GNUNET_PACKED;
53 * Event mask that specifies which events this client
54 * is interested in. In NBO.
56 uint64_t event_mask GNUNET_PACKED;
58 /* Followed by 0-terminated hostname of the controller */
63 * Notify the service about a host that we intend to use.
65 struct GNUNET_TESTBED_AddHostMessage
69 * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST
71 struct GNUNET_MessageHeader header;
74 * Unique ID for the host (in NBO).
76 uint32_t host_id GNUNET_PACKED;
79 * SSH port to use, 0 for default (in NBO).
81 uint16_t ssh_port GNUNET_PACKED;
84 * Number of bytes in the user name that follows;
85 * 0 to use no user name; otherwise 'strlen (username)',
86 * excluding 0-termination!
88 uint16_t username_length GNUNET_PACKED;
91 * Number of bytes in the host name (excluding 0-termination) that follows the
92 * user name; cannot be 0
94 uint16_t hostname_length GNUNET_PACKED;
97 * The length of the uncompressed configuration
99 uint16_t config_size GNUNET_PACKED;
101 /* followed by non 0-terminated user name */
103 /* followed by non 0-terminated host name */
105 /* followed by gzip compressed configuration to start or connect to a
106 controller on this host. While starting the controller this configration
107 is used as a template */
113 * Confirmation from the service that adding a host
114 * worked (or failed).
115 * FIXME: Where is this required?
117 struct GNUNET_TESTBED_HostConfirmedMessage
121 * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS
123 struct GNUNET_MessageHeader header;
126 * Unique ID for the host (in NBO).
128 uint32_t host_id GNUNET_PACKED;
130 /* followed by the 0-terminated error message (on failure)
131 * (typical errors include host-id already in use) */
137 * Message to testing service: configure service sharing
140 struct GNUNET_TESTBED_ConfigureSharedServiceMessage
144 * Type is GNUNET_MESSAGE_TYPE_TESTBED_SHARE_SERVICE
146 struct GNUNET_MessageHeader header;
149 * Host that is being configured.
151 uint32_t host_id GNUNET_PACKED;
154 * Number of peers that should share a service instance;
155 * 1 for no sharing, 0 to forcefully disable the service.
157 uint32_t num_peers GNUNET_PACKED;
159 /* followed by 0-terminated name of the service */
165 * Client notifies controller that it should delegate
166 * requests for a particular client to a particular
169 struct GNUNET_TESTBED_ControllerLinkRequest
173 * Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS
175 struct GNUNET_MessageHeader header;
178 * For which host should requests be delegated? NBO.
180 uint32_t delegated_host_id GNUNET_PACKED;
183 * The id of the operation which created this message
185 uint64_t operation_id GNUNET_PACKED;
188 * Which host is responsible for managing the delegation? NBO
190 uint32_t slave_host_id GNUNET_PACKED;
193 * The size of the uncompressed configuration
195 uint16_t config_size GNUNET_PACKED;
198 * Set to 1 if the receiving controller is the master controller for
199 * the slave host (and thus responsible for starting it?). 0 if not
201 uint8_t is_subordinate;
203 /* followed by serialized slave configuration;
204 * gzip'ed configuration file in INI format */
210 * Response message for ControllerLinkRequest message
212 struct GNUNET_TESTBED_ControllerLinkResponse
216 * Type is GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
218 struct GNUNET_MessageHeader header;
221 * The size of the compressed configuration. Can be ZERO if the controller is
222 * not started (depends on the ControllerLinkRequest). NBO.
224 uint16_t config_size GNUNET_PACKED;
227 * Set to GNUNET_YES to signify SUCCESS; GNUNET_NO to signify failure
229 uint16_t success GNUNET_PACKED;
232 * The id of the operation which created this message. NBO
234 uint64_t operation_id GNUNET_PACKED;
236 /* If controller linking is successful and configuration is present, then here
237 * comes the serialized gzip configuration with which the controller is
238 * running at the delegate host */
240 /* In case of failure, here comes the error message (without \0 termination)*/
246 * Message sent from client to testing service to
247 * create (configure, but not start) a peer.
249 struct GNUNET_TESTBED_PeerCreateMessage
253 * Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
255 struct GNUNET_MessageHeader header;
258 * Unique operation id
260 uint64_t operation_id GNUNET_PACKED;
263 * On which host should the peer be started?
265 uint32_t host_id GNUNET_PACKED;
268 * Unique ID for the peer.
270 uint32_t peer_id GNUNET_PACKED;
273 * Size of the uncompressed configuration
275 uint32_t config_size GNUNET_PACKED;
277 /* followed by serialized peer configuration;
278 * gzip'ed configuration file in INI format */
284 * Message sent from client to testing service to
285 * reconfigure a (stopped) a peer.
287 struct GNUNET_TESTBED_PeerReconfigureMessage
291 * Type is GNUNET_MESSAGE_TYPDE_TESTBED_RECONFIGURE_PEER
293 struct GNUNET_MessageHeader header;
296 * Unique ID for the peer.
298 uint32_t peer_id GNUNET_PACKED;
301 * Operation ID that is used to identify this operation.
303 uint64_t operation_id GNUNET_PACKED;
305 /* followed by serialized peer configuration;
306 * gzip'ed configuration file in INI format */
312 * Message sent from client to testing service to
315 struct GNUNET_TESTBED_PeerStartMessage
319 * Type is GNUNET_MESSAGE_TYPE_TESTBED_START_PEER
321 struct GNUNET_MessageHeader header;
324 * Unique ID for the peer.
326 uint32_t peer_id GNUNET_PACKED;
329 * Operation ID that is used to identify this operation.
331 uint64_t operation_id GNUNET_PACKED;
337 * Message sent from client to testing service to
340 struct GNUNET_TESTBED_PeerStopMessage
344 * Type is GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER
346 struct GNUNET_MessageHeader header;
349 * Unique ID for the peer.
351 uint32_t peer_id GNUNET_PACKED;
354 * Operation ID that is used to identify this operation.
356 uint64_t operation_id GNUNET_PACKED;
362 * Message sent from client to testing service to
363 * destroy a (stopped) peer.
365 struct GNUNET_TESTBED_PeerDestroyMessage
369 * Type is GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER
371 struct GNUNET_MessageHeader header;
374 * Unique ID for the peer.
376 uint32_t peer_id GNUNET_PACKED;
379 * Operation ID that is used to identify this operation.
381 uint64_t operation_id GNUNET_PACKED;
387 * Message sent from client to testing service to
388 * (re)configure a "physical" link between two peers.
390 struct GNUNET_TESTBED_ConfigureUnderlayLinkMessage
394 * Type is GNUNET_MESSAGE_TYPE_TESTBED_CONFIGURE_UNDERLAY_LINK
396 struct GNUNET_MessageHeader header;
399 * 'enum GNUNET_TESTBED_ConnectOption' of the option to change
401 int32_t connect_option GNUNET_PACKED;
404 * Unique ID for the first peer.
406 uint32_t peer1 GNUNET_PACKED;
409 * Unique ID for the second peer.
411 uint32_t peer2 GNUNET_PACKED;
414 * Operation ID that is used to identify this operation.
416 uint64_t operation_id GNUNET_PACKED;
418 /* followed by option-dependent variable-size values */
424 * Message sent from client to testing service to
427 struct GNUNET_TESTBED_OverlayConnectMessage
431 * Type is GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT
433 struct GNUNET_MessageHeader header;
436 * Unique ID for the first peer.
438 uint32_t peer1 GNUNET_PACKED;
441 * Operation ID that is used to identify this operation.
443 uint64_t operation_id GNUNET_PACKED;
446 * Unique ID for the second peer.
448 uint32_t peer2 GNUNET_PACKED;
451 * The ID of the host which runs peer2
453 uint32_t peer2_host_id GNUNET_PACKED;
459 * Message sent from host controller of a peer(A) to the host controller of
460 * another peer(B) to request B to connect to A
462 struct GNUNET_TESTBED_RemoteOverlayConnectMessage
465 * Type is GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT
467 struct GNUNET_MessageHeader header;
472 uint32_t peer GNUNET_PACKED;
475 * The Operation ID that is used to identify this operation
477 uint64_t operation_id GNUNET_PACKED;
482 struct GNUNET_PeerIdentity peer_identity;
485 * To be followed by the HELLO message of A
487 struct GNUNET_MessageHeader hello[0];
493 * Event notification from a controller to a client.
495 struct GNUNET_TESTBED_PeerEventMessage
499 * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT
501 struct GNUNET_MessageHeader header;
504 * 'enum GNUNET_TESTBED_EventType' (in NBO);
505 * either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER_STOP.
507 int32_t event_type GNUNET_PACKED;
510 * Host where the peer is running.
512 uint32_t host_id GNUNET_PACKED;
515 * Peer that was started or stopped.
517 uint32_t peer_id GNUNET_PACKED;
520 * Operation ID that is used to identify this operation.
522 uint64_t operation_id GNUNET_PACKED;
528 * Event notification from a controller to a client.
530 struct GNUNET_TESTBED_ConnectionEventMessage
534 * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT
536 struct GNUNET_MessageHeader header;
539 * 'enum GNUNET_TESTBED_EventType' (in NBO);
540 * either GNUNET_TESTBED_ET_CONNECT or GNUNET_TESTBED_ET_DISCONNECT.
542 int32_t event_type GNUNET_PACKED;
547 uint32_t peer1 GNUNET_PACKED;
552 uint32_t peer2 GNUNET_PACKED;
555 * Operation ID that is used to identify this operation.
557 uint64_t operation_id GNUNET_PACKED;
563 * Event notification from a controller to a client.
565 struct GNUNET_TESTBED_OperationFailureEventMessage
569 * Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT
571 struct GNUNET_MessageHeader header;
574 * 'enum GNUNET_TESTBED_EventType' (in NBO);
575 * GNUNET_TESTBED_ET_OPERATION_FINISHED.
577 int32_t event_type GNUNET_PACKED;
580 * Operation ID of the operation that created this event.
582 uint64_t operation_id GNUNET_PACKED;
584 /* followed by 0-terminated error message */
590 * Event notification from a controller to a client.
592 struct GNUNET_TESTBED_PeerCreateSuccessEventMessage
596 * Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS
598 struct GNUNET_MessageHeader header;
601 * Peer identity of the peer that was created.
603 uint32_t peer_id GNUNET_PACKED;
606 * Operation ID of the operation that created this event.
608 uint64_t operation_id GNUNET_PACKED;
614 * Event notification from a controller to a client for
615 * a generic operational success where the operation does
616 * not return any data.
618 struct GNUNET_TESTBED_GenericOperationSuccessEventMessage
622 * Type is GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS
624 struct GNUNET_MessageHeader header;
627 * 'enum GNUNET_TESTBED_EventType' (in NBO);
628 * GNUNET_TESTBED_ET_OPERATION_FINISHED.
630 int32_t event_type GNUNET_PACKED;
633 * Operation ID of the operation that created this event.
635 uint64_t operation_id GNUNET_PACKED;
641 * Message sent from client to testing service to
642 * obtain the configuration of a peer.
644 struct GNUNET_TESTBED_PeerGetConfigurationMessage
648 * Type is GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_CONFIGURATION
650 struct GNUNET_MessageHeader header;
653 * Unique ID for the peer.
655 uint32_t peer_id GNUNET_PACKED;
658 * Operation ID that is used to identify this operation.
660 uint64_t operation_id GNUNET_PACKED;
666 * Peer configuration and identity reply from controller to a client.
668 struct GNUNET_TESTBED_PeerConfigurationInformationMessage
672 * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONFIGURATION
674 struct GNUNET_MessageHeader header;
677 * The id of the peer relevant to this information
679 uint32_t peer_id GNUNET_PACKED;
682 * Operation ID of the operation that created this event.
684 uint64_t operation_id GNUNET_PACKED;
687 * Identity of the peer.
689 struct GNUNET_PeerIdentity peer_identity;
692 * The size of configuration when uncompressed
694 uint16_t config_size GNUNET_PACKED;
696 /* followed by gzip-compressed configuration of the peer */
702 * Message to request configuration of a slave controller
704 struct GNUNET_TESTBED_SlaveGetConfigurationMessage
707 * Type is GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
709 struct GNUNET_MessageHeader header;
712 * The id of the slave host
714 uint32_t slave_id GNUNET_PACKED;
719 uint64_t operation_id GNUNET_PACKED;
725 * Reply to GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIG message
727 struct GNUNET_TESTBED_SlaveConfiguration
730 * Type is GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
732 struct GNUNET_MessageHeader header;
735 * The id of the host where the slave is running
737 uint32_t slave_id GNUNET_PACKED;
742 uint64_t operation_id GNUNET_PACKED;
745 * The size of the configuration when uncompressed
747 uint16_t config_size GNUNET_PACKED;
749 /* followed by gzip-compressed configuration of the peer */
755 * Shutdown peers message
757 struct GNUNET_TESTBED_ShutdownPeersMessage
760 * Type is GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
762 struct GNUNET_MessageHeader header;
767 uint64_t operation_id GNUNET_PACKED;
771 GNUNET_NETWORK_STRUCT_END
773 /* end of testbed.h */