HKDF (does not work yet)
[oweals/gnunet.git] / src / include / gnunet_testing_lib.h
index 9fd43c8ff4e8d0ce5d981a0913901e66f832b41d..8d35e845f53c8f2b485a05ae3431a70ccd9b9ed6 100644 (file)
@@ -337,6 +337,7 @@ struct GNUNET_TESTING_PeerGroup;
  * @param cls closure
  * @param first peer id for first daemon
  * @param second peer id for the second daemon
+ * @param distance distance between the connected peers
  * @param first_cfg config for the first daemon
  * @param second_cfg config for the second daemon
  * @param first_daemon handle for the first daemon
@@ -344,13 +345,14 @@ struct GNUNET_TESTING_PeerGroup;
  * @param emsg error message (NULL on success)
  */
 typedef void (*GNUNET_TESTING_NotifyConnection)(void *cls,
-                                                   const struct GNUNET_PeerIdentity *first,
-                                                   const struct GNUNET_PeerIdentity *second,
-                                                   const struct GNUNET_CONFIGURATION_Handle *first_cfg,
-                                                   const struct GNUNET_CONFIGURATION_Handle *second_cfg,
-                                                   struct GNUNET_TESTING_Daemon *first_daemon,
-                                                   struct GNUNET_TESTING_Daemon *second_daemon,
-                                                   const char *emsg);
+                                                const struct GNUNET_PeerIdentity *first,
+                                                const struct GNUNET_PeerIdentity *second,
+                                                uint32_t distance,
+                                                const struct GNUNET_CONFIGURATION_Handle *first_cfg,
+                                                const struct GNUNET_CONFIGURATION_Handle *second_cfg,
+                                                struct GNUNET_TESTING_Daemon *first_daemon,
+                                                struct GNUNET_TESTING_Daemon *second_daemon,
+                                                const char *emsg);
 
 /**
  * Starts a GNUnet daemon.  GNUnet must be installed on the target
@@ -424,7 +426,8 @@ GNUNET_TESTING_daemon_start_stopped (struct GNUNET_TESTING_Daemon *daemon,
  * @param position the number of the peer to return
  */
 struct GNUNET_TESTING_Daemon *
-GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg, unsigned int position);
+GNUNET_TESTING_daemon_get (struct GNUNET_TESTING_PeerGroup *pg, 
+                          unsigned int position);
 
 
 /**
@@ -546,10 +549,14 @@ GNUNET_TESTING_daemons_restart (struct GNUNET_TESTING_PeerGroup *pg,
  *
  * @param pg handle to the peer group
  * @param timeout how long to wait for shutdown
+ * @param cb callback to notify upon success or failure
+ * @param cb_cls closure for cb
  */
 void
 GNUNET_TESTING_daemons_stop (struct GNUNET_TESTING_PeerGroup *pg, 
-                            struct GNUNET_TIME_Relative timeout);
+                             struct GNUNET_TIME_Relative timeout,
+                             GNUNET_TESTING_NotifyCompletion cb,
+                             void *cb_cls);
 
 
 /**
@@ -629,6 +636,11 @@ enum GNUNET_TESTING_Topology
    */
   GNUNET_TESTING_TOPOLOGY_SCALE_FREE,
 
+  /**
+   * Straight line topology.
+   */
+  GNUNET_TESTING_TOPOLOGY_LINE,
+
   /**
    * All peers are disconnected.
    */
@@ -669,6 +681,33 @@ enum GNUNET_TESTING_TopologyOption
   GNUNET_TESTING_TOPOLOGY_OPTION_NONE
 };
 
+
+/**
+ * Get a topology from a string input.
+ *
+ * @param topology where to write the retrieved topology
+ * @param topology_string The string to attempt to
+ *        get a configuration value from
+ * @return GNUNET_YES if topology string matched a
+ *         known topology, GNUNET_NO if not
+ */
+int
+GNUNET_TESTING_topology_get(enum GNUNET_TESTING_Topology *topology, char * topology_string);
+
+/**
+ * Get connect topology option from string input.
+ *
+ * @param topology_option where to write the retrieved topology
+ * @param topology_string The string to attempt to
+ *        get a configuration value from
+ * @return GNUNET_YES if topology string matched a
+ *         known topology, GNUNET_NO if not
+ */
+int
+GNUNET_TESTING_topology_option_get(enum GNUNET_TESTING_TopologyOption *topology_option,
+                                  char * topology_string);
+
+
 /**
  * Takes a peer group and creates a topology based on the
  * one specified.  Creates a topology means generates friend
@@ -734,74 +773,6 @@ GNUNET_TESTING_daemons_vary (struct GNUNET_TESTING_PeerGroup *pg,
                             void *cb_cls);
 
 
-/**
- * Start "count" GNUnet daemons with a particular topology.
- *
- * @param sched scheduler to use
- * @param cfg configuration template to use
- * @param count number of peers the testbed should have
- * @param topology desired topology (enforced via F2F)
- * @param cb function to call on each daemon that was started
- * @param cb_cls closure for cb
- * @param hostname where to run the peers; can be NULL (to run
- *        everything on localhost). Additional
- *        hosts can be specified using a NULL-terminated list of
- *        varargs, hosts will then be used round-robin from that
- *        list.
- * @return handle to control the testbed
- */
-struct GNUNET_TESTING_Testbed *
-GNUNET_TESTING_testbed_start (struct GNUNET_SCHEDULER_Handle *sched,
-                             const struct GNUNET_CONFIGURATION_Handle *cfg,
-                             unsigned int count,
-                             enum GNUNET_TESTING_Topology topology,
-                             GNUNET_TESTING_NotifyDaemonRunning cb,
-                             void *cb_cls,
-                             const char *hostname,
-                             ...);
-
-
-/**
- * Stop all of the daemons started with the start function.
- *
- * @param tb handle for the testbed
- * @param cb function to call when done
- * @param cb_cls closure for cb
- */
-void
-GNUNET_TESTING_testbed_stop (struct GNUNET_TESTING_Testbed *tb,
-                            GNUNET_TESTING_NotifyCompletion cb,
-                            void *cb_cls );
-
-
-/**
- * Simulate churn in the testbed by stopping some peers (and possibly
- * re-starting others if churn is called multiple times).  This
- * function can only be used to create leave-join churn (peers "never"
- * leave for good).  First "voff" random peers that are currently
- * online will be taken offline; then "von" random peers that are then
- * offline will be put back online.  No notifications will be
- * generated for any of these operations except for the callback upon
- * completion.  Note that the implementation is at liberty to keep
- * the ARM service itself (but none of the other services or daemons)
- * running even though the "peer" is being varied offline.
- *
- * @param tb handle for the testbed
- * @param voff number of peers that should go offline
- * @param von number of peers that should come back online;
- *            must be zero on first call (since "testbed_start"
- *            always starts all of the peers)
- * @param cb function to call at the end
- * @param cb_cls closure for cb
- */
-void
-GNUNET_TESTING_testbed_churn (struct GNUNET_TESTING_Testbed *tb,
-                             unsigned int voff,
-                             unsigned int von,
-                             GNUNET_TESTING_NotifyCompletion cb,
-                             void *cb_cls);
-
-
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif