-avoid side-effect in assertion
[oweals/gnunet.git] / src / testbed / testbed_api.h
index a90acbf811f46909764e5c4bbe8fc68e7b21786b..dbeea92437cd7c005ccbd0954184d58f50e003bb 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      (C) 2012 Christian Grothoff (and other contributing authors)
+      (C) 2008--2013 Christian Grothoff (and other contributing authors)
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -67,6 +67,11 @@ enum OperationType
      */
   OP_PEER_INFO,
 
+  /**
+   * Reconfigure a peer
+   */
+  OP_PEER_RECONFIGURE,
+
     /**
      * Overlay connection operation
      */
@@ -85,7 +90,17 @@ enum OperationType
   /**
    * Get slave config operation
    */
-  OP_GET_SLAVE_CONFIG
+  OP_GET_SLAVE_CONFIG,
+
+  /**
+   * Stop and destroy all peers  
+   */
+  OP_SHUTDOWN_PEERS,
+
+  /**
+   * Start/stop service at a peer
+   */
+  OP_MANAGE_SERVICE
 };
 
 
@@ -94,11 +109,6 @@ enum OperationType
  */
 struct MessageQueue;
 
-/**
- * Structure for a controller link
- */
-struct ControllerLink;
-
 
 /**
  * Enumeration of states of OperationContext
@@ -130,16 +140,6 @@ enum OperationContextState
  */
 struct OperationContext
 {
-  /**
-   * next ptr for DLL
-   */
-  struct OperationContext *next;
-
-  /**
-   * prev ptr for DLL
-   */
-  struct OperationContext *prev;
-
   /**
    * The controller to which this operation context belongs to
    */
@@ -223,16 +223,6 @@ struct GNUNET_TESTBED_Controller
    */
   struct MessageQueue *mq_tail;
 
-  /**
-   * The head of the ControllerLink list
-   */
-  struct ControllerLink *cl_head;
-
-  /**
-   * The tail of the ControllerLink list
-   */
-  struct ControllerLink *cl_tail;
-
   /**
    * The client transmit handle
    */
@@ -245,14 +235,9 @@ struct GNUNET_TESTBED_Controller
   struct GNUNET_TESTBED_HostRegistrationHandle *rh;
 
   /**
-   * The head of the opeartion context queue
+   * The map of active operation contexts
    */
-  struct OperationContext *ocq_head;
-
-  /**
-   * The tail of the operation context queue
-   */
-  struct OperationContext *ocq_tail;
+  struct GNUNET_CONTAINER_MultiHashMap32 *opc_map;
 
   /**
    * Operation queue for simultaneous operations
@@ -279,11 +264,6 @@ struct GNUNET_TESTBED_Controller
    */
   int in_receive;
 
-  /**
-   * Did we create the host for this?
-   */
-  int aux_host;
-
   /**
    * The operation id counter. use current value and increment
    */
@@ -303,6 +283,31 @@ GNUNET_TESTBED_queue_message_ (struct GNUNET_TESTBED_Controller *controller,
                                struct GNUNET_MessageHeader *msg);
 
 
+/**
+ * Inserts the given operation context into the operation context map of the
+ * given controller.  Creates the operation context map if one does not exist
+ * for the controller
+ *
+ * @param c the controller
+ * @param opc the operation context to be inserted
+ */
+void
+GNUNET_TESTBED_insert_opc_ (struct GNUNET_TESTBED_Controller *c,
+                            struct OperationContext *opc);
+
+
+/**
+ * Removes the given operation context from the operation context map of the
+ * given controller
+ *
+ * @param c the controller
+ * @param opc the operation context to remove 
+ */
+void
+GNUNET_TESTBED_remove_opc_ (const struct GNUNET_TESTBED_Controller *c,
+                            struct OperationContext *opc);
+
+
 /**
  * Compresses given configuration using zlib compress
  *
@@ -331,15 +336,6 @@ GNUNET_TESTBED_compress_cfg_ (const struct GNUNET_CONFIGURATION_Handle *cfg,
                               size_t *size, size_t *xsize);
 
 
-/**
- * Adds an operation to the queue of operations
- *
- * @param op the operation to add
- */
-void
-GNUNET_TESTBED_operation_add_ (struct GNUNET_TESTBED_Operation *op);
-
-
 /**
  * Creates a helper initialization message. This function is here because we
  * want to use this in testing