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 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.
17 * @file testbed/testbed.h
18 * @brief IPC messages between testing API and service ("controller")
19 * @author Christian Grothoff
25 #include "gnunet_util_lib.h"
27 GNUNET_NETWORK_STRUCT_BEGIN
29 * Initial message from a client to a testing control service.
31 struct GNUNET_TESTBED_InitMessage
35 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_INIT
37 struct GNUNET_MessageHeader header;
40 * Host ID that the controller is either given (if this is the
41 * dominating client) or assumed to have (for peer-connections
42 * between controllers). A controller must check that all
43 * connections make consistent claims...
45 uint32_t host_id GNUNET_PACKED;
48 * Event mask that specifies which events this client
49 * is interested in. In NBO.
51 uint64_t event_mask GNUNET_PACKED;
53 /* Followed by 0-terminated hostname of the controller */
58 * Notify the service about a host that we intend to use.
60 struct GNUNET_TESTBED_AddHostMessage
64 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST
66 struct GNUNET_MessageHeader header;
69 * Unique ID for the host (in NBO).
71 uint32_t host_id GNUNET_PACKED;
74 * SSH port to use, 0 for default (in NBO).
76 uint16_t ssh_port GNUNET_PACKED;
79 * Number of bytes in the user name that follows;
80 * 0 to use no user name; otherwise 'strlen (username)',
81 * excluding 0-termination!
83 uint16_t username_length GNUNET_PACKED;
86 * Number of bytes in the host name (excluding 0-termination) that follows the
87 * user name; cannot be 0
89 uint16_t hostname_length GNUNET_PACKED;
92 * The length of the uncompressed configuration
94 uint16_t config_size GNUNET_PACKED;
96 /* followed by non 0-terminated user name */
98 /* followed by non 0-terminated host name */
100 /* followed by gzip compressed configuration to start or connect to a
101 controller on this host. While starting the controller this configration
102 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
116 * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS
118 struct GNUNET_MessageHeader header;
121 * Unique ID for the host (in NBO).
123 uint32_t host_id GNUNET_PACKED;
125 /* followed by the 0-terminated error message (on failure)
126 * (typical errors include host-id already in use) */
132 * Client notifies controller that it should delegate
133 * requests for a particular client to a particular
136 struct GNUNET_TESTBED_ControllerLinkRequest
140 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS
142 struct GNUNET_MessageHeader header;
145 * For which host should requests be delegated? NBO.
147 uint32_t delegated_host_id GNUNET_PACKED;
150 * The id of the operation which created this message
152 uint64_t operation_id GNUNET_PACKED;
155 * Which host is responsible for managing the delegation? NBO
157 uint32_t slave_host_id GNUNET_PACKED;
160 * Set to 1 if the receiving controller is the master controller for
161 * the slave host (and thus responsible for starting it?). 0 if not
163 uint8_t is_subordinate;
169 * Response message for ControllerLinkRequest message
171 struct GNUNET_TESTBED_ControllerLinkResponse
175 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
177 struct GNUNET_MessageHeader header;
180 * The size of the compressed configuration. Can be ZERO if the controller is
181 * not started (depends on the ControllerLinkRequest). NBO.
183 uint16_t config_size GNUNET_PACKED;
186 * Set to #GNUNET_YES to signify SUCCESS; #GNUNET_NO to signify failure
188 uint16_t success GNUNET_PACKED;
191 * The id of the operation which created this message. NBO
193 uint64_t operation_id GNUNET_PACKED;
195 /* If controller linking is successful and configuration is present, then here
196 * comes the serialized gzip configuration with which the controller is
197 * running at the delegate host */
199 /* In case of failure, here comes the error message (without \0 termination)*/
205 * Message sent from client to testing service to
206 * create (configure, but not start) a peer.
208 struct GNUNET_TESTBED_PeerCreateMessage
212 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
214 struct GNUNET_MessageHeader header;
217 * On which host should the peer be started?
219 uint32_t host_id GNUNET_PACKED;
222 * Unique operation id
224 uint64_t operation_id GNUNET_PACKED;
227 * Unique ID for the peer.
229 uint32_t peer_id GNUNET_PACKED;
232 * Size of the uncompressed configuration
234 uint16_t config_size GNUNET_PACKED;
236 /* followed by serialized peer configuration;
237 * gzip'ed configuration file in INI format */
243 * Message sent from client to testing service to
244 * reconfigure a (stopped) a peer.
246 struct GNUNET_TESTBED_PeerReconfigureMessage
250 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER
252 struct GNUNET_MessageHeader header;
255 * Unique ID for the peer.
257 uint32_t peer_id GNUNET_PACKED;
260 * Operation ID that is used to identify this operation.
262 uint64_t operation_id GNUNET_PACKED;
265 * The length of the serialized configuration when uncompressed
267 uint16_t config_size GNUNET_PACKED;
269 /* followed by serialized peer configuration;
270 * gzip'ed configuration file in INI format */
276 * Message sent from client to testing service to
279 struct GNUNET_TESTBED_PeerStartMessage
283 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_START_PEER
285 struct GNUNET_MessageHeader header;
288 * Unique ID for the peer.
290 uint32_t peer_id GNUNET_PACKED;
293 * Operation ID that is used to identify this operation.
295 uint64_t operation_id GNUNET_PACKED;
301 * Message sent from client to testing service to
304 struct GNUNET_TESTBED_PeerStopMessage
308 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER
310 struct GNUNET_MessageHeader header;
313 * Unique ID for the peer.
315 uint32_t peer_id GNUNET_PACKED;
318 * Operation ID that is used to identify this operation.
320 uint64_t operation_id GNUNET_PACKED;
326 * Message sent from client to testing service to
327 * destroy a (stopped) peer.
329 struct GNUNET_TESTBED_PeerDestroyMessage
333 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER
335 struct GNUNET_MessageHeader header;
338 * Unique ID for the peer.
340 uint32_t peer_id GNUNET_PACKED;
343 * Operation ID that is used to identify this operation.
345 uint64_t operation_id GNUNET_PACKED;
351 * Message sent from client to testing service to
352 * (re)configure a "physical" link between two peers.
354 struct GNUNET_TESTBED_ConfigureUnderlayLinkMessage
358 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CONFIGURE_UNDERLAY_LINK
360 struct GNUNET_MessageHeader header;
363 * 'enum GNUNET_TESTBED_ConnectOption' of the option to change
365 int32_t connect_option GNUNET_PACKED;
368 * Unique ID for the first peer.
370 uint32_t peer1 GNUNET_PACKED;
373 * Unique ID for the second peer.
375 uint32_t peer2 GNUNET_PACKED;
378 * Operation ID that is used to identify this operation.
380 uint64_t operation_id GNUNET_PACKED;
382 /* followed by option-dependent variable-size values */
388 * Message sent from client to testing service to
391 struct GNUNET_TESTBED_OverlayConnectMessage
395 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT
397 struct GNUNET_MessageHeader header;
400 * Unique ID for the first peer.
402 uint32_t peer1 GNUNET_PACKED;
405 * Operation ID that is used to identify this operation.
407 uint64_t operation_id GNUNET_PACKED;
410 * Unique ID for the second peer.
412 uint32_t peer2 GNUNET_PACKED;
415 * The ID of the host which runs peer2
417 uint32_t peer2_host_id GNUNET_PACKED;
423 * Message sent from host controller of a peer(A) to the host controller of
424 * another peer(B) to request B to connect to A
426 struct GNUNET_TESTBED_RemoteOverlayConnectMessage
429 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT
431 struct GNUNET_MessageHeader header;
436 uint32_t peer GNUNET_PACKED;
439 * The Operation ID that is used to identify this operation
441 uint64_t operation_id GNUNET_PACKED;
446 struct GNUNET_PeerIdentity peer_identity;
449 * To be followed by the HELLO message of A
451 struct GNUNET_MessageHeader hello[0];
452 // FIXME: we usually do not use this gcc-hack as some
453 // compilers / tools really get messed up by it...
459 * Event notification from a controller to a client.
461 struct GNUNET_TESTBED_PeerEventMessage
465 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT
467 struct GNUNET_MessageHeader header;
470 * `enum GNUNET_TESTBED_EventType` (in NBO);
471 * either #GNUNET_TESTBED_ET_PEER_START or #GNUNET_TESTBED_ET_PEER_STOP.
473 int32_t event_type GNUNET_PACKED;
476 * Host where the peer is running.
478 uint32_t host_id GNUNET_PACKED;
481 * Peer that was started or stopped.
483 uint32_t peer_id GNUNET_PACKED;
486 * Operation ID that is used to identify this operation.
488 uint64_t operation_id GNUNET_PACKED;
494 * Event notification from a controller to a client.
496 struct GNUNET_TESTBED_ConnectionEventMessage
500 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT
502 struct GNUNET_MessageHeader header;
505 * 'enum GNUNET_TESTBED_EventType' (in NBO);
506 * either #GNUNET_TESTBED_ET_CONNECT or #GNUNET_TESTBED_ET_DISCONNECT.
508 int32_t event_type GNUNET_PACKED;
513 uint32_t peer1 GNUNET_PACKED;
518 uint32_t peer2 GNUNET_PACKED;
521 * Operation ID that is used to identify this operation.
523 uint64_t operation_id GNUNET_PACKED;
529 * Event notification from a controller to a client.
531 struct GNUNET_TESTBED_OperationFailureEventMessage
535 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT
537 struct GNUNET_MessageHeader header;
540 * 'enum GNUNET_TESTBED_EventType' (in NBO);
541 * #GNUNET_TESTBED_ET_OPERATION_FINISHED.
543 int32_t event_type GNUNET_PACKED;
546 * Operation ID of the operation that created this event.
548 uint64_t operation_id GNUNET_PACKED;
550 /* followed by 0-terminated error message */
556 * Event notification from a controller to a client.
558 struct GNUNET_TESTBED_PeerCreateSuccessEventMessage
562 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS
564 struct GNUNET_MessageHeader header;
567 * Peer identity of the peer that was created.
569 uint32_t peer_id GNUNET_PACKED;
572 * Operation ID of the operation that created this event.
574 uint64_t operation_id GNUNET_PACKED;
580 * Event notification from a controller to a client for
581 * a generic operational success where the operation does
582 * not return any data.
584 struct GNUNET_TESTBED_GenericOperationSuccessEventMessage
588 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS
590 struct GNUNET_MessageHeader header;
593 * 'enum GNUNET_TESTBED_EventType' (in NBO);
594 * #GNUNET_TESTBED_ET_OPERATION_FINISHED.
596 int32_t event_type GNUNET_PACKED;
599 * Operation ID of the operation that created this event.
601 uint64_t operation_id GNUNET_PACKED;
607 * Message sent from client to testing service to
608 * obtain the configuration of a peer.
610 struct GNUNET_TESTBED_PeerGetConfigurationMessage
614 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION
616 struct GNUNET_MessageHeader header;
619 * Unique ID for the peer.
621 uint32_t peer_id GNUNET_PACKED;
624 * Operation ID that is used to identify this operation.
626 uint64_t operation_id GNUNET_PACKED;
632 * Peer configuration and identity reply from controller to a client.
634 struct GNUNET_TESTBED_PeerConfigurationInformationMessage
638 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION
640 struct GNUNET_MessageHeader header;
643 * The id of the peer relevant to this information
645 uint32_t peer_id GNUNET_PACKED;
648 * Operation ID of the operation that created this event.
650 uint64_t operation_id GNUNET_PACKED;
653 * Identity of the peer.
655 struct GNUNET_PeerIdentity peer_identity;
658 * The size of configuration when uncompressed
660 uint16_t config_size GNUNET_PACKED;
662 /* followed by gzip-compressed configuration of the peer */
668 * Message to request configuration of a slave controller
670 struct GNUNET_TESTBED_SlaveGetConfigurationMessage
673 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
675 struct GNUNET_MessageHeader header;
678 * The id of the slave host
680 uint32_t slave_id GNUNET_PACKED;
685 uint64_t operation_id GNUNET_PACKED;
691 * Reply to #GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message
693 struct GNUNET_TESTBED_SlaveConfiguration
696 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
698 struct GNUNET_MessageHeader header;
701 * The id of the host where the slave is running
703 uint32_t slave_id GNUNET_PACKED;
708 uint64_t operation_id GNUNET_PACKED;
711 * The size of the configuration when uncompressed
713 uint16_t config_size GNUNET_PACKED;
715 /* followed by gzip-compressed configuration of the peer */
721 * Shutdown peers message
723 struct GNUNET_TESTBED_ShutdownPeersMessage
726 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
728 struct GNUNET_MessageHeader header;
733 uint64_t operation_id GNUNET_PACKED;
738 * Message to start/stop services of a peer
740 struct GNUNET_TESTBED_ManagePeerServiceMessage
743 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
745 struct GNUNET_MessageHeader header;
748 * Unique ID of the peer whose service has to be managed.
750 uint32_t peer_id GNUNET_PACKED;
755 uint64_t operation_id GNUNET_PACKED;
758 * set this to 1 to start the service; 0 to stop the service
763 * The NULL-terminated name of the service to start/stop follows here
769 * Message to send underlay link model of a peer. This message will be
770 * forwarded to the controller running the peer.
772 struct GNUNET_TESTBED_UnderlayLinkModelMsg
775 * Type is #GNUNET_MESSAGE_TYPE_UNDERLAYLINKMODELMSG
777 struct GNUNET_MessageHeader header;
780 * The number of peer entries contained in this message
782 uint32_t nentries GNUNET_PACKED;
785 * The number of link properties contained in this message
787 uint32_t nprops GNUNET_PACKED;
790 * Array of ids of peers to be in the blacklist/whitelist. Each id is of type
791 * uint32_t. Number of ids should be equal to nentries.
795 * Array of link properties. Each link property is to be arraged in a
796 * sequence of four integers of type uint32_t: peer_id, latency, loss and
803 /**************************************/
804 /* Barriers IPC messages and protocol */
805 /**************************************/
809 * The environmental variable which when available refers to the configuration
810 * file the local testbed controller is using
812 #define ENV_TESTBED_CONFIG "GNUNET_TESTBED_CONTROLLER_CONFIG"
816 * Message to initialise a barrier
818 struct GNUNET_TESTBED_BarrierInit
821 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT
823 struct GNUNET_MessageHeader header;
826 * The quorum percentage needed for crossing the barrier
831 * name of the barrier. Non NULL-terminated.
838 * Message to cancel a barrier
840 struct GNUNET_TESTBED_BarrierCancel
843 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL
845 struct GNUNET_MessageHeader header;
848 * The barrier name. Non NULL terminated
855 * Message for signalling status changes of a barrier
857 struct GNUNET_TESTBED_BarrierStatusMsg
860 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS
862 struct GNUNET_MessageHeader header;
865 * status. Use enumerated values of enum BarrierStatus
867 uint16_t status GNUNET_PACKED;
870 * strlen of the barrier name
872 uint16_t name_len GNUNET_PACKED;
875 * the barrier name (0-terminated) concatenated with an error message
876 * (0-terminated) if the status were to indicate an error
883 * Message sent from peers to the testbed-barrier service to indicate that they
884 * have reached a barrier and are waiting for it to be crossed
886 struct GNUNET_TESTBED_BarrierWait
889 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT
891 struct GNUNET_MessageHeader header;
894 * The name of the barrier they have reached. Non-NULL terminated.
900 GNUNET_NETWORK_STRUCT_END
902 /* end of testbed.h */