plugin datastore mysql
[oweals/gnunet.git] / src / testbed / testbed_api.c
index a65102eadb3192ad8d04b13fb9fa50419fb5d9f9..dd24e83f866efbfd28cd635bf90fc275b2e20457 100644 (file)
@@ -1,6 +1,6 @@
 /*
       This file is part of GNUnet
-      (C) 2008--2013 Christian Grothoff (and other contributing authors)
+      Copyright (C) 2008--2013 GNUnet e.V.
 
       GNUnet is free software; you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
       You should have received a copy of the GNU General Public License
       along with GNUnet; see the file COPYING.  If not, write to the
-      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-      Boston, MA 02111-1307, USA.
+      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+      Boston, MA 02110-1301, USA.
  */
 
 /**
@@ -382,12 +382,12 @@ handle_forwarded_operation_msg (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_ADDHOSTCONFIRM message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST_SUCCESS message from
  * controller (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -484,12 +484,12 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCREATESUCCESS message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_CREATE_PEER_SUCCESS message from
  * controller (testbed service)
  *
  * @param c the controller handle
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -543,12 +543,12 @@ handle_peer_create_success (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEEREVENT message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEER_EVENT message from
  * controller (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -624,12 +624,12 @@ handle_peer_event (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCONEVENT message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEER_CONNECT_EVENT message from
  * controller (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -699,12 +699,12 @@ handle_peer_conevent (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_PEERCONFIG message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION message from
  * controller (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -771,12 +771,12 @@ handle_peer_config (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_OPERATIONFAILEVENT message from
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_OPERATION_FAIL_EVENT message from
  * controller (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -931,12 +931,12 @@ GNUNET_TESTBED_generate_slavegetconfig_msg_ (uint64_t op_id, uint32_t slave_id)
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION message from controller
  * (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -978,12 +978,12 @@ handle_slave_config (struct GNUNET_TESTBED_Controller *c,
 
 
 /**
- * Handler for GNUNET_MESSAGE_TYPE_TESTBED_SLAVECONFIG message from controller
+ * Handler for #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT message from controller
  * (testbed service)
  *
  * @param c the controller handler
  * @param msg message received
- * @return GNUNET_YES if we can continue receiving from service; GNUNET_NO if
+ * @return #GNUNET_YES if we can continue receiving from service; #GNUNET_NO if
  *           not
  */
 static int
@@ -1558,8 +1558,7 @@ opc_free_iterator (void *cls, uint32_t key, void *value)
  * @param c handle to controller to stop
  */
 void
-GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller
-                                      *c)
+GNUNET_TESTBED_controller_disconnect (struct GNUNET_TESTBED_Controller *c)
 {
   struct MessageQueue *mq_entry;
 
@@ -1899,11 +1898,11 @@ GNUNET_TESTBED_operation_done (struct GNUNET_TESTBED_Operation *operation)
 /**
  * Generates configuration by uncompressing configuration in given message. The
  * given message should be of the following types:
- * GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION,
- * GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION,
- * GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST,
- * GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS,
- * GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_PEER_INFORMATION,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_SLAVE_CONFIGURATION,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_ADD_HOST,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS,
+ * #GNUNET_MESSAGE_TYPE_TESTBED_LINK_CONTROLLERS_RESULT,
  *
  * @param msg the message containing compressed configuration
  * @return handle to the parsed configuration; NULL upon error while parsing the message
@@ -2156,4 +2155,18 @@ GNUNET_TESTBED_shutdown_peers (struct GNUNET_TESTBED_Controller *c,
 }
 
 
+/**
+ * Return the index of the peer inside of the total peer array,
+ * aka. the peer's "unique ID".
+ *
+ * @param peer Peer handle.
+ *
+ * @return The peer's unique ID.
+ */
+uint32_t
+GNUNET_TESTBED_get_index (const struct GNUNET_TESTBED_Peer *peer)
+{
+  return peer->unique_id;
+}
+
 /* end of testbed_api.c */