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/>.
20 * @file testbed/testbed.h
21 * @brief IPC messages between testing API and service ("controller")
22 * @author Christian Grothoff
28 #include "gnunet_util_lib.h"
30 GNUNET_NETWORK_STRUCT_BEGIN
32 * Initial message from a client to a testing control service.
34 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
67 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST
69 struct GNUNET_MessageHeader header;
72 * Unique ID for the host (in NBO).
74 uint32_t host_id GNUNET_PACKED;
77 * SSH port to use, 0 for default (in NBO).
79 uint16_t ssh_port GNUNET_PACKED;
82 * Number of bytes in the user name that follows;
83 * 0 to use no user name; otherwise 'strlen (username)',
84 * excluding 0-termination!
86 uint16_t username_length GNUNET_PACKED;
89 * Number of bytes in the host name (excluding 0-termination) that follows the
90 * user name; cannot be 0
92 uint16_t hostname_length GNUNET_PACKED;
95 * The length of the uncompressed configuration
97 uint16_t config_size GNUNET_PACKED;
99 /* followed by non 0-terminated user name */
101 /* followed by non 0-terminated host name */
103 /* followed by gzip compressed configuration to start or connect to a
104 controller on this host. While starting the controller this configration
105 is used as a template */
111 * Confirmation from the service that adding a host
112 * worked (or failed).
113 * FIXME: Where is this required?
115 struct GNUNET_TESTBED_HostConfirmedMessage
119 * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS
121 struct GNUNET_MessageHeader header;
124 * Unique ID for the host (in NBO).
126 uint32_t host_id GNUNET_PACKED;
128 /* followed by the 0-terminated error message (on failure)
129 * (typical errors include host-id already in use) */
135 * Client notifies controller that it should delegate
136 * requests for a particular client to a particular
139 struct GNUNET_TESTBED_ControllerLinkRequest
143 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS
145 struct GNUNET_MessageHeader header;
148 * For which host should requests be delegated? NBO.
150 uint32_t delegated_host_id GNUNET_PACKED;
153 * The id of the operation which created this message
155 uint64_t operation_id GNUNET_PACKED;
158 * Which host is responsible for managing the delegation? NBO
160 uint32_t slave_host_id GNUNET_PACKED;
163 * Set to 1 if the receiving controller is the master controller for
164 * the slave host (and thus responsible for starting it?). 0 if not
166 uint8_t is_subordinate;
172 * Response message for ControllerLinkRequest message
174 struct GNUNET_TESTBED_ControllerLinkResponse
178 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
180 struct GNUNET_MessageHeader header;
183 * The size of the compressed configuration. Can be ZERO if the controller is
184 * not started (depends on the ControllerLinkRequest). NBO.
186 uint16_t config_size GNUNET_PACKED;
189 * Set to #GNUNET_YES to signify SUCCESS; #GNUNET_NO to signify failure
191 uint16_t success GNUNET_PACKED;
194 * The id of the operation which created this message. NBO
196 uint64_t operation_id GNUNET_PACKED;
198 /* If controller linking is successful and configuration is present, then here
199 * comes the serialized gzip configuration with which the controller is
200 * running at the delegate host */
202 /* In case of failure, here comes the error message (without \0 termination)*/
208 * Message sent from client to testing service to
209 * create (configure, but not start) a peer.
211 struct GNUNET_TESTBED_PeerCreateMessage
215 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
217 struct GNUNET_MessageHeader header;
220 * On which host should the peer be started?
222 uint32_t host_id GNUNET_PACKED;
225 * Unique operation id
227 uint64_t operation_id GNUNET_PACKED;
230 * Unique ID for the peer.
232 uint32_t peer_id GNUNET_PACKED;
235 * Size of the uncompressed configuration
237 uint16_t config_size GNUNET_PACKED;
239 /* followed by serialized peer configuration;
240 * gzip'ed configuration file in INI format */
246 * Message sent from client to testing service to
247 * reconfigure a (stopped) a peer.
249 struct GNUNET_TESTBED_PeerReconfigureMessage
253 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER
255 struct GNUNET_MessageHeader header;
258 * Unique ID for the peer.
260 uint32_t peer_id GNUNET_PACKED;
263 * Operation ID that is used to identify this operation.
265 uint64_t operation_id GNUNET_PACKED;
268 * The length of the serialized configuration when uncompressed
270 uint16_t config_size GNUNET_PACKED;
272 /* followed by serialized peer configuration;
273 * gzip'ed configuration file in INI format */
279 * Message sent from client to testing service to
282 struct GNUNET_TESTBED_PeerStartMessage
286 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_START_PEER
288 struct GNUNET_MessageHeader header;
291 * Unique ID for the peer.
293 uint32_t peer_id GNUNET_PACKED;
296 * Operation ID that is used to identify this operation.
298 uint64_t operation_id GNUNET_PACKED;
304 * Message sent from client to testing service to
307 struct GNUNET_TESTBED_PeerStopMessage
311 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER
313 struct GNUNET_MessageHeader header;
316 * Unique ID for the peer.
318 uint32_t peer_id GNUNET_PACKED;
321 * Operation ID that is used to identify this operation.
323 uint64_t operation_id GNUNET_PACKED;
329 * Message sent from client to testing service to
330 * destroy a (stopped) peer.
332 struct GNUNET_TESTBED_PeerDestroyMessage
336 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER
338 struct GNUNET_MessageHeader header;
341 * Unique ID for the peer.
343 uint32_t peer_id GNUNET_PACKED;
346 * Operation ID that is used to identify this operation.
348 uint64_t operation_id GNUNET_PACKED;
354 * Message sent from client to testing service to
355 * (re)configure a "physical" link between two peers.
357 struct GNUNET_TESTBED_ConfigureUnderlayLinkMessage
361 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CONFIGURE_UNDERLAY_LINK
363 struct GNUNET_MessageHeader header;
366 * 'enum GNUNET_TESTBED_ConnectOption' of the option to change
368 int32_t connect_option GNUNET_PACKED;
371 * Unique ID for the first peer.
373 uint32_t peer1 GNUNET_PACKED;
376 * Unique ID for the second peer.
378 uint32_t peer2 GNUNET_PACKED;
381 * Operation ID that is used to identify this operation.
383 uint64_t operation_id GNUNET_PACKED;
385 /* followed by option-dependent variable-size values */
391 * Message sent from client to testing service to
394 struct GNUNET_TESTBED_OverlayConnectMessage
398 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT
400 struct GNUNET_MessageHeader header;
403 * Unique ID for the first peer.
405 uint32_t peer1 GNUNET_PACKED;
408 * Operation ID that is used to identify this operation.
410 uint64_t operation_id GNUNET_PACKED;
413 * Unique ID for the second peer.
415 uint32_t peer2 GNUNET_PACKED;
418 * The ID of the host which runs peer2
420 uint32_t peer2_host_id GNUNET_PACKED;
426 * Message sent from host controller of a peer(A) to the host controller of
427 * another peer(B) to request B to connect to A
429 struct GNUNET_TESTBED_RemoteOverlayConnectMessage
432 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT
434 struct GNUNET_MessageHeader header;
439 uint32_t peer GNUNET_PACKED;
442 * The Operation ID that is used to identify this operation
444 uint64_t operation_id GNUNET_PACKED;
449 struct GNUNET_PeerIdentity peer_identity;
452 * To be followed by the HELLO message of A
454 struct GNUNET_MessageHeader hello[0];
455 // FIXME: we usually do not use this gcc-hack as some
456 // compilers / tools really get messed up by it...
462 * Event notification from a controller to a client.
464 struct GNUNET_TESTBED_PeerEventMessage
468 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT
470 struct GNUNET_MessageHeader header;
473 * `enum GNUNET_TESTBED_EventType` (in NBO);
474 * either #GNUNET_TESTBED_ET_PEER_START or #GNUNET_TESTBED_ET_PEER_STOP.
476 int32_t event_type GNUNET_PACKED;
479 * Host where the peer is running.
481 uint32_t host_id GNUNET_PACKED;
484 * Peer that was started or stopped.
486 uint32_t peer_id GNUNET_PACKED;
489 * Operation ID that is used to identify this operation.
491 uint64_t operation_id GNUNET_PACKED;
497 * Event notification from a controller to a client.
499 struct GNUNET_TESTBED_ConnectionEventMessage
503 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT
505 struct GNUNET_MessageHeader header;
508 * 'enum GNUNET_TESTBED_EventType' (in NBO);
509 * either #GNUNET_TESTBED_ET_CONNECT or #GNUNET_TESTBED_ET_DISCONNECT.
511 int32_t event_type GNUNET_PACKED;
516 uint32_t peer1 GNUNET_PACKED;
521 uint32_t peer2 GNUNET_PACKED;
524 * Operation ID that is used to identify this operation.
526 uint64_t operation_id GNUNET_PACKED;
532 * Event notification from a controller to a client.
534 struct GNUNET_TESTBED_OperationFailureEventMessage
538 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT
540 struct GNUNET_MessageHeader header;
543 * 'enum GNUNET_TESTBED_EventType' (in NBO);
544 * #GNUNET_TESTBED_ET_OPERATION_FINISHED.
546 int32_t event_type GNUNET_PACKED;
549 * Operation ID of the operation that created this event.
551 uint64_t operation_id GNUNET_PACKED;
553 /* followed by 0-terminated error message */
559 * Event notification from a controller to a client.
561 struct GNUNET_TESTBED_PeerCreateSuccessEventMessage
565 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS
567 struct GNUNET_MessageHeader header;
570 * Peer identity of the peer that was created.
572 uint32_t peer_id GNUNET_PACKED;
575 * Operation ID of the operation that created this event.
577 uint64_t operation_id GNUNET_PACKED;
583 * Event notification from a controller to a client for
584 * a generic operational success where the operation does
585 * not return any data.
587 struct GNUNET_TESTBED_GenericOperationSuccessEventMessage
591 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS
593 struct GNUNET_MessageHeader header;
596 * 'enum GNUNET_TESTBED_EventType' (in NBO);
597 * #GNUNET_TESTBED_ET_OPERATION_FINISHED.
599 int32_t event_type GNUNET_PACKED;
602 * Operation ID of the operation that created this event.
604 uint64_t operation_id GNUNET_PACKED;
610 * Message sent from client to testing service to
611 * obtain the configuration of a peer.
613 struct GNUNET_TESTBED_PeerGetConfigurationMessage
617 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION
619 struct GNUNET_MessageHeader header;
622 * Unique ID for the peer.
624 uint32_t peer_id GNUNET_PACKED;
627 * Operation ID that is used to identify this operation.
629 uint64_t operation_id GNUNET_PACKED;
635 * Peer configuration and identity reply from controller to a client.
637 struct GNUNET_TESTBED_PeerConfigurationInformationMessage
641 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION
643 struct GNUNET_MessageHeader header;
646 * The id of the peer relevant to this information
648 uint32_t peer_id GNUNET_PACKED;
651 * Operation ID of the operation that created this event.
653 uint64_t operation_id GNUNET_PACKED;
656 * Identity of the peer.
658 struct GNUNET_PeerIdentity peer_identity;
661 * The size of configuration when uncompressed
663 uint16_t config_size GNUNET_PACKED;
665 /* followed by gzip-compressed configuration of the peer */
671 * Message to request configuration of a slave controller
673 struct GNUNET_TESTBED_SlaveGetConfigurationMessage
676 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
678 struct GNUNET_MessageHeader header;
681 * The id of the slave host
683 uint32_t slave_id GNUNET_PACKED;
688 uint64_t operation_id GNUNET_PACKED;
694 * Reply to #GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message
696 struct GNUNET_TESTBED_SlaveConfiguration
699 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
701 struct GNUNET_MessageHeader header;
704 * The id of the host where the slave is running
706 uint32_t slave_id GNUNET_PACKED;
711 uint64_t operation_id GNUNET_PACKED;
714 * The size of the configuration when uncompressed
716 uint16_t config_size GNUNET_PACKED;
718 /* followed by gzip-compressed configuration of the peer */
724 * Shutdown peers message
726 struct GNUNET_TESTBED_ShutdownPeersMessage
729 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
731 struct GNUNET_MessageHeader header;
736 uint64_t operation_id GNUNET_PACKED;
741 * Message to start/stop services of a peer
743 struct GNUNET_TESTBED_ManagePeerServiceMessage
746 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
748 struct GNUNET_MessageHeader header;
751 * Unique ID of the peer whose service has to be managed.
753 uint32_t peer_id GNUNET_PACKED;
758 uint64_t operation_id GNUNET_PACKED;
761 * set this to 1 to start the service; 0 to stop the service
766 * The NULL-terminated name of the service to start/stop follows here
772 * Message to send underlay link model of a peer. This message will be
773 * forwarded to the controller running the peer.
775 struct GNUNET_TESTBED_UnderlayLinkModelMsg
778 * Type is #GNUNET_MESSAGE_TYPE_UNDERLAYLINKMODELMSG
780 struct GNUNET_MessageHeader header;
783 * The number of peer entries contained in this message
785 uint32_t nentries GNUNET_PACKED;
788 * The number of link properties contained in this message
790 uint32_t nprops GNUNET_PACKED;
793 * Array of ids of peers to be in the blacklist/whitelist. Each id is of type
794 * uint32_t. Number of ids should be equal to nentries.
798 * Array of link properties. Each link property is to be arraged in a
799 * sequence of four integers of type uint32_t: peer_id, latency, loss and
806 /**************************************/
807 /* Barriers IPC messages and protocol */
808 /**************************************/
812 * The environmental variable which when available refers to the configuration
813 * file the local testbed controller is using
815 #define ENV_TESTBED_CONFIG "GNUNET_TESTBED_CONTROLLER_CONFIG"
819 * Message to initialise a barrier
821 struct GNUNET_TESTBED_BarrierInit
824 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT
826 struct GNUNET_MessageHeader header;
829 * The quorum percentage needed for crossing the barrier
834 * name of the barrier. Non NULL-terminated.
841 * Message to cancel a barrier
843 struct GNUNET_TESTBED_BarrierCancel
846 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL
848 struct GNUNET_MessageHeader header;
851 * The barrier name. Non NULL terminated
858 * Message for signalling status changes of a barrier
860 struct GNUNET_TESTBED_BarrierStatusMsg
863 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS
865 struct GNUNET_MessageHeader header;
868 * status. Use enumerated values of enum BarrierStatus
870 uint16_t status GNUNET_PACKED;
873 * strlen of the barrier name
875 uint16_t name_len GNUNET_PACKED;
878 * the barrier name (0-terminated) concatenated with an error message
879 * (0-terminated) if the status were to indicate an error
886 * Message sent from peers to the testbed-barrier service to indicate that they
887 * have reached a barrier and are waiting for it to be crossed
889 struct GNUNET_TESTBED_BarrierWait
892 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT
894 struct GNUNET_MessageHeader header;
897 * The name of the barrier they have reached. Non-NULL terminated.
903 GNUNET_NETWORK_STRUCT_END
905 /* end of testbed.h */