[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: Testbed: Renaming.
From: |
gnunet |
Subject: |
[gnunet] branch master updated: Testbed: Renaming. |
Date: |
Mon, 20 May 2024 10:36:31 +0200 |
This is an automated email from the git hooks/post-receive script.
t3sserakt pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 96a0b8e36 Testbed: Renaming.
96a0b8e36 is described below
commit 96a0b8e367d04738d6cdece54d72b73f80049159
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Mon May 20 10:34:32 2024 +0200
Testbed: Renaming.
---
src/service/testbed/Makefile.am | 42 +-
src/service/testbed/gnunet-testbed.c | 41 +-
src/service/testbed/list-keys.c | 9 +-
src/service/testbed/test_testbed_peerstartup2.c | 28 +-
src/service/testbed/test_testbed_portreservation.c | 24 +-
src/service/testbed/test_testbed_servicestartup.c | 14 +-
.../testbed/test_testbed_start_with_config.c | 3 +-
src/service/testbed/{testing.c => testbed.c} | 1316 ++------------------
.../testbed/testbed_api_cmd_system_create.c | 14 +-
.../testbed/testbed_api_cmd_system_destroy.c | 4 +-
.../testbed/{testing_lib.h => testbed_lib.h} | 106 +-
src/service/testbed/testing.h | 173 ---
12 files changed, 260 insertions(+), 1514 deletions(-)
diff --git a/src/service/testbed/Makefile.am b/src/service/testbed/Makefile.am
index 801b0b047..ebc5911ef 100644
--- a/src/service/testbed/Makefile.am
+++ b/src/service/testbed/Makefile.am
@@ -13,22 +13,50 @@ pkgcfgdir= $(pkgdatadir)/config.d/
dist_pkgcfg_DATA = \
testbed.conf
+lib_LTLIBRARIES = \
+ libgnunettestbed.la
libgnunettestbed_la_SOURCES = \
+ testbed_lib.h \
+ testbed.c \
testbed_api_cmd_system_create.c \
testbed_api_cmd_system_destroy.c
+libgnunettestbed_la_LIBADD = \
+ $(top_builddir)/src/service/arm/libgnunetarm.la \
+ $(top_builddir)/src/lib/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/testing/libgnunettesting.la
bin_PROGRAMS = \
gnunet-testbed
+#libexec_PROGRAMS = \
+# test_testbed_start_with_config
+
noinst_PROGRAMS = \
list-keys
+#testbed_api_cmd_system_create_SOURCES = \
+# testbed_api_cmd_system_create.c
+#testbed_api_cmd_system_create_LDADD = \
+# libgnunettestbed.la \
+# $(top_builddir)/src/lib/util/libgnunetutil.la \
+# $(top_builddir)/src/lib/testing/libgnunettesting.la
+
+
+#testbed_SOURCES = \
+# testbed.c
+#testbed_LDADD = \
+# libgnunettestbed.la \
+# $(top_builddir)/src/lib/util/libgnunetutil.la \
+# $(top_builddir)/src/lib/testing/libgnunettesting.la \
+# $(GN_LIBINTL)
+
gnunet_testbed_SOURCES = \
gnunet-testbed.c
gnunet_testbed_LDADD = \
libgnunettestbed.la \
$(top_builddir)/src/lib/util/libgnunetutil.la \
+ $(top_builddir)/src/lib/testing/libgnunettesting.la \
$(GN_LIBINTL)
list_keys_SOURCES = \
@@ -54,12 +82,12 @@ check_PROGRAMS = \
# test_testbed_servicestartup
# endif
-test_testbed_start_with_config_SOURCES = \
- test_testbed_start_with_config.c
-test_testbed_start_with_config_LDADD = \
- libgnunettestbed.la \
- $(top_builddir)/src/lib/util/libgnunetutil.la \
- $(top_builddir)/src/lib/hello/libgnunethello.la
+#test_testbed_start_with_config_SOURCES = \
+# test_testbed_start_with_config.c
+#test_testbed_start_with_config_LDADD = \
+# libgnunettestbed.la \
+# $(top_builddir)/src/lib/util/libgnunetutil.la \
+# $(top_builddir)/src/lib/hello/libgnunethello.la
test_testbed_portreservation_SOURCES = \
test_testbed_portreservation.c
@@ -94,4 +122,4 @@ test_testbed_sharedservices_LDADD = \
EXTRA_DIST = \
test_testbed_defaults.conf \
test_testbed_sharedservices.conf \
- testbed_cmds.h
+ testbed_lib.h
diff --git a/src/service/testbed/gnunet-testbed.c
b/src/service/testbed/gnunet-testbed.c
index 88906e5fa..4a666d72f 100644
--- a/src/service/testbed/gnunet-testbed.c
+++ b/src/service/testbed/gnunet-testbed.c
@@ -9,7 +9,7 @@
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ MERCHANTABILITY or FITNESS FORp A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
@@ -19,16 +19,17 @@
*/
/**
- * @file testing/gnunet-testing.c
+ * @file testbed/gnunet-testbed.c
* @brief tool to use testing functionality from cmd line
* @author Christian Grothoff
*/
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
+#include "testbed_lib.h"
-#define LOG(kind, ...) GNUNET_log_from (kind, "gnunet-testing", __VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "gnunet-testbed", __VA_ARGS__)
/**
@@ -63,7 +64,7 @@ static char *create_cfg_template;
static char *run_service_name;
/**
- * File handle to STDIN, for reading restart/quit commands.
+ * File handle to STDIN, for reading resytart/quit commands.
*/
static struct GNUNET_DISK_FileHandle *fh;
@@ -80,13 +81,13 @@ static struct GNUNET_SCHEDULER_Task *tid;
/**
* Peer started for '-r'.
*/
-static struct GNUNET_TESTING_Peer *my_peer;
+static struct GNUNET_TESTBED_Peer *my_peer;
static int
create_unique_cfgs (const char *template, const unsigned int no)
{
- struct GNUNET_TESTING_System *system;
+ struct GNUNET_TESTBED_System *system;
int fail;
unsigned int cur;
char *cur_file;
@@ -125,7 +126,7 @@ create_unique_cfgs (const char *template, const unsigned
int no)
fail = GNUNET_NO;
system =
- GNUNET_TESTING_system_create ("testing", NULL /* controller */, NULL,
NULL);
+ GNUNET_TESTBED_system_create ("testing", NULL /* controller */, NULL,
NULL);
for (cur = 0; cur < no; cur++)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -137,7 +138,7 @@ create_unique_cfgs (const char *template, const unsigned
int no)
GNUNET_asprintf (&cur_file, "%04u%s", cur, ".conf");
cfg_new = GNUNET_CONFIGURATION_dup (cfg_tmpl);
- if (GNUNET_OK != GNUNET_TESTING_configuration_create (system, cfg_new))
+ if (GNUNET_OK != GNUNET_TESTBED_configuration_create (system, cfg_new))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Could not create another configuration\n");
@@ -162,7 +163,7 @@ create_unique_cfgs (const char *template, const unsigned
int no)
break;
}
GNUNET_CONFIGURATION_destroy (cfg_tmpl);
- GNUNET_TESTING_system_destroy (system, GNUNET_NO);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_NO);
if (GNUNET_YES == fail)
return 1;
return 0;
@@ -172,19 +173,19 @@ create_unique_cfgs (const char *template, const unsigned
int no)
static int
create_hostkeys (const unsigned int no)
{
- struct GNUNET_TESTING_System *system;
+ struct GNUNET_TESTBED_System *system;
struct GNUNET_PeerIdentity id;
struct GNUNET_DISK_FileHandle *fd;
struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
- system = GNUNET_TESTING_system_create ("testing", NULL, NULL, NULL);
- pk = GNUNET_TESTING_hostkey_get (system, create_no, &id);
+ system = GNUNET_TESTBED_system_create ("testing", NULL, NULL, NULL);
+ pk = GNUNET_TESTBED_hostkey_get (system, create_no, &id);
if (NULL == pk)
{
fprintf (stderr,
_ ("Could not extract hostkey %u (offset too large?)\n"),
create_no);
- GNUNET_TESTING_system_destroy (system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
return 1;
}
(void) GNUNET_DISK_directory_create_for_file (create_hostkey);
@@ -203,7 +204,7 @@ create_hostkeys (const unsigned int no)
"Wrote hostkey to file: `%s'\n",
create_hostkey);
GNUNET_free (pk);
- GNUNET_TESTING_system_destroy (system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
return 0;
}
@@ -257,9 +258,9 @@ stdin_cb (void *cls)
return;
case 'r':
- if (GNUNET_OK != GNUNET_TESTING_peer_stop (my_peer))
+ if (GNUNET_OK != GNUNET_TESTBED_peer_stop (my_peer))
LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to stop the peer\n");
- if (GNUNET_OK != GNUNET_TESTING_peer_start (my_peer))
+ if (GNUNET_OK != GNUNET_TESTBED_peer_start (my_peer))
LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to start the peer\n");
printf ("restarted\n");
fflush (stdout);
@@ -293,7 +294,7 @@ stdin_cb (void *cls)
static void
testing_main (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TESTING_Peer *peer)
+ struct GNUNET_TESTBED_Peer *peer)
{
my_peer = peer;
if (NULL == (tmpfilename = GNUNET_DISK_mktemp ("gnunet-testing")))
@@ -336,7 +337,7 @@ run_no_scheduler (void *cls,
{
if (NULL != run_service_name)
{
- ret = GNUNET_TESTING_service_run ("gnunet_service_test",
+ ret = GNUNET_TESTBED_service_run ("gnunet_service_test",
run_service_name,
cfgfile,
&testing_main,
@@ -420,7 +421,7 @@ main (int argc, char *const *argv)
return 2;
/* Run without scheduler, because we may want to call
- * GNUNET_TESTING_service_run, which starts the scheduler on its own.
+ * GNUNET_TESTBED_service_run, which starts the scheduler on its own.
* Furthermore, the other functionality currently does not require the
scheduler, too,
* but beware when extending gnunet-testing. */
ret =
@@ -441,4 +442,4 @@ main (int argc, char *const *argv)
}
-/* end of gnunet-testing.c */
+/* end of gnunet-testbed.c */
diff --git a/src/service/testbed/list-keys.c b/src/service/testbed/list-keys.c
index f65b45a77..955e3a05a 100644
--- a/src/service/testbed/list-keys.c
+++ b/src/service/testbed/list-keys.c
@@ -1,6 +1,7 @@
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
+#include "testbed_lib.h"
static unsigned int nkeys;
static unsigned int nskip;
@@ -42,7 +43,7 @@ run (void *cls,
GNUNET_break (0);
return;
}
- if (0 != (fsize % GNUNET_TESTING_HOSTKEYFILESIZE))
+ if (0 != (fsize % GNUNET_TESTBED_HOSTKEYFILESIZE))
{
fprintf (stderr, _ ("Incorrect hostkey file format: %s\n"), idfile);
return;
@@ -62,7 +63,7 @@ run (void *cls,
GNUNET_DISK_file_close (f);
return;
}
- nmax = fsize / GNUNET_TESTING_HOSTKEYFILESIZE;
+ nmax = fsize / GNUNET_TESTBED_HOSTKEYFILESIZE;
for (cnt = nskip; cnt < (nskip + nkeys); cnt++)
{
if (nskip + cnt >= nmax)
@@ -71,8 +72,8 @@ run (void *cls,
break;
}
GNUNET_memcpy (&pkey,
- data + (cnt * GNUNET_TESTING_HOSTKEYFILESIZE),
- GNUNET_TESTING_HOSTKEYFILESIZE);
+ data + (cnt * GNUNET_TESTBED_HOSTKEYFILESIZE),
+ GNUNET_TESTBED_HOSTKEYFILESIZE);
GNUNET_CRYPTO_eddsa_key_get_public (&pkey, &id.public_key);
printf ("Key %u: %s\n", cnt, GNUNET_i2s_full (&id));
}
diff --git a/src/service/testbed/test_testbed_peerstartup2.c
b/src/service/testbed/test_testbed_peerstartup2.c
index 8d357cb08..a4d0d0af3 100644
--- a/src/service/testbed/test_testbed_peerstartup2.c
+++ b/src/service/testbed/test_testbed_peerstartup2.c
@@ -19,8 +19,8 @@
*/
/**
- * @file testing/test_testing_new_peerstartup.c
- * @brief test case for testing peer startup and shutdown using new testing
+ * @file tested/test_tested_new_peerstartup.c
+ * @brief test case for testing peer startup and shutdown using new tested
* library
* @author Sree Harsha Totakura
*/
@@ -57,12 +57,12 @@ struct TestingContext
/**
* The testing system
*/
- struct GNUNET_TESTING_System *system;
+ struct GNUNET_TESTBED_System *system;
/**
* The peer which has been started by the testing system
*/
- struct GNUNET_TESTING_Peer *peer;
+ struct GNUNET_TESTBED_Peer *peer;
/**
* The running configuration of the peer
@@ -89,11 +89,11 @@ do_shutdown2 (void *cls)
struct TestingContext *test_ctx = cls;
if (NULL != test_ctx->peer)
- GNUNET_TESTING_peer_destroy (test_ctx->peer);
+ GNUNET_TESTBED_peer_destroy (test_ctx->peer);
if (NULL != test_ctx->cfg)
GNUNET_CONFIGURATION_destroy (test_ctx->cfg);
if (NULL != test_ctx->system)
- GNUNET_TESTING_system_destroy (test_ctx->system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (test_ctx->system, GNUNET_YES);
GNUNET_free (test_ctx);
}
@@ -108,7 +108,7 @@ do_shutdown (void *cls);
static void
-peer_status_cb (void *cls, struct GNUNET_TESTING_Peer *peer, int success)
+peer_status_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, int success)
{
struct TestingContext *test_ctx = cls;
@@ -144,7 +144,7 @@ do_shutdown (void *cls)
if (NULL != test_ctx->peer)
{
FAIL_TEST (GNUNET_OK ==
- GNUNET_TESTING_peer_stop_async (test_ctx->peer,
+ GNUNET_TESTBED_peer_stop_async (test_ctx->peer,
&peer_status_cb,
test_ctx));
}
@@ -166,14 +166,14 @@ run (void *cls, char *const *args, const char *cfgfile,
test_ctx = GNUNET_new (struct TestingContext);
test_ctx->system =
- GNUNET_TESTING_system_create ("test-gnunet-testing",
+ GNUNET_TESTBED_system_create ("test-gnunet-testing",
"127.0.0.1", NULL, NULL);
emsg = NULL;
if (NULL == test_ctx->system)
goto end;
test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg);
test_ctx->peer =
- GNUNET_TESTING_peer_configure (test_ctx->system,
+ GNUNET_TESTBED_peer_configure (test_ctx->system,
test_ctx->cfg,
0, &id, &emsg);
if (NULL == test_ctx->peer)
@@ -182,14 +182,14 @@ run (void *cls, char *const *args, const char *cfgfile,
printf ("Test failed upon error: %s", emsg);
goto end;
}
- if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer))
+ if (GNUNET_OK != GNUNET_TESTBED_peer_start (test_ctx->peer))
goto end;
test_ctx->state = PEER_STARTED;
FAIL_TEST (GNUNET_OK ==
- GNUNET_TESTING_peer_stop_async (test_ctx->peer,
+ GNUNET_TESTBED_peer_stop_async (test_ctx->peer,
&peer_status_cb,
test_ctx));
- GNUNET_TESTING_peer_stop_async_cancel (test_ctx->peer);
+ GNUNET_TESTBED_peer_stop_async_cancel (test_ctx->peer);
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
&do_shutdown, test_ctx);
return;
@@ -219,4 +219,4 @@ main (int argc, char *argv[])
}
-/* end of test_testing_peerstartup.c */
+/* end of test_tested_peerstartup.c */
diff --git a/src/service/testbed/test_testbed_portreservation.c
b/src/service/testbed/test_testbed_portreservation.c
index df3d8d523..7246c0cfa 100644
--- a/src/service/testbed/test_testbed_portreservation.c
+++ b/src/service/testbed/test_testbed_portreservation.c
@@ -44,39 +44,39 @@ static void
run (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- struct GNUNET_TESTING_System *system;
+ struct GNUNET_TESTBED_System *system;
uint16_t new_port1;
uint16_t new_port2;
uint16_t old_port1;
- system = GNUNET_TESTING_system_create ("/tmp/gnunet-testing-new",
+ system = GNUNET_TESTBED_system_create ("/tmp/gnunet-testing-new",
"localhost", NULL, NULL);
GNUNET_assert (NULL != system);
- new_port1 = GNUNET_TESTING_reserve_port (system);
+ new_port1 = GNUNET_TESTBED_reserve_port (system);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Reserved TCP port %u\n", new_port1);
if (0 == new_port1)
goto end;
- new_port2 = GNUNET_TESTING_reserve_port (system);
+ new_port2 = GNUNET_TESTBED_reserve_port (system);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Reserved TCP port %u\n", new_port2);
if (0 == new_port2)
goto end;
GNUNET_assert (new_port1 != new_port2);
- GNUNET_TESTING_release_port (system, new_port1);
+ GNUNET_TESTBED_release_port (system, new_port1);
old_port1 = new_port1;
new_port1 = 0;
- new_port1 = GNUNET_TESTING_reserve_port (system);
+ new_port1 = GNUNET_TESTBED_reserve_port (system);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Reserved TCP port %u\n", new_port1);
GNUNET_assert (0 != new_port1);
GNUNET_assert (old_port1 == new_port1);
- GNUNET_TESTING_release_port (system, new_port1);
- GNUNET_TESTING_release_port (system, new_port2);
+ GNUNET_TESTBED_release_port (system, new_port1);
+ GNUNET_TESTBED_release_port (system, new_port2);
status = GNUNET_OK;
end:
- GNUNET_TESTING_system_destroy (system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
}
@@ -91,9 +91,9 @@ main (int argc, char *argv[])
if (GNUNET_OK !=
GNUNET_PROGRAM_run (argc,
argv,
- "test_testing_new_portreservation",
+ "test_testbed_new_portreservation",
"test case for testing port reservation routines"
- " from the new testing library API",
+ " from the new testeb library API",
options,
&run,
NULL))
@@ -102,4 +102,4 @@ main (int argc, char *argv[])
}
-/* end of test_testing_portreservation.c */
+/* end of test_testbed_portreservation.c */
diff --git a/src/service/testbed/test_testbed_servicestartup.c
b/src/service/testbed/test_testbed_servicestartup.c
index 83458898b..891fa538a 100644
--- a/src/service/testbed/test_testbed_servicestartup.c
+++ b/src/service/testbed/test_testbed_servicestartup.c
@@ -19,8 +19,8 @@
*/
/**
- * @file testing/test_testing_new_servicestartup.c
- * @brief test case for testing service startup using new testing API
+ * @file tested/test_testeb_new_servicestartup.c
+ * @brief test case for testing service startup using new testeb API
* @author Sree Harsha Totakura
*/
#include "platform.h"
@@ -42,11 +42,11 @@ static int test_success;
* The testing callback function
*
* @param cls NULL
- * @param cfg the configuration with which the current testing service is run
+ * @param cfg the configuration with which the current testeb service is run
*/
static void
test_run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TESTING_Peer *peer)
+ struct GNUNET_TESTBED_Peer *peer)
{
GNUNET_assert (NULL == cls);
GNUNET_assert (NULL != cfg);
@@ -63,13 +63,13 @@ int
main (int argc, char *argv[])
{
test_success = GNUNET_NO;
- GNUNET_assert (0 == GNUNET_TESTING_service_run
("test-testing-servicestartup",
+ GNUNET_assert (0 == GNUNET_TESTBED_service_run
("test-testing-servicestartup",
"arm",
- "test_testing_defaults.conf",
+ "test_testbed_defaults.conf",
&test_run,
NULL));
return (GNUNET_YES == test_success) ? 0 : 1;
}
-/* end of test_testing_servicestartup.c */
+/* end of test_testbed_servicestartup.c */
diff --git a/src/service/testbed/test_testbed_start_with_config.c
b/src/service/testbed/test_testbed_start_with_config.c
index 76b31dbfb..efe306d85 100644
--- a/src/service/testbed/test_testbed_start_with_config.c
+++ b/src/service/testbed/test_testbed_start_with_config.c
@@ -24,9 +24,8 @@
* @author t3sserakt
*/
#include "platform.h"
-#include "gnunet_testing_ng_lib.h"
-#include "gnunet_testing_netjail_lib.h"
#include "gnunet_util_lib.h"
+#include "testbed_lib.h"
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
diff --git a/src/service/testbed/testing.c b/src/service/testbed/testbed.c
similarity index 55%
rename from src/service/testbed/testing.c
rename to src/service/testbed/testbed.c
index 5e0c0724e..0f39811da 100644
--- a/src/service/testbed/testing.c
+++ b/src/service/testbed/testbed.c
@@ -33,11 +33,7 @@
#include "gnunet_util_lib.h"
#include "gnunet_arm_service.h"
#include "gnunet_testing_lib.h"
-#include "gnunet_testing_ng_lib.h"
-#include "gnunet_testing_plugin.h"
-#include "gnunet_testing_barrier.h"
-#include "gnunet_testing_netjail_lib.h"
-#include "testing_cmds.h"
+#include "testbed_lib.h"
#define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
@@ -118,7 +114,7 @@ struct SharedService
* Handle for a system on which GNUnet peers are executed;
* a system is used for reserving unique paths and ports.
*/
-struct GNUNET_TESTING_System
+struct GNUNET_TESTBED_System
{
/**
* Prefix (e.g. "/tmp/gnunet-testing/") we prepend to each
@@ -138,7 +134,7 @@ struct GNUNET_TESTING_System
char *hostname;
/**
- * Hostkeys data, contains "GNUNET_TESTING_HOSTKEYFILESIZE * total_hostkeys"
bytes.
+ * Hostkeys data, contains "GNUNET_TESTBED_HOSTKEYFILESIZE * total_hostkeys"
bytes.
*/
char *hostkeys_data;
@@ -191,12 +187,12 @@ struct GNUNET_TESTING_System
/**
* Handle for a GNUnet peer controlled by testing.
*/
-struct GNUNET_TESTING_Peer
+struct GNUNET_TESTBED_Peer
{
/**
- * The TESTING system associated with this peer
+ * The TESTBED system associated with this peer
*/
- struct GNUNET_TESTING_System *system;
+ struct GNUNET_TESTBED_System *system;
/**
* Path to the configuration file for this peer.
@@ -204,9 +200,9 @@ struct GNUNET_TESTING_Peer
char *cfgfile;
/**
- * Binary to be executed during 'GNUNET_TESTING_peer_start'.
+ * Binary to be executed during 'GNUNET_TESTBED_peer_start'.
* Typically 'gnunet-service-arm' (but can be set to a
- * specific service by 'GNUNET_TESTING_service_run' if
+ * specific service by 'GNUNET_TESTBED_service_run' if
* necessary).
*/
char *main_binary;
@@ -231,7 +227,7 @@ struct GNUNET_TESTING_Peer
/**
* The callback to call asynchronously when a peer is stopped
*/
- GNUNET_TESTING_PeerStopCallback cb;
+ GNUNET_TESTBED_PeerStopCallback cb;
/**
* The closure for the above callback
@@ -240,7 +236,7 @@ struct GNUNET_TESTING_Peer
/**
* The cached identity of this peer. Will be populated on call to
- * GNUNET_TESTING_peer_get_identity()
+ * GNUNET_TESTBED_peer_get_identity()
*/
struct GNUNET_PeerIdentity *id;
@@ -273,7 +269,7 @@ struct GNUNET_TESTING_Peer
* @return #GNUNET_OK on success; #GNUNET_SYSERR on error
*/
static enum GNUNET_GenericReturnValue
-hostkeys_load (struct GNUNET_TESTING_System *system)
+hostkeys_load (struct GNUNET_TESTBED_System *system)
{
uint64_t fs;
char *data_dir;
@@ -302,7 +298,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system)
GNUNET_free (filename);
return GNUNET_SYSERR; /* File is empty */
}
- if (0 != (fs % GNUNET_TESTING_HOSTKEYFILESIZE))
+ if (0 != (fs % GNUNET_TESTBED_HOSTKEYFILESIZE))
{
LOG (GNUNET_ERROR_TYPE_ERROR,
_ ("Incorrect hostkey file format: %s\n"),
@@ -325,7 +321,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system)
GNUNET_DISK_file_close (fd);
if (NULL == system->hostkeys_data)
return GNUNET_SYSERR;
- system->total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE;
+ system->total_hostkeys = fs / GNUNET_TESTBED_HOSTKEYFILESIZE;
return GNUNET_OK;
}
@@ -336,7 +332,7 @@ hostkeys_load (struct GNUNET_TESTING_System *system)
* @param system the testing system handle
*/
static void
-hostkeys_unload (struct GNUNET_TESTING_System *system)
+hostkeys_unload (struct GNUNET_TESTBED_System *system)
{
GNUNET_break (NULL != system->hostkeys_data);
system->hostkeys_data = NULL;
@@ -375,7 +371,7 @@ cfg_copy_iterator (void *cls,
* all service homes; the directory will be created in a temporary
* location depending on the underlying OS. This variable will be
* overridden with the value of the environmental variable
- * GNUNET_TESTING_PREFIX, if it exists.
+ * GNUNET_TESTBED_PREFIX, if it exists.
* @param trusted_ip the ip address which will be set as TRUSTED HOST in all
* service configurations generated to allow control connections from
* this ip. This can either be a single ip address or a network
address
@@ -388,23 +384,23 @@ cfg_copy_iterator (void *cls,
* @param highport highest port number this system is allowed to allocate
(exclusive)
* @return handle to this system, NULL on error
*/
-struct GNUNET_TESTING_System *
-GNUNET_TESTING_system_create_with_portrange (
+struct GNUNET_TESTBED_System *
+GNUNET_TESTBED_system_create_with_portrange (
const char *testdir,
const char *trusted_ip,
const char *hostname,
- const struct GNUNET_TESTING_SharedService *shared_services,
+ const struct GNUNET_TESTBED_SharedService *shared_services,
uint16_t lowport,
uint16_t highport)
{
- struct GNUNET_TESTING_System *system;
- struct GNUNET_TESTING_SharedService tss;
+ struct GNUNET_TESTBED_System *system;
+ struct GNUNET_TESTBED_SharedService tss;
struct SharedService ss;
unsigned int cnt;
GNUNET_assert (NULL != testdir);
- system = GNUNET_new (struct GNUNET_TESTING_System);
- if (NULL == (system->tmppath = getenv (GNUNET_TESTING_PREFIX)))
+ system = GNUNET_new (struct GNUNET_TESTBED_System);
+ if (NULL == (system->tmppath = getenv (GNUNET_TESTBED_PREFIX)))
system->tmppath = GNUNET_DISK_mkdtemp (testdir);
else
system->tmppath = GNUNET_strdup (system->tmppath);
@@ -421,7 +417,7 @@ GNUNET_TESTING_system_create_with_portrange (
system->hostname = GNUNET_strdup (hostname);
if (GNUNET_OK != hostkeys_load (system))
{
- GNUNET_TESTING_system_destroy (system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
return NULL;
}
if (NULL == shared_services)
@@ -437,7 +433,7 @@ GNUNET_TESTING_system_create_with_portrange (
&cfg_copy_iterator,
ss.cfg);
GNUNET_CONFIGURATION_iterate_section_values (tss.cfg,
- "TESTING",
+ "TESTBED",
&cfg_copy_iterator,
ss.cfg);
GNUNET_CONFIGURATION_iterate_section_values (tss.cfg,
@@ -462,7 +458,7 @@ GNUNET_TESTING_system_create_with_portrange (
* service homes; the directory will be created in a temporary
location
* depending on the underlying OS. This variable will be
* overridden with the value of the environmental variable
- * GNUNET_TESTING_PREFIX, if it exists.
+ * GNUNET_TESTBED_PREFIX, if it exists.
* @param trusted_ip the ip address which will be set as TRUSTED HOST in all
* service configurations generated to allow control connections from
* this ip. This can either be a single ip address or a network
address
@@ -473,14 +469,14 @@ GNUNET_TESTING_system_create_with_portrange (
* be shared among peers
* @return handle to this system, NULL on error
*/
-struct GNUNET_TESTING_System *
-GNUNET_TESTING_system_create (
+struct GNUNET_TESTBED_System *
+GNUNET_TESTBED_system_create (
const char *testdir,
const char *trusted_ip,
const char *hostname,
- const struct GNUNET_TESTING_SharedService *shared_services)
+ const struct GNUNET_TESTBED_SharedService *shared_services)
{
- return GNUNET_TESTING_system_create_with_portrange (testdir,
+ return GNUNET_TESTBED_system_create_with_portrange (testdir,
trusted_ip,
hostname,
shared_services,
@@ -554,7 +550,7 @@ stop_shared_service_instance (struct SharedServiceInstance
*i)
* be removed (clean up on shutdown)?
*/
void
-GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
+GNUNET_TESTBED_system_destroy (struct GNUNET_TESTBED_System *system,
int remove_paths)
{
struct SharedService *ss;
@@ -595,7 +591,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System
*system,
* @return 0 if no free port was available
*/
uint16_t
-GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system)
+GNUNET_TESTBED_reserve_port (struct GNUNET_TESTBED_System *system)
{
struct GNUNET_NETWORK_Handle *socket;
struct addrinfo hint;
@@ -685,13 +681,13 @@ GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System
*system)
/**
* Release reservation of a TCP or UDP port for a peer
- * (used during #GNUNET_TESTING_peer_destroy()).
+ * (used during #GNUNET_TESTBED_peer_destroy()).
*
* @param system system to use for reservation tracking
* @param port reserved port to release
*/
void
-GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system,
+GNUNET_TESTBED_release_port (struct GNUNET_TESTBED_System *system,
uint16_t port)
{
uint32_t *port_buckets;
@@ -720,7 +716,7 @@ GNUNET_TESTING_release_port (struct GNUNET_TESTING_System
*system,
* GNUnet source code.
*
* This is primarily a helper function used internally
- * by #GNUNET_TESTING_peer_configure.
+ * by #GNUNET_TESTBED_peer_configure.
*
* @param system the testing system handle
* @param key_number desired pre-created hostkey to obtain
@@ -729,7 +725,7 @@ GNUNET_TESTING_release_port (struct GNUNET_TESTING_System
*system,
* @return NULL on error (not enough keys)
*/
struct GNUNET_CRYPTO_EddsaPrivateKey *
-GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
+GNUNET_TESTBED_hostkey_get (const struct GNUNET_TESTBED_System *system,
uint32_t key_number,
struct GNUNET_PeerIdentity *id)
{
@@ -747,8 +743,8 @@ GNUNET_TESTING_hostkey_get (const struct
GNUNET_TESTING_System *system,
private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey);
GNUNET_memcpy (private_key,
system->hostkeys_data
- + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
- GNUNET_TESTING_HOSTKEYFILESIZE);
+ + (key_number * GNUNET_TESTBED_HOSTKEYFILESIZE),
+ GNUNET_TESTBED_HOSTKEYFILESIZE);
GNUNET_CRYPTO_eddsa_key_get_public (private_key, &id->public_key);
return private_key;
}
@@ -763,7 +759,7 @@ struct UpdateContext
/**
* The system for which we are building configurations
*/
- struct GNUNET_TESTING_System *system;
+ struct GNUNET_TESTBED_System *system;
/**
* The configuration we are building
@@ -833,7 +829,7 @@ update_config (void *cls,
"testing",
single_variable)))
{
- new_port = GNUNET_TESTING_reserve_port (uc->system);
+ new_port = GNUNET_TESTBED_reserve_port (uc->system);
if (0 == new_port)
{
uc->status = GNUNET_SYSERR;
@@ -919,12 +915,12 @@ update_config_sections (void *cls, const char *section)
/* Ignore certain options from sections. See
https://gnunet.org/bugs/view.php?id=2476 */
if (GNUNET_YES ==
- GNUNET_CONFIGURATION_have_value (uc->cfg, section,
"TESTING_IGNORE_KEYS"))
+ GNUNET_CONFIGURATION_have_value (uc->cfg, section,
"TESTBED_IGNORE_KEYS"))
{
GNUNET_assert (GNUNET_YES ==
GNUNET_CONFIGURATION_get_value_string (uc->cfg,
section,
-
"TESTING_IGNORE_KEYS",
+
"TESTBED_IGNORE_KEYS",
&val));
ptr = val;
for (ikeys_cnt = 0; NULL != (ptr = strstr (ptr, ";")); ikeys_cnt++)
@@ -1008,7 +1004,7 @@ update_config_sections (void *cls, const char *section)
static struct SharedServiceInstance *
-associate_shared_service (struct GNUNET_TESTING_System *system,
+associate_shared_service (struct GNUNET_TESTBED_System *system,
struct SharedService *ss,
struct GNUNET_CONFIGURATION_Handle *cfg)
{
@@ -1030,7 +1026,7 @@ associate_shared_service (struct GNUNET_TESTING_System
*system,
ss->sname,
ss->n_instances);
(void) GNUNET_asprintf (&i->unix_sock, "%s/sock", gnunet_home);
- port = GNUNET_TESTING_reserve_port (system);
+ port = GNUNET_TESTBED_reserve_port (system);
if (0 == port)
{
GNUNET_free (gnunet_home);
@@ -1090,7 +1086,7 @@ associate_shared_service (struct GNUNET_TESTING_System
*system,
* out of "*port" numbers, return #GNUNET_SYSERR.
*
* This is primarily a helper function used internally
- * by 'GNUNET_TESTING_peer_configure'.
+ * by 'GNUNET_TESTBED_peer_configure'.
*
* @param system system to use to coordinate resource usage
* @param cfg template configuration to update
@@ -1101,7 +1097,7 @@ associate_shared_service (struct GNUNET_TESTING_System
*system,
* be incomplete and should not be used there upon
*/
static int
-GNUNET_TESTING_configuration_create_ (struct GNUNET_TESTING_System *system,
+GNUNET_TESTBED_configuration_create_ (struct GNUNET_TESTBED_System *system,
struct GNUNET_CONFIGURATION_Handle *cfg,
uint16_t **ports,
unsigned int *nports)
@@ -1156,7 +1152,7 @@ GNUNET_TESTING_configuration_create_ (struct
GNUNET_TESTING_System *system,
* out of "*port" numbers, return #GNUNET_SYSERR.
*
* This is primarily a helper function used internally
- * by #GNUNET_TESTING_peer_configure().
+ * by #GNUNET_TESTBED_peer_configure().
*
* @param system system to use to coordinate resource usage
* @param cfg template configuration to update
@@ -1164,10 +1160,10 @@ GNUNET_TESTING_configuration_create_ (struct
GNUNET_TESTING_System *system,
* be incomplete and should not be used there upon
*/
int
-GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system,
+GNUNET_TESTBED_configuration_create (struct GNUNET_TESTBED_System *system,
struct GNUNET_CONFIGURATION_Handle *cfg)
{
- return GNUNET_TESTING_configuration_create_ (system, cfg, NULL, NULL);
+ return GNUNET_TESTBED_configuration_create_ (system, cfg, NULL, NULL);
}
@@ -1184,14 +1180,14 @@ GNUNET_TESTING_configuration_create (struct
GNUNET_TESTING_System *system,
* can be NULL
* @return handle to the peer, NULL on error
*/
-struct GNUNET_TESTING_Peer *
-GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
+struct GNUNET_TESTBED_Peer *
+GNUNET_TESTBED_peer_configure (struct GNUNET_TESTBED_System *system,
struct GNUNET_CONFIGURATION_Handle *cfg,
uint32_t key_number,
struct GNUNET_PeerIdentity *id,
char **emsg)
{
- struct GNUNET_TESTING_Peer *peer;
+ struct GNUNET_TESTBED_Peer *peer;
struct GNUNET_DISK_FileHandle *fd;
char *hostkey_filename;
char *config_filename;
@@ -1220,7 +1216,7 @@ GNUNET_TESTING_peer_configure (struct
GNUNET_TESTING_System *system,
}
pk = NULL;
if ((NULL != id) &&
- (NULL == (pk = GNUNET_TESTING_hostkey_get (system, key_number, id))))
+ (NULL == (pk = GNUNET_TESTBED_hostkey_get (system, key_number, id))))
{
GNUNET_asprintf (&emsg_,
_ ("Failed to initialize hostkey for peer %u\n"),
@@ -1243,7 +1239,7 @@ GNUNET_TESTING_peer_configure (struct
GNUNET_TESTING_System *system,
GNUNET_CONFIGURATION_remove_section (cfg, ss->sname);
}
if (GNUNET_OK !=
- GNUNET_TESTING_configuration_create_ (system, cfg, &ports, &nports))
+ GNUNET_TESTBED_configuration_create_ (system, cfg, &ports, &nports))
{
GNUNET_asprintf (&emsg_,
_ ("Failed to create configuration for peer "
@@ -1269,11 +1265,11 @@ GNUNET_TESTING_peer_configure (struct
GNUNET_TESTING_System *system,
goto err_ret;
}
GNUNET_free (hostkey_filename);
- if (GNUNET_TESTING_HOSTKEYFILESIZE !=
+ if (GNUNET_TESTBED_HOSTKEYFILESIZE !=
GNUNET_DISK_file_write (fd,
system->hostkeys_data
- + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
- GNUNET_TESTING_HOSTKEYFILESIZE))
+ + (key_number * GNUNET_TESTBED_HOSTKEYFILESIZE),
+ GNUNET_TESTBED_HOSTKEYFILESIZE))
{
GNUNET_asprintf (&emsg_,
_ ("Failed to write hostkey file for peer %u: %s\n"),
@@ -1311,7 +1307,7 @@ GNUNET_TESTING_peer_configure (struct
GNUNET_TESTING_System *system,
GNUNET_free (config_filename);
goto err_ret;
}
- peer = GNUNET_new (struct GNUNET_TESTING_Peer);
+ peer = GNUNET_new (struct GNUNET_TESTBED_Peer);
peer->ss_instances = ss_instances;
peer->cfgfile = config_filename; /* Free in peer_destroy */
peer->cfg = GNUNET_CONFIGURATION_dup (cfg);
@@ -1356,7 +1352,7 @@ err_ret:
* @param id identifier for the daemon, will be set
*/
void
-GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
+GNUNET_TESTBED_peer_get_identity (struct GNUNET_TESTBED_Peer *peer,
struct GNUNET_PeerIdentity *id)
{
if (NULL != peer->id)
@@ -1366,7 +1362,7 @@ GNUNET_TESTING_peer_get_identity (struct
GNUNET_TESTING_Peer *peer,
}
peer->id = GNUNET_new (struct GNUNET_PeerIdentity);
GNUNET_free_nz (
- GNUNET_TESTING_hostkey_get (peer->system, peer->key_number, peer->id));
+ GNUNET_TESTBED_hostkey_get (peer->system, peer->key_number, peer->id));
GNUNET_memcpy (id, peer->id, sizeof(struct GNUNET_PeerIdentity));
}
@@ -1378,7 +1374,7 @@ GNUNET_TESTING_peer_get_identity (struct
GNUNET_TESTING_Peer *peer,
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error (i.e. peer already
running)
*/
int
-GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
+GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer)
{
struct SharedServiceInstance *i;
unsigned int cnt;
@@ -1427,7 +1423,7 @@ GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer
*peer)
* or upon any error while sending SIGTERM
*/
int
-GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer *peer)
+GNUNET_TESTBED_peer_kill (struct GNUNET_TESTBED_Peer *peer)
{
struct SharedServiceInstance *i;
unsigned int cnt;
@@ -1459,7 +1455,7 @@ GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer
*peer)
* or upon any error while waiting
*/
int
-GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer)
+GNUNET_TESTBED_peer_wait (struct GNUNET_TESTBED_Peer *peer)
{
int ret;
@@ -1482,11 +1478,11 @@ GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer
*peer)
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
int
-GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer)
+GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer)
{
- if (GNUNET_SYSERR == GNUNET_TESTING_peer_kill (peer))
+ if (GNUNET_SYSERR == GNUNET_TESTBED_peer_kill (peer))
return GNUNET_SYSERR;
- if (GNUNET_SYSERR == GNUNET_TESTING_peer_wait (peer))
+ if (GNUNET_SYSERR == GNUNET_TESTBED_peer_wait (peer))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -1502,7 +1498,7 @@ GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer
*peer)
static void
disconn_status (void *cls, int connected)
{
- struct GNUNET_TESTING_Peer *peer = cls;
+ struct GNUNET_TESTBED_Peer *peer = cls;
if (GNUNET_SYSERR == connected)
{
@@ -1511,10 +1507,10 @@ disconn_status (void *cls, int connected)
}
if (GNUNET_YES == connected)
{
- GNUNET_break (GNUNET_OK == GNUNET_TESTING_peer_kill (peer));
+ GNUNET_break (GNUNET_OK == GNUNET_TESTBED_peer_kill (peer));
return;
}
- GNUNET_break (GNUNET_OK == GNUNET_TESTING_peer_wait (peer));
+ GNUNET_break (GNUNET_OK == GNUNET_TESTBED_peer_wait (peer));
GNUNET_ARM_disconnect (peer->ah);
peer->ah = NULL;
peer->cb (peer->cb_cls, peer, GNUNET_YES);
@@ -1522,8 +1518,8 @@ disconn_status (void *cls, int connected)
int
-GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer,
- GNUNET_TESTING_PeerStopCallback cb,
+GNUNET_TESTBED_peer_stop_async (struct GNUNET_TESTBED_Peer *peer,
+ GNUNET_TESTBED_PeerStopCallback cb,
void *cb_cls)
{
if (NULL == peer->main_process)
@@ -1539,15 +1535,15 @@ GNUNET_TESTING_peer_stop_async (struct
GNUNET_TESTING_Peer *peer,
/**
* Cancel a previous asynchronous peer stop request.
- * GNUNET_TESTING_peer_stop_async() should have been called before on the given
+ * GNUNET_TESTBED_peer_stop_async() should have been called before on the given
* peer. It is an error to call this function if the peer stop callback was
* already called
*
- * @param peer the peer on which GNUNET_TESTING_peer_stop_async() was called
+ * @param peer the peer on which GNUNET_TESTBED_peer_stop_async() was called
* before.
*/
void
-GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer)
+GNUNET_TESTBED_peer_stop_async_cancel (struct GNUNET_TESTBED_Peer *peer)
{
GNUNET_assert (NULL != peer->ah);
GNUNET_ARM_disconnect (peer->ah);
@@ -1563,12 +1559,12 @@ GNUNET_TESTING_peer_stop_async_cancel (struct
GNUNET_TESTING_Peer *peer)
* @param peer peer to destroy
*/
void
-GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer)
+GNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer)
{
unsigned int cnt;
if (NULL != peer->main_process)
- GNUNET_TESTING_peer_stop (peer);
+ GNUNET_TESTBED_peer_stop (peer);
if (NULL != peer->ah)
GNUNET_ARM_disconnect (peer->ah);
GNUNET_free (peer->cfgfile);
@@ -1581,7 +1577,7 @@ GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer
*peer)
if (NULL != peer->ports)
{
for (cnt = 0; cnt < peer->nports; cnt++)
- GNUNET_TESTING_release_port (peer->system, peer->ports[cnt]);
+ GNUNET_TESTBED_release_port (peer->system, peer->ports[cnt]);
GNUNET_free (peer->ports);
}
GNUNET_free (peer);
@@ -1589,12 +1585,12 @@ GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer
*peer)
int
-GNUNET_TESTING_peer_run (const char *testdir,
+GNUNET_TESTBED_peer_run (const char *testdir,
const char *cfgfilename,
- GNUNET_TESTING_TestMain tm,
+ GNUNET_TESTBED_TestMain tm,
void *tm_cls)
{
- return GNUNET_TESTING_service_run (testdir, "arm", cfgfilename, tm, tm_cls);
+ return GNUNET_TESTBED_service_run (testdir, "arm", cfgfilename, tm, tm_cls);
}
@@ -1611,12 +1607,12 @@ struct ServiceContext
/**
* Callback to signal service startup
*/
- GNUNET_TESTING_TestMain tm;
+ GNUNET_TESTBED_TestMain tm;
/**
* The peer in which the service is run.
*/
- struct GNUNET_TESTING_Peer *peer;
+ struct GNUNET_TESTBED_Peer *peer;
/**
* Closure for the above callback
@@ -1640,21 +1636,21 @@ service_run_main (void *cls)
int
-GNUNET_TESTING_service_run (const char *testdir,
+GNUNET_TESTBED_service_run (const char *testdir,
const char *service_name,
const char *cfgfilename,
- GNUNET_TESTING_TestMain tm,
+ GNUNET_TESTBED_TestMain tm,
void *tm_cls)
{
struct ServiceContext sc;
- struct GNUNET_TESTING_System *system;
- struct GNUNET_TESTING_Peer *peer;
+ struct GNUNET_TESTBED_System *system;
+ struct GNUNET_TESTBED_Peer *peer;
struct GNUNET_CONFIGURATION_Handle *cfg;
char *binary;
char *libexec_binary;
GNUNET_log_setup (testdir, "WARNING", NULL);
- system = GNUNET_TESTING_system_create (testdir, "127.0.0.1", NULL, NULL);
+ system = GNUNET_TESTBED_system_create (testdir, "127.0.0.1", NULL, NULL);
if (NULL == system)
return 1;
cfg = GNUNET_CONFIGURATION_create ();
@@ -1664,15 +1660,15 @@ GNUNET_TESTING_service_run (const char *testdir,
_ ("Failed to load configuration from %s\n"),
cfgfilename);
GNUNET_CONFIGURATION_destroy (cfg);
- GNUNET_TESTING_system_destroy (system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
return 1;
}
- peer = GNUNET_TESTING_peer_configure (system, cfg, 0, NULL, NULL);
+ peer = GNUNET_TESTBED_peer_configure (system, cfg, 0, NULL, NULL);
if (NULL == peer)
{
GNUNET_CONFIGURATION_destroy (cfg);
hostkeys_unload (system);
- GNUNET_TESTING_system_destroy (system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
return 1;
}
GNUNET_free (peer->main_binary);
@@ -1694,11 +1690,11 @@ GNUNET_TESTING_service_run (const char *testdir,
GNUNET_free (libexec_binary);
GNUNET_free (binary);
- if (GNUNET_OK != GNUNET_TESTING_peer_start (peer))
+ if (GNUNET_OK != GNUNET_TESTBED_peer_start (peer))
{
- GNUNET_TESTING_peer_destroy (peer);
+ GNUNET_TESTBED_peer_destroy (peer);
GNUNET_CONFIGURATION_destroy (cfg);
- GNUNET_TESTING_system_destroy (system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
return 1;
}
sc.cfg = cfg;
@@ -1707,1135 +1703,23 @@ GNUNET_TESTING_service_run (const char *testdir,
sc.peer = peer;
GNUNET_SCHEDULER_run (&service_run_main, &sc); /* Scheduler loop */
if ((NULL != peer->main_process) &&
- (GNUNET_OK != GNUNET_TESTING_peer_stop (peer)))
+ (GNUNET_OK != GNUNET_TESTBED_peer_stop (peer)))
{
- GNUNET_TESTING_peer_destroy (peer);
+ GNUNET_TESTBED_peer_destroy (peer);
GNUNET_CONFIGURATION_destroy (cfg);
- GNUNET_TESTING_system_destroy (system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
return 1;
}
- GNUNET_TESTING_peer_destroy (peer);
+ GNUNET_TESTBED_peer_destroy (peer);
GNUNET_CONFIGURATION_destroy (cfg);
- GNUNET_TESTING_system_destroy (system, GNUNET_YES);
+ GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
return 0;
}
-/**
- * Every line in the topology configuration starts with a string indicating
which
- * kind of information will be configured with this line. Configuration values
following
- * this string are seperated by special sequences of characters. An integer
value seperated
- * by ':' is returned by this function.
- *
- * @param line The line of configuration.
- * @return An integer value.
- */
-static unsigned int
-get_first_value (const char *line)
-{
- char *copy;
- size_t slen;
- char *token;
- unsigned int ret;
- char *rest = NULL;
-
- slen = strlen (line) + 1;
- copy = GNUNET_malloc (slen);
- memcpy (copy, line, slen);
- token = strtok_r (copy, ":", &rest);
- token = strtok_r (NULL, ":", &rest);
- GNUNET_assert (1 == sscanf (token, "%u", &ret));
- GNUNET_free (copy);
- return ret;
-}
-
-
-/**
- * Every line in the topology configuration starts with a string indicating
which
- * kind of information will be configured with this line. This string is
returned by this function.
- *
- * @param line The line of configuration.
- * @return The leading string of this configuration line.
- */
-static char *
-get_key (const char *line)
-{
- char *copy;
- size_t slen;
- size_t tlen;
- char *token;
- char *ret;
- char *rest = NULL;
-
- slen = strlen (line) + 1;
- copy = GNUNET_malloc (slen);
- memcpy (copy, line, slen);
- token = strtok_r (copy, ":", &rest);
- tlen = strlen (token) + 1;
- ret = GNUNET_malloc (tlen);
- memcpy (ret, token, tlen);
- GNUNET_free (copy);
- return ret;
-}
-
-
-/**
- * Every line in the topology configuration starts with a string indicating
which
- * kind of information will be configured with this line. Configuration values
following
- * this string are seperated by special sequences of characters. A string
value seperated
- * by ':' is returned by this function.
- *
- * @param line The line of configuration.
- * @return A string value.
- */
-static char *
-get_first_string_value (const char *line)
-{
- char *copy;
- size_t slen, slen_token;
- char *token;
- char *ret;
- char *rest = NULL;
-
- slen = strlen (line) + 1;
- copy = GNUNET_malloc (slen);
- memcpy (copy, line, slen);
- token = strtok_r (copy, ":", &rest);
- token = strtok_r (NULL, ":", &rest);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "first token %s\n",
- token);
- slen_token = strlen (token);
- ret = GNUNET_malloc (slen_token + 1);
- memcpy (ret, token, slen_token + 1);
- GNUNET_free (copy);
- return ret;
-}
-
-
-/**
- * Every line in the topology configuration starts with a string indicating
which
- * kind of information will be configured with this line. Configuration values
following
- * this string are seperated by special sequences of characters. A second
integer value
- * seperated by ':' from a first value is returned by this function.
- *
- * @param line The line of configuration.
- * @return An integer value.
- */
-static unsigned int
-get_second_value (const char *line)
-{
- char *copy;
- char *token;
- unsigned int ret;
- char *rest = NULL;
-
- copy = GNUNET_strdup (line);
- token = strtok_r (copy, ":", &rest);
- token = strtok_r (NULL, ":", &rest);
- token = strtok_r (NULL, ":", &rest);
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "Format error in configuration line: %s\n",
- line);
- GNUNET_assert (1 == sscanf (token, "%u", &ret));
- GNUNET_free (copy);
- return ret;
-}
-
-
-/**
- * Every line in the topology configuration starts with a string indicating
which
- * kind of information will be configured with this line. Configuration values
following
- * this string are seperated by special sequences of characters. A value might
be
- * a key value pair.
- * This function returns the value for a specific key in a configuration line.
- *
- * @param key The key of the key value pair.
- * @return The value of the key value pair.
- */
-static char *
-get_value (const char *key, const char *line)
-{
- char copy[strlen (line) + 1];
- size_t slen;
- char *token;
- char *token2;
- char *temp;
- char *rest = NULL;
-
- slen = strlen (line) + 1;
- memcpy (copy, line, slen);
- temp = strstr (copy, key);
- if (NULL == temp)
- return NULL;
- token = strtok_r (temp, ":", &rest);
- if (NULL == token)
- return NULL;
- token = strtok_r (NULL, ":", &rest);
- if (NULL == token)
- return NULL;
- token2 = strtok_r (token, "}", &rest);
- if (NULL == token2)
- return NULL;
- return GNUNET_strdup (token2);
-}
-
-
-/**
- * Every line in the topology configuration starts with a string indicating
which
- * kind of information will be configured with this line. Configuration values
following
- * this string are seperated by special sequences of characters. A value might
be
- * a key value pair. A special key is the 'connect' key which can appear more
than once.
- * The value is the information about a connection via some protocol to some
other node.
- * This function returns the struct GNUNET_TESTING_NodeConnection which holds
the information
- * of the connect value.
- *
- * @param value The value of the connect key value pair.
- * @return The struct GNUNET_TESTING_NodeConnection.
- */
-static struct GNUNET_TESTING_NodeConnection *
-get_connect_value (const char *line,
- struct GNUNET_TESTING_NetjailNode *node)
-{
- struct GNUNET_TESTING_NodeConnection *node_connection;
- char *copy;
- char *token;
- char *token2;
- unsigned int node_n;
- unsigned int namespace_n;
- char *rest = NULL;
- char *rest2 = NULL;
- struct GNUNET_TESTING_AddressPrefix *prefix;
- unsigned int sscanf_ret;
-
- node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection);
- node_connection->node = node;
-
- copy = GNUNET_strdup (line);
- token = strtok_r (copy, ":", &rest);
- if (0 == strcmp ("{K", token))
- {
- node_connection->node_type = GNUNET_TESTING_GLOBAL_NODE;
- token = strtok_r (NULL, ":", &rest);
- GNUNET_assert (1 == sscanf (token, "%u", &node_n));
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "node_n %u\n",
- node_n);
- node_connection->node_n = node_n;
- node_connection->namespace_n = 0;
- }
- else if (0 == strcmp ("{P", token))
- {
- node_connection->node_type = GNUNET_TESTING_SUBNET_NODE;
- token = strtok_r (NULL, ":", &rest);
- errno = 0;
- sscanf_ret = sscanf (token, "%u", &namespace_n);
- if (errno != 0)
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
- }
- GNUNET_assert (0 < sscanf_ret);
- node_connection->namespace_n = namespace_n;
- token = strtok_r (NULL, ":", &rest);
- errno = 0;
- sscanf_ret = sscanf (token, "%u", &node_n);
- if (errno != 0)
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
- }
- GNUNET_assert (0 < sscanf_ret);
- node_connection->node_n = node_n;
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "node_n %u namespace_n %u node->node_n %u node->namespace_n %u\n",
- node_n,
- namespace_n,
- node->node_n,
- node->namespace_n);
- }
- else
- {
- GNUNET_break (0);
- GNUNET_free (node_connection);
- GNUNET_free (copy);
- return NULL;
- }
-
- while (NULL != (token = strtok_r (NULL, ":", &rest)))
- {
- prefix = GNUNET_new (struct GNUNET_TESTING_AddressPrefix);
- token2 = strtok_r (token, "}", &rest2);
- if (NULL != token2)
- prefix->address_prefix = GNUNET_strdup (token2);
- else
- prefix->address_prefix = GNUNET_strdup (token);
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "address_prefix %s\n",
- prefix->address_prefix);
-
- GNUNET_CONTAINER_DLL_insert (node_connection->address_prefixes_head,
- node_connection->address_prefixes_tail,
- prefix);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "address_prefix %s\n",
- prefix->address_prefix);
- }
-
- GNUNET_free (copy);
- return node_connection;
-}
-
-
-/**
- * Every line in the topology configuration starts with a string indicating
which
- * kind of information will be configured with this line. Configuration values
following
- * this string are seperated by special sequences of characters. A value might
be
- * a key value pair. A special key is the 'connect' key.
- * The value is the information about a connections via some protocol to other
nodes.
- * Each connection itself is a key value pair separated by the character '|'
and
- * surrounded by the characters '{' and '}'.
- * The struct GNUNET_TESTING_NodeConnection holds the information of each
connection value.
- * This function extracts the values of each connection into a DLL of
- * struct GNUNET_TESTING_NodeConnection which will be added to a node.
- *
- * @param line The line of configuration.
- * @param node The struct GNUNET_TESTING_NetjailNode to which the DLL of
- * struct GNUNET_TESTING_NodeConnection will be added.
- */
-static void
-node_connections (const char *line, struct GNUNET_TESTING_NetjailNode *node)
-{
- char *value, *value2;
- char *temp;
- char *copy;
- char *rest = NULL;
- char *rest2 = NULL;
- struct GNUNET_TESTING_NodeConnection *node_connection;
-
-
- temp = strstr (line, "connect");
- if (NULL != temp)
- {
- copy = GNUNET_strdup (temp);
- strtok_r (copy, ":", &rest);
- value = strtok_r (rest, "|", &rest2);
-
- while (NULL != value)
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "node_connections value %s\n",
- value);
- node_connection = get_connect_value (value, node);
- if (NULL == node_connection)
- {
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "connect key was not expected in this configuration line: %s\n",
- line);
- break;
- }
- GNUNET_CONTAINER_DLL_insert (node->node_connections_head,
- node->node_connections_tail,
- node_connection);
- value2 = strstr (value, "}}");
- if (NULL != value2)
- break;
- value = strtok_r (NULL, "|", &rest2);
-
- }
- GNUNET_free (copy);
- }
-}
-
-
-/**
- * A helper function to log information about individual nodes.
- *
- * @param cls This is not used actually.
- * @param id The key of this value in the map.
- * @param value A struct GNUNET_TESTING_NetjailNode which holds information
about a node.
- * return GNUNET_YES to continue with iterating, GNUNET_NO otherwise.
- */
-static int
-log_nodes (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
-{
- struct GNUNET_TESTING_NetjailNode *node = value;
- struct GNUNET_TESTING_NodeConnection *pos_connection;
- struct GNUNET_TESTING_AddressPrefix *pos_prefix;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "plugin: %s space: %u node: %u global: %u\n",
- node->plugin,
- node->namespace_n,
- node->node_n,
- node->is_global);
-
- for (pos_connection = node->node_connections_head; NULL != pos_connection;
- pos_connection = pos_connection->next)
- {
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "namespace_n: %u node_n: %u node_type: %u\n",
- pos_connection->namespace_n,
- pos_connection->node_n,
- pos_connection->node_type);
-
- for (pos_prefix = pos_connection->address_prefixes_head; NULL !=
pos_prefix;
- pos_prefix =
- pos_prefix->next)
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "prefix: %s\n",
- pos_prefix->address_prefix);
- }
- }
- return GNUNET_YES;
-}
-
-
-/**
- * Helper function to log information about namespaces.
- *
- * @param cls This is not used actually.
- * @param id The key of this value in the map.
- * @param value A struct GNUNET_TESTING_NetjailNamespace which holds
information about a subnet.
- * return GNUNET_YES to continue with iterating, GNUNET_NO otherwise.
- */
-static int
-log_namespaces (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
-{
- struct GNUNET_TESTING_NetjailNamespace *namespace = value;
-
- GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes, &log_nodes, NULL);
- return GNUNET_YES;
-}
-
-
-/**
- * Helper function to log the configuration in case of a problem with
configuration.
- *
- * @param topology The struct GNUNET_TESTING_NetjailTopology holding the
configuration information.
- */
-static int
-log_topo (const struct GNUNET_TESTING_NetjailTopology *topology)
-{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "plugin: %s spaces: %u nodes: %u known: %u\n",
- topology->plugin,
- topology->namespaces_n,
- topology->nodes_m,
- topology->nodes_x);
-
- GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces,
- log_namespaces, NULL);
- GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals, &log_nodes,
- NULL);
- return GNUNET_YES;
-}
-
-
-/**
- * This function extracts information about a specific node from the topology.
- *
- * @param num The global index number of the node.
- * @param[out] node_ex A struct GNUNET_TESTING_NetjailNode with information
about the node.
- * @param[out] namespace_ex A struct GNUNET_TESTING_NetjailNamespace with
information about the namespace
- the node is in or NULL, if the node is a global node.
- * @param[out] node_connections_ex A struct GNUNET_TESTING_NodeConnection with
information about the connection
- of this node to other nodes.
-*/
-static void
-get_node_info (unsigned int num,
- const struct GNUNET_TESTING_NetjailTopology *topology,
- struct GNUNET_TESTING_NetjailNode **node_ex,
- struct GNUNET_TESTING_NetjailNamespace **namespace_ex,
- struct GNUNET_TESTING_NodeConnection **node_connections_ex)
-{
- struct GNUNET_ShortHashCode hkey;
- struct GNUNET_HashCode hc;
- unsigned int namespace_n;
- unsigned int node_m;
- struct GNUNET_TESTING_NetjailNode *node;
- struct GNUNET_TESTING_NetjailNamespace *namespace;
- struct GNUNET_TESTING_NodeConnection *node_connections = NULL;
-
- log_topo (topology);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "num: %u \n",
- num);
- if (topology->nodes_x >= num)
- {
-
- GNUNET_CRYPTO_hash (&num, sizeof(num), &hc);
- memcpy (&hkey,
- &hc,
- sizeof (hkey));
- node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
- &hkey);
- if (NULL != node)
- {
- *node_ex = node;
- *node_connections_ex = node->node_connections_head;
- }
- }
- else
- {
- namespace_n = (unsigned int) ceil ((double) (num - topology->nodes_x)
- / topology->nodes_m);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "ceil num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n",
- num,
- topology->nodes_x,
- topology->nodes_m,
- namespace_n);
- GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc);
- memcpy (&hkey,
- &hc,
- sizeof (hkey));
- namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
- &hkey);
- if (NULL != namespace)
- {
- node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
- GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
- memcpy (&hkey,
- &hc,
- sizeof (hkey));
- node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
- &hkey);
- if (NULL != node)
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "node additional_connects: %u %p\n",
- node->additional_connects,
- node);
- node_connections = node->node_connections_head;
- }
- *node_ex = node;
- *namespace_ex = namespace;
- *node_connections_ex = node_connections;
- }
- }
-}
-
-
-/**
- * Get a node from the topology.
- *
- * @param num The specific node we want the connections for.
- * @param topology The topology we get the connections from.
- * @return The connections of the node.
- */
-struct GNUNET_TESTING_NetjailNode *
-GNUNET_TESTING_get_node (unsigned int num,
- struct GNUNET_TESTING_NetjailTopology *topology)
-{
- struct GNUNET_TESTING_NetjailNode *node;
- struct GNUNET_TESTING_NetjailNamespace *namespace;
- struct GNUNET_TESTING_NodeConnection *node_connections;
-
- get_node_info (num, topology, &node, &namespace, &node_connections);
-
- return node;
-
-}
-
-
-/**
- * Get the connections to other nodes for a specific node.
- *
- * @param num The specific node we want the connections for.
- * @param topology The topology we get the connections from.
- * @return The connections of the node.
- */
-struct GNUNET_TESTING_NodeConnection *
-GNUNET_TESTING_get_connections (unsigned int num,
- const struct
- GNUNET_TESTING_NetjailTopology *topology)
-{
- struct GNUNET_TESTING_NetjailNode *node;
- struct GNUNET_TESTING_NetjailNamespace *namespace;
- struct GNUNET_TESTING_NodeConnection *node_connections;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "get_connections\n");
-
- get_node_info (num, topology, &node, &namespace, &node_connections);
-
- return node_connections;
-}
-
-
-/**
- * Retrieve the peer identity from the test system with the unique node id.
- *
- * @param num The unique node id.
- * @param tl_system The test system.
- * @return The peer identity wrapping the public key.
- */
-struct GNUNET_PeerIdentity *
-GNUNET_TESTING_get_peer (unsigned int num,
- const struct GNUNET_TESTING_System *tl_system)
-{
- struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
- struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key;
-
- priv_key = GNUNET_TESTING_hostkey_get (tl_system,
- num,
- peer);
-
- GNUNET_CRYPTO_eddsa_key_get_public (priv_key,
- &peer->public_key);
- GNUNET_free (priv_key);
- return peer;
-}
-
-
-int
-free_nodes_cb (void *cls,
- const struct GNUNET_ShortHashCode *key,
- void *value)
-{
- (void) cls;
- struct GNUNET_TESTING_NetjailNode *node = value;
- struct GNUNET_TESTING_NodeConnection *pos_connection;
- struct GNUNET_TESTING_AddressPrefix *pos_prefix;
-
- while (NULL != (pos_connection = node->node_connections_head))
- {
- while (NULL != (pos_prefix = pos_connection->address_prefixes_head))
- {
- GNUNET_CONTAINER_DLL_remove (pos_connection->address_prefixes_head,
- pos_connection->address_prefixes_tail,
- pos_prefix);
- GNUNET_free (pos_prefix->address_prefix);
- GNUNET_free (pos_prefix);
- }
- GNUNET_CONTAINER_DLL_remove (node->node_connections_head,
- node->node_connections_tail,
- pos_connection);
- GNUNET_free (pos_connection);
- }
-
- GNUNET_free (node->plugin);
- GNUNET_free (node);
- return GNUNET_OK;
-}
-
-
-int
-free_namespaces_cb (void *cls,
- const struct GNUNET_ShortHashCode *key,
- void *value)
-{
- (void) cls;
- struct GNUNET_TESTING_NetjailNamespace *namespace = value;
-
- GNUNET_free (namespace->router);
- GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes, free_nodes_cb,
- namespace->nodes);
- return GNUNET_OK;
-
-}
-
-
-/**
- * Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
- *
- * @param topology The GNUNET_TESTING_NetjailTopology to be deallocated.
- */
-void
-GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology)
-{
- GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces,
- free_namespaces_cb, NULL);
- GNUNET_CONTAINER_multishortmap_destroy (topology->map_namespaces);
- GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals, free_nodes_cb,
- NULL);
- GNUNET_CONTAINER_multishortmap_destroy (topology->map_globals);
- GNUNET_free (topology->plugin);
- GNUNET_free (topology);
-}
-
-
-unsigned int
-GNUNET_TESTING_calculate_num (
- struct GNUNET_TESTING_NodeConnection *node_connection,
- struct GNUNET_TESTING_NetjailTopology *topology)
-{
- unsigned int n, m, num;
-
- n = node_connection->namespace_n;
- m = node_connection->node_n;
-
- if (0 == n)
- num = m;
- else
- num = (n - 1) * topology->nodes_m + m + topology->nodes_x;
-
- return num;
-}
-
-
-/**
- * Get the address for a specific communicator from a connection.
- *
- * @param connection The connection we like to have the address from.
- * @param prefix The communicator protocol prefix.
- * @return The address of the communicator.
- */
-char *
-GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection,
- const char *prefix)
-{
- struct GNUNET_TESTING_NetjailNode *node;
- char *addr;
- char *template;
- unsigned int node_n;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "get address prefix: %s node_n: %u\n",
- prefix,
- connection->node_n);
-
- node = connection->node;
- if (connection->namespace_n == node->namespace_n)
- {
- template = CONNECT_ADDRESS_TEMPLATE;
- node_n = connection->node_n;
- }
- else if (0 == connection->namespace_n)
- {
- template = KNOWN_CONNECT_ADDRESS_TEMPLATE;
- node_n = connection->node_n;
- }
- else if (1 == connection->node_n)
- {
- template = ROUTER_CONNECT_ADDRESS_TEMPLATE;
- node_n = connection->namespace_n;
- }
- else
- {
- return NULL;
- }
-
- if (0 == strcmp (PREFIX_TCP, prefix) ||
- 0 == strcmp (PREFIX_UDP, prefix) ||
- 0 == strcmp (PREFIX_UDP_NATTED, prefix) ||
- 0 == strcmp (PREFIX_TCP_NATTED, prefix))
- {
- GNUNET_asprintf (&addr,
- template,
- prefix,
- node_n);
- }
- else
- {
- GNUNET_assert (0);
- }
-
- return addr;
-}
-
-
-/**
- * Get the number of unintentional additional connections the node waits for.
- *
- * @param num The specific node we want the additional connects for.
- * @return The number of additional connects
- */
-unsigned int
-GNUNET_TESTING_get_additional_connects (unsigned int num,
- struct GNUNET_TESTING_NetjailTopology *
- topology)
-{
- struct GNUNET_TESTING_NetjailNode *node;
- struct GNUNET_TESTING_NetjailNamespace *namespace;
- struct GNUNET_TESTING_NodeConnection *node_connections;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "get_additional_connects\n");
-
- get_node_info (num, topology, &node, &namespace, &node_connections);
-
- if (NULL == node)
- {
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "No info found for node %d\n", num);
- return 0;
- }
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "node additional_connects for node %p\n",
- node);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "node additional_connects: %u\n",
- node->additional_connects);
-
- return node->additional_connects;
-}
-
-
-static void
-parse_ac (struct GNUNET_TESTING_NetjailNode *p_node, const char *token)
-{
- char *ac_value;
- int ret;
-
- ac_value = get_value ("AC", token);
- if (NULL != ac_value)
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "ac value: %s\n",
- ac_value);
- errno = 0;
- ret = sscanf (ac_value, "%u", &p_node->additional_connects);
- if (errno != 0)
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
- }
- GNUNET_assert (0 < ret);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "AC %u\n",
- p_node->additional_connects);
- }
- else
- {
- p_node->additional_connects = 0;
- }
- GNUNET_free (ac_value);
-}
-
-
-/**
- * Parse the topology data.
- *
- * @param data The topology data.
- * @return The GNUNET_TESTING_NetjailTopology
- */
-struct GNUNET_TESTING_NetjailTopology *
-GNUNET_TESTING_get_topo_from_string (const char *input)
-{
- char *token;
- char *key = NULL;
- unsigned int out;
- char *rest = NULL;
- char *value = NULL;
- char *value2;
- char *data;
- int ret;
- struct GNUNET_TESTING_NetjailTopology *topo;
- struct GNUNET_TESTING_NetjailRouter *router;
- struct GNUNET_TESTING_NetjailNamespace *namespace;
- struct GNUNET_HashCode hc;
-
- data = GNUNET_strdup (input);
- token = strtok_r (data, "\n", &rest);
- topo = GNUNET_new (struct GNUNET_TESTING_NetjailTopology);
- topo->map_namespaces =
- GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
- topo->map_globals =
- GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
-
- while (NULL != token)
- {
- if (NULL != key)
- GNUNET_free (key);
- key = get_key (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "In the loop with token: %s beginning with %s\n",
- token,
- key);
- if (0 == strcmp (key, "M"))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get first Value for M.\n");
- out = get_first_value (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "M: %u\n",
- out);
- topo->nodes_m = out;
- }
- else if (0 == strcmp (key, "N"))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get first Value for N.\n");
- out = get_first_value (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "N: %u\n",
- out);
- topo->namespaces_n = out;
- }
- else if (0 == strcmp (key, "X"))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get first Value for X.\n");
- out = get_first_value (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "X: %u\n",
- out);
- topo->nodes_x = out;
- }
- else if (0 == strcmp (key, "AC"))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get first Value for AC.\n");
- out = get_first_value (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "AC: %u\n",
- out);
- topo->additional_connects = out;
- }
- else if (0 == strcmp (key, "T"))
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get first string value for T.\n");
- value = get_first_string_value (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "value: %s\n",
- value);
- topo->plugin = value;
- }
- else if (0 == strcmp (key, "K"))
- {
- struct GNUNET_ShortHashCode hkey_k;
- struct GNUNET_TESTING_NetjailNode *k_node = GNUNET_new (struct
-
GNUNET_TESTING_NetjailNode);
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get first Value for K.\n");
- out = get_first_value (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "K: %u\n",
- out);
- k_node->node_n = out;
- GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
- memcpy (&hkey_k,
- &hc,
- sizeof (hkey_k));
- k_node->is_global = GNUNET_YES;
-
- if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
- topo->map_globals,
- &hkey_k))
- GNUNET_break (0);
- else
- GNUNET_CONTAINER_multishortmap_put (topo->map_globals,
- &hkey_k,
- k_node,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get value for key value on K.\n");
- value = get_value ("plugin", token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "value: %s\n",
- value);
- k_node->plugin = value;
- parse_ac (k_node, token);
- node_connections (token, k_node);
- GNUNET_free (value);
- }
- else if (0 == strcmp (key, "R"))
- {
- struct GNUNET_ShortHashCode hkey_r;
- router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter);
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get first Value for R.\n");
- out = get_first_value (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "R: %u\n",
- out);
- GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
- memcpy (&hkey_r,
- &hc,
- sizeof (hkey_r));
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get value for key tcp_port on R.\n");
- value = get_value ("tcp_port", token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "tcp_port: %s\n",
- value);
- ret = sscanf (value, "%u", &(router->tcp_port));
- GNUNET_free (value);
- GNUNET_break (0 != ret && 1 >= router->tcp_port);
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get value for key udp_port on R.\n");
- value2 = get_value ("udp_port", token);
- ret = sscanf (value2, "%u", &(router->udp_port));
- GNUNET_free (value2);
- GNUNET_break (0 != ret && 1 >= router->udp_port);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "udp_port: %s\n",
- value2);
- GNUNET_free (value2);
- if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
- topo->map_namespaces,
- &hkey_r))
- {
- namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
- &hkey_r);
- }
- else
- {
- namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace);
- namespace->namespace_n = out;
- namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
- GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces,
- &hkey_r,
- namespace,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
- }
- namespace->router = router;
-
- }
- else if (0 == strcmp (key, "P"))
- {
- struct GNUNET_TESTING_NetjailNode *p_node = GNUNET_new (struct
-
GNUNET_TESTING_NetjailNode);
- struct GNUNET_ShortHashCode hkey_p;
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get first Value for P.\n");
- out = get_first_value (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "P: %u\n",
- out);
- GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
- memcpy (&hkey_p,
- &hc,
- sizeof (hkey_p));
-
- if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
- topo->map_namespaces,
- &hkey_p))
- {
- namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
- &hkey_p);
- }
- else
- {
- namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace);
- namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
- namespace->namespace_n = out;
- GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces,
- &hkey_p,
- namespace,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
- }
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get second Value for P.\n");
- out = get_second_value (token);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "P: %u\n",
- out);
- GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
- memcpy (&hkey_p,
- &hc,
- sizeof (hkey_p));
- if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
- namespace->nodes,
- &hkey_p))
- {
- GNUNET_break (0);
- }
- else
- {
-
- GNUNET_CONTAINER_multishortmap_put (namespace->nodes,
- &hkey_p,
- p_node,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get value for key plugin on P.\n");
- value = get_value ("plugin", token);
- if (NULL != value)
- {
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "plugin: %s\n",
- value);
- p_node->plugin = value;
- }
- p_node->node_n = out;
- p_node->namespace_n = namespace->namespace_n;
- }
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Get AC Value for P.\n");
- parse_ac (p_node, token);
- node_connections (token, p_node);
- }
- token = strtok_r (NULL, "\n", &rest);
- if (NULL != token)
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Next token %s\n",
- token);
- }
- if (NULL != key)
- GNUNET_free (key);
- GNUNET_free (data);
- return topo;
-}
-
-
-char *
-GNUNET_TESTING_get_topo_string_from_file (const char *filename)
-{
- uint64_t fs;
- char *data;
-
- if (GNUNET_YES != GNUNET_DISK_file_test (filename))
- {
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _ ("Topology file %s not found\n"),
- filename);
- return NULL;
- }
- if (GNUNET_OK !=
- GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
- {
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _ ("Topology file %s has no data\n"),
- filename);
- return NULL;
- }
- data = GNUNET_malloc (fs + 1);
- if (fs != GNUNET_DISK_fn_read (filename, data, fs))
- {
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _ ("Topology file %s cannot be read\n"),
- filename);
- GNUNET_free (data);
- return NULL;
- }
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "file length %" PRIu64 "\n",
- fs);
- data[fs] = '\0';
-
- return data;
-}
-
-
-/**
- * Getting the topology from file.
- *
- * @param filename The name of the topology file.
- * @return The GNUNET_TESTING_NetjailTopology
- */
-struct GNUNET_TESTING_NetjailTopology *
-GNUNET_TESTING_get_topo_from_file (const char *filename)
-{
- char *data;
- struct GNUNET_TESTING_NetjailTopology *topo;
-
- data = GNUNET_TESTING_get_topo_string_from_file (filename);
-
- topo = GNUNET_TESTING_get_topo_from_string (data);
-
- GNUNET_free (data);
-
- return topo;
-}
+GNUNET_TESTING_SIMPLE_TESTBED_TRAITS (
+ GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT,
+ GNUNET_TESTBED)
/* end of testing.c */
diff --git a/src/service/testbed/testbed_api_cmd_system_create.c
b/src/service/testbed/testbed_api_cmd_system_create.c
index a1420c1ee..0b1170079 100644
--- a/src/service/testbed/testbed_api_cmd_system_create.c
+++ b/src/service/testbed/testbed_api_cmd_system_create.c
@@ -25,10 +25,8 @@
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_testing_ng_lib.h"
-#include "gnunet_testing_plugin.h"
-#include "gnunet_testing_netjail_lib.h"
#include "gnunet_testing_lib.h"
+#include "testbed_lib.h"
/**
* Struct to hold information for callbacks.
@@ -36,7 +34,7 @@
*/
struct TestSystemState
{
- struct GNUNET_TESTING_System *test_system;
+ struct GNUNET_TESTBED_System *test_system;
const char *testdir;
};
@@ -55,7 +53,7 @@ system_create_run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"system create\n");
- tss->test_system = GNUNET_TESTING_system_create (tss->testdir,
+ tss->test_system = GNUNET_TESTBED_system_create (tss->testdir,
NULL,
NULL,
NULL);
@@ -75,10 +73,10 @@ system_create_traits (void *cls,
unsigned int index)
{
struct TestSystemState *tss = cls;
- struct GNUNET_TESTING_System *test_system = tss->test_system;
+ struct GNUNET_TESTBED_System *test_system = tss->test_system;
struct GNUNET_TESTING_Trait traits[] = {
- GNUNET_TESTING_make_trait_test_system ((const void *) test_system),
+ GNUNET_TESTING_make_trait_test_system (test_system),
GNUNET_TESTING_trait_end ()
};
@@ -110,7 +108,7 @@ system_create_cleanup (void *cls)
* @return command.
*/
struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_system_create (const char *label,
+GNUNET_TESTBED_cmd_system_create (const char *label,
const char *testdir)
{
struct TestSystemState *tss;
diff --git a/src/service/testbed/testbed_api_cmd_system_destroy.c
b/src/service/testbed/testbed_api_cmd_system_destroy.c
index e18dae127..fc31e729f 100644
--- a/src/service/testbed/testbed_api_cmd_system_destroy.c
+++ b/src/service/testbed/testbed_api_cmd_system_destroy.c
@@ -25,10 +25,8 @@
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_testing_ng_lib.h"
-#include "gnunet_testing_plugin.h"
-#include "gnunet_testing_netjail_lib.h"
#include "gnunet_testing_lib.h"
+#include "testbed_lib.h"
/**
diff --git a/src/service/testbed/testing_lib.h
b/src/service/testbed/testbed_lib.h
similarity index 82%
rename from src/service/testbed/testing_lib.h
rename to src/service/testbed/testbed_lib.h
index 0d74de8c2..e7cfdf7d5 100644
--- a/src/service/testbed/testing_lib.h
+++ b/src/service/testbed/testbed_lib.h
@@ -41,8 +41,8 @@
* @{
*/
-#ifndef GNUNET_TESTING_LIB_H
-#define GNUNET_TESTING_LIB_H
+#ifndef GNUNET_TESTBED_LIB_H
+#define GNUNET_TESTBED_LIB_H
#include "gnunet_util_lib.h"
@@ -60,33 +60,33 @@ extern "C"
/**
* Size of each hostkey in the hostkey file (in BYTES).
*/
-#define GNUNET_TESTING_HOSTKEYFILESIZE sizeof(struct \
+#define GNUNET_TESTBED_HOSTKEYFILESIZE sizeof(struct \
GNUNET_CRYPTO_EddsaPrivateKey)
/**
* The environmental variable, if set, that dictates where testing should place
* generated peer configurations
*/
-#define GNUNET_TESTING_PREFIX "GNUNET_TESTING_PREFIX"
+#define GNUNET_TESTBED_PREFIX "GNUNET_TESTBED_PREFIX"
/**
* Handle for a system on which GNUnet peers are executed;
* a system is used for reserving unique paths and ports.
*/
-struct GNUNET_TESTING_System;
+struct GNUNET_TESTBED_System;
/**
* Handle for a GNUnet peer controlled by testing.
*/
-struct GNUNET_TESTING_Peer;
+struct GNUNET_TESTBED_Peer;
/**
* Specification of a service that is to be shared among peers
*/
-struct GNUNET_TESTING_SharedService
+struct GNUNET_TESTBED_SharedService
{
/**
* The name of the service.
@@ -115,7 +115,7 @@ struct GNUNET_TESTING_SharedService
* service homes; the directory will be created in a temporary
location
* depending on the underlying OS. This variable will be
* overridden with the value of the environmental variable
- * GNUNET_TESTING_PREFIX, if it exists.
+ * GNUNET_TESTBED_PREFIX, if it exists.
* @param trusted_ip the ip address which will be set as TRUSTED HOST in all
* service configurations generated to allow control connections from
* this ip. This can either be a single ip address or a network
address
@@ -126,11 +126,11 @@ struct GNUNET_TESTING_SharedService
* be shared among peers
* @return handle to this system, NULL on error
*/
-struct GNUNET_TESTING_System *
-GNUNET_TESTING_system_create (const char *testdir,
+struct GNUNET_TESTBED_System *
+GNUNET_TESTBED_system_create (const char *testdir,
const char *trusted_ip,
const char *hostname,
- const struct GNUNET_TESTING_SharedService *
+ const struct GNUNET_TESTBED_SharedService *
shared_services);
@@ -145,7 +145,7 @@ GNUNET_TESTING_system_create (const char *testdir,
* all service homes; the directory will be created in a temporary
* location depending on the underlying OS. This variable will be
* overridden with the value of the environmental variable
- * GNUNET_TESTING_PREFIX, if it exists.
+ * GNUNET_TESTBED_PREFIX, if it exists.
* @param trusted_ip the ip address which will be set as TRUSTED HOST in all
* service configurations generated to allow control connections from
* this ip. This can either be a single ip address or a network
address
@@ -158,12 +158,12 @@ GNUNET_TESTING_system_create (const char *testdir,
* @param highport highest port number this system is allowed to allocate
(exclusive)
* @return handle to this system, NULL on error
*/
-struct GNUNET_TESTING_System *
-GNUNET_TESTING_system_create_with_portrange (const char *testdir,
+struct GNUNET_TESTBED_System *
+GNUNET_TESTBED_system_create_with_portrange (const char *testdir,
const char *trusted_ip,
const char *hostname,
const struct
- GNUNET_TESTING_SharedService *
+ GNUNET_TESTBED_SharedService *
shared_services,
uint16_t lowport,
uint16_t highport);
@@ -177,7 +177,7 @@ GNUNET_TESTING_system_create_with_portrange (const char
*testdir,
* be removed (clean up on shutdown)?
*/
void
-GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
+GNUNET_TESTBED_system_destroy (struct GNUNET_TESTBED_System *system,
int remove_paths);
@@ -190,7 +190,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System
*system,
* GNUnet source code.
*
* This is primarily a helper function used internally
- * by #GNUNET_TESTING_peer_configure().
+ * by #GNUNET_TESTBED_peer_configure().
*
* @param system the testing system handle
* @param key_number desired pre-created hostkey to obtain
@@ -199,7 +199,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System
*system,
* @return NULL on error (not enough keys)
*/
struct GNUNET_CRYPTO_EddsaPrivateKey *
-GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
+GNUNET_TESTBED_hostkey_get (const struct GNUNET_TESTBED_System *system,
uint32_t key_number,
struct GNUNET_PeerIdentity *id);
@@ -211,18 +211,18 @@ GNUNET_TESTING_hostkey_get (const struct
GNUNET_TESTING_System *system,
* @return 0 if no free port was available
*/
uint16_t
-GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system);
+GNUNET_TESTBED_reserve_port (struct GNUNET_TESTBED_System *system);
/**
* Release reservation of a TCP or UDP port for a peer
- * (used during GNUNET_TESTING_peer_destroy).
+ * (used during GNUNET_TESTBED_peer_destroy).
*
* @param system system to use for reservation tracking
* @param port reserved port to release
*/
void
-GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system,
+GNUNET_TESTBED_release_port (struct GNUNET_TESTBED_System *system,
uint16_t port);
@@ -235,7 +235,7 @@ GNUNET_TESTING_release_port (struct GNUNET_TESTING_System
*system,
* out of "*port" numbers, return #GNUNET_SYSERR.
*
* This is primarily a helper function used internally
- * by #GNUNET_TESTING_peer_configure().
+ * by #GNUNET_TESTBED_peer_configure().
*
* @param system system to use to coordinate resource usage
* @param cfg template configuration to update
@@ -244,7 +244,7 @@ GNUNET_TESTING_release_port (struct GNUNET_TESTING_System
*system,
* be incomplete and should not be used there upon
*/
int
-GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system,
+GNUNET_TESTBED_configuration_create (struct GNUNET_TESTBED_System *system,
struct GNUNET_CONFIGURATION_Handle *cfg);
// FIXME: add dual to 'release' ports again...
@@ -263,8 +263,8 @@ GNUNET_TESTING_configuration_create (struct
GNUNET_TESTING_System *system,
* can be NULL
* @return handle to the peer, NULL on error
*/
-struct GNUNET_TESTING_Peer *
-GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
+struct GNUNET_TESTBED_Peer *
+GNUNET_TESTBED_peer_configure (struct GNUNET_TESTBED_System *system,
struct GNUNET_CONFIGURATION_Handle *cfg,
uint32_t key_number,
struct GNUNET_PeerIdentity *id,
@@ -278,7 +278,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System
*system,
* @param id identifier for the daemon, will be set
*/
void
-GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
+GNUNET_TESTBED_peer_get_identity (struct GNUNET_TESTBED_Peer *peer,
struct GNUNET_PeerIdentity *id);
@@ -290,20 +290,20 @@ GNUNET_TESTING_peer_get_identity (struct
GNUNET_TESTING_Peer *peer,
* #GNUNET_SYSERR on error (i.e. peer already running)
*/
int
-GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer);
+GNUNET_TESTBED_peer_start (struct GNUNET_TESTBED_Peer *peer);
/**
* Stop the peer. This call is blocking as it kills the peer's main ARM process
* by sending a SIGTERM and waits on it. For asynchronous shutdown of peer,
see
- * GNUNET_TESTING_peer_stop_async().
+ * GNUNET_TESTBED_peer_stop_async().
*
* @param peer peer to stop
* @return #GNUNET_OK on success,
* #GNUNET_SYSERR on error (i.e. peer not running)
*/
int
-GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer);
+GNUNET_TESTBED_peer_stop (struct GNUNET_TESTBED_Peer *peer);
/**
@@ -314,7 +314,7 @@ GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer);
* @param peer peer to destroy
*/
void
-GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer);
+GNUNET_TESTBED_peer_destroy (struct GNUNET_TESTBED_Peer *peer);
/**
@@ -325,7 +325,7 @@ GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer
*peer);
* or upon any error while sending SIGTERM
*/
int
-GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer *peer);
+GNUNET_TESTBED_peer_kill (struct GNUNET_TESTBED_Peer *peer);
/**
@@ -336,26 +336,26 @@ GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer
*peer);
* or upon any error while waiting
*/
int
-GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer);
+GNUNET_TESTBED_peer_wait (struct GNUNET_TESTBED_Peer *peer);
/**
* Callback to inform whether the peer is running or stopped.
*
- * @param cls the closure given to GNUNET_TESTING_peer_stop_async()
+ * @param cls the closure given to GNUNET_TESTBED_peer_stop_async()
* @param peer the respective peer whose status is being reported
* @param success #GNUNET_YES if the peer is stopped; #GNUNET_SYSERR upon any
* error
*/
typedef void
-(*GNUNET_TESTING_PeerStopCallback) (void *cls,
- struct GNUNET_TESTING_Peer *peer,
+(*GNUNET_TESTBED_PeerStopCallback) (void *cls,
+ struct GNUNET_TESTBED_Peer *peer,
int success);
/**
* Stop a peer asynchronously using ARM API. Peer's shutdown is signaled
- * through the GNUNET_TESTING_PeerStopCallback().
+ * through the GNUNET_TESTBED_PeerStopCallback().
*
* @param peer the peer to stop
* @param cb the callback to signal peer shutdown
@@ -365,36 +365,36 @@ typedef void
* upon any error.
*/
int
-GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer,
- GNUNET_TESTING_PeerStopCallback cb,
+GNUNET_TESTBED_peer_stop_async (struct GNUNET_TESTBED_Peer *peer,
+ GNUNET_TESTBED_PeerStopCallback cb,
void *cb_cls);
/**
* Cancel a previous asynchronous peer stop request.
- * GNUNET_TESTING_peer_stop_async() should have been called before on the given
+ * GNUNET_TESTBED_peer_stop_async() should have been called before on the given
* peer. It is an error to call this function if the peer stop callback was
* already called
*
- * @param peer the peer on which GNUNET_TESTING_peer_stop_async() was called
+ * @param peer the peer on which GNUNET_TESTBED_peer_stop_async() was called
* before.
*/
void
-GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer);
+GNUNET_TESTBED_peer_stop_async_cancel (struct GNUNET_TESTBED_Peer *peer);
/**
* Signature of the 'main' function for a (single-peer) testcase that
- * is run using #GNUNET_TESTING_peer_run().
+ * is run using #GNUNET_TESTBED_peer_run().
*
* @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,
+(*GNUNET_TESTBED_TestMain) (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TESTING_Peer *peer);
+ struct GNUNET_TESTBED_Peer *peer);
/**
@@ -414,9 +414,9 @@ typedef void
* @return 0 on success, 1 on error
*/
int
-GNUNET_TESTING_peer_run (const char *testdir,
+GNUNET_TESTBED_peer_run (const char *testdir,
const char *cfgfilename,
- GNUNET_TESTING_TestMain tm,
+ GNUNET_TESTBED_TestMain tm,
void *tm_cls);
@@ -442,13 +442,23 @@ GNUNET_TESTING_peer_run (const char *testdir,
* @return 0 on success, 1 on error
*/
int
-GNUNET_TESTING_service_run (const char *testdir,
+GNUNET_TESTBED_service_run (const char *testdir,
const char *service_name,
const char *cfgfilename,
- GNUNET_TESTING_TestMain tm,
+ GNUNET_TESTBED_TestMain tm,
void *tm_cls);
+/**
+ * Call #op on all simple traits.
+ */
+#define GNUNET_TESTING_SIMPLE_TESTBED_TRAITS(op, prefix) \
+ op (prefix, test_system, const struct GNUNET_TESTBED_System)
+
+GNUNET_TESTING_SIMPLE_TESTBED_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
+GNUNET_TESTING)
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
diff --git a/src/service/testbed/testing.h b/src/service/testbed/testing.h
deleted file mode 100644
index 0f26e3c15..000000000
--- a/src/service/testbed/testing.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- This file is part of GNUnet
- Copyright (C) 2021 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-
-/**
- * @author t3sserakt
- */
-#ifndef TESTING_H
-#define TESTING_H
-#include "gnunet_util_lib.h"
-#include "gnunet_testing_plugin.h"
-
-
-/**
- * Handle for a plugin.
- */
-struct TestcasePlugin
-{
- /**
- * Name of the shared library.
- */
- char *library_name;
-
- /**
- * Plugin API.
- */
- struct GNUNET_TESTING_PluginFunctions *api;
-
- /**
- * IP address of the specific node the helper is running for.
- *
- */
- char *node_ip;
-
- /**
- * Name of the test case plugin.
- *
- */
- char *plugin_name;
-
- /**
- * The number of namespaces
- *
- */
- char *global_n;
-
- /**
- * The number of local nodes per namespace.
- *
- */
- char *local_m;
-
- /**
- * The number of the namespace this node is in.
- *
- */
- char *n;
-
- /**
- * The number of the node in the namespace.
- *
- */
- char *m;
-};
-
-struct CommandListEntry
-{
- struct CommandListEntry *next;
-
- struct CommandListEntry *prev;
-
- struct GNUNET_TESTING_Command *command;
-};
-
-
-struct GNUNET_TESTING_Barrier
-{
- /**
- * Pointer to the previous prefix in the DLL.
- */
- struct GNUNET_TESTING_Barrier *prev;
-
- /**
- * Pointer to the next prefix in the DLL.
- */
- struct GNUNET_TESTING_Barrier *next;
-
- /**
- * Head of the DLL with local commands the barrier is attached too.
- */
- struct CommandListEntry *cmds_head;
-
- /**
- * Tail of the DLL with local commands the barrier is attached too.
- */
- struct CommandListEntry *cmds_tail;
-
- /**
- * Hash map containing the global known nodes which are not natted.
- */
- struct GNUNET_CONTAINER_MultiShortmap *nodes;
-
- /**
- * Name of the barrier.
- */
- const char *name;
-
- /**
- * Is this barrier running on the master.
- */
- unsigned int running_on_master;
-
- /**
- * Number of commands attached to this barrier.
- */
- unsigned int expected_reaches;
-
- /**
- * Number of commands which reached this barrier.
- */
- unsigned int reached;
-
- /**
- * Percentage of of commands which need to reach the barrier to change state.
- * Can not be used together with to_be_reached;
- */
- double percentage_to_be_reached;
-
- /**
- * Number of commands which need to reach the barrier to change state.
- * Can not be used together with percentage_to_be_reached;
- */
- unsigned int number_to_be_reached;
-
- /*
- * No barrier locally. Shadow created. Real barrier created elsewhere.
- */
- unsigned int shadow;
-};
-
-
-/**
- * Call #op on all simple traits.
- */
-#define GNUNET_TESTING_SIMPLE_TESTBED_TRAITS(op, prefix)
\
- op (prefix, get_topology, const struct GNUNET_TESTING_NetjailTopology)
\
- op (prefix, get_topology_string, const char *)
\
- op (prefix, test_system, const struct GNUNET_TESTING_System)
\
- op (prefix, async_context, struct GNUNET_TESTING_AsyncContext)
\
- op (prefix, helper_handles, const struct GNUNET_HELPER_Handle *)
\
- op (prefix, block_state, struct GNUNET_TESTING_BlockState)
-
-GNUNET_TESTING_SIMPLE_TESTBED_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
- GNUNET_TESTING)
-
-
-#endif
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.