clique topology
[oweals/gnunet.git] / src / testbed / testbed.h
index 4e4e490f0abc8e8289abb7da27a1a29e54911837..9274846ca0a752b61e197456bff8daeaad649354 100644 (file)
  */
 
 /**
- * @file testing/new_testing.h
+ * @file testbed/testbed.h
  * @brief IPC messages between testing API and service ("controller")
  * @author Christian Grothoff
  */
 
-#ifndef NEW_TESTING_H
-#define NEW_TESTING_H
+#ifndef TESTBED_H
+#define TESTBED_H
 
 #include "gnunet_util_lib.h"
 
+GNUNET_NETWORK_STRUCT_BEGIN
 
 /**
  * Initial message from a client to a testing control service.
  */
-struct GNUNET_TESTBED_Message
+struct GNUNET_TESTBED_InitMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_INIT
    */
   struct GNUNET_MessageHeader header;
 
   /**
-   * Host ID that the controller is either given
-   * (if this is the dominating client communicating
-   * via stdin) or assumed to have (for peer-connections
-   * between controllers).
+   * Host ID that the controller is either given (if this is the
+   * dominating client) or assumed to have (for peer-connections
+   * between controllers).  A controller must check that all
+   * connections make consistent claims...
    */
   uint32_t host_id GNUNET_PACKED;
 
@@ -55,6 +56,7 @@ struct GNUNET_TESTBED_Message
    */
   uint64_t event_mask GNUNET_PACKED;
 
+  /* Followed by 0-terminated hostname of the controller */
 };
 
 
@@ -65,7 +67,7 @@ struct GNUNET_TESTBED_AddHostMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADDHOST
    */
   struct GNUNET_MessageHeader header;
 
@@ -96,12 +98,13 @@ struct GNUNET_TESTBED_AddHostMessage
 /**
  * Confirmation from the service that adding a host
  * worked (or failed).
+ * FIXME: Where is this required?
  */
 struct GNUNET_TESTBED_HostConfirmedMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRMED
    */
   struct GNUNET_MessageHeader header;
 
@@ -110,9 +113,8 @@ struct GNUNET_TESTBED_HostConfirmedMessage
    */
   uint32_t host_id GNUNET_PACKED;
 
-  /* followed by the 0-terminated error message (on failure) 
-   (typical errors include failure to login and 
-   host-id already in use) */
+  /* followed by the 0-terminated error message (on failure)
+   * (typical errors include host-id already in use) */
 
 };
 
@@ -125,7 +127,7 @@ struct GNUNET_TESTBED_ConfigureSharedServiceMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_SERVICESHARE
    */
   struct GNUNET_MessageHeader header;
 
@@ -154,7 +156,7 @@ struct GNUNET_TESTBED_ControllerLinkMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_LCONTROLLERS
    */
   struct GNUNET_MessageHeader header;
 
@@ -163,35 +165,50 @@ struct GNUNET_TESTBED_ControllerLinkMessage
    */
   uint32_t delegated_host_id GNUNET_PACKED;
 
+  /**
+   * The id of the operation which created this message
+   */
+  uint64_t operation_id GNUNET_PACKED;
+
   /**
    * Which host is responsible for managing the delegation? NBO
    */
   uint32_t slave_host_id GNUNET_PACKED;
 
   /**
-   * Is the receiving controller the master controller for
-   * the slave host (and thus responsible for starting it?). NBO.
+   * The size of the uncompressed configuration
    */
-  int32_t is_subordinate GNUNET_PACKED;
+  uint16_t config_size GNUNET_PACKED;
+
+  /**
+   * Set to 1 if the receiving controller is the master controller for
+   * the slave host (and thus responsible for starting it?). 0 if not
+   */
+  uint8_t is_subordinate;
 
   /* followed by serialized slave configuration;
-     gzip'ed configuration file in INI format */
+   * gzip'ed configuration file in INI format */
 
 };
 
 
 /**
- * Message sent from client to testing service to 
+ * Message sent from client to testing service to
  * create (configure, but not start) a peer.
  */
 struct GNUNET_TESTBED_PeerCreateMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_CREATEPEER
    */
   struct GNUNET_MessageHeader header;
 
+  /**
+   * Unique operation id
+   */
+  uint64_t operation_id GNUNET_PACKED;
+
   /**
    * On which host should the peer be started?
    */
@@ -202,21 +219,26 @@ struct GNUNET_TESTBED_PeerCreateMessage
    */
   uint32_t peer_id GNUNET_PACKED;
 
