- mark old API calls used for previous VPN implementation as deprecated
[oweals/gnunet.git] / src / include / gnunet_testing_lib-new.h
index 9bd6c3b25835c6f9e5cbd80872436845bc0f95ee..fc26eefa03beb2810cd3fffbf94e2e3817750412 100644 (file)
@@ -62,14 +62,16 @@ struct GNUNET_TESTING_Peer;
  * Create a system handle.  There must only be one system
  * handle per operating system.
  *
- * @param tmppath prefix path to use for all service homes
+ ** @param testdir only the directory name without any path. This is used for
+ *          all service homes; the directory will be created in a temporary
+ *          location depending on the underlying OS
  * @param controller hostname of the controlling host, 
  *        service configurations are modified to allow 
  *        control connections from this host; can be NULL
  * @return handle to this system, NULL on error
  */
 struct GNUNET_TESTING_System *
-GNUNET_TESTING_system_create (const char *tmppath,
+GNUNET_TESTING_system_create (const char *testdir,
                              const char *controller);
 
 
@@ -77,7 +79,7 @@ GNUNET_TESTING_system_create (const char *tmppath,
  * Free system resources.
  *
  * @param system system to be freed
- * @param remove_paths should the 'tmppath' and all subdirectories
+ * @param remove_paths should the 'testdir' and all subdirectories
  *        be removed (clean up on shutdown)?
  */
 void
@@ -100,9 +102,9 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
  * @param key_number desired pre-created hostkey to obtain
  * @param id set to the peer's identity (hash of the public
  *        key; if NULL, GNUNET_SYSERR is returned immediately
- * @return GNUNET_SYSERR on error (not enough keys)
+ * @return NULL on error (not enough keys)
  */
-int
+struct GNUNET_CRYPTO_RsaPrivateKey *
 GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
                            uint32_t key_number,
                            struct GNUNET_PeerIdentity *id);
@@ -174,6 +176,17 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
                               char **emsg);
 
 
+/**
+ * Obtain the peer identity from a peer handle.
+ *
+ * @param peer peer handle for which we want the peer's identity
+ * @param id identifier for the daemon, will be set
+ */
+void
+GNUNET_TESTING_peer_get_identity (const struct GNUNET_TESTING_Peer *peer,
+                                 struct GNUNET_PeerIdentity *id);
+
+
 /**
  * Start the peer. 
  *
@@ -211,9 +224,11 @@ GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer);
  * 
  * @param cls closure
  * @param cfg configuration of the peer that was started
+ * @param peer identity of the peer that was created
  */
 typedef void (*GNUNET_TESTING_TestMain)(void *cls,
-                                       const struct GNUNET_CONFIGURATION_Handle *cfg);
+                                       const struct GNUNET_CONFIGURATION_Handle *cfg,
+                                       struct GNUNET_TESTING_Peer *peer);
 
 
 /**
@@ -223,8 +238,9 @@ typedef void (*GNUNET_TESTING_TestMain)(void *cls,
  * and should thus be called directly from "main".  The testcase
  * should self-terminate by invoking 'GNUNET_SCHEDULER_shutdown'.
  *
- * @param tmppath path for storing temporary data for the test
- *        also used to setup the program name for logging
+ * @param testdir only the directory name without any path. This is used for
+ *          all service homes; the directory will be created in a temporary
+ *          location depending on the underlying OS
  * @param cfgfilename name of the configuration file to use;
  *         use NULL to only run with defaults
  * @param tm main function of the testcase
@@ -232,7 +248,7 @@ typedef void (*GNUNET_TESTING_TestMain)(void *cls,
  * @return 0 on success, 1 on error
  */
 int
-GNUNET_TESTING_peer_run (const char *tmppath,
+GNUNET_TESTING_peer_run (const char *testdir,
                         const char *cfgfilename,
                         GNUNET_TESTING_TestMain tm,
                         void *tm_cls);
@@ -249,8 +265,9 @@ GNUNET_TESTING_peer_run (const char *tmppath,
  * This function is useful if the testcase is for a single service
  * and if that service doesn't itself depend on other services.
  *
- * @param tmppath path for storing temporary data for the test
- *        also used to setup the program name for logging
+ * @param testdir only the directory name without any path. This is used for
+ *          all service homes; the directory will be created in a temporary
+ *          location depending on the underlying OS
  * @param service_name name of the service to run
  * @param cfgfilename name of the configuration file to use;
  *         use NULL to only run with defaults
@@ -259,14 +276,13 @@ GNUNET_TESTING_peer_run (const char *tmppath,
  * @return 0 on success, 1 on error
  */
 int
-GNUNET_TESTING_service_run (const char *tmppath,
+GNUNET_TESTING_service_run (const char *testdir,
                            const char *service_name,
                            const char *cfgfilename,
                            GNUNET_TESTING_TestMain tm,
                            void *tm_cls);
 
 
-
 /**
  * Sometimes we use the binary name to determine which specific
  * test to run.  In those cases, the string after the last "_"