2 This file is part of GNUnet
3 Copyright (C) 2008--2013 GNUnet e.V.
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 SPDX-License-Identifier: AGPL3.0-or-later
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 {
38 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_INIT
40 struct GNUNET_MessageHeader header;
43 * Host ID that the controller is either given (if this is the
44 * dominating client) or assumed to have (for peer-connections
45 * between controllers). A controller must check that all
46 * connections make consistent claims...
48 uint32_t host_id GNUNET_PACKED;
51 * Event mask that specifies which events this client
52 * is interested in. In NBO.
54 uint64_t event_mask GNUNET_PACKED;
56 /* Followed by 0-terminated hostname of the controller */
61 * Notify the service about a host that we intend to use.
63 struct GNUNET_TESTBED_AddHostMessage {
65 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST
67 struct GNUNET_MessageHeader header;
70 * Unique ID for the host (in NBO).
72 uint32_t host_id GNUNET_PACKED;
75 * SSH port to use, 0 for default (in NBO).
77 uint16_t ssh_port GNUNET_PACKED;
80 * Number of bytes in the user name that follows;
81 * 0 to use no user name; otherwise 'strlen (username)',
82 * excluding 0-termination!
84 uint16_t username_length GNUNET_PACKED;
87 * Number of bytes in the host name (excluding 0-termination) that follows the
88 * user name; cannot be 0
90 uint16_t hostname_length GNUNET_PACKED;
93 * The length of the uncompressed configuration
95 uint16_t config_size GNUNET_PACKED;
97 /* followed by non 0-terminated user name */
99 /* followed by non 0-terminated host name */
101 /* followed by gzip compressed configuration to start or connect to a
102 controller on this host. While starting the controller this configuration
103 is used as a template */
108 * Confirmation from the service that adding a host
109 * worked (or failed).
110 * FIXME: Where is this required?
112 struct GNUNET_TESTBED_HostConfirmedMessage {
114 * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS
116 struct GNUNET_MessageHeader header;
119 * Unique ID for the host (in NBO).
121 uint32_t host_id GNUNET_PACKED;
123 /* followed by the 0-terminated error message (on failure)
124 * (typical errors include host-id already in use) */
129 * Client notifies controller that it should delegate
130 * requests for a particular client to a particular
133 struct GNUNET_TESTBED_ControllerLinkRequest {
135 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS
137 struct GNUNET_MessageHeader header;
140 * For which host should requests be delegated? NBO.
142 uint32_t delegated_host_id GNUNET_PACKED;
145 * The id of the operation which created this message
147 uint64_t operation_id GNUNET_PACKED;
150 * Which host is responsible for managing the delegation? NBO
152 uint32_t slave_host_id GNUNET_PACKED;
155 * Set to 1 if the receiving controller is the master controller for
156 * the slave host (and thus responsible for starting it?). 0 if not
158 uint8_t is_subordinate;
163 * Response message for ControllerLinkRequest message
165 struct GNUNET_TESTBED_ControllerLinkResponse {
167 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
169 struct GNUNET_MessageHeader header;
172 * The size of the compressed configuration. Can be ZERO if the controller is
173 * not started (depends on the ControllerLinkRequest). NBO.
175 uint16_t config_size GNUNET_PACKED;
178 * Set to #GNUNET_YES to signify SUCCESS; #GNUNET_NO to signify failure
180 uint16_t success GNUNET_PACKED;
183 * The id of the operation which created this message. NBO
185 uint64_t operation_id GNUNET_PACKED;
187 /* If controller linking is successful and configuration is present, then here
188 * comes the serialized gzip configuration with which the controller is
189 * running at the delegate host */
191 /* In case of failure, here comes the error message (without \0 termination)*/
196 * Message sent from client to testing service to
197 * create (configure, but not start) a peer.
199 struct GNUNET_TESTBED_PeerCreateMessage {
201 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
203 struct GNUNET_MessageHeader header;
206 * On which host should the peer be started?
208 uint32_t host_id GNUNET_PACKED;
211 * Unique operation id
213 uint64_t operation_id GNUNET_PACKED;
216 * Unique ID for the peer.
218 uint32_t peer_id GNUNET_PACKED;
221 * Size of the uncompressed configuration
223 uint16_t config_size GNUNET_PACKED;
225 /* followed by serialized peer configuration;
226 * gzip'ed configuration file in INI format */
231 * Message sent from client to testing service to
232 * reconfigure a (stopped) a peer.
234 struct GNUNET_TESTBED_PeerReconfigureMessage {
236 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER
238 struct GNUNET_MessageHeader header;
241 * Unique ID for the peer.
243 uint32_t peer_id GNUNET_PACKED;
246 * Operation ID that is used to identify this operation.
248 uint64_t operation_id GNUNET_PACKED;
251 * The length of the serialized configuration when uncompressed
253 uint16_t config_size GNUNET_PACKED;
255 /* followed by serialized peer configuration;
256 * gzip'ed configuration file in INI format */
261 * Message sent from client to testing service to
264 struct GNUNET_TESTBED_PeerStartMessage {
266 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_START_PEER
268 struct GNUNET_MessageHeader header;
271 * Unique ID for the peer.
273 uint32_t peer_id GNUNET_PACKED;
276 * Operation ID that is used to identify this operation.
278 uint64_t operation_id GNUNET_PACKED;
283 * Message sent from client to testing service to
286 struct GNUNET_TESTBED_PeerStopMessage {
288 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER
290 struct GNUNET_MessageHeader header;
293 * Unique ID for the peer.
295 uint32_t peer_id GNUNET_PACKED;
298 * Operation ID that is used to identify this operation.
300 uint64_t operation_id GNUNET_PACKED;
305 * Message sent from client to testing service to
306 * destroy a (stopped) peer.
308 struct GNUNET_TESTBED_PeerDestroyMessage {
310 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER
312 struct GNUNET_MessageHeader header;
315 * Unique ID for the peer.
317 uint32_t peer_id GNUNET_PACKED;
320 * Operation ID that is used to identify this operation.
322 uint64_t operation_id GNUNET_PACKED;
327 * Message sent from client to testing service to
328 * (re)configure a "physical" link between two peers.
330 struct GNUNET_TESTBED_ConfigureUnderlayLinkMessage {
332 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CONFIGURE_UNDERLAY_LINK
334 struct GNUNET_MessageHeader header;
337 * 'enum GNUNET_TESTBED_ConnectOption' of the option to change
339 int32_t connect_option GNUNET_PACKED;
342 * Unique ID for the first peer.
344 uint32_t peer1 GNUNET_PACKED;
347 * Unique ID for the second peer.
349 uint32_t peer2 GNUNET_PACKED;
352 * Operation ID that is used to identify this operation.
354 uint64_t operation_id GNUNET_PACKED;
356 /* followed by option-dependent variable-size values */
361 * Message sent from client to testing service to
364 struct GNUNET_TESTBED_OverlayConnectMessage {
366 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT
368 struct GNUNET_MessageHeader header;
371 * Unique ID for the first peer.
373 uint32_t peer1 GNUNET_PACKED;
376 * Operation ID that is used to identify this operation.
378 uint64_t operation_id GNUNET_PACKED;
381 * Unique ID for the second peer.
383 uint32_t peer2 GNUNET_PACKED;
386 * The ID of the host which runs peer2
388 uint32_t peer2_host_id GNUNET_PACKED;
393 * Message sent from host controller of a peer(A) to the host controller of
394 * another peer(B) to request B to connect to A
396 struct GNUNET_TESTBED_RemoteOverlayConnectMessage {
398 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT
400 struct GNUNET_MessageHeader header;
405 uint32_t peer GNUNET_PACKED;
408 * The Operation ID that is used to identify this operation
410 uint64_t operation_id GNUNET_PACKED;
415 struct GNUNET_PeerIdentity peer_identity;
418 * To be followed by the HELLO message of A
420 struct GNUNET_MessageHeader hello[0];
421 // FIXME: we usually do not use this gcc-hack as some
422 // compilers / tools really get messed up by it...
427 * Event notification from a controller to a client.
429 struct GNUNET_TESTBED_PeerEventMessage {
431 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT
433 struct GNUNET_MessageHeader header;
436 * `enum GNUNET_TESTBED_EventType` (in NBO);
437 * either #GNUNET_TESTBED_ET_PEER_START or #GNUNET_TESTBED_ET_PEER_STOP.
439 int32_t event_type GNUNET_PACKED;
442 * Host where the peer is running.
444 uint32_t host_id GNUNET_PACKED;
447 * Peer that was started or stopped.
449 uint32_t peer_id GNUNET_PACKED;
452 * Operation ID that is used to identify this operation.
454 uint64_t operation_id GNUNET_PACKED;
459 * Event notification from a controller to a client.
461 struct GNUNET_TESTBED_ConnectionEventMessage {
463 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT
465 struct GNUNET_MessageHeader header;
468 * 'enum GNUNET_TESTBED_EventType' (in NBO);
469 * either #GNUNET_TESTBED_ET_CONNECT or #GNUNET_TESTBED_ET_DISCONNECT.
471 int32_t event_type GNUNET_PACKED;
476 uint32_t peer1 GNUNET_PACKED;
481 uint32_t peer2 GNUNET_PACKED;
484 * Operation ID that is used to identify this operation.
486 uint64_t operation_id GNUNET_PACKED;
491 * Event notification from a controller to a client.
493 struct GNUNET_TESTBED_OperationFailureEventMessage {
495 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT
497 struct GNUNET_MessageHeader header;
500 * 'enum GNUNET_TESTBED_EventType' (in NBO);
501 * #GNUNET_TESTBED_ET_OPERATION_FINISHED.
503 int32_t event_type GNUNET_PACKED;
506 * Operation ID of the operation that created this event.
508 uint64_t operation_id GNUNET_PACKED;
510 /* followed by 0-terminated error message */
515 * Event notification from a controller to a client.
517 struct GNUNET_TESTBED_PeerCreateSuccessEventMessage {
519 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS
521 struct GNUNET_MessageHeader header;
524 * Peer identity of the peer that was created.
526 uint32_t peer_id GNUNET_PACKED;
529 * Operation ID of the operation that created this event.
531 uint64_t operation_id GNUNET_PACKED;
536 * Event notification from a controller to a client for
537 * a generic operational success where the operation does
538 * not return any data.
540 struct GNUNET_TESTBED_GenericOperationSuccessEventMessage {
542 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS
544 struct GNUNET_MessageHeader header;
547 * 'enum GNUNET_TESTBED_EventType' (in NBO);
548 * #GNUNET_TESTBED_ET_OPERATION_FINISHED.
550 int32_t event_type GNUNET_PACKED;
553 * Operation ID of the operation that created this event.
555 uint64_t operation_id GNUNET_PACKED;
560 * Message sent from client to testing service to
561 * obtain the configuration of a peer.
563 struct GNUNET_TESTBED_PeerGetConfigurationMessage {
565 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION
567 struct GNUNET_MessageHeader header;
570 * Unique ID for the peer.
572 uint32_t peer_id GNUNET_PACKED;
575 * Operation ID that is used to identify this operation.
577 uint64_t operation_id GNUNET_PACKED;
582 * Peer configuration and identity reply from controller to a client.
584 struct GNUNET_TESTBED_PeerConfigurationInformationMessage {
586 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION
588 struct GNUNET_MessageHeader header;
591 * The id of the peer relevant to this information
593 uint32_t peer_id GNUNET_PACKED;
596 * Operation ID of the operation that created this event.
598 uint64_t operation_id GNUNET_PACKED;
601 * Identity of the peer.
603 struct GNUNET_PeerIdentity peer_identity;
606 * The size of configuration when uncompressed
608 uint16_t config_size GNUNET_PACKED;
610 /* followed by gzip-compressed configuration of the peer */
615 * Message to request configuration of a slave controller
617 struct GNUNET_TESTBED_SlaveGetConfigurationMessage {
619 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
621 struct GNUNET_MessageHeader header;
624 * The id of the slave host
626 uint32_t slave_id GNUNET_PACKED;
631 uint64_t operation_id GNUNET_PACKED;
636 * Reply to #GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message
638 struct GNUNET_TESTBED_SlaveConfiguration {
640 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
642 struct GNUNET_MessageHeader header;
645 * The id of the host where the slave is running
647 uint32_t slave_id GNUNET_PACKED;
652 uint64_t operation_id GNUNET_PACKED;
655 * The size of the configuration when uncompressed
657 uint16_t config_size GNUNET_PACKED;
659 /* followed by gzip-compressed configuration of the peer */
664 * Shutdown peers message
666 struct GNUNET_TESTBED_ShutdownPeersMessage {
668 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
670 struct GNUNET_MessageHeader header;
675 uint64_t operation_id GNUNET_PACKED;
680 * Message to start/stop services of a peer
682 struct GNUNET_TESTBED_ManagePeerServiceMessage {
684 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
686 struct GNUNET_MessageHeader header;
689 * Unique ID of the peer whose service has to be managed.
691 uint32_t peer_id GNUNET_PACKED;
696 uint64_t operation_id GNUNET_PACKED;
699 * set this to 1 to start the service; 0 to stop the service
704 * The NULL-terminated name of the service to start/stop follows here
710 * Message to send underlay link model of a peer. This message will be
711 * forwarded to the controller running the peer.
713 struct GNUNET_TESTBED_UnderlayLinkModelMsg {
715 * Type is #GNUNET_MESSAGE_TYPE_UNDERLAYLINKMODELMSG
717 struct GNUNET_MessageHeader header;
720 * The number of peer entries contained in this message
722 uint32_t nentries GNUNET_PACKED;
725 * The number of link properties contained in this message
727 uint32_t nprops GNUNET_PACKED;
730 * Array of ids of peers to be in the blacklist/whitelist. Each id is of type
731 * uint32_t. Number of ids should be equal to nentries.
735 * Array of link properties. Each link property is to be arraged in a
736 * sequence of four integers of type uint32_t: peer_id, latency, loss and
742 /**************************************/
743 /* Barriers IPC messages and protocol */
744 /**************************************/
748 * The environmental variable which when available refers to the configuration
749 * file the local testbed controller is using
751 #define ENV_TESTBED_CONFIG "GNUNET_TESTBED_CONTROLLER_CONFIG"
755 * Message to initialise a barrier
757 struct GNUNET_TESTBED_BarrierInit {
759 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT
761 struct GNUNET_MessageHeader header;
764 * The quorum percentage needed for crossing the barrier
769 * name of the barrier. Non NULL-terminated.
776 * Message to cancel a barrier
778 struct GNUNET_TESTBED_BarrierCancel {
780 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL
782 struct GNUNET_MessageHeader header;
785 * The barrier name. Non NULL terminated
792 * Message for signalling status changes of a barrier
794 struct GNUNET_TESTBED_BarrierStatusMsg {
796 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS
798 struct GNUNET_MessageHeader header;
801 * status. Use enumerated values of enum BarrierStatus
803 uint16_t status GNUNET_PACKED;
806 * strlen of the barrier name
808 uint16_t name_len GNUNET_PACKED;
811 * the barrier name (0-terminated) concatenated with an error message
812 * (0-terminated) if the status were to indicate an error
819 * Message sent from peers to the testbed-barrier service to indicate that they
820 * have reached a barrier and are waiting for it to be crossed
822 struct GNUNET_TESTBED_BarrierWait {
824 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT
826 struct GNUNET_MessageHeader header;
829 * The name of the barrier they have reached. Non-NULL terminated.
835 GNUNET_NETWORK_STRUCT_END
837 /* end of testbed.h */