+  /**
+   * Size of the uncompressed configuration
+   */
+  uint32_t config_size GNUNET_PACKED;
+
   /* followed by serialized peer configuration;
-     gzip'ed configuration file in INI format */
-  
+   * gzip'ed configuration file in INI format */
+
 };
 
 
 /**
- * Message sent from client to testing service to 
+ * Message sent from client to testing service to
  * reconfigure a (stopped) a peer.
  */
 struct GNUNET_TESTBED_PeerReconfigureMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPDE_TESTBED_PEERRECONF
    */
   struct GNUNET_MessageHeader header;
 
@@ -231,8 +253,8 @@ struct GNUNET_TESTBED_PeerReconfigureMessage
   uint64_t operation_id GNUNET_PACKED;
 
   /* followed by serialized peer configuration;
-     gzip'ed configuration file in INI format */
-  
+   * gzip'ed configuration file in INI format */
+
 };
 
 
@@ -244,7 +266,7 @@ struct GNUNET_TESTBED_PeerStartMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_STARTPEER
    */
   struct GNUNET_MessageHeader header;
 
@@ -269,7 +291,7 @@ struct GNUNET_TESTBED_PeerStopMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_STOPPEER
    */
   struct GNUNET_MessageHeader header;
 
@@ -294,7 +316,7 @@ struct GNUNET_TESTBED_PeerDestroyMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER
    */
   struct GNUNET_MessageHeader header;
 
@@ -319,7 +341,7 @@ struct GNUNET_TESTBED_ConfigureUnderlayLinkMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_CONFIGULLINK
    */
   struct GNUNET_MessageHeader header;
 
@@ -356,7 +378,7 @@ struct GNUNET_TESTBED_OverlayConnectMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_OLCONNECT
    */
   struct GNUNET_MessageHeader header;
 
@@ -375,6 +397,45 @@ struct GNUNET_TESTBED_OverlayConnectMessage
    */
   uint32_t peer2 GNUNET_PACKED;
 
+  /**
+   * The ID of the host which runs peer2
+   */
+  uint32_t peer2_host_id GNUNET_PACKED;
+
+};
+
+
+/**
+ * Message sent from host controller of a peer(A) to the host controller of
+ * another peer(B) to request B to connect to A
+ */
+struct GNUNET_TESTBED_RequestConnectMessage
+{
+  /**
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_REQUESTCONNECT
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * The Unique ID of B
+   */
+  uint32_t peer GNUNET_PACKED;
+
+  /**
+   * The Operation ID that is used to identify this operation
+   */
+  uint64_t operation_id GNUNET_PACKED;
+
+  /**
+   * Identity of A
+   */
+  struct GNUNET_PeerIdentity peer_identity;
+  
+  /**
+   * To be followed by the HELLO message of A
+   */
+  struct GNUNET_MessageHeader hello[0];
+  
 };
 
 
@@ -385,7 +446,7 @@ struct GNUNET_TESTBED_PeerEventMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT
    */
   struct GNUNET_MessageHeader header;
 
@@ -394,7 +455,7 @@ struct GNUNET_TESTBED_PeerEventMessage
    * either GNUNET_TESTBED_ET_PEER_START or GNUNET_TESTBED_ET_PEER_STOP.
    */
   int32_t event_type GNUNET_PACKED;
-  
+
   /**
    * Host where the peer is running.
    */
@@ -420,16 +481,16 @@ struct GNUNET_TESTBED_ConnectionEventMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT
    */
   struct GNUNET_MessageHeader header;
 
   /**
    * 'enum GNUNET_TESTBED_EventType' (in NBO);
-   * either GNUNET_TESTBED_ET_PEER_CONNECT or GNUNET_TESTBED_ET_PEER_DISCONNECT.
+   * either GNUNET_TESTBED_ET_CONNECT or GNUNET_TESTBED_ET_DISCONNECT.
    */
   int32_t event_type GNUNET_PACKED;
-  
+
   /**
    * First peer.
    */
@@ -455,7 +516,7 @@ struct GNUNET_TESTBED_OperationFailureEventMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT
    */
   struct GNUNET_MessageHeader header;
 
@@ -464,7 +525,7 @@ struct GNUNET_TESTBED_OperationFailureEventMessage
    * GNUNET_TESTBED_ET_OPERATION_FINISHED.
    */
   int32_t event_type GNUNET_PACKED;
