gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r22551 - gnunet/src/testbed


From: gnunet
Subject: [GNUnet-SVN] r22551 - gnunet/src/testbed
Date: Mon, 9 Jul 2012 00:35:24 +0200

Author: harsha
Date: 2012-07-09 00:35:24 +0200 (Mon, 09 Jul 2012)
New Revision: 22551

Modified:
   gnunet/src/testbed/testbed_api.c
   gnunet/src/testbed/testbed_api.h
   gnunet/src/testbed/testbed_api_peers.c
Log:
-removed static operations and operation queue

Modified: gnunet/src/testbed/testbed_api.c
===================================================================
--- gnunet/src/testbed/testbed_api.c    2012-07-08 22:31:17 UTC (rev 22550)
+++ gnunet/src/testbed/testbed_api.c    2012-07-08 22:35:24 UTC (rev 22551)
@@ -128,91 +128,6 @@
 
 
 /**
- * Handle to interact with a GNUnet testbed controller.  Each
- * controller has at least one master handle which is created when the
- * controller is created; this master handle interacts with the
- * controller process, destroying it destroys the controller (by
- * closing stdin of the controller process).  Additionally,
- * controllers can interact with each other (in a P2P fashion); those
- * links are established via TCP/IP on the controller's service port.
- */
-struct GNUNET_TESTBED_Controller
-{
-
-  /**
-   * The host where the controller is running
-   */
-  struct GNUNET_TESTBED_Host *host;
-
-  /**
-   * The controller callback
-   */
-  GNUNET_TESTBED_ControllerCallback cc;
-
-  /**
-   * The closure for controller callback
-   */
-  void *cc_cls;
-
-  /**
-   * The configuration to use while connecting to controller
-   */
-  struct GNUNET_CONFIGURATION_Handle *cfg;
-
-  /**
-   * The client connection handle to the controller service
-   */
-  struct GNUNET_CLIENT_Connection *client;
-  
-  /**
-   * The head of the message queue
-   */
-  struct MessageQueue *mq_head;
-
-  /**
-   * The tail of the message queue
-   */
-  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
-   */
-  struct GNUNET_CLIENT_TransmitHandle *th;
-
-  /**
-   * The host registration handle; NULL if no current registration requests are
-   * present 
-   */
-  struct GNUNET_TESTBED_HostRegistrationHandle *rh;
-
-  /**
-   * The controller event mask
-   */
-  uint64_t event_mask;
-
-  /**
-   * Did we start the receive loop yet?
-   */
-  int in_receive;
-
-  /**
-   * Did we create the host for this?
-   */
-  int aux_host;
-};
-
-
-/**
  * handle for host registration
  */
 struct GNUNET_TESTBED_HostRegistrationHandle
@@ -240,34 +155,6 @@
 
 
 /**
- * The global operation id counter
- */
-uint64_t GNUNET_TESTBED_operation_id;
-
-/**
- * The head of the operation queue
- */
-struct GNUNET_TESTBED_Operation *op_head;
-
-/**
- * The tail of the operation queue
- */
-struct GNUNET_TESTBED_Operation *op_tail;
-
-
-/**
- * Adds an operation to the queue of operations
- *
- * @param op the operation to add
- */
-void
-GNUNET_TESTBED_operation_add (struct GNUNET_TESTBED_Operation *op)
-{
-  GNUNET_CONTAINER_DLL_insert_tail (op_head, op_tail, op);
-}
-
-
-/**
  * Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message from
  * controller (testbed service)
  *
@@ -342,7 +229,7 @@
   
   op_id = GNUNET_ntohll (msg->operation_id);
   LOG_DEBUG ("Operation %ul successful\n", op_id);
-  for (op = op_head; NULL != op; op = op->next)
+  for (op = c->op_head; NULL != op; op = op->next)
   {
     if (op->operation_id == op_id)
       break;
@@ -391,7 +278,7 @@
     if (NULL != c->cc)
       c->cc (c->cc_cls, event);
   }
-  GNUNET_CONTAINER_DLL_remove (op_head, op_tail, op);
+  GNUNET_CONTAINER_DLL_remove (c->op_head, c->op_tail, op);
   GNUNET_free (op);
   return GNUNET_YES;  
 }

Modified: gnunet/src/testbed/testbed_api.h
===================================================================
--- gnunet/src/testbed/testbed_api.h    2012-07-08 22:31:17 UTC (rev 22550)
+++ gnunet/src/testbed/testbed_api.h    2012-07-08 22:35:24 UTC (rev 22551)
@@ -41,12 +41,6 @@
 
 
 /**
- * The counter for generating unique operation ids. Use its current value and
- * increment it (defined in testbed_api.c)
- */
-extern uint64_t GNUNET_TESTBED_operation_id;
-
-/**
  * Testbed operation structure
  */
 struct GNUNET_TESTBED_Operation
