summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac39
-rw-r--r--contrib/Makefile.am13
-rwxr-xr-xcontrib/get_version.sh18
-rw-r--r--contrib/gnunet.m42
-rw-r--r--contrib/scripts/Makefile.am1
-rwxr-xr-xcontrib/scripts/testbed_cleanup.sh14
-rw-r--r--contrib/testbed_infiniband_results/30000_connections_90000_peers_30_poc.txt37
-rw-r--r--contrib/testbed_infiniband_results/6000_connections_10000_peers_100_poc.txt36
-rw-r--r--contrib/testbed_infiniband_results/6000_connections_10000_peers_20_poc.txt36
-rw-r--r--contrib/testbed_infiniband_results/6000_connections_10000_peers_30_poc.txt37
-rw-r--r--contrib/testbed_infiniband_results/6000_connections_20000_peers.txt25
-rw-r--r--contrib/testbed_infiniband_results/6000_connections_40000_peers.txt36
-rw-r--r--contrib/testbed_infiniband_results/6000_connections_60000_peers.txt61
-rw-r--r--contrib/testbed_infiniband_results/6000_connections_60000_peers_5_poc.txt36
-rw-r--r--contrib/testbed_infiniband_results/6000_connections_80000_peers_20_poc.txt38
-rw-r--r--contrib/testbed_infiniband_results/6000_connections_80000_peers_5_poc.txt22
-rw-r--r--doc/handbook/chapters/developer.texi3
-rw-r--r--doc/handbook/chapters/keyconcepts.texi8
-rw-r--r--po/POTFILES.in4
-rw-r--r--src/Makefile.am6
-rw-r--r--src/ats/Makefile.am2
-rw-r--r--src/cadet/Makefile.am4
-rw-r--r--src/consensus/Makefile.am2
-rw-r--r--src/core/Makefile.am6
-rw-r--r--src/datacache/Makefile.am2
-rw-r--r--src/datastore/Makefile.am6
-rw-r--r--src/dht/Makefile.am6
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c9
-rw-r--r--src/dhtu/Makefile.am15
-rw-r--r--src/dhtu/test_dhtu_ip.c47
-rw-r--r--src/dhtu/testing_dhtu_cmd_send.c118
-rw-r--r--src/fs/Makefile.am6
-rw-r--r--src/identity/Makefile.am2
-rw-r--r--src/include/gnunet_messenger_service.h47
-rw-r--r--src/include/gnunet_testbed_service.h18
-rw-r--r--src/include/gnunet_testing_ng_lib.h405
-rw-r--r--src/messenger/gnunet-messenger.c21
-rw-r--r--src/messenger/gnunet-service-messenger.c51
-rw-r--r--src/messenger/gnunet-service-messenger_basement.c8
-rw-r--r--src/messenger/gnunet-service-messenger_basement.h8
-rw-r--r--src/messenger/gnunet-service-messenger_ego_store.c37
-rw-r--r--src/messenger/gnunet-service-messenger_ego_store.h21
-rw-r--r--src/messenger/gnunet-service-messenger_handle.c79
-rw-r--r--src/messenger/gnunet-service-messenger_handle.h40
-rw-r--r--src/messenger/gnunet-service-messenger_list_handles.c9
-rw-r--r--src/messenger/gnunet-service-messenger_list_handles.h9
-rw-r--r--src/messenger/gnunet-service-messenger_list_messages.c15
-rw-r--r--src/messenger/gnunet-service-messenger_list_messages.h15
-rw-r--r--src/messenger/gnunet-service-messenger_member.c61
-rw-r--r--src/messenger/gnunet-service-messenger_member.h28
-rw-r--r--src/messenger/gnunet-service-messenger_member_session.c26
-rw-r--r--src/messenger/gnunet-service-messenger_member_session.h12
-rw-r--r--src/messenger/gnunet-service-messenger_member_store.c44
-rw-r--r--src/messenger/gnunet-service-messenger_member_store.h21
-rw-r--r--src/messenger/gnunet-service-messenger_message_handle.c51
-rw-r--r--src/messenger/gnunet-service-messenger_message_handle.h48
-rw-r--r--src/messenger/gnunet-service-messenger_message_kind.c6
-rw-r--r--src/messenger/gnunet-service-messenger_message_kind.h6
-rw-r--r--src/messenger/gnunet-service-messenger_message_recv.c32
-rw-r--r--src/messenger/gnunet-service-messenger_message_recv.h18
-rw-r--r--src/messenger/gnunet-service-messenger_message_send.c24
-rw-r--r--src/messenger/gnunet-service-messenger_message_send.h24
-rw-r--r--src/messenger/gnunet-service-messenger_message_state.c12
-rw-r--r--src/messenger/gnunet-service-messenger_message_state.h12
-rw-r--r--src/messenger/gnunet-service-messenger_message_store.c54
-rw-r--r--src/messenger/gnunet-service-messenger_message_store.h21
-rw-r--r--src/messenger/gnunet-service-messenger_operation.c6
-rw-r--r--src/messenger/gnunet-service-messenger_operation.h6
-rw-r--r--src/messenger/gnunet-service-messenger_operation_store.c20
-rw-r--r--src/messenger/gnunet-service-messenger_operation_store.h3
-rw-r--r--src/messenger/gnunet-service-messenger_room.c142
-rw-r--r--src/messenger/gnunet-service-messenger_room.h55
-rw-r--r--src/messenger/gnunet-service-messenger_service.c37
-rw-r--r--src/messenger/gnunet-service-messenger_service.h33
-rw-r--r--src/messenger/gnunet-service-messenger_tunnel.c49
-rw-r--r--src/messenger/gnunet-service-messenger_tunnel.h22
-rw-r--r--src/messenger/messenger_api.c90
-rw-r--r--src/messenger/messenger_api_contact.c6
-rw-r--r--src/messenger/messenger_api_contact.h6
-rw-r--r--src/messenger/messenger_api_contact_store.c22
-rw-r--r--src/messenger/messenger_api_contact_store.h15
-rw-r--r--src/messenger/messenger_api_handle.c29
-rw-r--r--src/messenger/messenger_api_handle.h25
-rw-r--r--src/messenger/messenger_api_list_tunnels.c22
-rw-r--r--src/messenger/messenger_api_list_tunnels.h19
-rw-r--r--src/messenger/messenger_api_message.c74
-rw-r--r--src/messenger/messenger_api_message.h37
-rw-r--r--src/messenger/messenger_api_room.c75
-rw-r--r--src/messenger/messenger_api_room.h21
-rw-r--r--src/messenger/messenger_api_util.c6
-rw-r--r--src/messenger/messenger_api_util.h6
-rw-r--r--src/messenger/test_messenger.c10
-rw-r--r--src/messenger/test_messenger_adapt.c3
-rw-r--r--src/messenger/test_messenger_anonymous.c10
-rw-r--r--src/messenger/test_messenger_async_client.c3
-rw-r--r--src/messenger/test_messenger_async_p2p.c3
-rw-r--r--src/messenger/test_messenger_growth.c3
-rw-r--r--src/messenger/test_messenger_ring.c3
-rw-r--r--src/messenger/test_messenger_server.c3
-rw-r--r--src/messenger/test_messenger_sync_client.c3
-rw-r--r--src/messenger/test_messenger_sync_p2p.c3
-rw-r--r--src/messenger/test_messenger_worst_client.c3
-rw-r--r--src/messenger/test_messenger_worst_p2p.c3
-rw-r--r--src/messenger/testing_messenger_barrier.c6
-rw-r--r--src/messenger/testing_messenger_setup.c41
-rw-r--r--src/messenger/testing_messenger_setup.h3
-rw-r--r--src/namecache/Makefile.am8
-rw-r--r--src/namestore/Makefile.am6
-rw-r--r--src/nse/Makefile.am4
-rw-r--r--src/peerinfo/Makefile.am2
-rw-r--r--src/peerstore/Makefile.am2
-rw-r--r--src/pt/Makefile.am4
-rw-r--r--src/regex/Makefile.am2
-rw-r--r--src/rps/Makefile.am4
-rw-r--r--src/secretsharing/Makefile.am2
-rw-r--r--src/set/Makefile.am4
-rw-r--r--src/seti/Makefile.am4
-rw-r--r--src/setu/Makefile.am4
-rw-r--r--src/testbed/gnunet-testbed-profiler.c4
-rw-r--r--src/testbed/gnunet_testbed_mpi_spawn.c327
-rw-r--r--src/testbed/testbed_api_hosts.c35
-rw-r--r--src/testbed/testbed_api_testbed.c11
-rw-r--r--src/testing/Makefile.am19
-rwxr-xr-xsrc/testing/netjail_core.sh190
-rwxr-xr-xsrc/testing/netjail_core_v2.sh260
-rwxr-xr-xsrc/testing/netjail_exec.sh6
-rwxr-xr-xsrc/testing/netjail_exec_v2.sh14
-rwxr-xr-xsrc/testing/netjail_start.sh70
-rwxr-xr-xsrc/testing/netjail_start_v2.sh74
-rwxr-xr-xsrc/testing/netjail_stop.sh49
-rwxr-xr-xsrc/testing/netjail_stop_v2.sh59
-rw-r--r--src/testing/test_testing_plugin_testcmd.c19
-rw-r--r--src/testing/testing.c30
-rw-r--r--src/testing/testing.h94
-rw-r--r--src/testing/testing_api_cmd_batch.c86
-rw-r--r--src/testing/testing_api_cmd_block_until_all_peers_started.c66
-rw-r--r--src/testing/testing_api_cmd_block_until_external_trigger.c116
-rw-r--r--src/testing/testing_api_cmd_end.c39
-rw-r--r--src/testing/testing_api_cmd_finish.c198
-rw-r--r--src/testing/testing_api_cmd_hello_world.c65
-rw-r--r--src/testing/testing_api_cmd_hello_world_birth.c10
-rw-r--r--src/testing/testing_api_cmd_local_test_finished.c67
-rw-r--r--src/testing/testing_api_cmd_netjail_start.c148
-rw-r--r--src/testing/testing_api_cmd_netjail_start_testsystem.c319
-rw-r--r--src/testing/testing_api_cmd_netjail_start_testsystem_v2.c720
-rw-r--r--src/testing/testing_api_cmd_netjail_start_v2.c249
-rw-r--r--src/testing/testing_api_cmd_netjail_stop.c116
-rw-r--r--src/testing/testing_api_cmd_netjail_stop_testsystem.c58
-rw-r--r--src/testing/testing_api_cmd_netjail_stop_testsystem_v2.c143
-rw-r--r--src/testing/testing_api_cmd_netjail_stop_v2.c225
-rw-r--r--src/testing/testing_api_cmd_send_peer_ready.c29
-rw-r--r--src/testing/testing_api_cmd_system_create.c4
-rw-r--r--src/testing/testing_api_cmd_system_destroy.c33
-rw-r--r--src/testing/testing_api_loop.c593
-rw-r--r--src/testing/testing_api_trait_cmd.c2
-rw-r--r--src/testing/testing_api_traits.c2
-rw-r--r--src/testing/testing_cmds.h2
-rw-r--r--src/topology/Makefile.am2
-rw-r--r--src/transport/Makefile.am52
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send.c195
-rw-r--r--src/transport/test_transport_plugin_cmd_simple_send_v2.c234
-rw-r--r--src/transport/test_transport_plugin_cmd_udp_backchannel.c178
-rw-r--r--src/transport/test_transport_port_forward.c85
-rw-r--r--src/transport/test_transport_simple_send.c86
-rwxr-xr-xsrc/transport/test_transport_simple_send.sh2
-rw-r--r--src/transport/test_transport_simple_send_v2.c83
-rwxr-xr-xsrc/transport/test_transport_simple_send_v2.sh2
-rw-r--r--src/transport/test_transport_start_with_config.c59
-rw-r--r--src/transport/transport-testing-cmds.h201
-rw-r--r--src/transport/transport_api_cmd_connecting_peers.c515
-rw-r--r--src/transport/transport_api_cmd_connecting_peers_v2.c242
-rw-r--r--src/transport/transport_api_cmd_connecting_peers_v3.c508
-rw-r--r--src/transport/transport_api_cmd_send_simple.c48
-rw-r--r--src/transport/transport_api_cmd_send_simple_v2.c156
-rw-r--r--src/transport/transport_api_cmd_start_peer.c101
-rw-r--r--src/transport/transport_api_cmd_start_peer_v2.c607
-rw-r--r--src/transport/transport_api_cmd_start_peer_v3.c619
-rw-r--r--src/transport/transport_api_cmd_stop_peer.c27
-rw-r--r--src/util/Makefile.am6
-rw-r--r--src/util/child_management.c19
-rw-r--r--src/util/common_allocation.c40
182 files changed, 3751 insertions, 7822 deletions
diff --git a/Makefile.am b/Makefile.am
index f072d0cae..9191107d2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,7 +24,8 @@ EXTRA_DIST = \
ABOUT-NLS \
config.rpath \
acinclude.m4 \
- README.1st
+ README.1st \
+ .version
gnunetincludedir = $(includedir)/gnunet
gnunetinclude_HEADERS = gnunet_config.h
diff --git a/configure.ac b/configure.ac
index 770ba499e..8a3574118 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@
#
AC_PREREQ([2.69])
# Checks for programs.
-AC_INIT([gnunet],[0.15.4-alpha.0],[bug-gnunet@gnu.org])
+AC_INIT([gnunet],m4_esyscmd([contrib/get_version.sh]),[bug-gnunet@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
# check for legacy option that is no longer supported (#5627) and fail hard
@@ -35,7 +35,7 @@ AC_ARG_WITH(nssdir,
AC_CANONICAL_TARGET
AC_CANONICAL_HOST
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([1.9 tar-ustar])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AM_DEFAULT_VERBOSITY=1 AC_SUBST(AM_DEFAULT_VERBOSITY)])
AC_CONFIG_HEADERS([gnunet_config.h])
AH_TOP([#define _GNU_SOURCE 1])
@@ -1440,8 +1440,7 @@ AC_SUBST(MYSQL_LDFLAGS)
AC_SUBST(MYSQL_CPPFLAGS)
# additional version check for mysql
-AC_ARG_ENABLE(mysql-version-check, [ --disable-mysql-version-check do not check MySQL version],, enable_mysql_version_check=yes)
-AS_IF([test "$mysql" = "true" -a "x$enable_mysql_version_check" = "xyes"],
+AS_IF([test "$mysql" = "true"],
[
AC_MSG_CHECKING(mysql version)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
@@ -1686,20 +1685,6 @@ AC_DEFINE_UNQUOTED([HAVE_GNUTLS_DANE], $gnutls_dane, [We have GnuTLS with DANE s
-# Test if we are building for superMUC
-AC_MSG_CHECKING(if GNUnet is being configured to run on the SuperMUC)
-AC_ARG_ENABLE([supermuc],
- [AS_HELP_STRING([--enable-supermuc],
- [build GNUnet with support to run on the SuperMUC (default is NO)])],
- [AS_IF([test "x$enable_supermuc" = "xno"],
- [supermuc=0],
- [supermuc=1])],
- [supermuc=0
- enable_supermuc=no])
-AC_MSG_RESULT($enable_SUPERMUC)
-AM_CONDITIONAL([ENABLE_SUPERMUC], [test "x$supermuc" = "x1"])
-AC_DEFINE_UNQUOTED([ENABLE_SUPERMUC], [$supermuc], [Build with support for SuperMUC])
-
# Check if NSE has to send timestamp information to testbed logger for
# generating histogram of messages received
AC_MSG_CHECKING(if NSE has to send timestamp information to testbed logger)
@@ -1739,15 +1724,6 @@ AS_IF([test "x$enable_benchmark" = "xyes"],
AM_CONDITIONAL([ENABLE_BENCHMARK], [test "x$enable_benchmark" = "xyes"])
-# should expensive tests be run?
-AC_MSG_CHECKING(whether to run expensive tests)
-AC_ARG_ENABLE([expensivetests],
- [AS_HELP_STRING([--enable-expensivetests], [enable running expensive testcases])],
- [enable_expensive=${enableval}],
- [enable_expensive=no])
-AC_MSG_RESULT($enable_expensive)
-AM_CONDITIONAL([HAVE_EXPENSIVE_TESTS], [test "x$enable_expensive" = "xyes"])
-
# should ports be open for Java services?
AC_MSG_CHECKING(whether to enable ports for gnunet-java)
AC_ARG_ENABLE([javaports],
@@ -1769,15 +1745,6 @@ AC_ARG_ENABLE([benchmarks],
AC_MSG_RESULT($enable_benchmarks)
AM_CONDITIONAL([HAVE_BENCHMARKS], [test "x$enable_benchmarks" = "xyes"])
-# should gnunet-testing be compiled
-AC_MSG_CHECKING(whether to compile gnunet-testing)
-AC_ARG_ENABLE([testing],
- [AS_HELP_STRING([--disable-testing], [do not build gnunet-testing])],
- [enable_testing=${enableval}],
- [enable_testing=yes])
-AC_MSG_RESULT($enable_testing)
-AM_CONDITIONAL([HAVE_TESTING], [test "x$enable_testing" = "xyes"])
-
# should experimental code be compiled (code that may not yet compile)?
AC_MSG_CHECKING(whether to compile experimental code)
AC_ARG_ENABLE([experimental],
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 6598c1520..464016ee8 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -184,19 +184,7 @@ EXTRA_DIST = \
conf/gnunet/no_forcestart.conf \
conf/colorit/colorit.conf \
conf/nss/nssswitch.conf \
- testbed_infiniband_results/6000_connections_20000_peers.txt \
- testbed_infiniband_results/6000_connections_10000_peers_20_poc.txt \
- testbed_infiniband_results/6000_connections_10000_peers_30_poc.txt \
- testbed_infiniband_results/6000_connections_40000_peers.txt \
- testbed_infiniband_results/6000_connections_60000_peers_5_poc.txt \
- testbed_infiniband_results/30000_connections_90000_peers_30_poc.txt \
- testbed_infiniband_results/6000_connections_80000_peers_20_poc.txt \
- testbed_infiniband_results/6000_connections_80000_peers_5_poc.txt \
- testbed_infiniband_results/6000_connections_10000_peers_100_poc.txt \
- testbed_infiniband_results/6000_connections_60000_peers.txt \
testbed_configs/testbed_cluster.conf \
- testbed_configs/testbed_infiniband.conf \
- testbed_configs/regex_profiler_infiniband.conf \
testbed_configs/testbed_supermuc.conf \
guix.README \
web/log.php \
@@ -209,7 +197,6 @@ EXTRA_DIST = \
docker/Dockerfile \
docker/README.md \
docker/gnunet.conf \
- nse/experiments/infiniband.conf \
benchmark/collect.awk \
gnunet_infrastructure/handbook_pull.sh \
guix.scm \
diff --git a/contrib/get_version.sh b/contrib/get_version.sh
new file mode 100755
index 000000000..35eed9f94
--- /dev/null
+++ b/contrib/get_version.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# Gets the version number from git, or from the contents of .version
+VERSION=
+if test -f ".version"
+then
+ VERSION=$(cat .version)
+fi
+if test "x$VERSION" = "x" -a -d "./.git"
+then
+ VERSION=$(git describe --tags)
+ VERSION=${VERSION:1:${#VERSION}}
+ echo $VERSION > .version
+fi
+if test "x$VERSION" = "x"
+then
+ VERSION="unknown"
+fi
+echo -n "$VERSION"
diff --git a/contrib/gnunet.m4 b/contrib/gnunet.m4
index 6d9332db3..e740fa396 100644
--- a/contrib/gnunet.m4
+++ b/contrib/gnunet.m4
@@ -41,7 +41,7 @@ AC_DEFUN([AM_PATH_GNUNET],
[gnunet_PATH="$prefix/bin${PATH_SEPARATOR}$prefix/usr/bin"])
AC_PATH_PROG([GNUNET_CONFIG],[gnunet-config],[no],[$gnunet_PATH])
AS_UNSET([gnunet_PATH])],
- [GNUNET_CONFIG="pkg-config gnunetutil"])])
+ [GNUNET_CONFIG="gnunet-config"])])
AC_MSG_CHECKING([if GNUnet version is >= $min_gnunet_version])
gnunet_result=no
AS_IF([test "x$GNUNET_CONFIG" != "xno" && test -n "$GNUNET_CONFIG"],
diff --git a/contrib/scripts/Makefile.am b/contrib/scripts/Makefile.am
index 2d4f5584b..756119ada 100644
--- a/contrib/scripts/Makefile.am
+++ b/contrib/scripts/Makefile.am
@@ -42,7 +42,6 @@ EXTRA_DIST = \
changelog_delta.sh \
debug \
build_cscope.sh \
- testbed_cleanup.sh \
lint/lint-man.sh \
lint/lint-python.sh \
revisionary.sh \
diff --git a/contrib/scripts/testbed_cleanup.sh b/contrib/scripts/testbed_cleanup.sh
deleted file mode 100755
index ee0200d44..000000000
--- a/contrib/scripts/testbed_cleanup.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-###################################################################################
-# Script to clean a previous run of testbed which has crashed. This scripts kills #
-# the peers and cleans the temporary files created for those peers #
-# #
-# Author: Sree Harsha Totakura #
-###################################################################################
-
-for host in `cut -d : -f 1 < infiniband_cluster.hosts | cut -d @ -f 2`
-do
- echo "ssh --> $host"
- ssh $host 'pkill -SIGKILL gnunet; rm -rf /tmp/gnunet-pipe*; rm -rf /tmp/testbed*'
-done
diff --git a/contrib/testbed_infiniband_results/30000_connections_90000_peers_30_poc.txt b/contrib/testbed_infiniband_results/30000_connections_90000_peers_30_poc.txt
deleted file mode 100644
index 666b00942..000000000
--- a/contrib/testbed_infiniband_results/30000_connections_90000_peers_30_poc.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-29 controllers started successfully
-90000 peers created successfully in 385.34 seconds
-90000 peers started successfully in 102.31 seconds
-Establishing links. Please wait
-......FFFFFFFFFFFFFFFFFFFFFFFF.....F......................................F.....................FFFFFFFF....F...F...........................................................................................................F............................F........................................................................F.....................F...................................F.....F...F........................F.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F.....................................................................................................................................................F..........................................................................................................................................................................................F......................................................................................................................................................................................F....................................................................................................................................................................F............................................................................................................................................................................F............................................................................................................................................................................F.................................................................................................................................................................................F...........................................................................................................................................................F........................................................................................................................................................F.................................................................F...............................................................................................F.....................................................................................................................................................................................F.....................................................................F...............................................................................................F............................................................................................................................................................................F...........................................................................F..............................................................................................F....................................................................................................................................................................................F...................................................................F.............................................................................................F..................................................................................................................................................................................F.....................................................................F................................................................................................F.............................................................................................................................................................................F.....................................................................F..............................................................................................F.............................................................................................................................................................................F.....................................................................F.................................................................................................F....................................................................................................................................................................................F.....................................................................F..............................................................................................F................................................................................................................................................................................F.........................................................................F.................................................................................................F...............................................................................................................................................................................F..................................................................F......................................................................................F........................................................................................................................................................F........................................................F...........................................................................F........................................................................................................................................F..................................................F.........................................................................F.......................................................................................................................................F.........................................................F...............................................................................F...........................................................................................................................................F.....................................................F.........................................................................F...............................................................................................................F...................................................F..............................................................F..........................................................................................................................F.................................................F..............................................................F.................................................................................................................F...............................................F...............................................................F................................................................................................................F........................................F.........................................................F..................................................................................................F........................................F..................................................F........................................................................................................F.........................F................................F..........................F.......................F..................F...............F....................................F....................F.....F................................F..............F..........................................................................F.........................................F.....................................................F......................................................................................................F.........................................F..................................................F..............................................................................................F.....................................F........................................F..................................................................................F...............F...................F..................................................F................................................................................F...............F..................F..........................................F...............................................................................F.................F................F..........................................F........................................................................F................F...............F.........................................F.............................................................................F.............F..............F............................................F...........................................................................F................F................F.........................................F............................................................................F................F...............F........................................F.........................................................................F...............F................F...........................................F..............................................................................F..............F..............F.........................................F............................................................F...........F............F................................F.............F.............................................................F...............F.................F..........................................F...............F.........................................................F................F.................F..........................................F..............F..............................................................F...............F................F...............................F...........F............................................F............F............F................................F..........F.............................................F...........F...........F...............................F...........F...........................................F...........F............F...............................F..........F...............................................F..........F...........F.....................F........F.............................F........F........F.....................F........F...............................F.....F........F....................F.......F..............................F.......F........F....................F........F..............................F.......F........F....................F........F...............................F........F.......F.....................F.......F.............................F........F........F....................F.......F.............................F........F........F.....................F.......F..............................F........F........F....................F........F..............................F........F........F...................F........F..............................F.....F.......F.....................F.......F...........................F........F........F.............F...F...............F....F....F..F................F........F.............................F.......F........F...F..................F........F..............................F........F........F...F.................F.......F..............................F.......F........F....F..................F........F.............................F.......F........F...F..................F.......F.............................F........F........F..F..................F.......F.............................F........F.......F...F.................F.......F...............................F........F.......F..F..................F.......F.............................F.......F.........F..F..................F.......F.............................F........F........F...F..................F.......F.............................F........F.......F....F.................F........F.............................F.......F........F...F.................F.......F.............................F.......F........F....F................F........F..............................F.......F........F..F..................F.......F...............................F......F.......F....F................F........F.............................F........F........F..F..................F........F..............................F........F.......F....F..................F......F..............................F.......F........F....F..................F.......F...............................F........F......F...F.................F...F..............F....F....F.F........F..F.......F.............................F......F.........F...F..............F...F.......F..............................F.......F........F....F................F..F......F..............................F........F.......F...F...............F...F.......F.............................F.......F........F..F...............F...F........F..............................F........F.......F...F...............F...F......F.............................F.......F........F...F..............F....F......F..............................F.......F........F..F................F..F........F............................F.......F........F..F.................F..F........F.............................F........F.......F....F...............F...F.......F..............................F.......F........F...F..............F...F.......F.............................F........F........F..F..............F...F.......F............................F........F........F...F...............F...F......F............................F........F........F..F................F..F........F............................F.......F.......F..F.FFFFFFF.FF...........F..F...F..............F...F....FF.F.F....F....F...F.......F...FFFFFFFFFFF...F..................FFFFFFFFFFFFF.F.F....F.FFFFFFFFFFF.FF..F...F....FF.F.F....F...F.F...F.F..F...........F.F.F.F.F...F.....FF..FF.FFFFFFFFFFFFF...FF.F.FF.......F......F..F......F..F......F...................F...F..F.F.F.FF....FF.F.FF....FFFFFFFFFF.F.F..FF...F.F.FF.F...F.F....F...F...F.F..F..........F.F.FF.FFFFFFFFFFFFFF...F.F..F......FFFFFF.F.F.F....FF.F.FF..FFFFFFFFF....F.F.FF.FF.F..F.F...FF.F.FF..F..F.FFFFFFFFFFFFFFFFFF
-Aborting due to very high failure rate
-30000 links established in 3322.23 seconds
-Overlay link operations have been retried 703 times upon timeouts
diff --git a/contrib/testbed_infiniband_results/6000_connections_10000_peers_100_poc.txt b/contrib/testbed_infiniband_results/6000_connections_10000_peers_100_poc.txt
deleted file mode 100644
index 1ff9f799e..000000000
--- a/contrib/testbed_infiniband_results/6000_connections_10000_peers_100_poc.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-29 controllers started successfully
-10000 peers created successfully in 35.98 seconds
-10000 peers started successfully in 4.81 seconds
-Establishing links. Please wait
-...............................................................................................................................................................................................................................................................................................................F.FFFFFFFFF................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
-6000 links established in 168.63 seconds
-Overlay link operations have been retried 10 times upon timeouts
diff --git a/contrib/testbed_infiniband_results/6000_connections_10000_peers_20_poc.txt b/contrib/testbed_infiniband_results/6000_connections_10000_peers_20_poc.txt
deleted file mode 100644
index 00504be78..000000000
--- a/contrib/testbed_infiniband_results/6000_connections_10000_peers_20_poc.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-29 controllers started successfully
-10000 peers created successfully in 35.34 seconds
-10000 peers started successfully in 3.87 seconds
-Establishing links. Please wait
-...........................................................................................................................................................................................................................................................................................FFFF.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
-6000 links established in 203.77 seconds
-Overlay link operations have been retried 4 times upon timeouts
diff --git a/contrib/testbed_infiniband_results/6000_connections_10000_peers_30_poc.txt b/contrib/testbed_infiniband_results/6000_connections_10000_peers_30_poc.txt
deleted file mode 100644
index daa5d9149..000000000
--- a/contrib/testbed_infiniband_results/6000_connections_10000_peers_30_poc.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-29 controllers started successfully
-20000 peers created successfully in 79.97 seconds
-20000 peers started successfully in 10.22 seconds
-Establishing links. Please wait
-...............................................FFFFFFFFF.FFF
-Aborting due to very high failure rate
-12000 links established in 30.08 seconds
-Overlay link operations have been retried 12 times upon timeouts
diff --git a/contrib/testbed_infiniband_results/6000_connections_20000_peers.txt b/contrib/testbed_infiniband_results/6000_connections_20000_peers.txt
deleted file mode 100644
index b00832e58..000000000
--- a/contrib/testbed_infiniband_results/6000_connections_20000_peers.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-All slaves started successfully
-All peers created successfully in 55.53 seconds
-All peers started successfully in 26.02 seconds
-Establishing links. Please wait
-........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................F...F.F.FF....................................................................................................F...............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
-6000 links established in 123.49 seconds
diff --git a/contrib/testbed_infiniband_results/6000_connections_40000_peers.txt b/contrib/testbed_infiniband_results/6000_connections_40000_peers.txt
deleted file mode 100644
index ccd5ec41c..000000000
--- a/contrib/testbed_infiniband_results/6000_connections_40000_peers.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-29 controllers started successfully
-40000 peers created successfully in 165.12 seconds
-40000 peers started successfully in 179.35 seconds
-Establishing links. Please wait
-................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
-6000 links established in 101.62 seconds
-Overlay link operations have been retried 0 times upon timeouts
diff --git a/contrib/testbed_infiniband_results/6000_connections_60000_peers.txt b/contrib/testbed_infiniband_results/6000_connections_60000_peers.txt
deleted file mode 100644
index 88606f99e..000000000
--- a/contrib/testbed_infiniband_results/6000_connections_60000_peers.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-29 controllers started successfully
-60000 peers created successfully in 253.31 seconds
-60000 peers started successfully in 53.18 seconds
-Establishing links. Please wait
-..............FFFFFFFFFFF
-Aborting due to very high failure rate
-6000 links established in 30.14 seconds
-Overlay link operations have been retried 11 times upon timeouts
-F
-Aborting due to very high failure rate
-6000 links established in 30.14 seconds
-Overlay link operations have been retried 12 times upon timeouts
-F
-Aborting due to very high failure rate
-6000 links established in 30.14 seconds
-Overlay link operations have been retried 13 times upon timeouts
-F
-Aborting due to very high failure rate
-6000 links established in 30.14 seconds
-Overlay link operations have been retried 14 times upon timeouts
-F
-Aborting due to very high failure rate
-6000 links established in 30.14 seconds
-Overlay link operations have been retried 15 times upon timeouts
-F
-Aborting due to very high failure rate
-6000 links established in 30.14 seconds
-Overlay link operations have been retried 16 times upon timeouts
-F
-Aborting due to very high failure rate
-6000 links established in 30.14 seconds
-Overlay link operations have been retried 17 times upon timeouts
diff --git a/contrib/testbed_infiniband_results/6000_connections_60000_peers_5_poc.txt b/contrib/testbed_infiniband_results/6000_connections_60000_peers_5_poc.txt
deleted file mode 100644
index 62ed9f842..000000000
--- a/contrib/testbed_infiniband_results/6000_connections_60000_peers_5_poc.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-29 controllers started successfully
-60000 peers created successfully in 254.00 seconds
-60000 peers started successfully in 50.20 seconds
-Establishing links. Please wait
-.FFFF.F.................F.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
-6000 links established in 2305.66 seconds
-Overlay link operations have been retried 6 times upon timeouts
diff --git a/contrib/testbed_infiniband_results/6000_connections_80000_peers_20_poc.txt b/contrib/testbed_infiniband_results/6000_connections_80000_peers_20_poc.txt
deleted file mode 100644
index 502bc72e3..000000000
--- a/contrib/testbed_infiniband_results/6000_connections_80000_peers_20_poc.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-29 controllers started successfully
-80000 peers created successfully in 360.78 seconds
-80000 peers started successfully in 77.87 seconds
-Establishing links. Please wait
-............FFFFFFFFFFFF...F..........FF...F...................FFFFFFF.......FF.F.....F........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
-Aborting due to very high failure rate
-6000 links established in 1283.11 seconds
-Overlay link operations have been retried 62 times upon timeouts
-t
diff --git a/contrib/testbed_infiniband_results/6000_connections_80000_peers_5_poc.txt b/contrib/testbed_infiniband_results/6000_connections_80000_peers_5_poc.txt
deleted file mode 100644
index b3f4e6415..000000000
--- a/contrib/testbed_infiniband_results/6000_connections_80000_peers_5_poc.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
-/home/totakura/local/bin/gnunet-helper-testbed
diff --git a/doc/handbook/chapters/developer.texi b/doc/handbook/chapters/developer.texi
index cf13fd816..a8f9d1ec3 100644
--- a/doc/handbook/chapters/developer.texi
+++ b/doc/handbook/chapters/developer.texi
@@ -9470,9 +9470,6 @@ your hosts file).
@strong{Configuration}
Moreover, an appropriate configuration file is needed.
-Generally you can refer to the
-@file{contrib/regex_profiler_infiniband.conf} file in the sourcecode
-of GNUnet for an example configuration.
In the following paragraph the important details are highlighted.
Announcing of the regular expressions is done by the
diff --git a/doc/handbook/chapters/keyconcepts.texi b/doc/handbook/chapters/keyconcepts.texi
index 49129acf5..c8dd1599b 100644
--- a/doc/handbook/chapters/keyconcepts.texi
+++ b/doc/handbook/chapters/keyconcepts.texi
@@ -290,10 +290,10 @@ An Encoding for Censorship-Resistant Sharing.
Peer identities are used to identify peers in the network and are unique
for each peer. The identity for a peer is simply its public key, which is
-generated along with a private key the peer is started for the first time.
-While the identity is binary data, it is often expressed as ASCII string.
-For example, the following is a peer identity as you might see it in
-various places:
+generated along with a private key when the peer is started for the first
+time. While the identity is binary data, it is often expressed as an ASCII
+string. For example, the following is a peer identity as you might see it
+in various places:
@example
UAT1S6PMPITLBKSJ2DGV341JI6KF7B66AC4JVCN9811NNEGQLUN0
diff --git a/po/POTFILES.in b/po/POTFILES.in
index adea4bcf1..e34cb25f4 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -110,6 +110,7 @@ src/dht/gnunet_dht_profiler.c
src/dht/plugin_block_dht.c
src/dhtu/plugin_dhtu_gnunet.c
src/dhtu/plugin_dhtu_ip.c
+src/dhtu/testing_dhtu_cmd_send.c
src/dns/dns_api.c
src/dns/gnunet-dns-monitor.c
src/dns/gnunet-dns-redirector.c
@@ -405,7 +406,6 @@ src/testbed/gnunet-service-testbed_oc.c
src/testbed/gnunet-service-testbed_peers.c
src/testbed/gnunet-testbed-profiler.c
src/testbed/gnunet_mpi_test.c
-src/testbed/gnunet_testbed_mpi_spawn.c
src/testbed/testbed_api.c
src/testbed/testbed_api_barriers.c
src/testbed/testbed_api_hosts.c
@@ -425,6 +425,8 @@ src/testing/testing.c
src/testing/testing_api_cmd_batch.c
src/testing/testing_api_cmd_block_until_all_peers_started.c
src/testing/testing_api_cmd_block_until_external_trigger.c
+src/testing/testing_api_cmd_end.c
+src/testing/testing_api_cmd_finish.c
src/testing/testing_api_cmd_hello_world.c
src/testing/testing_api_cmd_hello_world_birth.c
src/testing/testing_api_cmd_local_test_finished.c
diff --git a/src/Makefile.am b/src/Makefile.am
index ef8c5b110..31215c6d0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,9 +1,7 @@
# This Makefile.am is in the public domain
-if HAVE_TESTING
- TESTING = testing
- TESTBED = testbed-logger testbed
-endif
+TESTING = testing
+TESTBED = testbed-logger testbed
if HAVE_EXPERIMENTAL
EXP_DIR = \
diff --git a/src/ats/Makefile.am b/src/ats/Makefile.am
index 0b8e7309a..85a2bb555 100644
--- a/src/ats/Makefile.am
+++ b/src/ats/Makefile.am
@@ -65,11 +65,9 @@ gnunet_service_ats_LDADD = \
libgnunetats.la \
$(GN_LIBINTL)
-if HAVE_TESTING
TESTING_TESTS = \
test_ats_api_proportional \
test_ats_reservation_api_proportional
-endif
check_PROGRAMS = \
$(TESTING_TESTS)
diff --git a/src/cadet/Makefile.am b/src/cadet/Makefile.am
index 2289a2d96..d942c6495 100644
--- a/src/cadet/Makefile.am
+++ b/src/cadet/Makefile.am
@@ -78,12 +78,9 @@ if LINUX
endif
-if HAVE_TESTING
noinst_LTLIBRARIES = libgnunetcadettest.la $(noinst_LIB_EXP)
# noinst_PROGRAMS = gnunet-cadet-profiler
-endif
-if HAVE_TESTING
check_PROGRAMS = \
test_cadet_local_mq \
test_cadet_2_forward \
@@ -106,7 +103,6 @@ check_PROGRAMS = \
test_cadet_5_speed_reliable_backwards \
test_cadet_5_speed_backwards \
test_cadet_5_reopen
-endif
#gnunet_cadet_profiler_SOURCES = \
diff --git a/src/consensus/Makefile.am b/src/consensus/Makefile.am
index cf1d32e74..d7b23e7c6 100644
--- a/src/consensus/Makefile.am
+++ b/src/consensus/Makefile.am
@@ -89,7 +89,6 @@ libgnunet_plugin_block_consensus_la_LDFLAGS = \
-if HAVE_TESTING
bin_PROGRAMS = \
gnunet-consensus-profiler
@@ -100,7 +99,6 @@ if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
TESTS = $(check_PROGRAMS)
endif
-endif
test_consensus_api_SOURCES = \
test_consensus_api.c
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index d2d3a2d7f..e51247e18 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -54,10 +54,8 @@ gnunet_core_LDADD = \
gnunet_core_LDFLAGS = \
$(GN_LIBINTL)
-if HAVE_TESTING
- TESTING_TESTS = \
- test_core_api_send_to_self
-endif
+TESTING_TESTS = \
+ test_core_api_send_to_self
check_PROGRAMS = \
test_core_api_start_only \
diff --git a/src/datacache/Makefile.am b/src/datacache/Makefile.am
index ecb02d1c3..4789706ff 100644
--- a/src/datacache/Makefile.am
+++ b/src/datacache/Makefile.am
@@ -85,7 +85,6 @@ libgnunet_plugin_datacache_template_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
-if HAVE_TESTING
if HAVE_SQLITE
if HAVE_BENCHMARKS
SQLITE_BENCHMARKS = \
@@ -95,7 +94,6 @@ SQLITE_TESTS = \
test_datacache_sqlite \
test_datacache_quota_sqlite \
$(SQLITE_BENCHMARKS)
-endif
if HAVE_BENCHMARKS
HEAP_BENCHMARKS = \
diff --git a/src/datastore/Makefile.am b/src/datastore/Makefile.am
index cd1df4e5e..07ae004b3 100644
--- a/src/datastore/Makefile.am
+++ b/src/datastore/Makefile.am
@@ -52,7 +52,6 @@ gnunet_datastore_LDADD = \
if HAVE_MYSQL
MYSQL_PLUGIN = libgnunet_plugin_datastore_mysql.la
-if HAVE_TESTING
if HAVE_BENCHMARKS
MYSQL_BENCHMARKS = \
perf_datastore_api_mysql \
@@ -64,10 +63,8 @@ endif
test_plugin_datastore_mysql \
$(MYSQL_BENCHMARKS)
endif
-endif
if HAVE_SQLITE
SQLITE_PLUGIN = libgnunet_plugin_datastore_sqlite.la
-if HAVE_TESTING
if HAVE_BENCHMARKS
SQLITE_BENCHMARKS = \
perf_datastore_api_sqlite \
@@ -79,10 +76,8 @@ endif
test_plugin_datastore_sqlite \
$(SQLITE_BENCHMARKS)
endif
-endif
if HAVE_POSTGRESQL
POSTGRES_PLUGIN = libgnunet_plugin_datastore_postgres.la
-if HAVE_TESTING
if HAVE_BENCHMARKS
POSTGRES_BENCHMARKS = \
perf_datastore_api_postgres \
@@ -94,7 +89,6 @@ endif
test_plugin_datastore_postgres \
$(POSTGRES_BENCHMARKS)
endif
-endif
plugin_LTLIBRARIES = \
$(SQLITE_PLUGIN) \
diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am
index 919eca438..69e34000c 100644
--- a/src/dht/Makefile.am
+++ b/src/dht/Makefile.am
@@ -52,10 +52,8 @@ bin_PROGRAMS = \
gnunet-dht-get \
gnunet-dht-put
-if HAVE_TESTING
noinst_PROGRAMS = \
gnunet-dht-profiler
-endif
gnunet_service_dht_SOURCES = \
gnunet-service-dht.c gnunet-service-dht.h \
@@ -117,9 +115,7 @@ gnunet_dht_profiler_LDADD = \
gnunet_dht_profiler_LDFLAGS = \
$(GN_LIBINTL)
-if HAVE_TESTING
noinst_LIBRARIES = libgnunetdhttest.a
-endif
libgnunetdhttest_a_SOURCES = \
dht_test_lib.c dht_test_lib.h
@@ -128,7 +124,6 @@ libgnunetdhttest_a_LIBADD = \
$(top_builddir)/src/testbed/libgnunettestbed.la \
libgnunetdht.la
-if HAVE_TESTING
check_PROGRAMS = \
test_dht_api \
test_dht_twopeer \
@@ -136,7 +131,6 @@ check_PROGRAMS = \
test_dht_line \
test_dht_2dtorus \
test_dht_monitor
-endif
if HAVE_EXPERIMENTAL
# These tests still do not work as testbed does
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index ca255310c..6465d8d57 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -844,6 +844,10 @@ get_forward_count (uint32_t hop_count,
uint32_t forward_count;
float target_value;
+ if (0 == target_replication)
+ target_replication = 1; /* 0 is verboten */
+ if (target_replication > MAXIMUM_REPLICATION_LEVEL)
+ target_replication = MAXIMUM_REPLICATION_LEVEL;
if (hop_count > GDS_NSE_get () * 4.0)
{
/* forcefully terminate */
@@ -864,6 +868,8 @@ get_forward_count (uint32_t hop_count,
1 + (target_replication - 1.0) / (GDS_NSE_get ()
+ ((float) (target_replication - 1.0)
* hop_count));
+
+
/* Set forward count to floor of target_value */
forward_count = (uint32_t) target_value;
/* Subtract forward_count (floor) from target_value (yields value between 0 and 1) */
@@ -872,7 +878,8 @@ get_forward_count (uint32_t hop_count,
GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
if (random_value < (target_value * UINT32_MAX))
forward_count++;
- return forward_count;
+ return GNUNET_MIN (forward_count,
+ MAXIMUM_REPLICATION_LEVEL);
}
diff --git a/src/dhtu/Makefile.am b/src/dhtu/Makefile.am
index 61ca84ee3..772bee60a 100644
--- a/src/dhtu/Makefile.am
+++ b/src/dhtu/Makefile.am
@@ -41,6 +41,21 @@ libgnunet_plugin_dhtu_gnunet_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
+lib_LTLIBRARIES = \
+ libgnunettestingdhtu.la
+
+libgnunettestingdhtu_la_SOURCES = \
+ testing_dhtu_cmd_send.c
+libgnunettestingdhtu_la_LIBADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(LTLIBINTL)
+libgnunettestingdhtu_la_LDFLAGS = \
+ $(GN_LIB_LDFLAGS) \
+ -version-info 0:0:0
+
+
+
test_dhtu_ip_SOURCES = \
test_dhtu_ip.c
test_dhtu_ip_LDADD = \
diff --git a/src/dhtu/test_dhtu_ip.c b/src/dhtu/test_dhtu_ip.c
index f350905b8..c9528053f 100644
--- a/src/dhtu/test_dhtu_ip.c
+++ b/src/dhtu/test_dhtu_ip.c
@@ -32,46 +32,19 @@
#define CONFIG_FILE "test_dhtu_ip.conf"
-/**
- * Return value of the test.
- *
- */
-static int rv;
-
-
-/**
- * Main function to run the test cases.
- *
- * @param cls not used.
- */
-static void
-run (void *cls)
+int
+main (int argc,
+ char *const *argv)
{
struct GNUNET_TESTING_Command commands[] = {
- GNUNET_TESTING_cmd_netjail_start_v2 ("netjail-start",
- CONFIG_FILE),
- GNUNET_TESTING_cmd_netjail_stop_v2 ("netjail-stop",
- CONFIG_FILE),
+ GNUNET_TESTING_cmd_netjail_start ("netjail-start",
+ CONFIG_FILE),
+ GNUNET_TESTING_cmd_netjail_stop ("netjail-stop",
+ CONFIG_FILE),
GNUNET_TESTING_cmd_end ()
};
- (void) cls;
- if (GNUNET_OK !=
- GNUNET_TESTING_run (NULL, /* config file */
- commands,
- TIMEOUT))
- {
- GNUNET_break (0);
- rv = EXIT_FAILURE;
- }
-}
-
-
-int
-main (int argc,
- char *const *argv)
-{
- GNUNET_SCHEDULER_run (&run,
- NULL);
- return rv;
+ return GNUNET_TESTING_main (NULL,
+ commands,
+ TIMEOUT);
}
diff --git a/src/dhtu/testing_dhtu_cmd_send.c b/src/dhtu/testing_dhtu_cmd_send.c
new file mode 100644
index 000000000..e620e329e
--- /dev/null
+++ b/src/dhtu/testing_dhtu_cmd_send.c
@@ -0,0 +1,118 @@
+/*
+ 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
+ */
+
+/**
+ * @file testing/testing_dhtu_cmd_send.c
+ * @brief use DHTU to send a message
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_testing_ng_lib.h"
+
+
+/**
+ * State for the 'send' command.
+ */
+struct SendState
+{
+
+ /**
+ * Mandatory context for async commands.
+ */
+ struct GNUNET_TESTING_AsyncContext ac;
+
+};
+
+
+/**
+ *
+ *
+ * @param cls a `struct SendState`
+ */
+static void
+send_cleanup (void *cls)
+{
+ struct SendState *ss = cls;
+
+ GNUNET_free (ss);
+}
+
+
+/**
+ * Return trains of the ``send`` command.
+ *
+ * @param cls closure.
+ * @param[out] ret result
+ * @param trait name of the trait.
+ * @param index index number of the object to offer.
+ * @return #GNUNET_OK on success.
+ * #GNUNET_NO if no trait was found
+ */
+static enum GNUNET_GenericReturnValue
+send_traits (void *cls,
+ const void **ret,
+ const char *trait,
+ unsigned int index)
+{
+ return GNUNET_NO;
+}
+
+
+/**
+ * Run the 'send' command.
+ *
+ * @param cls closure.
+ * @param is interpreter state.
+ */
+static void
+send_run (void *cls,
+ struct GNUNET_TESTING_Interpreter *is)
+{
+ struct SendState *ss = cls;
+
+#if 0
+ other_cmd = GNUNET_TESTING_interpreter_lookup_command (ss->other_label);
+ GNUNET_TESTING_get_trait_XXX (other_cmd,
+ &data);
+#endif
+ GNUNET_TESTING_async_finish (&ss->ac);
+}
+
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_DHTU_cmd_send (const char *label)
+{
+ struct SendState *ss;
+
+ ss = GNUNET_new (struct SendState);
+
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = ss,
+ .label = label,
+ .run = &send_run,
+ .ac = &ss->ac,
+ .cleanup = &send_cleanup,
+ .traits = &send_traits
+ };
+
+ return cmd;
+ }
+}
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 5b6ba2376..3d8ec2bac 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -21,9 +21,7 @@ lib_LTLIBRARIES = libgnunetfs.la
plugin_LTLIBRARIES = \
libgnunet_plugin_block_fs.la
-if HAVE_TESTING
noinst_LIBRARIES = libgnunetfstest.a
-endif
libgnunetfs_la_SOURCES = \
fs_api.c fs_api.h fs.h \
@@ -71,11 +69,9 @@ libexec_PROGRAMS = \
gnunet-helper-fs-publish \
gnunet-service-fs
-if HAVE_TESTING
noinst_PROGRAMS = \
gnunet-fs-profiler \
gnunet-daemon-fsprofiler
-endif
bin_PROGRAMS = \
gnunet-auto-share \
@@ -230,7 +226,6 @@ if HAVE_BENCHMARKS
perf_gnunet_service_fs_p2p_respect
endif
-if HAVE_TESTING
check_PROGRAMS = \
test_plugin_block_fs \
test_fs_directory \
@@ -258,7 +253,6 @@ check_PROGRAMS = \
test_gnunet_service_fs_p2p \
test_gnunet_service_fs_p2p_cadet \
$(FS_BENCHMARKS)
-endif
test_plugin_block_fs_SOURCES = \
test_plugin_block_fs.c
diff --git a/src/identity/Makefile.am b/src/identity/Makefile.am
index e806f0059..59ace6c41 100644
--- a/src/identity/Makefile.am
+++ b/src/identity/Makefile.am
@@ -67,11 +67,9 @@ gnunet_identity_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
-if HAVE_TESTING
check_PROGRAMS = \
test_identity \
test_identity_defaults
-endif
if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h
index 5d7155a3d..b54567aa7 100644
--- a/src/include/gnunet_messenger_service.h
+++ b/src/include/gnunet_messenger_service.h
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2020 GNUnet e.V.
+ Copyright (C) 2020--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
@@ -527,7 +527,8 @@ enum GNUNET_MESSENGER_MessageFlags
* @param[in/out] handle Messenger handle
*/
typedef void
-(*GNUNET_MESSENGER_IdentityCallback) (void *cls, struct GNUNET_MESSENGER_Handle *handle);
+(*GNUNET_MESSENGER_IdentityCallback) (void *cls,
+ struct GNUNET_MESSENGER_Handle *handle);
/**
* Method called whenever a message is sent or received from a <i>room</i>.
@@ -543,7 +544,8 @@ typedef void
* @param[in] flags Flags of the message
*/
typedef void
-(*GNUNET_MESSENGER_MessageCallback) (void *cls, struct GNUNET_MESSENGER_Room *room,
+(*GNUNET_MESSENGER_MessageCallback) (void *cls,
+ struct GNUNET_MESSENGER_Room *room,
const struct GNUNET_MESSENGER_Contact *sender,
const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_HashCode *hash,
@@ -558,7 +560,8 @@ typedef void
* @param[in] contact Contact handle
*/
typedef int
-(*GNUNET_MESSENGER_MemberCallback) (void* cls, struct GNUNET_MESSENGER_Room *room,
+(*GNUNET_MESSENGER_MemberCallback) (void* cls,
+ struct GNUNET_MESSENGER_Room *room,
const struct GNUNET_MESSENGER_Contact *contact);
/**
@@ -574,9 +577,12 @@ typedef int
* @return Messenger handle to use, NULL on error
*/
struct GNUNET_MESSENGER_Handle*
-GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name,
- GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls,
- GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls);
+GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *name,
+ GNUNET_MESSENGER_IdentityCallback identity_callback,
+ void *identity_cls,
+ GNUNET_MESSENGER_MessageCallback msg_callback,
+ void *msg_cls);
/**
* Update a handle of the messenger to use a different ego key and replace the old one with a newly generated one. All
@@ -619,7 +625,8 @@ GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle);
* @return #GNUNET_YES on success, #GNUNET_NO on failure and #GNUNET_SYSERR if <i>handle</i> is NULL
*/
int
-GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name);
+GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle,
+ const char *name);
/**
* Get the public key used by the messenger or NULL if the anonymous key was used.
@@ -647,7 +654,8 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle);
* @return Room handle, NULL on error
*/
struct GNUNET_MESSENGER_Room*
-GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
+GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key);
/**
* Enter a room to send and receive messages through a <b>door</b> opened using #GNUNET_MESSENGER_open_room.
@@ -668,7 +676,8 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct
* @return Room handle, NULL on error
*/
struct GNUNET_MESSENGER_Room*
-GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door,
+GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_PeerIdentity *door,
const struct GNUNET_HashCode *key);
/**
@@ -695,8 +704,10 @@ GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room);
* @return Amount of rooms iterated
*/
int
-GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact,
- GNUNET_MESSENGER_MemberCallback callback, void *cls);
+GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_MESSENGER_Contact *contact,
+ GNUNET_MESSENGER_MemberCallback callback,
+ void *cls);
/**
* Get the key of a given <i>room</i>.
@@ -717,7 +728,8 @@ GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room);
* @return Contact handle, NULL otherwise
*/
const struct GNUNET_MESSENGER_Contact*
-GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash);
+GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_HashCode *hash);
/**
* Get the name used by the <i>contact</i>.
@@ -756,7 +768,8 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact
* @param[in] contact Contact or NULL
*/
void
-GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message,
+GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_MESSENGER_Contact* contact);
/**
@@ -767,7 +780,8 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct
* @return Message struct or NULL if no message with that hash is known
*/
const struct GNUNET_MESSENGER_Message*
-GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash);
+GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_HashCode *hash);
/**
* Iterates through all members of a given <i>room</i> and calls a selected <i>callback</i>
@@ -780,7 +794,8 @@ GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const st
* @return Amount of members iterated
*/
int
-GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback,
+GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room,
+ GNUNET_MESSENGER_MemberCallback callback,
void* cls);
#if 0 /* keep Emacsens' auto-indent happy */
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index acb444de4..888c6e391 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -139,24 +139,6 @@ GNUNET_TESTBED_hosts_load_from_file (const char *filename,
/**
- * Loads the set of host allocated by the LoadLeveler Job Scheduler. This
- * function is only available when compiled with support for LoadLeveler and is
- * used for running on the SuperMUC
- *
- * @param cfg the configuration to use as a template while starting a controller
- * on any of the loaded hosts. Operation queue sizes specific to a host
- * are also read from this configuration handle
- * @param hosts set to the hosts found in the file; caller must free this if
- * number of hosts returned is greater than 0
- * @return number of hosts returned in 'hosts', 0 on error
- */
-unsigned int
-GNUNET_TESTBED_hosts_load_from_loadleveler (const struct
- GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TESTBED_Host
- ***hosts);
-
-/**
* Destroy a host handle. Must only be called once everything
* running on that host has been stopped.
*
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h
index 31665f8f7..adf5453e1 100644
--- a/src/include/gnunet_testing_ng_lib.h
+++ b/src/include/gnunet_testing_ng_lib.h
@@ -17,7 +17,6 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
-
/**
* @brief API for writing an interpreter to test GNUnet components
* @author Christian Grothoff <christian@grothoff.org>
@@ -49,6 +48,7 @@
/**
* Router of a network namespace.
+ * // FIXME: this does not belong here!
*/
struct GNUNET_TESTING_NetjailRouter
{
@@ -63,8 +63,10 @@ struct GNUNET_TESTING_NetjailRouter
unsigned int udp_port;
};
+
/**
* Enum for the different types of nodes.
+ * // FIXME: this does not belong here!
*/
enum GNUNET_TESTING_NODE_TYPE
{
@@ -79,6 +81,8 @@ enum GNUNET_TESTING_NODE_TYPE
GNUNET_TESTING_GLOBAL_NODE
};
+
+// FIXME: this does not belong here!
struct GNUNET_TESTING_ADDRESS_PREFIX
{
/**
@@ -97,10 +101,13 @@ struct GNUNET_TESTING_ADDRESS_PREFIX
char *address_prefix;
};
+
+// FIXME: this does not belong here!
struct GNUNET_TESTING_NetjailNode;
/**
* Connection to another node.
+ * // FIXME: this does not belong here!
*/
struct GNUNET_TESTING_NodeConnection
{
@@ -148,6 +155,7 @@ struct GNUNET_TESTING_NodeConnection
/**
* Node in the netjail topology.
+ * // FIXME: this does not belong here!
*/
struct GNUNET_TESTING_NetjailNode
{
@@ -185,6 +193,7 @@ struct GNUNET_TESTING_NetjailNode
/**
* Namespace in a topology.
+ * // FIXME: this does not belong here!
*/
struct GNUNET_TESTING_NetjailNamespace
{
@@ -206,6 +215,7 @@ struct GNUNET_TESTING_NetjailNamespace
/**
* Toplogy of our netjail setup.
+ * // FIXME: this does not belong here!
*/
struct GNUNET_TESTING_NetjailTopology
{
@@ -251,6 +261,36 @@ struct GNUNET_TESTING_NetjailTopology
struct GNUNET_TESTING_Interpreter;
/**
+ * State each asynchronous command must have in its closure.
+ */
+struct GNUNET_TESTING_AsyncContext
+{
+
+ /**
+ * Interpreter we are part of.
+ */
+ struct GNUNET_TESTING_Interpreter *is;
+
+ /**
+ * Function to call when done.
+ */
+ GNUNET_SCHEDULER_TaskCallback cont;
+
+ /**
+ * Closure for @e cont.
+ */
+ void *cont_cls;
+
+ /**
+ * Indication if the command finished (#GNUNET_OK).
+ * #GNUNET_NO if it is still running,
+ * #GNUNET_SYSERR if it failed.
+ */
+ enum GNUNET_GenericReturnValue finished;
+};
+
+
+/**
* A command to be run by the interpreter.
*/
struct GNUNET_TESTING_Command
@@ -279,57 +319,43 @@ struct GNUNET_TESTING_Command
* the asynchronous activity to terminate.
*
* @param cls closure
- * @param cmd command being run
- * @param i interpreter state
+ * @param is interpreter state
*/
void
(*run)(void *cls,
- const struct GNUNET_TESTING_Command *cmd,
- struct GNUNET_TESTING_Interpreter *i);
+ struct GNUNET_TESTING_Interpreter *is);
/**
- * Wait for any asynchronous execution of @e run to conclude,
- * then call finish_cont. Finish may only be called once per command.
- *
- * This member may be NULL if this command is a synchronous command,
- * and also should be set to NULL once the command has finished.
+ * Pointer to the asynchronous context in the command's
+ * closure. Used by the
+ * #GNUNET_TESTING_async_finish() and
+ * #GNUNET_TESTING_async_fail() functions.
*
- * @param cls closure
- * @param cont function to call upon completion, can be NULL
- * @param cont_cls closure for @a cont
- */
- int
- (*finish)(void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls);
-
- /**
- * Task for running the finish function.
+ * Must be NULL if a command is synchronous.
*/
- struct GNUNET_SCHEDULER_Task *finish_task;
+ struct GNUNET_TESTING_AsyncContext *ac;
/**
* Clean up after the command. Run during forced termination
* (CTRL-C) or test failure or test success.
*
* @param cls closure
- * @param cmd command being cleaned up
*/
void
- (*cleanup)(void *cls,
- const struct GNUNET_TESTING_Command *cmd);
+ (*cleanup)(void *cls);
/**
* Extract information from a command that is useful for other
- * commands.
+ * commands. Can be NULL if a command has no traits.
*
* @param cls closure
* @param[out] ret result (could be anything)
* @param trait name of the trait
* @param index index number of the object to extract.
- * @return #GNUNET_OK on success
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO if no trait was found
*/
- int
+ enum GNUNET_GenericReturnValue
(*traits)(void *cls,
const void **ret,
const char *trait,
@@ -357,13 +383,6 @@ struct GNUNET_TESTING_Command
struct GNUNET_TIME_Absolute last_req_time;
/**
- * How often did we try to execute this command? (In case it is a request
- * that is repated.) Note that a command must have some built-in retry
- * mechanism for this value to be useful.
- */
- unsigned int num_tries;
-
- /**
* In case @e asynchronous_finish is true, how long should we wait for this
* command to complete? If @e finish did not complete after this amount of
* time, the interpreter will fail. Should be set generously to ensure
@@ -372,6 +391,13 @@ struct GNUNET_TESTING_Command
struct GNUNET_TIME_Relative default_timeout;
/**
+ * How often did we try to execute this command? (In case it is a request
+ * that is repated.) Note that a command must have some built-in retry
+ * mechanism for this value to be useful.
+ */
+ unsigned int num_tries;
+
+ /**
* If "true", the interpreter should not immediately call
* @e finish, even if @e finish is non-NULL. Otherwise,
* #TALER_TESTING_cmd_finish() must be used
@@ -383,40 +409,15 @@ struct GNUNET_TESTING_Command
/**
- * Struct to use for command-specific context information closure of a command waiting
- * for another command.
- */
-struct SyncState
-{
- /**
- * Closure for all commands with command-specific context information.
- */
- void *cls;
-
- /**
- * The asynchronous command the synchronous command of this closure waits for.
- */
- const struct GNUNET_TESTING_Command *async_cmd;
-
- /**
- * Task for running the finish method of the asynchronous task the command is waiting for.
- */
- struct GNUNET_SCHEDULER_Task *finish_task;
-
- /**
- * When did the execution of this commands finish function start?
- */
- struct GNUNET_TIME_Absolute start_finish_time;
-};
-
-/**
* Lookup command by label.
*
+ * @param is interpreter to lookup command in
* @param label label of the command to lookup.
* @return the command, if it is found, or NULL.
*/
const struct GNUNET_TESTING_Command *
GNUNET_TESTING_interpreter_lookup_command (
+ struct GNUNET_TESTING_Interpreter *is,
const char *label);
@@ -437,7 +438,25 @@ GNUNET_TESTING_interpreter_get_current_label (
* @param is interpreter state.
*/
void
-GNUNET_TESTING_interpreter_fail ();
+GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is);
+
+
+/**
+ * The asynchronous command of @a ac has failed.
+ *
+ * @param ac command-specific context
+ */
+void
+GNUNET_TESTING_async_fail (struct GNUNET_TESTING_AsyncContext *ac);
+
+
+/**
+ * The asynchronous command of @a ac has finished.
+ *
+ * @param ac command-specific context
+ */
+void
+GNUNET_TESTING_async_finish (struct GNUNET_TESTING_AsyncContext *ac);
/**
@@ -455,8 +474,8 @@ GNUNET_TESTING_cmd_end (void);
* @param cmd command to make synchronous.
* @return a finish-command.
*/
-const struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_make_unblocking (const struct GNUNET_TESTING_Command cmd);
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_make_unblocking (struct GNUNET_TESTING_Command cmd);
/**
@@ -492,31 +511,46 @@ GNUNET_TESTING_cmd_rewind_ip (const char *label,
/**
- * Wait until we receive SIGCHLD signal. Then obtain the process trait of the
- * current command, wait on the the zombie and continue with the next command.
+ * Function called with the final result of the test.
*
- * @param is interpreter state.
+ * @param cls closure
+ * @param rv #GNUNET_OK if the test passed
*/
-// void
-// GNUNET_TESTING_wait_for_sigchld (struct GNUNET_TESTING_Interpreter *is);
-// => replace with child_management.c
+typedef void
+(*GNUNET_TESTING_ResultCallback)(void *cls,
+ enum GNUNET_GenericReturnValue rv);
/**
- * Start scheduling loop with signal handlers and run the
- * test suite with the @a commands.
+ * Run the testsuite. Note, CMDs are copied into
+ * the interpreter state because they are _usually_
+ * defined into the "run" method that returns after
+ * having scheduled the test interpreter.
*
- * @param cfg_name name of configuration file to use
* @param commands the list of command to execute
* @param timeout how long to wait for each command to execute
- * @return #GNUNET_OK if all is okay, != #GNUNET_OK otherwise.
- * non-GNUNET_OK codes are #GNUNET_SYSERR most of the
- * times.
+ * @param rc function to call with the final result
+ * @param rc_cls closure for @a rc
+ */
+void
+GNUNET_TESTING_run (struct GNUNET_TESTING_Command *commands,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_TESTING_ResultCallback rc,
+ void *rc_cls);
+
+
+/**
+ * Start a GNUnet scheduler event loop and
+ * run the testsuite. Return 0 upon success.
+ * Expected to be called directly from main().
+ *
+ * @param commands the list of command to execute
+ * @param timeout how long to wait for each command to execute
+ * @return EXIT_SUCCESS on success, EXIT_FAILURE on failure
*/
int
-GNUNET_TESTING_run (const char *cfg_filename,
- struct GNUNET_TESTING_Command *commands,
- struct GNUNET_TIME_Relative timeout);
+GNUNET_TESTING_main (struct GNUNET_TESTING_Command *commands,
+ struct GNUNET_TIME_Relative timeout);
/**
@@ -524,6 +558,8 @@ GNUNET_TESTING_run (const char *cfg_filename,
*
* @param prog program's name to look into
* @param marker chunk to find in @a prog
+ * // FIXME: this does not belong here! => libgnunetutil, maybe?
+ * // FIXME: return bool? document return value!
*/
int
GNUNET_TESTING_has_in_name (const char *prog,
@@ -537,7 +573,7 @@ GNUNET_TESTING_has_in_name (const char *prog,
*
* @param label command label.
* @param process_label label of a command that has a process trait
- * @param process_index index of the process trait at @a process_label
+ * @param process_index index of the process trait at @a process_label // FIXME: enum? needed?
* @param signal signal to send to @a process.
* @return the command.
*/
@@ -576,49 +612,8 @@ GNUNET_TESTING_cmd_batch (const char *label,
/**
- * Test if this command is a batch command.
- *
- * @return false if not, true if it is a batch command
- */
-// TODO: figure out if this needs to be exposed in the public API.
-int
-GNUNET_TESTING_cmd_is_batch (const struct GNUNET_TESTING_Command *cmd);
-
-
-/**
- * Advance internal pointer to next command.
- *
- * @param is interpreter state.
- */
-// TODO: figure out if this needs to be exposed in the public API.
-void
-GNUNET_TESTING_cmd_batch_next (struct GNUNET_TESTING_Interpreter *is);
-
-
-/**
- * Obtain what command the batch is at.
- *
- * @return cmd current batch command
- */
-// TODO: figure out if this needs to be exposed in the public API.
-struct GNUNET_TESTING_Command *
-GNUNET_TESTING_cmd_batch_get_current (const struct GNUNET_TESTING_Command *cmd);
-
-
-/**
- * Set what command the batch should be at.
- *
- * @param cmd current batch command
- * @param new_ip where to move the IP
- */
-// TODO: figure out if this needs to be exposed in the public API.
-void
-GNUNET_TESTING_cmd_batch_set_current (const struct GNUNET_TESTING_Command *cmd,
- unsigned int new_ip);
-
-
-/**
* Performance counter.
+ * // FIXME: this might not belong here!
*/
struct GNUNET_TESTING_Timer
{
@@ -714,7 +709,7 @@ GNUNET_TESTING_trait_end (void);
* @param index index number of the trait to extract.
* @return #GNUNET_OK when the trait is found.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits,
const void **ret,
const char *trait,
@@ -728,12 +723,12 @@ GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits,
*
* @param cmd command to extract trait from.
* @param index which process to pick if @a cmd
- * has multiple on offer.
+ * has multiple on offer. -- FIXME: remove?
* @param[out] processp set to the address of the pointer to the
* process.
* @return #GNUNET_OK on success.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_process (const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
struct GNUNET_OS_Process ***processp);
@@ -743,7 +738,7 @@ GNUNET_TESTING_get_trait_process (const struct GNUNET_TESTING_Command *cmd,
* Offer location where a command stores a pointer to a process.
*
* @param index offered location index number, in case there are
- * multiple on offer.
+ * multiple on offer. // FIXME: remove?
* @param processp process location to offer.
* @return the trait.
*/
@@ -755,7 +750,7 @@ GNUNET_TESTING_make_trait_process (unsigned int index,
/**
* Offer number trait, 32-bit version.
*
- * @param index the number's index number.
+ * @param index the number's index number. // FIXME: introduce enum?
* @param n number to offer.
*/
struct GNUNET_TESTING_Trait
@@ -767,11 +762,11 @@ GNUNET_TESTING_make_trait_uint32 (unsigned int index,
* Obtain a "number" value from @a cmd, 32-bit version.
*
* @param cmd command to extract the number from.
- * @param index the number's index number.
+ * @param index the number's index number. // FIXME: introduce enum?
* @param[out] n set to the number coming from @a cmd.
* @return #GNUNET_OK on success.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_uint32 (const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
const uint32_t **n);
@@ -780,7 +775,7 @@ GNUNET_TESTING_get_trait_uint32 (const struct GNUNET_TESTING_Command *cmd,
/**
* Offer number trait, 64-bit version.
*
- * @param index the number's index number.
+ * @param index the number's index number. // FIXME: introduce enum?
* @param n number to offer.
*/
struct GNUNET_TESTING_Trait
@@ -792,11 +787,11 @@ GNUNET_TESTING_make_trait_uint64 (unsigned int index,
* Obtain a "number" value from @a cmd, 64-bit version.
*
* @param cmd command to extract the number from.
- * @param index the number's index number.
+ * @param index the number's index number. // FIXME: introduce enum?
* @param[out] n set to the number coming from @a cmd.
* @return #GNUNET_OK on success.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_uint64 (const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
const uint64_t **n);
@@ -805,7 +800,7 @@ GNUNET_TESTING_get_trait_uint64 (const struct GNUNET_TESTING_Command *cmd,
/**
* Offer number trait, 64-bit signed version.
*
- * @param index the number's index number.
+ * @param index the number's index number. // FIXME: introduce enum?
* @param n number to offer.
*/
struct GNUNET_TESTING_Trait
@@ -817,11 +812,11 @@ GNUNET_TESTING_make_trait_int64 (unsigned int index,
* Obtain a "number" value from @a cmd, 64-bit signed version.
*
* @param cmd command to extract the number from.
- * @param index the number's index number.
+ * @param index the number's index number. // FIXME: introduce enum?
* @param[out] n set to the number coming from @a cmd.
* @return #GNUNET_OK on success.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_int64 (const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
const int64_t **n);
@@ -831,7 +826,7 @@ GNUNET_TESTING_get_trait_int64 (const struct GNUNET_TESTING_Command *cmd,
* Offer a number.
*
* @param index the number's index number.
- * @param n the number to offer.
+ * @param n the number to offer. // FIXME: introduce enum?
* @return #GNUNET_OK on success.
*/
struct GNUNET_TESTING_Trait
@@ -843,11 +838,11 @@ GNUNET_TESTING_make_trait_uint (unsigned int index,
* Obtain a number from @a cmd.
*
* @param cmd command to extract the number from.
- * @param index the number's index number.
+ * @param index the number's index number. // FIXME: introduce enum?
* @param[out] n set to the number coming from @a cmd.
* @return #GNUNET_OK on success.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_uint (const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
const unsigned int **n);
@@ -857,12 +852,12 @@ GNUNET_TESTING_get_trait_uint (const struct GNUNET_TESTING_Command *cmd,
*
* @param cmd command to extract the subject from.
* @param index index number associated with the transfer
- * subject to offer.
+ * subject to offer. // FIXME: introduce enum?
* @param[out] s where to write the offered
* string.
* @return #GNUNET_OK on success.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_string (
const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
@@ -873,7 +868,7 @@ GNUNET_TESTING_get_trait_string (
* Offer string subject.
*
* @param index index number associated with the transfer
- * subject being offered.
+ * subject being offered. // FIXME: introduce enum?
* @param s string to offer.
* @return the trait.
*/
@@ -887,9 +882,8 @@ GNUNET_TESTING_make_trait_string (unsigned int index,
* @param index always zero. Commands offering this
* kind of traits do not need this index. For
* example, a "meta" CMD returns always the
- * CMD currently being executed.
+ * CMD currently being executed. FIXME: remove!
* @param cmd wire details to offer.
- *
* @return the trait.
*/
struct GNUNET_TESTING_Trait
@@ -904,11 +898,11 @@ GNUNET_TESTING_make_trait_cmd (unsigned int index,
* @param index always zero. Commands offering this
* kind of traits do not need this index. For
* example, a "meta" CMD returns always the
- * CMD currently being executed.
+ * CMD currently being executed. FIXME: remove!
* @param[out] _cmd where to write the wire details.
* @return #GNUNET_OK on success.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_cmd (const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
struct GNUNET_TESTING_Command **_cmd);
@@ -919,11 +913,11 @@ GNUNET_TESTING_get_trait_cmd (const struct GNUNET_TESTING_Command *cmd,
*
* @param cmd command to extract the uuid from.
* @param index which amount to pick if @a cmd has multiple
- * on offer
+ * on offer // FIXME: introduce enum?
* @param[out] uuid where to write the uuid.
* @return #GNUNET_OK on success.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_uuid (const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
struct GNUNET_Uuid **uuid);
@@ -933,9 +927,8 @@ GNUNET_TESTING_get_trait_uuid (const struct GNUNET_TESTING_Command *cmd,
* Offer a uuid in a trait.
*
* @param index which uuid to offer, in case there are
- * multiple available.
+ * multiple available. // FIXME: introduce enum?
* @param uuid the uuid to offer.
- *
* @return the trait.
*/
struct GNUNET_TESTING_Trait
@@ -948,11 +941,11 @@ GNUNET_TESTING_make_trait_uuid (unsigned int index,
*
* @param cmd command to extract trait from
* @param index which time stamp to pick if
- * @a cmd has multiple on offer.
+ * @a cmd has multiple on offer // FIXME: introduce enum?
* @param[out] time set to the wanted WTID.
* @return #GNUNET_OK on success
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_absolute_time (
const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
@@ -1001,6 +994,9 @@ GNUNET_TESTING_make_trait_relative_time (
const struct GNUNET_TIME_Relative *time);
+// FIXME: move these commands into a separate libgnunetestingnetjail lib or so!
+
+
/**
* Create command.
*
@@ -1058,40 +1054,12 @@ GNUNET_TESTING_cmd_system_destroy (const char *label,
* Create command.
*
* @param label name for command.
- * @param local_m Number of local nodes in each namespace.
- * @param global_n The number of namespaces.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_start (const char *label,
- char *local_m,
- char *global_n);
-
-/**
- * Create command.
- *
- * @param label name for command.
* @param topology_config Configuration file for the test topology.
* @return command.
*/
struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_start_v2 (const char *label,
- char *topology_config);
-
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @param binaryname to exec.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
- char *local_m,
- char *global_n,
- char *plugin_name,
- unsigned int *rv);
+GNUNET_TESTING_cmd_netjail_start (const char *label,
+ char *topology_config);
/**
@@ -1103,22 +1071,20 @@ GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
* @return command.
*/
struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_start_testing_system_v2 (const char *label,
- const char *topology_config,
- unsigned int *rv);
+GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
+ const char *topology_config);
/**
* Create command.
*
* @param label name for command.
- * @param binaryname to stop.
+ * @param topology_config Configuration file for the test topology.
* @return command.
*/
struct GNUNET_TESTING_Command
GNUNET_TESTING_cmd_netjail_stop (const char *label,
- char *local_m,
- char *global_n);
+ char *topology_config);
/**
@@ -1129,33 +1095,31 @@ GNUNET_TESTING_cmd_netjail_stop (const char *label,
* @return command.
*/
struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_stop_v2 (const char *label,
- char *topology_config);
-
-
-struct GNUNET_TESTING_Command
GNUNET_TESTING_cmd_stop_testing_system (const char *label,
const char *helper_start_label,
- char *local_m,
- char *global_n);
+ const char *topology_config);
+
/**
- * Create command.
+ * Create a GNUNET_CMDS_LOCAL_FINISHED message.
*
- * @param label name for command.
- * @param topology_config Configuration file for the test topology.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_stop_testing_system_v2 (const char *label,
- const char *helper_start_label,
- const char *topology_config);
+ * @param rv The result of the local test as GNUNET_GenericReturnValue.
+ * @return The GNUNET_CMDS_LOCAL_FINISHED message.
+*/
+struct GNUNET_MessageHeader *
+GNUNET_TESTING_send_local_test_finished_msg (enum GNUNET_GenericReturnValue rv);
+/**
+ * Function to get the trait with the async context.
+ *
+ * @param[out] ac GNUNET_TESTING_AsyncContext.
+ * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
+ */
int
-GNUNET_TESTING_get_trait_helper_handles (const struct
- GNUNET_TESTING_Command *cmd,
- struct GNUNET_HELPER_Handle ***helper);
+GNUNET_TESTING_get_trait_async_context (
+ const struct GNUNET_TESTING_Command *cmd,
+ struct GNUNET_TESTING_AsyncContext **ac);
/**
@@ -1165,30 +1129,29 @@ GNUNET_TESTING_get_trait_helper_handles (const struct
* @param pt pointer to message.
* @return #GNUNET_OK on success.
*/
-int
-GNUNET_TESTING_get_trait_helper_handles_v2 (const struct
- GNUNET_TESTING_Command *cmd,
- struct GNUNET_HELPER_Handle ***
- helper);
+enum GNUNET_GenericReturnValue
+GNUNET_TESTING_get_trait_helper_handles (
+ const struct GNUNET_TESTING_Command *cmd,
+ struct GNUNET_HELPER_Handle ***helper);
struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label,
- unsigned int *
- all_peers_started);
+GNUNET_TESTING_cmd_block_until_all_peers_started (
+ const char *label,
+ unsigned int *all_peers_started);
struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_block_until_external_trigger (const char *label,
- unsigned int *
- stop_blocking);
+GNUNET_TESTING_cmd_block_until_external_trigger (
+ const char *label);
struct GNUNET_TESTING_Command
GNUNET_TESTING_cmd_send_peer_ready (const char *label,
TESTING_CMD_HELPER_write_cb write_message);
struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_local_test_finished (const char *label,
- TESTING_CMD_HELPER_write_cb
- write_message);
+GNUNET_TESTING_cmd_local_test_finished (
+ const char *label,
+ TESTING_CMD_HELPER_write_cb write_message);
+
#endif
diff --git a/src/messenger/gnunet-messenger.c b/src/messenger/gnunet-messenger.c
index 28fa4b147..e2d106be8 100644
--- a/src/messenger/gnunet-messenger.c
+++ b/src/messenger/gnunet-messenger.c
@@ -42,8 +42,11 @@ struct GNUNET_MESSENGER_Handle *messenger;
* @param[in] flags Flags of message
*/
void
-on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash,
+on_message (void *cls,
+ struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash,
enum GNUNET_MESSENGER_MessageFlags flags)
{
const char *sender_name = GNUNET_MESSENGER_contact_get_name (sender);
@@ -124,7 +127,8 @@ listen_stdio (void *cls);
#define MAX_BUFFER_SIZE 60000
static int
-iterate_send_private_message (void *cls, struct GNUNET_MESSENGER_Room *room,
+iterate_send_private_message (void *cls,
+ struct GNUNET_MESSENGER_Room *room,
const struct GNUNET_MESSENGER_Contact *contact)
{
struct GNUNET_MESSENGER_Message *message = cls;
@@ -226,7 +230,8 @@ struct GNUNET_SCHEDULER_Task *shutdown_task;
* @param[in/out] handle Handle of messenger service
*/
static void
-on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
+on_identity (void *cls,
+ struct GNUNET_MESSENGER_Handle *handle)
{
struct GNUNET_HashCode key;
memset (&key, 0, sizeof(key));
@@ -292,7 +297,10 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
* @param[in] cfg configuration
*/
static void
-run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg)
+run (void *cls,
+ char *const*args,
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
messenger = GNUNET_MESSENGER_connect (cfg, ego_name, &on_identity, NULL, &on_message, NULL);
@@ -307,7 +315,8 @@ run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFI
* @return #EXIT_SUCCESS ok, #EXIT_FAILURE on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
const char *description = "Open and connect to rooms using the MESSENGER to chat.";
diff --git a/src/messenger/gnunet-service-messenger.c b/src/messenger/gnunet-service-messenger.c
index 7edd76d32..989157ceb 100644
--- a/src/messenger/gnunet-service-messenger.c
+++ b/src/messenger/gnunet-service-messenger.c
@@ -39,14 +39,16 @@ struct GNUNET_MESSENGER_Client
struct GNUNET_MESSENGER_Service *messenger;
static int
-check_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg)
+check_create (void *cls,
+ const struct GNUNET_MESSENGER_CreateMessage *msg)
{
GNUNET_MQ_check_zero_termination(msg);
return GNUNET_OK;
}
static void
-handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg)
+handle_create (void *cls,
+ const struct GNUNET_MESSENGER_CreateMessage *msg)
{
struct GNUNET_MESSENGER_Client *msg_client = cls;
@@ -60,7 +62,8 @@ handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg)
}
static void
-handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg)
+handle_update (void *cls,
+ const struct GNUNET_MESSENGER_UpdateMessage *msg)
{
struct GNUNET_MESSENGER_Client *msg_client = cls;
@@ -70,7 +73,8 @@ handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg)
}
static void
-handle_destroy (void *cls, const struct GNUNET_MESSENGER_DestroyMessage *msg)
+handle_destroy (void *cls,
+ const struct GNUNET_MESSENGER_DestroyMessage *msg)
{
struct GNUNET_MESSENGER_Client *msg_client = cls;
@@ -78,14 +82,16 @@ handle_destroy (void *cls, const struct GNUNET_MESSENGER_DestroyMessage *msg)
}
static int
-check_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg)
+check_set_name (void *cls,
+ const struct GNUNET_MESSENGER_NameMessage *msg)
{
GNUNET_MQ_check_zero_termination(msg);
return GNUNET_OK;
}
static void
-handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg)
+handle_set_name (void *cls,
+ const struct GNUNET_MESSENGER_NameMessage *msg)
{
struct GNUNET_MESSENGER_Client *msg_client = cls;
@@ -99,7 +105,8 @@ handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg)
}
static void
-handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
+handle_room_open (void *cls,
+ const struct GNUNET_MESSENGER_RoomMessage *msg)
{
struct GNUNET_MESSENGER_Client *msg_client = cls;
@@ -125,7 +132,8 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
}
static void
-handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
+handle_room_entry (void *cls,
+ const struct GNUNET_MESSENGER_RoomMessage *msg)
{
struct GNUNET_MESSENGER_Client *msg_client = cls;
@@ -153,7 +161,8 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
}
static void
-handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
+handle_room_close (void *cls,
+ const struct GNUNET_MESSENGER_RoomMessage *msg)
{
struct GNUNET_MESSENGER_Client *msg_client = cls;
@@ -179,7 +188,8 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
}
static int
-check_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg)
+check_send_message (void *cls,
+ const struct GNUNET_MESSENGER_SendMessage *msg)
{
const uint16_t full_length = ntohs (msg->header.size);
@@ -224,7 +234,8 @@ check_for_message:
}
static void
-handle_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg)
+handle_send_message (void *cls,
+ const struct GNUNET_MESSENGER_SendMessage *msg)
{
struct GNUNET_MESSENGER_Client *msg_client = cls;
@@ -271,7 +282,8 @@ end_handling:
}
static void
-callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room,
+callback_found_message (void *cls,
+ struct GNUNET_MESSENGER_SrvRoom *room,
const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_HashCode *hash)
{
@@ -300,7 +312,8 @@ callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room,
}
static void
-handle_get_message (void *cls, const struct GNUNET_MESSENGER_GetMessage *msg)
+handle_get_message (void *cls,
+ const struct GNUNET_MESSENGER_GetMessage *msg)
{
struct GNUNET_MESSENGER_Client *msg_client = cls;
@@ -341,7 +354,9 @@ end_handling:
}
static void*
-callback_client_connect (void *cls, struct GNUNET_SERVICE_Client *client, struct GNUNET_MQ_Handle *mq)
+callback_client_connect (void *cls,
+ struct GNUNET_SERVICE_Client *client,
+ struct GNUNET_MQ_Handle *mq)
{
struct GNUNET_MESSENGER_Client *msg_client = GNUNET_new(struct GNUNET_MESSENGER_Client);
@@ -352,7 +367,9 @@ callback_client_connect (void *cls, struct GNUNET_SERVICE_Client *client, struct
}
static void
-callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls)
+callback_client_disconnect (void *cls,
+ struct GNUNET_SERVICE_Client *client,
+ void *internal_cls)
{
struct GNUNET_MESSENGER_Client *msg_client = internal_cls;
@@ -369,7 +386,9 @@ callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, voi
* @param[in/out] service the initialized service
*/
static void
-run (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service)
+run (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *config,
+ struct GNUNET_SERVICE_Handle *service)
{
messenger = create_service (config, service);
diff --git a/src/messenger/gnunet-service-messenger_basement.c b/src/messenger/gnunet-service-messenger_basement.c
index f302c8d66..89aa103ee 100644
--- a/src/messenger/gnunet-service-messenger_basement.c
+++ b/src/messenger/gnunet-service-messenger_basement.c
@@ -40,7 +40,9 @@ count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels)
}
int
-should_connect_tunnel_to (size_t count, size_t src, size_t dst)
+should_connect_tunnel_to (size_t count,
+ size_t src,
+ size_t dst)
{
if ((src + 1) % count == dst % count)
return GNUNET_YES;
@@ -49,7 +51,9 @@ should_connect_tunnel_to (size_t count, size_t src, size_t dst)
}
int
-required_connection_between (size_t count, size_t src, size_t dst)
+required_connection_between (size_t count,
+ size_t src,
+ size_t dst)
{
if (GNUNET_YES == should_connect_tunnel_to (count, src, dst))
return GNUNET_YES;
diff --git a/src/messenger/gnunet-service-messenger_basement.h b/src/messenger/gnunet-service-messenger_basement.h
index b19aec405..a097b482f 100644
--- a/src/messenger/gnunet-service-messenger_basement.h
+++ b/src/messenger/gnunet-service-messenger_basement.h
@@ -48,7 +48,9 @@ count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels);
* @return #GNUNET_YES or #GNUNET_NO based on topologic requirement
*/
int
-should_connect_tunnel_to (size_t count, size_t src, size_t dst);
+should_connect_tunnel_to (size_t count,
+ size_t src,
+ size_t dst);
/**
* Returns #GNUNET_YES or #GNUNET_NO to determine if the peers of index <i>src</i> and
@@ -61,6 +63,8 @@ should_connect_tunnel_to (size_t count, size_t src, size_t dst);
* @return #GNUNET_YES or #GNUNET_NO based on topologic requirement
*/
int
-required_connection_between (size_t count, size_t src, size_t dst);
+required_connection_between (size_t count,
+ size_t src,
+ size_t dst);
#endif //GNUNET_SERVICE_MESSENGER_BASEMENT_H
diff --git a/src/messenger/gnunet-service-messenger_ego_store.c b/src/messenger/gnunet-service-messenger_ego_store.c
index 3b069fcf5..c460ac1c7 100644
--- a/src/messenger/gnunet-service-messenger_ego_store.c
+++ b/src/messenger/gnunet-service-messenger_ego_store.c
@@ -28,7 +28,10 @@
#include "gnunet-service-messenger_handle.h"
static void
-callback_update_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier)
+callback_update_ego (void *cls,
+ struct GNUNET_IDENTITY_Ego *ego,
+ void **ctx,
+ const char *identifier)
{
if ((!ego) || (!identifier))
return;
@@ -41,7 +44,8 @@ callback_update_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, con
}
void
-init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config)
+init_ego_store(struct GNUNET_MESSENGER_EgoStore *store,
+ const struct GNUNET_CONFIGURATION_Handle *config)
{
GNUNET_assert ((store) && (config));
@@ -58,7 +62,9 @@ init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONF
static int
-iterate_destroy_egos (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_egos (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_Ego *ego = value;
GNUNET_free(ego);
@@ -112,7 +118,9 @@ clear_ego_store(struct GNUNET_MESSENGER_EgoStore *store)
}
static void
-callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, const char *emsg)
+callback_ego_create (void *cls,
+ const struct GNUNET_IDENTITY_PrivateKey *key,
+ const char *emsg)
{
struct GNUNET_MESSENGER_EgoOperation *element = cls;
struct GNUNET_MESSENGER_EgoStore *store = element->store;
@@ -139,7 +147,8 @@ callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, co
}
void
-create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier,
+create_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
+ const char *identifier,
void *handle)
{
GNUNET_assert ((store) && (identifier));
@@ -158,7 +167,8 @@ create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie
}
static void
-callback_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego)
+callback_ego_lookup (void *cls,
+ struct GNUNET_IDENTITY_Ego *ego)
{
struct GNUNET_MESSENGER_EgoLookup *element = cls;
struct GNUNET_MESSENGER_EgoStore *store = element->store;
@@ -183,8 +193,10 @@ callback_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego)
}
void
-lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier,
- GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls)
+lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store,
+ const char *identifier,
+ GNUNET_MESSENGER_EgoLookupCallback lookup,
+ void *cls)
{
GNUNET_assert (store);
@@ -219,7 +231,8 @@ lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier
}
struct GNUNET_MESSENGER_Ego*
-update_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier,
+update_store_ego(struct GNUNET_MESSENGER_EgoStore *store,
+ const char *identifier,
const struct GNUNET_IDENTITY_PrivateKey *key)
{
GNUNET_assert ((store) && (identifier) && (key));
@@ -244,7 +257,8 @@ update_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier
}
static void
-callback_ego_rename (void *cls, const char *emsg)
+callback_ego_rename (void *cls,
+ const char *emsg)
{
struct GNUNET_MESSENGER_EgoOperation *element = cls;
struct GNUNET_MESSENGER_EgoStore *store = element->store;
@@ -277,7 +291,8 @@ callback_ego_rename (void *cls, const char *emsg)
}
void
-rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier,
+rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
+ const char *old_identifier,
const char *new_identifier)
{
GNUNET_assert ((store) && (old_identifier) && (new_identifier));
diff --git a/src/messenger/gnunet-service-messenger_ego_store.h b/src/messenger/gnunet-service-messenger_ego_store.h
index 41f14fff2..4222a4e91 100644
--- a/src/messenger/gnunet-service-messenger_ego_store.h
+++ b/src/messenger/gnunet-service-messenger_ego_store.h
@@ -35,7 +35,8 @@ struct GNUNET_MESSENGER_Ego;
struct GNUNET_MESSENGER_EgoStore;
typedef void
-(*GNUNET_MESSENGER_EgoLookupCallback) (void *cls, const char *identifier,
+(*GNUNET_MESSENGER_EgoLookupCallback) (void *cls,
+ const char *identifier,
const struct GNUNET_MESSENGER_Ego *ego);
struct GNUNET_MESSENGER_EgoLookup
@@ -87,7 +88,8 @@ struct GNUNET_MESSENGER_EgoStore
* @param[in] config Configuration handle
*/
void
-init_ego_store (struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config);
+init_ego_store (struct GNUNET_MESSENGER_EgoStore *store,
+ const struct GNUNET_CONFIGURATION_Handle *config);
/**
* Clears an EGO-store, wipes its content and deallocates its memory.
@@ -107,7 +109,8 @@ clear_ego_store (struct GNUNET_MESSENGER_EgoStore *store);
* @param[in/out] handle Handle or NULL
*/
void
-create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier,
+create_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
+ const char *identifier,
void *handle);
/**
@@ -120,8 +123,10 @@ create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie
* @param[in] cls Closure
*/
void
-lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier,
- GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls);
+lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
+ const char *identifier,
+ GNUNET_MESSENGER_EgoLookupCallback lookup,
+ void *cls);
/**
* Updates the registration of an EGO to a <i>store</i> under
@@ -133,7 +138,8 @@ lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie
* @return Updated EGO
*/
struct GNUNET_MESSENGER_Ego*
-update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier,
+update_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
+ const char *identifier,
const struct GNUNET_IDENTITY_PrivateKey *key);
/**
@@ -146,7 +152,8 @@ update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifie
* @param[in] new_identifier New identifier string
*/
void
-rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier,
+rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
+ const char *old_identifier,
const char *new_identifier);
#endif //GNUNET_SERVICE_MESSENGER_EGO_STORE_H
diff --git a/src/messenger/gnunet-service-messenger_handle.c b/src/messenger/gnunet-service-messenger_handle.c
index d7007dbf6..2095f8b29 100644
--- a/src/messenger/gnunet-service-messenger_handle.c
+++ b/src/messenger/gnunet-service-messenger_handle.c
@@ -31,7 +31,8 @@
#include "messenger_api_util.h"
struct GNUNET_MESSENGER_SrvHandle*
-create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq)
+create_handle (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MQ_Handle *mq)
{
GNUNET_assert((service) && (mq));
@@ -49,7 +50,9 @@ create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle
}
int
-iterate_free_member_ids (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_free_member_ids (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
GNUNET_free(value);
@@ -74,7 +77,9 @@ destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle)
}
void
-get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir)
+get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle,
+ const char *name,
+ char **dir)
{
GNUNET_assert((handle) && (dir));
@@ -87,7 +92,8 @@ get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const c
}
static int
-create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
+create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key));
@@ -112,7 +118,8 @@ create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const
}
const struct GNUNET_ShortHashCode*
-get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
+get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key));
@@ -120,7 +127,8 @@ get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const str
}
int
-change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key,
+change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key,
const struct GNUNET_ShortHashCode *unique_id)
{
GNUNET_assert((handle) && (key) && (unique_id));
@@ -165,7 +173,8 @@ send_message_to_client:
}
static void
-change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
+change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const char *name)
{
GNUNET_assert(handle);
@@ -192,7 +201,8 @@ change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
}
static void
-change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego)
+change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Ego *ego)
{
GNUNET_assert(handle);
@@ -222,7 +232,9 @@ struct GNUNET_MESSENGER_MessageHandle
};
static int
-iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_send_message (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_MessageHandle *msg_handle = cls;
@@ -232,7 +244,8 @@ iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value)
}
void
-set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego)
+set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Ego *ego)
{
GNUNET_assert((handle) && (ego));
@@ -271,7 +284,9 @@ get_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle)
}
static void
-callback_setup_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego)
+callback_setup_handle_name (void *cls,
+ const char *name,
+ const struct GNUNET_MESSENGER_Ego *ego)
{
struct GNUNET_MESSENGER_SrvHandle *handle = cls;
@@ -285,7 +300,8 @@ callback_setup_handle_name (void *cls, const char *name, const struct GNUNET_MES
}
void
-setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
+setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const char *name)
{
GNUNET_assert(handle);
@@ -295,7 +311,9 @@ setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
}
static void
-callback_update_handle (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego)
+callback_update_handle (void *cls,
+ const char *name,
+ const struct GNUNET_MESSENGER_Ego *ego)
{
struct GNUNET_MESSENGER_SrvHandle *handle = cls;
@@ -326,7 +344,9 @@ update_handle (struct GNUNET_MESSENGER_SrvHandle *handle)
}
static void
-callback_set_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego)
+callback_set_handle_name (void *cls,
+ const char *name,
+ const struct GNUNET_MESSENGER_Ego *ego)
{
struct GNUNET_MESSENGER_SrvHandle *handle = cls;
@@ -383,7 +403,8 @@ callback_set_handle_name (void *cls, const char *name, const struct GNUNET_MESSE
}
void
-set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
+set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const char *name)
{
GNUNET_assert(handle);
@@ -403,7 +424,8 @@ set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name)
}
int
-open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
+open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key));
@@ -414,7 +436,8 @@ open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET
}
int
-entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door,
+entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_PeerIdentity *door,
const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (door) && (key));
@@ -426,7 +449,8 @@ entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE
}
int
-close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
+close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key));
@@ -437,7 +461,8 @@ close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE
}
int
-send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key,
+send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key,
const struct GNUNET_MESSENGER_Message *message)
{
GNUNET_assert((handle) && (key) && (message));
@@ -475,7 +500,8 @@ get_next_member_session_contect(const struct GNUNET_MESSENGER_MemberSession *ses
}
static const struct GNUNET_MESSENGER_MemberSession*
-get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
+get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key) && (handle->service));
@@ -497,9 +523,11 @@ get_handle_member_session (struct GNUNET_MESSENGER_SrvHandle *handle, const stru
}
void
-notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key,
+notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key,
const struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((handle) && (key) && (session) && (message) && (hash));
@@ -563,7 +591,8 @@ notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct G
}
static int
-callback_scan_for_rooms (void *cls, const char *filename)
+callback_scan_for_rooms (void *cls,
+ const char *filename)
{
struct GNUNET_MESSENGER_SrvHandle *handle = cls;
@@ -606,7 +635,9 @@ load_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle)
}
static int
-iterate_save_rooms (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_save_rooms (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_SrvHandle *handle = cls;
struct GNUNET_ShortHashCode *member_id = value;
diff --git a/src/messenger/gnunet-service-messenger_handle.h b/src/messenger/gnunet-service-messenger_handle.h
index d8ff3aaa8..97a984721 100644
--- a/src/messenger/gnunet-service-messenger_handle.h
+++ b/src/messenger/gnunet-service-messenger_handle.h
@@ -60,7 +60,8 @@ struct GNUNET_MESSENGER_SrvHandle
* @return New handle
*/
struct GNUNET_MESSENGER_SrvHandle*
-create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq);
+create_handle (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MQ_Handle *mq);
/**
* Destroys a handle and frees its memory fully.
@@ -79,7 +80,9 @@ destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle);
* @param[out] dir Path to store data
*/
void
-get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir);
+get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle,
+ const char *name,
+ char **dir);
/**
* Returns the member id of a given <i>handle</i> in a specific <i>room</i>.
@@ -91,7 +94,8 @@ get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const c
* @return Member id or NULL
*/
const struct GNUNET_ShortHashCode*
-get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key);
+get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key);
/**
* Changes the member id of a given <i>handle</i> in a specific <i>room</i> to match a <i>unique_id</i>
@@ -105,7 +109,8 @@ get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const str
* @return GNUNET_OK on success, otherwise GNUNET_SYSERR
*/
int
-change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key,
+change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key,
const struct GNUNET_ShortHashCode *unique_id);
/**
@@ -115,7 +120,8 @@ change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct
* @param[in] ego EGO key pair
*/
void
-set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego);
+set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Ego *ego);
/**
* Returns the EGO used by a given <i>handle</i>.
@@ -133,7 +139,8 @@ get_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle);
* @param[in] name Name (optionally: valid EGO name)
*/
void
-setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name);
+setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const char *name);
/**
* Tries to change the key pair of an EGO of a <i>handle</i> under the same name and informs all rooms
@@ -154,7 +161,8 @@ update_handle (struct GNUNET_MESSENGER_SrvHandle *handle);
* @param[in] name New name
*/
void
-set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name);
+set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const char *name);
/**
* Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and opens the
@@ -165,7 +173,8 @@ set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name);
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key);
+open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key);
/**
* Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and enters the room
@@ -177,7 +186,8 @@ open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door,
+entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_PeerIdentity *door,
const struct GNUNET_HashCode *key);
/**
@@ -189,7 +199,8 @@ entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key);
+close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key);
/**
* Sends a <i>message</i> from a given <i>handle</i> to the room using a specific <i>key</i>.
@@ -200,7 +211,8 @@ close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE
* @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise.
*/
int
-send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key,
+send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key,
const struct GNUNET_MESSENGER_Message *message);
/**
@@ -213,9 +225,11 @@ send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNU
* @param[in] hash Hash of message
*/
void
-notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key,
+notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key,
const struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Loads member ids and other potential configuration from a given <i>handle</i> which
diff --git a/src/messenger/gnunet-service-messenger_list_handles.c b/src/messenger/gnunet-service-messenger_list_handles.c
index adcbf6a42..c0ae18716 100644
--- a/src/messenger/gnunet-service-messenger_list_handles.c
+++ b/src/messenger/gnunet-service-messenger_list_handles.c
@@ -55,7 +55,8 @@ clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles)
}
void
-add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle)
+add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
+ struct GNUNET_MESSENGER_SrvHandle *handle)
{
GNUNET_assert((handles) && (handle));
@@ -67,7 +68,8 @@ add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MES
}
int
-remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle)
+remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
+ struct GNUNET_MESSENGER_SrvHandle *handle)
{
GNUNET_assert((handles) && (handle));
@@ -87,7 +89,8 @@ remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_
}
struct GNUNET_MESSENGER_SrvHandle*
-find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key)
+find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handles) && (key));
diff --git a/src/messenger/gnunet-service-messenger_list_handles.h b/src/messenger/gnunet-service-messenger_list_handles.h
index 9f7ca725f..f4d7ca5c0 100644
--- a/src/messenger/gnunet-service-messenger_list_handles.h
+++ b/src/messenger/gnunet-service-messenger_list_handles.h
@@ -69,7 +69,8 @@ clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles);
* @param[in/out] handle Handle
*/
void
-add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle);
+add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
+ struct GNUNET_MESSENGER_SrvHandle *handle);
/**
* Removes the first entry matching with a specific <i>handle</i> from the list of
@@ -80,7 +81,8 @@ add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MES
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle);
+remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles,
+ struct GNUNET_MESSENGER_SrvHandle *handle);
/**
* Searches linearly through the list of <i>handles</i> for members of a specific room
@@ -93,6 +95,7 @@ remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_
* @return First handle which is a current member
*/
struct GNUNET_MESSENGER_SrvHandle*
-find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key);
+find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles,
+ const struct GNUNET_HashCode *key);
#endif //GNUNET_SERVICE_MESSENGER_LIST_HANDLES_H
diff --git a/src/messenger/gnunet-service-messenger_list_messages.c b/src/messenger/gnunet-service-messenger_list_messages.c
index 2666ccdab..7092dc76f 100644
--- a/src/messenger/gnunet-service-messenger_list_messages.c
+++ b/src/messenger/gnunet-service-messenger_list_messages.c
@@ -52,7 +52,8 @@ clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages)
}
void
-add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash)
+add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((messages) && (hash));
@@ -64,7 +65,8 @@ add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const stru
}
void
-copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin)
+copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
+ const struct GNUNET_MESSENGER_ListMessages *origin)
{
GNUNET_assert((messages) && (origin));
@@ -75,7 +77,8 @@ copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct
}
void
-remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash)
+remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((messages) && (hash));
@@ -91,7 +94,8 @@ remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const
}
void
-load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path)
+load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
+ const char *path)
{
GNUNET_assert((messages) && (path));
@@ -125,7 +129,8 @@ load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *
}
void
-save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, const char *path)
+save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages,
+ const char *path)
{
GNUNET_assert((messages) && (path));
diff --git a/src/messenger/gnunet-service-messenger_list_messages.h b/src/messenger/gnunet-service-messenger_list_messages.h
index 93ec203ea..7abc8c00f 100644
--- a/src/messenger/gnunet-service-messenger_list_messages.h
+++ b/src/messenger/gnunet-service-messenger_list_messages.h
@@ -68,7 +68,8 @@ clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages);
* @param[in] hash Hash of message
*/
void
-add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash);
+add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
+ const struct GNUNET_HashCode *hash);
/**
* Copies all message hashes from an <i>origin</i> to another list.
@@ -77,7 +78,8 @@ add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const stru
* @param[in] origin Source list of hashes
*/
void
-copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin);
+copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
+ const struct GNUNET_MESSENGER_ListMessages *origin);
/**
* Removes the first entry with a matching <i>hash</i> from the list.
@@ -86,7 +88,8 @@ copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct
* @param[in] hash Hash of message
*/
void
-remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash);
+remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
+ const struct GNUNET_HashCode *hash);
/**
* Loads the list of message hashes from a file under a given <i>path</i>.
@@ -95,7 +98,8 @@ remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const
* @param[in] path Path of file
*/
void
-load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path);
+load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
+ const char *path);
/**
* Saves the list of message hashes to a file under a given <i>path</i>.
@@ -104,6 +108,7 @@ load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *
* @param[in] path Path of file
*/
void
-save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages, const char *path);
+save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages,
+ const char *path);
#endif //GNUNET_SERVICE_MESSENGER_LIST_MESSAGES_H
diff --git a/src/messenger/gnunet-service-messenger_member.c b/src/messenger/gnunet-service-messenger_member.c
index b0a735dbe..def57aef9 100644
--- a/src/messenger/gnunet-service-messenger_member.c
+++ b/src/messenger/gnunet-service-messenger_member.c
@@ -28,7 +28,8 @@
#include "gnunet-service-messenger_member_session.h"
struct GNUNET_MESSENGER_Member*
-create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id)
+create_member (struct GNUNET_MESSENGER_MemberStore *store,
+ const struct GNUNET_ShortHashCode *id)
{
GNUNET_assert (store);
@@ -50,7 +51,9 @@ create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_S
}
static int
-iterate_destroy_session (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_session (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_MemberSession *session = value;
destroy_member_session(session);
@@ -77,7 +80,8 @@ get_member_id (const struct GNUNET_MESSENGER_Member *member)
}
static int
-callback_scan_for_sessions (void *cls, const char *filename)
+callback_scan_for_sessions (void *cls,
+ const char *filename)
{
struct GNUNET_MESSENGER_Member *member = cls;
@@ -95,7 +99,8 @@ callback_scan_for_sessions (void *cls, const char *filename)
}
void
-load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory)
+load_member (struct GNUNET_MESSENGER_MemberStore *store,
+ const char *directory)
{
GNUNET_assert ((store) && (directory));
@@ -139,7 +144,9 @@ free_config:
}
static int
-iterate_load_next_session (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_load_next_session (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
const char* sessions_directory = cls;
@@ -156,7 +163,8 @@ iterate_load_next_session (void *cls, const struct GNUNET_HashCode *key, void *v
}
void
-load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory)
+load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member,
+ const char *directory)
{
GNUNET_assert ((member) && (directory));
@@ -169,7 +177,9 @@ load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const c
}
static int
-iterate_save_session (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_save_session (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
const char* sessions_directory = cls;
@@ -187,7 +197,8 @@ iterate_save_session (void *cls, const struct GNUNET_HashCode *key, void *value)
}
void
-save_member (struct GNUNET_MESSENGER_Member *member, const char *directory)
+save_member (struct GNUNET_MESSENGER_Member *member,
+ const char *directory)
{
GNUNET_assert ((member) && (directory));
@@ -221,7 +232,8 @@ save_member (struct GNUNET_MESSENGER_Member *member, const char *directory)
}
static void
-sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next)
+sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session,
+ struct GNUNET_MESSENGER_MemberSession *next)
{
GNUNET_assert((session) && (next));
@@ -235,7 +247,9 @@ sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session,
}
static int
-iterate_sync_session_contact (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_sync_session_contact (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_MemberSession *session = value;
@@ -254,7 +268,8 @@ sync_member_contacts (struct GNUNET_MESSENGER_Member *member)
}
struct GNUNET_MESSENGER_MemberSession*
-get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key)
+get_member_session (const struct GNUNET_MESSENGER_Member *member,
+ const struct GNUNET_IDENTITY_PublicKey *public_key)
{
GNUNET_assert ((member) && (public_key));
@@ -272,7 +287,9 @@ struct GNUNET_MESSENGER_ClosureSearchSession {
};
static int
-iterate_search_session (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_search_session (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_ClosureSearchSession* search = cls;
struct GNUNET_MESSENGER_MemberSession *session = value;
@@ -285,7 +302,8 @@ iterate_search_session (void *cls, const struct GNUNET_HashCode *key, void *valu
}
static struct GNUNET_MESSENGER_MemberSession*
-try_member_session (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key)
+try_member_session (struct GNUNET_MESSENGER_Member *member,
+ const struct GNUNET_IDENTITY_PublicKey *public_key)
{
struct GNUNET_MESSENGER_MemberSession* session = get_member_session(member, public_key);
@@ -301,7 +319,8 @@ try_member_session (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_
}
struct GNUNET_MESSENGER_MemberSession*
-get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message,
+get_member_session_of (struct GNUNET_MESSENGER_Member *member,
+ const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_HashCode *hash)
{
GNUNET_assert ((member) && (message) && (hash) &&
@@ -324,7 +343,8 @@ get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUN
}
void
-add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session)
+add_member_session (struct GNUNET_MESSENGER_Member *member,
+ struct GNUNET_MESSENGER_MemberSession *session)
{
if (!session)
return;
@@ -344,7 +364,8 @@ add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSEN
}
void
-remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session)
+remove_member_session (struct GNUNET_MESSENGER_Member *member,
+ struct GNUNET_MESSENGER_MemberSession *session)
{
GNUNET_assert ((member) && (session) && (session->member == member));
@@ -364,7 +385,9 @@ struct GNUNET_MESSENGER_ClosureIterateSessions {
};
static int
-iterate_member_sessions_it (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_member_sessions_it (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_ClosureIterateSessions *iterate = cls;
struct GNUNET_MESSENGER_MemberSession *session = value;
@@ -373,7 +396,9 @@ iterate_member_sessions_it (void *cls, const struct GNUNET_HashCode *key, void *
}
int
-iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void *cls)
+iterate_member_sessions (struct GNUNET_MESSENGER_Member *member,
+ GNUNET_MESSENGER_MemberIteratorCallback it,
+ void *cls)
{
GNUNET_assert ((member) && (member->sessions) && (it));
diff --git a/src/messenger/gnunet-service-messenger_member.h b/src/messenger/gnunet-service-messenger_member.h
index fb2e57cfb..46269315a 100644
--- a/src/messenger/gnunet-service-messenger_member.h
+++ b/src/messenger/gnunet-service-messenger_member.h
@@ -52,7 +52,8 @@ struct GNUNET_MESSENGER_Member
* @return New member or NULL
*/
struct GNUNET_MESSENGER_Member*
-create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id);
+create_member (struct GNUNET_MESSENGER_MemberStore *store,
+ const struct GNUNET_ShortHashCode *id);
/**
* Destroys a member and frees its memory fully.
@@ -80,7 +81,8 @@ get_member_id (const struct GNUNET_MESSENGER_Member *member);
* @param[in] directory Path to a directory
*/
void
-load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory);
+load_member (struct GNUNET_MESSENGER_MemberStore *store,
+ const char *directory);
/**
* Loads data about next sessions from a <i>directory</i> into an empty loaded
@@ -90,7 +92,8 @@ load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory);
* @param[in] directory Path to a directory
*/
void
-load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory);
+load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member,
+ const char *directory);
/**
* Saves data from a <i>member</i> into a directory which
@@ -100,7 +103,8 @@ load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const c
* @param[in] directory Path to a directory
*/
void
-save_member (struct GNUNET_MESSENGER_Member *member, const char *directory);
+save_member (struct GNUNET_MESSENGER_Member *member,
+ const char *directory);
/**
* Synchronizes contacts between all sessions from a given <i>member</i>
@@ -120,7 +124,8 @@ sync_member_contacts (struct GNUNET_MESSENGER_Member *member);
* @return Member session
*/
struct GNUNET_MESSENGER_MemberSession*
-get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key);
+get_member_session (const struct GNUNET_MESSENGER_Member *member,
+ const struct GNUNET_IDENTITY_PublicKey *public_key);
/**
* Returns the member session of a <i>member</i> using a public key which can verify
@@ -133,7 +138,8 @@ get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct G
* @return Member session
*/
struct GNUNET_MESSENGER_MemberSession*
-get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message,
+get_member_session_of (struct GNUNET_MESSENGER_Member *member,
+ const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_HashCode *hash);
/**
@@ -143,7 +149,8 @@ get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUN
* @param[in/out] session Member session
*/
void
-add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session);
+add_member_session (struct GNUNET_MESSENGER_Member *member,
+ struct GNUNET_MESSENGER_MemberSession *session);
/**
* Removes a given member <i>session</i> from its <i>member</i>.
@@ -152,7 +159,8 @@ add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSEN
* @param[in/out] session Member session
*/
void
-remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session);
+remove_member_session (struct GNUNET_MESSENGER_Member *member,
+ struct GNUNET_MESSENGER_MemberSession *session);
/**
* Iterate through all member sessions currently connected to a given <i>member</i>
@@ -165,6 +173,8 @@ remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MES
* @return Amount of sessions iterated through
*/
int
-iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void* cls);
+iterate_member_sessions (struct GNUNET_MESSENGER_Member *member,
+ GNUNET_MESSENGER_MemberIteratorCallback it,
+ void* cls);
#endif //GNUNET_SERVICE_MESSENGER_MEMBER_H
diff --git a/src/messenger/gnunet-service-messenger_member_session.c b/src/messenger/gnunet-service-messenger_member_session.c
index 690c703b2..03736941f 100644
--- a/src/messenger/gnunet-service-messenger_member_session.c
+++ b/src/messenger/gnunet-service-messenger_member_session.c
@@ -158,7 +158,9 @@ completion:
}
static int
-iterate_copy_history (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_copy_history (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_MemberSession *next = cls;
@@ -460,7 +462,8 @@ struct GNUNET_MESSENGER_MemberSessionHistoryEntry
};
static void
-load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path)
+load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
+ const char *path)
{
GNUNET_assert((session) && (path));
@@ -502,7 +505,8 @@ load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, con
}
void
-load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory)
+load_member_session (struct GNUNET_MESSENGER_Member *member,
+ const char *directory)
{
GNUNET_assert ((member) && (directory));
@@ -571,7 +575,8 @@ free_config:
}
static struct GNUNET_MESSENGER_MemberSession*
-get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next)
+get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session,
+ struct GNUNET_MESSENGER_MemberSession *next)
{
if (!next)
return NULL;
@@ -589,7 +594,8 @@ get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session, str
}
void
-load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory)
+load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session,
+ const char *directory)
{
GNUNET_assert ((session) && (directory));
@@ -640,7 +646,9 @@ free_config:
}
static int
-iterate_save_member_session_history_hentries (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_save_member_session_history_hentries (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_DISK_FileHandle *handle = cls;
unsigned char ownership = value? GNUNET_YES : GNUNET_NO;
@@ -652,7 +660,8 @@ iterate_save_member_session_history_hentries (void *cls, const struct GNUNET_Has
}
static void
-save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path)
+save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
+ const char *path)
{
GNUNET_assert((session) && (path));
@@ -678,7 +687,8 @@ save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, con
}
void
-save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory)
+save_member_session (struct GNUNET_MESSENGER_MemberSession *session,
+ const char *directory)
{
GNUNET_assert ((session) && (directory));
diff --git a/src/messenger/gnunet-service-messenger_member_session.h b/src/messenger/gnunet-service-messenger_member_session.h
index bf4d10f67..9ba801776 100644
--- a/src/messenger/gnunet-service-messenger_member_session.h
+++ b/src/messenger/gnunet-service-messenger_member_session.h
@@ -225,7 +225,8 @@ verify_member_session_as_sender (const struct GNUNET_MESSENGER_MemberSession *se
*/
int
check_member_session_history (const struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_HashCode *hash, int ownership);
+ const struct GNUNET_HashCode *hash,
+ int ownership);
/**
* Adds a given <i>message</i> to the history of a <i>session</i> using the messages
@@ -262,7 +263,8 @@ clear_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
* @param[in] directory Path to a directory
*/
void
-load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory);
+load_member_session (struct GNUNET_MESSENGER_Member *member,
+ const char *directory);
/**
* Loads the connection from one <i>session</i> to another through the
@@ -273,7 +275,8 @@ load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directo
* @param[in] directory Path to a directory
*/
void
-load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory);
+load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session,
+ const char *directory);
/**
* Saves data from a member <i>session</i> into a <i>directory</i> which can be
@@ -283,6 +286,7 @@ load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const
* @param[in] directory Path to a directory
*/
void
-save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory);
+save_member_session (struct GNUNET_MESSENGER_MemberSession *session,
+ const char *directory);
#endif //GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H
diff --git a/src/messenger/gnunet-service-messenger_member_store.c b/src/messenger/gnunet-service-messenger_member_store.c
index 2925965d4..e96ee3883 100644
--- a/src/messenger/gnunet-service-messenger_member_store.c
+++ b/src/messenger/gnunet-service-messenger_member_store.c
@@ -30,7 +30,8 @@
#include "gnunet-service-messenger_room.h"
void
-init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room)
+init_member_store (struct GNUNET_MESSENGER_MemberStore *store,
+ struct GNUNET_MESSENGER_SrvRoom *room)
{
GNUNET_assert ((store) && (room));
@@ -39,7 +40,9 @@ init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MES
}
static int
-iterate_destroy_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value)
+iterate_destroy_members (void *cls,
+ const struct GNUNET_ShortHashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_Member *member = value;
destroy_member(member);
@@ -75,7 +78,8 @@ get_member_store_key (const struct GNUNET_MESSENGER_MemberStore *store)
}
static int
-callback_scan_for_members (void *cls, const char *filename)
+callback_scan_for_members (void *cls,
+ const char *filename)
{
struct GNUNET_MESSENGER_MemberStore *store = cls;
@@ -94,7 +98,9 @@ callback_scan_for_members (void *cls, const char *filename)
}
static int
-iterate_load_next_member_sessions (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
+iterate_load_next_member_sessions (void *cls,
+ const struct GNUNET_ShortHashCode *id,
+ void *value)
{
const char *sync_dir = cls;
@@ -114,7 +120,9 @@ iterate_load_next_member_sessions (void *cls, const struct GNUNET_ShortHashCode
}
static int
-iterate_sync_member_contacts (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
+iterate_sync_member_contacts (void *cls,
+ const struct GNUNET_ShortHashCode *id,
+ void *value)
{
struct GNUNET_MESSENGER_Member *member = value;
@@ -126,7 +134,8 @@ iterate_sync_member_contacts (void *cls, const struct GNUNET_ShortHashCode *id,
}
void
-load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory)
+load_member_store (struct GNUNET_MESSENGER_MemberStore *store,
+ const char *directory)
{
GNUNET_assert ((store) && (directory));
@@ -143,7 +152,9 @@ load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc
}
static int
-iterate_save_members (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
+iterate_save_members (void *cls,
+ const struct GNUNET_ShortHashCode *id,
+ void *value)
{
const char *save_dir = cls;
@@ -164,7 +175,8 @@ iterate_save_members (void *cls, const struct GNUNET_ShortHashCode *id, void *va
}
void
-save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory)
+save_member_store (struct GNUNET_MESSENGER_MemberStore *store,
+ const char *directory)
{
GNUNET_assert ((store) && (directory));
@@ -179,7 +191,8 @@ save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc
}
struct GNUNET_MESSENGER_Member*
-get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id)
+get_store_member (const struct GNUNET_MESSENGER_MemberStore *store,
+ const struct GNUNET_ShortHashCode *id)
{
GNUNET_assert ((store) && (store->members) && (id));
@@ -187,7 +200,8 @@ get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct
}
struct GNUNET_MESSENGER_Member*
-get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message)
+get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store,
+ const struct GNUNET_MESSENGER_Message *message)
{
if ((GNUNET_MESSENGER_KIND_INFO == message->header.kind) ||
(GNUNET_MESSENGER_KIND_JOIN == message->header.kind))
@@ -197,7 +211,8 @@ get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GN
}
struct GNUNET_MESSENGER_Member*
-add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id)
+add_store_member (struct GNUNET_MESSENGER_MemberStore *store,
+ const struct GNUNET_ShortHashCode *id)
{
GNUNET_assert ((store) && (store->members));
@@ -227,7 +242,9 @@ struct GNUNET_MESSENGER_ClosureIterateMembers {
};
static int
-iterate_store_members_it (void *cls, const struct GNUNET_ShortHashCode *key, void *value)
+iterate_store_members_it (void *cls,
+ const struct GNUNET_ShortHashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_ClosureIterateMembers *iterate = cls;
struct GNUNET_MESSENGER_Member *member = value;
@@ -236,7 +253,8 @@ iterate_store_members_it (void *cls, const struct GNUNET_ShortHashCode *key, voi
}
int
-iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it,
+iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store,
+ GNUNET_MESSENGER_MemberIteratorCallback it,
void* cls)
{
GNUNET_assert ((store) && (store->members) && (it));
diff --git a/src/messenger/gnunet-service-messenger_member_store.h b/src/messenger/gnunet-service-messenger_member_store.h
index 859e4683d..af50f0d36 100644
--- a/src/messenger/gnunet-service-messenger_member_store.h
+++ b/src/messenger/gnunet-service-messenger_member_store.h
@@ -56,7 +56,8 @@ typedef int (*GNUNET_MESSENGER_MemberIteratorCallback) (
* @param room Room
*/
void
-init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room);
+init_member_store (struct GNUNET_MESSENGER_MemberStore *store,
+ struct GNUNET_MESSENGER_SrvRoom *room);
/**
* Clears a member <i>store</i>, wipes its content and deallocates its memory.
@@ -91,7 +92,8 @@ get_member_store_key (const struct GNUNET_MESSENGER_MemberStore *store);
* @param[in] directory Path to a directory
*/
void
-load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory);
+load_member_store (struct GNUNET_MESSENGER_MemberStore *store,
+ const char *directory);
/**
* Saves members from a member <i>store</i> into a directory.
@@ -100,7 +102,8 @@ load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc
* @param[in] directory Path to a directory
*/
void
-save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory);
+save_member_store (struct GNUNET_MESSENGER_MemberStore *store,
+ const char *directory);
/**
* Returns the member in a <i>store</i> identified by a given <i>id</i>. If the <i>store</i>
@@ -111,7 +114,8 @@ save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *direc
* @return Member or NULL
*/
struct GNUNET_MESSENGER_Member*
-get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id);
+get_store_member (const struct GNUNET_MESSENGER_MemberStore *store,
+ const struct GNUNET_ShortHashCode *id);
/**
* Returns the member of a <i>store</i> using a sender id of a given <i>message</i>.
@@ -122,7 +126,8 @@ get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct
* @return Member or NULL
*/
struct GNUNET_MESSENGER_Member*
-get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message);
+get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store,
+ const struct GNUNET_MESSENGER_Message *message);
/**
* Adds a member to a <i>store</i> under a specific <i>id</i> and returns it on success.
@@ -132,7 +137,8 @@ get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GN
* @return Member or NULL
*/
struct GNUNET_MESSENGER_Member*
-add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id);
+add_store_member (struct GNUNET_MESSENGER_MemberStore *store,
+ const struct GNUNET_ShortHashCode *id);
/**
* Iterate through all member sessions currently connected to the members of the given
@@ -145,7 +151,8 @@ add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNE
* @return Amount of members iterated through
*/
int
-iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it,
+iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store,
+ GNUNET_MESSENGER_MemberIteratorCallback it,
void* cls);
#endif //GNUNET_SERVICE_MESSENGER_MEMBER_STORE_H
diff --git a/src/messenger/gnunet-service-messenger_message_handle.c b/src/messenger/gnunet-service-messenger_message_handle.c
index 86f2b901a..701d78c89 100644
--- a/src/messenger/gnunet-service-messenger_message_handle.c
+++ b/src/messenger/gnunet-service-messenger_message_handle.c
@@ -27,7 +27,8 @@
static void
handle_session_switch (struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_MESSENGER_MemberSession *next = switch_member_session(session, message, hash);
@@ -36,8 +37,10 @@ handle_session_switch (struct GNUNET_MESSENGER_MemberSession *session,
}
void
-handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) joins room (%s).\n",
GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room)));
@@ -54,8 +57,10 @@ handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
}
void
-handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) leaves room (%s).\n",
GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room)));
@@ -64,8 +69,10 @@ handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE
}
void
-handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_MESSENGER_Contact *contact = get_member_session_contact(session);
@@ -76,15 +83,19 @@ handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
}
void
-handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
handle_session_switch (session, message, hash);
}
void
-handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
if (GNUNET_NO == contains_list_tunnels (&(room->basement), &(message->body.peer.peer)))
add_to_list_tunnels (&(room->basement), &(message->body.peer.peer));
@@ -94,8 +105,10 @@ handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
}
void
-handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
handle_session_switch (session, message, hash);
@@ -108,8 +121,10 @@ handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
}
void
-handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_MESSENGER_ListTunnel *element = find_list_tunnels (&(room->basement), &(message->body.peer.peer), NULL);
@@ -123,8 +138,10 @@ handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
}
void
-handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_TIME_Relative delay = GNUNET_TIME_relative_ntoh (message->body.deletion.delay);
struct GNUNET_TIME_Absolute action = GNUNET_TIME_absolute_ntoh (message->header.timestamp);
diff --git a/src/messenger/gnunet-service-messenger_message_handle.h b/src/messenger/gnunet-service-messenger_message_handle.h
index 844142b77..0e5be3408 100644
--- a/src/messenger/gnunet-service-messenger_message_handle.h
+++ b/src/messenger/gnunet-service-messenger_message_handle.h
@@ -45,8 +45,10 @@
* @param[in] hash Hash of the message
*/
void
-handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a received or sent leave message to make changes of current member information.
@@ -58,8 +60,10 @@ handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
* @param[in] hash Hash of the message
*/
void
-handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a received or sent name message to rename a current member.
@@ -71,8 +75,10 @@ handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE
* @param[in] hash Hash of the message
*/
void
-handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a received or sent key message to change the key of a member and rearrange the contacts accordingly.
@@ -84,8 +90,10 @@ handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
* @param[in] hash Hash of the message
*/
void
-handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a received or sent peer message to make changes of the basement in the room.
@@ -97,8 +105,10 @@ handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENG
* @param[in] hash Hash of the message
*/
void
-handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a received or sent id message to change a members id.
@@ -110,8 +120,10 @@ handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
* @param[in] hash Hash of the message
*/
void
-handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a received or sent miss message to drop a peer from the basement in the room.
@@ -123,8 +135,10 @@ handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
* @param[in] hash Hash of the message
*/
void
-handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a received or sent delete message to delete a specific message from the store.
@@ -136,7 +150,9 @@ handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN
* @param[in] hash Hash of the message
*/
void
-handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_HANDLE_H
diff --git a/src/messenger/gnunet-service-messenger_message_kind.c b/src/messenger/gnunet-service-messenger_message_kind.c
index 3edcade91..2449b9230 100644
--- a/src/messenger/gnunet-service-messenger_message_kind.c
+++ b/src/messenger/gnunet-service-messenger_message_kind.c
@@ -190,7 +190,8 @@ create_message_request (const struct GNUNET_HashCode *hash)
}
struct GNUNET_MESSENGER_Message*
-create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key)
+create_message_invite (const struct GNUNET_PeerIdentity *door,
+ const struct GNUNET_HashCode *key)
{
if ((!door) || (!key))
return NULL;
@@ -222,7 +223,8 @@ create_message_text (const char *text)
}
struct GNUNET_MESSENGER_Message*
-create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
+create_message_delete (const struct GNUNET_HashCode *hash,
+ const struct GNUNET_TIME_Relative delay)
{
if (!hash)
return NULL;
diff --git a/src/messenger/gnunet-service-messenger_message_kind.h b/src/messenger/gnunet-service-messenger_message_kind.h
index c098868c0..508f19074 100644
--- a/src/messenger/gnunet-service-messenger_message_kind.h
+++ b/src/messenger/gnunet-service-messenger_message_kind.h
@@ -146,7 +146,8 @@ create_message_request (const struct GNUNET_HashCode *hash);
* @return New message
*/
struct GNUNET_MESSENGER_Message*
-create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key);
+create_message_invite (const struct GNUNET_PeerIdentity *door,
+ const struct GNUNET_HashCode *key);
/**
* Creates and allocates a new <i>text message containing a string representing text.
@@ -167,6 +168,7 @@ create_message_text (const char *text);
* @return New message
*/
struct GNUNET_MESSENGER_Message*
-create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay);
+create_message_delete (const struct GNUNET_HashCode *hash,
+ const struct GNUNET_TIME_Relative delay);
#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H
diff --git a/src/messenger/gnunet-service-messenger_message_recv.c b/src/messenger/gnunet-service-messenger_message_recv.c
index b2a5052d2..bb6ee6f17 100644
--- a/src/messenger/gnunet-service-messenger_message_recv.c
+++ b/src/messenger/gnunet-service-messenger_message_recv.c
@@ -28,8 +28,10 @@
#include "gnunet-service-messenger_operation.h"
static void
-forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
- struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_CONTAINER_MultiHashMap *map)
+forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ struct GNUNET_CONTAINER_MultiHashMap *map)
{
if (session->prev)
forward_about_members (room, tunnel, session->prev, map);
@@ -54,8 +56,9 @@ forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESS
}
static int
-iterate_forward_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key,
- struct GNUNET_MESSENGER_MemberSession *session)
+iterate_forward_members (void *cls,
+ const struct GNUNET_IDENTITY_PublicKey *public_key,
+ struct GNUNET_MESSENGER_MemberSession *session)
{
struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
@@ -71,8 +74,10 @@ iterate_forward_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *publ
}
int
-recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
const uint32_t version = get_tunnel_messenger_version(tunnel);
@@ -108,8 +113,10 @@ recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
}
int
-recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_PeerIdentity peer;
GNUNET_PEER_resolve (tunnel->peer, &peer);
@@ -126,7 +133,8 @@ recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
}
static void
-callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room,
+callback_found_message (void *cls,
+ struct GNUNET_MESSENGER_SrvRoom *room,
const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_HashCode *hash)
{
@@ -152,8 +160,10 @@ callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room,
* It will only be forwarded if it can't be answered!
*/
int
-recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room);
struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message);
diff --git a/src/messenger/gnunet-service-messenger_message_recv.h b/src/messenger/gnunet-service-messenger_message_recv.h
index 9cb36c466..400c10245 100644
--- a/src/messenger/gnunet-service-messenger_message_recv.h
+++ b/src/messenger/gnunet-service-messenger_message_recv.h
@@ -46,8 +46,10 @@
* @return #GNUNET_NO to not forward the message
*/
int
-recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a received peer message to link it to its origin tunnel if the peer identity matches.
@@ -60,8 +62,10 @@ recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
* @return #GNUNET_YES to forward the message
*/
int
-recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a received request message by checking for the requested message and forwarding it back
@@ -75,7 +79,9 @@ recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
* @return #GNUNET_YES or #GNUNET_NO depending on required forwarding
*/
int
-recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H
diff --git a/src/messenger/gnunet-service-messenger_message_send.c b/src/messenger/gnunet-service-messenger_message_send.c
index a59a178cc..8cc2466d7 100644
--- a/src/messenger/gnunet-service-messenger_message_send.c
+++ b/src/messenger/gnunet-service-messenger_message_send.c
@@ -30,15 +30,19 @@
#include "gnunet-service-messenger_operation.h"
void
-send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+send_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
check_room_peer_status(room, NULL);
}
void
-send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
if (!room->peer_message)
room->peer_message = GNUNET_new(struct GNUNET_HashCode);
@@ -47,15 +51,19 @@ send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
}
void
-send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+send_message_id (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
change_handle_member_id (handle, get_room_key(room), &(message->body.id.id));
}
void
-send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+send_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room);
diff --git a/src/messenger/gnunet-service-messenger_message_send.h b/src/messenger/gnunet-service-messenger_message_send.h
index 63320ab17..232355c41 100644
--- a/src/messenger/gnunet-service-messenger_message_send.h
+++ b/src/messenger/gnunet-service-messenger_message_send.h
@@ -44,8 +44,10 @@
* @param[in] hash Hash of the message
*/
void
-send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+send_message_join (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a sent peer message to update the rooms peer message of this service.
@@ -57,8 +59,10 @@ send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
* @param[in] hash Hash of the message
*/
void
-send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a sent id message to update the handles member id in the room.
@@ -70,8 +74,10 @@ send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
* @param[in] hash Hash of the message
*/
void
-send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+send_message_id (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a sent request message to trigger the request operation for this service.
@@ -83,7 +89,9 @@ send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_
* @param[in] hash Hash of the message
*/
void
-send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+send_message_request (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_SEND_H
diff --git a/src/messenger/gnunet-service-messenger_message_state.c b/src/messenger/gnunet-service-messenger_message_state.c
index cdd2d9712..344962d11 100644
--- a/src/messenger/gnunet-service-messenger_message_state.c
+++ b/src/messenger/gnunet-service-messenger_message_state.c
@@ -65,8 +65,10 @@ get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state)
}
void
-update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+update_message_state (struct GNUNET_MESSENGER_MessageState *state,
+ int requested,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((state) && (message) && (hash));
@@ -83,7 +85,8 @@ update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested
}
void
-load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path)
+load_message_state (struct GNUNET_MESSENGER_MessageState *state,
+ const char *path)
{
GNUNET_assert((state) && (path));
@@ -95,7 +98,8 @@ load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *pat
}
void
-save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path)
+save_message_state (const struct GNUNET_MESSENGER_MessageState *state,
+ const char *path)
{
GNUNET_assert((state) && (path));
diff --git a/src/messenger/gnunet-service-messenger_message_state.h b/src/messenger/gnunet-service-messenger_message_state.h
index dc8671df4..af52b26b6 100644
--- a/src/messenger/gnunet-service-messenger_message_state.h
+++ b/src/messenger/gnunet-service-messenger_message_state.h
@@ -51,13 +51,17 @@ const struct GNUNET_HashCode*
get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state);
void
-update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+update_message_state (struct GNUNET_MESSENGER_MessageState *state,
+ int requested,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
void
-load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path);
+load_message_state (struct GNUNET_MESSENGER_MessageState *state,
+ const char *path);
void
-save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path);
+save_message_state (const struct GNUNET_MESSENGER_MessageState *state,
+ const char *path);
#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STATE_H
diff --git a/src/messenger/gnunet-service-messenger_message_store.c b/src/messenger/gnunet-service-messenger_message_store.c
index 1984eba21..56448997a 100644
--- a/src/messenger/gnunet-service-messenger_message_store.c
+++ b/src/messenger/gnunet-service-messenger_message_store.c
@@ -42,7 +42,9 @@ init_message_store (struct GNUNET_MESSENGER_MessageStore *store)
}
static int
-iterate_destroy_entries (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_entries (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_MessageEntry *entry = value;
@@ -52,7 +54,9 @@ iterate_destroy_entries (void *cls, const struct GNUNET_HashCode *key, void *val
}
static int
-iterate_destroy_messages (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_messages (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_Message *message = value;
@@ -62,7 +66,9 @@ iterate_destroy_messages (void *cls, const struct GNUNET_HashCode *key, void *va
}
static int
-iterate_destroy_links (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_links (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_HashCode *previous = value;
@@ -99,7 +105,8 @@ struct GNUNET_MESSENGER_MessageEntryStorage
};
static void
-load_message_store_entries (struct GNUNET_MESSENGER_MessageStore *store, const char *filename)
+load_message_store_entries (struct GNUNET_MESSENGER_MessageStore *store,
+ const char *filename)
{
enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ);
@@ -146,7 +153,8 @@ struct GNUNET_MESSENGER_MessageLinkStorage
};
static void
-load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, const char *filename)
+load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store,
+ const char *filename)
{
enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ);
@@ -187,7 +195,8 @@ load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, const cha
}
void
-load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory)
+load_message_store (struct GNUNET_MESSENGER_MessageStore *store,
+ const char *directory)
{
GNUNET_assert((store) && (directory));
@@ -232,7 +241,9 @@ struct GNUNET_MESSENGER_ClosureMessageSave
};
static int
-iterate_save_entries (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_save_entries (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_ClosureMessageSave *save = cls;
struct GNUNET_MESSENGER_MessageEntry *entry = value;
@@ -248,7 +259,9 @@ iterate_save_entries (void *cls, const struct GNUNET_HashCode *key, void *value)
}
static int
-iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_save_messages (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_ClosureMessageSave *save = cls;
@@ -279,7 +292,9 @@ iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value
}
static int
-iterate_save_links (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_save_links (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_ClosureMessageSave *save = cls;
struct GNUNET_MESSENGER_MessageLink *link = value;
@@ -295,7 +310,8 @@ iterate_save_links (void *cls, const struct GNUNET_HashCode *key, void *value)
}
void
-save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory)
+save_message_store (struct GNUNET_MESSENGER_MessageStore *store,
+ const char *directory)
{
GNUNET_assert((store) && (directory));
@@ -372,7 +388,8 @@ close_entries:
}
int
-contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash)
+contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((store) && (hash));
@@ -383,7 +400,8 @@ contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const
}
const struct GNUNET_MESSENGER_Message*
-get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash)
+get_store_message (struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((store) && (hash));
@@ -444,7 +462,8 @@ free_buffer:
}
const struct GNUNET_MESSENGER_MessageLink*
-get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash,
+get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash,
int deleted_only)
{
if (deleted_only)
@@ -473,7 +492,8 @@ get_link:
}
int
-put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash,
+put_store_message (struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash,
struct GNUNET_MESSENGER_Message *message)
{
GNUNET_assert((store) && (hash) && (message));
@@ -483,7 +503,8 @@ put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU
}
static void
-add_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash,
+add_link (struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash,
const struct GNUNET_MESSENGER_Message *message)
{
struct GNUNET_MESSENGER_MessageLink *link = GNUNET_new(struct GNUNET_MESSENGER_MessageLink);
@@ -503,7 +524,8 @@ add_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashC
}
int
-delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash)
+delete_store_message (struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((store) && (hash));
diff --git a/src/messenger/gnunet-service-messenger_message_store.h b/src/messenger/gnunet-service-messenger_message_store.h
index 87305826a..476d98dd5 100644
--- a/src/messenger/gnunet-service-messenger_message_store.h
+++ b/src/messenger/gnunet-service-messenger_message_store.h
@@ -81,7 +81,8 @@ clear_message_store (struct GNUNET_MESSENGER_MessageStore *store);
* @param[in] directory Path to a directory
*/
void
-load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory);
+load_message_store (struct GNUNET_MESSENGER_MessageStore *store,
+ const char *directory);
/**
* Saves messages from a message <i>store</i> into a <i>directory</i>.
@@ -90,7 +91,8 @@ load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir
* @param[in] directory Path to a directory
*/
void
-save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory);
+save_message_store (struct GNUNET_MESSENGER_MessageStore *store,
+ const char *directory);
/**
* Checks if a message matching a given <i>hash</i> is stored in a message <i>store</i>.
@@ -103,7 +105,8 @@ save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir
* @return #GNUNET_YES on match, otherwise #GNUNET_NO
*/
int
-contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash);
+contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash);
/**
* Returns the message from a message <i>store</i> matching a given <i>hash</i>. If no matching
@@ -117,7 +120,8 @@ contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const
* @return Message or NULL
*/
const struct GNUNET_MESSENGER_Message*
-get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash);
+get_store_message (struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash);
/**
* Returns the message link from a message <i>store</i> matching a given <i>hash</i>. If the
@@ -133,7 +137,8 @@ get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU
* @return Message link or NULL
*/
const struct GNUNET_MESSENGER_MessageLink*
-get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash,
+get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash,
int deleted_only);
/**
@@ -145,7 +150,8 @@ get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struc
* @return #GNUNET_OK on success, otherwise #GNUNET_NO
*/
int
-put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash,
+put_store_message (struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash,
struct GNUNET_MESSENGER_Message *message);
/**
@@ -157,6 +163,7 @@ put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU
* @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
*/
int
-delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash);
+delete_store_message (struct GNUNET_MESSENGER_MessageStore *store,
+ const struct GNUNET_HashCode *hash);
#endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STORE_H
diff --git a/src/messenger/gnunet-service-messenger_operation.c b/src/messenger/gnunet-service-messenger_operation.c
index d0c378699..a8744e577 100644
--- a/src/messenger/gnunet-service-messenger_operation.c
+++ b/src/messenger/gnunet-service-messenger_operation.c
@@ -58,7 +58,8 @@ static void
callback_operation (void *cls);
struct GNUNET_MESSENGER_Operation*
-load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path)
+load_operation (struct GNUNET_MESSENGER_OperationStore *store,
+ const char *path)
{
GNUNET_assert((store) && (path));
@@ -118,7 +119,8 @@ destroy_config:
}
void
-save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path)
+save_operation (const struct GNUNET_MESSENGER_Operation *op,
+ const char *path)
{
GNUNET_assert((path) && (op));
diff --git a/src/messenger/gnunet-service-messenger_operation.h b/src/messenger/gnunet-service-messenger_operation.h
index f1e06f4a7..485668548 100644
--- a/src/messenger/gnunet-service-messenger_operation.h
+++ b/src/messenger/gnunet-service-messenger_operation.h
@@ -86,7 +86,8 @@ destroy_operation (struct GNUNET_MESSENGER_Operation *op);
* @param[in] path Path of a configuration file
*/
struct GNUNET_MESSENGER_Operation*
-load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path);
+load_operation (struct GNUNET_MESSENGER_OperationStore *store,
+ const char *path);
/**
* Saves data from an <i>operation</i> into a configuration file at a
@@ -97,7 +98,8 @@ load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path)
* @param[in] path Path of a configuration file
*/
void
-save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path);
+save_operation (const struct GNUNET_MESSENGER_Operation *op,
+ const char *path);
/**
* Starts an inactive operation with a given <i>delay</i> in a
diff --git a/src/messenger/gnunet-service-messenger_operation_store.c b/src/messenger/gnunet-service-messenger_operation_store.c
index a32fbad2c..4f8419daa 100644
--- a/src/messenger/gnunet-service-messenger_operation_store.c
+++ b/src/messenger/gnunet-service-messenger_operation_store.c
@@ -29,7 +29,8 @@
#include "gnunet-service-messenger_room.h"
void
-init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room)
+init_operation_store (struct GNUNET_MESSENGER_OperationStore *store,
+ struct GNUNET_MESSENGER_SrvRoom *room)
{
GNUNET_assert((store) && (room));
@@ -38,7 +39,9 @@ init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUN
}
static int
-iterate_destroy_operations (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_operations (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_Operation *op = value;
@@ -57,7 +60,8 @@ clear_operation_store (struct GNUNET_MESSENGER_OperationStore *store)
}
static int
-callback_scan_for_operations (void *cls, const char *filename)
+callback_scan_for_operations (void *cls,
+ const char *filename)
{
struct GNUNET_MESSENGER_OperationStore *store = cls;
@@ -94,7 +98,9 @@ load_operation_store (struct GNUNET_MESSENGER_OperationStore *store,
}
static int
-iterate_save_operations (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_save_operations (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
const char *save_dir = cls;
@@ -192,10 +198,12 @@ cancel_store_operation (struct GNUNET_MESSENGER_OperationStore *store,
}
extern void
-callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash);
+callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_HashCode *hash);
extern void
-callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash);
+callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_HashCode *hash);
void
callback_store_operation (struct GNUNET_MESSENGER_OperationStore *store,
diff --git a/src/messenger/gnunet-service-messenger_operation_store.h b/src/messenger/gnunet-service-messenger_operation_store.h
index 4c613437c..18eb7f8a1 100644
--- a/src/messenger/gnunet-service-messenger_operation_store.h
+++ b/src/messenger/gnunet-service-messenger_operation_store.h
@@ -48,7 +48,8 @@ struct GNUNET_MESSENGER_OperationStore
* @param[in/out] room Room
*/
void
-init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room);
+init_operation_store (struct GNUNET_MESSENGER_OperationStore *store,
+ struct GNUNET_MESSENGER_SrvRoom *room);
/**
* Clears an operation <i>store</i>, stops all operations and deallocates its memory.
diff --git a/src/messenger/gnunet-service-messenger_room.c b/src/messenger/gnunet-service-messenger_room.c
index 73e94908f..920abb10e 100644
--- a/src/messenger/gnunet-service-messenger_room.c
+++ b/src/messenger/gnunet-service-messenger_room.c
@@ -43,7 +43,8 @@ static void
idle_request_room_messages (void *cls);
struct GNUNET_MESSENGER_SrvRoom*
-create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key)
+create_room (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key));
@@ -78,7 +79,9 @@ create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_Hash
}
static int
-iterate_destroy_tunnels (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
+iterate_destroy_tunnels (void *cls,
+ const struct GNUNET_PeerIdentity *key,
+ void *value)
{
struct GNUNET_MESSENGER_SrvTunnel *tunnel = value;
destroy_tunnel (tunnel);
@@ -150,7 +153,8 @@ get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room)
}
static int
-send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
+send_room_info (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
struct GNUNET_MESSENGER_SrvTunnel *tunnel)
{
if ((!handle) || (!is_tunnel_connected (tunnel)))
@@ -160,7 +164,9 @@ send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_S
}
static void*
-callback_room_connect (void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *source)
+callback_room_connect (void *cls,
+ struct GNUNET_CADET_Channel *channel,
+ const struct GNUNET_PeerIdentity *source)
{
struct GNUNET_MESSENGER_SrvRoom *room = cls;
@@ -197,7 +203,8 @@ callback_room_connect (void *cls, struct GNUNET_CADET_Channel *channel, const st
}
static int
-join_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
+join_room (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
struct GNUNET_MESSENGER_Member *member)
{
GNUNET_assert((room) && (handle) && (member));
@@ -228,8 +235,10 @@ struct GNUNET_MESSENGER_MemberNotify
};
static void
-notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNET_MESSENGER_MemberSession *session,
- struct GNUNET_CONTAINER_MultiHashMap *map, int check_permission)
+notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ struct GNUNET_CONTAINER_MultiHashMap *map,
+ int check_permission)
{
if (session->prev)
notify_about_members (notify, session->prev, map, GNUNET_YES);
@@ -258,7 +267,8 @@ notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNE
}
static int
-iterate_notify_about_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key,
+iterate_notify_about_members (void *cls,
+ const struct GNUNET_IDENTITY_PublicKey *public_key,
struct GNUNET_MESSENGER_MemberSession *session)
{
struct GNUNET_MESSENGER_MemberNotify *notify = cls;
@@ -275,7 +285,8 @@ iterate_notify_about_members (void *cls, const struct GNUNET_IDENTITY_PublicKey
}
static int
-join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle)
+join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle)
{
const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (handle, get_room_key(room));
@@ -306,16 +317,20 @@ join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
}
extern int
-check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header);
+check_tunnel_message (void *cls,
+ const struct GNUNET_MessageHeader *header);
extern void
-handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header);
+handle_tunnel_message (void *cls,
+ const struct GNUNET_MessageHeader *header);
extern void
-callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channel);
+callback_tunnel_disconnect (void *cls,
+ const struct GNUNET_CADET_Channel *channel);
int
-open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle)
+open_room (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle)
{
GNUNET_assert((room) && (handle));
@@ -366,7 +381,8 @@ exit_open_room:
}
int
-enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
+enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
const struct GNUNET_PeerIdentity *door)
{
GNUNET_assert((room) && (handle) && (door));
@@ -404,8 +420,11 @@ enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_Sr
}
struct GNUNET_MQ_Envelope*
-pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle,
- struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode)
+pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_MESSENGER_SrvHandle *handle,
+ struct GNUNET_MESSENGER_Message *message,
+ struct GNUNET_HashCode *hash,
+ int mode)
{
GNUNET_assert((room) && (handle) && (message) && (hash));
@@ -432,7 +451,9 @@ struct GNUNET_MESSENGER_ClosureSendRoom
};
static int
-iterate_send_room_message (void *cls, const struct GNUNET_PeerIdentity *key, void *value)
+iterate_send_room_message (void *cls,
+ const struct GNUNET_PeerIdentity *key,
+ void *value)
{
struct GNUNET_MESSENGER_SrvTunnel *tunnel = value;
@@ -466,14 +487,18 @@ iterate_send_room_message (void *cls, const struct GNUNET_PeerIdentity *key, voi
int
update_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
- struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+ struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
void
-callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
int
-send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
+send_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
struct GNUNET_MESSENGER_Message *message)
{
GNUNET_assert((room) && (handle));
@@ -530,8 +555,10 @@ send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
}
void
-forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
- struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((room) && (tunnel));
@@ -554,7 +581,8 @@ forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE
}
void
-check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel)
+check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel)
{
if (!room->peer_message)
return;
@@ -592,7 +620,8 @@ resend_peer_message:
}
void
-merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle)
+merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle)
{
GNUNET_assert(room);
@@ -612,7 +641,8 @@ merge_next:
}
void
-callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash)
+callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_HashCode *hash)
{
if (GNUNET_OK != delete_store_message (get_room_message_store(room), hash))
{
@@ -622,7 +652,8 @@ callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUN
}
void
-callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash)
+callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_HashCode *hash)
{
if (!room->host)
return;
@@ -631,8 +662,10 @@ callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_
}
int
-delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay)
+delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_TIME_Relative delay)
{
GNUNET_assert((room) && (session) && (hash));
@@ -687,7 +720,8 @@ get_room_key (const struct GNUNET_MESSENGER_SrvRoom *room)
}
const struct GNUNET_MESSENGER_SrvTunnel*
-get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer)
+get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_PeerIdentity *peer)
{
GNUNET_assert((room) && (peer));
@@ -695,9 +729,11 @@ get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNE
}
static int
-request_room_message_step (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash,
+request_room_message_step (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_HashCode *hash,
const struct GNUNET_MESSENGER_MemberSession *session,
- GNUNET_MESSENGER_MessageRequestCallback callback, void* cls)
+ GNUNET_MESSENGER_MessageRequestCallback callback,
+ void* cls)
{
struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room);
@@ -732,9 +768,11 @@ forward:
}
int
-request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash,
+request_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_HashCode *hash,
const struct GNUNET_MESSENGER_MemberSession *session,
- GNUNET_MESSENGER_MessageRequestCallback callback, void* cls)
+ GNUNET_MESSENGER_MessageRequestCallback callback,
+ void* cls)
{
GNUNET_assert((room) && (hash));
@@ -747,7 +785,8 @@ request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET
}
void
-callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls)
+callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room,
+ void *cls)
{
struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
@@ -766,8 +805,10 @@ callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls)
}
int
-callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, void *cls,
- struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash)
+callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ void *cls,
+ struct GNUNET_MESSENGER_Message *message,
+ struct GNUNET_HashCode *hash)
{
if (GNUNET_MESSENGER_KIND_UNKNOWN == message->header.kind)
{
@@ -826,8 +867,10 @@ idle_request_room_messages (void *cls)
}
void
-solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key,
- const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp)
+solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_IDENTITY_PublicKey *public_key,
+ const struct GNUNET_ShortHashCode *member_id,
+ struct GNUNET_TIME_Absolute timestamp)
{
GNUNET_assert ((room) && (public_key) && (member_id));
@@ -945,7 +988,8 @@ finish_handling:
int
update_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
- struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+ struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((room) && (message) && (hash));
@@ -1008,7 +1052,8 @@ struct GNUNET_MESSENGER_MemberUpdate
};
static int
-iterate_update_member_sessions (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key,
+iterate_update_member_sessions (void *cls,
+ const struct GNUNET_IDENTITY_PublicKey *public_key,
struct GNUNET_MESSENGER_MemberSession *session)
{
struct GNUNET_MESSENGER_MemberUpdate *update = cls;
@@ -1030,11 +1075,14 @@ iterate_update_member_sessions (void *cls, const struct GNUNET_IDENTITY_PublicKe
}
static void
-remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session);
+remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session);
void
-callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room);
struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message);
@@ -1113,7 +1161,8 @@ callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUN
}
static void
-get_room_data_subdir (struct GNUNET_MESSENGER_SrvRoom *room, char **dir)
+get_room_data_subdir (struct GNUNET_MESSENGER_SrvRoom *room,
+ char **dir)
{
GNUNET_assert((room) && (dir));
@@ -1178,7 +1227,8 @@ save_room (struct GNUNET_MESSENGER_SrvRoom *room)
}
static void
-remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session)
+remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session)
{
GNUNET_assert ((room) && (session));
diff --git a/src/messenger/gnunet-service-messenger_room.h b/src/messenger/gnunet-service-messenger_room.h
index 31ec877af..4b3811104 100644
--- a/src/messenger/gnunet-service-messenger_room.h
+++ b/src/messenger/gnunet-service-messenger_room.h
@@ -89,7 +89,8 @@ struct GNUNET_MESSENGER_SrvRoom
* @return New room
*/
struct GNUNET_MESSENGER_SrvRoom*
-create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key);
+create_room (struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_HashCode *key);
/**
* Destroys a room and frees its memory fully.
@@ -139,7 +140,8 @@ get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room);
* @return #GNUNET_YES on success, #GNUNET_NO on failure.
*/
int
-open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle);
+open_room (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle);
/**
* Connects a tunnel to a hosting peer of a <i>room</i> through a so called <i>door</i> which is represented by
@@ -152,7 +154,8 @@ open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHan
* @return #GNUNET_YES on success, #GNUNET_NO on failure.
*/
int
-enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
+enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
const struct GNUNET_PeerIdentity *door);
/**
@@ -173,8 +176,11 @@ enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_Sr
* @return New envelope or NULL
*/
struct GNUNET_MQ_Envelope*
-pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle,
- struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode);
+pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_MESSENGER_SrvHandle *handle,
+ struct GNUNET_MESSENGER_Message *message,
+ struct GNUNET_HashCode *hash,
+ int mode);
/**
* Sends a <i>message</i> from a given <i>handle</i> into a <i>room</i>. The <i>hash</i> parameter will be
@@ -192,7 +198,8 @@ pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNU
* @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise.
*/
int
-send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
+send_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
struct GNUNET_MESSENGER_Message *message);
/**
@@ -204,8 +211,10 @@ send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE
* @param[in] hash Hash of message
*/
void
-forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel,
- struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Checks the current state of opening a given <i>room</i> from this peer and re-publishes it
@@ -216,7 +225,8 @@ forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE
* @param[in/out] tunnel Tunnel
*/
void
-check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel);
+check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvTunnel *tunnel);
/**
* Reduces all current forks inside of the message history of a <i>room</i> to one remaining last message
@@ -226,7 +236,8 @@ check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MES
* @param[in/out] handle Handle
*/
void
-merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle);
+merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle);
/**
* Deletes a message from the <i>room</i> with a given <i>hash</i> in a specific <i>delay</i> if
@@ -239,8 +250,10 @@ merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_M
* @return #GNUNET_YES on success, #GNUNET_NO if permission gets denied, #GNUNET_SYSERR on operation failure
*/
int
-delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay);
+delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_MemberSession *session,
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_TIME_Relative delay);
/**
* Returns the CADET handle from a rooms service.
@@ -269,7 +282,8 @@ get_room_key (const struct GNUNET_MESSENGER_SrvRoom *room);
* @return Tunnel or NULL
*/
const struct GNUNET_MESSENGER_SrvTunnel*
-get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer);
+get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_PeerIdentity *peer);
/**
* Method called whenever a <i>message</i> is found during a request in a <i>room</i>.
@@ -280,7 +294,8 @@ get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNE
* @param[in] hash Hash of message
*/
typedef void (GNUNET_MESSENGER_MessageRequestCallback) (
- void *cls, struct GNUNET_MESSENGER_SrvRoom *room,
+ void *cls,
+ struct GNUNET_MESSENGER_SrvRoom *room,
const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_HashCode *hash
);
@@ -301,9 +316,11 @@ typedef void (GNUNET_MESSENGER_MessageRequestCallback) (
* @return #GNUNET_YES if the request could be processed, otherwise #GNUNET_NO
*/
int
-request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash,
+request_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_HashCode *hash,
const struct GNUNET_MESSENGER_MemberSession *session,
- GNUNET_MESSENGER_MessageRequestCallback callback, void* cls);
+ GNUNET_MESSENGER_MessageRequestCallback callback,
+ void* cls);
/**
* Checks for potential collisions with member ids and solves them changing active handles ids if they
@@ -315,8 +332,10 @@ request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET
* @param[in] timestamp Timestamp
*/
void
-solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key,
- const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp);
+solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_IDENTITY_PublicKey *public_key,
+ const struct GNUNET_ShortHashCode *member_id,
+ struct GNUNET_TIME_Absolute timestamp);
/**
* Rebuilds the decentralized structure for a <i>room</i> by ensuring all required connections are made
diff --git a/src/messenger/gnunet-service-messenger_service.c b/src/messenger/gnunet-service-messenger_service.c
index 8c63e9bf4..91165cf63 100644
--- a/src/messenger/gnunet-service-messenger_service.c
+++ b/src/messenger/gnunet-service-messenger_service.c
@@ -41,7 +41,8 @@ callback_shutdown_service (void *cls)
}
struct GNUNET_MESSENGER_Service*
-create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle)
+create_service (const struct GNUNET_CONFIGURATION_Handle *config,
+ struct GNUNET_SERVICE_Handle *service_handle)
{
GNUNET_assert((config) && (service_handle));
@@ -88,7 +89,9 @@ create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_
}
static int
-iterate_destroy_rooms (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_rooms (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_SrvRoom *room = value;
destroy_room (room);
@@ -151,7 +154,8 @@ get_service_contact_store (struct GNUNET_MESSENGER_Service *service)
}
struct GNUNET_MESSENGER_SrvHandle*
-add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq)
+add_service_handle (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MQ_Handle *mq)
{
GNUNET_assert((service) && (mq));
@@ -166,7 +170,8 @@ add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_H
}
void
-remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle)
+remove_service_handle (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvHandle *handle)
{
GNUNET_assert((service) && (handle));
@@ -178,7 +183,8 @@ remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_M
}
int
-get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer)
+get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_PeerIdentity *peer)
{
GNUNET_assert((service) && (peer));
@@ -186,7 +192,8 @@ get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struc
}
struct GNUNET_MESSENGER_SrvRoom*
-get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key)
+get_service_room (const struct GNUNET_MESSENGER_Service *service,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((service) && (key));
@@ -194,7 +201,8 @@ get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct G
}
int
-open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle,
+open_service_room (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
const struct GNUNET_HashCode *key)
{
GNUNET_assert((service) && (handle) && (key));
@@ -217,8 +225,10 @@ open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSE
}
int
-entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key)
+entry_service_room (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_PeerIdentity *door,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((service) && (handle) && (door) && (key));
@@ -250,7 +260,8 @@ entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS
}
int
-close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle,
+close_service_room (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
const struct GNUNET_HashCode *key)
{
GNUNET_assert((service) && (handle) && (key));
@@ -290,9 +301,11 @@ close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS
}
void
-handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room,
+handle_service_message (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvRoom *room,
const struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((service) && (room) && (session) && (message) && (hash));
diff --git a/src/messenger/gnunet-service-messenger_service.h b/src/messenger/gnunet-service-messenger_service.h
index aa43fa457..d364a93c0 100644
--- a/src/messenger/gnunet-service-messenger_service.h
+++ b/src/messenger/gnunet-service-messenger_service.h
@@ -68,7 +68,8 @@ struct GNUNET_MESSENGER_Service
* @return New service
*/
struct GNUNET_MESSENGER_Service*
-create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle);
+create_service (const struct GNUNET_CONFIGURATION_Handle *config,
+ struct GNUNET_SERVICE_Handle *service_handle);
/**
* Destroys a <i>service</i> and frees its memory fully.
@@ -104,7 +105,8 @@ get_service_contact_store (struct GNUNET_MESSENGER_Service *service);
* @return New handle
*/
struct GNUNET_MESSENGER_SrvHandle*
-add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq);
+add_service_handle (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MQ_Handle *mq);
/**
* Removes a <i>handle</i> from a <i>service</i> and destroys it.
@@ -113,7 +115,8 @@ add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_H
* @param[in/out] handle Handle
*/
void
-remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle);
+remove_service_handle (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvHandle *handle);
/**
* Tries to write the peer identity of the peer running a <i>service</i> on to the <i>peer</i>
@@ -124,7 +127,8 @@ remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_M
* @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR
*/
int
-get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer);
+get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_PeerIdentity *peer);
/**
* Returns the room identified by a given <i>key</i> for a <i>service</i>. If the service doesn't know any room
@@ -135,7 +139,8 @@ get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struc
* @return Room or NULL
*/
struct GNUNET_MESSENGER_SrvRoom*
-get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key);
+get_service_room (const struct GNUNET_MESSENGER_Service *service,
+ const struct GNUNET_HashCode *key);
/**
* Tries to open a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will be
@@ -147,7 +152,8 @@ get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct G
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle,
+open_service_room (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
const struct GNUNET_HashCode *key);
/**
@@ -164,8 +170,10 @@ open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSE
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key);
+entry_service_room (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_PeerIdentity *door,
+ const struct GNUNET_HashCode *key);
/**
* Tries to close a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will
@@ -180,7 +188,8 @@ entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle,
+close_service_room (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
const struct GNUNET_HashCode *key);
/**
@@ -194,8 +203,10 @@ close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS
* @param[in] hash Hash of message
*/
void
-handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room,
+handle_service_message (struct GNUNET_MESSENGER_Service *service,
+ struct GNUNET_MESSENGER_SrvRoom *room,
const struct GNUNET_MESSENGER_MemberSession *session,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
#endif //GNUNET_SERVICE_MESSENGER_SERVICE_H
diff --git a/src/messenger/gnunet-service-messenger_tunnel.c b/src/messenger/gnunet-service-messenger_tunnel.c
index b9d063813..fdd6429e6 100644
--- a/src/messenger/gnunet-service-messenger_tunnel.c
+++ b/src/messenger/gnunet-service-messenger_tunnel.c
@@ -33,7 +33,8 @@
#include "messenger_api_util.h"
struct GNUNET_MESSENGER_SrvTunnel*
-create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door)
+create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_PeerIdentity *door)
{
GNUNET_assert((room) && (door));
@@ -72,7 +73,8 @@ destroy_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel)
}
void
-bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel)
+bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ struct GNUNET_CADET_Channel *channel)
{
GNUNET_assert(tunnel);
@@ -83,10 +85,12 @@ bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Chan
}
extern void
-callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls);
+callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room,
+ void *cls);
void
-callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channel)
+callback_tunnel_disconnect (void *cls,
+ const struct GNUNET_CADET_Channel *channel)
{
struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
@@ -99,11 +103,14 @@ callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channe
}
extern int
-callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, void *cls,
- struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash);
+callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ void *cls,
+ struct GNUNET_MESSENGER_Message *message,
+ struct GNUNET_HashCode *hash);
int
-check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header)
+check_tunnel_message (void *cls,
+ const struct GNUNET_MessageHeader *header)
{
struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls;
@@ -137,14 +144,18 @@ check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header)
extern int
update_room_message (struct GNUNET_MESSENGER_SrvRoom *room,
- struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+ struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
extern void
-callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room,
+ struct GNUNET_MESSENGER_SrvHandle *handle,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
static void
-update_tunnel_last_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_HashCode *hash)
+update_tunnel_last_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(tunnel->room);
@@ -281,7 +292,8 @@ callback_tunnel_sent (void *cls)
}
void
-send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env,
+send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ struct GNUNET_MQ_Envelope *env,
const struct GNUNET_HashCode *hash)
{
GNUNET_assert((tunnel) && (env) && (hash));
@@ -299,7 +311,9 @@ send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_M
}
int
-send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message)
+send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ void *handle,
+ struct GNUNET_MESSENGER_Message *message)
{
GNUNET_assert((tunnel) && (handle));
@@ -325,7 +339,8 @@ send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, st
}
void
-forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message,
+forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_HashCode *hash)
{
GNUNET_assert((tunnel) && (message) && (hash));
@@ -353,7 +368,8 @@ get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel)
}
void
-get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer)
+get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ struct GNUNET_PeerIdentity *peer)
{
GNUNET_assert(tunnel);
@@ -369,7 +385,8 @@ get_tunnel_messenger_version (const struct GNUNET_MESSENGER_SrvTunnel *tunnel)
}
int
-update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version)
+update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ uint32_t version)
{
GNUNET_assert(tunnel);
diff --git a/src/messenger/gnunet-service-messenger_tunnel.h b/src/messenger/gnunet-service-messenger_tunnel.h
index 96d98546d..7bd749281 100644
--- a/src/messenger/gnunet-service-messenger_tunnel.h
+++ b/src/messenger/gnunet-service-messenger_tunnel.h
@@ -55,7 +55,8 @@ struct GNUNET_MESSENGER_SrvTunnel
* @return New tunnel
*/
struct GNUNET_MESSENGER_SrvTunnel*
-create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door);
+create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room,
+ const struct GNUNET_PeerIdentity *door);
/**
* Destroys a <i>tunnel</i> and frees its memory fully.
@@ -73,7 +74,8 @@ destroy_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel);
* @param[in/out] channel CADET channel
*/
void
-bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel);
+bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ struct GNUNET_CADET_Channel *channel);
/**
* Tries to connect a <i>tunnel</i> by creating a new CADET channel and binding it.
@@ -112,7 +114,8 @@ is_tunnel_connected (const struct GNUNET_MESSENGER_SrvTunnel *tunnel);
* @param[in] hash Hash of message
*/
void
-send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env,
+send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ struct GNUNET_MQ_Envelope *env,
const struct GNUNET_HashCode *hash);
/**
@@ -126,7 +129,9 @@ send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_M
* @return #GNUNET_YES on success, GNUNET_NO otherwise
*/
int
-send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message);
+send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ void *handle,
+ struct GNUNET_MESSENGER_Message *message);
/**
* Forwards a given <i>message</i> with a known <i>hash</i> through a <i>tunnel</i>.
@@ -136,7 +141,8 @@ send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, st
* @param[in] hash Hash of message
*/
void
-forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message,
+forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_HashCode *hash);
/**
@@ -158,7 +164,8 @@ get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel);
* @param[out] peer Peer identity
*/
void
-get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer);
+get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ struct GNUNET_PeerIdentity *peer);
/**
* Returns the current messenger version the peer connected via a given <i>tunnel</i>
@@ -181,6 +188,7 @@ get_tunnel_messenger_version (const struct GNUNET_MESSENGER_SrvTunnel *tunnel);
* @param[in] version Version of messenger
*/
int
-update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version);
+update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel,
+ uint32_t version);
#endif //GNUNET_SERVICE_MESSENGER_TUNNEL_H
diff --git a/src/messenger/messenger_api.c b/src/messenger/messenger_api.c
index f7c73f769..ef6244e19 100644
--- a/src/messenger/messenger_api.c
+++ b/src/messenger/messenger_api.c
@@ -70,14 +70,16 @@ GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind)
}
static int
-check_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg)
+check_get_name (void *cls,
+ const struct GNUNET_MESSENGER_NameMessage *msg)
{
GNUNET_MQ_check_zero_termination(msg);
return GNUNET_OK;
}
static void
-handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg)
+handle_get_name (void *cls,
+ const struct GNUNET_MESSENGER_NameMessage *msg)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
@@ -89,7 +91,8 @@ handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg)
}
static int
-check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg)
+check_get_key (void *cls,
+ const struct GNUNET_MESSENGER_KeyMessage *msg)
{
const uint16_t full_length = ntohs (msg->header.size);
@@ -107,7 +110,8 @@ check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg)
}
static void
-handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg)
+handle_get_key (void *cls,
+ const struct GNUNET_MESSENGER_KeyMessage *msg)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
@@ -129,7 +133,8 @@ handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg)
}
static void
-handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg)
+handle_member_id (void *cls,
+ const struct GNUNET_MESSENGER_MemberMessage *msg)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
@@ -150,7 +155,8 @@ handle_member_id (void *cls, const struct GNUNET_MESSENGER_MemberMessage *msg)
}
static void
-handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
+handle_room_open (void *cls,
+ const struct GNUNET_MESSENGER_RoomMessage *msg)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
@@ -162,7 +168,8 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
}
static void
-handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
+handle_room_entry (void *cls,
+ const struct GNUNET_MESSENGER_RoomMessage *msg)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
@@ -175,7 +182,8 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
}
static void
-handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
+handle_room_close (void *cls,
+ const struct GNUNET_MESSENGER_RoomMessage *msg)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
@@ -187,7 +195,8 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg)
}
static int
-check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg)
+check_recv_message (void *cls,
+ const struct GNUNET_MESSENGER_RecvMessage *msg)
{
const uint16_t full_length = ntohs (msg->header.size);
@@ -209,7 +218,8 @@ check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg)
}
static void
-handle_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg)
+handle_recv_message (void *cls,
+ const struct GNUNET_MESSENGER_RecvMessage *msg)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
@@ -255,7 +265,8 @@ static void
reconnect (struct GNUNET_MESSENGER_Handle *handle);
static void
-send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room)
+send_open_room (struct GNUNET_MESSENGER_Handle *handle,
+ struct GNUNET_MESSENGER_Room *room)
{
struct GNUNET_MESSENGER_RoomMessage *msg;
struct GNUNET_MQ_Envelope *env;
@@ -266,7 +277,8 @@ send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_
}
static void
-send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room,
+send_enter_room (struct GNUNET_MESSENGER_Handle *handle,
+ struct GNUNET_MESSENGER_Room *room,
const struct GNUNET_PeerIdentity *door)
{
struct GNUNET_MESSENGER_RoomMessage *msg;
@@ -279,7 +291,8 @@ send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER
}
static void
-send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room)
+send_close_room (struct GNUNET_MESSENGER_Handle *handle,
+ struct GNUNET_MESSENGER_Room *room)
{
struct GNUNET_MESSENGER_RoomMessage *msg;
struct GNUNET_MQ_Envelope *env;
@@ -290,7 +303,9 @@ send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER
}
static int
-iterate_reset_room (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_reset_room (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
struct GNUNET_MESSENGER_Room *room = value;
@@ -329,7 +344,9 @@ callback_reconnect (void *cls)
}
static int
-iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_close_room (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
struct GNUNET_MESSENGER_Room *room = value;
@@ -340,7 +357,8 @@ iterate_close_room (void *cls, const struct GNUNET_HashCode *key, void *value)
}
static void
-callback_mq_error (void *cls, enum GNUNET_MQ_Error error)
+callback_mq_error (void *cls,
+ enum GNUNET_MQ_Error error)
{
struct GNUNET_MESSENGER_Handle *handle = cls;
@@ -402,9 +420,12 @@ reconnect (struct GNUNET_MESSENGER_Handle *handle)
}
struct GNUNET_MESSENGER_Handle*
-GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name,
- GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls,
- GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
+GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *name,
+ GNUNET_MESSENGER_IdentityCallback identity_callback,
+ void *identity_cls,
+ GNUNET_MESSENGER_MessageCallback msg_callback,
+ void *msg_cls)
{
struct GNUNET_MESSENGER_Handle *handle = create_handle (cfg, identity_callback, identity_cls, msg_callback, msg_cls);
@@ -475,7 +496,8 @@ GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle)
}
int
-GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name)
+GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle,
+ const char *name)
{
if (!handle)
return GNUNET_SYSERR;
@@ -517,7 +539,8 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle)
}
struct GNUNET_MESSENGER_Room*
-GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
+GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key)
{
if ((!handle) || (!key))
return NULL;
@@ -541,7 +564,8 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct
}
struct GNUNET_MESSENGER_Room*
-GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door,
+GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_PeerIdentity *door,
const struct GNUNET_HashCode *key)
{
if ((!handle) || (!door) || (!key))
@@ -583,7 +607,9 @@ struct GNUNET_MESSENGER_RoomFind
};
static int
-iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value)
+iterate_find_room (void* cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_RoomFind *find = cls;
struct GNUNET_MESSENGER_Room *room = value;
@@ -602,8 +628,10 @@ iterate_find_room (void* cls, const struct GNUNET_HashCode *key, void *value)
}
int
-GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact,
- GNUNET_MESSENGER_MemberCallback callback, void *cls)
+GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_MESSENGER_Contact *contact,
+ GNUNET_MESSENGER_MemberCallback callback,
+ void *cls)
{
if (!handle)
return GNUNET_SYSERR;
@@ -628,7 +656,8 @@ GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room)
}
const struct GNUNET_MESSENGER_Contact*
-GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
+GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_HashCode *hash)
{
if ((!room) || (!hash))
return NULL;
@@ -655,7 +684,8 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact
}
void
-GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message,
+GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_MESSENGER_Message *message,
const struct GNUNET_MESSENGER_Contact *contact)
{
if ((!room) || (!message))
@@ -723,7 +753,8 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct
}
const struct GNUNET_MESSENGER_Message*
-GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
+GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_HashCode *hash)
{
if ((!room) || (!hash))
return NULL;
@@ -745,7 +776,8 @@ GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const st
}
int
-GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback,
+GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room,
+ GNUNET_MESSENGER_MemberCallback callback,
void *cls)
{
if (!room)
diff --git a/src/messenger/messenger_api_contact.c b/src/messenger/messenger_api_contact.c
index 04e1f60c1..cbca17640 100644
--- a/src/messenger/messenger_api_contact.c
+++ b/src/messenger/messenger_api_contact.c
@@ -60,7 +60,8 @@ get_contact_name (const struct GNUNET_MESSENGER_Contact *contact)
}
void
-set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name)
+set_contact_name (struct GNUNET_MESSENGER_Contact *contact,
+ const char *name)
{
GNUNET_assert(contact);
@@ -98,7 +99,8 @@ decrease_contact_rc (struct GNUNET_MESSENGER_Contact *contact)
}
void
-get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id,
+get_context_from_member (const struct GNUNET_HashCode *key,
+ const struct GNUNET_ShortHashCode *id,
struct GNUNET_HashCode *context)
{
GNUNET_assert((key) && (id) && (context));
diff --git a/src/messenger/messenger_api_contact.h b/src/messenger/messenger_api_contact.h
index e94d1fcd0..b5410f998 100644
--- a/src/messenger/messenger_api_contact.h
+++ b/src/messenger/messenger_api_contact.h
@@ -71,7 +71,8 @@ get_contact_name (const struct GNUNET_MESSENGER_Contact *contact);
* @param[in] name Name
*/
void
-set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name);
+set_contact_name (struct GNUNET_MESSENGER_Contact *contact,
+ const char *name);
/**
* Returns the public key of a given <i>contact</i>.
@@ -108,7 +109,8 @@ decrease_contact_rc (struct GNUNET_MESSENGER_Contact *contact);
* @param[out] hash Member context
*/
void
-get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id,
+get_context_from_member (const struct GNUNET_HashCode *key,
+ const struct GNUNET_ShortHashCode *id,
struct GNUNET_HashCode *context);
#endif //GNUNET_MESSENGER_API_CONTACT_H
diff --git a/src/messenger/messenger_api_contact_store.c b/src/messenger/messenger_api_contact_store.c
index 6a517c2e0..1c10a8fbf 100644
--- a/src/messenger/messenger_api_contact_store.c
+++ b/src/messenger/messenger_api_contact_store.c
@@ -38,7 +38,9 @@ init_contact_store (struct GNUNET_MESSENGER_ContactStore *store)
}
static int
-iterate_destroy_contacts (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_contacts (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_Contact *contact = value;
destroy_contact (contact);
@@ -58,7 +60,8 @@ clear_contact_store (struct GNUNET_MESSENGER_ContactStore *store)
}
static struct GNUNET_CONTAINER_MultiHashMap*
-select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context,
+select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store,
+ const struct GNUNET_HashCode *context,
struct GNUNET_HashCode *hash)
{
const struct GNUNET_IDENTITY_PublicKey *anonymous = get_anonymous_public_key ();
@@ -76,7 +79,8 @@ select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store, const str
}
struct GNUNET_MESSENGER_Contact*
-get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context,
+get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store,
+ const struct GNUNET_HashCode *context,
const struct GNUNET_HashCode *key_hash)
{
GNUNET_assert ((store) && (store->contacts) && (context) && (key_hash));
@@ -92,7 +96,8 @@ get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct
}
struct GNUNET_MESSENGER_Contact*
-get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context,
+get_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
+ const struct GNUNET_HashCode *context,
const struct GNUNET_IDENTITY_PublicKey *pubkey)
{
GNUNET_assert ((store) && (store->contacts) && (context) && (pubkey));
@@ -130,8 +135,10 @@ get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNU
}
void
-update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact,
- const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context,
+update_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
+ struct GNUNET_MESSENGER_Contact* contact,
+ const struct GNUNET_HashCode *context,
+ const struct GNUNET_HashCode *next_context,
const struct GNUNET_IDENTITY_PublicKey *pubkey)
{
GNUNET_assert ((store) && (store->contacts) && (contact) && (pubkey));
@@ -163,7 +170,8 @@ update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET
}
void
-remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact,
+remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
+ struct GNUNET_MESSENGER_Contact* contact,
const struct GNUNET_HashCode *context)
{
GNUNET_assert ((store) && (store->contacts) && (contact));
diff --git a/src/messenger/messenger_api_contact_store.h b/src/messenger/messenger_api_contact_store.h
index f2dad9f84..bdab2ceeb 100644
--- a/src/messenger/messenger_api_contact_store.h
+++ b/src/messenger/messenger_api_contact_store.h
@@ -68,7 +68,8 @@ clear_contact_store (struct GNUNET_MESSENGER_ContactStore *store);
* @param[in] key_hash Hash of public key
*/
struct GNUNET_MESSENGER_Contact*
-get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context,
+get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store,
+ const struct GNUNET_HashCode *context,
const struct GNUNET_HashCode *key_hash);
/**
@@ -87,7 +88,8 @@ get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct
* @param[in] pubkey Public key of EGO
*/
struct GNUNET_MESSENGER_Contact*
-get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context,
+get_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
+ const struct GNUNET_HashCode *context,
const struct GNUNET_IDENTITY_PublicKey *pubkey);
/**
@@ -103,8 +105,10 @@ get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNU
* @param[in] pubkey Public key of EGO
*/
void
-update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact,
- const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context,
+update_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
+ struct GNUNET_MESSENGER_Contact* contact,
+ const struct GNUNET_HashCode *context,
+ const struct GNUNET_HashCode *next_context,
const struct GNUNET_IDENTITY_PublicKey *pubkey);
/**
@@ -116,7 +120,8 @@ update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET
* @param[in] context Member context
*/
void
-remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact,
+remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
+ struct GNUNET_MESSENGER_Contact* contact,
const struct GNUNET_HashCode *context);
#endif //GNUNET_MESSENGER_API_CONTACT_STORE_H
diff --git a/src/messenger/messenger_api_handle.c b/src/messenger/messenger_api_handle.c
index ab57f82cc..516807e13 100644
--- a/src/messenger/messenger_api_handle.c
+++ b/src/messenger/messenger_api_handle.c
@@ -28,8 +28,11 @@
#include "messenger_api_util.h"
struct GNUNET_MESSENGER_Handle*
-create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback,
- void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls)
+create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ GNUNET_MESSENGER_IdentityCallback identity_callback,
+ void *identity_cls,
+ GNUNET_MESSENGER_MessageCallback msg_callback,
+ void *msg_cls)
{
GNUNET_assert(cfg);
@@ -58,7 +61,9 @@ create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_I
}
static int
-iterate_destroy_room (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_room (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_Room *room = value;
@@ -97,7 +102,8 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle)
}
void
-set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name)
+set_handle_name (struct GNUNET_MESSENGER_Handle *handle,
+ const char *name)
{
GNUNET_assert(handle);
@@ -116,7 +122,8 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle *handle)
}
void
-set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey)
+set_handle_key (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_IDENTITY_PublicKey *pubkey)
{
GNUNET_assert(handle);
@@ -146,7 +153,8 @@ get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle)
}
struct GNUNET_MESSENGER_Contact*
-get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
+get_handle_contact (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key));
@@ -162,7 +170,8 @@ get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_
}
void
-open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
+open_handle_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key));
@@ -173,7 +182,8 @@ open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_Ha
}
void
-entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door,
+entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_PeerIdentity *door,
const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (door) && (key));
@@ -185,7 +195,8 @@ entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNE
}
void
-close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
+close_handle_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key));
diff --git a/src/messenger/messenger_api_handle.h b/src/messenger/messenger_api_handle.h
index e6ca474f2..6a43f13a6 100644
--- a/src/messenger/messenger_api_handle.h
+++ b/src/messenger/messenger_api_handle.h
@@ -71,8 +71,11 @@ struct GNUNET_MESSENGER_Handle
* @return New handle
*/
struct GNUNET_MESSENGER_Handle*
-create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback,
- void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls);
+create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ GNUNET_MESSENGER_IdentityCallback identity_callback,
+ void *identity_cls,
+ GNUNET_MESSENGER_MessageCallback msg_callback,
+ void *msg_cls);
/**
* Destroys a <i>handle</i> and frees its memory fully from the client API.
@@ -89,7 +92,8 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle);
* @param[in] name New name
*/
void
-set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name);
+set_handle_name (struct GNUNET_MESSENGER_Handle *handle,
+ const char *name);
/**
* Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet.
@@ -107,7 +111,8 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle *handle);
* @param[in] pubkey Public key
*/
void
-set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey);
+set_handle_key (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_IDENTITY_PublicKey *pubkey);
/**
* Returns the public key of a given <i>handle</i>.
@@ -136,7 +141,8 @@ get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle);
* @return Contact
*/
struct GNUNET_MESSENGER_Contact*
-get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
+get_handle_contact (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key);
/**
* Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open.
@@ -145,7 +151,8 @@ get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_
* @param[in] key Key of room
*/
void
-open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
+open_handle_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key);
/**
* Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a
@@ -156,7 +163,8 @@ open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_Ha
* @param[in] key Key of room
*/
void
-entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door,
+entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_PeerIdentity *door,
const struct GNUNET_HashCode *key);
/**
@@ -166,6 +174,7 @@ entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNE
* @param[in] key Key of room
*/
void
-close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
+close_handle_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key);
#endif //GNUNET_MESSENGER_API_HANDLE_H
diff --git a/src/messenger/messenger_api_list_tunnels.c b/src/messenger/messenger_api_list_tunnels.c
index 990e36878..7e77d8f2f 100644
--- a/src/messenger/messenger_api_list_tunnels.c
+++ b/src/messenger/messenger_api_list_tunnels.c
@@ -53,14 +53,16 @@ clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels)
}
static int
-compare_list_tunnels (void *cls, struct GNUNET_MESSENGER_ListTunnel *element0,
+compare_list_tunnels (void *cls,
+ struct GNUNET_MESSENGER_ListTunnel *element0,
struct GNUNET_MESSENGER_ListTunnel *element1)
{
return ((int) element0->peer) - ((int) element1->peer);
}
void
-add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer)
+add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const struct GNUNET_PeerIdentity *peer)
{
GNUNET_assert((tunnels) && (peer));
@@ -73,7 +75,9 @@ add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct
}
struct GNUNET_MESSENGER_ListTunnel*
-find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index)
+find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const struct GNUNET_PeerIdentity *peer,
+ size_t *index)
{
GNUNET_assert((tunnels) && (peer));
@@ -98,7 +102,8 @@ find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GN
}
int
-contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer)
+contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const struct GNUNET_PeerIdentity *peer)
{
GNUNET_assert((tunnels) && (peer));
@@ -106,7 +111,8 @@ contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struc
}
struct GNUNET_MESSENGER_ListTunnel*
-remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element)
+remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ struct GNUNET_MESSENGER_ListTunnel *element)
{
GNUNET_assert((tunnels) && (element));
@@ -120,7 +126,8 @@ remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct G
}
void
-load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path)
+load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const char *path)
{
GNUNET_assert((tunnels) && (path));
@@ -154,7 +161,8 @@ load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *pat
}
void
-save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path)
+save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const char *path)
{
GNUNET_assert((tunnels) && (path));
diff --git a/src/messenger/messenger_api_list_tunnels.h b/src/messenger/messenger_api_list_tunnels.h
index c952da3c2..0e086ee5e 100644
--- a/src/messenger/messenger_api_list_tunnels.h
+++ b/src/messenger/messenger_api_list_tunnels.h
@@ -67,7 +67,8 @@ clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels);
* @param[in] peer Peer identity of tunnel
*/
void
-add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer);
+add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const struct GNUNET_PeerIdentity *peer);
/**
* Searches linearly through the list of tunnels peer identities for matching a
@@ -85,7 +86,9 @@ add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct
* @return Element in the list with matching peer identity
*/
struct GNUNET_MESSENGER_ListTunnel*
-find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index);
+find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const struct GNUNET_PeerIdentity *peer,
+ size_t *index);
/**
* Tests linearly if the list of tunnels peer identities contains a specific
@@ -96,7 +99,8 @@ find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GN
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer);
+contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const struct GNUNET_PeerIdentity *peer);
/**
* Removes a specific <i>element</i> from the list of tunnels peer identities and returns
@@ -107,7 +111,8 @@ contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struc
* @return Next element in the list
*/
struct GNUNET_MESSENGER_ListTunnel*
-remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element);
+remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ struct GNUNET_MESSENGER_ListTunnel *element);
/**
* Loads the list of tunnels peer identities from a file under a given <i>path</i>.
@@ -116,7 +121,8 @@ remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct G
* @param[in] path Path of file
*/
void
-load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path);
+load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const char *path);
/**
* Saves the list of tunnels peer identities to a file under a given <i>path</i>.
@@ -125,6 +131,7 @@ load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *pat
* @param[in] path Path of file
*/
void
-save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path);
+save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
+ const char *path);
#endif //GNUNET_MESSENGER_API_LIST_TUNNELS_H
diff --git a/src/messenger/messenger_api_message.c b/src/messenger/messenger_api_message.c
index c7364d51c..05bf654fb 100644
--- a/src/messenger/messenger_api_message.c
+++ b/src/messenger/messenger_api_message.c
@@ -103,7 +103,8 @@ copy_message (const struct GNUNET_MESSENGER_Message *message)
}
static void
-destroy_message_body (enum GNUNET_MESSENGER_MessageKind kind, struct GNUNET_MESSENGER_MessageBody *body)
+destroy_message_body (enum GNUNET_MESSENGER_MessageKind kind,
+ struct GNUNET_MESSENGER_MessageBody *body)
{
switch (kind)
{
@@ -150,7 +151,8 @@ is_message_session_bound (const struct GNUNET_MESSENGER_Message *message)
}
static void
-fold_short_message (const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_ShortMessage *shortened)
+fold_short_message (const struct GNUNET_MESSENGER_Message *message,
+ struct GNUNET_MESSENGER_ShortMessage *shortened)
{
shortened->kind = message->header.kind;
@@ -158,7 +160,8 @@ fold_short_message (const struct GNUNET_MESSENGER_Message *message, struct GNUNE
}
static void
-unfold_short_message (struct GNUNET_MESSENGER_ShortMessage *shortened, struct GNUNET_MESSENGER_Message *message)
+unfold_short_message (struct GNUNET_MESSENGER_ShortMessage *shortened,
+ struct GNUNET_MESSENGER_Message *message)
{
destroy_message_body (message->header.kind, &(message->body));
@@ -231,7 +234,8 @@ get_message_kind_size (enum GNUNET_MESSENGER_MessageKind kind)
}
static uint16_t
-get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body)
+get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind,
+ const struct GNUNET_MESSENGER_MessageBody *body)
{
uint16_t length = 0;
@@ -283,7 +287,8 @@ get_message_size (const struct GNUNET_MESSENGER_Message *message,
}
static uint16_t
-get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message, int include_body)
+get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message,
+ int include_body)
{
const uint16_t minimum_size = sizeof(struct GNUNET_HashCode) + sizeof(kind_t);
@@ -370,8 +375,11 @@ calc_padded_length (uint16_t length)
} while (0)
static void
-encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body,
- uint16_t length, char *buffer, uint16_t offset)
+encode_message_body (enum GNUNET_MESSENGER_MessageKind kind,
+ const struct GNUNET_MESSENGER_MessageBody *body,
+ uint16_t length,
+ char *buffer,
+ uint16_t offset)
{
uint32_t version;
switch (kind)
@@ -445,7 +453,9 @@ encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET
}
void
-encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer,
+encode_message (const struct GNUNET_MESSENGER_Message *message,
+ uint16_t length,
+ char *buffer,
int include_signature)
{
GNUNET_assert((message) && (buffer));
@@ -466,7 +476,9 @@ encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length,
}
static void
-encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, char *buffer)
+encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message,
+ uint16_t length,
+ char *buffer)
{
struct GNUNET_HashCode hash;
uint16_t offset = sizeof(hash);
@@ -512,8 +524,11 @@ encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint1
} while (0)
static uint16_t
-decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESSENGER_MessageBody *body,
- uint16_t length, const char *buffer, uint16_t offset)
+decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind,
+ struct GNUNET_MESSENGER_MessageBody *body,
+ uint16_t length,
+ const char *buffer,
+ uint16_t offset)
{
uint16_t padding = 0;
@@ -593,8 +608,11 @@ decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESS
}
int
-decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer,
- int include_signature, uint16_t *padding)
+decode_message (struct GNUNET_MESSENGER_Message *message,
+ uint16_t length,
+ const char *buffer,
+ int include_signature,
+ uint16_t *padding)
{
GNUNET_assert((message) && (buffer) && (length >= get_message_kind_size(GNUNET_MESSENGER_KIND_UNKNOWN)));
@@ -638,7 +656,9 @@ decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const
}
static int
-decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, const char *buffer)
+decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message,
+ uint16_t length,
+ const char *buffer)
{
struct GNUNET_HashCode expected, hash;
uint16_t offset = sizeof(hash);
@@ -675,7 +695,9 @@ decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, uint16_t le
}
void
-hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer,
+hash_message (const struct GNUNET_MESSENGER_Message *message,
+ uint16_t length,
+ const char *buffer,
struct GNUNET_HashCode *hash)
{
GNUNET_assert((message) && (buffer) && (hash));
@@ -688,8 +710,11 @@ hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, c
}
void
-sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer,
- const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Ego *ego)
+sign_message (struct GNUNET_MESSENGER_Message *message,
+ uint16_t length,
+ char *buffer,
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_MESSENGER_Ego *ego)
{
GNUNET_assert((message) && (buffer) && (hash) && (ego));
@@ -706,7 +731,8 @@ sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *b
}
int
-verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash,
+verify_message (const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash,
const struct GNUNET_IDENTITY_PublicKey *key)
{
GNUNET_assert((message) && (hash) && (key));
@@ -726,7 +752,8 @@ verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNU
}
int
-encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key)
+encrypt_message (struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_IDENTITY_PublicKey *key)
{
GNUNET_assert((message) && (key));
@@ -760,7 +787,8 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I
}
int
-decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key)
+decrypt_message (struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_IDENTITY_PrivateKey *key)
{
GNUNET_assert((message) && (key));
@@ -788,8 +816,10 @@ decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I
}
struct GNUNET_MQ_Envelope*
-pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash,
- const struct GNUNET_MESSENGER_Ego *ego, int mode)
+pack_message (struct GNUNET_MESSENGER_Message *message,
+ struct GNUNET_HashCode *hash,
+ const struct GNUNET_MESSENGER_Ego *ego,
+ int mode)
{
GNUNET_assert(message);
diff --git a/src/messenger/messenger_api_message.h b/src/messenger/messenger_api_message.h
index 7ce30dc92..6aebf4014 100644
--- a/src/messenger/messenger_api_message.h
+++ b/src/messenger/messenger_api_message.h
@@ -107,7 +107,9 @@ get_message_size (const struct GNUNET_MESSENGER_Message *message,
* @param[in] encode_signature Flag to include signature
*/
void
-encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer,
+encode_message (const struct GNUNET_MESSENGER_Message *message,
+ uint16_t length,
+ char *buffer,
int include_signature);
/**
@@ -125,8 +127,11 @@ encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length,
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer,
- int include_signature, uint16_t *padding);
+decode_message (struct GNUNET_MESSENGER_Message *message,
+ uint16_t length,
+ const char *buffer,
+ int include_signature,
+ uint16_t *padding);
/**
* Calculates a <i>hash</i> of a given <i>buffer</i> with a <i>length</i> in bytes
@@ -138,7 +143,9 @@ decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const
* @param[out] hash Hash
*/
void
-hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer,
+hash_message (const struct GNUNET_MESSENGER_Message *message,
+ uint16_t length,
+ const char *buffer,
struct GNUNET_HashCode *hash);
/**
@@ -152,8 +159,11 @@ hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, c
* @param[in] ego EGO
*/
void
-sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer,
- const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Ego *ego);
+sign_message (struct GNUNET_MESSENGER_Message *message,
+ uint16_t length,
+ char *buffer,
+ const struct GNUNET_HashCode *hash,
+ const struct GNUNET_MESSENGER_Ego *ego);
/**
* Verifies the signature of a given <i>message</i> and its <i>hash</i> with a specific
@@ -166,7 +176,8 @@ sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *b
* @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR
*/
int
-verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash,
+verify_message (const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash,
const struct GNUNET_IDENTITY_PublicKey *key);
/**
@@ -179,7 +190,8 @@ verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNU
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key);
+encrypt_message (struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_IDENTITY_PublicKey *key);
/**
* Decrypts a private <i>message</i> using a given private <i>key</i> and replaces its body
@@ -191,7 +203,8 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I
* @return #GNUNET_YES on success, otherwise #GNUNET_NO
*/
int
-decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key);
+decrypt_message (struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_IDENTITY_PrivateKey *key);
#define GNUNET_MESSENGER_PACK_MODE_ENVELOPE 0x1
#define GNUNET_MESSENGER_PACK_MODE_UNKNOWN 0x0
@@ -209,8 +222,10 @@ decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I
* @return Envelope or NULL
*/
struct GNUNET_MQ_Envelope*
-pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash,
- const struct GNUNET_MESSENGER_Ego *ego, int mode);
+pack_message (struct GNUNET_MESSENGER_Message *message,
+ struct GNUNET_HashCode *hash,
+ const struct GNUNET_MESSENGER_Ego *ego,
+ int mode);
/**
* Returns if a specific kind of message should be sent by a client. The function returns
diff --git a/src/messenger/messenger_api_room.c b/src/messenger/messenger_api_room.c
index 0d9237a2e..6e2d33f48 100644
--- a/src/messenger/messenger_api_room.c
+++ b/src/messenger/messenger_api_room.c
@@ -28,7 +28,8 @@
#include "messenger_api_handle.h"
struct GNUNET_MESSENGER_Room*
-create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key)
+create_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key)
{
GNUNET_assert((handle) && (key));
@@ -49,7 +50,9 @@ create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCod
}
static int
-iterate_destroy_message (void *cls, const struct GNUNET_HashCode *key, void *value)
+iterate_destroy_message (void *cls,
+ const struct GNUNET_HashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_RoomMessageEntry *entry = value;
@@ -83,7 +86,8 @@ destroy_room (struct GNUNET_MESSENGER_Room *room)
}
const struct GNUNET_MESSENGER_Message*
-get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
+get_room_message (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((room) && (hash));
@@ -95,7 +99,8 @@ get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_
}
struct GNUNET_MESSENGER_Contact*
-get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash)
+get_room_sender (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_HashCode *hash)
{
GNUNET_assert((room) && (hash));
@@ -107,8 +112,10 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_H
}
static struct GNUNET_MESSENGER_Contact*
-handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_join_message (struct GNUNET_MESSENGER_Room *room,
+ struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
if (!sender)
{
@@ -129,8 +136,10 @@ handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
}
static void
-handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_leave_message (struct GNUNET_MESSENGER_Room *room,
+ struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
if ((!sender) ||
(GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender)))
@@ -144,8 +153,10 @@ handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGE
}
static void
-handle_name_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_name_message (struct GNUNET_MESSENGER_Room *room,
+ struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
if (!sender)
return;
@@ -154,8 +165,10 @@ handle_name_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
}
static void
-handle_key_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_key_message (struct GNUNET_MESSENGER_Room *room,
+ struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
if (!sender)
return;
@@ -169,8 +182,10 @@ handle_key_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_
}
static void
-handle_id_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_id_message (struct GNUNET_MESSENGER_Room *room,
+ struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
if ((!sender) ||
(GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender)) ||
@@ -188,8 +203,10 @@ handle_id_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_C
}
static void
-handle_miss_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_miss_message (struct GNUNET_MESSENGER_Room *room,
+ struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
if ((room->contact_id) && (0 == GNUNET_memcmp(&(message->header.sender_id), room->contact_id)))
{
@@ -201,8 +218,10 @@ handle_miss_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
}
static void
-handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_delete_message (struct GNUNET_MESSENGER_Room *room,
+ struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_CONTAINER_multihashmap_get (
room->messages, &(message->body.deletion.hash)
@@ -217,8 +236,10 @@ handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENG
}
struct GNUNET_MESSENGER_Contact*
-handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
+handle_room_message (struct GNUNET_MESSENGER_Room *room,
+ struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash)
{
if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->messages, hash))
return sender;
@@ -276,7 +297,9 @@ struct GNUNET_MESSENGER_MemberCall
};
static int
-iterate_local_members (void* cls, const struct GNUNET_ShortHashCode *key, void *value)
+iterate_local_members (void* cls,
+ const struct GNUNET_ShortHashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_MemberCall *call = cls;
struct GNUNET_MESSENGER_Contact *contact = value;
@@ -285,7 +308,8 @@ iterate_local_members (void* cls, const struct GNUNET_ShortHashCode *key, void *
}
int
-iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback,
+iterate_room_members (struct GNUNET_MESSENGER_Room *room,
+ GNUNET_MESSENGER_MemberCallback callback,
void* cls)
{
GNUNET_assert(room);
@@ -311,7 +335,9 @@ struct GNUNET_MESSENGER_MemberFind
};
static int
-iterate_find_member (void* cls, const struct GNUNET_ShortHashCode *key, void *value)
+iterate_find_member (void* cls,
+ const struct GNUNET_ShortHashCode *key,
+ void *value)
{
struct GNUNET_MESSENGER_MemberFind *find = cls;
struct GNUNET_MESSENGER_Contact *contact = value;
@@ -326,7 +352,8 @@ iterate_find_member (void* cls, const struct GNUNET_ShortHashCode *key, void *va
}
int
-find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact)
+find_room_member (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_MESSENGER_Contact *contact)
{
GNUNET_assert(room);
diff --git a/src/messenger/messenger_api_room.h b/src/messenger/messenger_api_room.h
index 634052272..320312f0c 100644
--- a/src/messenger/messenger_api_room.h
+++ b/src/messenger/messenger_api_room.h
@@ -64,7 +64,8 @@ struct GNUNET_MESSENGER_Room
* @return New room
*/
struct GNUNET_MESSENGER_Room*
-create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
+create_room (struct GNUNET_MESSENGER_Handle *handle,
+ const struct GNUNET_HashCode *key);
/**
* Destroys a room and frees its memory fully from the client API.
@@ -83,7 +84,8 @@ destroy_room (struct GNUNET_MESSENGER_Room *room);
* @return Message or NULL
*/
const struct GNUNET_MESSENGER_Message*
-get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash);
+get_room_message (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_HashCode *hash);
/**
* Returns a messages sender locally stored from a map for a given <i>hash</i> in a <i>room</i>. If no
@@ -94,7 +96,8 @@ get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_
* @return Contact of sender or NULL
*/
struct GNUNET_MESSENGER_Contact*
-get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash);
+get_room_sender (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_HashCode *hash);
/**
* Handles a <i>message</i> with a given <i>hash</i> in a <i>room</i> for the client API to update
@@ -110,8 +113,10 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_H
* @return Contact of sender
*/
struct GNUNET_MESSENGER_Contact*
-handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
+handle_room_message (struct GNUNET_MESSENGER_Room *room,
+ struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash);
/**
* Iterates through all members of a given <i>room</i> to forward each of them to a selected
@@ -123,7 +128,8 @@ handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
* @return Amount of members iterated
*/
int
-iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback,
+iterate_room_members (struct GNUNET_MESSENGER_Room *room,
+ GNUNET_MESSENGER_MemberCallback callback,
void* cls);
/**
@@ -135,6 +141,7 @@ iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_Membe
* @return #GNUNET_YES if found, otherwise #GNUNET_NO
*/
int
-find_room_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact);
+find_room_member (const struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_MESSENGER_Contact *contact);
#endif //GNUNET_MESSENGER_API_ROOM_H
diff --git a/src/messenger/messenger_api_util.c b/src/messenger/messenger_api_util.c
index 4ad00c45e..52b4e934a 100644
--- a/src/messenger/messenger_api_util.c
+++ b/src/messenger/messenger_api_util.c
@@ -45,7 +45,8 @@ delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel)
}
int
-generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members)
+generate_free_member_id (struct GNUNET_ShortHashCode *id,
+ const struct GNUNET_CONTAINER_MultiShortmap *members)
{
GNUNET_assert(id);
@@ -84,7 +85,8 @@ get_anonymous_public_key ()
}
void
-convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port)
+convert_messenger_key_to_port(const struct GNUNET_HashCode *key,
+ struct GNUNET_HashCode *port)
{
static uint32_t version_value = 0;
static struct GNUNET_HashCode version;
diff --git a/src/messenger/messenger_api_util.h b/src/messenger/messenger_api_util.h
index af562a1e8..af64790b6 100644
--- a/src/messenger/messenger_api_util.h
+++ b/src/messenger/messenger_api_util.h
@@ -51,7 +51,8 @@ delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel);
* @return #GNUNET_YES on success, #GNUNET_NO on failure
*/
int
-generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members);
+generate_free_member_id (struct GNUNET_ShortHashCode *id,
+ const struct GNUNET_CONTAINER_MultiShortmap *members);
/**
* Returns the public identity key of #GNUNET_IDENTITY_ego_get_anonymous() without
@@ -73,6 +74,7 @@ get_anonymous_public_key ();
* @param[out] port CADET service port
*/
void
-convert_messenger_key_to_port(const struct GNUNET_HashCode *key, struct GNUNET_HashCode *port);
+convert_messenger_key_to_port(const struct GNUNET_HashCode *key,
+ struct GNUNET_HashCode *port);
#endif //GNUNET_SERVICE_MESSENGER_UTIL_H
diff --git a/src/messenger/test_messenger.c b/src/messenger/test_messenger.c
index fb3e3e1bc..5784dfd82 100644
--- a/src/messenger/test_messenger.c
+++ b/src/messenger/test_messenger.c
@@ -100,7 +100,8 @@ static int identity_counter = 0;
* @param handle Handle of messenger service
*/
static void
-on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
+on_identity (void *cls,
+ struct GNUNET_MESSENGER_Handle *handle)
{
if (op_task)
{
@@ -150,7 +151,9 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
* @param peer Peer for testing
*/
static void
-run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer)
+run (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTING_Peer *peer)
{
die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL);
@@ -168,7 +171,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TES
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL))
return 1;
diff --git a/src/messenger/test_messenger_adapt.c b/src/messenger/test_messenger_adapt.c
index 90e8ac28d..3230af6b7 100644
--- a/src/messenger/test_messenger_adapt.c
+++ b/src/messenger/test_messenger_adapt.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 5, 1, 2, 3, 6, 7, 8, 4 };
unsigned int stages [] = { 0x21, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x21 };
diff --git a/src/messenger/test_messenger_anonymous.c b/src/messenger/test_messenger_anonymous.c
index a70121a30..8cb339f0e 100644
--- a/src/messenger/test_messenger_anonymous.c
+++ b/src/messenger/test_messenger_anonymous.c
@@ -96,7 +96,8 @@ end_operation (void *cls)
* @param handle Handle of messenger service
*/
static void
-on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
+on_identity (void *cls,
+ struct GNUNET_MESSENGER_Handle *handle)
{
if (op_task)
{
@@ -144,7 +145,9 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
* @param peer Peer for testing
*/
static void
-run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer)
+run (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTING_Peer *peer)
{
die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL);
@@ -160,7 +163,8 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TES
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL))
return 1;
diff --git a/src/messenger/test_messenger_async_client.c b/src/messenger/test_messenger_async_client.c
index 1067b9a6d..8404195dc 100644
--- a/src/messenger/test_messenger_async_client.c
+++ b/src/messenger/test_messenger_async_client.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 0, 1 };
unsigned int stages [] = { 0x10, 0x20 };
diff --git a/src/messenger/test_messenger_async_p2p.c b/src/messenger/test_messenger_async_p2p.c
index d827aae16..25746f7ff 100644
--- a/src/messenger/test_messenger_async_p2p.c
+++ b/src/messenger/test_messenger_async_p2p.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 2, 1 };
unsigned int stages [] = { 0x30, 0x30 };
diff --git a/src/messenger/test_messenger_growth.c b/src/messenger/test_messenger_growth.c
index 3781f3ee5..c3f243cbf 100644
--- a/src/messenger/test_messenger_growth.c
+++ b/src/messenger/test_messenger_growth.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 };
unsigned int stages [] = { 0x01, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 };
diff --git a/src/messenger/test_messenger_ring.c b/src/messenger/test_messenger_ring.c
index 07cfd0c47..777d79eb8 100644
--- a/src/messenger/test_messenger_ring.c
+++ b/src/messenger/test_messenger_ring.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 8, 1, 2, 3, 4, 5, 6, 7 };
unsigned int stages [] = { 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 };
diff --git a/src/messenger/test_messenger_server.c b/src/messenger/test_messenger_server.c
index 1cf2fcc27..61e96e879 100644
--- a/src/messenger/test_messenger_server.c
+++ b/src/messenger/test_messenger_server.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 };
unsigned int stages [] = { 0x01, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
diff --git a/src/messenger/test_messenger_sync_client.c b/src/messenger/test_messenger_sync_client.c
index 99f26b018..02d90a61d 100644
--- a/src/messenger/test_messenger_sync_client.c
+++ b/src/messenger/test_messenger_sync_client.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 0, 1 };
unsigned int stages [] = { 0x01, 0x20 };
diff --git a/src/messenger/test_messenger_sync_p2p.c b/src/messenger/test_messenger_sync_p2p.c
index 77ce280a1..0a900a39e 100644
--- a/src/messenger/test_messenger_sync_p2p.c
+++ b/src/messenger/test_messenger_sync_p2p.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 2, 1 };
unsigned int stages [] = { 0x21, 0x21 };
diff --git a/src/messenger/test_messenger_worst_client.c b/src/messenger/test_messenger_worst_client.c
index 63826631c..a3d5aafec 100644
--- a/src/messenger/test_messenger_worst_client.c
+++ b/src/messenger/test_messenger_worst_client.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 0, 1 };
unsigned int stages [] = { 0x10, 0x02 };
diff --git a/src/messenger/test_messenger_worst_p2p.c b/src/messenger/test_messenger_worst_p2p.c
index c89288eea..89e54cfbd 100644
--- a/src/messenger/test_messenger_worst_p2p.c
+++ b/src/messenger/test_messenger_worst_p2p.c
@@ -33,7 +33,8 @@
* @return 0 ok, 1 on error
*/
int
-main (int argc, char **argv)
+main (int argc,
+ char **argv)
{
unsigned int doors [] = { 2, 1 };
unsigned int stages [] = { 0x12, 0x12 };
diff --git a/src/messenger/testing_messenger_barrier.c b/src/messenger/testing_messenger_barrier.c
index 618d255b7..a95ea9ef1 100644
--- a/src/messenger/testing_messenger_barrier.c
+++ b/src/messenger/testing_messenger_barrier.c
@@ -61,7 +61,8 @@ GNUNET_init_barrier (unsigned int requirement,
}
static void
-exit_status (struct GNUNET_BarrierHandle *barrier, int status);
+exit_status (struct GNUNET_BarrierHandle *barrier,
+ int status);
static void
cancel_barrier (void *cls)
@@ -96,7 +97,8 @@ struct GNUNET_BarrierWaitHandle
};
static void
-exit_status (struct GNUNET_BarrierHandle *barrier, int status)
+exit_status (struct GNUNET_BarrierHandle *barrier,
+ int status)
{
struct GNUNET_BarrierWaitHandle *waiting = barrier->head;
while (waiting)
diff --git a/src/messenger/testing_messenger_setup.c b/src/messenger/testing_messenger_setup.c
index 98241fa08..3cde8c9bb 100644
--- a/src/messenger/testing_messenger_setup.c
+++ b/src/messenger/testing_messenger_setup.c
@@ -204,7 +204,9 @@ end_error_cb (void *cls)
}
static void
-barrier2_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status)
+barrier2_wait_cb (void *cls,
+ struct GNUNET_BarrierWaitHandle *waiting,
+ int status)
{
struct test_peer *peer = cls;
@@ -215,7 +217,9 @@ barrier2_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int statu
}
static void
-barrier_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status)
+barrier_wait_cb (void *cls,
+ struct GNUNET_BarrierWaitHandle *waiting,
+ int status)
{
struct test_peer *peer = cls;
@@ -259,8 +263,11 @@ barrier_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status
* @param flags Flags of message
*/
static void
-on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender,
- const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash,
+on_message (void *cls,
+ struct GNUNET_MESSENGER_Room *room,
+ const struct GNUNET_MESSENGER_Contact *sender,
+ const struct GNUNET_MESSENGER_Message *message,
+ const struct GNUNET_HashCode *hash,
enum GNUNET_MESSENGER_MessageFlags flags)
{
struct test_peer *peer = cls;
@@ -340,7 +347,9 @@ second_stage (void *cls)
}
static void
-on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo,
+on_peer (void *cb_cls,
+ struct GNUNET_TESTBED_Operation *op,
+ const struct GNUNET_TESTBED_PeerInformation *pinfo,
const char *emsg)
{
struct test_peer *peer = cb_cls;
@@ -396,7 +405,8 @@ on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_
* @param event Information about the event
*/
static void
-run (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
+run (void *cls,
+ const struct GNUNET_TESTBED_EventInformation *event)
{
struct test_properties *properties = cls;
@@ -420,7 +430,9 @@ run (void *cls, const struct GNUNET_TESTBED_EventInformation *event)
}
static void
-barrier2_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status)
+barrier2_cb (void *cls,
+ struct GNUNET_BarrierHandle *barrier,
+ int status)
{
struct test_properties *properties = cls;
@@ -449,7 +461,9 @@ barrier2_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status)
}
static void
-barrier_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status)
+barrier_cb (void *cls,
+ struct GNUNET_BarrierHandle *barrier,
+ int status)
{
struct test_properties *properties = cls;
@@ -485,8 +499,12 @@ barrier_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status)
}
static void
-init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers,
- unsigned int links_succeeded, unsigned int links_failed)
+init (void *cls,
+ struct GNUNET_TESTBED_RunHandle *h,
+ unsigned int num_peers,
+ struct GNUNET_TESTBED_Peer **peers,
+ unsigned int links_succeeded,
+ unsigned int links_failed)
{
struct test_properties *properties = cls;
@@ -500,7 +518,8 @@ init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, str
}
int
-GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg)
+GNUNET_run_messenger_setup (const char* test_name,
+ const struct test_configuration *cfg)
{
struct test_properties properties;
memset(&properties, 0, sizeof(properties));
diff --git a/src/messenger/testing_messenger_setup.h b/src/messenger/testing_messenger_setup.h
index 5e6b5d461..e5ae0c151 100644
--- a/src/messenger/testing_messenger_setup.h
+++ b/src/messenger/testing_messenger_setup.h
@@ -34,6 +34,7 @@ struct test_configuration
};
int
-GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg);
+GNUNET_run_messenger_setup (const char* test_name,
+ const struct test_configuration *cfg);
#endif /* GNUNET_TESTING_MESSENGER_SETUP_H_ */
diff --git a/src/namecache/Makefile.am b/src/namecache/Makefile.am
index 8ffa85ddb..272f16b77 100644
--- a/src/namecache/Makefile.am
+++ b/src/namecache/Makefile.am
@@ -17,30 +17,22 @@ endif
if HAVE_EXPERIMENTAL
FLAT_PLUGIN = libgnunet_plugin_namecache_flat.la
-if HAVE_TESTING
FLAT_TESTS = test_plugin_namecache_flat
endif
-endif
if HAVE_SQLITE
SQLITE_PLUGIN = libgnunet_plugin_namecache_sqlite.la
-if HAVE_TESTING
SQLITE_TESTS = test_plugin_namecache_sqlite
endif
-endif
if HAVE_POSTGRESQL
POSTGRES_PLUGIN = libgnunet_plugin_namecache_postgres.la
-if HAVE_TESTING
POSTGRES_TESTS = test_plugin_namecache_postgres
endif
-endif
# testcases do not even build yet; thus: experimental!
-if HAVE_TESTING
TESTING_TESTS = \
test_namecache_api_cache_block
-endif
if HAVE_SQLITE
check_PROGRAMS = \
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index 18e6a196b..51708dd67 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -16,7 +16,6 @@ if USE_COVERAGE
endif
HEAP_PLUGIN = libgnunet_plugin_namestore_flat.la
-if HAVE_TESTING
HEAP_TESTS = test_plugin_namestore_flat \
test_namestore_api_store_flat \
test_namestore_api_store_update_flat \
@@ -35,11 +34,9 @@ HEAP_TESTS = test_plugin_namestore_flat \
test_namestore_api_monitoring_existing_flat \
test_namestore_api_zone_to_name_flat \
perf_namestore_api_zone_iteration_flat
-endif
if HAVE_SQLITE
SQLITE_PLUGIN = libgnunet_plugin_namestore_sqlite.la
-if HAVE_TESTING
SQLITE_TESTS = test_plugin_namestore_sqlite \
test_namestore_api_store_sqlite \
test_namestore_api_store_update_sqlite \
@@ -59,11 +56,9 @@ SQLITE_TESTS = test_plugin_namestore_sqlite \
test_namestore_api_zone_to_name_sqlite \
perf_namestore_api_zone_iteration_sqlite
endif
-endif
if HAVE_POSTGRESQL
POSTGRES_PLUGIN = libgnunet_plugin_namestore_postgres.la
-if HAVE_TESTING
POSTGRES_TESTS = test_plugin_namestore_postgres \
test_namestore_api_store_postgres \
test_namestore_api_store_update_postgres \
@@ -83,7 +78,6 @@ POSTGRES_TESTS = test_plugin_namestore_postgres \
test_namestore_api_zone_to_name_postgres \
perf_namestore_api_zone_iteration_postgres
endif
-endif
if HAVE_SQLITE
check_PROGRAMS = \
diff --git a/src/nse/Makefile.am b/src/nse/Makefile.am
index 824aa10d4..0c6182e61 100644
--- a/src/nse/Makefile.am
+++ b/src/nse/Makefile.am
@@ -36,10 +36,8 @@ libgnunetnse_la_LDFLAGS = \
libexec_PROGRAMS = \
gnunet-service-nse
-if HAVE_TESTING
noinst_PROGRAMS = \
gnunet-nse-profiler
-endif
gnunet_nse_profiler_SOURCES = \
gnunet-nse-profiler.c
@@ -71,12 +69,10 @@ if HAVE_BENCHMARKS
MULTIPEER_TEST = test_nse_multipeer
endif
-if HAVE_TESTING
check_PROGRAMS = \
test_nse_api \
perf_kdf \
$(MULTIPEER_TEST)
-endif
if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
diff --git a/src/peerinfo/Makefile.am b/src/peerinfo/Makefile.am
index e61e5a13d..cdab22a9d 100644
--- a/src/peerinfo/Makefile.am
+++ b/src/peerinfo/Makefile.am
@@ -48,14 +48,12 @@ if HAVE_BENCHMARKS
perf_peerinfo_api
endif
-if HAVE_TESTING
check_PROGRAMS = \
test_peerinfo_shipped_hellos \
test_peerinfo_api \
test_peerinfo_api_friend_only \
test_peerinfo_api_notify_friend_only \
$(PEERINFO_BENCHMARKS)
-endif
if ENABLE_TEST_RUN
diff --git a/src/peerstore/Makefile.am b/src/peerstore/Makefile.am
index babf40654..d9904e59d 100644
--- a/src/peerstore/Makefile.am
+++ b/src/peerstore/Makefile.am
@@ -63,9 +63,7 @@ endif
if HAVE_SQLITE
SQLITE_PLUGIN = libgnunet_plugin_peerstore_sqlite.la
-if HAVE_TESTING
SQLITE_TESTS = test_plugin_peerstore_sqlite
-endif
libgnunet_plugin_peerstore_sqlite_la_SOURCES = \
plugin_peerstore_sqlite.c
libgnunet_plugin_peerstore_sqlite_la_LIBADD = \
diff --git a/src/pt/Makefile.am b/src/pt/Makefile.am
index 10ae04931..fc2cb592c 100644
--- a/src/pt/Makefile.am
+++ b/src/pt/Makefile.am
@@ -28,8 +28,6 @@ gnunet_daemon_pt_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
-if HAVE_TESTING
-
if HAVE_LIBGNURL
LIB_GNURL=@LIBGNURL@
CPP_GNURL=@LIBGNURL_CPPFLAGS@
@@ -56,8 +54,6 @@ endif
endif
endif
-endif
-
check_PROGRAMS = $(VPN_TEST)
if ENABLE_TEST_RUN
diff --git a/src/regex/Makefile.am b/src/regex/Makefile.am
index 9a7466cb2..2dbf3a3f9 100644
--- a/src/regex/Makefile.am
+++ b/src/regex/Makefile.am
@@ -102,11 +102,9 @@ libgnunetregextest_a_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
libgnunetregex_internal.a
-if HAVE_TESTING
noinst_PROGRAMS = $(noinst_mysql_progs) \
perf-regex \
gnunet-regex-profiler
-endif
perf_regex_SOURCES = \
perf-regex.c
diff --git a/src/rps/Makefile.am b/src/rps/Makefile.am
index b9de6b5e3..b5e8c0617 100644
--- a/src/rps/Makefile.am
+++ b/src/rps/Makefile.am
@@ -45,10 +45,8 @@ libgnunetrps_la_CFLAGS = $(AM_CFLAGS)
libexec_PROGRAMS = \
gnunet-service-rps
-if HAVE_TESTING
noinst_PROGRAMS = \
gnunet-rps-profiler
-endif
gnunet_service_rps_SOURCES = \
@@ -74,7 +72,6 @@ gnunet_service_rps_LDADD = \
$(GN_LIBINTL)
-if HAVE_TESTING
check_PROGRAMS = \
test_service_rps_view \
test_service_rps_custommap \
@@ -91,7 +88,6 @@ check_PROGRAMS += \
test_rps_malicious_2 \
test_rps_malicious_3
endif
-endif
rps_test_src = \
test_rps.c \
diff --git a/src/secretsharing/Makefile.am b/src/secretsharing/Makefile.am
index 9ae6e7892..13dd0bd8d 100644
--- a/src/secretsharing/Makefile.am
+++ b/src/secretsharing/Makefile.am
@@ -51,7 +51,6 @@ libgnunetsecretsharing_la_LIBADD = \
libgnunetsecretsharing_la_LDFLAGS = \
$(GN_LIB_LDFLAGS)
-if HAVE_TESTING
bin_PROGRAMS = \
gnunet-secretsharing-profiler
@@ -62,7 +61,6 @@ if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
TESTS = $(check_PROGRAMS)
endif
-endif
test_secretsharing_api_SOURCES = \
test_secretsharing_api.c
diff --git a/src/set/Makefile.am b/src/set/Makefile.am
index d6b10a1f8..837d42ff5 100644
--- a/src/set/Makefile.am
+++ b/src/set/Makefile.am
@@ -14,13 +14,11 @@ if USE_COVERAGE
AM_CFLAGS = -fprofile-arcs -ftest-coverage
endif
-if HAVE_TESTING
bin_PROGRAMS = \
gnunet-set-profiler
noinst_PROGRAMS = \
gnunet-set-ibf-profiler
-endif
libexec_PROGRAMS = \
gnunet-service-set
@@ -69,13 +67,11 @@ libgnunetset_la_LIBADD = \
libgnunetset_la_LDFLAGS = \
$(GN_LIB_LDFLAGS)
-if HAVE_TESTING
check_PROGRAMS = \
test_set_api \
test_set_union_result_symmetric \
test_set_intersection_result_full \
test_set_union_copy
-endif
if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
diff --git a/src/seti/Makefile.am b/src/seti/Makefile.am
index 522f33ece..8441c5060 100644
--- a/src/seti/Makefile.am
+++ b/src/seti/Makefile.am
@@ -14,10 +14,8 @@ if USE_COVERAGE
AM_CFLAGS = -fprofile-arcs -ftest-coverage
endif
-if HAVE_TESTING
bin_PROGRAMS = \
gnunet-seti-profiler
-endif
libexec_PROGRAMS = \
gnunet-service-seti
@@ -55,10 +53,8 @@ libgnunetseti_la_LIBADD = \
libgnunetseti_la_LDFLAGS = \
$(GN_LIB_LDFLAGS)
-if HAVE_TESTING
check_PROGRAMS = \
test_seti_api
-endif
if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
diff --git a/src/setu/Makefile.am b/src/setu/Makefile.am
index 77d048add..897bf3f86 100644
--- a/src/setu/Makefile.am
+++ b/src/setu/Makefile.am
@@ -14,13 +14,11 @@ if USE_COVERAGE
AM_CFLAGS = -fprofile-arcs -ftest-coverage
endif
-if HAVE_TESTING
bin_PROGRAMS = \
gnunet-setu-profiler
noinst_PROGRAMS = \
gnunet-setu-ibf-profiler
-endif
libexec_PROGRAMS = \
gnunet-service-setu
@@ -67,11 +65,9 @@ libgnunetsetu_la_LIBADD = \
libgnunetsetu_la_LDFLAGS = \
$(GN_LIB_LDFLAGS)
-if HAVE_TESTING
check_PROGRAMS = \
test_setu_api \
perf_setu_api
-endif
if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c
index b07c725a3..49d975119 100644
--- a/src/testbed/gnunet-testbed-profiler.c
+++ b/src/testbed/gnunet-testbed-profiler.c
@@ -227,11 +227,9 @@ test_run (void *cls,
abort_task = NULL;
return;
}
-#if (! ENABLE_SUPERMUC)
fprintf (stdout, "Testbed running, waiting for keystroke to shut down\n");
fflush (stdout);
(void) getc (stdin);
-#endif
fprintf (stdout, "Shutting down. Please wait\n");
fflush (stdout);
GNUNET_SCHEDULER_shutdown ();
@@ -297,14 +295,12 @@ main (int argc, char *const *argv)
"keystroke but continues to run until a termination "
"signal is received"),
&noninteractive),
-#if ! ENABLE_SUPERMUC
GNUNET_GETOPT_option_string ('H',
"hosts",
"FILENAME",
gettext_noop (
"name of the file with the login information for the testbed"),
&hosts_file),
-#endif
GNUNET_GETOPT_OPTION_END
};
const char *binaryHelp = "gnunet-testbed-profiler [OPTIONS]";
diff --git a/src/testbed/gnunet_testbed_mpi_spawn.c b/src/testbed/gnunet_testbed_mpi_spawn.c
deleted file mode 100644
index 577ffbeba..000000000
--- a/src/testbed/gnunet_testbed_mpi_spawn.c
+++ /dev/null
@@ -1,327 +0,0 @@
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_testbed_service.h"
-
-
-/**
- * Generic logging shorthand
- */
-#define LOG(kind, ...) \
- GNUNET_log (kind, __VA_ARGS__)
-
-/**
- * Debug logging shorthand
- */
-#define LOG_DEBUG(...) \
- LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
-
-/**
- * Global result
- */
-static int ret;
-
-/**
- * The child process we spawn
- */
-static struct GNUNET_OS_Process *child;
-
-/**
- * The arguments including the binary to spawn
- */
-static char **argv2;
-
-/**
- * Pipe used to communicate shutdown via signal.
- */
-static struct GNUNET_DISK_PipeHandle *sigpipe;
-
-/**
- * Filename of the unique file
- */
-static char *fn;
-
-/**
- * Handle to the unique file
- */
-static int fh;
-
-/**
- * The return code of the binary
- */
-static unsigned long child_exit_code;
-
-/**
- * The process status of the child
- */
-static enum GNUNET_OS_ProcessStatusType child_status;
-
-/**
- * Task to kill the child
- */
-static struct GNUNET_SCHEDULER_Task *terminate_task_id;
-
-/**
- * Task to kill the child
- */
-static struct GNUNET_SCHEDULER_Task *child_death_task_id;
-
-/**
- * The shutdown task
- */
-static void
-shutdown_task (void *cls)
-{
- if (0 != child_exit_code)
- {
- LOG (GNUNET_ERROR_TYPE_WARNING, "Child exited with error code: %lu\n",
- child_exit_code);
- ret = 128 + (int) child_exit_code;
- }
- if (0 != fh)
- {
- close (fh);
- }
- if ((NULL != fn) && (0 != unlink (fn)))
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "open");
- ret = GNUNET_SYSERR;
- }
-}
-
-
-static void
-terminate_task (void *cls)
-{
- static int hard_kill;
-
- GNUNET_assert (NULL != child);
- terminate_task_id =
- GNUNET_SCHEDULER_add_shutdown (&terminate_task, NULL);
- if (0 != hard_kill)
- {
- switch (hard_kill)
- {
- case 1:
- case 2:
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "%d more interrupts needed to send SIGKILL to the child\n",
- 3 - hard_kill);
- hard_kill++;
- return;
-
- case 3:
- GNUNET_break (0 == GNUNET_OS_process_kill (child, SIGKILL));
- return;
- }
- }
- hard_kill++;
- GNUNET_break (0 == GNUNET_OS_process_kill (child, GNUNET_TERM_SIG));
- LOG (GNUNET_ERROR_TYPE_INFO, _ ("Waiting for child to exit.\n"));
-}
-
-
-/**
- * Task triggered whenever we receive a SIGCHLD (child
- * process died).
- *
- * @param cls closure, NULL if we need to self-restart
- */
-static void
-child_death_task (void *cls)
-{
- const struct GNUNET_DISK_FileHandle *pr;
- char c[16];
- const struct GNUNET_SCHEDULER_TaskContext *tc;
-
-
- pr = GNUNET_DISK_pipe_handle (sigpipe, GNUNET_DISK_PIPE_END_READ);
- child_death_task_id = NULL;
- tc = GNUNET_SCHEDULER_get_task_context ();
- if (0 == (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY))
- {
- child_death_task_id =
- GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- pr, &child_death_task, NULL);
- return;
- }
- /* consume the signal */
- GNUNET_break (0 < GNUNET_DISK_file_read (pr, &c, sizeof(c)));
- LOG_DEBUG ("Child died\n");
- GNUNET_SCHEDULER_cancel (terminate_task_id);
- terminate_task_id = NULL;
- GNUNET_assert (GNUNET_OK == GNUNET_OS_process_status (child, &child_status,
- &child_exit_code));
- GNUNET_OS_process_destroy (child);
- child = NULL;
- GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
-}
-
-
-static void
-destroy_hosts (struct GNUNET_TESTBED_Host **hosts, unsigned int nhosts)
-{
- unsigned int host;
-
- GNUNET_assert (NULL != hosts);
- for (host = 0; host < nhosts; host++)
- if (NULL != hosts[host])
- GNUNET_TESTBED_host_destroy (hosts[host]);
- GNUNET_free (hosts);
- hosts = NULL;
-}
-
-
-/**
- * The main scheduler run task
- *
- * @param cls NULL
- */
-static void
-run (void *cls)
-{
- struct GNUNET_TESTBED_Host **hosts;
- const struct GNUNET_CONFIGURATION_Handle *null_cfg;
- char *tmpdir;
- char *hostname;
- size_t hostname_len;
- unsigned int nhosts;
-
- null_cfg = GNUNET_CONFIGURATION_create ();
- nhosts = GNUNET_TESTBED_hosts_load_from_loadleveler (null_cfg, &hosts);
- if (0 == nhosts)
- {
- GNUNET_break (0);
- ret = GNUNET_SYSERR;
- return;
- }
- hostname_len = GNUNET_OS_get_hostname_max_length ();
- hostname = GNUNET_malloc (hostname_len);
- if (0 != gethostname (hostname, hostname_len))
- {
- LOG (GNUNET_ERROR_TYPE_ERROR, "Cannot get hostname. Exiting\n");
- GNUNET_free (hostname);
- destroy_hosts (hosts, nhosts);
- ret = GNUNET_SYSERR;
- return;
- }
- if (NULL == strstr (GNUNET_TESTBED_host_get_hostname (hosts[0]), hostname))
- {
- LOG_DEBUG ("Exiting as `%s' is not the lowest host\n", hostname);
- GNUNET_free (hostname);
- ret = GNUNET_OK;
- return;
- }
- LOG_DEBUG ("Will be executing `%s' on host `%s'\n", argv2[0], hostname);
- GNUNET_free (hostname);
- destroy_hosts (hosts, nhosts);
- tmpdir = getenv ("TMPDIR");
- if (NULL == tmpdir)
- tmpdir = getenv ("TMP");
- if (NULL == tmpdir)
- tmpdir = getenv ("TEMP");
- if (NULL == tmpdir)
- tmpdir = "/tmp";
- (void) GNUNET_asprintf (&fn, "%s/gnunet-testbed-spawn.lock", tmpdir);
- /* Open the unique file; we can create it then we can spawn the child process
- else we exit */
- fh = open (fn, O_CREAT | O_EXCL | O_CLOEXEC,
- S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
- if (-1 == fh)
- {
- if (EEXIST == errno)
- {
- LOG_DEBUG ("Lock file already created by other process. Exiting\n");
- ret = GNUNET_OK;
- return;
- }
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "open");
- ret = GNUNET_SYSERR;
- return;
- }
- /* Spawn the new process here */
- LOG (GNUNET_ERROR_TYPE_INFO, _ ("Spawning process `%s'\n"), argv2[0]);
- child = GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL,
- NULL,
- NULL, NULL,
- argv2[0], argv2);
- if (NULL == child)
- {
- GNUNET_break (0);
- ret = GNUNET_SYSERR;
- GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
- return;
- }
- ret = GNUNET_OK;
- terminate_task_id =
- GNUNET_SCHEDULER_add_shutdown (&terminate_task, NULL);
- child_death_task_id =
- GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_DISK_pipe_handle (sigpipe,
- GNUNET_DISK_PIPE_END_READ),
- &child_death_task, NULL);
-}
-
-
-/**
- * Signal handler called for SIGCHLD.
- */
-static void
-sighandler_child_death ()
-{
- static char c;
- int old_errno = errno; /* back-up errno */
-
- GNUNET_break (1 ==
- GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle
- (sigpipe, GNUNET_DISK_PIPE_END_WRITE),
- &c, sizeof(c)));
- errno = old_errno; /* restore errno */
-}
-
-
-/**
- * Execution start point
- */
-int
-main (int argc, char *argv[])
-{
- struct GNUNET_SIGNAL_Context *shc_chld;
- unsigned int cnt;
-
- ret = -1;
- if (argc < 2)
- {
- printf ("Need arguments: gnunet-testbed-mpi-spawn <cmd> <cmd_args>");
- return 1;
- }
- if (GNUNET_OK != GNUNET_log_setup ("gnunet-testbed-spawn", NULL, NULL))
- {
- GNUNET_break (0);
- return 1;
- }
- if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE)))
- {
- GNUNET_break (0);
- ret = GNUNET_SYSERR;
- return 1;
- }
- shc_chld =
- GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death);
- if (NULL == shc_chld)
- {
- LOG (GNUNET_ERROR_TYPE_ERROR, "Cannot install a signal handler\n");
- return 1;
- }
- argv2 = GNUNET_malloc (sizeof(char *) * argc);
- for (cnt = 1; cnt < argc; cnt++)
- argv2[cnt - 1] = argv[cnt];
- GNUNET_SCHEDULER_run (run, NULL);
- GNUNET_free (argv2);
- GNUNET_SIGNAL_handler_uninstall (shc_chld);
- shc_chld = NULL;
- GNUNET_DISK_pipe_close (sigpipe);
- GNUNET_free (fn);
- if (GNUNET_OK != ret)
- return ret;
- return 0;
-}
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c
index 1a8d9976d..8dd0a4893 100644
--- a/src/testbed/testbed_api_hosts.c
+++ b/src/testbed/testbed_api_hosts.c
@@ -568,41 +568,6 @@ simple_resolve (const char *host)
/**
- * Loads the set of host allocated by the LoadLeveler Job Scheduler. This
- * function is only available when compiled with support for LoadLeveler and is
- * used for running on the SuperMUC
- *
- * @param cfg the configuration to use as a template while starting a controller
- * on any of the loaded hosts. Operation queue sizes specific to a host
- * are also read from this configuration handle
- * @param hosts set to the hosts found in the file; caller must free this if
- * number of hosts returned is greater than 0
- * @return number of hosts returned in 'hosts', 0 on error
- */
-unsigned int
-GNUNET_TESTBED_hosts_load_from_loadleveler (
- const struct GNUNET_CONFIGURATION_Handle *cfg,
- struct GNUNET_TESTBED_Host ***hosts)
-{
-#if ! ENABLE_SUPERMUC
- LOG (GNUNET_ERROR_TYPE_ERROR,
- _ ("The function %s is only available when compiled with (--with-ll)\n"),
- __func__);
- GNUNET_assert (0);
-#else
- const char *hostfile;
-
- if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE")))
- {
- GNUNET_break (0);
- return 0;
- }
- return GNUNET_TESTBED_hosts_load_from_file (hostfile, cfg, hosts);
-#endif
-}
-
-
-/**
* Destroy a host handle. Must only be called once everything
* running on that host has been stopped.
*
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c
index e9b9979ce..e0b76ad78 100644
--- a/src/testbed/testbed_api_testbed.c
+++ b/src/testbed/testbed_api_testbed.c
@@ -1265,16 +1265,6 @@ GNUNET_TESTBED_run (const char *host_filename,
GNUNET_assert (num_peers > 0);
rc = GNUNET_new (struct GNUNET_TESTBED_RunHandle);
rc->cfg = GNUNET_CONFIGURATION_dup (cfg);
-#if ENABLE_SUPERMUC
- rc->num_hosts = GNUNET_TESTBED_hosts_load_from_loadleveler (rc->cfg,
- &rc->hosts);
- if (0 == rc->num_hosts)
- {
- LOG (GNUNET_ERROR_TYPE_WARNING,
- _ ("No hosts loaded from LoadLeveler. Need at least one host\n"));
- goto error_cleanup;
- }
-#else
if (NULL != host_filename)
{
rc->num_hosts =
@@ -1289,7 +1279,6 @@ GNUNET_TESTBED_run (const char *host_filename,
}
else
rc->h = GNUNET_TESTBED_host_create (NULL, NULL, rc->cfg, 0);
-#endif
rc->num_peers = num_peers;
rc->event_mask = event_mask;
rc->cc = cc;
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index efb22b279..39e85c4ac 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -42,19 +42,18 @@ libgnunet_test_testing_plugin_testcmd_la_LIBADD = \
libgnunet_test_testing_plugin_testcmd_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
+
libgnunettesting_la_SOURCES = \
+ testing_api_cmd_end.c \
+ testing_api_cmd_finish.c \
testing_api_cmd_local_test_finished.c \
testing_api_cmd_send_peer_ready.c \
testing_api_cmd_block_until_all_peers_started.c \
testing_api_cmd_block_until_external_trigger.c \
testing_api_cmd_netjail_start.c \
- testing_api_cmd_netjail_start_v2.c \
testing_api_cmd_netjail_start_testsystem.c \
- testing_api_cmd_netjail_start_testsystem_v2.c \
testing_api_cmd_netjail_stop_testsystem.c \
- testing_api_cmd_netjail_stop_testsystem_v2.c \
testing_api_cmd_netjail_stop.c \
- testing_api_cmd_netjail_stop_v2.c \
testing.c testing.h \
testing_api_cmd_system_create.c \
testing_api_cmd_system_destroy.c \
@@ -94,7 +93,6 @@ list_keys_LDADD = \
check_PROGRAMS = \
- test_testing_topology \
test_testing_api_cmd_netjail \
test_testing_hello_world \
test_testing_portreservation \
@@ -106,7 +104,6 @@ check_PROGRAMS = \
if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
TESTS = \
- test_testing_topology \
test_testing_api_cmd_netjail \
test_testing_hello_world \
test_testing_portreservation \
@@ -115,11 +112,11 @@ TESTS = \
test_testing_servicestartup
endif
-test_testing_topology_SOURCES = \
- test_testing_topology.c
-test_testing_topology_LDADD = \
- libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
+#test_testing_topology_SOURCES = \
+# test_testing_topology.c
+#test_testing_topology_LDADD = \
+# libgnunettesting.la \
+# $(top_builddir)/src/util/libgnunetutil.la
test_testing_api_cmd_netjail_SOURCES = \
test_testing_api_cmd_netjail.c
diff --git a/src/testing/netjail_core.sh b/src/testing/netjail_core.sh
index cf350d3fa..ef0a54a5e 100755
--- a/src/testing/netjail_core.sh
+++ b/src/testing/netjail_core.sh
@@ -2,6 +2,7 @@
#
+PREFIX=${PPID:?must run from a parent process}
# running with `sudo` is required to be
# able running the actual commands as the
@@ -9,10 +10,61 @@
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-netjail_check() {
- NODE_COUNT=$1
+export RESULT=
+export NAMESPACE_NUM=0
+export INTERFACE_NUM=0
+
+netjail_next_namespace() {
+ local NUM=$NAMESPACE_NUM
+ NAMESPACE_NUM=$(($NAMESPACE_NUM + 1))
+ RESULT=$NUM
+}
+
+netjail_next_interface() {
+ local NUM=$INTERFACE_NUM
+ INTERFACE_NUM=$(($INTERFACE_NUM + 1))
+ RESULT=$NUM
+}
+
+netjail_opt() {
+ local OPT=$1
+ shift 1
+
+ INDEX=1
+
+ while [ $# -gt 0 ]; do
+ if [ "$1" = "$OPT" ]; then
+ RESULT=$INDEX
+ return
+ fi
+
+ INDEX=$(($INDEX + 1))
+ shift 1
+ done
+
+ RESULT=0
+}
+
+netjail_opts() {
+ local OPT=$1
+ local DEF=$2
+ shift 2
+
+ while [ $# -gt 0 ]; do
+ if [ "$1" = "$OPT" ]; then
+ printf "$2"
+ return
+ fi
+
+ shift 1
+ done
+
+ RESULT="$DEF"
+}
- FD_COUNT=$(($(ls /proc/self/fd | wc -w) - 4))
+netjail_check() {
+ local NODE_COUNT=$1
+ local FD_COUNT=$(($(ls /proc/self/fd | wc -w) - 4))
# quit if `$FD_COUNT < ($LOCAL_M * $GLOBAL_N * 2)`:
# the script also requires `sudo -C ($FD_COUNT + 4)`
@@ -25,43 +77,81 @@ netjail_check() {
fi
}
-netjail_print_name() {
- printf "%s%02x%02x" $1 $2 ${3:-0}
+netjail_check_bin() {
+ local PROGRAM=$1
+ local MATCH=$(ls $(echo $PATH | tr ":" "\n") | grep "^$PROGRAM\$" | tr "\n" " " | awk '{ print $1 }')
+
+ # quit if the required binary $PROGRAM can not be
+ # found in the used $PATH.
+
+ if [ "$MATCH" != "$PROGRAM" ]; then
+ echo "Required binary not found: $PROGRAM" >&2
+ exit 1
+ fi
}
netjail_bridge() {
- BRIDGE=$1
+ netjail_next_interface
+ local NUM=$RESULT
+ local BRIDGE=$(printf "%06x-%08x" $PREFIX $NUM)
ip link add $BRIDGE type bridge
ip link set dev $BRIDGE up
+
+ RESULT=$BRIDGE
+}
+
+netjail_bridge_name() {
+ netjail_next_interface
+ local NUM=$RESULT
+ local BRIDGE=$(printf "%06x-%08x" $PREFIX $NUM)
+
+ RESULT=$BRIDGE
}
netjail_bridge_clear() {
- BRIDGE=$1
+ local BRIDGE=$1
ip link delete $BRIDGE
}
netjail_node() {
- NODE=$1
+ netjail_next_namespace
+ local NUM=$RESULT
+ local NODE=$(printf "%06x-%08x" $PREFIX $NUM)
ip netns add $NODE
+
+ RESULT=$NODE
+}
+
+netjail_node_name() {
+ netjail_next_namespace
+ local NUM=$RESULT
+ local NODE=$(printf "%06x-%08x" $PREFIX $NUM)
+
+ RESULT=$NODE
}
netjail_node_clear() {
- NODE=$1
+ local NODE=$1
ip netns delete $NODE
}
netjail_node_link_bridge() {
- NODE=$1
- BRIDGE=$2
- ADDRESS=$3
- MASK=$4
+ local NODE=$1
+ local BRIDGE=$2
+ local ADDRESS=$3
+ local MASK=$4
- LINK_IF="$NODE-$BRIDGE-0"
- LINK_BR="$NODE-$BRIDGE-1"
+ netjail_next_interface
+ local NUM_IF=$RESULT
+ netjail_next_interface
+ local NUM_BR=$RESULT
+
+ local LINK_IF=$(printf "%06x-%08x" $PREFIX $NUM_IF)
+ local LINK_BR=$(printf "%06x-%08x" $PREFIX $NUM_BR)
ip link add $LINK_IF type veth peer name $LINK_BR
ip link set $LINK_IF netns $NODE
@@ -72,28 +162,47 @@ netjail_node_link_bridge() {
ip -n $NODE link set up dev lo
ip link set $LINK_BR up
+
+ RESULT=$LINK_BR
+}
+
+netjail_node_link_bridge_name() {
+
+ netjail_next_interface
+ netjail_next_interface
+ local NUM_BR=$RESULT
+
+ local LINK_BR=$(printf "%06x-%08x" $PREFIX $NUM_BR)
+
+ RESULT=$LINK_BR
+}
+
+netjail_node_unlink_bridge() {
+ local LINK_BR=$1
+
+ ip link delete $LINK_BR
}
netjail_node_add_nat() {
- NODE=$1
- ADDRESS=$2
- MASK=$3
+ local NODE=$1
+ local ADDRESS=$2
+ local MASK=$3
ip netns exec $NODE iptables -t nat -A POSTROUTING -s "$ADDRESS/$MASK" -j MASQUERADE
}
netjail_node_add_default() {
- NODE=$1
- ADDRESS=$2
+ local NODE=$1
+ local ADDRESS=$2
ip -n $NODE route add default via $ADDRESS
}
netjail_node_exec() {
JAILOR=${SUDO_USER:?must run in sudo}
- NODE=$1
- FD_IN=$2
- FD_OUT=$3
+ local NODE=$1
+ local FD_IN=$2
+ local FD_OUT=$3
shift 3
ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN
@@ -114,3 +223,38 @@ netjail_node_exec_without_fds_and_sudo() {
ip netns exec $NODE $@
}
+netjail_kill() {
+ local PID=$1
+ local MATCH=$(ps --pid $PID | awk "{ if ( \$1 == $PID ) { print \$1 } }" | wc -l)
+
+ if [ $MATCH -gt 0 ]; then
+ kill -n 19 $PID
+
+ for CHILD in $(ps -o pid,ppid -ax | awk "{ if ( \$2 == $PID ) { print \$1 } }"); do
+ netjail_kill $CHILD
+ done
+
+ kill $PID
+ fi
+}
+
+netjail_killall() {
+ if [ $# -gt 0 ]; then
+ local PIDS=$1
+
+ for PID in $PIDS; do
+ netjail_kill $PID
+ done
+ fi
+}
+
+netjail_waitall() {
+ if [ $# -gt 0 ]; then
+ local PIDS=$1
+
+ for PID in $PIDS; do
+ wait $PID
+ done
+ fi
+}
+
diff --git a/src/testing/netjail_core_v2.sh b/src/testing/netjail_core_v2.sh
deleted file mode 100755
index ef0a54a5e..000000000
--- a/src/testing/netjail_core_v2.sh
+++ /dev/null
@@ -1,260 +0,0 @@
-#!/bin/sh
-#
-
-
-PREFIX=${PPID:?must run from a parent process}
-
-# running with `sudo` is required to be
-# able running the actual commands as the
-# original user.
-
-export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-
-export RESULT=
-export NAMESPACE_NUM=0
-export INTERFACE_NUM=0
-
-netjail_next_namespace() {
- local NUM=$NAMESPACE_NUM
- NAMESPACE_NUM=$(($NAMESPACE_NUM + 1))
- RESULT=$NUM
-}
-
-netjail_next_interface() {
- local NUM=$INTERFACE_NUM
- INTERFACE_NUM=$(($INTERFACE_NUM + 1))
- RESULT=$NUM
-}
-
-netjail_opt() {
- local OPT=$1
- shift 1
-
- INDEX=1
-
- while [ $# -gt 0 ]; do
- if [ "$1" = "$OPT" ]; then
- RESULT=$INDEX
- return
- fi
-
- INDEX=$(($INDEX + 1))
- shift 1
- done
-
- RESULT=0
-}
-
-netjail_opts() {
- local OPT=$1
- local DEF=$2
- shift 2
-
- while [ $# -gt 0 ]; do
- if [ "$1" = "$OPT" ]; then
- printf "$2"
- return
- fi
-
- shift 1
- done
-
- RESULT="$DEF"
-}
-
-netjail_check() {
- local NODE_COUNT=$1
- local FD_COUNT=$(($(ls /proc/self/fd | wc -w) - 4))
-
- # quit if `$FD_COUNT < ($LOCAL_M * $GLOBAL_N * 2)`:
- # the script also requires `sudo -C ($FD_COUNT + 4)`
- # so you need 'Defaults closefrom_override' in the
- # sudoers file.
-
- if [ $FD_COUNT -lt $(($NODE_COUNT * 2)) ]; then
- echo "File descriptors do not match requirements!" >&2
- exit 1
- fi
-}
-
-netjail_check_bin() {
- local PROGRAM=$1
- local MATCH=$(ls $(echo $PATH | tr ":" "\n") | grep "^$PROGRAM\$" | tr "\n" " " | awk '{ print $1 }')
-
- # quit if the required binary $PROGRAM can not be
- # found in the used $PATH.
-
- if [ "$MATCH" != "$PROGRAM" ]; then
- echo "Required binary not found: $PROGRAM" >&2
- exit 1
- fi
-}
-
-netjail_bridge() {
- netjail_next_interface
- local NUM=$RESULT
- local BRIDGE=$(printf "%06x-%08x" $PREFIX $NUM)
-
- ip link add $BRIDGE type bridge
- ip link set dev $BRIDGE up
-
- RESULT=$BRIDGE
-}
-
-netjail_bridge_name() {
- netjail_next_interface
- local NUM=$RESULT
- local BRIDGE=$(printf "%06x-%08x" $PREFIX $NUM)
-
- RESULT=$BRIDGE
-}
-
-netjail_bridge_clear() {
- local BRIDGE=$1
-
- ip link delete $BRIDGE
-}
-
-netjail_node() {
- netjail_next_namespace
- local NUM=$RESULT
- local NODE=$(printf "%06x-%08x" $PREFIX $NUM)
-
- ip netns add $NODE
-
- RESULT=$NODE
-}
-
-netjail_node_name() {
- netjail_next_namespace
- local NUM=$RESULT
- local NODE=$(printf "%06x-%08x" $PREFIX $NUM)
-
- RESULT=$NODE
-}
-
-netjail_node_clear() {
- local NODE=$1
-
- ip netns delete $NODE
-}
-
-netjail_node_link_bridge() {
- local NODE=$1
- local BRIDGE=$2
- local ADDRESS=$3
- local MASK=$4
-
- netjail_next_interface
- local NUM_IF=$RESULT
- netjail_next_interface
- local NUM_BR=$RESULT
-
- local LINK_IF=$(printf "%06x-%08x" $PREFIX $NUM_IF)
- local LINK_BR=$(printf "%06x-%08x" $PREFIX $NUM_BR)
-
- ip link add $LINK_IF type veth peer name $LINK_BR
- ip link set $LINK_IF netns $NODE
- ip link set $LINK_BR master $BRIDGE
-
- ip -n $NODE addr add "$ADDRESS/$MASK" dev $LINK_IF
- ip -n $NODE link set $LINK_IF up
- ip -n $NODE link set up dev lo
-
- ip link set $LINK_BR up
-
- RESULT=$LINK_BR
-}
-
-netjail_node_link_bridge_name() {
-
- netjail_next_interface
- netjail_next_interface
- local NUM_BR=$RESULT
-
- local LINK_BR=$(printf "%06x-%08x" $PREFIX $NUM_BR)
-
- RESULT=$LINK_BR
-}
-
-netjail_node_unlink_bridge() {
- local LINK_BR=$1
-
- ip link delete $LINK_BR
-}
-
-netjail_node_add_nat() {
- local NODE=$1
- local ADDRESS=$2
- local MASK=$3
-
- ip netns exec $NODE iptables -t nat -A POSTROUTING -s "$ADDRESS/$MASK" -j MASQUERADE
-}
-
-netjail_node_add_default() {
- local NODE=$1
- local ADDRESS=$2
-
- ip -n $NODE route add default via $ADDRESS
-}
-
-netjail_node_exec() {
- JAILOR=${SUDO_USER:?must run in sudo}
- local NODE=$1
- local FD_IN=$2
- local FD_OUT=$3
- shift 3
-
- ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN
-}
-
-netjail_node_exec_without_fds() {
- JAILOR=${SUDO_USER:?must run in sudo}
- NODE=$1
- shift 1
-
- ip netns exec $NODE sudo -u $JAILOR -- $@
-}
-
-netjail_node_exec_without_fds_and_sudo() {
- NODE=$1
- shift 1
-
- ip netns exec $NODE $@
-}
-
-netjail_kill() {
- local PID=$1
- local MATCH=$(ps --pid $PID | awk "{ if ( \$1 == $PID ) { print \$1 } }" | wc -l)
-
- if [ $MATCH -gt 0 ]; then
- kill -n 19 $PID
-
- for CHILD in $(ps -o pid,ppid -ax | awk "{ if ( \$2 == $PID ) { print \$1 } }"); do
- netjail_kill $CHILD
- done
-
- kill $PID
- fi
-}
-
-netjail_killall() {
- if [ $# -gt 0 ]; then
- local PIDS=$1
-
- for PID in $PIDS; do
- netjail_kill $PID
- done
- fi
-}
-
-netjail_waitall() {
- if [ $# -gt 0 ]; then
- local PIDS=$1
-
- for PID in $PIDS; do
- wait $PID
- done
- fi
-}
-
diff --git a/src/testing/netjail_exec.sh b/src/testing/netjail_exec.sh
index 17a7caaac..cd993a39b 100755
--- a/src/testing/netjail_exec.sh
+++ b/src/testing/netjail_exec.sh
@@ -9,8 +9,6 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
M=$1
N=$2
-NODE=$(netjail_print_name "N" $N $M)
+NODE=$6
-
-
-netjail_node_exec_without_fds_and_sudo $NODE $3 $4 $5 $1 $2
+netjail_node_exec_without_fds_and_sudo $NODE $3 $4 $5 $1 $2
diff --git a/src/testing/netjail_exec_v2.sh b/src/testing/netjail_exec_v2.sh
deleted file mode 100755
index 597baad20..000000000
--- a/src/testing/netjail_exec_v2.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-. "./../testing/netjail_core_v2.sh"
-
-set -eu
-set -x
-
-export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-
-M=$1
-N=$2
-
-NODE=$6
-
-netjail_node_exec_without_fds_and_sudo $NODE $3 $4 $5 $1 $2
diff --git a/src/testing/netjail_start.sh b/src/testing/netjail_start.sh
index 0984a3c42..1dfe1dfdf 100755
--- a/src/testing/netjail_start.sh
+++ b/src/testing/netjail_start.sh
@@ -1,52 +1,74 @@
-#!/bin/sh
+#!/bin/bash
. "./../testing/netjail_core.sh"
+. "./../testing/topo.sh"
set -eu
set -x
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-LOCAL_M=$1
-GLOBAL_N=$2
+filename=$1
+PREFIX=$2
-# TODO: stunserver? ..and globally known peer?
+read_topology $filename
shift 2
LOCAL_GROUP="192.168.15"
GLOBAL_GROUP="92.68.150"
+KNOWN_GROUP="92.68.151"
-NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M)
-netjail_bridge $NETWORK_NET
+echo "Start [local: $LOCAL_GROUP.0/24, global: $GLOBAL_GROUP.0/16]"
-for N in $(seq $GLOBAL_N); do
- ROUTER=$(netjail_print_name "R" $N)
+netjail_bridge
+NETWORK_NET=$RESULT
- netjail_node $ROUTER
- netjail_node_link_bridge $ROUTER $NETWORK_NET "$GLOBAL_GROUP.$N" 24
+for X in $(seq $KNOWN); do
+ netjail_node
+ KNOWN_NODES[$X]=$RESULT
+ netjail_node_link_bridge ${KNOWN_NODES[$X]} $NETWORK_NET "$KNOWN_GROUP.$X" 16
+ KNOWN_LINKS[$X]=$RESULT
+done
- ROUTER_NET=$(netjail_print_name "r" $N)
+declare -A NODES
+declare -A NODE_LINKS
- netjail_bridge $ROUTER_NET
+for N in $(seq $GLOBAL_N); do
+ netjail_node
+ ROUTERS[$N]=$RESULT
+ netjail_node_link_bridge ${ROUTERS[$N]} $NETWORK_NET "$GLOBAL_GROUP.$N" 16
+ NETWORK_LINKS[$N]=$RESULT
+ netjail_bridge
+ ROUTER_NETS[$N]=$RESULT
for M in $(seq $LOCAL_M); do
- NODE=$(netjail_print_name "N" $N $M)
-
- netjail_node $NODE
- netjail_node_link_bridge $NODE $ROUTER_NET "$LOCAL_GROUP.$M" 24
+ netjail_node
+ NODES[$N,$M]=$RESULT
+ netjail_node_link_bridge ${NODES[$N,$M]} ${ROUTER_NETS[$N]} "$LOCAL_GROUP.$M" 24
+ NODE_LINKS[$N,$M]=$RESULT
done
ROUTER_ADDR="$LOCAL_GROUP.$(($LOCAL_M+1))"
-
- netjail_node_link_bridge $ROUTER $ROUTER_NET $ROUTER_ADDR 24
- netjail_node_add_nat $ROUTER $ROUTER_ADDR 24
+ netjail_node_link_bridge ${ROUTERS[$N]} ${ROUTER_NETS[$N]} $ROUTER_ADDR 24
+ ROUTER_LINKS[$N]=$RESULT
+
+ netjail_node_add_nat ${ROUTERS[$N]} $ROUTER_ADDR 24
for M in $(seq $LOCAL_M); do
- NODE=$(netjail_print_name "N" $N $M)
-
- netjail_node_add_default $NODE $ROUTER_ADDR
+ netjail_node_add_default ${NODES[$N,$M]} $ROUTER_ADDR
done
-done
-
+ # TODO Topology configuration must be enhanced to configure forwarding to more than one subnet node via different ports.
+
+ if [ "1" == "${R_TCP[$N]}" ]
+ then
+ ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p tcp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1
+ ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
+ fi
+ if [ "1" == "${R_UDP[$N]}" ]
+ then
+ ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p udp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1
+ ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
+ fi
+done
diff --git a/src/testing/netjail_start_v2.sh b/src/testing/netjail_start_v2.sh
deleted file mode 100755
index dd1f2ad93..000000000
--- a/src/testing/netjail_start_v2.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-. "./../testing/netjail_core_v2.sh"
-. "./../testing/topo.sh"
-
-set -eu
-set -x
-
-export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-
-filename=$1
-PREFIX=$2
-
-read_topology $filename
-
-shift 2
-
-LOCAL_GROUP="192.168.15"
-GLOBAL_GROUP="92.68.150"
-KNOWN_GROUP="92.68.151"
-
-
-echo "Start [local: $LOCAL_GROUP.0/24, global: $GLOBAL_GROUP.0/16]"
-
-netjail_bridge
-NETWORK_NET=$RESULT
-
-for X in $(seq $KNOWN); do
- netjail_node
- KNOWN_NODES[$X]=$RESULT
- netjail_node_link_bridge ${KNOWN_NODES[$X]} $NETWORK_NET "$KNOWN_GROUP.$X" 16
- KNOWN_LINKS[$X]=$RESULT
-done
-
-declare -A NODES
-declare -A NODE_LINKS
-
-for N in $(seq $GLOBAL_N); do
- netjail_node
- ROUTERS[$N]=$RESULT
- netjail_node_link_bridge ${ROUTERS[$N]} $NETWORK_NET "$GLOBAL_GROUP.$N" 16
- NETWORK_LINKS[$N]=$RESULT
- netjail_bridge
- ROUTER_NETS[$N]=$RESULT
-
- for M in $(seq $LOCAL_M); do
- netjail_node
- NODES[$N,$M]=$RESULT
- netjail_node_link_bridge ${NODES[$N,$M]} ${ROUTER_NETS[$N]} "$LOCAL_GROUP.$M" 24
- NODE_LINKS[$N,$M]=$RESULT
- done
-
- ROUTER_ADDR="$LOCAL_GROUP.$(($LOCAL_M+1))"
- netjail_node_link_bridge ${ROUTERS[$N]} ${ROUTER_NETS[$N]} $ROUTER_ADDR 24
- ROUTER_LINKS[$N]=$RESULT
-
- netjail_node_add_nat ${ROUTERS[$N]} $ROUTER_ADDR 24
-
- for M in $(seq $LOCAL_M); do
- netjail_node_add_default ${NODES[$N,$M]} $ROUTER_ADDR
- done
-
- # TODO Topology configuration must be enhanced to configure forwarding to more than one subnet node via different ports.
-
- if [ "1" == "${R_TCP[$N]}" ]
- then
- ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p tcp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1
- ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- fi
- if [ "1" == "${R_UDP[$N]}" ]
- then
- ip netns exec ${ROUTERS[$N]} iptables -t nat -A PREROUTING -p udp -d $GLOBAL_GROUP.$N --dport 60002 -j DNAT --to $LOCAL_GROUP.1
- ip netns exec ${ROUTERS[$N]} iptables -A FORWARD -d $LOCAL_GROUP.1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
- fi
-done
diff --git a/src/testing/netjail_stop.sh b/src/testing/netjail_stop.sh
index 08f68cf7f..abfaf3acf 100755
--- a/src/testing/netjail_stop.sh
+++ b/src/testing/netjail_stop.sh
@@ -1,24 +1,57 @@
-#!/bin/sh
+#!/bin/bash
. "./../testing/netjail_core.sh"
+. "./../testing/topo.sh"
set -eu
set -x
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-LOCAL_M=$1
-GLOBAL_N=$2
-NETWORK_NET=$(netjail_print_name "n" $GLOBAL_N $LOCAL_M)
+filename=$1
+PREFIX=$2
-shift 2
+read_topology $filename
+
+declare -A NODES
+declare -A NODE_LINKS
+
+netjail_bridge_name
+NETWORK_NET=$RESULT
+
+for X in $(seq $KNOWN); do
+ netjail_node_name
+ KNOWN_NODES[$X]=$RESULT
+ netjail_node_link_bridge_name
+ KNOWN_LINKS[$X]=$RESULT
+ netjail_node_unlink_bridge ${KNOWN_LINKS[$X]}
+ netjail_node_clear ${KNOWN_NODES[$X]}
+done
for N in $(seq $GLOBAL_N); do
+ netjail_node_name
+ ROUTERS[$N]=$RESULT
+ netjail_node_link_bridge_name
+ NETWORK_LINKS[$N]=$RESULT
+ netjail_bridge_name
+ ROUTER_NETS[$N]=$RESULT
+ netjail_node_link_bridge_name
+ ROUTER_LINKS[$N]=$RESULT
+
+ netjail_node_unlink_bridge ${ROUTER_LINKS[$N]}
+
for M in $(seq $LOCAL_M); do
- netjail_node_clear $(netjail_print_name "N" $N $M)
+ netjail_node_name
+ NODES[$N,$M]=$RESULT
+ netjail_node_link_bridge_name
+ NODE_LINKS[$N,$M]=$RESULT
+ netjail_node_unlink_bridge ${NODE_LINKS[$N,$M]}
+ netjail_node_clear ${NODES[$N,$M]}
done
+
- netjail_bridge_clear $(netjail_print_name "r" $N)
- netjail_node_clear $(netjail_print_name "R" $N)
+ netjail_bridge_clear ${ROUTER_NETS[$N]}
+ netjail_node_unlink_bridge ${NETWORK_LINKS[$N]}
+ netjail_node_clear ${ROUTERS[$N]}
done
netjail_bridge_clear $NETWORK_NET
diff --git a/src/testing/netjail_stop_v2.sh b/src/testing/netjail_stop_v2.sh
deleted file mode 100755
index 6e9fd1ccc..000000000
--- a/src/testing/netjail_stop_v2.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-. "./../testing/netjail_core_v2.sh"
-. "./../testing/topo.sh"
-
-set -eu
-set -x
-
-export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
-
-filename=$1
-PREFIX=$2
-
-read_topology $filename
-
-declare -A NODES
-declare -A NODE_LINKS
-
-netjail_bridge_name
-NETWORK_NET=$RESULT
-
-for X in $(seq $KNOWN); do
- netjail_node_name
- KNOWN_NODES[$X]=$RESULT
- netjail_node_link_bridge_name
- KNOWN_LINKS[$X]=$RESULT
- netjail_node_unlink_bridge ${KNOWN_LINKS[$X]}
- netjail_node_clear ${KNOWN_NODES[$X]}
-done
-
-for N in $(seq $GLOBAL_N); do
- netjail_node_name
- ROUTERS[$N]=$RESULT
- netjail_node_link_bridge_name
- NETWORK_LINKS[$N]=$RESULT
- netjail_bridge_name
- ROUTER_NETS[$N]=$RESULT
- netjail_node_link_bridge_name
- ROUTER_LINKS[$N]=$RESULT
-
- netjail_node_unlink_bridge ${ROUTER_LINKS[$N]}
-
- for M in $(seq $LOCAL_M); do
- netjail_node_name
- NODES[$N,$M]=$RESULT
- netjail_node_link_bridge_name
- NODE_LINKS[$N,$M]=$RESULT
- netjail_node_unlink_bridge ${NODE_LINKS[$N,$M]}
- netjail_node_clear ${NODES[$N,$M]}
- done
-
-
- netjail_bridge_clear ${ROUTER_NETS[$N]}
- netjail_node_unlink_bridge ${NETWORK_LINKS[$N]}
- netjail_node_clear ${ROUTERS[$N]}
-done
-
-netjail_bridge_clear $NETWORK_NET
-
-echo "Done"
diff --git a/src/testing/test_testing_plugin_testcmd.c b/src/testing/test_testing_plugin_testcmd.c
index 444272fcd..32e2b38a7 100644
--- a/src/testing/test_testing_plugin_testcmd.c
+++ b/src/testing/test_testing_plugin_testcmd.c
@@ -17,11 +17,12 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
-
/**
* @file testbed/plugin_testcmd.c
* @brief a plugin to provide the API for running test cases.
* @author t3sserakt
+ *
+ * // FIXME: too verbose, no logic to return final status, will segv!
*/
#include "platform.h"
#include "gnunet_testing_ng_lib.h"
@@ -33,8 +34,11 @@
*/
#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
+
+// FIXME: bad global!
unsigned int are_all_peers_started;
+
static void
all_peers_started ()
{
@@ -44,8 +48,10 @@ all_peers_started ()
are_all_peers_started);
}
+
static void
-start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
+start_testcase (TESTING_CMD_HELPER_write_cb write_message,
+ char *router_ip,
char *node_ip,
char *n,
char *m,
@@ -70,9 +76,10 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
write_message)
};
- GNUNET_TESTING_run (NULL,
- commands,
- GNUNET_TIME_UNIT_FOREVER_REL);
+ GNUNET_TESTING_run (commands,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL, /* FIXME: pass continuation! */
+ NULL);
LOG (GNUNET_ERROR_TYPE_ERROR,
"We got here 7!\n");
@@ -113,4 +120,4 @@ libgnunet_plugin_testcmd_done (void *cls)
}
-/* end of plugin_testcmd.c */
+
diff --git a/src/testing/testing.c b/src/testing/testing.c
index a11d404a5..766c7b084 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -34,6 +34,7 @@
#include "gnunet_arm_service.h"
#include "gnunet_testing_lib.h"
#include "gnunet_testing_ng_lib.h"
+#include "testing_cmds.h"
#define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
@@ -1961,10 +1962,6 @@ get_connect_value (char *line, struct GNUNET_TESTING_NetjailNode *node)
}
GNUNET_free (copy);
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "address_prefix %s\n",
- prefix->address_prefix);
-
return node_connection;
}
@@ -2007,6 +2004,31 @@ node_connections (char *line, struct GNUNET_TESTING_NetjailNode *node)
/**
+ * Create a GNUNET_CMDS_LOCAL_FINISHED message.
+ *
+ * @param rv The result of the local test as GNUNET_GenericReturnValue.
+ * @return The GNUNET_CMDS_LOCAL_FINISHED message.
+*/
+struct GNUNET_MessageHeader *
+GNUNET_TESTING_send_local_test_finished_msg (enum GNUNET_GenericReturnValue rv)
+{
+ struct GNUNET_CMDS_LOCAL_FINISHED *reply;
+ size_t msg_length;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Local test exits with status %d\n",
+ rv);
+ msg_length = sizeof(struct GNUNET_CMDS_LOCAL_FINISHED);
+ reply = GNUNET_new (struct GNUNET_CMDS_LOCAL_FINISHED);
+ reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED);
+ reply->header.size = htons ((uint16_t) msg_length);
+ reply->result = htons (rv);
+
+ return (struct GNUNET_MessageHeader *) reply;
+}
+
+
+/**
* Getting the topology from file.
*
* @param filename The name of the topology file.
diff --git a/src/testing/testing.h b/src/testing/testing.h
index b12466530..8aba09e4b 100644
--- a/src/testing/testing.h
+++ b/src/testing/testing.h
@@ -21,54 +21,54 @@
/**
* @author t3sserakt
*/
-
+#ifndef TESTING_H
+#define TESTING_H
#include "gnunet_util_lib.h"
+
+/**
+ * Advance internal pointer to next command.
+ *
+ * @param cls batch internal state
+ * @return true if we could advance, false if the batch
+ * has completed and cannot advance anymore
+ */
+bool
+GNUNET_TESTING_cmd_batch_next_ (void *cls);
+
+
+/**
+ * Test if this command is a batch command.
+ *
+ * @return false if not, true if it is a batch command
+ */
+bool
+GNUNET_TESTING_cmd_is_batch_ (const struct GNUNET_TESTING_Command *cmd);
+
+
+/**
+ * Obtain what command the batch is at.
+ *
+ * @return cmd current batch command
+ */
+struct GNUNET_TESTING_Command *
+GNUNET_TESTING_cmd_batch_get_current_ (const struct GNUNET_TESTING_Command *cmd);
+
+
/**
- * Global state of the interpreter, used by a command
- * to access information about other commands.
+ * Set what command the batch should be at. Needed for
+ * loops. We may want to change this to take a label
+ * and/or expose it in the public API in the future.
+ * Not used for now.
+ *
+ * @param cmd current batch command
+ * @param new_ip where to move the IP
*/
-// SUGGESTION: consider making this struct opaque (only known inside of libgnunettesting,
-// say main loop and a few select commands, like next/fail/batch); + helper
-// function to access 'cfg'?
-struct GNUNET_TESTING_Interpreter
-{
-
- /**
- * Commands the interpreter will run.
- */
- struct GNUNET_TESTING_Command *commands;
-
- /**
- * Interpreter task (if one is scheduled).
- */
- struct GNUNET_SCHEDULER_Task *task;
-
- /**
- * Finish task of a blocking call to a commands finish method.
- */
- struct GNUNET_SCHEDULER_Task *finish_task;
-
- /**
- * Our configuration.
- */
- const struct GNUNET_CONFIGURATION_Handle *cfg;
-
- /**
- * Task run on timeout.
- */
- struct GNUNET_SCHEDULER_Task *timeout_task;
-
- /**
- * Instruction pointer. Tells #interpreter_run() which instruction to run
- * next. Need (signed) int because it gets -1 when rewinding the
- * interpreter to the first CMD.
- */
- int ip;
-
- /**
- * Result of the testcases, #GNUNET_OK on success
- */
- int result;
-
-};
+void
+GNUNET_TESTING_cmd_batch_set_current_ (const struct GNUNET_TESTING_Command *cmd,
+ unsigned int new_ip);
+
+
+
+
+#endif
diff --git a/src/testing/testing_api_cmd_batch.c b/src/testing/testing_api_cmd_batch.c
index af260f80d..080a4880d 100644
--- a/src/testing/testing_api_cmd_batch.c
+++ b/src/testing/testing_api_cmd_batch.c
@@ -39,6 +39,11 @@ struct BatchState
struct GNUNET_TESTING_Command *batch;
/**
+ * Our label.
+ */
+ const char *label;
+
+ /**
* Internal command pointer.
*/
unsigned int batch_ip;
@@ -49,12 +54,10 @@ struct BatchState
* Run the command.
*
* @param cls closure.
- * @param cmd the command being executed.
* @param is the interpreter state.
*/
static void
batch_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct BatchState *bs = cls;
@@ -69,7 +72,7 @@ batch_run (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Exiting from batch: %s\n",
- cmd->label);
+ bs->label);
return;
}
bs->batch[bs->batch_ip].start_time
@@ -77,7 +80,6 @@ batch_run (void *cls,
= GNUNET_TIME_absolute_get ();
bs->batch[bs->batch_ip].num_tries = 1;
bs->batch[bs->batch_ip].run (bs->batch[bs->batch_ip].cls,
- &bs->batch[bs->batch_ip],
is);
}
@@ -87,20 +89,16 @@ batch_run (void *cls,
* cancel a pending operation thereof.
*
* @param cls closure.
- * @param cmd the command which is being cleaned up.
*/
static void
-batch_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+batch_cleanup (void *cls)
{
struct BatchState *bs = cls;
- (void) cmd;
for (unsigned int i = 0;
NULL != bs->batch[i].label;
i++)
- bs->batch[i].cleanup (bs->batch[i].cls,
- &bs->batch[i]);
+ bs->batch[i].cleanup (bs->batch[i].cls);
GNUNET_free (bs->batch);
GNUNET_free (bs);
}
@@ -115,22 +113,21 @@ batch_cleanup (void *cls,
* @param index index number of the object to offer.
* @return #GNUNET_OK on success.
*/
-static int
+static enum GNUNET_GenericReturnValue
batch_traits (void *cls,
const void **ret,
const char *trait,
unsigned int index)
{
+ struct BatchState *bs = cls;
+ // FIXME: these constants should be more global!
#define CURRENT_CMD_INDEX 0
#define BATCH_INDEX 1
-
- struct BatchState *bs = cls;
-
struct GNUNET_TESTING_Trait traits[] = {
- GNUNET_TESTING_make_trait_cmd
- (CURRENT_CMD_INDEX, &bs->batch[bs->batch_ip]),
- GNUNET_TESTING_make_trait_cmd
- (BATCH_INDEX, bs->batch),
+ GNUNET_TESTING_make_trait_cmd (CURRENT_CMD_INDEX,
+ &bs->batch[bs->batch_ip]),
+ GNUNET_TESTING_make_trait_cmd (BATCH_INDEX,
+ bs->batch),
GNUNET_TESTING_trait_end ()
};
@@ -162,7 +159,7 @@ GNUNET_TESTING_cmd_batch (const char *label,
unsigned int i;
bs = GNUNET_new (struct BatchState);
-
+ bs->label = label;
/* Get number of commands. */
for (i = 0; NULL != batch[i].label; i++)
/* noop */
@@ -187,68 +184,45 @@ GNUNET_TESTING_cmd_batch (const char *label,
}
-/**
- * Advance internal pointer to next command.
- *
- * @param is interpreter state.
- */
-void
-GNUNET_TESTING_cmd_batch_next (struct GNUNET_TESTING_Interpreter *is)
+bool
+GNUNET_TESTING_cmd_batch_next_ (void *cls)
{
- struct BatchState *bs = is->commands[is->ip].cls;
+ struct BatchState *bs = cls;
if (NULL == bs->batch[bs->batch_ip].label)
- {
- is->commands[is->ip].finish_time = GNUNET_TIME_absolute_get ();
- is->ip++;
- return;
- }
- bs->batch[bs->batch_ip].finish_time = GNUNET_TIME_absolute_get ();
+ return false;
+ bs->batch[bs->batch_ip].finish_time
+ = GNUNET_TIME_absolute_get ();
bs->batch_ip++;
+ return true;
}
-/**
- * Test if this command is a batch command.
- *
- * @return false if not, true if it is a batch command
- */
-int
-GNUNET_TESTING_cmd_is_batch (const struct GNUNET_TESTING_Command *cmd)
+bool
+GNUNET_TESTING_cmd_is_batch_ (const struct GNUNET_TESTING_Command *cmd)
{
return cmd->run == &batch_run;
}
-/**
- * Obtain what command the batch is at.
- *
- * @return cmd current batch command
- */
struct GNUNET_TESTING_Command *
-GNUNET_TESTING_cmd_batch_get_current (const struct GNUNET_TESTING_Command *cmd)
+GNUNET_TESTING_cmd_batch_get_current_ (const struct GNUNET_TESTING_Command *cmd)
{
struct BatchState *bs = cmd->cls;
- GNUNET_assert (cmd->run == &batch_run);
+ GNUNET_assert (GNUNET_TESTING_cmd_is_batch_ (cmd));
return &bs->batch[bs->batch_ip];
}
-/**
- * Set what command the batch should be at.
- *
- * @param cmd current batch command
- * @param new_ip where to move the IP
- */
void
-GNUNET_TESTING_cmd_batch_set_current (const struct GNUNET_TESTING_Command *cmd,
- unsigned int new_ip)
+GNUNET_TESTING_cmd_batch_set_current_ (const struct GNUNET_TESTING_Command *cmd,
+ unsigned int new_ip)
{
struct BatchState *bs = cmd->cls;
/* sanity checks */
- GNUNET_assert (cmd->run == &batch_run);
+ GNUNET_assert (GNUNET_TESTING_cmd_is_batch_ (cmd));
for (unsigned int i = 0; i < new_ip; i++)
GNUNET_assert (NULL != bs->batch[i].label);
/* actual logic */
diff --git a/src/testing/testing_api_cmd_block_until_all_peers_started.c b/src/testing/testing_api_cmd_block_until_all_peers_started.c
index e9d3f0ed3..763713e15 100644
--- a/src/testing/testing_api_cmd_block_until_all_peers_started.c
+++ b/src/testing/testing_api_cmd_block_until_all_peers_started.c
@@ -39,6 +39,11 @@
struct BlockState
{
/**
+ * Context for our asynchronous completion.
+ */
+ struct GNUNET_TESTING_AsyncContext ac;
+
+ /**
* Flag to indicate if all peers have started.
*
*/
@@ -47,26 +52,11 @@ struct BlockState
/**
- * Trait function of this cmd does nothing.
- *
- */
-static int
-block_until_all_peers_started_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- return GNUNET_OK;
-}
-
-
-/**
* The cleanup function of this cmd frees resources the cmd allocated.
*
*/
static void
-block_until_all_peers_started_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+block_until_all_peers_started_cleanup (void *cls)
{
struct BlockState *bs = cls;
@@ -80,7 +70,6 @@ block_until_all_peers_started_cleanup (void *cls,
*/
static void
block_until_all_peers_started_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -89,27 +78,6 @@ block_until_all_peers_started_run (void *cls,
/**
- * Function to check if BlockState#all_peers_started is GNUNET_YES. In that case interpreter_next will be called.
- *
- */
-static int
-block_until_all_peers_started_finish (void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls)
-{
- struct BlockState *bs = cls;
- unsigned int *ret = bs->all_peers_started;
-
- if (GNUNET_YES == *ret)
- {
- cont (cont_cls);
- }
-
- return *ret;
-}
-
-
-/**
* Create command.
*
* @param label name for command.
@@ -125,15 +93,15 @@ GNUNET_TESTING_cmd_block_until_all_peers_started (const char *label,
bs = GNUNET_new (struct BlockState);
bs->all_peers_started = all_peers_started;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = bs,
- .label = label,
- .run = &block_until_all_peers_started_run,
- .finish = &block_until_all_peers_started_finish,
- .cleanup = &block_until_all_peers_started_cleanup,
- .traits = &block_until_all_peers_started_traits
- };
-
- return cmd;
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = bs,
+ .label = label,
+ .run = &block_until_all_peers_started_run,
+ .ac = &bs->ac,
+ .cleanup = &block_until_all_peers_started_cleanup
+ };
+
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_cmd_block_until_external_trigger.c b/src/testing/testing_api_cmd_block_until_external_trigger.c
index 2439afeaf..aeb9ffda3 100644
--- a/src/testing/testing_api_cmd_block_until_external_trigger.c
+++ b/src/testing/testing_api_cmd_block_until_external_trigger.c
@@ -39,25 +39,15 @@
struct BlockState
{
/**
- * Flag to indicate if all peers have started.
- *
+ * Context for our asynchronous completion.
*/
- unsigned int *stop_blocking;
-};
-
+ struct GNUNET_TESTING_AsyncContext ac;
-/**
- * Trait function of this cmd does nothing.
- *
- */
-static int
-block_until_all_peers_started_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- return GNUNET_OK;
-}
+ /**
+ * The label of this command.
+ */
+ const char *label;
+};
/**
@@ -65,47 +55,68 @@ block_until_all_peers_started_traits (void *cls,
*
*/
static void
-block_until_all_peers_started_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+block_until_all_peers_started_cleanup (void *cls)
{
struct BlockState *bs = cls;
GNUNET_free (bs);
}
+static int
+block_until_external_trigger_traits (void *cls,
+ const void **ret,
+ const char *trait,
+ unsigned int index)
+{
+ struct BlockState *bs = cls;
+ struct GNUNET_TESTING_AsyncContext *ac = &bs->ac;
+ struct GNUNET_TESTING_Trait traits[] = {
+ {
+ .index = 0,
+ .trait_name = "async_context",
+ .ptr = (const void *) ac,
+ },
+ GNUNET_TESTING_trait_end ()
+ };
+
+ return GNUNET_TESTING_get_trait (traits,
+ ret,
+ trait,
+ index);
+}
+
/**
- * This function does nothing but to start the cmd.
+ * Function to get the trait with the async context.
*
+ * @param[out] ac GNUNET_TESTING_AsyncContext.
+ * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
*/
-static void
-block_until_all_peers_started_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
- struct GNUNET_TESTING_Interpreter *is)
+int
+GNUNET_TESTING_get_trait_async_context (
+ const struct GNUNET_TESTING_Command *cmd,
+ struct GNUNET_TESTING_AsyncContext **ac)
{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "block_until_all_peers_started_run!\n");
+ return cmd->traits (cmd->cls,
+ (const void **) ac,
+ "async_context",
+ (unsigned int) 0);
}
/**
- * Function to check if BlockState#all_peers_started is GNUNET_YES. In that case interpreter_next will be called.
+ * This function does nothing but to start the cmd.
*
*/
-static int
-block_until_all_peers_started_finish (void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls)
+static void
+block_until_all_peers_started_run (void *cls,
+ struct GNUNET_TESTING_Interpreter *is)
{
struct BlockState *bs = cls;
- unsigned int *ret = bs->stop_blocking;
- if (GNUNET_YES == *ret)
- {
- cont (cont_cls);
- }
-
- return *ret;
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "block %s running!\n",
+ bs->label);
}
@@ -117,23 +128,22 @@ block_until_all_peers_started_finish (void *cls,
* @return command.
*/
struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_block_until_external_trigger (const char *label,
- unsigned int *
- stop_blocking)
+GNUNET_TESTING_cmd_block_until_external_trigger (const char *label)
{
struct BlockState *bs;
bs = GNUNET_new (struct BlockState);
- bs->stop_blocking = stop_blocking;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = bs,
- .label = label,
- .run = &block_until_all_peers_started_run,
- .finish = &block_until_all_peers_started_finish,
- .cleanup = &block_until_all_peers_started_cleanup,
- .traits = &block_until_all_peers_started_traits
- };
-
- return cmd;
+ bs->label = label;
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = bs,
+ .label = label,
+ .run = &block_until_all_peers_started_run,
+ .ac = &bs->ac,
+ .cleanup = &block_until_all_peers_started_cleanup,
+ .traits = block_until_external_trigger_traits
+ };
+
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_cmd_end.c b/src/testing/testing_api_cmd_end.c
new file mode 100644
index 000000000..f0f036429
--- /dev/null
+++ b/src/testing/testing_api_cmd_end.c
@@ -0,0 +1,39 @@
+/*
+ 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
+ */
+/**
+ * @file testing/testing_api_cmd_end.c
+ * @brief command to end a command array
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_ng_lib.h"
+
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_end (void)
+{
+ static struct GNUNET_TESTING_Command cmd = {
+ .label = NULL
+ };
+
+ return cmd;
+}
+
+
diff --git a/src/testing/testing_api_cmd_finish.c b/src/testing/testing_api_cmd_finish.c
new file mode 100644
index 000000000..3ac0871a5
--- /dev/null
+++ b/src/testing/testing_api_cmd_finish.c
@@ -0,0 +1,198 @@
+/*
+ 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
+ */
+/**
+ * @file testing/testing_api_cmd_finish.c
+ * @brief command to wait for completion of async command
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_ng_lib.h"
+
+/**
+ * Struct to use for command-specific context information closure of a command waiting
+ * for another command.
+ */
+struct FinishState
+{
+ /**
+ * Closure for all commands with command-specific context information.
+ */
+ void *cls;
+
+ /**
+ * Label of the asynchronous command the synchronous command of this closure waits for.
+ */
+ const char *async_label;
+
+ /**
+ * Task for running the finish method of the asynchronous task the command is waiting for.
+ */
+ struct GNUNET_SCHEDULER_Task *finish_task;
+
+ /**
+ * Function to call when done.
+ */
+ struct GNUNET_TESTING_AsyncContext ac;
+
+ /**
+ * How long to wait until finish fails hard?
+ */
+ struct GNUNET_TIME_Relative timeout;
+
+};
+
+
+/**
+ * Function called when the command we are waiting on
+ * is finished. Hence we are finished, too.
+ *
+ * @param cls a `struct FinishState` being notified
+ */
+static void
+done_finish (void *cls)
+{
+ struct FinishState *finish_state = cls;
+
+ GNUNET_SCHEDULER_cancel (finish_state->finish_task);
+ finish_state->finish_task = NULL;
+ GNUNET_TESTING_async_finish (&finish_state->ac);
+}
+
+
+/**
+ * Function triggered if the command we are waiting
+ * for did not complete on time.
+ *
+ * @param cls our `struct FinishState`
+ */
+static void
+timeout_finish (void *cls)
+{
+ struct FinishState *finish_state = cls;
+
+ finish_state->finish_task = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Timeout waiting for command `%s' to finish\n",
+ finish_state->async_label);
+ GNUNET_TESTING_async_fail (&finish_state->ac);
+}
+
+
+/**
+ * Run method of the command created by the interpreter to wait for another
+ * command to finish.
+ *
+ */
+static void
+run_finish (void *cls,
+ struct GNUNET_TESTING_Interpreter *is)
+{
+ struct FinishState *finish_state = cls;
+ const struct GNUNET_TESTING_Command *async_cmd;
+ struct GNUNET_TESTING_AsyncContext *aac;
+
+ async_cmd
+ = GNUNET_TESTING_interpreter_lookup_command (is,
+ finish_state->async_label);
+ if (NULL == async_cmd)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Did not find command `%s'\n",
+ finish_state->async_label);
+ GNUNET_TESTING_interpreter_fail (is);
+ return;
+ }
+ if ( (NULL == (aac = async_cmd->ac)) ||
+ (! async_cmd->asynchronous_finish) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Cannot finish `%s': not asynchronous\n",
+ finish_state->async_label);
+ GNUNET_TESTING_interpreter_fail (is);
+ return;
+ }
+ if (GNUNET_NO != aac->finished)
+ {
+ /* Command is already finished, so are we! */
+ GNUNET_TESTING_async_finish (&finish_state->ac);
+ return;
+ }
+ finish_state->finish_task
+ = GNUNET_SCHEDULER_add_delayed (finish_state->timeout,
+ &timeout_finish,
+ finish_state);
+ aac->cont = &done_finish;
+ aac->cont_cls = finish_state;
+}
+
+
+/**
+ * Cleanup state of a finish command.
+ *
+ * @param cls a `struct FinishState` to clean up
+ */
+static void
+cleanup_finish (void *cls)
+{
+ struct FinishState *finish_state = cls;
+
+ if (NULL != finish_state->finish_task)
+ {
+ GNUNET_SCHEDULER_cancel (finish_state->finish_task);
+ finish_state->finish_task = NULL;
+ }
+ GNUNET_free (finish_state);
+}
+
+
+const struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_finish (const char *finish_label,
+ const char *cmd_ref,
+ struct GNUNET_TIME_Relative timeout)
+{
+ struct FinishState *finish_state;
+
+ finish_state = GNUNET_new (struct FinishState);
+ finish_state->async_label = cmd_ref;
+ finish_state->timeout = timeout;
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = finish_state,
+ .label = finish_label,
+ .run = &run_finish,
+ .ac = &finish_state->ac,
+ .cleanup = &cleanup_finish
+ };
+
+ return cmd;
+ }
+}
+
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTING_cmd_make_unblocking (struct GNUNET_TESTING_Command cmd)
+{
+ /* do not permit this function to be used on
+ a finish command! */
+ GNUNET_assert (cmd.run != &run_finish);
+ cmd.asynchronous_finish = true;
+ return cmd;
+}
diff --git a/src/testing/testing_api_cmd_hello_world.c b/src/testing/testing_api_cmd_hello_world.c
index 4347ac818..73dcd6dff 100644
--- a/src/testing/testing_api_cmd_hello_world.c
+++ b/src/testing/testing_api_cmd_hello_world.c
@@ -32,50 +32,51 @@ struct HelloWorldState
const char *birthLabel;
};
+
/**
-*
-*
-* @param cls closure
-* @param cmd current CMD being cleaned up.
-*/
+ *
+ *
+ * @param cls closure
+ */
static void
-hello_world_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+hello_world_cleanup (void *cls)
{
struct HelloWorldState *hs = cls;
+
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Cleaning up message %s\n",
hs->message);
+ GNUNET_free (hs);
}
+
/**
-*
-*
-* @param cls closure.
-* @param[out] ret result
-* @param trait name of the trait.
-* @param index index number of the object to offer.
-* @return #GNUNET_OK on success.
-*/
-static int
+ *
+ *
+ * @param cls closure.
+ * @param[out] ret result
+ * @param trait name of the trait.
+ * @param index index number of the object to offer.
+ * @return #GNUNET_OK on success.
+ */
+static enum GNUNET_GenericReturnValue
hello_world_traits (void *cls,
const void **ret,
const char *trait,
unsigned int index)
{
- return GNUNET_OK;
+ return GNUNET_NO;
}
+
/**
* Run the "hello world" CMD.
*
* @param cls closure.
-* @param cmd CMD being run.
* @param is interpreter state.
*/
static void
hello_world_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct HelloWorldState *hs = cls;
@@ -84,13 +85,16 @@ hello_world_run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"%s\n",
hs->message);
- birth_cmd = GNUNET_TESTING_interpreter_lookup_command (hs->birthLabel);
- GNUNET_TESTING_get_trait_what_am_i (birth_cmd, &hs->message);
+ birth_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
+ hs->birthLabel);
+ GNUNET_TESTING_get_trait_what_am_i (birth_cmd,
+ &hs->message);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Now I am a %s\n",
hs->message);
}
+
/**
* Create command.
*
@@ -108,14 +112,15 @@ GNUNET_TESTING_cmd_hello_world (const char *label,
hs = GNUNET_new (struct HelloWorldState);
hs->message = "Hello World, I was nobody!";
hs->birthLabel = birthLabel;
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = hs,
+ .label = label,
+ .run = &hello_world_run,
+ .cleanup = &hello_world_cleanup,
+ .traits = &hello_world_traits
+ };
- struct GNUNET_TESTING_Command cmd = {
- .cls = hs,
- .label = label,
- .run = &hello_world_run,
- .cleanup = &hello_world_cleanup,
- .traits = &hello_world_traits
- };
-
- return cmd;
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_cmd_hello_world_birth.c b/src/testing/testing_api_cmd_hello_world_birth.c
index 9d60059a5..8415b99f0 100644
--- a/src/testing/testing_api_cmd_hello_world_birth.c
+++ b/src/testing/testing_api_cmd_hello_world_birth.c
@@ -40,8 +40,7 @@ struct HelloWorldBirthState
* @param cmd current CMD being cleaned up.
*/
static void
-hello_world_birth_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+hello_world_birth_cleanup (void *cls)
{
struct HelloWorldBirthState *hbs = cls;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -49,6 +48,7 @@ hello_world_birth_cleanup (void *cls,
hbs->what_am_i);
}
+
/**
*
*
@@ -82,6 +82,7 @@ hello_world_birth_traits (void *cls,
index);
}
+
/**
* Run the "hello world" CMD.
*
@@ -91,14 +92,13 @@ hello_world_birth_traits (void *cls,
*/
static void
hello_world_birth_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct HelloWorldBirthState *hbs = cls;
struct GNUNET_TIME_Relative relative;
relative = GNUNET_TIME_absolute_get_difference (*hbs->date,
- GNUNET_TIME_absolute_get ());
+ GNUNET_TIME_absolute_get ());
if (0 == relative.rel_value_us % 10)
{
@@ -114,6 +114,7 @@ hello_world_birth_run (void *cls,
}
}
+
/**
* Offer data from trait
*
@@ -131,6 +132,7 @@ GNUNET_TESTING_get_trait_what_am_i (const struct GNUNET_TESTING_Command *cmd,
(unsigned int) 0);
}
+
/**
* Create command.
*
diff --git a/src/testing/testing_api_cmd_local_test_finished.c b/src/testing/testing_api_cmd_local_test_finished.c
index 383de4c10..0e7e214dc 100644
--- a/src/testing/testing_api_cmd_local_test_finished.c
+++ b/src/testing/testing_api_cmd_local_test_finished.c
@@ -19,7 +19,7 @@
*/
/**
- * @file testing_api_cmd_block_until_all_peers_started.c
+ * @file testing_api_cmd_local_test_finished.c
* @brief cmd to block the interpreter loop until all peers started.
* @author t3sserakt
*/
@@ -40,6 +40,7 @@
*/
struct LocalFinishedState
{
+
/**
* Callback to write messages to the master loop.
*
@@ -55,26 +56,11 @@ struct LocalFinishedState
/**
- * Trait function of this cmd does nothing.
- *
- */
-static int
-local_test_finished_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- return GNUNET_OK;
-}
-
-
-/**
* The cleanup function of this cmd frees resources the cmd allocated.
*
*/
static void
-local_test_finished_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+local_test_finished_cleanup (void *cls)
{
struct LocalFinishedState *lfs = cls;
@@ -89,11 +75,9 @@ local_test_finished_cleanup (void *cls,
*/
static void
local_test_finished_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct LocalFinishedState *lfs = cls;
-
struct GNUNET_CMDS_LOCAL_FINISHED *reply;
size_t msg_length;
@@ -102,22 +86,8 @@ local_test_finished_run (void *cls,
reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED);
reply->header.size = htons ((uint16_t) msg_length);
lfs->reply = reply;
- lfs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
-}
-
-
-/**
- * This finish function will stop the local loop without shutting down the scheduler, because we do not call the continuation, which is the interpreter_next method.
- *
- */
-static int
-local_test_finished_finish (void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls)
-{
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Stopping local loop\n");
- return GNUNET_YES;
+ lfs->write_message ((struct GNUNET_MessageHeader *) reply,
+ msg_length);
}
@@ -129,23 +99,22 @@ local_test_finished_finish (void *cls,
* @return command.
*/
struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_local_test_finished (const char *label,
- TESTING_CMD_HELPER_write_cb
- write_message)
+GNUNET_TESTING_cmd_local_test_finished (
+ const char *label,
+ TESTING_CMD_HELPER_write_cb write_message)
{
struct LocalFinishedState *lfs;
lfs = GNUNET_new (struct LocalFinishedState);
lfs->write_message = write_message;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = lfs,
- .label = label,
- .run = &local_test_finished_run,
- .finish = &local_test_finished_finish,
- .cleanup = &local_test_finished_cleanup,
- .traits = &local_test_finished_traits
- };
-
- return cmd;
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = lfs,
+ .label = label,
+ .run = &local_test_finished_run,
+ .cleanup = &local_test_finished_cleanup,
+ };
+
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_cmd_netjail_start.c b/src/testing/testing_api_cmd_netjail_start.c
index 536b356a6..35fb90f3c 100644
--- a/src/testing/testing_api_cmd_netjail_start.c
+++ b/src/testing/testing_api_cmd_netjail_start.c
@@ -19,7 +19,7 @@
*/
/**
- * @file testing/testing_api_cmd_hello_world.c
+ * @file testing/testing_api_cmd_netjail_start.c
* @brief Command to start the netjail script.
* @author t3sserakt
*/
@@ -35,22 +35,24 @@
*/
struct NetJailState
{
+ /**
+ * Context for our asynchronous completion.
+ */
+ struct GNUNET_TESTING_AsyncContext ac;
+
// Child Wait handle
struct GNUNET_ChildWaitHandle *cwh;
- // Number of local nodes in each namespace.
- char *local_m;
-
- // The number of namespaces.
- char *global_n;
-
/**
* The process id of the start script.
*/
struct GNUNET_OS_Process *start_proc;
- // Flag indication if the script finished.
- unsigned int finished;
+ /**
+ * Configuration file for the test topology.
+ */
+ char *topology_config;
+
};
@@ -59,8 +61,7 @@ struct NetJailState
*
*/
static void
-netjail_start_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+netjail_start_cleanup (void *cls)
{
struct NetJailState *ns = cls;
@@ -87,20 +88,6 @@ netjail_start_cleanup (void *cls,
/**
- * Trait function of this cmd does nothing.
- *
- */
-static int
-netjail_start_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- return GNUNET_OK;
-}
-
-
-/**
* Callback which will be called if the setup script finished.
*
*/
@@ -111,40 +98,40 @@ child_completed_callback (void *cls,
{
struct NetJailState *ns = cls;
+ GNUNET_OS_process_destroy (ns->start_proc);
+ ns->start_proc = NULL;
if (0 == exit_code)
{
- ns->finished = GNUNET_YES;
+ GNUNET_TESTING_async_finish (&ns->ac);
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Child completed with an error!\n");
- ns->finished = GNUNET_SYSERR;
+ "Child failed with error %lu!\n",
+ exit_code);
+ GNUNET_TESTING_async_fail (&ns->ac);
}
- GNUNET_OS_process_destroy (ns->start_proc);
- ns->start_proc = NULL;
}
-
/**
* The run method starts the script which setup the network namespaces.
*
* @param cls closure.
-* @param cmd CMD being run.
* @param is interpreter state.
*/
static void
netjail_start_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct NetJailState *ns = cls;
- char *const script_argv[] = {NETJAIL_START_SCRIPT,
- ns->local_m,
- ns->global_n,
- NULL};
- unsigned int helper_check = GNUNET_OS_check_helper_binary (
+ char pid[15];
+ enum GNUNET_GenericReturnValue helper_check;
+
+ // FIXME: NETJAIL_START_SCRIPT like this is bad,
+ // use location from share/gnunet/ of installed
+ // binary in case libgnunettesting is used as a lib!
+ helper_check = GNUNET_OS_check_helper_binary (
NETJAIL_START_SCRIPT,
GNUNET_YES,
NULL);
@@ -154,23 +141,38 @@ netjail_start_run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No SUID for %s!\n",
NETJAIL_START_SCRIPT);
- GNUNET_TESTING_interpreter_fail ();
+ GNUNET_TESTING_interpreter_fail (is);
+ return;
}
- else if (GNUNET_NO == helper_check)
+ if (GNUNET_SYSERR == helper_check)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%s not found!\n",
NETJAIL_START_SCRIPT);
- GNUNET_TESTING_interpreter_fail ();
+ GNUNET_TESTING_interpreter_fail (is);
+ return;
}
- ns->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
- NULL,
- NULL,
- NULL,
- NETJAIL_START_SCRIPT,
- script_argv);
-
+ GNUNET_snprintf (pid,
+ sizeof (pid),
+ "%u",
+ getpid ());
+ {
+ char *const script_argv[] = {
+ NETJAIL_START_SCRIPT,
+ ns->topology_config,
+ pid,
+ NULL
+ };
+
+ ns->start_proc
+ = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
+ NULL,
+ NULL,
+ NULL,
+ NETJAIL_START_SCRIPT,
+ script_argv);
+ }
ns->cwh = GNUNET_wait_child (ns->start_proc,
&child_completed_callback,
ns);
@@ -179,51 +181,29 @@ netjail_start_run (void *cls,
/**
- * This function checks the flag NetJailState#finished, if this cmd finished.
- *
- */
-static int
-netjail_start_finish (void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls)
-{
- struct NetJailState *ns = cls;
-
- if (ns->finished)
- {
- cont (cont_cls);
- }
- return ns->finished;
-}
-
-/**
* Create command.
*
* @param label name for command.
- * @param local_m Number of local nodes in each namespace.
- * @param global_n The number of namespaces.
+ * @param topology_config Configuration file for the test topology.
* @return command.
*/
struct GNUNET_TESTING_Command
GNUNET_TESTING_cmd_netjail_start (const char *label,
- char *local_m,
- char *global_n)
+ char *topology_config)
{
struct NetJailState *ns;
ns = GNUNET_new (struct NetJailState);
- ns->local_m = local_m;
- ns->global_n = global_n;
- ns->finished = GNUNET_NO;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = ns,
- .label = label,
- .run = &netjail_start_run,
- .finish = &netjail_start_finish,
- .cleanup = &netjail_start_cleanup,
- .traits = &netjail_start_traits
- };
-
- return cmd;
+ ns->topology_config = topology_config;
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = ns,
+ .label = label,
+ .run = &netjail_start_run,
+ .ac = &ns->ac,
+ .cleanup = &netjail_start_cleanup
+ };
+
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c b/src/testing/testing_api_cmd_netjail_start_testsystem.c
index 531621eb5..a1d71c436 100644
--- a/src/testing/testing_api_cmd_netjail_start_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c
@@ -62,6 +62,16 @@ struct HelperMessage
struct NetJailState
{
/**
+ * Context for our asynchronous completion.
+ */
+ struct GNUNET_TESTING_AsyncContext ac;
+
+ /**
+ * The complete topology information.
+ */
+ struct GNUNET_TESTING_NetjailTopology *topology;
+
+ /**
* Pointer to the return value of the test.
*
*/
@@ -91,16 +101,22 @@ struct NetJailState
unsigned int n_helper;
/**
- * Number of nodes in a network namespace. //TODO make this a unsigned int
+ * Number of nodes in a natted subnet.
*
*/
- char *local_m;
+ unsigned int local_m;
/**
- * Number of network namespaces. //TODO make this a unsigned int
+ * Number of natted subnets.
*
*/
- char *global_n;
+ unsigned int global_n;
+
+ /**
+ * Number of global known nodes.
+ *
+ */
+ unsigned int known;
/**
* The send handle for the helper
@@ -194,11 +210,9 @@ struct TestingSystemCount
* Code to clean up resource this cmd used.
*
* @param cls closure
-* @param cmd current CMD being cleaned up.
*/
static void
-netjail_exec_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+netjail_exec_cleanup (void *cls)
{
struct NetJailState *ns = cls;
struct HelperMessage *message_pos;
@@ -268,7 +282,8 @@ netjail_exec_traits (void *cls,
int
GNUNET_TESTING_get_trait_helper_handles (const struct
GNUNET_TESTING_Command *cmd,
- struct GNUNET_HELPER_Handle ***helper)
+ struct GNUNET_HELPER_Handle ***
+ helper)
{
return cmd->traits (cmd->cls,
(const void **) helper,
@@ -298,6 +313,43 @@ clear_msg (void *cls, int result)
}
+static void
+send_all_peers_started (unsigned int i, unsigned int j, struct NetJailState *ns)
+{
+ unsigned int total_number = ns->local_m * ns->global_n + ns->known;
+ struct GNUNET_CMDS_ALL_PEERS_STARTED *reply;
+ size_t msg_length;
+ struct GNUNET_HELPER_Handle *helper;
+ struct TestingSystemCount *tbc;
+
+ tbc = GNUNET_new (struct TestingSystemCount);
+ tbc->ns = ns;
+ // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone.
+ if (0 == i)
+ tbc->count = j + total_number;
+ else
+ tbc->count = (i - 1) * ns->local_m + j + total_number + ns->known;
+
+ helper = ns->helper[tbc->count - 1 - total_number];
+ msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED);
+ reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED);
+ reply->header.type = htons (
+ GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED);
+ reply->header.size = htons ((uint16_t) msg_length);
+
+ GNUNET_array_append (ns->msg, ns->n_msg, &reply->header);
+
+ struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send (
+ helper,
+ &reply->header,
+ GNUNET_NO,
+ &clear_msg,
+ tbc);
+
+ GNUNET_array_append (ns->shandle, ns->n_shandle, sh);
+}
+
+
/**
* Functions with this signature are called whenever a
* complete message is received by the tokenizer.
@@ -316,6 +368,7 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
struct TestingSystemCount *tbc = cls;
struct NetJailState *ns = tbc->ns;
struct HelperMessage *hp_msg;
+ unsigned int total_number = ns->local_m * ns->global_n + ns->known;
if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY == ntohs (message->type))
{
@@ -325,11 +378,31 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
message->type))
{
ns->number_of_peers_started++;
+ if (ns->number_of_peers_started == total_number)
+ {
+ for (int i = 1; i <= ns->known; i++)
+ {
+ send_all_peers_started (0,i, ns);
+ }
+
+ for (int i = 1; i <= ns->global_n; i++)
+ {
+ for (int j = 1; j <= ns->local_m; j++)
+ {
+ send_all_peers_started (i,j, ns);
+ }
+ }
+ ns->number_of_peers_started = 0;
+ }
}
else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED == ntohs (
message->type))
{
ns->number_of_local_test_finished++;
+ if (ns->number_of_local_test_finished == total_number)
+ {
+ GNUNET_TESTING_async_finish (&ns->ac);
+ }
}
else
{
@@ -340,6 +413,12 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
hp_msg);
}
+
+
+
+
+
+
return GNUNET_OK;
}
@@ -351,24 +430,21 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
static void
exp_cb (void *cls)
{
- struct NetJailState *ns = cls;
+ struct TestingSystemCount *tbc = cls;
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n");
- *ns->rv = 1;
+ GNUNET_TESTING_interpreter_fail (tbc->ns->ac.is);
}
/**
* Function to initialize a init message for the helper.
*
- * @param m_char The actual node in a namespace. //TODO Change this to unsigned int
- * @param n_char The actual namespace. //TODO Change this to unsigned int
* @param plugin_name Name of the test case plugin the helper will load.
*
*/
static struct GNUNET_CMDS_HelperInit *
-create_helper_init_msg_ (char *m_char,
- char *n_char,
- const char *plugin_name)
+create_helper_init_msg_ (const char *plugin_name)
{
struct GNUNET_CMDS_HelperInit *msg;
uint16_t plugin_name_len;
@@ -395,22 +471,49 @@ create_helper_init_msg_ (char *m_char,
static void
start_helper (struct NetJailState *ns, struct
GNUNET_CONFIGURATION_Handle *config,
- char *m_char,
- char *n_char)
+ unsigned int m,
+ unsigned int n)
{
struct GNUNET_HELPER_Handle *helper;
struct GNUNET_CMDS_HelperInit *msg;
struct TestingSystemCount *tbc;
+ char *m_char, *n_char, *global_n_char, *local_m_char, *known_char, *node_id,
+ *plugin;
+ pid_t pid;
+ unsigned int script_num;
+ struct GNUNET_ShortHashCode *hkey;
+ struct GNUNET_HashCode hc;
+ struct GNUNET_TESTING_NetjailTopology *topology = ns->topology;
+ struct GNUNET_TESTING_NetjailNode *node;
+ struct GNUNET_TESTING_NetjailNamespace *namespace;
+
+
+ if (0 == n)
+ script_num = m - 1;
+ else
+ script_num = n - 1 + (n - 1) * ns->local_m + m + ns->known;
+ pid = getpid ();
+
+ GNUNET_asprintf (&m_char, "%u", m);
+ GNUNET_asprintf (&n_char, "%u", n);
+ GNUNET_asprintf (&local_m_char, "%u", ns->local_m);
+ GNUNET_asprintf (&global_n_char, "%u",ns->global_n);
+ GNUNET_asprintf (&known_char, "%u",ns->known);
+ GNUNET_asprintf (&node_id, "%06x-%08x\n",
+ pid,
+ script_num);
+
+
char *const script_argv[] = {NETJAIL_EXEC_SCRIPT,
m_char,
n_char,
GNUNET_OS_get_libexec_binary_path (
HELPER_CMDS_BINARY),
- ns->global_n,
- ns->local_m,
+ global_n_char,
+ local_m_char,
+ node_id,
NULL};
- unsigned int m = atoi (m_char);
- unsigned int n = atoi (n_char);
+
unsigned int helper_check = GNUNET_OS_check_helper_binary (
NETJAIL_EXEC_SCRIPT,
GNUNET_YES,
@@ -418,7 +521,10 @@ start_helper (struct NetJailState *ns, struct
tbc = GNUNET_new (struct TestingSystemCount);
tbc->ns = ns;
- tbc->count = (n - 1) * atoi (ns->local_m) + m;
+ if (0 == n)
+ tbc->count = m;
+ else
+ tbc->count = (n - 1) * ns->local_m + m + ns->known;
GNUNET_CONTAINER_DLL_insert (ns->tbcs_head, ns->tbcs_tail,
tbc);
@@ -429,14 +535,14 @@ start_helper (struct NetJailState *ns, struct
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No SUID for %s!\n",
NETJAIL_EXEC_SCRIPT);
- *ns->rv = 1;
+ GNUNET_TESTING_interpreter_fail (ns->ac.is);
}
else if (GNUNET_NO == helper_check)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%s not found!\n",
NETJAIL_EXEC_SCRIPT);
- *ns->rv = 1;
+ GNUNET_TESTING_interpreter_fail (ns->ac.is);
}
GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start (
@@ -449,9 +555,57 @@ start_helper (struct NetJailState *ns, struct
helper = ns->helper[tbc->count - 1];
- msg = create_helper_init_msg_ (m_char,
- n_char,
- ns->plugin_name);
+ hkey = GNUNET_new (struct GNUNET_ShortHashCode);
+
+ plugin = topology->plugin;
+
+ if (0 == m)
+ {
+
+ GNUNET_CRYPTO_hash (&n, sizeof(n), &hc);
+ memcpy (hkey,
+ &hc,
+ sizeof (*hkey));
+ if (1 == GNUNET_CONTAINER_multishortmap_contains (topology->map_globals,
+ hkey))
+ {
+ node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
+ hkey);
+ if (NULL != node->plugin)
+ plugin = node->plugin;
+ }
+
+ }
+ else
+ {
+ GNUNET_CRYPTO_hash (&m, sizeof(m), &hc);
+ memcpy (hkey,
+ &hc,
+ sizeof (*hkey));
+ if (1 == GNUNET_CONTAINER_multishortmap_contains (topology->map_namespaces,
+ hkey))
+ {
+ namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
+ hkey);
+ GNUNET_CRYPTO_hash (&n, sizeof(n), &hc);
+ memcpy (hkey,
+ &hc,
+ sizeof (*hkey));
+ if (1 == GNUNET_CONTAINER_multishortmap_contains (namespace->nodes,
+ hkey))
+ {
+ node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
+ hkey);
+ if (NULL != node->plugin)
+ plugin = node->plugin;
+ }
+ }
+
+
+ }
+
+ msg = create_helper_init_msg_ (plugin);
+
GNUNET_array_append (ns->msg, ns->n_msg, &msg->header);
GNUNET_array_append (ns->shandle, ns->n_shandle, GNUNET_HELPER_send (
@@ -466,7 +620,7 @@ start_helper (struct NetJailState *ns, struct
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Send handle is NULL!\n");
GNUNET_free (msg);
- *ns->rv = 1;
+ GNUNET_TESTING_interpreter_fail (ns->ac.is);
}
}
@@ -480,95 +634,28 @@ start_helper (struct NetJailState *ns, struct
*/
static void
netjail_exec_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
- char str_m[12];
- char str_n[12];
struct NetJailState *ns = cls;
struct GNUNET_CONFIGURATION_Handle *config =
GNUNET_CONFIGURATION_create ();
- for (int i = 1; i <= atoi (ns->global_n); i++)
+ for (int i = 1; i <= ns->known; i++)
{
- for (int j = 1; j <= atoi (ns->local_m); j++)
- {
- sprintf (str_n, "%d", i);
- sprintf (str_m, "%d", j);
- start_helper (ns, config,
- str_m,
- str_n);
- }
+ start_helper (ns, config,
+ i,
+ 0);
}
-}
-
-/**
- * This function checks on three different information.
- *
- * 1. Did all helpers start. This is only logged.
- * 2. Did all peer start.
- * In this case a GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED is send to all peers.
- * 3. Did all peers finished the test case. In this case interpreter_next will be called.
- *
- */
-static int
-netjail_start_finish (void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls)
-{
- unsigned int ret = GNUNET_NO;
- struct NetJailState *ns = cls;
- unsigned int total_number = atoi (ns->local_m) * atoi (ns->global_n);
- struct GNUNET_CMDS_ALL_PEERS_STARTED *reply;
- size_t msg_length;
- struct GNUNET_HELPER_Handle *helper;
- struct TestingSystemCount *tbc;
-
- if (ns->number_of_local_test_finished == total_number)
- {
- ret = GNUNET_YES;
- cont (cont_cls);
- }
-
- if (ns->number_of_testsystems_started == total_number)
- {
- ns->number_of_testsystems_started = 0;
- }
-
- if (ns->number_of_peers_started == total_number)
+ for (int i = 1; i <= ns->global_n; i++)
{
- for (int i = 1; i <= atoi (ns->global_n); i++)
+ for (int j = 1; j <= ns->local_m; j++)
{
- for (int j = 1; j <= atoi (ns->local_m); j++)
- {
- tbc = GNUNET_new (struct TestingSystemCount);
- tbc->ns = ns;
- // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone.
- tbc->count = (i - 1) * atoi (ns->local_m) + j + total_number;
-
- helper = ns->helper[tbc->count - 1 - total_number];
- msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED);
- reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED);
- reply->header.type = htons (
- GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED);
- reply->header.size = htons ((uint16_t) msg_length);
-
- GNUNET_array_append (ns->msg, ns->n_msg, &reply->header);
-
- struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send (
- helper,
- &reply->header,
- GNUNET_NO,
- &clear_msg,
- tbc);
-
- GNUNET_array_append (ns->shandle, ns->n_shandle, sh);
- }
+ start_helper (ns, config,
+ j,
+ i);
}
- ns->number_of_peers_started = 0;
}
- return ret;
}
@@ -576,32 +663,30 @@ netjail_start_finish (void *cls,
* Create command.
*
* @param label Name for the command.
- * @param local_m Number of nodes in a network namespace. //TODO make this a unsigned int
- * @param global_n Number of network namespaces. //TODO make this a unsigned int
- * @param plugin_name Name of the test case plugin the helper will load.
- * @param rv Pointer to the return value of the test.
+ * @param topology_config Configuration file for the test topology.
* @return command.
*/
struct GNUNET_TESTING_Command
GNUNET_TESTING_cmd_netjail_start_testing_system (const char *label,
- char *local_m,
- char *global_n,
- char *plugin_name,
- unsigned int *rv)
+ const char *topology_config)
{
struct NetJailState *ns;
+ struct GNUNET_TESTING_NetjailTopology *topology =
+ GNUNET_TESTING_get_topo_from_file (topology_config);
+
ns = GNUNET_new (struct NetJailState);
- ns->local_m = local_m;
- ns->global_n = global_n;
- ns->plugin_name = plugin_name;
- ns->rv = rv;
+ ns->local_m = topology->nodes_m;
+ ns->global_n = topology->namespaces_n;
+ ns->known = topology->nodes_x;
+ ns->plugin_name = topology->plugin;
+ ns->topology = topology;
struct GNUNET_TESTING_Command cmd = {
.cls = ns,
.label = label,
.run = &netjail_exec_run,
- .finish = &netjail_start_finish,
+ .ac = &ns->ac,
.cleanup = &netjail_exec_cleanup,
.traits = &netjail_exec_traits
};
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c b/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c
deleted file mode 100644
index ccb3f5ae8..000000000
--- a/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c
+++ /dev/null
@@ -1,720 +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
- */
-
-/**
- * @file testing/testing_api_cmd_hello_world.c
- * @brief Command to start the netjail peers.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_testing_ng_lib.h"
-#include "testing_cmds.h"
-
-#define NETJAIL_EXEC_SCRIPT "./../testing/netjail_exec_v2.sh"
-
-/**
- * Struct to store messages send/received by the helper into a DLL
- *
- */
-struct HelperMessage
-{
-
- /**
- * Kept in a DLL.
- */
- struct HelperMessage *next;
-
- /**
- * Kept in a DLL.
- */
- struct HelperMessage *prev;
-
- /**
- * Size of the original message.
- */
- uint16_t bytes_msg;
-
- /* Followed by @e bytes_msg of msg.*/
-};
-
-
-/**
- * Struct to store information handed over to callbacks.
- *
- */
-struct NetJailState
-{
- /**
- * The complete topology information.
- */
- struct GNUNET_TESTING_NetjailTopology *topology;
-
- /**
- * Pointer to the return value of the test.
- *
- */
- unsigned int *rv;
-
- /**
- * Head of the DLL which stores messages received by the helper.
- *
- */
- struct HelperMessage *hp_messages_head;
-
- /**
- * Tail of the DLL which stores messages received by the helper.
- *
- */
- struct HelperMessage *hp_messages_tail;
-
- /**
- * Array with handles of helper processes.
- */
- struct GNUNET_HELPER_Handle **helper;
-
- /**
- * Size of the array NetJailState#helper.
- *
- */
- unsigned int n_helper;
-
- /**
- * Number of nodes in a natted subnet.
- *
- */
- unsigned int local_m;
-
- /**
- * Number of natted subnets.
- *
- */
- unsigned int global_n;
-
- /**
- * Number of global known nodes.
- *
- */
- unsigned int known;
-
- /**
- * The send handle for the helper
- */
- struct GNUNET_HELPER_SendHandle **shandle;
-
- /**
- * Size of the array NetJailState#shandle.
- *
- */
- unsigned int n_shandle;
-
- /**
- * The messages send to the helper.
- */
- struct GNUNET_MessageHeader **msg;
-
- /**
- * Size of the array NetJailState#msg.
- *
- */
- unsigned int n_msg;
-
- /**
- * Number of test environments started.
- *
- */
- unsigned int number_of_testsystems_started;
-
- /**
- * Number of peers started.
- *
- */
- unsigned int number_of_peers_started;
-
- /**
- * Number of local tests finished.
- *
- */
- unsigned int number_of_local_test_finished;
-
- /**
- * Name of the test case plugin the helper will load.
- *
- */
- char *plugin_name;
-
- /**
- * HEAD of the DLL containing TestingSystemCount.
- *
- */
- struct TestingSystemCount *tbcs_head;
-
- /**
- * TAIL of the DLL containing TestingSystemCount.
- *
- */
- struct TestingSystemCount *tbcs_tail;
-};
-
-/**
- * Struct containing the number of the test environment and the NetJailState which
- * will be handed to callbacks specific to a test environment.
- */
-struct TestingSystemCount
-{
- /**
- * Kept in a DLL.
- */
- struct TestingSystemCount *next;
-
- /**
- * Kept in a DLL.
- */
- struct TestingSystemCount *prev;
-
- /**
- * The number of the test environment.
- *
- */
- unsigned int count;
-
- /**
- * Struct to store information handed over to callbacks.
- *
- */
- struct NetJailState *ns;
-};
-
-/**
-* Code to clean up resource this cmd used.
-*
-* @param cls closure
-* @param cmd current CMD being cleaned up.
-*/
-static void
-netjail_exec_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
-{
- struct NetJailState *ns = cls;
- struct HelperMessage *message_pos;
- struct TestingSystemCount *tbc_pos;
-
- while (NULL != (message_pos = ns->hp_messages_head))
- {
- GNUNET_CONTAINER_DLL_remove (ns->hp_messages_head,
- ns->hp_messages_tail,
- message_pos);
- GNUNET_free (message_pos);
- }
- while (NULL != (tbc_pos = ns->tbcs_head))
- {
- GNUNET_CONTAINER_DLL_remove (ns->tbcs_head,
- ns->tbcs_tail,
- tbc_pos);
- GNUNET_free (tbc_pos);
- }
- GNUNET_free (ns);
-}
-
-
-/**
- * This function prepares an array with traits.
- *
- */
-static int
-netjail_exec_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- struct NetJailState *ns = cls;
- struct GNUNET_HELPER_Handle **helper = ns->helper;
- struct HelperMessage *hp_messages_head = ns->hp_messages_head;
-
-
- struct GNUNET_TESTING_Trait traits[] = {
- {
- .index = 0,
- .trait_name = "helper_handles",
- .ptr = (const void *) helper,
- },
- {
- .index = 1,
- .trait_name = "hp_msgs_head",
- .ptr = (const void *) hp_messages_head,
- },
- GNUNET_TESTING_trait_end ()
- };
-
- return GNUNET_TESTING_get_trait (traits,
- ret,
- trait,
- index);
-}
-
-
-/**
- * Offer handles to testing cmd helper from trait
- *
- * @param cmd command to extract the message from.
- * @param pt pointer to message.
- * @return #GNUNET_OK on success.
- */
-int
-GNUNET_TESTING_get_trait_helper_handles_v2 (const struct
- GNUNET_TESTING_Command *cmd,
- struct GNUNET_HELPER_Handle ***
- helper)
-{
- return cmd->traits (cmd->cls,
- (const void **) helper,
- "helper_handles",
- (unsigned int) 0);
-}
-
-
-/**
- * Continuation function from GNUNET_HELPER_send()
- *
- * @param cls closure
- * @param result GNUNET_OK on success,
- * GNUNET_NO if helper process died
- * GNUNET_SYSERR during GNUNET_HELPER_stop
- */
-static void
-clear_msg (void *cls, int result)
-{
- struct TestingSystemCount *tbc = cls;
- struct NetJailState *ns = tbc->ns;
-
- GNUNET_assert (NULL != ns->shandle[tbc->count - 1]);
- ns->shandle[tbc->count - 1] = NULL;
- GNUNET_free (ns->msg[tbc->count - 1]);
- ns->msg[tbc->count - 1] = NULL;
-}
-
-
-/**
- * Functions with this signature are called whenever a
- * complete message is received by the tokenizer.
- *
- * Do not call GNUNET_SERVER_mst_destroy in callback
- *
- * @param cls closure
- * @param client identification of the client
- * @param message the actual message
- *
- * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
- */
-static int
-helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
-{
- struct TestingSystemCount *tbc = cls;
- struct NetJailState *ns = tbc->ns;
- struct HelperMessage *hp_msg;
-
- if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY == ntohs (message->type))
- {
- ns->number_of_testsystems_started++;
- }
- else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED == ntohs (
- message->type))
- {
- ns->number_of_peers_started++;
- }
- else if (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED == ntohs (
- message->type))
- {
- ns->number_of_local_test_finished++;
- }
- else
- {
- hp_msg = GNUNET_new (struct HelperMessage);
- hp_msg->bytes_msg = message->size;
- memcpy (&hp_msg[1], message, message->size);
- GNUNET_CONTAINER_DLL_insert (ns->hp_messages_head, ns->hp_messages_tail,
- hp_msg);
- }
-
- return GNUNET_OK;
-}
-
-
-/**
- * Callback called if there was an exception during execution of the helper.
- *
- */
-static void
-exp_cb (void *cls)
-{
- struct NetJailState *ns = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n");
- *ns->rv = 1;
-}
-
-
-/**
- * Function to initialize a init message for the helper.
- *
- * @param m_char The actual node in a namespace. //TODO Change this to unsigned int
- * @param n_char The actual namespace. //TODO Change this to unsigned int
- * @param plugin_name Name of the test case plugin the helper will load.
- *
- */
-static struct GNUNET_CMDS_HelperInit *
-create_helper_init_msg_ (const char *plugin_name)
-{
- struct GNUNET_CMDS_HelperInit *msg;
- uint16_t plugin_name_len;
- uint16_t msg_size;
-
- GNUNET_assert (NULL != plugin_name);
- plugin_name_len = strlen (plugin_name);
- msg_size = sizeof(struct GNUNET_CMDS_HelperInit) + plugin_name_len;
- msg = GNUNET_malloc (msg_size);
- msg->header.size = htons (msg_size);
- msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT);
- msg->plugin_name_size = htons (plugin_name_len);
- GNUNET_memcpy ((char *) &msg[1],
- plugin_name,
- plugin_name_len);
- return msg;
-}
-
-
-/**
- * Function which start a single helper process.
- *
- */
-static void
-start_helper (struct NetJailState *ns, struct
- GNUNET_CONFIGURATION_Handle *config,
- unsigned int m,
- unsigned int n)
-{
- struct GNUNET_HELPER_Handle *helper;
- struct GNUNET_CMDS_HelperInit *msg;
- struct TestingSystemCount *tbc;
- char *m_char, *n_char, *global_n_char, *local_m_char, *known_char, *node_id,
- *plugin;
- pid_t pid;
- unsigned int script_num;
- struct GNUNET_ShortHashCode *hkey;
- struct GNUNET_HashCode hc;
- struct GNUNET_TESTING_NetjailTopology *topology = ns->topology;
- struct GNUNET_TESTING_NetjailNode *node;
- struct GNUNET_TESTING_NetjailNamespace *namespace;
-
-
- if (0 == n)
- script_num = m - 1;
- else
- script_num = n - 1 + (n - 1) * ns->local_m + m + ns->known;
- pid = getpid ();
-
- GNUNET_asprintf (&m_char, "%u", m);
- GNUNET_asprintf (&n_char, "%u", n);
- GNUNET_asprintf (&local_m_char, "%u", ns->local_m);
- GNUNET_asprintf (&global_n_char, "%u",ns->global_n);
- GNUNET_asprintf (&known_char, "%u",ns->known);
- GNUNET_asprintf (&node_id, "%06x-%08x\n",
- pid,
- script_num);
-
-
- char *const script_argv[] = {NETJAIL_EXEC_SCRIPT,
- m_char,
- n_char,
- GNUNET_OS_get_libexec_binary_path (
- HELPER_CMDS_BINARY),
- global_n_char,
- local_m_char,
- node_id,
- NULL};
-
- unsigned int helper_check = GNUNET_OS_check_helper_binary (
- NETJAIL_EXEC_SCRIPT,
- GNUNET_YES,
- NULL);
-
- tbc = GNUNET_new (struct TestingSystemCount);
- tbc->ns = ns;
- if (0 == n)
- tbc->count = m;
- else
- tbc->count = (n - 1) * ns->local_m + m + ns->known;
-
- GNUNET_CONTAINER_DLL_insert (ns->tbcs_head, ns->tbcs_tail,
- tbc);
-
-
- if (GNUNET_NO == helper_check)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "No SUID for %s!\n",
- NETJAIL_EXEC_SCRIPT);
- *ns->rv = 1;
- }
- else if (GNUNET_NO == helper_check)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%s not found!\n",
- NETJAIL_EXEC_SCRIPT);
- *ns->rv = 1;
- }
-
- GNUNET_array_append (ns->helper, ns->n_helper, GNUNET_HELPER_start (
- GNUNET_YES,
- NETJAIL_EXEC_SCRIPT,
- script_argv,
- &helper_mst,
- &exp_cb,
- tbc));
-
- helper = ns->helper[tbc->count - 1];
-
- hkey = GNUNET_new (struct GNUNET_ShortHashCode);
-
- plugin = topology->plugin;
-
- if (0 == m)
- {
-
- GNUNET_CRYPTO_hash (&n, sizeof(n), &hc);
- memcpy (hkey,
- &hc,
- sizeof (*hkey));
- if (1 == GNUNET_CONTAINER_multishortmap_contains (topology->map_globals,
- hkey))
- {
- node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
- hkey);
- if (NULL != node->plugin)
- plugin = node->plugin;
- }
-
- }
- else
- {
- GNUNET_CRYPTO_hash (&m, sizeof(m), &hc);
- memcpy (hkey,
- &hc,
- sizeof (*hkey));
- if (1 == GNUNET_CONTAINER_multishortmap_contains (topology->map_namespaces,
- hkey))
- {
- namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
- hkey);
- GNUNET_CRYPTO_hash (&n, sizeof(n), &hc);
- memcpy (hkey,
- &hc,
- sizeof (*hkey));
- if (1 == GNUNET_CONTAINER_multishortmap_contains (namespace->nodes,
- hkey))
- {
- node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
- hkey);
- if (NULL != node->plugin)
- plugin = node->plugin;
- }
- }
-
-
- }
-
- msg = create_helper_init_msg_ (plugin);
-
- GNUNET_array_append (ns->msg, ns->n_msg, &msg->header);
-
- GNUNET_array_append (ns->shandle, ns->n_shandle, GNUNET_HELPER_send (
- helper,
- &msg->header,
- GNUNET_NO,
- &clear_msg,
- tbc));
-
- if (NULL == ns->shandle[tbc->count - 1])
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Send handle is NULL!\n");
- GNUNET_free (msg);
- *ns->rv = 1;
- }
-}
-
-
-/**
-* This function starts a helper process for each node.
-*
-* @param cls closure.
-* @param cmd CMD being run.
-* @param is interpreter state.
-*/
-static void
-netjail_exec_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
- struct GNUNET_TESTING_Interpreter *is)
-{
- struct NetJailState *ns = cls;
- struct GNUNET_CONFIGURATION_Handle *config =
- GNUNET_CONFIGURATION_create ();
-
- for (int i = 1; i <= ns->known; i++)
- {
- start_helper (ns, config,
- i,
- 0);
- }
-
- for (int i = 1; i <= ns->global_n; i++)
- {
- for (int j = 1; j <= ns->local_m; j++)
- {
- start_helper (ns, config,
- j,
- i);
- }
- }
-}
-
-
-static void
-send_all_peers_started (unsigned int i, unsigned int j, struct NetJailState *ns)
-{
- unsigned int total_number = ns->local_m * ns->global_n + ns->known;
- struct GNUNET_CMDS_ALL_PEERS_STARTED *reply;
- size_t msg_length;
- struct GNUNET_HELPER_Handle *helper;
- struct TestingSystemCount *tbc;
-
- tbc = GNUNET_new (struct TestingSystemCount);
- tbc->ns = ns;
- // TODO This needs to be more generic. As we send more messages back and forth, we can not grow the arrays again and again, because this is to error prone.
- if (0 == i)
- tbc->count = j + total_number;
- else
- tbc->count = (i - 1) * ns->local_m + j + total_number + ns->known;
-
- helper = ns->helper[tbc->count - 1 - total_number];
- msg_length = sizeof(struct GNUNET_CMDS_ALL_PEERS_STARTED);
- reply = GNUNET_new (struct GNUNET_CMDS_ALL_PEERS_STARTED);
- reply->header.type = htons (
- GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED);
- reply->header.size = htons ((uint16_t) msg_length);
-
- GNUNET_array_append (ns->msg, ns->n_msg, &reply->header);
-
- struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send (
- helper,
- &reply->header,
- GNUNET_NO,
- &clear_msg,
- tbc);
-
- GNUNET_array_append (ns->shandle, ns->n_shandle, sh);
-}
-
-
-/**
- * This function checks on three different information.
- *
- * 1. Did all helpers start. This is only logged.
- * 2. Did all peer start.
- * In this case a GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED is send to all peers.
- * 3. Did all peers finished the test case. In this case interpreter_next will be called.
- *
- */
-static int
-netjail_start_finish (void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls)
-{
- unsigned int ret = GNUNET_NO;
- struct NetJailState *ns = cls;
- unsigned int total_number = ns->local_m * ns->global_n + ns->known;
-
-
- if (ns->number_of_local_test_finished == total_number)
- {
- ret = GNUNET_YES;
- cont (cont_cls);
- }
-
- if (ns->number_of_testsystems_started == total_number)
- {
- ns->number_of_testsystems_started = 0;
- }
-
- if (ns->number_of_peers_started == total_number)
- {
- for (int i = 1; i <= ns->known; i++)
- {
- send_all_peers_started (0,i, ns);
- }
-
- for (int i = 1; i <= ns->global_n; i++)
- {
- for (int j = 1; j <= ns->local_m; j++)
- {
- send_all_peers_started (i,j, ns);
- }
- }
- ns->number_of_peers_started = 0;
- }
- return ret;
-}
-
-
-/**
- * Create command.
- *
- * @param label Name for the command.
- * @param topology_config Configuration file for the test topology.
- * @param rv Pointer to the return value of the test.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_start_testing_system_v2 (const char *label,
- const char *topology_config,
- unsigned int *rv)
-{
- struct NetJailState *ns;
-
- struct GNUNET_TESTING_NetjailTopology *topology =
- GNUNET_TESTING_get_topo_from_file (topology_config);
-
- ns = GNUNET_new (struct NetJailState);
- ns->rv = rv;
- ns->local_m = topology->nodes_m;
- ns->global_n = topology->namespaces_n;
- ns->known = topology->nodes_x;
- ns->plugin_name = topology->plugin;
- ns->topology = topology;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = ns,
- .label = label,
- .run = &netjail_exec_run,
- .finish = &netjail_start_finish,
- .cleanup = &netjail_exec_cleanup,
- .traits = &netjail_exec_traits
- };
-
- return cmd;
-}
diff --git a/src/testing/testing_api_cmd_netjail_start_v2.c b/src/testing/testing_api_cmd_netjail_start_v2.c
deleted file mode 100644
index 9123148a7..000000000
--- a/src/testing/testing_api_cmd_netjail_start_v2.c
+++ /dev/null
@@ -1,249 +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
- */
-
-/**
- * @file testing/testing_api_cmd_hello_world.c
- * @brief Command to start the netjail script.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_testing_ng_lib.h"
-
-#define NETJAIL_START_SCRIPT "./../testing/netjail_start_v2.sh"
-
-/**
- * Struct to hold information for callbacks.
- *
- */
-struct NetJailState
-{
- // Child Wait handle
- struct GNUNET_ChildWaitHandle *cwh;
-
- /**
- * Configuration file for the test topology.
- */
- char *topology_config;
-
- /**
- * The process id of the start script.
- */
- struct GNUNET_OS_Process *start_proc;
-
- // Flag indication if the script finished.
- // FIXME: document 3 values
- enum GNUNET_GenericReturnValue finished;
-};
-
-
-/**
- * The cleanup function of this cmd frees resources the cmd allocated.
- *
- */
-static void
-netjail_start_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
-{
- struct NetJailState *ns = cls;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "netjail_start_cleanup!\n");
-
- if (NULL != ns->cwh)
- {
- GNUNET_wait_child_cancel (ns->cwh);
- ns->cwh = NULL;
- }
- if (NULL != ns->start_proc)
- {
- GNUNET_assert (0 ==
- GNUNET_OS_process_kill (ns->start_proc,
- SIGKILL));
- GNUNET_assert (GNUNET_OK ==
- GNUNET_OS_process_wait (ns->start_proc));
- GNUNET_OS_process_destroy (ns->start_proc);
- ns->start_proc = NULL;
- }
- GNUNET_free (ns);
-}
-
-
-/**
- * Trait function of this cmd does nothing.
- *
- */
-static int
-netjail_start_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- return GNUNET_OK;
-}
-
-
-/**
- * Callback which will be called if the setup script finished.
- *
- */
-static void
-child_completed_callback (void *cls,
- enum GNUNET_OS_ProcessStatusType type,
- long unsigned int exit_code)
-{
- struct NetJailState *ns = cls;
-
- if (0 == exit_code)
- {
- ns->finished = GNUNET_YES;
- }
- else
- {
- // FIXME: log status code
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Child completed with an error!\n");
- ns->finished = GNUNET_SYSERR;
- }
- GNUNET_OS_process_destroy (ns->start_proc);
- ns->start_proc = NULL;
-}
-
-
-
-/**
-* The run method starts the script which setup the network namespaces.
-*
-* @param cls closure.
-* @param cmd CMD being run.
-* @param is interpreter state.
-*/
-static void
-netjail_start_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
- struct GNUNET_TESTING_Interpreter *is)
-{
- struct NetJailState *ns = cls;
- char pid[15];
- enum GNUNET_GenericReturnValue helper_check;
-
- // FIXME: NETJAIL_START_SCRIPT like this is bad,
- // use location from share/gnunet/ of installed
- // binary in case libgnunettesting is used as a lib!
- helper_check = GNUNET_OS_check_helper_binary (
- NETJAIL_START_SCRIPT,
- GNUNET_YES,
- NULL);
-
- if (GNUNET_NO == helper_check)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "No SUID for %s!\n",
- NETJAIL_START_SCRIPT);
- GNUNET_TESTING_interpreter_fail ();
- return;
- }
- if (GNUNET_SYSERR == helper_check)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%s not found!\n",
- NETJAIL_START_SCRIPT);
- GNUNET_TESTING_interpreter_fail ();
- return;
- }
-
- GNUNET_snprintf (pid,
- sizeof (pid),
- "%u",
- getpid ());
- {
- char *const script_argv[] = {
- NETJAIL_START_SCRIPT,
- ns->topology_config,
- pid,
- NULL
- };
-
- ns->start_proc
- = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
- NULL,
- NULL,
- NULL,
- NETJAIL_START_SCRIPT,
- script_argv);
- }
- ns->cwh = GNUNET_wait_child (ns->start_proc,
- &child_completed_callback,
- ns);
- GNUNET_break (NULL != ns->cwh);
-}
-
-
-/**
- * This function checks the flag NetJailState
- *
- * FIXME: fix comment!
- * #finished, if this cmd finished.
- *
- */
-static enum GNUNET_GenericReturnValue
-netjail_start_finish (void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls)
-{
- struct NetJailState *ns = cls;
-
- if (GNUNET_NO != ns->finished)
- {
- cont (cont_cls);
- }
- // FIXME: cont should be called later in the else case!
- return ns->finished;
-}
-
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @param topology_config Configuration file for the test topology.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_start_v2 (const char *label,
- char *topology_config)
-{
- struct NetJailState *ns;
-
- ns = GNUNET_new (struct NetJailState);
- ns->topology_config = topology_config;
- {
- struct GNUNET_TESTING_Command cmd = {
- .cls = ns,
- .label = label,
- .run = &netjail_start_run,
- .finish = &netjail_start_finish,
- .cleanup = &netjail_start_cleanup,
- .traits = &netjail_start_traits
- };
-
- return cmd;
- }
-}
diff --git a/src/testing/testing_api_cmd_netjail_stop.c b/src/testing/testing_api_cmd_netjail_stop.c
index 99084d9af..5033272a3 100644
--- a/src/testing/testing_api_cmd_netjail_stop.c
+++ b/src/testing/testing_api_cmd_netjail_stop.c
@@ -19,7 +19,7 @@
*/
/**
- * @file testing/testing_api_cmd_hello_world.c
+ * @file testing/testing_api_cmd_netjail_stop.c
* @brief Command to stop the netjail script.
* @author t3sserakt
*/
@@ -31,7 +31,7 @@
#define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop.sh"
// Child Wait handle
-struct GNUNET_ChildWaitHandle *cwh;
+static struct GNUNET_ChildWaitHandle *cwh;
/**
* Struct to hold information for callbacks.
@@ -39,19 +39,21 @@ struct GNUNET_ChildWaitHandle *cwh;
*/
struct NetJailState
{
- // Number of local nodes in each namespace.
- char *local_m;
+ /**
+ * Context for our asynchronous completion.
+ */
+ struct GNUNET_TESTING_AsyncContext ac;
- // The number of namespaces.
- char *global_n;
+ /**
+ * Configuration file for the test topology.
+ */
+ char *topology_config;
/**
* The process id of the start script.
*/
struct GNUNET_OS_Process *stop_proc;
- // Flag indication if the script finished.
- unsigned int finished;
};
@@ -60,8 +62,7 @@ struct NetJailState
*
*/
static void
-netjail_stop_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+netjail_stop_cleanup (void *cls)
{
struct NetJailState *ns = cls;
@@ -84,20 +85,6 @@ netjail_stop_cleanup (void *cls,
/**
- * Trait function of this cmd does nothing.
- *
- */
-static int
-netjail_stop_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- return GNUNET_OK;
-}
-
-
-/**
* Callback which will be called if the setup script finished.
*
*/
@@ -108,17 +95,17 @@ child_completed_callback (void *cls,
{
struct NetJailState *ns = cls;
- cwh = NULL;
+ cwh = NULL; // WTF? globals!?!?!
+ GNUNET_OS_process_destroy (ns->stop_proc);
+ ns->stop_proc = NULL;
if (0 == exit_code)
{
- ns->finished = GNUNET_YES;
+ GNUNET_TESTING_async_finish (&ns->ac);
}
else
{
- ns->finished = GNUNET_SYSERR;
+ GNUNET_TESTING_async_fail (&ns->ac);
}
- GNUNET_OS_process_destroy (ns->stop_proc);
- ns->stop_proc = NULL;
}
@@ -126,18 +113,21 @@ child_completed_callback (void *cls,
* The run method starts the script which deletes the network namespaces.
*
* @param cls closure.
-* @param cmd CMD being run.
* @param is interpreter state.
*/
static void
netjail_stop_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct NetJailState *ns = cls;
+ char *pid;
+
+ GNUNET_asprintf (&pid,
+ "%u",
+ getpid ());
char *const script_argv[] = {NETJAIL_STOP_SCRIPT,
- ns->local_m,
- ns->global_n,
+ ns->topology_config,
+ pid,
NULL};
unsigned int helper_check = GNUNET_OS_check_helper_binary (
NETJAIL_STOP_SCRIPT,
@@ -149,14 +139,14 @@ netjail_stop_run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No SUID for %s!\n",
NETJAIL_STOP_SCRIPT);
- GNUNET_TESTING_interpreter_fail ();
+ GNUNET_TESTING_interpreter_fail (is);
}
else if (GNUNET_NO == helper_check)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"%s not found!\n",
NETJAIL_STOP_SCRIPT);
- GNUNET_TESTING_interpreter_fail ();
+ GNUNET_TESTING_interpreter_fail (is);
}
ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
@@ -170,56 +160,26 @@ netjail_stop_run (void *cls,
&child_completed_callback,
ns);
GNUNET_break (NULL != cwh);
-
}
-/**
- * This function checks the flag NetJailState#finished, if this cmd finished.
- *
- */
-static int
-netjail_stop_finish (void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls)
-{
- struct NetJailState *ns = cls;
-
- if (ns->finished)
- {
- cont (cont_cls);
- }
- return ns->finished;
-}
-
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @param local_m Number of local nodes in each namespace.
- * @param global_n The number of namespaces.
- * @return command.
- */
struct GNUNET_TESTING_Command
GNUNET_TESTING_cmd_netjail_stop (const char *label,
- char *local_m,
- char *global_n)
+ char *topology_config)
{
struct NetJailState *ns;
ns = GNUNET_new (struct NetJailState);
- ns->local_m = local_m;
- ns->global_n = global_n;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = ns,
- .label = label,
- .run = &netjail_stop_run,
- .finish = &netjail_stop_finish,
- .cleanup = &netjail_stop_cleanup,
- .traits = &netjail_stop_traits
- };
-
- return cmd;
+ ns->topology_config = topology_config;
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = ns,
+ .label = label,
+ .run = &netjail_stop_run,
+ .ac = &ns->ac,
+ .cleanup = &netjail_stop_cleanup
+ };
+
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem.c b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
index 0ae82a26a..d3754153d 100644
--- a/src/testing/testing_api_cmd_netjail_stop_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
@@ -42,9 +42,15 @@ struct StopHelperState
*/
struct GNUNET_HELPER_Handle **helper;
- char *local_m;
+ unsigned int local_m;
- char *global_n;
+ unsigned int global_n;
+
+ /**
+ * Number of global known nodes.
+ *
+ */
+ unsigned int known;
};
@@ -55,8 +61,7 @@ struct StopHelperState
* @param cmd current CMD being cleaned up.
*/
static void
-stop_testing_system_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+stop_testing_system_cleanup (void *cls)
{
}
@@ -80,28 +85,40 @@ stop_testing_system_traits (void *cls,
* This function stops the helper process for each node.
*
* @param cls closure.
-* @param cmd CMD being run.
* @param is interpreter state.
*/
static void
stop_testing_system_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct StopHelperState *shs = cls;
struct GNUNET_HELPER_Handle **helper;
const struct GNUNET_TESTING_Command *start_helper_cmd;
- start_helper_cmd = GNUNET_TESTING_interpreter_lookup_command (
- shs->helper_start_label);
+ start_helper_cmd = GNUNET_TESTING_interpreter_lookup_command (NULL,
+ shs->
+ helper_start_label);
GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd,
&helper);
- for (int i = 1; i <= atoi (shs->global_n); i++)
+ for (int i = 1; i <= shs->known; i++)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "i: %u\n",
+ i);
+ GNUNET_HELPER_stop (helper[i - 1],
+ GNUNET_YES);
+ }
+
+ for (int i = 1; i <= shs->global_n; i++)
{
- for (int j = 1; j <= atoi (shs->local_m); j++)
+ for (int j = 1; j <= shs->local_m; j++)
{
- GNUNET_HELPER_stop (helper[(i - 1) * atoi (shs->local_m) + j - 1],
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "i: %u j: %u\n",
+ i,
+ j);
+ GNUNET_HELPER_stop (helper[(i - 1) * shs->local_m + j + shs->known - 1],
GNUNET_YES);
}
}
@@ -110,26 +127,27 @@ stop_testing_system_run (void *cls,
/**
* Create command.
- * @param helper_start_label label of the cmd to start the test system.
+ *
* @param label name for command.
- * @param .
- * @param local_m Number of nodes in a network namespace. //TODO make this a unsigned int
- * @param global_n Number of network namespaces. //TODO make this a unsigned int
+ * @param helper_start_label label of the cmd to start the test system.
+ * @param topology_config Configuration file for the test topology.
* @return command.
*/
struct GNUNET_TESTING_Command
GNUNET_TESTING_cmd_stop_testing_system (const char *label,
const char *helper_start_label,
- char *local_m,
- char *global_n
- )
+ const char *topology_config)
{
struct StopHelperState *shs;
+ struct GNUNET_TESTING_NetjailTopology *topology =
+ GNUNET_TESTING_get_topo_from_file (topology_config);
+
shs = GNUNET_new (struct StopHelperState);
shs->helper_start_label = helper_start_label;
- shs->local_m = local_m;
- shs->global_n = global_n;
+ shs->local_m = topology->nodes_m;
+ shs->global_n = topology->namespaces_n;
+ shs->known = topology->nodes_x;
struct GNUNET_TESTING_Command cmd = {
.cls = shs,
diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem_v2.c b/src/testing/testing_api_cmd_netjail_stop_testsystem_v2.c
deleted file mode 100644
index 8eccc5764..000000000
--- a/src/testing/testing_api_cmd_netjail_stop_testsystem_v2.c
+++ /dev/null
@@ -1,143 +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
- */
-
-/**
- * @file testing/testing_api_cmd_hello_world.c
- * @brief Command to start the netjail peers.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_testing_ng_lib.h"
-#include "testing_cmds.h"
-
-
-/**
- * Struct to store information handed over to callbacks.
- *
- */
-struct StopHelperState
-{
-
- const char *helper_start_label;
-
- /**
- * The process handle
- */
- struct GNUNET_HELPER_Handle **helper;
-
- unsigned int local_m;
-
- unsigned int global_n;
-};
-
-
-/**
-* Code to clean up resource this cmd used.
-*
-* @param cls closure
-* @param cmd current CMD being cleaned up.
-*/
-static void
-stop_testing_system_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
-{
-
-}
-
-
-/**
- * Trait function of this cmd does nothing.
- *
- */
-static int
-stop_testing_system_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- return GNUNET_OK;
-}
-
-
-/**
-* This function stops the helper process for each node.
-*
-* @param cls closure.
-* @param cmd CMD being run.
-* @param is interpreter state.
-*/
-static void
-stop_testing_system_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
- struct GNUNET_TESTING_Interpreter *is)
-{
- struct StopHelperState *shs = cls;
- struct GNUNET_HELPER_Handle **helper;
- const struct GNUNET_TESTING_Command *start_helper_cmd;
-
- start_helper_cmd = GNUNET_TESTING_interpreter_lookup_command (
- shs->helper_start_label);
- GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd,
- &helper);
-
- for (int i = 1; i <= shs->global_n; i++)
- {
- for (int j = 1; j <= shs->local_m; j++)
- {
- GNUNET_HELPER_stop (helper[(i - 1) * shs->local_m + j - 1],
- GNUNET_YES);
- }
- }
-}
-
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @param helper_start_label label of the cmd to start the test system.
- * @param topology_config Configuration file for the test topology.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_stop_testing_system_v2 (const char *label,
- const char *helper_start_label,
- const char *topology_config)
-{
- struct StopHelperState *shs;
-
- struct GNUNET_TESTING_NetjailTopology *topology =
- GNUNET_TESTING_get_topo_from_file (topology_config);
-
- shs = GNUNET_new (struct StopHelperState);
- shs->helper_start_label = helper_start_label;
- shs->local_m = topology->nodes_m;
- shs->global_n = topology->namespaces_n;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = shs,
- .label = label,
- .run = &stop_testing_system_run,
- .cleanup = &stop_testing_system_cleanup,
- .traits = &stop_testing_system_traits
- };
-
- return cmd;
-}
diff --git a/src/testing/testing_api_cmd_netjail_stop_v2.c b/src/testing/testing_api_cmd_netjail_stop_v2.c
deleted file mode 100644
index 8c1f3cedd..000000000
--- a/src/testing/testing_api_cmd_netjail_stop_v2.c
+++ /dev/null
@@ -1,225 +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
- */
-
-/**
- * @file testing/testing_api_cmd_hello_world.c
- * @brief Command to stop the netjail script.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_testing_ng_lib.h"
-
-
-#define NETJAIL_STOP_SCRIPT "./../testing/netjail_stop_v2.sh"
-
-// Child Wait handle
-static struct GNUNET_ChildWaitHandle *cwh;
-
-/**
- * Struct to hold information for callbacks.
- *
- */
-struct NetJailState
-{
- /**
- * Configuration file for the test topology.
- */
- char *topology_config;
-
- /**
- * The process id of the start script.
- */
- struct GNUNET_OS_Process *stop_proc;
-
- // Flag indication if the script finished.
- unsigned int finished;
-};
-
-
-/**
- * The cleanup function of this cmd frees resources the cmd allocated.
- *
- */
-static void
-netjail_stop_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
-{
- struct NetJailState *ns = cls;
-
- if (NULL != cwh)
- {
- GNUNET_wait_child_cancel (cwh);
- cwh = NULL;
- }
- if (NULL != ns->stop_proc)
- {
- GNUNET_assert (0 ==
- GNUNET_OS_process_kill (ns->stop_proc,
- SIGKILL));
- GNUNET_assert (GNUNET_OK ==
- GNUNET_OS_process_wait (ns->stop_proc));
- GNUNET_OS_process_destroy (ns->stop_proc);
- ns->stop_proc = NULL;
- }
-}
-
-
-/**
- * Trait function of this cmd does nothing.
- *
- */
-static int
-netjail_stop_traits (void *cls,
- const void **ret,
- const char *trait,
- unsigned int index)
-{
- return GNUNET_OK;
-}
-
-
-/**
- * Callback which will be called if the setup script finished.
- *
- */
-static void
-child_completed_callback (void *cls,
- enum GNUNET_OS_ProcessStatusType type,
- long unsigned int exit_code)
-{
- struct NetJailState *ns = cls;
-
- cwh = NULL;
- if (0 == exit_code)
- {
- ns->finished = GNUNET_YES;
- }
- else
- {
- ns->finished = GNUNET_SYSERR;
- }
- GNUNET_OS_process_destroy (ns->stop_proc);
- ns->stop_proc = NULL;
-}
-
-
-/**
-* The run method starts the script which deletes the network namespaces.
-*
-* @param cls closure.
-* @param cmd CMD being run.
-* @param is interpreter state.
-*/
-static void
-netjail_stop_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
- struct GNUNET_TESTING_Interpreter *is)
-{
- struct NetJailState *ns = cls;
- char *pid;
- GNUNET_asprintf (&pid,
- "%u",
- getpid ());
- char *const script_argv[] = {NETJAIL_STOP_SCRIPT,
- ns->topology_config,
- pid,
- NULL};
- unsigned int helper_check = GNUNET_OS_check_helper_binary (
- NETJAIL_STOP_SCRIPT,
- GNUNET_YES,
- NULL);
-
- if (GNUNET_NO == helper_check)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "No SUID for %s!\n",
- NETJAIL_STOP_SCRIPT);
- GNUNET_TESTING_interpreter_fail ();
- }
- else if (GNUNET_NO == helper_check)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%s not found!\n",
- NETJAIL_STOP_SCRIPT);
- GNUNET_TESTING_interpreter_fail ();
- }
-
- ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
- NULL,
- NULL,
- NULL,
- NETJAIL_STOP_SCRIPT,
- script_argv);
-
- cwh = GNUNET_wait_child (ns->stop_proc,
- &child_completed_callback,
- ns);
- GNUNET_break (NULL != cwh);
-
-}
-
-
-/**
- * This function checks the flag NetJailState#finished, if this cmd finished.
- *
- */
-static int
-netjail_stop_finish (void *cls,
- GNUNET_SCHEDULER_TaskCallback cont,
- void *cont_cls)
-{
- struct NetJailState *ns = cls;
-
- if (ns->finished)
- {
- cont (cont_cls);
- }
- return ns->finished;
-}
-
-
-/**
- * Create command.
- *
- * @param label name for command.
- * @param topology_config Configuration file for the test topology.
- * @return command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_netjail_stop_v2 (const char *label,
- char *topology_config)
-{
- struct NetJailState *ns;
-
- ns = GNUNET_new (struct NetJailState);
- ns->topology_config = topology_config;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = ns,
- .label = label,
- .run = &netjail_stop_run,
- .finish = &netjail_stop_finish,
- .cleanup = &netjail_stop_cleanup,
- .traits = &netjail_stop_traits
- };
-
- return cmd;
-}
diff --git a/src/testing/testing_api_cmd_send_peer_ready.c b/src/testing/testing_api_cmd_send_peer_ready.c
index 016837214..8b4c11deb 100644
--- a/src/testing/testing_api_cmd_send_peer_ready.c
+++ b/src/testing/testing_api_cmd_send_peer_ready.c
@@ -53,13 +53,13 @@ struct SendPeerReadyState
* Trait function of this cmd does nothing.
*
*/
-static int
+static enum GNUNET_GenericReturnValue
send_peer_ready_traits (void *cls,
const void **ret,
const char *trait,
unsigned int index)
{
- return GNUNET_OK;
+ return GNUNET_NO;
}
@@ -68,8 +68,7 @@ send_peer_ready_traits (void *cls,
*
*/
static void
-send_peer_ready_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+send_peer_ready_cleanup (void *cls)
{
struct SendPeerReadyState *sprs = cls;
@@ -84,7 +83,6 @@ send_peer_ready_cleanup (void *cls,
*/
static void
send_peer_ready_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct SendPeerReadyState *sprs = cls;
@@ -115,14 +113,15 @@ GNUNET_TESTING_cmd_send_peer_ready (const char *label,
sprs = GNUNET_new (struct SendPeerReadyState);
sprs->write_message = write_message;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = sprs,
- .label = label,
- .run = &send_peer_ready_run,
- .cleanup = &send_peer_ready_cleanup,
- .traits = &send_peer_ready_traits
- };
-
- return cmd;
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = sprs,
+ .label = label,
+ .run = &send_peer_ready_run,
+ .cleanup = &send_peer_ready_cleanup,
+ .traits = &send_peer_ready_traits
+ };
+
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_cmd_system_create.c b/src/testing/testing_api_cmd_system_create.c
index f3a0b1a4c..820adf1bd 100644
--- a/src/testing/testing_api_cmd_system_create.c
+++ b/src/testing/testing_api_cmd_system_create.c
@@ -46,7 +46,6 @@ struct TestSystemState
*/
static void
system_create_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct TestSystemState *tss = cls;
@@ -115,8 +114,7 @@ GNUNET_TESTING_get_trait_test_system (const struct
*
*/
static void
-system_create_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+system_create_cleanup (void *cls)
{
struct TestSystemState *tss = cls;
diff --git a/src/testing/testing_api_cmd_system_destroy.c b/src/testing/testing_api_cmd_system_destroy.c
index 5ed0c2fd2..338123d91 100644
--- a/src/testing/testing_api_cmd_system_destroy.c
+++ b/src/testing/testing_api_cmd_system_destroy.c
@@ -46,17 +46,18 @@ struct TestSystemState
*/
static void
system_destroy_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
struct GNUNET_TESTING_Interpreter *is)
{
struct TestSystemState *tss = cls;
const struct GNUNET_TESTING_Command *system_cmd;
struct GNUNET_TESTING_System *tl_system;
- system_cmd = GNUNET_TESTING_interpreter_lookup_command (tss->create_label);
+ system_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
+ tss->create_label);
GNUNET_TESTING_get_trait_test_system (system_cmd,
&tl_system);
- GNUNET_TESTING_system_destroy (tl_system, GNUNET_YES);
+ GNUNET_TESTING_system_destroy (tl_system,
+ GNUNET_YES);
}
@@ -65,8 +66,7 @@ system_destroy_run (void *cls,
*
*/
static void
-system_destroy_cleanup (void *cls,
- const struct GNUNET_TESTING_Command *cmd)
+system_destroy_cleanup (void *cls)
{
struct TestSystemState *tss = cls;
@@ -78,7 +78,7 @@ system_destroy_cleanup (void *cls,
* Trait function of this cmd does nothing.
*
*/
-static int
+static enum GNUNET_GenericReturnValue
system_destroy_traits (void *cls,
const void **ret,
const char *trait,
@@ -103,14 +103,15 @@ GNUNET_TESTING_cmd_system_destroy (const char *label,
tss = GNUNET_new (struct TestSystemState);
tss->create_label = create_label;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = tss,
- .label = label,
- .run = &system_destroy_run,
- .cleanup = &system_destroy_cleanup,
- .traits = &system_destroy_traits
- };
-
- return cmd;
+ {
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = tss,
+ .label = label,
+ .run = &system_destroy_run,
+ .cleanup = &system_destroy_cleanup,
+ .traits = &system_destroy_traits
+ };
+
+ return cmd;
+ }
}
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 0c24c0e26..3727d2543 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -24,67 +24,68 @@
* @author Christian Grothoff (GNU Taler testing)
* @author Marcello Stanisci (GNU Taler testing)
* @author t3sserakt
-*/
+ */
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_ng_lib.h"
#include "testing.h"
-#define CHECK_FINISHED_PERIOD \
- GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
-
-struct GNUNET_TESTING_Interpreter *is;
-
-
/**
- * Closure used to sync an asynchronous with an synchronous command.
+ * Global state of the interpreter, used by a command
+ * to access information about other commands.
*/
-struct SyncTaskClosure
+struct GNUNET_TESTING_Interpreter
{
/**
- * The asynchronous command the synchronous command waits for.
+ * Function to call with the test result.
*/
- const struct GNUNET_TESTING_Command *async_cmd;
+ GNUNET_TESTING_ResultCallback rc;
/**
- * The synchronous command that waits for the asynchronous command.
+ * Closure for @e rc.
*/
- const struct GNUNET_TESTING_Command *sync_cmd;
+ void *rc_cls;
/**
- * The interpreter of the test.
+ * Commands the interpreter will run.
*/
- struct GNUNET_TESTING_Interpreter *is;
-};
+ struct GNUNET_TESTING_Command *commands;
+ /**
+ * Interpreter task (if one is scheduled).
+ */
+ struct GNUNET_SCHEDULER_Task *task;
-/**
-* Closure used to run the finish task.
-*/
-struct FinishTaskClosure
-{
+ /**
+ * Final task that returns the result.
+ */
+ struct GNUNET_SCHEDULER_Task *final_task;
/**
- * The asynchronous command the synchronous command waits for.
+ * Task run on timeout.
*/
- const struct GNUNET_TESTING_Command *cmd;
+ struct GNUNET_SCHEDULER_Task *timeout_task;
/**
- * The interpreter of the test.
+ * Instruction pointer. Tells #interpreter_run() which instruction to run
+ * next. Need (signed) int because it gets -1 when rewinding the
+ * interpreter to the first CMD.
*/
- struct GNUNET_TESTING_Interpreter *is;
+ int ip;
+
+ /**
+ * Result of the testcases, #GNUNET_OK on success
+ */
+ enum GNUNET_GenericReturnValue result;
+
};
-/**
- * Lookup command by label.
- *
- * @param label label to look for
- * @return NULL if command was not found
- */
const struct GNUNET_TESTING_Command *
-GNUNET_TESTING_interpreter_lookup_command (const char *label)
+GNUNET_TESTING_interpreter_lookup_command (
+ struct GNUNET_TESTING_Interpreter *is,
+ const char *label)
{
if (NULL == label)
{
@@ -103,7 +104,7 @@ GNUNET_TESTING_interpreter_lookup_command (const char *label)
label)) )
return cmd;
- if (GNUNET_TESTING_cmd_is_batch (cmd))
+ if (GNUNET_TESTING_cmd_is_batch_ (cmd))
{
#define BATCH_INDEX 1
struct GNUNET_TESTING_Command *batch;
@@ -111,7 +112,7 @@ GNUNET_TESTING_interpreter_lookup_command (const char *label)
struct GNUNET_TESTING_Command *icmd;
const struct GNUNET_TESTING_Command *match;
- current = GNUNET_TESTING_cmd_batch_get_current (cmd);
+ current = GNUNET_TESTING_cmd_batch_get_current_ (cmd);
GNUNET_assert (GNUNET_OK ==
GNUNET_TESTING_get_trait_cmd (cmd,
BATCH_INDEX,
@@ -134,10 +135,58 @@ GNUNET_TESTING_interpreter_lookup_command (const char *label)
}
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Command not found: %s\n",
+ "Command `%s' not found\n",
label);
return NULL;
+}
+
+/**
+ * Finish the test run, return the final result.
+ *
+ * @param cls the `struct GNUNET_TESTING_Interpreter`
+ */
+static void
+finish_test (void *cls)
+{
+ struct GNUNET_TESTING_Interpreter *is = cls;
+ struct GNUNET_TESTING_Command *cmd;
+ const char *label;
+
+ is->final_task = NULL;
+ label = is->commands[is->ip].label;
+ if (NULL == label)
+ label = "END";
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Interpreter finishes at `%s' with status %d\n",
+ label,
+ is->result);
+ for (unsigned int j = 0;
+ NULL != (cmd = &is->commands[j])->label;
+ j++)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Cleaning up cmd %s\n",
+ cmd->label);
+ cmd->cleanup (cmd->cls);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Cleaned up cmd %s\n",
+ cmd->label);
+ }
+ if (NULL != is->task)
+ {
+ GNUNET_SCHEDULER_cancel (is->task);
+ is->task = NULL;
+ }
+ if (NULL != is->timeout_task)
+ {
+ GNUNET_SCHEDULER_cancel (is->timeout_task);
+ is->timeout_task = NULL;
+ }
+ GNUNET_free (is->commands);
+ is->rc (is->rc_cls,
+ is->result);
+ GNUNET_free (is);
}
@@ -163,15 +212,10 @@ interpreter_next (void *cls)
if (GNUNET_SYSERR == is->result)
return; /* ignore, we already failed! */
- if (GNUNET_TESTING_cmd_is_batch (cmd))
- {
- GNUNET_TESTING_cmd_batch_next (is);
- }
- else
- {
- cmd->finish_time = GNUNET_TIME_absolute_get ();
+ cmd->finish_time = GNUNET_TIME_absolute_get ();
+ if ( (! GNUNET_TESTING_cmd_is_batch_ (cmd)) ||
+ (! GNUNET_TESTING_cmd_batch_next_ (cmd->cls)) )
is->ip++;
- }
if (0 == (ipc % 1000))
{
if (0 != ipc)
@@ -188,237 +232,44 @@ interpreter_next (void *cls)
}
-/**
- * This function checks if the finish function of a command returns GNUNET_YES, when the command is finished. In this case the finish function might have called interpreter_next. IF GNUNET_NO was returned this function is added to the scheduler again. In case of an error interpreter_fail is called.
- *
- */
-static void
-run_finish_task_next (void *cls)
-{
- struct FinishTaskClosure *ftc = cls;
- const struct GNUNET_TESTING_Command *cmd = ftc->cmd;
- struct GNUNET_TESTING_Interpreter *is = ftc->is;
- unsigned int finished = cmd->finish (cmd->cls, &interpreter_next, is);
-
- if (GNUNET_YES == finished)
- {
- is->finish_task = NULL;
- }
- else if (GNUNET_NO == finished)
- {
- is->finish_task = GNUNET_SCHEDULER_add_delayed (CHECK_FINISHED_PERIOD,
- &run_finish_task_next, ftc);
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Next task finished with an error.\n");
- GNUNET_TESTING_interpreter_fail ();
- }
-
-}
-
-
-/**
- * This function checks if the finish function of an asynchronous command returns GNUNET_YES, when the command is finished. In this case the finish function might have called interpreter_next. IF GNUNET_NO was returned this function is added to the scheduler again. In case of an error interpreter_fail is called.
- *
- * //TODO run_finish_task_next and this function can be merged.
- *
- */
-static void
-run_finish_task_sync (void *cls)
-{
- struct SyncTaskClosure *stc = cls;
- const struct GNUNET_TESTING_Command *cmd = stc->async_cmd;
- const struct GNUNET_TESTING_Command *sync_cmd = stc->sync_cmd;
- struct FinishTaskClosure *ftc;
- struct SyncState *sync_state = sync_cmd->cls;
- struct GNUNET_SCHEDULER_Task *finish_task = sync_state->finish_task;
- unsigned int finished = cmd->finish (cmd->cls, &interpreter_next, is);
-
- GNUNET_assert (NULL != finish_task);
- ftc = GNUNET_new (struct FinishTaskClosure);
- ftc->cmd = stc->sync_cmd;
- ftc->is = stc->is;
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
- if (cmd->default_timeout.rel_value_us < now.abs_value_us
- - sync_state->start_finish_time.abs_value_us)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "The command with label %s did not finish its asynchronous task in time.\n",
- cmd->label);
- GNUNET_TESTING_interpreter_fail ();
- }
-
- if (GNUNET_YES == finished)
- {
- finish_task = NULL;
- }
- else if (GNUNET_NO == finished)
- {
- finish_task = GNUNET_SCHEDULER_add_delayed (CHECK_FINISHED_PERIOD,
- &run_finish_task_sync, stc);
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Sync task finished with an error.\n");
- GNUNET_TESTING_interpreter_fail ();
- }
-}
-
-
-/**
- * run method of the command created by the interpreter to wait for another command to finish.
- *
- */
-static void
-start_finish_on_ref (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
- struct GNUNET_TESTING_Interpreter *is)
-{
- struct SyncState *sync_state = cls;
- struct SyncTaskClosure *stc;
- const struct GNUNET_TESTING_Command *async_cmd;
-
- async_cmd = sync_state->async_cmd;
- stc = GNUNET_new (struct SyncTaskClosure);
- stc->async_cmd = async_cmd;
- stc->sync_cmd = cmd;
- stc->is = is;
- sync_state->start_finish_time = GNUNET_TIME_absolute_get ();
- sync_state->finish_task = GNUNET_SCHEDULER_add_delayed (
- CHECK_FINISHED_PERIOD,
- &run_finish_task_sync,
- stc);
-}
-
-
-/**
- * Create (synchronous) command that waits for another command to finish.
- * If @a cmd_ref did not finish after @a timeout, this command will fail
- * the test case.
- *
- * @param finish_label label for this command
- * @param cmd_ref reference to a previous command which we should
- * wait for (call `finish()` on)
- * @param timeout how long to wait at most for @a cmd_ref to finish
- * @return a finish-command.
- */
-const struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_finish (const char *finish_label,
- const char *cmd_ref,
- struct GNUNET_TIME_Relative timeout)
-{
- const struct GNUNET_TESTING_Command *async_cmd;
- struct SyncState *sync_state;
-
- async_cmd = GNUNET_TESTING_interpreter_lookup_command (cmd_ref);
- sync_state = GNUNET_new (struct SyncState);
- sync_state->async_cmd = async_cmd;
-
- struct GNUNET_TESTING_Command cmd = {
- .cls = sync_state,
- .label = finish_label,
- .run = &start_finish_on_ref,
- .asynchronous_finish = GNUNET_NO
- };
-
- return cmd;
-}
-
-
-const struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_make_unblocking (const struct GNUNET_TESTING_Command cmd)
-{
-
- GNUNET_assert (NULL != cmd.finish);
- const struct GNUNET_TESTING_Command async_cmd = {
- .cls = cmd.cls,
- .label = cmd.label,
- .run = cmd.run,
- .cleanup = cmd.cleanup,
- .traits = cmd.traits,
- .finish = cmd.finish,
- .asynchronous_finish = GNUNET_YES
- };
-
- return async_cmd;
-}
-
-
-/**
- * Current command failed, clean up and fail the test case.
- *
- * @param is interpreter of the test
- */
void
-GNUNET_TESTING_interpreter_fail ()
+GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is)
{
struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip];
if (GNUNET_SYSERR == is->result)
+ {
+ GNUNET_break (0);
return; /* ignore, we already failed! */
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "interpreter_fail!\n");
-
+ }
if (NULL != cmd)
{
- while (GNUNET_TESTING_cmd_is_batch (cmd))
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed at command `%s'\n",
+ cmd->label);
+ while (GNUNET_TESTING_cmd_is_batch_ (cmd))
{
- cmd = GNUNET_TESTING_cmd_batch_get_current (cmd);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Batch is at command `%s'\n",
+ cmd = GNUNET_TESTING_cmd_batch_get_current_ (cmd);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed in batch at command `%s'\n",
cmd->label);
}
-
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "cmd is NULL.\n");
+ "Failed with CMD being NULL!\n");
}
-
- if (NULL == cmd->label)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Failed at command `%s'\n",
- cmd->label);
-
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "cmd->label is NULL.\n");
- }
-
is->result = GNUNET_SYSERR;
- GNUNET_SCHEDULER_shutdown ();
+ GNUNET_assert (NULL == is->final_task);
+ is->final_task = GNUNET_SCHEDULER_add_now (&finish_test,
+ is);
}
-/**
- * Create command array terminator.
- *
- * @return a end-command.
- */
-struct GNUNET_TESTING_Command
-GNUNET_TESTING_cmd_end (void)
-{
- static struct GNUNET_TESTING_Command cmd;
- cmd.label = NULL;
-
- return cmd;
-}
-
-
-/**
- * Obtain current label.
- */
const char *
-GNUNET_TESTING_interpreter_get_current_label (struct
- GNUNET_TESTING_Interpreter *is)
+GNUNET_TESTING_interpreter_get_current_label (
+ struct GNUNET_TESTING_Interpreter *is)
{
struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip];
@@ -434,165 +285,195 @@ GNUNET_TESTING_interpreter_get_current_label (struct
static void
interpreter_run (void *cls)
{
- struct FinishTaskClosure *ftc;
struct GNUNET_TESTING_Interpreter *is = cls;
struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip];
is->task = NULL;
-
if (NULL == cmd->label)
{
-
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Running command END %p\n",
- is);
+ "Running command END\n");
is->result = GNUNET_OK;
- GNUNET_SCHEDULER_shutdown ();
+ finish_test (is);
return;
}
- else if (NULL != cmd)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Running command `%s' %p\n",
- cmd->label,
- is);
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Running command `%s'\n",
+ cmd->label);
cmd->start_time
= cmd->last_req_time
= GNUNET_TIME_absolute_get ();
cmd->num_tries = 1;
+ if (NULL != cmd->ac)
+ {
+ cmd->ac->is = is;
+ cmd->ac->cont = &interpreter_next;
+ cmd->ac->cont_cls = is;
+ cmd->ac->finished = GNUNET_NO;
+ }
cmd->run (cmd->cls,
- cmd,
is);
- if ((NULL != cmd->finish) && (GNUNET_NO == cmd->asynchronous_finish))
+ if (NULL == cmd->ac)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Next task will not be called directly!\n");
- ftc = GNUNET_new (struct FinishTaskClosure);
- ftc->cmd = cmd;
- ftc->is = is;
- is->finish_task = GNUNET_SCHEDULER_add_delayed (CHECK_FINISHED_PERIOD,
- &run_finish_task_next,
- ftc);
+ interpreter_next (is);
}
- else
+ else if ( (cmd->asynchronous_finish) &&
+ (NULL != cmd->ac->cont) )
{
+ cmd->ac->cont = NULL;
interpreter_next (is);
}
}
/**
- * Function run when the test terminates (good or bad).
- * Cleans up our state.
+ * Function run when the test terminates (good or bad) with timeout.
*
- * @param cls the interpreter state.
+ * @param cls the interpreter state
*/
static void
-do_shutdown (void *cls)
+do_timeout (void *cls)
{
- (void) cls;
- struct GNUNET_TESTING_Command *cmd;
- const char *label;
-
- label = is->commands[is->ip].label;
- if (NULL == label)
- label = "END";
+ struct GNUNET_TESTING_Interpreter *is = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Executing shutdown at `%s'\n",
- label);
+ is->timeout_task = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Terminating test due to global timeout\n");
+ is->result = GNUNET_SYSERR;
+ finish_test (is);
+}
- for (unsigned int j = 0;
- NULL != (cmd = &is->commands[j])->label;
- j++) {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Cleaning up cmd %s\n",
- cmd->label);
- cmd->cleanup (cmd->cls,
- cmd);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Cleaned up cmd %s\n",
- cmd->label);
- }
- if (NULL != is->finish_task)
- {
- GNUNET_SCHEDULER_cancel (is->finish_task);
- cmd->finish_task = NULL;
- }
+void
+GNUNET_TESTING_run (struct GNUNET_TESTING_Command *commands,
+ struct GNUNET_TIME_Relative timeout,
+ GNUNET_TESTING_ResultCallback rc,
+ void *rc_cls)
+{
+ struct GNUNET_TESTING_Interpreter *is;
+ unsigned int i;
- if (NULL != is->task)
- {
- GNUNET_SCHEDULER_cancel (is->task);
- is->task = NULL;
- }
- if (NULL != is->timeout_task)
- {
- GNUNET_SCHEDULER_cancel (is->timeout_task);
- is->timeout_task = NULL;
- }
- GNUNET_free (is->commands);
+ is = GNUNET_new (struct GNUNET_TESTING_Interpreter);
+ is->rc = rc;
+ is->rc_cls = rc_cls;
+ /* get the number of commands */
+ for (i = 0; NULL != commands[i].label; i++)
+ ;
+ is->commands = GNUNET_new_array (i + 1,
+ struct GNUNET_TESTING_Command);
+ memcpy (is->commands,
+ commands,
+ sizeof (struct GNUNET_TESTING_Command) * i);
+ is->timeout_task
+ = GNUNET_SCHEDULER_add_delayed (timeout,
+ &do_timeout,
+ is);
+ is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
+ is);
}
/**
- * Function run when the test terminates (good or bad) with timeout.
+ * Closure for #loop_run().
+ */
+struct MainParams
+{
+
+ /**
+ * NULL-label terminated array of commands.
+ */
+ struct GNUNET_TESTING_Command *commands;
+
+ /**
+ * Global timeout for the test.
+ */
+ struct GNUNET_TIME_Relative timeout;
+
+ /**
+ * Set to #EXIT_FAILURE on error.
+ */
+ int rv;
+};
+
+
+/**
+ * Function called with the final result of the test.
*
- * @param cls NULL
+ * @param cls the `struct MainParams`
+ * @param rv #GNUNET_OK if the test passed
*/
static void
-do_timeout (void *cls)
+handle_result (void *cls,
+ enum GNUNET_GenericReturnValue rv)
{
- (void) cls;
+ struct MainParams *mp = cls;
- is->timeout_task = NULL;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Terminating test due to timeout\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Test exits with status %d\n",
+ rv);
+ if (GNUNET_OK != rv)
+ mp->rv = EXIT_FAILURE;
GNUNET_SCHEDULER_shutdown ();
}
/**
- * Run the testsuite. Note, CMDs are copied into
- * the interpreter state because they are _usually_
- * defined into the "run" method that returns after
- * having scheduled the test interpreter.
+ * Main function to run the test cases.
*
- * @param is the interpreter state
- * @param commands the list of command to execute
- * @param timeout how long to wait
+ * @param cls a `struct MainParams *`
*/
+static void
+loop_run (void *cls)
+{
+ struct MainParams *mp = cls;
+
+ GNUNET_TESTING_run (mp->commands,
+ mp->timeout,
+ &handle_result,
+ mp);
+}
+
+
int
-GNUNET_TESTING_run (const char *cfg_filename,
- struct GNUNET_TESTING_Command *commands,
- struct GNUNET_TIME_Relative timeout)
+GNUNET_TESTING_main (struct GNUNET_TESTING_Command *commands,
+ struct GNUNET_TIME_Relative timeout)
{
- unsigned int i;
+ struct MainParams mp = {
+ .commands = commands,
+ .timeout = timeout,
+ .rv = EXIT_SUCCESS
+ };
- is = GNUNET_new (struct GNUNET_TESTING_Interpreter);
+ GNUNET_SCHEDULER_run (&loop_run,
+ &mp);
+ return mp.rv;
+}
- if (NULL != is->timeout_task)
+
+void
+GNUNET_TESTING_async_fail (struct GNUNET_TESTING_AsyncContext *ac)
+{
+ GNUNET_assert (GNUNET_NO == ac->finished);
+ ac->finished = GNUNET_SYSERR;
+ GNUNET_TESTING_interpreter_fail (ac->is);
+ if (NULL != ac->cont)
{
- GNUNET_SCHEDULER_cancel (is->timeout_task);
- is->timeout_task = NULL;
+ ac->cont (ac->cont_cls);
+ ac->cont = NULL;
}
- /* get the number of commands */
- for (i = 0; NULL != commands[i].label; i++)
- ;
- is->commands = GNUNET_new_array (i + 1,
- struct GNUNET_TESTING_Command);
- memcpy (is->commands,
- commands,
- sizeof (struct GNUNET_TESTING_Command) * i);
+}
+
- is->timeout_task = GNUNET_SCHEDULER_add_delayed
- (timeout,
- &do_timeout,
- is);
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown, is);
- is->task = GNUNET_SCHEDULER_add_now (&interpreter_run, is);
- return GNUNET_OK;
+void
+GNUNET_TESTING_async_finish (struct GNUNET_TESTING_AsyncContext *ac)
+{
+ GNUNET_assert (GNUNET_NO == ac->finished);
+ ac->finished = GNUNET_OK;
+ if (NULL != ac->cont)
+ {
+ ac->cont (ac->cont_cls);
+ ac->cont = NULL;
+ }
}
diff --git a/src/testing/testing_api_trait_cmd.c b/src/testing/testing_api_trait_cmd.c
index 886baee5b..7afa8b264 100644
--- a/src/testing/testing_api_trait_cmd.c
+++ b/src/testing/testing_api_trait_cmd.c
@@ -41,7 +41,7 @@
* @param[out] _cmd where to write the wire details.
* @return #GNUNET_OK on success.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait_cmd (const struct GNUNET_TESTING_Command *cmd,
unsigned int index,
struct GNUNET_TESTING_Command **_cmd)
diff --git a/src/testing/testing_api_traits.c b/src/testing/testing_api_traits.c
index 66626833d..2f836ddfa 100644
--- a/src/testing/testing_api_traits.c
+++ b/src/testing/testing_api_traits.c
@@ -55,7 +55,7 @@ GNUNET_TESTING_trait_end ()
* @param index index number of the object to extract.
* @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits,
const void **ret,
const char *trait,
diff --git a/src/testing/testing_cmds.h b/src/testing/testing_cmds.h
index 7a5860aea..09e4f2dcb 100644
--- a/src/testing/testing_cmds.h
+++ b/src/testing/testing_cmds.h
@@ -83,6 +83,8 @@ struct GNUNET_CMDS_LOCAL_FINISHED
* Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED
*/
struct GNUNET_MessageHeader header;
+
+ enum GNUNET_GenericReturnValue result;
};
GNUNET_NETWORK_STRUCT_END
diff --git a/src/topology/Makefile.am b/src/topology/Makefile.am
index 8580d200c..e5920116b 100644
--- a/src/topology/Makefile.am
+++ b/src/topology/Makefile.am
@@ -42,10 +42,8 @@ gnunet_daemon_topology_LDADD = \
$(GN_LIBINTL)
-if HAVE_TESTING
check_PROGRAMS = \
test_gnunet_daemon_topology
-endif
if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 32075ee16..0df422976 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -128,11 +128,9 @@ noinst_PROGRAMS = \
$(WLAN_BIN_SENDER) \
$(WLAN_BIN_RECEIVER)
-if HAVE_TESTING
TESTING_LIBS = \
libgnunettransporttesting.la \
libgnunettransporttesting2.la
-endif
lib_LTLIBRARIES = \
libgnunettransport.la \
@@ -161,14 +159,9 @@ libgnunettransporttesting_la_LDFLAGS = \
libgnunettransporttesting2_la_SOURCES = \
transport_api_cmd_connecting_peers.c \
- transport_api_cmd_connecting_peers_v2.c \
- transport_api_cmd_connecting_peers_v3.c \
transport_api_cmd_start_peer.c \
- transport_api_cmd_start_peer_v2.c \
- transport_api_cmd_start_peer_v3.c \
transport_api_cmd_stop_peer.c \
transport_api_cmd_send_simple.c \
- transport_api_cmd_send_simple_v2.c \
transport-testing2.c transport-testing2.h \
transport-testing-cmds.h \
transport-testing-filenames2.c \
@@ -396,7 +389,6 @@ plugin_LTLIBRARIES = \
$(WLAN_PLUGIN_LA) \
$(BT_PLUGIN_LA) \
libgnunet_test_transport_plugin_cmd_simple_send.la \
- libgnunet_test_transport_plugin_cmd_simple_send_v2.la \
libgnunet_test_transport_plugin_cmd_udp_backchannel.la
libgnunet_test_transport_plugin_cmd_udp_backchannel_la_SOURCES = \
@@ -433,23 +425,6 @@ libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = \
libgnunet_test_transport_plugin_cmd_simple_send_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
-libgnunet_test_transport_plugin_cmd_simple_send_v2_la_SOURCES = \
- test_transport_plugin_cmd_simple_send_v2.c
-libgnunet_test_transport_plugin_cmd_simple_send_v2_la_LIBADD = \
- libgnunettransporttesting2.la \
- libgnunettransportapplication.la \
- libgnunettransportcore.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/arm/libgnunetarm.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(LTLIBINTL)
-libgnunet_test_transport_plugin_cmd_simple_send_v2_la_LDFLAGS = \
- $(GN_PLUGIN_LDFLAGS)
-
if HAVE_EXPERIMENTAL
plugin_LTLIBRARIES += \
libgnunet_plugin_transport_udp.la
@@ -594,10 +569,7 @@ libgnunet_plugin_transport_https_server_la_LDFLAGS = \
libgnunet_plugin_transport_https_server_la_CFLAGS = \
$(MHD_CFLAGS) $(AM_CFLAGS) -DBUILD_HTTPS
-if HAVE_TESTING
check_PROGRAMS = \
- test_transport_simple_send \
- test_transport_simple_send_v2 \
test_transport_start_with_config \
test_transport_address_switch_tcp \
test_transport_testing_startstop \
@@ -682,7 +654,6 @@ check_PROGRAMS += \
test_communicator_backchannel-udp \
test_communicator_bidirect-tcp
endif
-endif
if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
@@ -747,8 +718,6 @@ test_transport_api_slow_ats
endif
if HAVE_EXPERIMENTAL
TESTS += \
- test_transport_simple_send \
- test_transport_simple_send_v2 \
test_transport_start_with_config \
test_transport_address_switch_udp \
test_plugin_udp \
@@ -769,7 +738,6 @@ endif
check_SCRIPTS= \
test_transport_simple_send.sh \
- test_transport_simple_send_v2.sh \
test_transport_udp_backchannel.sh
test_transport_start_with_config_SOURCES = \
@@ -782,26 +750,6 @@ test_transport_start_with_config_LDADD = \
libgnunettransportcore.la \
libgnunettransporttesting2.la
-test_transport_simple_send_SOURCES = \
- test_transport_simple_send.c
-test_transport_simple_send_LDADD = \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- libgnunettransportcore.la \
- libgnunettransporttesting2.la
-
-test_transport_simple_send_v2_SOURCES = \
- test_transport_simple_send_v2.c
-test_transport_simple_send_v2_LDADD = \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- libgnunettransportcore.la \
- libgnunettransporttesting2.la
-
test_transport_testing_startstop_SOURCES = \
test_transport_testing_startstop.c
test_transport_testing_startstop_LDADD = \
diff --git a/src/transport/test_transport_plugin_cmd_simple_send.c b/src/transport/test_transport_plugin_cmd_simple_send.c
index 07255a1a5..5384bf24d 100644
--- a/src/transport/test_transport_plugin_cmd_simple_send.c
+++ b/src/transport/test_transport_plugin_cmd_simple_send.c
@@ -37,28 +37,34 @@
#define BASE_DIR "testdir"
-/**
- * The name for a specific test environment directory.
- *
- */
-char *testdir;
+#define TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf"
-/**
- * The name for the configuration file of the specific node.
- *
- */
-char *cfgname;
+struct TestState
+{
+ /**
+ * Callback to write messages to the master loop.
+ *
+ */
+ TESTING_CMD_HELPER_write_cb write_message;
-/**
- * Flag indicating if all peers have been started.
- *
- */
-unsigned int are_all_peers_started;
+ /**
+ * The name for a specific test environment directory.
+ *
+ */
+ char *testdir;
-/**
- * Flag indicating a received message.
- */
-unsigned int message_received;
+ /**
+ * The name for the configuration file of the specific node.
+ *
+ */
+ char *cfgname;
+};
+
+static struct GNUNET_TESTING_Command block_send;
+
+static struct GNUNET_TESTING_Command block_receive;
+
+static struct GNUNET_TESTING_Command connect_peers;
/**
@@ -83,7 +89,14 @@ static void
handle_test (void *cls,
const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
{
- message_received = GNUNET_YES;
+ struct GNUNET_TESTING_AsyncContext *ac;
+
+ GNUNET_TESTING_get_trait_async_context (&block_receive,
+ &ac);
+ if ((NULL == ac) || (NULL == ac->cont))
+ GNUNET_TESTING_async_fail (ac);
+ else
+ GNUNET_TESTING_async_finish (ac);
}
@@ -94,7 +107,62 @@ handle_test (void *cls,
static void
all_peers_started ()
{
- are_all_peers_started = GNUNET_YES;
+ struct GNUNET_TESTING_AsyncContext *ac;
+
+ GNUNET_TESTING_get_trait_async_context (&block_send,
+ &ac);
+ if ((NULL == ac) || (NULL == ac->cont))
+ GNUNET_TESTING_async_fail (ac);
+ else
+ GNUNET_TESTING_async_finish (ac);
+}
+
+
+/**
+ * Function called with the final result of the test.
+ *
+ * @param cls the `struct MainParams`
+ * @param rv #GNUNET_OK if the test passed
+ */
+static void
+handle_result (void *cls,
+ enum GNUNET_GenericReturnValue rv)
+{
+ struct TestState *ts = cls;
+ struct GNUNET_MessageHeader *reply;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Local test exits with status %d\n",
+ rv);
+ reply = GNUNET_TESTING_send_local_test_finished_msg (rv);
+
+ ts->write_message (reply,
+ ntohs (reply->size));
+ GNUNET_free (ts->testdir);
+ GNUNET_free (ts->cfgname);
+ GNUNET_free (ts);
+}
+
+
+/**
+ * Callback from start peer cmd for signaling a peer got connected.
+ *
+ */
+static void *
+notify_connect (void *cls,
+ const struct GNUNET_PeerIdentity *peer,
+ struct GNUNET_MQ_Handle *mq)
+{
+ struct ConnectPeersState *cps;
+
+ GNUNET_TESTING_get_trait_connect_peer_state (&connect_peers,
+ &cps);
+ void *ret = NULL;
+
+ cps->notify_connect (cps,
+ peer,
+ mq);
+ return ret;
}
@@ -116,24 +184,46 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
char *local_m)
{
- GNUNET_asprintf (&cfgname,
- "test_transport_api2_tcp_node%s.conf",
- "1");
+ unsigned int n_int;
+ unsigned int m_int;
+ unsigned int local_m_int;
+ unsigned int num;
+ struct TestState *ts = GNUNET_new (struct TestState);
+ struct GNUNET_TESTING_NetjailTopology *topology =
+ GNUNET_TESTING_get_topo_from_file (TOPOLOGY_CONFIG);
+
+ if (0 == m_int)
+ num = n_int;
+ else
+ num = (n_int - 1) * local_m_int + m_int + topology->nodes_x;
+
+ block_send = GNUNET_TESTING_cmd_block_until_external_trigger ("block");
+ block_receive = GNUNET_TESTING_cmd_block_until_external_trigger (
+ "block-receive");
+ connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers",
+ "start-peer",
+ "system-create",
+ num,
+ NULL);
+
+
+
+ sscanf (m, "%u", &m_int);
+ sscanf (n, "%u", &n_int);
+ sscanf (local_m, "%u", &local_m_int);
+
+ GNUNET_asprintf (&ts->cfgname,
+ "test_transport_api2_tcp_node1.conf");
LOG (GNUNET_ERROR_TYPE_ERROR,
"plugin cfgname: %s\n",
- cfgname);
+ ts->cfgname);
LOG (GNUNET_ERROR_TYPE_ERROR,
"node ip: %s\n",
node_ip);
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "m: %s n: %s\n",
- m,
- n);
-
- GNUNET_asprintf (&testdir,
+ GNUNET_asprintf (&ts->testdir,
"%s%s%s",
BASE_DIR,
m,
@@ -143,49 +233,38 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
GNUNET_MQ_hd_var_size (test,
GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
struct GNUNET_TRANSPORT_TESTING_TestMessage,
- NULL),
+ ts),
GNUNET_MQ_handler_end ()
};
struct GNUNET_TESTING_Command commands[] = {
GNUNET_TESTING_cmd_system_create ("system-create",
- testdir),
+ ts->testdir),
GNUNET_TRANSPORT_cmd_start_peer ("start-peer",
"system-create",
- m,
- n,
- local_m,
+ num,
node_ip,
handlers,
- cfgname),
+ ts->cfgname,
+ notify_connect),
GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready",
write_message),
- GNUNET_TESTING_cmd_block_until_all_peers_started ("block",
- &are_all_peers_started),
- GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers",
- "start-peer",
- "system-create",
- (atoi (n) - 1) * atoi (local_m) + atoi (
- m)),
+ block_send,
+ connect_peers,
GNUNET_TRANSPORT_cmd_send_simple ("send-simple",
- m,
- n,
- (atoi (n) - 1) * atoi (local_m) + atoi (
- m),
- "start-peer"),
- GNUNET_TESTING_cmd_block_until_external_trigger ("block-receive",
- &message_received),
+ "start-peer",
+ num),
+ block_receive,
GNUNET_TRANSPORT_cmd_stop_peer ("stop-peer",
"start-peer"),
GNUNET_TESTING_cmd_system_destroy ("system-destroy",
- "system-create"),
- GNUNET_TESTING_cmd_local_test_finished ("local-test-finished",
- write_message)
+ "system-create")
};
- GNUNET_TESTING_run (NULL,
- commands,
- GNUNET_TIME_UNIT_FOREVER_REL);
+ GNUNET_TESTING_run (commands,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ &handle_result,
+ ts);
}
@@ -220,8 +299,6 @@ libgnunet_test_transport_plugin_cmd_simple_send_done (void *cls)
struct GNUNET_TESTING_PluginFunctions *api = cls;
GNUNET_free (api);
- GNUNET_free (testdir);
- GNUNET_free (cfgname);
return NULL;
}
diff --git a/src/transport/test_transport_plugin_cmd_simple_send_v2.c b/src/transport/test_transport_plugin_cmd_simple_send_v2.c
deleted file mode 100644
index c79b5c7e2..000000000
--- a/src/transport/test_transport_plugin_cmd_simple_send_v2.c
+++ /dev/null
@@ -1,234 +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
- */
-
-/**
- * @file testbed/plugin_cmd_simple_send.c
- * @brief a plugin to provide the API for running test cases.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_testing_ng_lib.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_transport_application_service.h"
-#include "transport-testing2.h"
-#include "transport-testing-cmds.h"
-
-/**
- * Generic logging shortcut
- */
-#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
-
-#define BASE_DIR "testdir"
-
-#define TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf"
-
-/**
- * The name for a specific test environment directory.
- *
- */
-char *testdir;
-
-/**
- * The name for the configuration file of the specific node.
- *
- */
-char *cfgname;
-
-/**
- * Flag indicating if all peers have been started.
- *
- */
-unsigned int are_all_peers_started;
-
-/**
- * Flag indicating a received message.
- */
-unsigned int message_received;
-
-
-/**
- * Function called to check a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE being
- * received.
- *
- */
-static int
-check_test (void *cls,
- const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
- return GNUNET_OK;
-}
-
-
-/**
- * Function called to handle a message of type GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE
- * being received.
- *
- */
-static void
-handle_test (void *cls,
- const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
-{
- message_received = GNUNET_YES;
-}
-
-
-/**
- * Callback to set the flag indicating all peers started. Will be called via the plugin api.
- *
- */
-static void
-all_peers_started ()
-{
- are_all_peers_started = GNUNET_YES;
-}
-
-
-/**
- * Function to start a local test case.
- *
- * @param write_message Callback to send a message to the master loop.
- * @param router_ip Global address of the network namespace.
- * @param node_ip Local address of a node i a network namespace.
- * @param m The number of the node in a network namespace.
- * @param n The number of the network namespace.
- * @param local_m The number of nodes in a network namespace.
- */
-static void
-start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
- char *node_ip,
- char *m,
- char *n,
- char *local_m)
-{
-
- unsigned int n_int, m_int, local_m_int, num;
-
- struct GNUNET_TESTING_NetjailTopology *topology =
- GNUNET_TESTING_get_topo_from_file (TOPOLOGY_CONFIG);
-
- sscanf (m, "%u", &m_int);
- sscanf (n, "%u", &n_int);
- sscanf (local_m, "%u", &local_m_int);
-
-
- if (0 == m_int)
- num = n_int;
- else
- num = (n_int - 1) * local_m_int + m_int + topology->nodes_x;
-
- GNUNET_asprintf (&cfgname,
- "test_transport_api2_tcp_node1.conf");
-
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "plugin cfgname: %s\n",
- cfgname);
-
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "node ip: %s\n",
- node_ip);
-
- GNUNET_asprintf (&testdir,
- "%s%s%s",
- BASE_DIR,
- m,
- n);
-
- struct GNUNET_MQ_MessageHandler handlers[] = {
- GNUNET_MQ_hd_var_size (test,
- GNUNET_TRANSPORT_TESTING_SIMPLE_MTYPE,
- struct GNUNET_TRANSPORT_TESTING_TestMessage,
- NULL),
- GNUNET_MQ_handler_end ()
- };
-
- struct GNUNET_TESTING_Command commands[] = {
- GNUNET_TESTING_cmd_system_create ("system-create",
- testdir),
- GNUNET_TRANSPORT_cmd_start_peer_v2 ("start-peer",
- "system-create",
- num,
- node_ip,
- handlers,
- cfgname),
- GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready",
- write_message),
- GNUNET_TESTING_cmd_block_until_all_peers_started ("block",
- &are_all_peers_started),
- GNUNET_TRANSPORT_cmd_connect_peers_v2 ("connect-peers",
- "start-peer",
- "system-create",
- num),
- GNUNET_TRANSPORT_cmd_send_simple_v2 ("send-simple",
- "start-peer",
- num),
- GNUNET_TESTING_cmd_block_until_external_trigger ("block-receive",
- &message_received),
- GNUNET_TRANSPORT_cmd_stop_peer ("stop-peer",
- "start-peer"),
- GNUNET_TESTING_cmd_system_destroy ("system-destroy",
- "system-create"),
- GNUNET_TESTING_cmd_local_test_finished ("local-test-finished",
- write_message)
- };
-
- GNUNET_TESTING_run (NULL,
- commands,
- GNUNET_TIME_UNIT_FOREVER_REL);
-
-}
-
-
-/**
- * Entry point for the plugin.
- *
- * @param cls NULL
- * @return the exported block API
- */
-void *
-libgnunet_test_transport_plugin_cmd_simple_send_init (void *cls)
-{
- struct GNUNET_TESTING_PluginFunctions *api;
-
- api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions);
- api->start_testcase = &start_testcase;
- api->all_peers_started = &all_peers_started;
- return api;
-}
-
-
-/**
- * Exit point from the plugin.
- *
- * @param cls the return value from #libgnunet_test_transport_plugin_block_test_init
- * @return NULL
- */
-void *
-libgnunet_test_transport_plugin_cmd_simple_send_done (void *cls)
-{
- struct GNUNET_TESTING_PluginFunctions *api = cls;
-
- GNUNET_free (api);
- GNUNET_free (testdir);
- GNUNET_free (cfgname);
- return NULL;
-}
-
-
-/* end of plugin_cmd_simple_send.c */
diff --git a/src/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
index 90e474aea..108e1ac09 100644
--- a/src/transport/test_transport_plugin_cmd_udp_backchannel.c
+++ b/src/transport/test_transport_plugin_cmd_udp_backchannel.c
@@ -39,28 +39,32 @@
#define TOPOLOGY_CONFIG "test_transport_udp_backchannel_topo.conf"
-/**
- * The name for a specific test environment directory.
- *
- */
-char *testdir;
+struct TestState
+{
+ /**
+ * Callback to write messages to the master loop.
+ *
+ */
+ TESTING_CMD_HELPER_write_cb write_message;
-/**
- * The name for the configuration file of the specific node.
- *
- */
-char *cfgname;
+ /**
+ * The name for a specific test environment directory.
+ *
+ */
+ char *testdir;
-/**
- * Flag indicating if all peers have been started.
- *
- */
-unsigned int are_all_peers_started;
+ /**
+ * The name for the configuration file of the specific node.
+ *
+ */
+ char *cfgname;
+};
-/**
- * Flag indicating a received message.
- */
-unsigned int message_received;
+static struct GNUNET_TESTING_Command block_send;
+
+static struct GNUNET_TESTING_Command block_receive;
+
+static struct GNUNET_TESTING_Command connect_peers;
/**
@@ -85,7 +89,14 @@ static void
handle_test (void *cls,
const struct GNUNET_TRANSPORT_TESTING_TestMessage *message)
{
- message_received = GNUNET_YES;
+ struct GNUNET_TESTING_AsyncContext *ac;
+
+ GNUNET_TESTING_get_trait_async_context (&block_receive,
+ &ac);
+ if ((NULL == ac) || (NULL == ac->cont))
+ GNUNET_TESTING_async_fail (ac);
+ else
+ GNUNET_TESTING_async_finish (ac);
}
@@ -96,10 +107,62 @@ handle_test (void *cls,
static void
all_peers_started ()
{
- are_all_peers_started = GNUNET_YES;
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "setting are_all_peers_started: %d\n",
- are_all_peers_started);
+ struct GNUNET_TESTING_AsyncContext *ac;
+
+ GNUNET_TESTING_get_trait_async_context (&block_send,
+ &ac);
+ if ((NULL == ac) || (NULL == ac->cont))
+ GNUNET_TESTING_async_fail (ac);
+ else
+ GNUNET_TESTING_async_finish (ac);
+}
+
+
+/**
+* Function called with the final result of the test.
+*
+* @param cls the `struct MainParams`
+* @param rv #GNUNET_OK if the test passed
+*/
+static void
+handle_result (void *cls,
+ enum GNUNET_GenericReturnValue rv)
+{
+ struct TestState *ts = cls;
+ struct GNUNET_MessageHeader *reply;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Local test exits with status %d\n",
+ rv);
+ reply = GNUNET_TESTING_send_local_test_finished_msg (rv);
+
+ ts->write_message (reply,
+ ntohs (reply->size));
+ GNUNET_free (ts->testdir);
+ GNUNET_free (ts->cfgname);
+ GNUNET_free (ts);
+}
+
+
+/**
+ * Callback from start peer cmd for signaling a peer got connected.
+ *
+ */
+static void *
+notify_connect (void *cls,
+ const struct GNUNET_PeerIdentity *peer,
+ struct GNUNET_MQ_Handle *mq)
+{
+ struct ConnectPeersState *cps;
+
+ GNUNET_TESTING_get_trait_connect_peer_state (&connect_peers,
+ &cps);
+ void *ret = NULL;
+
+ cps->notify_connect (cps,
+ peer,
+ mq);
+ return ret;
}
@@ -121,7 +184,11 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
char *local_m)
{
- unsigned int n_int, m_int, local_m_int, num;
+ unsigned int n_int;
+ unsigned int m_int;
+ unsigned int local_m_int;
+ unsigned int num;
+ struct TestState *ts = GNUNET_new (struct TestState);
struct GNUNET_TESTING_NetjailTopology *topology =
GNUNET_TESTING_get_topo_from_file (TOPOLOGY_CONFIG);
@@ -136,18 +203,27 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
else
num = (n_int - 1) * local_m_int + m_int + topology->nodes_x;
- GNUNET_asprintf (&cfgname,
+ block_send = GNUNET_TESTING_cmd_block_until_external_trigger ("block");
+ block_receive = GNUNET_TESTING_cmd_block_until_external_trigger (
+ "block-receive");
+ connect_peers = GNUNET_TRANSPORT_cmd_connect_peers ("connect-peers",
+ "start-peer",
+ "system-create",
+ num,
+ NULL);
+
+ GNUNET_asprintf (&ts->cfgname,
"test_transport_api2_tcp_node1.conf");
LOG (GNUNET_ERROR_TYPE_ERROR,
"plugin cfgname: %s\n",
- cfgname);
+ ts->cfgname);
LOG (GNUNET_ERROR_TYPE_ERROR,
"node ip: %s\n",
node_ip);
- GNUNET_asprintf (&testdir,
+ GNUNET_asprintf (&ts->testdir,
"%s%s%s",
BASE_DIR,
m,
@@ -163,38 +239,32 @@ start_testcase (TESTING_CMD_HELPER_write_cb write_message, char *router_ip,
struct GNUNET_TESTING_Command commands[] = {
GNUNET_TESTING_cmd_system_create ("system-create",
- testdir),
- GNUNET_TRANSPORT_cmd_start_peer_v3 ("start-peer",
- "system-create",
- num,
- node_ip,
- handlers,
- cfgname),
+ ts->testdir),
+ GNUNET_TRANSPORT_cmd_start_peer ("start-peer",
+ "system-create",
+ num,
+ node_ip,
+ handlers,
+ ts->cfgname,
+ notify_connect),
GNUNET_TESTING_cmd_send_peer_ready ("send-peer-ready",
write_message),
- GNUNET_TESTING_cmd_block_until_all_peers_started ("block",
- &are_all_peers_started),
- GNUNET_TRANSPORT_cmd_connect_peers_v3 ("connect-peers",
- "start-peer",
- "system-create",
- num,
- topology),
- GNUNET_TRANSPORT_cmd_send_simple_v2 ("send-simple",
- "start-peer",
- num),
- GNUNET_TESTING_cmd_block_until_external_trigger ("block-receive",
- &message_received),
+ block_send,
+ connect_peers,
+ GNUNET_TRANSPORT_cmd_send_simple ("send-simple",
+ "start-peer",
+ num),
+ block_receive,
GNUNET_TRANSPORT_cmd_stop_peer ("stop-peer",
"start-peer"),
GNUNET_TESTING_cmd_system_destroy ("system-destroy",
- "system-create"),
- GNUNET_TESTING_cmd_local_test_finished ("local-test-finished",
- write_message)
+ "system-create")
};
- GNUNET_TESTING_run (NULL,
- commands,
- GNUNET_TIME_UNIT_FOREVER_REL);
+ GNUNET_TESTING_run (commands,
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ &handle_result,
+ ts);
}
@@ -233,8 +303,6 @@ libgnunet_test_transport_plugin_cmd_udp_backchannel_done (void *cls)
struct GNUNET_TESTING_PluginFunctions *api = cls;
GNUNET_free (api);
- GNUNET_free (testdir);
- GNUNET_free (cfgname);
return NULL;
}
diff --git a/src/transport/test_transport_port_forward.c b/src/transport/test_transport_port_forward.c
deleted file mode 100644
index d3233c2da..000000000
--- a/src/transport/test_transport_port_forward.c
+++ /dev/null
@@ -1,85 +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
- */
-
-/**
- * @file transport/test_transport_port_forward.c
- * @brief Test case executing a script which sends a test UDP message from a nated peer
- * to a global known peer. There is a tcp port forwarding in place towards the
- * natted peer to test the backchannel functionality of the TNG service.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_testing_ng_lib.h"
-#include "gnunet_util_lib.h"
-
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
-
-/**
- * Return value of the test.
- *
- */
-static unsigned int rv = 0;
-
-
-/**
- * Main function to run the test cases.
- *
- * @param cls not used.
- *
- */
-static void
-run (void *cls)
-{
- const char *topology_config = "test_topology_port_forward.conf";
-
- struct GNUNET_TESTING_Command commands[] = {
- GNUNET_TESTING_cmd_netjail_start_v2 ("netjail-start",
- topology_config),
- GNUNET_TESTING_cmd_netjail_start_testing_system_v2 ("netjail-start-testbed",
- topology_config,
- &rv),
- GNUNET_TESTING_cmd_stop_testing_system_v2 ("stop-testbed",
- "netjail-start-testbed",
- topology_config),
- GNUNET_TESTING_cmd_netjail_stop_v2 ("netjail-stop",
- topology_config),
- GNUNET_TESTING_cmd_end ()
- };
-
- GNUNET_TESTING_run (NULL,
- commands,
- TIMEOUT);
-}
-
-
-int
-main (int argc,
- char *const *argv)
-{
- GNUNET_log_setup ("test-netjail",
- "DEBUG",
- NULL);
- GNUNET_SCHEDULER_run (&run,
- NULL);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test finished!\n");
- return rv;
-}
diff --git a/src/transport/test_transport_simple_send.c b/src/transport/test_transport_simple_send.c
deleted file mode 100644
index 924990d0a..000000000
--- a/src/transport/test_transport_simple_send.c
+++ /dev/null
@@ -1,86 +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
- */
-
-/**
- * @file transport/test_transport_api_cmd_simple_send.c
- * @brief Test case executing a script which sends a test message between two peers.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_testing_ng_lib.h"
-#include "gnunet_util_lib.h"
-
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
-
-/**
- * Return value of the test.
- *
- */
-static unsigned int rv = 0;
-
-
-/**
- * Main function to run the test cases.
- *
- * @param cls not used.
- *
- */
-static void
-run (void *cls)
-{
- struct GNUNET_TESTING_Command commands[] = {
- GNUNET_TESTING_cmd_netjail_start ("netjail-start",
- "2",
- "1"),
- GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed",
- "2",
- "1",
- "libgnunet_test_transport_plugin_cmd_simple_send",
- &rv),
- GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed",
- "netjail-start-testbed",
- "2",
- "1"),
- GNUNET_TESTING_cmd_netjail_stop ("netjail-stop",
- "2",
- "1"),
- GNUNET_TESTING_cmd_end ()
- };
-
- GNUNET_TESTING_run (NULL,
- commands,
- TIMEOUT);
-}
-
-
-int
-main (int argc,
- char *const *argv)
-{
- GNUNET_log_setup ("test-netjail",
- "DEBUG",
- NULL);
- GNUNET_SCHEDULER_run (&run,
- NULL);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test finished!\n");
- return rv;
-}
diff --git a/src/transport/test_transport_simple_send.sh b/src/transport/test_transport_simple_send.sh
index 25d5b6797..2dd269fcc 100755
--- a/src/transport/test_transport_simple_send.sh
+++ b/src/transport/test_transport_simple_send.sh
@@ -1,2 +1,2 @@
#!/bin/bash
-exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_simple_send"
+exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_simple_send_topo.conf"
diff --git a/src/transport/test_transport_simple_send_v2.c b/src/transport/test_transport_simple_send_v2.c
deleted file mode 100644
index aeac1bfb6..000000000
--- a/src/transport/test_transport_simple_send_v2.c
+++ /dev/null
@@ -1,83 +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
- */
-
-/**
- * @file transport/test_transport_api_cmd_simple_send.c
- * @brief Test case executing a script which sends a test message between two peers.
- * @author t3sserakt
- */
-#include "platform.h"
-#include "gnunet_testing_ng_lib.h"
-#include "gnunet_util_lib.h"
-
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
-
-#define TOPOLOGY_CONFIG "test_transport_simple_send_topo.conf"
-
-/**
- * Return value of the test.
- *
- */
-static unsigned int rv = 0;
-
-
-/**
- * Main function to run the test cases.
- *
- * @param cls not used.
- *
- */
-static void
-run (void *cls)
-{
- struct GNUNET_TESTING_Command commands[] = {
- GNUNET_TESTING_cmd_netjail_start_v2 ("netjail-start",
- TOPOLOGY_CONFIG),
- GNUNET_TESTING_cmd_netjail_start_testing_system_v2 ("netjail-start-testbed",
- TOPOLOGY_CONFIG,
- &rv),
- GNUNET_TESTING_cmd_stop_testing_system_v2 ("stop-testbed",
- "netjail-start-testbed",
- TOPOLOGY_CONFIG),
- GNUNET_TESTING_cmd_netjail_stop_v2 ("netjail-stop",
- TOPOLOGY_CONFIG),
- GNUNET_TESTING_cmd_end ()
- };
-
- GNUNET_TESTING_run (NULL,
- commands,
- TIMEOUT);
-}
-
-
-int
-main (int argc,
- char *const *argv)
-{
- GNUNET_log_setup ("test-netjail",
- "DEBUG",
- NULL);
- GNUNET_SCHEDULER_run (&run,
- NULL);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test finished!\n");
- return rv;
-}
diff --git a/src/transport/test_transport_simple_send_v2.sh b/src/transport/test_transport_simple_send_v2.sh
deleted file mode 100755
index 8462d1849..000000000
--- a/src/transport/test_transport_simple_send_v2.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_simple_send_v2"
diff --git a/src/transport/test_transport_start_with_config.c b/src/transport/test_transport_start_with_config.c
index 795c157d7..932b0e583 100644
--- a/src/transport/test_transport_start_with_config.c
+++ b/src/transport/test_transport_start_with_config.c
@@ -20,7 +20,7 @@
/**
* @file transport/test_transport_start_with_config.c
- * @brief Test case executing a script which sends a test message between two peers.
+ * @brief Generic program to start testcases in an configurable topology.
* @author t3sserakt
*/
#include "platform.h"
@@ -29,57 +29,32 @@
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120)
-/**
- * Return value of the test.
- *
- */
-static unsigned int rv = 0;
-
-static char *topology_config;
-
-/**
- * Main function to run the test cases.
- *
- * @param cls not used.
- *
- */
-static void
-run (void *cls)
-{
- struct GNUNET_TESTING_Command commands[] = {
- GNUNET_TESTING_cmd_netjail_start_v2 ("netjail-start",
- topology_config),
- GNUNET_TESTING_cmd_netjail_start_testing_system_v2 ("netjail-start-testbed",
- topology_config,
- &rv),
- GNUNET_TESTING_cmd_stop_testing_system_v2 ("stop-testbed",
- "netjail-start-testbed",
- topology_config),
- GNUNET_TESTING_cmd_netjail_stop_v2 ("netjail-stop",
- topology_config),
- GNUNET_TESTING_cmd_end ()
- };
-
- GNUNET_TESTING_run (NULL,
- commands,
- TIMEOUT);
-}
-
int
main (int argc,
char *const *argv)
{
+ char *topology_config;
+
GNUNET_log_setup ("test-netjail",
"DEBUG",
NULL);
topology_config = argv[1];
- GNUNET_SCHEDULER_run (&run,
- NULL);
+ struct GNUNET_TESTING_Command commands[] = {
+ GNUNET_TESTING_cmd_netjail_start ("netjail-start",
+ topology_config),
+ GNUNET_TESTING_cmd_netjail_start_testing_system ("netjail-start-testbed",
+ topology_config),
+ GNUNET_TESTING_cmd_stop_testing_system ("stop-testbed",
+ "netjail-start-testbed",
+ topology_config),
+ GNUNET_TESTING_cmd_netjail_stop ("netjail-stop",
+ topology_config),
+ GNUNET_TESTING_cmd_end ()
+ };
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Test finished!\n");
- return rv;
+ return GNUNET_TESTING_main (commands,
+ TIMEOUT);
}
diff --git a/src/transport/transport-testing-cmds.h b/src/transport/transport-testing-cmds.h
index ecdabd35f..f6e34df62 100644
--- a/src/transport/transport-testing-cmds.h
+++ b/src/transport/transport-testing-cmds.h
@@ -29,92 +29,71 @@
#include "gnunet_testing_lib.h"
-struct StartPeerState_v2
+/**
+ * Struct to store information needed in callbacks.
+ *
+ */
+struct ConnectPeersState
{
/**
- * The ip of a node.
- */
- char *node_ip;
-
- /**
- * Receive callback
+ * Context for our asynchronous completion.
*/
- struct GNUNET_MQ_MessageHandler *handlers;
+ struct GNUNET_TESTING_AsyncContext ac;
- const char *cfgname;
+ GNUNET_TRANSPORT_NotifyConnect notify_connect;
/**
- * Peer's configuration
+ * The testing system of this node.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
-
- struct GNUNET_TESTING_Peer *peer;
+ struct GNUNET_TESTING_System *tl_system;
- /**
- * Peer identity
- */
- struct GNUNET_PeerIdentity id;
+ // Label of the cmd which started the test system.
+ const char *create_label;
/**
- * Peer's transport service handle
+ * Number globally identifying the node.
+ *
*/
- struct GNUNET_TRANSPORT_CoreHandle *th;
+ uint32_t num;
/**
- * Application handle
+ * Label of the cmd to start a peer.
+ *
*/
- struct GNUNET_TRANSPORT_ApplicationHandle *ah;
+ const char *start_peer_label;
/**
- * Peer's PEERSTORE Handle
+ * The peer identity of this peer.
+ *
*/
- struct GNUNET_PEERSTORE_Handle *ph;
+ struct GNUNET_PeerIdentity *id;
/**
- * Hello get task
+ * The topology of the test setup.
*/
- struct GNUNET_SCHEDULER_Task *rh_task;
+ struct GNUNET_TESTING_NetjailTopology *topology;
/**
- * Peer's transport get hello handle to retrieve peer's HELLO message
+ * Connections to other peers.
*/
- struct GNUNET_PEERSTORE_IterateContext *pic;
+ struct GNUNET_TESTING_NodeConnection *node_connections_head;
- /**
- * Hello
- */
- char *hello;
+ struct GNUNET_TESTING_Interpreter *is;
/**
- * Hello size
+ * Number of connections.
*/
- size_t hello_size;
-
- char *m;
-
- char *n;
-
- char *local_m;
-
- unsigned int finished;
-
- const char *system_label;
-
- /**
- * An unique number to identify the peer
- */
- unsigned int no;
-
- struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
-
- struct GNUNET_TESTING_System *tl_system;
-
+ unsigned int con_num;
};
-
struct StartPeerState
{
/**
+ * Context for our asynchronous completion.
+ */
+ struct GNUNET_TESTING_AsyncContext ac;
+
+ /**
* The ip of a node.
*/
char *node_ip;
@@ -179,8 +158,6 @@ struct StartPeerState
char *local_m;
- unsigned int finished;
-
const char *system_label;
/**
@@ -192,9 +169,24 @@ struct StartPeerState
struct GNUNET_TESTING_System *tl_system;
+ GNUNET_TRANSPORT_NotifyConnect notify_connect;
+
};
+/**
+ * Function to get the trait with the struct ConnectPeersState.
+ *
+ * @param[out] sps struct ConnectPeersState.
+ * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise.
+ *
+ */
+int
+GNUNET_TESTING_get_trait_connect_peer_state (
+ const struct GNUNET_TESTING_Command *cmd,
+ struct ConnectPeersState **cps);
+
+
int
GNUNET_TRANSPORT_get_trait_state (const struct
GNUNET_TESTING_Command
@@ -203,61 +195,28 @@ GNUNET_TRANSPORT_get_trait_state (const struct
struct GNUNET_TESTING_Command
-GNUNET_TRANSPORT_cmd_start_peer_v2 (const char *label,
- const char *system_label,
- uint32_t no,
- char *node_ip,
- struct GNUNET_MQ_MessageHandler *handlers,
- const char *cfgname);
-
-struct GNUNET_TESTING_Command
-GNUNET_TRANSPORT_cmd_start_peer_v3 (const char *label,
- const char *system_label,
- uint32_t no,
- char *node_ip,
- struct GNUNET_MQ_MessageHandler *handlers,
- const char *cfgname);
-
-struct GNUNET_TESTING_Command
GNUNET_TRANSPORT_cmd_start_peer (const char *label,
const char *system_label,
- char *m,
- char *n,
- char *local_m,
+ uint32_t no,
char *node_ip,
struct GNUNET_MQ_MessageHandler *handlers,
- const char *cfgname);
+ const char *cfgname,
+ GNUNET_TRANSPORT_NotifyConnect notify_connect);
+
struct GNUNET_TESTING_Command
GNUNET_TRANSPORT_cmd_stop_peer (const char *label,
const char *start_label);
+
struct GNUNET_TESTING_Command
GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
const char *start_peer_label,
const char *create_label,
- uint32_t num);
-
-struct GNUNET_TESTING_Command
-GNUNET_TRANSPORT_cmd_connect_peers_v2 (const char *label,
- const char *start_peer_label,
- const char *create_label,
- uint32_t num);
-
-struct GNUNET_TESTING_Command
-GNUNET_TRANSPORT_cmd_connect_peers_v3 (const char *label,
- const char *start_peer_label,
- const char *create_label,
- uint32_t num,
- struct GNUNET_TESTING_NetjailTopology *
- topology);
+ uint32_t num,
+ struct GNUNET_TESTING_NetjailTopology *
+ topology);
-struct GNUNET_TESTING_Command
-GNUNET_TRANSPORT_cmd_send_simple (const char *label,
- char *m,
- char *n,
- uint32_t num,
- const char *start_peer_label);
/**
* Create command.
@@ -270,43 +229,29 @@ GNUNET_TRANSPORT_cmd_send_simple (const char *label,
* @return command.
*/
struct GNUNET_TESTING_Command
-GNUNET_TRANSPORT_cmd_send_simple_v2 (const char *label,
- const char *start_peer_label,
- uint32_t num);
+GNUNET_TRANSPORT_cmd_send_simple (const char *label,
+ const char *start_peer_label,
+ uint32_t num);
+
+
+
+
int
GNUNET_TRANSPORT_get_trait_peer_id (const struct
GNUNET_TESTING_Command *cmd,
struct GNUNET_PeerIdentity **id);
+
int
GNUNET_TRANSPORT_get_trait_connected_peers_map (const struct
GNUNET_TESTING_Command
*cmd,
struct
- GNUNET_CONTAINER_MultiShortmap *
+ GNUNET_CONTAINER_MultiShortmap
+ *
*
connected_peers_map);
-
-int
-GNUNET_TRANSPORT_get_trait_connected_peers_map_v2 (const struct
- GNUNET_TESTING_Command
- *cmd,
- struct
- GNUNET_CONTAINER_MultiShortmap
- *
- *
- connected_peers_map);
-
-int
-GNUNET_TRANSPORT_get_trait_connected_peers_map_v3 (const struct
- GNUNET_TESTING_Command
- *cmd,
- struct
- GNUNET_CONTAINER_MultiShortmap
- *
- *
- connected_peers_map);
int
GNUNET_TRANSPORT_get_trait_hello_size (const struct
GNUNET_TESTING_Command
@@ -327,19 +272,5 @@ GNUNET_TRANSPORT_get_trait_application_handle (const struct
GNUNET_TRANSPORT_ApplicationHandle
**ah);
-int
-GNUNET_TRANSPORT_get_trait_application_handle_v2 (const struct
- GNUNET_TESTING_Command *cmd,
- struct
- GNUNET_TRANSPORT_ApplicationHandle
- **ah);
-
-int
-GNUNET_TRANSPORT_get_trait_application_handle_v3 (const struct
- GNUNET_TESTING_Command *cmd,
- struct
- GNUNET_TRANSPORT_ApplicationHandle
- **ah);
-
#endif
/* end of transport_testing.h */
diff --git a/src/transport/transport_api_cmd_connecting_peers.c b/src/transport/transport_api_cmd_connecting_peers.c
index 09ca9e54c..2e51363f6 100644
--- a/src/transport/transport_api_cmd_connecting_peers.c
+++ b/src/transport/transport_api_cmd_connecting_peers.c
@@ -36,199 +36,348 @@
*/
#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
-/**
- * Struct to store information needed in callbacks.
- *
- */
-struct ConnectPeersState
-{
- // Label of the cmd which started the test system.
- const char *create_label;
+#define CONNECT_ADDRESS_TEMPLATE_TCP "tcp-192.168.15.%u:60002"
- /**
- * Number globally identifying the node.
- *
- */
- uint32_t num;
+#define CONNECT_ADDRESS_TEMPLATE_UDP "udp-192.168.15.%u:60002"
- /**
- * Label of the cmd to start a peer.
- *
- */
- const char *start_peer_label;
+#define ROUTER_CONNECT_ADDRESS_TEMPLATE_TCP "tcp-92.68.150.%u:60002"
- /**
- * The peer identity of this peer.
- *
- */
- struct GNUNET_PeerIdentity *id;
-};
+#define ROUTER_CONNECT_ADDRESS_TEMPLATE_UDP "udp-92.68.150.%u:60002"
+#define GLOBAL_CONNECT_ADDRESS_TEMPLATE_TCP "tcp-92.68.151.%u:60002"
-/**
- * The run method of this cmd will connect to peers.
- *
- */
-static void
-connect_peers_run (void *cls,
- const struct GNUNET_TESTING_Command *cmd,
- struct GNUNET_TESTING_Interpreter *is)
+#define GLOBAL_CONNECT_ADDRESS_TEMPLATE_UDP "udp-92.68.151.%u:60002"
+
+#define PREFIX_TCP "tcp"
+
+#define PREFIX_UDP "udp"
+
+
+
+
+static struct GNUNET_PeerIdentity *
+get_pub_key (unsigned int num, struct GNUNET_TESTING_System *tl_system)
{
- struct ConnectPeersState *cps = cls;
- const struct GNUNET_TESTING_Command *system_cmd;
- struct GNUNET_TESTING_System *tl_system;
- struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key = GNUNET_new (struct
- GNUNET_CRYPTO_EddsaPrivateKey);
+ struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
struct GNUNET_CRYPTO_EddsaPublicKey *pub_key = GNUNET_new (struct
GNUNET_CRYPTO_EddsaPublicKey);
- ;
- const struct GNUNET_TESTING_Command *peer1_cmd;
- // const struct GNUNET_TESTING_Command *peer2_cmd;
- struct GNUNET_TRANSPORT_ApplicationHandle *ah;
- struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
- char *addr;
- // struct GNUNET_TIME_Absolute t;
- char *hello;
- // size_t *hello_size;
- enum GNUNET_NetworkType nt = 0;
- char *peer_id;
- struct GNUNET_PeerIdentity *id;
- struct GNUNET_PeerIdentity *other = GNUNET_new (struct GNUNET_PeerIdentity);
- uint32_t num;
+ struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key = GNUNET_new (struct
+ GNUNET_CRYPTO_EddsaPrivateKey);
- peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->start_peer_label);
- GNUNET_TRANSPORT_get_trait_application_handle (peer1_cmd,
- &ah);
+ priv_key = GNUNET_TESTING_hostkey_get (tl_system,
+ num,
+ peer);
- GNUNET_TRANSPORT_get_trait_hello (peer1_cmd,
- &hello);
+ GNUNET_CRYPTO_eddsa_key_get_public (priv_key,
+ pub_key);
+ peer->public_key = *pub_key;
+ return peer;
+}
- GNUNET_TRANSPORT_get_trait_peer_id (peer1_cmd,
- &id);
- system_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->create_label);
- GNUNET_TESTING_get_trait_test_system (system_cmd,
- &tl_system);
+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_ADDRESS_PREFIX *pos_prefix;
- if (2 == cps->num)
- num = 1;
- else
- num = 2;
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "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_ERROR,
+ "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_ERROR,
+ "prefix: %s\n",
+ pos_prefix->address_prefix);
+ }
+ }
+ return GNUNET_YES;
+}
+
+
+static int
+log_namespaces (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
+{
+ struct GNUNET_TESTING_NetjailNamespace *namespace = value;
+ struct GNUNET_TESTING_NetjailRouter *router = namespace->router;
+
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "router_tcp: %u router_udp: %u spaces: %u\n",
+ router->tcp_port,
+ router->udp_port,
+ namespace->namespace_n);
+ GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes, &log_nodes, NULL);
+ return GNUNET_YES;
+}
+static int
+log_topo (struct GNUNET_TESTING_NetjailTopology *topology)
+{
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "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;
+}
+
+
+static struct GNUNET_TESTING_NodeConnection *
+get_connections (unsigned int num, struct
+ GNUNET_TESTING_NetjailTopology *topology)
+{
+ struct GNUNET_TESTING_NetjailNode *node;
+ struct GNUNET_ShortHashCode *hkey;
+ struct GNUNET_HashCode hc;
+ struct GNUNET_TESTING_NetjailNamespace *namespace;
+ unsigned int namespace_n, node_m;
+ log_topo (topology);
- // if (strstr (hello, "60002") != NULL)
- if (2 == num)
+ hkey = GNUNET_new (struct GNUNET_ShortHashCode);
+ if (topology->nodes_x >= num)
{
- addr = "tcp-192.168.15.2:60002";
- peer_id = "F2F3X9G1YNCTXKK7A4J6M4ZM4BBSKC9DEXZVHCWQ475M0C7PNWCG";
+
+ GNUNET_CRYPTO_hash (&num, sizeof(num), &hc);
+ memcpy (hkey,
+ &hc,
+ sizeof (*hkey));
+ node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
+ hkey);
}
else
{
- addr = "tcp-192.168.15.1:60002";
- peer_id = "4TTC9WBSVP9RJT6DVEZ7E0TDW7TQXC11NR1EMR2F8ARS87WZ2730";
+ namespace_n = (unsigned int) floor ((num - topology->nodes_x)
+ / topology->nodes_m);
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n",
+ num,
+ topology->nodes_x,
+ topology->nodes_m,
+ namespace_n);
+ hkey = GNUNET_new (struct GNUNET_ShortHashCode);
+ GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc);
+ memcpy (hkey,
+ &hc,
+ sizeof (*hkey));
+ namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
+ hkey);
+ node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
+ hkey = GNUNET_new (struct GNUNET_ShortHashCode);
+ GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
+ memcpy (hkey,
+ &hc,
+ sizeof (*hkey));
+ node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
+ hkey);
}
- priv_key = GNUNET_TESTING_hostkey_get (tl_system,
- num,
- other);
- GNUNET_CRYPTO_eddsa_key_get_public (priv_key,
- pub_key);
+ return node->node_connections_head;
+}
- GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id,
- strlen (peer_id),
- &peer->public_key);
- peer->public_key = *pub_key;
+static unsigned int
+calculate_num (struct GNUNET_TESTING_NodeConnection *node_connection,
+ struct GNUNET_TESTING_NetjailTopology *topology)
+{
+ unsigned int n, m, num;
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "\nnum: %u\n peer_id: %s\n pub_key %s\n",
- num,
- peer_id,
- GNUNET_CRYPTO_eddsa_public_key_to_string (pub_key));
-
- cps->id = peer;
-
- // TODO This does not work, because the other peer is running in another local loop. We need to message between different local loops. For now we will create the hello manually with the known information about the other local peers.
- // ---------------------------------------------
- /*peer2_cmd = GNUNET_TESTING_interpreter_lookup_command (cps->peer2_label);
- GNUNET_TRANSPORT_get_trait_peer_id (peer2_cmd,
- &id);
- GNUNET_TRANSPORT_get_trait_hello (peer2_cmd,
- &hello);
- GNUNET_TRANSPORT_get_trait_hello_size (peer2_cmd,
- &hello_size);
-
- addr = GNUNET_HELLO_extract_address (hello,
- *hello_size,
- id,
- &nt,
- &t);*/
-
- // ----------------------------------------------
-
-
- GNUNET_TRANSPORT_application_validate (ah,
- peer,
- nt,
- addr);
+ 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;
+}
+
+
+static char *
+get_address (struct GNUNET_TESTING_NodeConnection *connection,
+ char *prefix)
+{
+ struct GNUNET_TESTING_NetjailNode *node;
+ char *addr;
+
+ node = connection->node;
+ if (connection->namespace_n == node->namespace_n)
+ {
+ if (0 == strcmp (PREFIX_TCP, prefix))
+ {
+
+ GNUNET_asprintf (&addr,
+ CONNECT_ADDRESS_TEMPLATE_TCP,
+ connection->node_n);
+ }
+ else if (0 == strcmp (PREFIX_UDP, prefix))
+ {
+ GNUNET_asprintf (&addr,
+ CONNECT_ADDRESS_TEMPLATE_UDP,
+ connection->node_n);
+ }
+ else
+ {
+ GNUNET_break (0);
+ }
+ }
+ else
+ {
+ if (0 == strcmp (PREFIX_TCP, prefix))
+ {
+
+ GNUNET_asprintf (&addr,
+ ROUTER_CONNECT_ADDRESS_TEMPLATE_TCP,
+ connection->namespace_n);
+ }
+ else if (0 == strcmp (PREFIX_UDP, prefix))
+ {
+ GNUNET_asprintf (&addr,
+ ROUTER_CONNECT_ADDRESS_TEMPLATE_UDP,
+ connection->namespace_n);
+ }
+ else
+ {
+ GNUNET_break (0);
+ }
+ }
+
+ return addr;
}
/**
- * The finish function of this cmd will check if the peer we are trying to connect to is in the connected peers map of the start peer cmd for this peer.
+ * The run method of this cmd will connect to peers.