-  
+
   /**
    * Operation ID of the operation that created this event.
    */
@@ -482,7 +543,7 @@ struct GNUNET_TESTBED_PeerCreateSuccessEventMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS
    */
   struct GNUNET_MessageHeader header;
 
@@ -490,19 +551,12 @@ struct GNUNET_TESTBED_PeerCreateSuccessEventMessage
    * Peer identity of the peer that was created.
    */
   uint32_t peer_id GNUNET_PACKED;
-  
+
   /**
    * Operation ID of the operation that created this event.
    */
   uint64_t operation_id GNUNET_PACKED;
 
-  /**
-   * Identity of the peer.
-   */
-  struct GNUNET_PeerIdentity peer_id;
-
-  /* followed by gzip-compressed configuration of the peer */
-
 };
 
 
@@ -515,7 +569,7 @@ struct GNUNET_TESTBED_GenericOperationSuccessEventMessage
 {
 
   /**
-   * Type is 
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_GENERICOPSUCCESS
    */
   struct GNUNET_MessageHeader header;
 
@@ -524,12 +578,153 @@ struct GNUNET_TESTBED_GenericOperationSuccessEventMessage
    * GNUNET_TESTBED_ET_OPERATION_FINISHED.
    */
   int32_t event_type GNUNET_PACKED;
-  
+
+  /**
+   * Operation ID of the operation that created this event.
+   */
+  uint64_t operation_id GNUNET_PACKED;
+
+};
+
+
+/**
+ * Message sent from client to testing service to
+ * obtain the configuration of a peer.
+ */
+struct GNUNET_TESTBED_PeerGetConfigurationMessage
+{
+
+  /**
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_GETPEERCONFIG
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * Unique ID for the peer.
+   */
+  uint32_t peer_id GNUNET_PACKED;
+
+  /**
+   * Operation ID that is used to identify this operation.
+   */
+  uint64_t operation_id GNUNET_PACKED;
+
+};
+
+
+/**
+ * Peer configuration and identity reply from controller to a client.
+ */
+struct GNUNET_TESTBED_PeerConfigurationInformationMessage
+{
+
+  /**
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * The id of the peer relevant to this information
+   */
+  uint32_t peer_id GNUNET_PACKED;
+
   /**
    * Operation ID of the operation that created this event.
    */
   uint64_t operation_id GNUNET_PACKED;
 
+  /**
+   * Identity of the peer.
+   */
+  struct GNUNET_PeerIdentity peer_identity;
+
+  /**
+   * The size of configuration when uncompressed
+   */
+  uint16_t config_size GNUNET_PACKED;
+
+  /* followed by gzip-compressed configuration of the peer */
+
 };
 
+
+/**
+ * Message to request configuration of a slave controller
+ */
+struct GNUNET_TESTBED_SlaveGetConfigurationMessage
+{
+  /**
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_GETSLAVECONFIG
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * The id of the slave host
+   */
+  uint32_t slave_id GNUNET_PACKED;
+
+  /**
+   * Operation ID
+   */
+  uint64_t operation_id GNUNET_PACKED;
+
+};
+
+
+/**
+ * Reply to GETSLAVECONFIG message
+ */
+struct GNUNET_TESTBED_SlaveConfiguration
+{
+  /**
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * The id of the host where the slave is running
+   */
+  uint32_t slave_id GNUNET_PACKED;
+
+  /**
+   * Operation ID
+   */
+  uint64_t operation_id GNUNET_PACKED;
+
+  /**
+   * The size of the configuration when uncompressed
+   */
+  uint16_t config_size GNUNET_PACKED;
+
+  /* followed by gzip-compressed configuration of the peer */
+
+};
+
+
+/**
+ * Message sent from a controller to the testbed API seeking the configuration
+ * of the host whose id is contained in the message.
+ */
+struct GNUNET_TESTBED_NeedControllerConfig
+{
+  /**
+   * Type is GNUNET_MESSAGE_TYPE_TESTBED_NEEDCONTROLLERCONFIG
+   */
+  struct GNUNET_MessageHeader header;
+
+  /**
+   * The id of the controller host
+   */
+  uint32_t controller_host_id GNUNET_PACKED;
+
+  /**
+   * Operation ID
+   */
+  uint64_t operation_id GNUNET_PACKED;
+
+};
+
+GNUNET_NETWORK_STRUCT_END
+
 #endif
+/* end of testbed.h */