@@ -79,6 +73,118 @@
 
 
 /**
+ * The message queue for sending messages to the controller service
+ */
+struct MessageQueue;
+
+
+/**
+ * Structure for a controller link
+ */
+struct ControllerLink;
+
+
+/**
+ * Handle to interact with a GNUnet testbed controller.  Each
+ * controller has at least one master handle which is created when the
+ * controller is created; this master handle interacts with the
+ * controller process, destroying it destroys the controller (by
+ * closing stdin of the controller process).  Additionally,
+ * controllers can interact with each other (in a P2P fashion); those
+ * links are established via TCP/IP on the controller's service port.
+ */
+struct GNUNET_TESTBED_Controller
+{
+
+  /**
+   * The host where the controller is running
+   */
+  struct GNUNET_TESTBED_Host *host;
+
+  /**
+   * The controller callback
+   */
+  GNUNET_TESTBED_ControllerCallback cc;
+
+  /**
+   * The closure for controller callback
+   */
+  void *cc_cls;
+
+  /**
+   * The configuration to use while connecting to controller
+   */
+  struct GNUNET_CONFIGURATION_Handle *cfg;
+
+  /**
+   * The client connection handle to the controller service
+   */
+  struct GNUNET_CLIENT_Connection *client;
+  
+  /**
+   * The head of the message queue
+   */
+  struct MessageQueue *mq_head;
+
+  /**
+   * The tail of the message queue
+   */
+  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
+   */
+  struct GNUNET_CLIENT_TransmitHandle *th;
+
+  /**
+   * The host registration handle; NULL if no current registration requests are
+   * present 
+   */
+  struct GNUNET_TESTBED_HostRegistrationHandle *rh;
+
+  /**
+   * The head of the operation queue
+   */
+  struct GNUNET_TESTBED_Operation *op_head;
+  
+  /**
+   * The tail of the operation queue
+   */
+  struct GNUNET_TESTBED_Operation *op_tail;
+
+  /**
+   * The operation id counter. use current value and increment
+   */
+  uint64_t operation_counter;
+  
+  /**
+   * The controller event mask
+   */
+  uint64_t event_mask;
+
+  /**
+   * Did we start the receive loop yet?
+   */
+  int in_receive;
+
+  /**
+   * Did we create the host for this?
+   */
+  int aux_host;
+};
+
+
+/**
  * Queues a message in send queue for sending to the service
  *
  * @param controller the handle to the controller

Modified: gnunet/src/testbed/testbed_api_peers.c
===================================================================
--- gnunet/src/testbed/testbed_api_peers.c      2012-07-08 22:31:17 UTC (rev 
22550)
+++ gnunet/src/testbed/testbed_api_peers.c      2012-07-08 22:35:24 UTC (rev 
22551)
@@ -235,7 +235,7 @@
   data = GNUNET_malloc (sizeof (struct PeerDestroyData));
   data->peer = peer;
   op = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Operation));
-  op->operation_id = GNUNET_TESTBED_operation_id++;
+  op->operation_id = peer->controller->operation_counter++;
   op->type = OP_PEER_DESTROY;
   op->data = data;
   msg = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_PeerDestroyMessage));
@@ -243,7 +243,8 @@
   msg->header.type = htons (GNUNET_MESSAGE_TYPE_TESTBED_DESTROYPEER);
   msg->peer_id = htonl (peer->unique_id);
   msg->operation_id = GNUNET_htonll (op->operation_id);
-  GNUNET_TESTBED_operation_add (op);
+  GNUNET_CONTAINER_DLL_insert_tail (peer->controller->op_head,
+                                    peer->controller->op_tail, op);
   GNUNET_TESTBED_queue_message (peer->controller, 
                                 (struct GNUNET_MessageHeader *) msg);
   return op;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]