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
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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, 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 * Client notifies controller that it should delegate
138 * requests for a particular client to a particular
141 struct GNUNET_TESTBED_ControllerLinkRequest
145 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS
147 struct GNUNET_MessageHeader header;
150 * For which host should requests be delegated? NBO.
152 uint32_t delegated_host_id GNUNET_PACKED;
155 * The id of the operation which created this message
157 uint64_t operation_id GNUNET_PACKED;
160 * Which host is responsible for managing the delegation? NBO
162 uint32_t slave_host_id GNUNET_PACKED;
165 * Set to 1 if the receiving controller is the master controller for
166 * the slave host (and thus responsible for starting it?). 0 if not
168 uint8_t is_subordinate;
174 * Response message for ControllerLinkRequest message
176 struct GNUNET_TESTBED_ControllerLinkResponse
180 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT
182 struct GNUNET_MessageHeader header;
185 * The size of the compressed configuration. Can be ZERO if the controller is
186 * not started (depends on the ControllerLinkRequest). NBO.
188 uint16_t config_size GNUNET_PACKED;
191 * Set to #GNUNET_YES to signify SUCCESS; #GNUNET_NO to signify failure
193 uint16_t success GNUNET_PACKED;
196 * The id of the operation which created this message. NBO
198 uint64_t operation_id GNUNET_PACKED;
200 /* If controller linking is successful and configuration is present, then here
201 * comes the serialized gzip configuration with which the controller is
202 * running at the delegate host */
204 /* In case of failure, here comes the error message (without \0 termination)*/
210 * Message sent from client to testing service to
211 * create (configure, but not start) a peer.
213 struct GNUNET_TESTBED_PeerCreateMessage
217 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER
219 struct GNUNET_MessageHeader header;
222 * On which host should the peer be started?
224 uint32_t host_id GNUNET_PACKED;
227 * Unique operation id
229 uint64_t operation_id GNUNET_PACKED;
232 * Unique ID for the peer.
234 uint32_t peer_id GNUNET_PACKED;
237 * Size of the uncompressed configuration
239 uint16_t config_size GNUNET_PACKED;
241 /* followed by serialized peer configuration;
242 * gzip'ed configuration file in INI format */
248 * Message sent from client to testing service to
249 * reconfigure a (stopped) a peer.
251 struct GNUNET_TESTBED_PeerReconfigureMessage
255 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_RECONFIGURE_PEER
257 struct GNUNET_MessageHeader header;
260 * Unique ID for the peer.
262 uint32_t peer_id GNUNET_PACKED;
265 * Operation ID that is used to identify this operation.
267 uint64_t operation_id GNUNET_PACKED;
270 * The length of the serialized configuration when uncompressed
272 uint16_t config_size GNUNET_PACKED;
274 /* followed by serialized peer configuration;
275 * gzip'ed configuration file in INI format */
281 * Message sent from client to testing service to
284 struct GNUNET_TESTBED_PeerStartMessage
288 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_START_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;
306 * Message sent from client to testing service to
309 struct GNUNET_TESTBED_PeerStopMessage
313 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_STOP_PEER
315 struct GNUNET_MessageHeader header;
318 * Unique ID for the peer.
320 uint32_t peer_id GNUNET_PACKED;
323 * Operation ID that is used to identify this operation.
325 uint64_t operation_id GNUNET_PACKED;
331 * Message sent from client to testing service to
332 * destroy a (stopped) peer.
334 struct GNUNET_TESTBED_PeerDestroyMessage
338 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_DESTROY_PEER
340 struct GNUNET_MessageHeader header;
343 * Unique ID for the peer.
345 uint32_t peer_id GNUNET_PACKED;
348 * Operation ID that is used to identify this operation.
350 uint64_t operation_id GNUNET_PACKED;
356 * Message sent from client to testing service to
357 * (re)configure a "physical" link between two peers.
359 struct GNUNET_TESTBED_ConfigureUnderlayLinkMessage
363 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CONFIGURE_UNDERLAY_LINK
365 struct GNUNET_MessageHeader header;
368 * 'enum GNUNET_TESTBED_ConnectOption' of the option to change
370 int32_t connect_option GNUNET_PACKED;
373 * Unique ID for the first peer.
375 uint32_t peer1 GNUNET_PACKED;
378 * Unique ID for the second peer.
380 uint32_t peer2 GNUNET_PACKED;
383 * Operation ID that is used to identify this operation.
385 uint64_t operation_id GNUNET_PACKED;
387 /* followed by option-dependent variable-size values */
393 * Message sent from client to testing service to
396 struct GNUNET_TESTBED_OverlayConnectMessage
400 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_OVERLAY_CONNECT
402 struct GNUNET_MessageHeader header;
405 * Unique ID for the first peer.
407 uint32_t peer1 GNUNET_PACKED;
410 * Operation ID that is used to identify this operation.
412 uint64_t operation_id GNUNET_PACKED;
415 * Unique ID for the second peer.
417 uint32_t peer2 GNUNET_PACKED;
420 * The ID of the host which runs peer2
422 uint32_t peer2_host_id GNUNET_PACKED;
428 * Message sent from host controller of a peer(A) to the host controller of
429 * another peer(B) to request B to connect to A
431 struct GNUNET_TESTBED_RemoteOverlayConnectMessage
434 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_REMOTE_OVERLAY_CONNECT
436 struct GNUNET_MessageHeader header;
441 uint32_t peer GNUNET_PACKED;
444 * The Operation ID that is used to identify this operation
446 uint64_t operation_id GNUNET_PACKED;
451 struct GNUNET_PeerIdentity peer_identity;
454 * To be followed by the HELLO message of A
456 struct GNUNET_MessageHeader hello[0];
457 // FIXME: we usually do not use this gcc-hack as some
458 // compilers / tools really get messed up by it...
464 * Event notification from a controller to a client.
466 struct GNUNET_TESTBED_PeerEventMessage
470 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT
472 struct GNUNET_MessageHeader header;
475 * `enum GNUNET_TESTBED_EventType` (in NBO);
476 * either #GNUNET_TESTBED_ET_PEER_START or #GNUNET_TESTBED_ET_PEER_STOP.
478 int32_t event_type GNUNET_PACKED;
481 * Host where the peer is running.
483 uint32_t host_id GNUNET_PACKED;
486 * Peer that was started or stopped.
488 uint32_t peer_id GNUNET_PACKED;
491 * Operation ID that is used to identify this operation.
493 uint64_t operation_id GNUNET_PACKED;
499 * Event notification from a controller to a client.
501 struct GNUNET_TESTBED_ConnectionEventMessage
505 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT
507 struct GNUNET_MessageHeader header;
510 * 'enum GNUNET_TESTBED_EventType' (in NBO);
511 * either #GNUNET_TESTBED_ET_CONNECT or #GNUNET_TESTBED_ET_DISCONNECT.
513 int32_t event_type GNUNET_PACKED;
518 uint32_t peer1 GNUNET_PACKED;
523 uint32_t peer2 GNUNET_PACKED;
526 * Operation ID that is used to identify this operation.
528 uint64_t operation_id GNUNET_PACKED;
534 * Event notification from a controller to a client.
536 struct GNUNET_TESTBED_OperationFailureEventMessage
540 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT
542 struct GNUNET_MessageHeader header;
545 * 'enum GNUNET_TESTBED_EventType' (in NBO);
546 * #GNUNET_TESTBED_ET_OPERATION_FINISHED.
548 int32_t event_type GNUNET_PACKED;
551 * Operation ID of the operation that created this event.
553 uint64_t operation_id GNUNET_PACKED;
555 /* followed by 0-terminated error message */
561 * Event notification from a controller to a client.
563 struct GNUNET_TESTBED_PeerCreateSuccessEventMessage
567 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS
569 struct GNUNET_MessageHeader header;
572 * Peer identity of the peer that was created.
574 uint32_t peer_id GNUNET_PACKED;
577 * Operation ID of the operation that created this event.
579 uint64_t operation_id GNUNET_PACKED;
585 * Event notification from a controller to a client for
586 * a generic operational success where the operation does
587 * not return any data.
589 struct GNUNET_TESTBED_GenericOperationSuccessEventMessage
593 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GENERIC_OPERATION_SUCCESS
595 struct GNUNET_MessageHeader header;
598 * 'enum GNUNET_TESTBED_EventType' (in NBO);
599 * #GNUNET_TESTBED_ET_OPERATION_FINISHED.
601 int32_t event_type GNUNET_PACKED;
604 * Operation ID of the operation that created this event.
606 uint64_t operation_id GNUNET_PACKED;
612 * Message sent from client to testing service to
613 * obtain the configuration of a peer.
615 struct GNUNET_TESTBED_PeerGetConfigurationMessage
619 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GET_PEER_INFORMATION
621 struct GNUNET_MessageHeader header;
624 * Unique ID for the peer.
626 uint32_t peer_id GNUNET_PACKED;
629 * Operation ID that is used to identify this operation.
631 uint64_t operation_id GNUNET_PACKED;
637 * Peer configuration and identity reply from controller to a client.
639 struct GNUNET_TESTBED_PeerConfigurationInformationMessage
643 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION
645 struct GNUNET_MessageHeader header;
648 * The id of the peer relevant to this information
650 uint32_t peer_id GNUNET_PACKED;
653 * Operation ID of the operation that created this event.
655 uint64_t operation_id GNUNET_PACKED;
658 * Identity of the peer.
660 struct GNUNET_PeerIdentity peer_identity;
663 * The size of configuration when uncompressed
665 uint16_t config_size GNUNET_PACKED;
667 /* followed by gzip-compressed configuration of the peer */
673 * Message to request configuration of a slave controller
675 struct GNUNET_TESTBED_SlaveGetConfigurationMessage
678 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION
680 struct GNUNET_MessageHeader header;
683 * The id of the slave host
685 uint32_t slave_id GNUNET_PACKED;
690 uint64_t operation_id GNUNET_PACKED;
696 * Reply to #GNUNET_MESSAGE_TYPE_TESTBED_GET_SLAVE_CONFIGURATION message
698 struct GNUNET_TESTBED_SlaveConfiguration
701 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION
703 struct GNUNET_MessageHeader header;
706 * The id of the host where the slave is running
708 uint32_t slave_id GNUNET_PACKED;
713 uint64_t operation_id GNUNET_PACKED;
716 * The size of the configuration when uncompressed
718 uint16_t config_size GNUNET_PACKED;
720 /* followed by gzip-compressed configuration of the peer */
726 * Shutdown peers message
728 struct GNUNET_TESTBED_ShutdownPeersMessage
731 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
733 struct GNUNET_MessageHeader header;
738 uint64_t operation_id GNUNET_PACKED;
743 * Message to start/stop services of a peer
745 struct GNUNET_TESTBED_ManagePeerServiceMessage
748 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_SHUTDOWN_PEERS
750 struct GNUNET_MessageHeader header;
753 * Unique ID of the peer whose service has to be managed.
755 uint32_t peer_id GNUNET_PACKED;
760 uint64_t operation_id GNUNET_PACKED;
763 * set this to 1 to start the service; 0 to stop the service
768 * The NULL-terminated name of the service to start/stop follows here
774 * Message to send underlay link model of a peer. This message will be
775 * forwarded to the controller running the peer.
777 struct GNUNET_TESTBED_UnderlayLinkModelMsg
780 * Type is #GNUNET_MESSAGE_TYPE_UNDERLAYLINKMODELMSG
782 struct GNUNET_MessageHeader header;
785 * The number of peer entries contained in this message
787 uint32_t nentries GNUNET_PACKED;
790 * The number of link properties contained in this message
792 uint32_t nprops GNUNET_PACKED;
795 * Array of ids of peers to be in the blacklist/whitelist. Each id is of type
796 * uint32_t. Number of ids should be equal to nentries.
800 * Array of link properties. Each link property is to be arraged in a
801 * sequence of four integers of type uint32_t: peer_id, latency, loss and
808 /**************************************/
809 /* Barriers IPC messages and protocol */
810 /**************************************/
814 * The environmental variable which when available refers to the configuration
815 * file the local testbed controller is using
817 #define ENV_TESTBED_CONFIG "GNUNET_TESTBED_CONTROLLER_CONFIG"
821 * Message to initialise a barrier
823 struct GNUNET_TESTBED_BarrierInit
826 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT
828 struct GNUNET_MessageHeader header;
831 * The quorum percentage needed for crossing the barrier
836 * name of the barrier. Non NULL-terminated.
843 * Message to cancel a barrier
845 struct GNUNET_TESTBED_BarrierCancel
848 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL
850 struct GNUNET_MessageHeader header;
853 * The barrier name. Non NULL terminated
860 * Message for signalling status changes of a barrier
862 struct GNUNET_TESTBED_BarrierStatusMsg
865 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS
867 struct GNUNET_MessageHeader header;
870 * status. Use enumerated values of enum BarrierStatus
872 uint16_t status GNUNET_PACKED;
875 * strlen of the barrier name
877 uint16_t name_len GNUNET_PACKED;
880 * the barrier name (0-terminated) concatenated with an error message
881 * (0-terminated) if the status were to indicate an error
888 * Message sent from peers to the testbed-barrier service to indicate that they
889 * have reached a barrier and are waiting for it to be crossed
891 struct GNUNET_TESTBED_BarrierWait
894 * Type is #GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT
896 struct GNUNET_MessageHeader header;
899 * The name of the barrier they have reached. Non-NULL terminated.
905 GNUNET_NETWORK_STRUCT_END
907 /* end of testbed.h */