aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS30
-rw-r--r--README3
-rwxr-xr-xbootstrap5
-rw-r--r--configure.ac3
-rwxr-xr-xcontrib/ci/jobs/2-deb-package/version.sh4
-rwxr-xr-xcontrib/ci/jobs/5-arm64-deb-package/version.sh4
m---------contrib/gana0
m---------contrib/handbook0
-rw-r--r--debian/changelog18
-rw-r--r--doc/man/gnunet-nse.13
-rw-r--r--meson.build80
-rw-r--r--po/POTFILES.in62
-rw-r--r--po/de.po493
-rw-r--r--po/es.po578
-rw-r--r--po/fr.po467
-rw-r--r--po/it.po466
-rw-r--r--po/sr.po565
-rw-r--r--po/sv.po519
-rw-r--r--po/vi.po522
-rw-r--r--po/zh_CN.po506
-rw-r--r--scripts/Makefile.am14
-rw-r--r--scripts/meson.build2
-rwxr-xr-xscripts/netjail/netjail_core.sh28
-rwxr-xr-xscripts/netjail/netjail_exec.sh15
-rwxr-xr-xscripts/netjail/netjail_start.sh7
-rwxr-xr-xscripts/netjail/netjail_stop.sh2
-rwxr-xr-xscripts/netjail/netjail_test_master.sh18
-rw-r--r--src/cli/core/gnunet-core.c8
-rw-r--r--src/cli/dht/gnunet-dht-put.c21
-rw-r--r--src/cli/gns/gnunet-gns.c9
-rw-r--r--src/cli/messenger/gnunet-messenger.c5
-rw-r--r--src/cli/nse/gnunet-nse.c19
-rw-r--r--src/cli/reclaim/gnunet-reclaim.c105
-rw-r--r--src/cli/reclaim/test_reclaim.conf12
-rwxr-xr-xsrc/cli/reclaim/test_reclaim_consume.sh6
-rwxr-xr-xsrc/cli/reclaim/test_reclaim_issue.sh2
-rwxr-xr-xsrc/cli/reclaim/test_reclaim_oidc.sh57
-rw-r--r--src/cli/util/gnunet-config.c248
-rw-r--r--src/cli/util/gnunet-ecc.c24
-rw-r--r--src/contrib/service/consensus/Makefile.am4
-rw-r--r--src/contrib/service/consensus/meson.build3
-rw-r--r--src/contrib/service/conversation/Makefile.am24
-rw-r--r--src/contrib/service/conversation/meson.build3
-rw-r--r--src/include/Makefile.am12
-rw-r--r--src/include/gnunet_arm_service.h82
-rw-r--r--src/include/gnunet_common.h485
-rw-r--r--src/include/gnunet_configuration_lib.h174
-rw-r--r--src/include/gnunet_crypto_lib.h190
-rw-r--r--src/include/gnunet_fs_service.h11
-rw-r--r--src/include/gnunet_getopt_lib.h20
-rw-r--r--src/include/gnunet_gns_service.h10
-rw-r--r--src/include/gnunet_helper_lib.h2
-rw-r--r--src/include/gnunet_json_lib.h71
-rw-r--r--src/include/gnunet_messenger_service.h35
-rw-r--r--src/include/gnunet_mq_lib.h79
-rw-r--r--src/include/gnunet_nat_service.h13
-rw-r--r--src/include/gnunet_pq_lib.h72
-rw-r--r--src/include/gnunet_protocols.h5
-rw-r--r--src/include/gnunet_reclaim_service.h77
-rw-r--r--src/include/gnunet_testbed_lib.h130
-rw-r--r--src/include/gnunet_testing_arm_lib.h47
-rw-r--r--src/include/gnunet_testing_barrier.h122
-rw-r--r--src/include/gnunet_testing_core_lib.h (renamed from src/include/gnunet_core_testing_lib.h)13
-rw-r--r--src/include/gnunet_testing_lib.h1120
-rw-r--r--src/include/gnunet_testing_loop_lib.h697
-rw-r--r--src/include/gnunet_testing_ng_lib.h115
-rw-r--r--src/include/gnunet_testing_plugin.h145
-rw-r--r--src/include/gnunet_testing_testbed_lib.h42
-rw-r--r--src/include/gnunet_testing_transport_lib.h (renamed from src/include/gnunet_transport_testing_ng_lib.h)34
-rw-r--r--src/include/gnunet_transport_application_service.h2
-rw-r--r--src/include/gnunet_transport_communication_service.h2
-rw-r--r--src/include/meson.build8
-rw-r--r--src/lib/Makefile.am9
-rw-r--r--src/lib/gnsrecord/Makefile.am5
-rw-r--r--src/lib/gnsrecord/test_gnsrecord_block_expiration.c3
-rw-r--r--src/lib/gnsrecord/test_gnsrecord_testvectors.c8
-rw-r--r--src/lib/json/json_helper.c428
-rw-r--r--src/lib/json/json_pack.c115
-rw-r--r--src/lib/meson.build1
-rw-r--r--src/lib/pq/Makefile.am2
-rw-r--r--src/lib/pq/meson.build4
-rw-r--r--src/lib/pq/pq_query_helper.c257
-rw-r--r--src/lib/pq/pq_result_helper.c381
-rw-r--r--src/lib/testing/.gitignore (renamed from src/service/testing/.gitignore)2
-rw-r--r--src/lib/testing/Makefile.am92
-rw-r--r--src/lib/testing/gnunet-cmds-helper.c530
-rw-r--r--src/lib/testing/gnunet-testing-netjail-launcher.c87
-rw-r--r--src/lib/testing/meson.build38
-rwxr-xr-xsrc/lib/testing/test_netjail_api.sh2
-rw-r--r--src/lib/testing/test_netjail_topo.conf12
-rw-r--r--src/lib/testing/test_testing_api.c130
-rw-r--r--src/lib/testing/test_testing_plugin_ping.c54
-rw-r--r--src/lib/testing/testing.conf (renamed from src/service/testing/testing.conf)0
-rw-r--r--src/lib/testing/testing_api_barrier.c51
-rw-r--r--src/lib/testing/testing_api_barrier.h81
-rw-r--r--src/lib/testing/testing_api_cmd_barrier_create.c106
-rw-r--r--src/lib/testing/testing_api_cmd_barrier_reached.c189
-rw-r--r--src/lib/testing/testing_api_cmd_batch.c (renamed from src/service/testing/testing_api_cmd_batch.c)63
-rw-r--r--src/lib/testing/testing_api_cmd_batch.h72
-rw-r--r--src/lib/testing/testing_api_cmd_exec.c254
-rw-r--r--src/lib/testing/testing_api_cmd_finish.c (renamed from src/service/testing/testing_api_cmd_finish.c)68
-rw-r--r--src/lib/testing/testing_api_cmd_get_topo.c214
-rw-r--r--src/lib/testing/testing_api_cmd_netjail_start.c (renamed from src/service/testing/testing_api_cmd_netjail_start.c)100
-rw-r--r--src/lib/testing/testing_api_cmd_netjail_start_cmds_helper.c586
-rw-r--r--src/lib/testing/testing_api_cmd_signal.c120
-rw-r--r--src/lib/testing/testing_api_cmd_stat.c161
-rw-r--r--src/lib/testing/testing_api_cmds.c92
-rw-r--r--src/lib/testing/testing_api_loop.c1012
-rw-r--r--src/lib/testing/testing_api_loop.h163
-rw-r--r--src/lib/testing/testing_api_main.c140
-rw-r--r--src/lib/testing/testing_api_topology.c1308
-rw-r--r--src/lib/testing/testing_api_topology.h (renamed from src/include/gnunet_testing_netjail_lib.h)386
-rw-r--r--src/lib/testing/testing_api_traits.c (renamed from src/service/testing/testing_api_traits.c)18
-rw-r--r--src/lib/testing/testing_cmds.h106
-rw-r--r--src/lib/util/.gitignore2
-rw-r--r--src/lib/util/Makefile.am2
-rw-r--r--src/lib/util/common_allocation.c261
-rw-r--r--src/lib/util/crypto_ecc.c21
-rw-r--r--src/lib/util/crypto_ecc_setup.c5
-rw-r--r--src/lib/util/crypto_elligator.c353
-rw-r--r--src/lib/util/crypto_pkey.c17
-rw-r--r--src/lib/util/crypto_symmetric.c2
-rw-r--r--src/lib/util/helper.c4
-rw-r--r--src/lib/util/scheduler.c39
-rw-r--r--src/lib/util/service.c596
-rw-r--r--src/lib/util/strings.c30
-rw-r--r--src/lib/util/test_crypto_blind.c1
-rw-r--r--src/lib/util/test_crypto_elligator.c187
-rw-r--r--src/plugin/datastore/Makefile.am6
-rw-r--r--src/plugin/namecache/Makefile.am3
-rw-r--r--src/plugin/peerstore/Makefile.am1
-rw-r--r--src/plugin/reclaim/plugin_gnsrecord_reclaim.c4
-rw-r--r--src/service/Makefile.am3
-rw-r--r--src/service/arm/Makefile.am23
-rw-r--r--src/service/arm/arm_api.c77
-rw-r--r--src/service/arm/testing_arm_cmd_start_peer.c293
-rw-r--r--src/service/arm/testing_arm_cmd_stop_peer.c174
-rw-r--r--src/service/arm/testing_arm_traits.c (renamed from src/service/transport/transport_api_traits.c)9
-rw-r--r--src/service/cadet/.gitignore25
-rw-r--r--src/service/cadet/gnunet-service-cadet_dht.c1
-rw-r--r--src/service/cadet/gnunet-service-cadet_hello.c1
-rw-r--r--src/service/cadet/meson.build4
-rw-r--r--src/service/core/Makefile.am37
-rw-r--r--src/service/core/meson.build14
-rw-r--r--src/service/core/test_core_plugin_cmd_just_run.c22
-rw-r--r--src/service/core/testing_core_cmd_connecting_peers.c (renamed from src/service/core/core_api_cmd_connecting_peers.c)33
-rw-r--r--src/service/datacache/Makefile.am6
-rw-r--r--src/service/datastore/Makefile.am14
-rw-r--r--src/service/datastore/meson.build3
-rw-r--r--src/service/dht/Makefile.am3
-rw-r--r--src/service/dht/gnunet-service-dht.c7
-rw-r--r--src/service/dht/meson.build14
-rw-r--r--src/service/fs/Makefile.am46
-rw-r--r--src/service/fs/fs_uri.c17
-rw-r--r--src/service/fs/gnunet-service-fs_cp.c2
-rw-r--r--src/service/gns/gns_tld_api.c32
-rw-r--r--src/service/hostlist/gnunet-daemon-hostlist_server.c2
-rw-r--r--src/service/identity/Makefile.am6
-rw-r--r--src/service/meson.build2
-rw-r--r--src/service/messenger/Makefile.am47
-rw-r--r--src/service/messenger/gnunet-service-messenger.c19
-rw-r--r--src/service/messenger/gnunet-service-messenger_handle.c9
-rw-r--r--src/service/messenger/gnunet-service-messenger_list_messages.c6
-rw-r--r--src/service/messenger/gnunet-service-messenger_member_session.c18
-rw-r--r--src/service/messenger/gnunet-service-messenger_message_recv.c1
-rw-r--r--src/service/messenger/gnunet-service-messenger_message_send.c1
-rw-r--r--src/service/messenger/gnunet-service-messenger_message_store.c9
-rw-r--r--src/service/messenger/gnunet-service-messenger_peer_store.c6
-rw-r--r--src/service/messenger/gnunet-service-messenger_room.c5
-rw-r--r--src/service/messenger/gnunet-service-messenger_service.c5
-rw-r--r--src/service/messenger/messenger-testing-cmds.h6
-rw-r--r--src/service/messenger/messenger_api.c130
-rw-r--r--src/service/messenger/messenger_api_contact_store.c2
-rw-r--r--src/service/messenger/messenger_api_handle.c20
-rw-r--r--src/service/messenger/messenger_api_list_tunnels.c6
-rw-r--r--src/service/messenger/messenger_api_message.c72
-rw-r--r--src/service/messenger/messenger_api_message_control.c5
-rw-r--r--src/service/messenger/messenger_api_message_kind.c13
-rw-r--r--src/service/messenger/messenger_api_message_kind.h5
-rw-r--r--src/service/messenger/messenger_api_queue_messages.c5
-rw-r--r--src/service/messenger/messenger_api_room.c9
-rw-r--r--src/service/messenger/test_messenger.c1
-rw-r--r--src/service/messenger/test_messenger_plugin_cmd_simple_join.c8
-rw-r--r--src/service/messenger/testing_messenger.c (renamed from src/service/messenger/messenger-testing.c)0
-rw-r--r--src/service/messenger/testing_messenger.h (renamed from src/service/messenger/messenger-testing.h)0
-rw-r--r--src/service/messenger/testing_messenger_cmd_join_room.c (renamed from src/service/messenger/messenger_api_cmd_join_room.c)7
-rw-r--r--src/service/messenger/testing_messenger_cmd_start_service.c (renamed from src/service/messenger/messenger_api_cmd_start_service.c)13
-rw-r--r--src/service/messenger/testing_messenger_cmd_stop_service.c (renamed from src/service/messenger/messenger_api_cmd_stop_service.c)3
-rw-r--r--src/service/messenger/testing_messenger_traits.c (renamed from src/service/messenger/messenger_api_traits.c)0
-rw-r--r--src/service/namecache/Makefile.am4
-rw-r--r--src/service/namestore/Makefile.am7
-rw-r--r--src/service/namestore/gnunet-service-namestore.c9
-rw-r--r--src/service/namestore/meson.build4
-rw-r--r--src/service/nat/gnunet-service-nat.c76
-rw-r--r--src/service/nat/nat.h19
-rw-r--r--src/service/nat/nat_api.c28
-rw-r--r--src/service/nse/Makefile.am6
-rw-r--r--src/service/peerstore/Makefile.am10
-rw-r--r--src/service/peerstore/gnunet-service-peerstore.c25
-rw-r--r--src/service/peerstore/meson.build6
-rw-r--r--src/service/peerstore/peerstore_api.c39
-rw-r--r--src/service/peerstore/peerstore_api_monitor.c29
-rw-r--r--src/service/peerstore/peerstore_common.c1
-rw-r--r--src/service/pt/Makefile.am12
-rw-r--r--src/service/reclaim/gnunet-service-reclaim.c136
-rw-r--r--src/service/reclaim/gnunet-service-reclaim_tickets.c262
-rw-r--r--src/service/reclaim/gnunet-service-reclaim_tickets.h14
-rw-r--r--src/service/reclaim/reclaim.h26
-rw-r--r--src/service/reclaim/reclaim_api.c179
-rw-r--r--src/service/regex/Makefile.am14
-rw-r--r--src/service/rest/json_reclaim.c55
-rw-r--r--src/service/rest/oidc_helper.c93
-rw-r--r--src/service/rest/oidc_helper.h25
-rw-r--r--src/service/rest/openid_plugin.c85
-rw-r--r--src/service/rest/reclaim_plugin.c63
-rw-r--r--src/service/setu/gnunet-service-setu_strata_estimator.c8
-rw-r--r--src/service/statistics/Makefile.am5
-rw-r--r--src/service/testbed/.gitignore1
-rw-r--r--src/service/testbed/Makefile.am53
-rw-r--r--src/service/testbed/gnunet-testbed.c230
-rw-r--r--src/service/testbed/test_testbed_portreservation.c (renamed from src/service/testing/test_testing_portreservation.c)32
-rw-r--r--src/service/testbed/testbed.c579
-rw-r--r--src/service/testbed/testbed_api_cmd_system_create.c (renamed from src/service/testing/testing_api_cmd_system_create.c)31
-rw-r--r--src/service/testbed/testing_testbed_traits.c34
-rw-r--r--src/service/testing/Makefile.am134
-rw-r--r--src/service/testing/gnunet-cmds-helper.c713
-rw-r--r--src/service/testing/gnunet-testing.c444
-rw-r--r--src/service/testing/list-keys.c112
-rw-r--r--src/service/testing/meson.build62
-rw-r--r--src/service/testing/test_testing_defaults.conf25
-rw-r--r--src/service/testing/test_testing_peerstartup.c143
-rw-r--r--src/service/testing/test_testing_peerstartup2.c222
-rw-r--r--src/service/testing/test_testing_servicestartup.c75
-rw-r--r--src/service/testing/test_testing_sharedservices.c167
-rw-r--r--src/service/testing/test_testing_sharedservices.conf30
-rw-r--r--src/service/testing/test_testing_start_with_config.c121
-rw-r--r--src/service/testing/testing.c2830
-rw-r--r--src/service/testing/testing.h339
-rw-r--r--src/service/testing/testing_api_cmd_barrier.c206
-rw-r--r--src/service/testing/testing_api_cmd_barrier_reached.c229
-rw-r--r--src/service/testing/testing_api_cmd_block_until_external_trigger.c119
-rw-r--r--src/service/testing/testing_api_cmd_exec_bash_script.c216
-rw-r--r--src/service/testing/testing_api_cmd_local_test_prepared.c112
-rw-r--r--src/service/testing/testing_api_cmd_netjail_start_cmds_helper.c917
-rw-r--r--src/service/testing/testing_api_cmd_netjail_stop.c200
-rw-r--r--src/service/testing/testing_api_cmd_netjail_stop_cmds_helper.c157
-rw-r--r--src/service/testing/testing_api_cmd_send_peer_ready.c123
-rw-r--r--src/service/testing/testing_api_cmd_system_destroy.c111
-rw-r--r--src/service/testing/testing_api_loop.c893
-rw-r--r--src/service/testing/testing_cmds.h143
-rwxr-xr-xsrc/service/testing/topo.sh99
-rw-r--r--src/service/topology/gnunet-daemon-topology.c24
-rw-r--r--src/service/transport/Makefile.am147
-rw-r--r--src/service/transport/gnunet-communicator-tcp.c151
-rw-r--r--src/service/transport/gnunet-communicator-udp.c391
-rw-r--r--src/service/transport/gnunet-service-transport.c482
-rw-r--r--src/service/transport/meson.build52
-rw-r--r--src/service/transport/test_communicator_basic.c84
-rw-r--r--src/service/transport/test_communicator_udp_basic_peer1.conf1
-rw-r--r--src/service/transport/test_communicator_udp_rekey_peer1.conf3
-rw-r--r--src/service/transport/test_communicator_udp_rekey_peer2.conf2
-rw-r--r--src/service/transport/test_transport_plugin_cmd_simple_send_broadcast.c4
-rw-r--r--src/service/transport/test_transport_plugin_cmd_simple_send_performance.c4
-rw-r--r--src/service/transport/test_transport_plugin_cmd_udp_backchannel.c85
-rwxr-xr-xsrc/service/transport/test_transport_simple_send.sh13
-rw-r--r--src/service/transport/test_transport_start_with_config.c3
-rw-r--r--src/service/transport/testing_api_cmd_start_peer.c296
-rw-r--r--src/service/transport/testing_api_cmd_stop_peer.c130
-rw-r--r--src/service/transport/testing_transport_traits.c35
-rw-r--r--src/service/transport/transport-testing-cmds.h42
-rw-r--r--src/service/transport/transport-testing-communicator.c12
-rw-r--r--src/service/transport/transport-testing2.c1
-rw-r--r--src/service/transport/transport-testing2.h2
-rw-r--r--src/service/transport/transport_api2_communication.c10
-rw-r--r--src/service/transport/transport_api_cmd_backchannel_check.c19
-rw-r--r--src/service/transport/transport_api_cmd_connecting_peers.c26
-rw-r--r--src/service/transport/transport_api_cmd_send_simple.c5
-rw-r--r--src/service/transport/transport_api_cmd_send_simple_performance.c15
-rw-r--r--src/service/transport/transport_api_cmd_start_peer.c29
-rw-r--r--src/service/transport/transport_api_cmd_stop_peer.c3
280 files changed, 15771 insertions, 16506 deletions
diff --git a/NEWS b/NEWS
index c37107197..b8b1b37f9 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,33 @@
1v0.21.2:
2 - Reworked TESTING API
3 - Disabled many old-style tests
4
5v0.21.1:
6 - Communicator and connectivity bugfixes
7
8v0.21.0:
9 - Reworked PEERSTORE API
10 - Added record flag for maintenance records
11 - ensure traits can be generated with subsystem-specific prefixes for the symbols
12 - libgnunettesting first major testing NG refactor towards getting dependency structure streamlined
13 - Remove single-use API macro GNUNET_VA_ARG_ENUM
14 - major revision of blind signature API
15 - Introduced closure to hold store context when caling function to add hello in peerstore.
16 - Added DDLs for handling GNUNET_PEERSTORE_StoreHelloContext
17 - Removed old hello functionality.
18 - Refactoring components under src/ into lib/, plugin/, cli/ and service/
19 - add support for encoding/decoding double values as part of JSON to libgnunetjson
20 - Changed method GNUNET_HELLO_builder_get_expiration_time to not need parameter GNUNET_HELLO_Builder.
21 - Code moved to the core package to get rid of circular dependencies.
22 - Moved code to testing to have more generic test setup, which can be used not only from within transport.
23 - The old hello design replaced by the new hello design.
24 - Added api to get notified when hellos are stored with peerstore service.
25 - Added api to store hellos with peerstore service.
26 - Changed new hello uri api to allow to change the expiration time
27 - Moved start peer command to testing subsystem.
28 - Removed all usage of old transport api, beside peerinfo tool, gnunet-transport cli and usage in transport layer itself.
29 - Added __attribute__((deprecated)) to the old transport API
30
1v0.20.0: 31v0.20.0:
2 - GNUNET_TESTING_get_testname_from_underscore renamed to GNUNET_STRINGS_get_suffix_from_binary_name and moved from libgnunettesting to libgnuneutil 32 - GNUNET_TESTING_get_testname_from_underscore renamed to GNUNET_STRINGS_get_suffix_from_binary_name and moved from libgnunettesting to libgnuneutil
3 - Move GNUNET_s into libgnunetutil. 33 - Move GNUNET_s into libgnunetutil.
diff --git a/README b/README
index 73681657f..70b429036 100644
--- a/README
+++ b/README
@@ -82,7 +82,8 @@ Build tools for compiling GNUnet from source:
82- make[*3] 82- make[*3]
83- pkgconf or pkg-config 83- pkgconf or pkg-config
84- sphinx 84- sphinx
85- sphinx-book-theme 85- sphinx-rtd-theme
86- sphinx-multiversion
86 87
87Direct dependencies of GNUnet: 88Direct dependencies of GNUnet:
88~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 89~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/bootstrap b/bootstrap
index d5bf30af4..fb47649a7 100755
--- a/bootstrap
+++ b/bootstrap
@@ -136,7 +136,10 @@ main()
136 check_libtool 136 check_libtool
137 fi 137 fi
138 pogen 138 pogen
139 install_hooks 139 if test -d .git
140 then
141 install_hooks
142 fi
140} 143}
141 144
142main "$@" 145main "$@"
diff --git a/configure.ac b/configure.ac
index 316257f97..0e338c242 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1235,6 +1235,7 @@ src/lib/gnsrecord/Makefile
1235src/lib/json/Makefile 1235src/lib/json/Makefile
1236src/lib/pq/Makefile 1236src/lib/pq/Makefile
1237src/lib/sq/Makefile 1237src/lib/sq/Makefile
1238src/lib/testing/Makefile
1238src/plugin/Makefile 1239src/plugin/Makefile
1239src/plugin/block/Makefile 1240src/plugin/block/Makefile
1240src/plugin/datacache/Makefile 1241src/plugin/datacache/Makefile
@@ -1303,7 +1304,7 @@ src/service/setu/Makefile
1303src/service/setu/setu.conf 1304src/service/setu/setu.conf
1304src/service/statistics/Makefile 1305src/service/statistics/Makefile
1305src/service/statistics/statistics.conf 1306src/service/statistics/statistics.conf
1306src/service/testing/Makefile 1307src/service/testbed/Makefile
1307src/service/topology/Makefile 1308src/service/topology/Makefile
1308src/service/transport/Makefile 1309src/service/transport/Makefile
1309src/service/transport/transport.conf 1310src/service/transport/transport.conf
diff --git a/contrib/ci/jobs/2-deb-package/version.sh b/contrib/ci/jobs/2-deb-package/version.sh
index c5b4e395a..b12ca77ba 100755
--- a/contrib/ci/jobs/2-deb-package/version.sh
+++ b/contrib/ci/jobs/2-deb-package/version.sh
@@ -7,10 +7,10 @@ if [ -z "${BRANCH}" ]; then
7else 7else
8 # "Unshallow" our checkout, but only our current branch, and exclude the submodules. 8 # "Unshallow" our checkout, but only our current branch, and exclude the submodules.
9 git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}" 9 git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}"
10 RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --always --abbrev=0 HEAD) 10 RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-*dev*' --always --abbrev=0 HEAD || exit 1)
11 commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" 11 commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
12 if [ "${commits}" = "0" ]; then 12 if [ "${commits}" = "0" ]; then
13 git describe --tag HEAD 13 git describe --tag HEAD | sed -r 's/^v//' || exit 1
14 else 14 else
15 echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD) 15 echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD)
16 fi 16 fi
diff --git a/contrib/ci/jobs/5-arm64-deb-package/version.sh b/contrib/ci/jobs/5-arm64-deb-package/version.sh
index c5b4e395a..b12ca77ba 100755
--- a/contrib/ci/jobs/5-arm64-deb-package/version.sh
+++ b/contrib/ci/jobs/5-arm64-deb-package/version.sh
@@ -7,10 +7,10 @@ if [ -z "${BRANCH}" ]; then
7else 7else
8 # "Unshallow" our checkout, but only our current branch, and exclude the submodules. 8 # "Unshallow" our checkout, but only our current branch, and exclude the submodules.
9 git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}" 9 git fetch --no-recurse-submodules --tags --depth=1000 origin "${BRANCH}"
10 RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --always --abbrev=0 HEAD) 10 RECENT_VERSION_TAG=$(git describe --tags --match 'v*.*.*' --exclude '*-*dev*' --always --abbrev=0 HEAD || exit 1)
11 commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)" 11 commits="$(git rev-list ${RECENT_VERSION_TAG}..HEAD --count)"
12 if [ "${commits}" = "0" ]; then 12 if [ "${commits}" = "0" ]; then
13 git describe --tag HEAD 13 git describe --tag HEAD | sed -r 's/^v//' || exit 1
14 else 14 else
15 echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD) 15 echo $(echo ${RECENT_VERSION_TAG} | sed -r 's/^v//')-${commits}-$(git rev-parse --short=8 HEAD)
16 fi 16 fi
diff --git a/contrib/gana b/contrib/gana
Subproject 2b581279ae67a1068b07a8c010ac1ab7b85e18d Subproject cbe19e87d6da5f16e71573c85a717e986a43da6
diff --git a/contrib/handbook b/contrib/handbook
Subproject f9368db2bf8ce9eb6a9e951891142309c9c898d Subproject 7d66dc1695829f2511f8e8ecc227a64d73d1562
diff --git a/debian/changelog b/debian/changelog
index e8513fa22..b8b403baf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,21 @@
1gnunet (0.21.1-2) unstable; urgency=low
2
3 * Package for GNU Taler v0.11.0 release.
4
5 -- Christian Grothoff <grothoff@gnu.org> Wed, 15 May 2024 13:50:12 +0100
6
7gnunet (0.21.1-1) unstable; urgency=low
8
9 * Package for GNU Taler v0.10.0 release.
10
11 -- Christian Grothoff <grothoff@gnu.org> Fri, 12 Apr 2024 13:50:12 +0100
12
13gnunet (0.21.1) unstable; urgency=low
14
15 * Package for GNU Taler v0.10.0 pre-release.
16
17 -- Christian Grothoff <grothoff@gnu.org> Tue, 9 Apr 2024 13:50:12 +0100
18
1gnunet (0.21.0-3) unstable; urgency=low 19gnunet (0.21.0-3) unstable; urgency=low
2 20
3 * Package for GNU Taler v0.9.4. 21 * Package for GNU Taler v0.9.4.
diff --git a/doc/man/gnunet-nse.1 b/doc/man/gnunet-nse.1
index 5f2d02bfa..193173381 100644
--- a/doc/man/gnunet-nse.1
+++ b/doc/man/gnunet-nse.1
@@ -48,6 +48,9 @@ Use LOGLEVEL for logging.
48Valid values are DEBUG, INFO, WARNING and ERROR. 48Valid values are DEBUG, INFO, WARNING and ERROR.
49.It Fl l Ar LOGFILE | Fl -logfile= Ns Ar LOGFILE 49.It Fl l Ar LOGFILE | Fl -logfile= Ns Ar LOGFILE
50Configure logging to write logs to LOGFILE. 50Configure logging to write logs to LOGFILE.
51.It Fl m | -monitor
52In monitor mode, gnunet-nse will continuously print the NSE estimates,
53instead of giving just a snapshot.
51.It Fl v | -version 54.It Fl v | -version
52Print GNUnet version number. 55Print GNUnet version number.
53.El 56.El
diff --git a/meson.build b/meson.build
index 3547d9cfa..e0ed7543f 100644
--- a/meson.build
+++ b/meson.build
@@ -349,13 +349,6 @@ endif
349 349
350add_project_arguments('-DNEED_LIBGCRYPT_VERSION="1.6.0"', language : 'c') 350add_project_arguments('-DNEED_LIBGCRYPT_VERSION="1.6.0"', language : 'c')
351 351
352if cc.check_header('sys/time.h')
353 add_project_arguments('-DHAVE_SYS_TIME_H', language : 'c')
354endif
355if cc.check_header('sys/param.h')
356 add_project_arguments('-DHAVE_SYS_PARAM_H', language : 'c')
357endif
358
359# NSS 352# NSS
360have_nss = false 353have_nss = false
361if cc.check_header('nss.h') 354if cc.check_header('nss.h')
@@ -390,9 +383,6 @@ if not tun_found and cc.check_header('net/tun/if_tun.h')
390 endif 383 endif
391endif 384endif
392 385
393
394
395
396# NSS 386# NSS
397if cc.check_header('nss.h') 387if cc.check_header('nss.h')
398 add_project_arguments('-DHAVE_GLIBCNSS', language : 'c') 388 add_project_arguments('-DHAVE_GLIBCNSS', language : 'c')
@@ -422,30 +412,52 @@ endif
422if cc.has_function('getloadavg') == false 412if cc.has_function('getloadavg') == false
423 error('getloadadv missing') 413 error('getloadadv missing')
424endif 414endif
425if cc.has_function('strnlen', prefix : '#include <string.h>') 415
426 cdata.set('HAVE_STRNLEN', 1) 416syscalls = [
427endif 417 'memset_s', 'explicit_bzero', 'atoll', 'stat64',
428if cc.has_function('memset_s') 418 'mremap', 'getrlimit', 'setrlimit', 'gethostbyname2',
429 cdata.set('HAVE_MEMSET_S', 1) 419 'getpeerucred', 'getpeereid', 'setresuid', 'getifaddrs', 'freeifaddrs',
430endif 420 'getresgid', 'mallinfo2', 'malloc_size', 'malloc_usable_size', 'getrusage',
431if cc.has_function('explicit_bzero') 421 'random', 'srandom', 'stat', 'statfs', 'statvfs', 'wait4', 'timegm',
432 cdata.set('HAVE_EXPLICIT_BZERO', 1) 422 'getaddrinfo', 'initgroups', 'gethostbyname'
433endif 423]
434if cc.has_function('gethostbyname') 424
435 cdata.set('HAVE_GETHOSTBYNAME', 1) 425str_syscalls = [
436endif 426 'strnlen', 'strndup',
437if cc.has_function('gethostbyname2') 427]
438 cdata.set('HAVE_GETHOSTBYNAME2', 1) 428
439endif 429foreach f : syscalls
440if cc.has_function('getifaddrs') 430 if cc.has_function(f)
441 cdata.set('HAVE_GETIFADDRS', 1) 431 define = 'HAVE_' + f.underscorify().to_upper()
442endif 432 cdata.set(define, 1)
443if cc.has_function('freeifaddrs') 433 endif
444 cdata.set('HAVE_FREEIFADDRS', 1) 434endforeach
445endif 435
446if cc.check_header('ifaddrs.h') 436foreach f : str_syscalls
447 add_project_arguments('-DHAVE_IFADDRS_H', language : 'c') 437 if cc.has_function(f, prefix : '#include <string.h>')
448endif 438 define = 'HAVE_' + f.underscorify().to_upper()
439 cdata.set(define, 1)
440 endif
441endforeach
442
443
444headers = [
445 'stdatomic.h', 'malloc.h', 'malloc/malloc.h', 'malloc/malloc_np.h',
446 'langinfo.h', 'sys/param.h', 'sys/mount.h', 'sys/statvfs.h',
447 'sys/select.h', 'sockLib.h', 'sys/mman.h', 'sys/msg.h', 'sys/vfs.h',
448 'arpa/inet.h', 'libintl.h', 'netdb.h', 'netinet/in.h', 'sys/ioctl.h',
449 'sys/socket.h', 'sys/time.h', 'sys/sysinfo.h', 'sys/file.h', 'sys/resource.h',
450 'ifaddrs.h', 'mach/mach.h', 'sys/timeb.h', 'argz.h', 'ucred.h', 'sys/ucred.h',
451 'endian.h', 'sys/endian.h', 'execinfo.h', 'byteswap.h', 'sys/types.h'
452]
453
454foreach h : headers
455 if cc.check_header(h)
456 define = '-DHAVE_' + h.underscorify().to_upper()
457 message(define)
458 add_project_arguments(define, language : 'c')
459 endif
460endforeach
449 461
450configure_file(#input: 'gnunet_private_config.h.in', 462configure_file(#input: 'gnunet_private_config.h.in',
451 output : 'gnunet_private_config.h', 463 output : 'gnunet_private_config.h',
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7eb136496..db8808e2f 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -131,6 +131,24 @@ src/lib/sq/sq_exec.c
131src/lib/sq/sq_prepare.c 131src/lib/sq/sq_prepare.c
132src/lib/sq/sq_query_helper.c 132src/lib/sq/sq_query_helper.c
133src/lib/sq/sq_result_helper.c 133src/lib/sq/sq_result_helper.c
134src/lib/testing/gnunet-cmds-helper.c
135src/lib/testing/gnunet-testing-netjail-launcher.c
136src/lib/testing/testing_api_barrier.c
137src/lib/testing/testing_api_cmd_barrier_create.c
138src/lib/testing/testing_api_cmd_barrier_reached.c
139src/lib/testing/testing_api_cmd_batch.c
140src/lib/testing/testing_api_cmd_exec.c
141src/lib/testing/testing_api_cmd_finish.c
142src/lib/testing/testing_api_cmd_get_topo.c
143src/lib/testing/testing_api_cmd_netjail_start.c
144src/lib/testing/testing_api_cmd_netjail_start_cmds_helper.c
145src/lib/testing/testing_api_cmd_signal.c
146src/lib/testing/testing_api_cmd_stat.c
147src/lib/testing/testing_api_cmds.c
148src/lib/testing/testing_api_loop.c
149src/lib/testing/testing_api_main.c
150src/lib/testing/testing_api_topology.c
151src/lib/testing/testing_api_traits.c
134src/lib/util/bandwidth.c 152src/lib/util/bandwidth.c
135src/lib/util/benchmark.c 153src/lib/util/benchmark.c
136src/lib/util/bio.c 154src/lib/util/bio.c
@@ -241,6 +259,9 @@ src/service/arm/arm_api.c
241src/service/arm/arm_monitor_api.c 259src/service/arm/arm_monitor_api.c
242src/service/arm/gnunet-service-arm.c 260src/service/arm/gnunet-service-arm.c
243src/service/arm/mockup-service.c 261src/service/arm/mockup-service.c
262src/service/arm/testing_arm_cmd_start_peer.c
263src/service/arm/testing_arm_cmd_stop_peer.c
264src/service/arm/testing_arm_traits.c
244src/service/cadet/cadet_api.c 265src/service/cadet/cadet_api.c
245src/service/cadet/cadet_api_drop_message.c 266src/service/cadet/cadet_api_drop_message.c
246src/service/cadet/cadet_api_get_channel.c 267src/service/cadet/cadet_api_get_channel.c
@@ -259,12 +280,12 @@ src/service/cadet/gnunet-service-cadet_paths.c
259src/service/cadet/gnunet-service-cadet_peer.c 280src/service/cadet/gnunet-service-cadet_peer.c
260src/service/cadet/gnunet-service-cadet_tunnels.c 281src/service/cadet/gnunet-service-cadet_tunnels.c
261src/service/core/core_api.c 282src/service/core/core_api.c
262src/service/core/core_api_cmd_connecting_peers.c
263src/service/core/core_api_monitor_peers.c 283src/service/core/core_api_monitor_peers.c
264src/service/core/gnunet-service-core.c 284src/service/core/gnunet-service-core.c
265src/service/core/gnunet-service-core_kx.c 285src/service/core/gnunet-service-core_kx.c
266src/service/core/gnunet-service-core_sessions.c 286src/service/core/gnunet-service-core_sessions.c
267src/service/core/gnunet-service-core_typemap.c 287src/service/core/gnunet-service-core_typemap.c
288src/service/core/testing_core_cmd_connecting_peers.c
268src/service/datacache/datacache.c 289src/service/datacache/datacache.c
269src/service/datastore/datastore_api.c 290src/service/datastore/datastore_api.c
270src/service/datastore/gnunet-service-datastore.c 291src/service/datastore/gnunet-service-datastore.c
@@ -355,21 +376,22 @@ src/service/messenger/gnunet-service-messenger_peer_store.c
355src/service/messenger/gnunet-service-messenger_room.c 376src/service/messenger/gnunet-service-messenger_room.c
356src/service/messenger/gnunet-service-messenger_service.c 377src/service/messenger/gnunet-service-messenger_service.c
357src/service/messenger/gnunet-service-messenger_tunnel.c 378src/service/messenger/gnunet-service-messenger_tunnel.c
358src/service/messenger/messenger-testing.c
359src/service/messenger/messenger_api.c 379src/service/messenger/messenger_api.c
360src/service/messenger/messenger_api_cmd_join_room.c
361src/service/messenger/messenger_api_cmd_start_service.c
362src/service/messenger/messenger_api_cmd_stop_service.c
363src/service/messenger/messenger_api_contact.c 380src/service/messenger/messenger_api_contact.c
364src/service/messenger/messenger_api_contact_store.c 381src/service/messenger/messenger_api_contact_store.c
365src/service/messenger/messenger_api_handle.c 382src/service/messenger/messenger_api_handle.c
366src/service/messenger/messenger_api_list_tunnels.c 383src/service/messenger/messenger_api_list_tunnels.c
367src/service/messenger/messenger_api_message.c 384src/service/messenger/messenger_api_message.c
385src/service/messenger/messenger_api_message_control.c
368src/service/messenger/messenger_api_message_kind.c 386src/service/messenger/messenger_api_message_kind.c
369src/service/messenger/messenger_api_queue_messages.c 387src/service/messenger/messenger_api_queue_messages.c
370src/service/messenger/messenger_api_room.c 388src/service/messenger/messenger_api_room.c
371src/service/messenger/messenger_api_traits.c
372src/service/messenger/messenger_api_util.c 389src/service/messenger/messenger_api_util.c
390src/service/messenger/testing_messenger.c
391src/service/messenger/testing_messenger_cmd_join_room.c
392src/service/messenger/testing_messenger_cmd_start_service.c
393src/service/messenger/testing_messenger_cmd_stop_service.c
394src/service/messenger/testing_messenger_traits.c
373src/service/namecache/gnunet-service-namecache.c 395src/service/namecache/gnunet-service-namecache.c
374src/service/namecache/namecache_api.c 396src/service/namecache/namecache_api.c
375src/service/namestore/gnunet-service-namestore.c 397src/service/namestore/gnunet-service-namestore.c
@@ -439,26 +461,10 @@ src/service/setu/ibf_sim.c
439src/service/setu/setu_api.c 461src/service/setu/setu_api.c
440src/service/statistics/gnunet-service-statistics.c 462src/service/statistics/gnunet-service-statistics.c
441src/service/statistics/statistics_api.c 463src/service/statistics/statistics_api.c
442src/service/testing/gnunet-cmds-helper.c 464src/service/testbed/gnunet-testbed.c
443src/service/testing/gnunet-testing.c 465src/service/testbed/testbed.c
444src/service/testing/list-keys.c 466src/service/testbed/testbed_api_cmd_system_create.c
445src/service/testing/testing.c 467src/service/testbed/testing_testbed_traits.c
446src/service/testing/testing_api_cmd_barrier.c
447src/service/testing/testing_api_cmd_barrier_reached.c
448src/service/testing/testing_api_cmd_batch.c
449src/service/testing/testing_api_cmd_block_until_external_trigger.c
450src/service/testing/testing_api_cmd_exec_bash_script.c
451src/service/testing/testing_api_cmd_finish.c
452src/service/testing/testing_api_cmd_local_test_prepared.c
453src/service/testing/testing_api_cmd_netjail_start.c
454src/service/testing/testing_api_cmd_netjail_start_cmds_helper.c
455src/service/testing/testing_api_cmd_netjail_stop.c
456src/service/testing/testing_api_cmd_netjail_stop_cmds_helper.c
457src/service/testing/testing_api_cmd_send_peer_ready.c
458src/service/testing/testing_api_cmd_system_create.c
459src/service/testing/testing_api_cmd_system_destroy.c
460src/service/testing/testing_api_loop.c
461src/service/testing/testing_api_traits.c
462src/service/topology/gnunet-daemon-topology.c 468src/service/topology/gnunet-daemon-topology.c
463src/service/transport/gnunet-communicator-quic.c 469src/service/transport/gnunet-communicator-quic.c
464src/service/transport/gnunet-communicator-tcp.c 470src/service/transport/gnunet-communicator-tcp.c
@@ -466,8 +472,7 @@ src/service/transport/gnunet-communicator-udp.c
466src/service/transport/gnunet-communicator-unix.c 472src/service/transport/gnunet-communicator-unix.c
467src/service/transport/gnunet-service-transport.c 473src/service/transport/gnunet-service-transport.c
468src/service/transport/gnunet-transport.c 474src/service/transport/gnunet-transport.c
469src/service/transport/testing_api_cmd_start_peer.c 475src/service/transport/testing_transport_traits.c
470src/service/transport/testing_api_cmd_stop_peer.c
471src/service/transport/transport-testing-communicator.c 476src/service/transport/transport-testing-communicator.c
472src/service/transport/transport-testing-filenames2.c 477src/service/transport/transport-testing-filenames2.c
473src/service/transport/transport-testing-loggers2.c 478src/service/transport/transport-testing-loggers2.c
@@ -484,7 +489,6 @@ src/service/transport/transport_api_cmd_send_simple.c
484src/service/transport/transport_api_cmd_send_simple_performance.c 489src/service/transport/transport_api_cmd_send_simple_performance.c
485src/service/transport/transport_api_cmd_start_peer.c 490src/service/transport/transport_api_cmd_start_peer.c
486src/service/transport/transport_api_cmd_stop_peer.c 491src/service/transport/transport_api_cmd_stop_peer.c
487src/service/transport/transport_api_traits.c
488src/service/util/gnunet-service-resolver.c 492src/service/util/gnunet-service-resolver.c
489src/service/vpn/gnunet-helper-vpn.c 493src/service/vpn/gnunet-helper-vpn.c
490src/service/vpn/gnunet-service-vpn.c 494src/service/vpn/gnunet-service-vpn.c
diff --git a/po/de.po b/po/de.po
index a9d4dae66..ee474e0e6 100644
--- a/po/de.po
+++ b/po/de.po
@@ -10,7 +10,7 @@ msgid ""
10msgstr "" 10msgstr ""
11"Project-Id-Version: gnunet 0.10.1\n" 11"Project-Id-Version: gnunet 0.10.1\n"
12"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 12"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
13"POT-Creation-Date: 2024-03-02 14:38+0100\n" 13"POT-Creation-Date: 2024-05-20 20:21+0200\n"
14"PO-Revision-Date: 2015-03-08 16:16+0100\n" 14"PO-Revision-Date: 2015-03-08 16:16+0100\n"
15"Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n" 15"Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n"
16"Language-Team: German <translation-team-de@lists.sourceforge.net>\n" 16"Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
@@ -348,20 +348,25 @@ msgstr "Fehler beim Parsen der Gerätedaten von `%s' bei %s:%d.\n"
348msgid "Failed to connect to CORE service!\n" 348msgid "Failed to connect to CORE service!\n"
349msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 349msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
350 350
351#: src/cli/core/gnunet-core.c:230 src/service/transport/gnunet-transport.c:1389 351#: src/cli/core/gnunet-core.c:213
352#, fuzzy
353msgid "No argument given.\n"
354msgstr "# empfangene Ergebnisse"
355
356#: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389
352msgid "provide information about all current connections (continuously)" 357msgid "provide information about all current connections (continuously)"
353msgstr "" 358msgstr ""
354 359
355#: src/cli/core/gnunet-core.c:236 360#: src/cli/core/gnunet-core.c:244
356msgid "Show our current peer identity" 361msgid "Show our current peer identity"
357msgstr "" 362msgstr ""
358 363
359#: src/cli/core/gnunet-core.c:243 364#: src/cli/core/gnunet-core.c:251
360#, fuzzy 365#, fuzzy
361msgid "Show current connections" 366msgid "Show current connections"
362msgstr "GNUnet Konfiguration" 367msgstr "GNUnet Konfiguration"
363 368
364#: src/cli/core/gnunet-core.c:254 369#: src/cli/core/gnunet-core.c:262
365msgid "Print information about connected peers." 370msgid "Print information about connected peers."
366msgstr "Informationen über verbundene Knoten ausgeben." 371msgstr "Informationen über verbundene Knoten ausgeben."
367 372
@@ -1084,54 +1089,54 @@ msgstr "Auf die Namespace Informationen konnte nicht zugegriffen werden.\n"
1084msgid "Unindex a file that was previously indexed with gnunet-publish." 1089msgid "Unindex a file that was previously indexed with gnunet-publish."
1085msgstr "" 1090msgstr ""
1086 1091
1087#: src/cli/gns/gnunet-gns.c:268 1092#: src/cli/gns/gnunet-gns.c:269
1088#, fuzzy, c-format 1093#, fuzzy, c-format
1089msgid "`%s' is not a valid DNS domain name\n" 1094msgid "`%s' is not a valid DNS domain name\n"
1090msgstr "»%s« ist keine gültige IP-Adresse.\n" 1095msgstr "»%s« ist keine gültige IP-Adresse.\n"
1091 1096
1092#: src/cli/gns/gnunet-gns.c:279 src/lib/util/dnsparser.c:273 1097#: src/cli/gns/gnunet-gns.c:280 src/lib/util/dnsparser.c:273
1093#, c-format 1098#, c-format
1094msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" 1099msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
1095msgstr "" 1100msgstr ""
1096 1101
1097#: src/cli/gns/gnunet-gns.c:294 1102#: src/cli/gns/gnunet-gns.c:295
1098msgid "Cannot resolve using GNS: GNUnet peer not running\n" 1103msgid "Cannot resolve using GNS: GNUnet peer not running\n"
1099msgstr "" 1104msgstr ""
1100 1105
1101#: src/cli/gns/gnunet-gns.c:305 1106#: src/cli/gns/gnunet-gns.c:306
1102#: src/contrib/service/abd/gnunet-service-abd.c:1745 1107#: src/contrib/service/abd/gnunet-service-abd.c:1745
1103#, fuzzy, c-format 1108#, fuzzy, c-format
1104msgid "Failed to connect to GNS\n" 1109msgid "Failed to connect to GNS\n"
1105msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 1110msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
1106 1111
1107#: src/cli/gns/gnunet-gns.c:318 1112#: src/cli/gns/gnunet-gns.c:325
1108#, c-format 1113#, c-format
1109msgid "Invalid typename specified, assuming `ANY'\n" 1114msgid "Invalid typename specified, assuming `ANY'\n"
1110msgstr "" 1115msgstr ""
1111 1116
1112#: src/cli/gns/gnunet-gns.c:358 1117#: src/cli/gns/gnunet-gns.c:365
1113msgid "Lookup a record for the given name" 1118msgid "Lookup a record for the given name"
1114msgstr "" 1119msgstr ""
1115 1120
1116#: src/cli/gns/gnunet-gns.c:364 1121#: src/cli/gns/gnunet-gns.c:371
1117#, fuzzy 1122#, fuzzy
1118msgid "Specify the type of the record to lookup" 1123msgid "Specify the type of the record to lookup"
1119msgstr "Die Priorität des Inhalts angeben" 1124msgstr "Die Priorität des Inhalts angeben"
1120 1125
1121#: src/cli/gns/gnunet-gns.c:370 1126#: src/cli/gns/gnunet-gns.c:377
1122#, fuzzy 1127#, fuzzy
1123msgid "Specify a timeout for the lookup" 1128msgid "Specify a timeout for the lookup"
1124msgstr "Die Priorität des Inhalts angeben" 1129msgstr "Die Priorität des Inhalts angeben"
1125 1130
1126#: src/cli/gns/gnunet-gns.c:374 1131#: src/cli/gns/gnunet-gns.c:381
1127msgid "No unneeded output" 1132msgid "No unneeded output"
1128msgstr "" 1133msgstr ""
1129 1134
1130#: src/cli/gns/gnunet-gns.c:379 1135#: src/cli/gns/gnunet-gns.c:386
1131msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" 1136msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
1132msgstr "" 1137msgstr ""
1133 1138
1134#: src/cli/gns/gnunet-gns.c:393 1139#: src/cli/gns/gnunet-gns.c:400
1135#, fuzzy 1140#, fuzzy
1136msgid "GNUnet GNS resolver tool" 1141msgid "GNUnet GNS resolver tool"
1137msgstr "GNUnet Netzwerk Topologie tracen." 1142msgstr "GNUnet Netzwerk Topologie tracen."
@@ -1652,7 +1657,11 @@ msgstr ""
1652msgid "GNUnet NAT traversal autoconfigure daemon" 1657msgid "GNUnet NAT traversal autoconfigure daemon"
1653msgstr "" 1658msgstr ""
1654 1659
1655#: src/cli/nse/gnunet-nse.c:124 1660#: src/cli/nse/gnunet-nse.c:126
1661msgid "Monitor and output current estimates"
1662msgstr ""
1663
1664#: src/cli/nse/gnunet-nse.c:137
1656msgid "Show network size estimates from NSE service." 1665msgid "Show network size estimates from NSE service."
1657msgstr "" 1666msgstr ""
1658 1667
@@ -1700,86 +1709,90 @@ msgstr ""
1700msgid "The time until the DID Document is going to expire (e.g. 5d)" 1709msgid "The time until the DID Document is going to expire (e.g. 5d)"
1701msgstr "" 1710msgstr ""
1702 1711
1703#: src/cli/reclaim/gnunet-reclaim.c:805 1712#: src/cli/reclaim/gnunet-reclaim.c:813
1704#, fuzzy, c-format 1713#, fuzzy, c-format
1705msgid "Ego is required\n" 1714msgid "Ego is required\n"
1706msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" 1715msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n"
1707 1716
1708#: src/cli/reclaim/gnunet-reclaim.c:812 1717#: src/cli/reclaim/gnunet-reclaim.c:820
1709#, c-format 1718#, c-format
1710msgid "Attribute value missing!\n" 1719msgid "Attribute value missing!\n"
1711msgstr "" 1720msgstr ""
1712 1721
1713#: src/cli/reclaim/gnunet-reclaim.c:819 1722#: src/cli/reclaim/gnunet-reclaim.c:827
1714#, fuzzy, c-format 1723#, fuzzy, c-format
1715msgid "Requesting party key is required!\n" 1724msgid "Requesting party key is required!\n"
1716msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" 1725msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n"
1717 1726
1718#: src/cli/reclaim/gnunet-reclaim.c:837 1727#: src/cli/reclaim/gnunet-reclaim.c:846
1719msgid "Add or update an attribute NAME" 1728msgid "Add or update an attribute NAME"
1720msgstr "" 1729msgstr ""
1721 1730
1722#: src/cli/reclaim/gnunet-reclaim.c:842 1731#: src/cli/reclaim/gnunet-reclaim.c:851
1723msgid "Delete the attribute with ID" 1732msgid "Delete the attribute with ID"
1724msgstr "" 1733msgstr ""
1725 1734
1726#: src/cli/reclaim/gnunet-reclaim.c:847 1735#: src/cli/reclaim/gnunet-reclaim.c:856
1727msgid "The attribute VALUE" 1736msgid "The attribute VALUE"
1728msgstr "" 1737msgstr ""
1729 1738
1730#: src/cli/reclaim/gnunet-reclaim.c:852 1739#: src/cli/reclaim/gnunet-reclaim.c:861
1731msgid "The EGO to use" 1740msgid "The EGO to use"
1732msgstr "" 1741msgstr ""
1733 1742
1734#: src/cli/reclaim/gnunet-reclaim.c:858 1743#: src/cli/reclaim/gnunet-reclaim.c:867
1735msgid "Specify the relying party for issue" 1744msgid "Specify the relying party for issue"
1736msgstr "" 1745msgstr ""
1737 1746
1738#: src/cli/reclaim/gnunet-reclaim.c:862 1747#: src/cli/reclaim/gnunet-reclaim.c:873
1748msgid "Specify the relying party URI for a ticket to consume"
1749msgstr ""
1750
1751#: src/cli/reclaim/gnunet-reclaim.c:877
1739msgid "List attributes for EGO" 1752msgid "List attributes for EGO"
1740msgstr "" 1753msgstr ""
1741 1754
1742#: src/cli/reclaim/gnunet-reclaim.c:866 1755#: src/cli/reclaim/gnunet-reclaim.c:881
1743msgid "List credentials for EGO" 1756msgid "List credentials for EGO"
1744msgstr "" 1757msgstr ""
1745 1758
1746#: src/cli/reclaim/gnunet-reclaim.c:872 1759#: src/cli/reclaim/gnunet-reclaim.c:887
1747msgid "Credential to use for attribute" 1760msgid "Credential to use for attribute"
1748msgstr "" 1761msgstr ""
1749 1762
1750#: src/cli/reclaim/gnunet-reclaim.c:877 1763#: src/cli/reclaim/gnunet-reclaim.c:892
1751msgid "Credential name" 1764msgid "Credential name"
1752msgstr "" 1765msgstr ""
1753 1766
1754#: src/cli/reclaim/gnunet-reclaim.c:883 1767#: src/cli/reclaim/gnunet-reclaim.c:898
1755msgid "Issue a ticket for a set of attributes separated by comma" 1768msgid "Issue a ticket for a set of attributes separated by comma"
1756msgstr "" 1769msgstr ""
1757 1770
1758#: src/cli/reclaim/gnunet-reclaim.c:888 1771#: src/cli/reclaim/gnunet-reclaim.c:903
1759msgid "Consume a ticket" 1772msgid "Consume a ticket"
1760msgstr "" 1773msgstr ""
1761 1774
1762#: src/cli/reclaim/gnunet-reclaim.c:893 1775#: src/cli/reclaim/gnunet-reclaim.c:908
1763msgid "Revoke a ticket" 1776msgid "Revoke a ticket"
1764msgstr "" 1777msgstr ""
1765 1778
1766#: src/cli/reclaim/gnunet-reclaim.c:898 1779#: src/cli/reclaim/gnunet-reclaim.c:913
1767msgid "Type of attribute" 1780msgid "Type of attribute"
1768msgstr "" 1781msgstr ""
1769 1782
1770#: src/cli/reclaim/gnunet-reclaim.c:903 1783#: src/cli/reclaim/gnunet-reclaim.c:918
1771msgid "Type of credential" 1784msgid "Type of credential"
1772msgstr "" 1785msgstr ""
1773 1786
1774#: src/cli/reclaim/gnunet-reclaim.c:907 1787#: src/cli/reclaim/gnunet-reclaim.c:922
1775msgid "List tickets of ego" 1788msgid "List tickets of ego"
1776msgstr "" 1789msgstr ""
1777 1790
1778#: src/cli/reclaim/gnunet-reclaim.c:913 1791#: src/cli/reclaim/gnunet-reclaim.c:928
1779msgid "Expiration interval of the attribute" 1792msgid "Expiration interval of the attribute"
1780msgstr "" 1793msgstr ""
1781 1794
1782#: src/cli/reclaim/gnunet-reclaim.c:921 1795#: src/cli/reclaim/gnunet-reclaim.c:936
1783msgid "re:claimID command line tool" 1796msgid "re:claimID command line tool"
1784msgstr "" 1797msgstr ""
1785 1798
@@ -2014,33 +2027,59 @@ msgstr "Statistiken der GNUnet-Aktivitäten ausgeben."
2014msgid "run decoder modus, otherwise runs as encoder" 2027msgid "run decoder modus, otherwise runs as encoder"
2015msgstr "" 2028msgstr ""
2016 2029
2017#: src/cli/util/gnunet-config.c:154 2030#: src/cli/util/gnunet-config.c:101
2018msgid "test if the current installation supports the specified BACKEND" 2031msgid "test if the current installation supports the specified BACKEND"
2019msgstr "" 2032msgstr ""
2020 2033
2021#: src/cli/util/gnunet-config.c:160 2034#: src/cli/util/gnunet-config.c:107
2022msgid "" 2035msgid ""
2023"Provide an appropriate value for CFLAGS to applications building on top of " 2036"Provide an appropriate value for CFLAGS to applications building on top of "
2024"GNUnet" 2037"GNUnet"
2025msgstr "" 2038msgstr ""
2026 2039
2027#: src/cli/util/gnunet-config.c:165 2040#: src/cli/util/gnunet-config.c:112
2028msgid "Is this an experimental build of GNUnet" 2041msgid "Is this an experimental build of GNUnet"
2029msgstr "" 2042msgstr ""
2030 2043
2031#: src/cli/util/gnunet-config.c:171 2044#: src/cli/util/gnunet-config.c:118
2032msgid "" 2045msgid ""
2033"Provide an appropriate value for LIBS to applications building on top of " 2046"Provide an appropriate value for LIBS to applications building on top of "
2034"GNUnet" 2047"GNUnet"
2035msgstr "" 2048msgstr ""
2036 2049
2037#: src/cli/util/gnunet-config.c:177 2050#: src/cli/util/gnunet-config.c:123
2051#, fuzzy
2052msgid "Do not parse default configuration files"
2053msgstr "GNUnet-Konfigurationsdateien bearbeiten"
2054
2055#: src/cli/util/gnunet-config.c:129
2038msgid "Provide the path under which GNUnet was installed" 2056msgid "Provide the path under which GNUnet was installed"
2039msgstr "" 2057msgstr ""
2040 2058
2041#: src/cli/util/gnunet-config.c:192 2059#: src/cli/util/gnunet-config.c:136
2042msgid "Manipulate GNUnet configuration files" 2060msgid ""
2043msgstr "GNUnet-Konfigurationsdateien bearbeiten" 2061"Parse main configuration from this command-line argument and not from disk"
2062msgstr ""
2063
2064#: src/cli/util/gnunet-config.c:225
2065#, fuzzy
2066msgid "Failed to load default configuration, exiting ...\n"
2067msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n"
2068
2069#: src/cli/util/gnunet-config.c:237
2070#, fuzzy
2071msgid "Failed to parse configuration, exiting ...\n"
2072msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':"
2073
2074#: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287
2075#, fuzzy, c-format
2076msgid "Unreadable configuration file `%s', exiting ...\n"
2077msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n"
2078
2079#: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299
2080#, fuzzy, c-format
2081msgid "Malformed configuration file `%s', exiting ...\n"
2082msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n"
2044 2083
2045#: src/cli/util/gnunet-crypto-tvg.c:1588 2084#: src/cli/util/gnunet-crypto-tvg.c:1588
2046msgid "verify a test vector from stdin" 2085msgid "verify a test vector from stdin"
@@ -2091,55 +2130,54 @@ msgstr ""
2091msgid "Hostkeys file `%s' not found\n" 2130msgid "Hostkeys file `%s' not found\n"
2092msgstr "Kommando `%s' wurde nicht gefunden!\n" 2131msgstr "Kommando `%s' wurde nicht gefunden!\n"
2093 2132
2094#: src/cli/util/gnunet-ecc.c:314 2133#: src/cli/util/gnunet-ecc.c:318
2095#, c-format 2134#, c-format
2096msgid "Hostkeys file `%s' is empty\n" 2135msgid "Hostkeys file `%s' is empty\n"
2097msgstr "" 2136msgstr ""
2098 2137
2099#: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 2138#: src/cli/util/gnunet-ecc.c:324
2100#: src/service/testing/testing.c:308
2101#, c-format 2139#, c-format
2102msgid "Incorrect hostkey file format: %s\n" 2140msgid "Incorrect hostkey file format: %s\n"
2103msgstr "" 2141msgstr ""
2104 2142
2105#: src/cli/util/gnunet-ecc.c:334 2143#: src/cli/util/gnunet-ecc.c:340
2106#, fuzzy, c-format 2144#, fuzzy, c-format
2107msgid "Could not read hostkey file: %s\n" 2145msgid "Could not read hostkey file: %s\n"
2108msgstr "PID konnte nicht in Datei `%s' geschrieben werden: %s.\n" 2146msgstr "PID konnte nicht in Datei `%s' geschrieben werden: %s.\n"
2109 2147
2110#: src/cli/util/gnunet-ecc.c:388 2148#: src/cli/util/gnunet-ecc.c:394
2111msgid "No hostkey file specified on command line\n" 2149msgid "No hostkey file specified on command line\n"
2112msgstr "" 2150msgstr ""
2113 2151
2114#: src/cli/util/gnunet-ecc.c:452 2152#: src/cli/util/gnunet-ecc.c:458
2115msgid "list keys included in a file (for testing)" 2153msgid "list keys included in a file (for testing)"
2116msgstr "" 2154msgstr ""
2117 2155
2118#: src/cli/util/gnunet-ecc.c:458 2156#: src/cli/util/gnunet-ecc.c:464
2119msgid "number of keys to list included in a file (for testing)" 2157msgid "number of keys to list included in a file (for testing)"
2120msgstr "" 2158msgstr ""
2121 2159
2122#: src/cli/util/gnunet-ecc.c:464 2160#: src/cli/util/gnunet-ecc.c:470
2123msgid "create COUNT public-private key pairs (for testing)" 2161msgid "create COUNT public-private key pairs (for testing)"
2124msgstr "" 2162msgstr ""
2125 2163
2126#: src/cli/util/gnunet-ecc.c:469 2164#: src/cli/util/gnunet-ecc.c:475
2127msgid "print the public key in ASCII format" 2165msgid "print the public key in ASCII format"
2128msgstr "" 2166msgstr ""
2129 2167
2130#: src/cli/util/gnunet-ecc.c:474 2168#: src/cli/util/gnunet-ecc.c:480
2131msgid "print the private key in ASCII format" 2169msgid "print the private key in ASCII format"
2132msgstr "" 2170msgstr ""
2133 2171
2134#: src/cli/util/gnunet-ecc.c:479 2172#: src/cli/util/gnunet-ecc.c:485
2135msgid "print the public key in HEX format" 2173msgid "print the public key in HEX format"
2136msgstr "" 2174msgstr ""
2137 2175
2138#: src/cli/util/gnunet-ecc.c:485 2176#: src/cli/util/gnunet-ecc.c:491
2139msgid "print examples of ECC operations (used for compatibility testing)" 2177msgid "print examples of ECC operations (used for compatibility testing)"
2140msgstr "" 2178msgstr ""
2141 2179
2142#: src/cli/util/gnunet-ecc.c:499 2180#: src/cli/util/gnunet-ecc.c:505
2143msgid "Manipulate GNUnet private ECC key files" 2181msgid "Manipulate GNUnet private ECC key files"
2144msgstr "" 2182msgstr ""
2145 2183
@@ -3217,13 +3255,13 @@ msgstr ""
3217msgid "Invalid handle type while writing `%s'" 3255msgid "Invalid handle type while writing `%s'"
3218msgstr "Ungültiger Parameter: `%s'\n" 3256msgstr "Ungültiger Parameter: `%s'\n"
3219 3257
3220#: src/lib/util/client.c:531 src/lib/util/service.c:1134 3258#: src/lib/util/client.c:531 src/lib/util/service.c:1139
3221#: src/service/arm/gnunet-service-arm.c:452 3259#: src/service/arm/gnunet-service-arm.c:452
3222#, c-format 3260#, c-format
3223msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 3261msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
3224msgstr "" 3262msgstr ""
3225 3263
3226#: src/lib/util/client.c:536 src/lib/util/service.c:1138 3264#: src/lib/util/client.c:536 src/lib/util/service.c:1143
3227#: src/service/arm/gnunet-service-arm.c:456 3265#: src/service/arm/gnunet-service-arm.c:456
3228#, c-format 3266#, c-format
3229msgid "Using `%s' instead\n" 3267msgid "Using `%s' instead\n"
@@ -3355,17 +3393,17 @@ msgstr ""
3355msgid "`%s' failed at %s:%d with error: %s\n" 3393msgid "`%s' failed at %s:%d with error: %s\n"
3356msgstr "»%s« schlug bei %s:%d mit dem Fehler %s fehl\n" 3394msgstr "»%s« schlug bei %s:%d mit dem Fehler %s fehl\n"
3357 3395
3358#: src/lib/util/crypto_ecc.c:554 3396#: src/lib/util/crypto_ecc.c:569
3359#, fuzzy, c-format 3397#, fuzzy, c-format
3360msgid "ECC signing failed at %s:%d: %s\n" 3398msgid "ECC signing failed at %s:%d: %s\n"
3361msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" 3399msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n"
3362 3400
3363#: src/lib/util/crypto_ecc.c:677 3401#: src/lib/util/crypto_ecc.c:692
3364#, fuzzy, c-format 3402#, fuzzy, c-format
3365msgid "ECDSA signature verification failed at %s:%d: %s\n" 3403msgid "ECDSA signature verification failed at %s:%d: %s\n"
3366msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" 3404msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n"
3367 3405
3368#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:304 3406#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:305
3369#, fuzzy 3407#, fuzzy
3370msgid "Could not load peer's private key\n" 3408msgid "Could not load peer's private key\n"
3371msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n" 3409msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n"
@@ -3391,7 +3429,7 @@ msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n"
3391msgid "Expected `%s' to be a directory!\n" 3429msgid "Expected `%s' to be a directory!\n"
3392msgstr "`%s' erwartet, dass `%s' ein Verzeichnis ist!\n" 3430msgstr "`%s' erwartet, dass `%s' ein Verzeichnis ist!\n"
3393 3431
3394#: src/lib/util/disk.c:1222 src/lib/util/service.c:1642 3432#: src/lib/util/disk.c:1222 src/lib/util/service.c:1651
3395#, fuzzy, c-format 3433#, fuzzy, c-format
3396msgid "Cannot obtain information about user `%s': %s\n" 3434msgid "Cannot obtain information about user `%s': %s\n"
3397msgstr "Fehler beim Speichern der Konfigurationsdatei: `%s': %s.\n" 3435msgstr "Fehler beim Speichern der Konfigurationsdatei: `%s': %s.\n"
@@ -3585,99 +3623,99 @@ msgstr "Sie müssen für die Option »%s« zusätzlich eine Zahl angeben.\n"
3585msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 3623msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
3586msgstr "" 3624msgstr ""
3587 3625
3588#: src/lib/util/gnunet_error_codes.c:60 3626#: src/lib/util/gnunet_error_codes.c:59
3589msgid "No error (success)." 3627msgid "No error (success)."
3590msgstr "" 3628msgstr ""
3591 3629
3592#: src/lib/util/gnunet_error_codes.c:66 3630#: src/lib/util/gnunet_error_codes.c:65
3593#, fuzzy 3631#, fuzzy
3594msgid "Unknown and unspecified error." 3632msgid "Unknown and unspecified error."
3595msgstr "Unbekannter Anfragestatus" 3633msgstr "Unbekannter Anfragestatus"
3596 3634
3597#: src/lib/util/gnunet_error_codes.c:72 3635#: src/lib/util/gnunet_error_codes.c:71
3598#, fuzzy 3636#, fuzzy
3599msgid "Communication with service failed." 3637msgid "Communication with service failed."
3600msgstr "Informationen über andere GNUnet Knoten ausgeben." 3638msgstr "Informationen über andere GNUnet Knoten ausgeben."
3601 3639
3602#: src/lib/util/gnunet_error_codes.c:78 3640#: src/lib/util/gnunet_error_codes.c:77
3603#, fuzzy 3641#, fuzzy
3604msgid "Ego not found." 3642msgid "Ego not found."
3605msgstr "Kein Inhalt gefunden" 3643msgstr "Kein Inhalt gefunden"
3606 3644
3607#: src/lib/util/gnunet_error_codes.c:84 3645#: src/lib/util/gnunet_error_codes.c:83
3608msgid "Identifier already in use for another ego." 3646msgid "Identifier already in use for another ego."
3609msgstr "" 3647msgstr ""
3610 3648
3611#: src/lib/util/gnunet_error_codes.c:90 3649#: src/lib/util/gnunet_error_codes.c:89
3612msgid "The given ego is invalid or malformed." 3650msgid "The given ego is invalid or malformed."
3613msgstr "" 3651msgstr ""
3614 3652
3615#: src/lib/util/gnunet_error_codes.c:96 3653#: src/lib/util/gnunet_error_codes.c:95
3616#, fuzzy 3654#, fuzzy
3617msgid "Unknown namestore error." 3655msgid "Unknown namestore error."
3618msgstr "Unbekannter Anfragestatus" 3656msgstr "Unbekannter Anfragestatus"
3619 3657
3620#: src/lib/util/gnunet_error_codes.c:102 src/lib/util/gnunet_error_codes.c:120 3658#: src/lib/util/gnunet_error_codes.c:101 src/lib/util/gnunet_error_codes.c:119
3621#, fuzzy 3659#, fuzzy
3622msgid "Zone iteration failed." 3660msgid "Zone iteration failed."
3623msgstr " Verbindung fehlgeschlagen\n" 3661msgstr " Verbindung fehlgeschlagen\n"
3624 3662
3625#: src/lib/util/gnunet_error_codes.c:108 3663#: src/lib/util/gnunet_error_codes.c:107
3626#, fuzzy 3664#, fuzzy
3627msgid "Zone not found." 3665msgid "Zone not found."
3628msgstr "Kein Inhalt gefunden" 3666msgstr "Kein Inhalt gefunden"
3629 3667
3630#: src/lib/util/gnunet_error_codes.c:114 3668#: src/lib/util/gnunet_error_codes.c:113
3631#, fuzzy 3669#, fuzzy
3632msgid "Record not found." 3670msgid "Record not found."
3633msgstr "Kommando `%s' wurde nicht gefunden!\n" 3671msgstr "Kommando `%s' wurde nicht gefunden!\n"
3634 3672
3635#: src/lib/util/gnunet_error_codes.c:126 3673#: src/lib/util/gnunet_error_codes.c:125
3636msgid "Zone does not contain any records." 3674msgid "Zone does not contain any records."
3637msgstr "" 3675msgstr ""
3638 3676
3639#: src/lib/util/gnunet_error_codes.c:132 3677#: src/lib/util/gnunet_error_codes.c:131
3640#, fuzzy 3678#, fuzzy
3641msgid "Failed to lookup record." 3679msgid "Failed to lookup record."
3642msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" 3680msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n"
3643 3681
3644#: src/lib/util/gnunet_error_codes.c:138 3682#: src/lib/util/gnunet_error_codes.c:137
3645#, fuzzy 3683#, fuzzy
3646msgid "No records given." 3684msgid "No records given."
3647msgstr "Kein Knoten angegeben!\n" 3685msgstr "Kein Knoten angegeben!\n"
3648 3686
3649#: src/lib/util/gnunet_error_codes.c:144 3687#: src/lib/util/gnunet_error_codes.c:143
3650msgid "Record data invalid." 3688msgid "Record data invalid."
3651msgstr "" 3689msgstr ""
3652 3690
3653#: src/lib/util/gnunet_error_codes.c:150 3691#: src/lib/util/gnunet_error_codes.c:149
3654#, fuzzy 3692#, fuzzy
3655msgid "No label given." 3693msgid "No label given."
3656msgstr "Kein Knoten angegeben!\n" 3694msgstr "Kein Knoten angegeben!\n"
3657 3695
3658#: src/lib/util/gnunet_error_codes.c:156 3696#: src/lib/util/gnunet_error_codes.c:155
3659#, fuzzy 3697#, fuzzy
3660msgid "No results given." 3698msgid "No results given."
3661msgstr "# empfangene Ergebnisse" 3699msgstr "# empfangene Ergebnisse"
3662 3700
3663#: src/lib/util/gnunet_error_codes.c:162 3701#: src/lib/util/gnunet_error_codes.c:161
3664msgid "Record already exists." 3702msgid "Record already exists."
3665msgstr "" 3703msgstr ""
3666 3704
3667#: src/lib/util/gnunet_error_codes.c:168 3705#: src/lib/util/gnunet_error_codes.c:167
3668msgid "Record size exceeds maximum limit." 3706msgid "Record size exceeds maximum limit."
3669msgstr "" 3707msgstr ""
3670 3708
3671#: src/lib/util/gnunet_error_codes.c:174 3709#: src/lib/util/gnunet_error_codes.c:173
3672msgid "There was an error in the database backend." 3710msgid "There was an error in the database backend."
3673msgstr "" 3711msgstr ""
3674 3712
3675#: src/lib/util/gnunet_error_codes.c:180 3713#: src/lib/util/gnunet_error_codes.c:179
3676#, fuzzy 3714#, fuzzy
3677msgid "Failed to store the given records." 3715msgid "Failed to store the given records."
3678msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" 3716msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n"
3679 3717
3680#: src/lib/util/gnunet_error_codes.c:186 3718#: src/lib/util/gnunet_error_codes.c:185
3681msgid "Label invalid or malformed." 3719msgid "Label invalid or malformed."
3682msgstr "" 3720msgstr ""
3683 3721
@@ -3745,16 +3783,6 @@ msgstr "`%s' fehlgeschlagen für die Bibliothek `%s'. Ort: %s:%d. Fehler: %s\n"
3745msgid "Could not determine plugin installation path.\n" 3783msgid "Could not determine plugin installation path.\n"
3746msgstr "Öffentliche IP-Adresse konnte nicht ermittelt werden.\n" 3784msgstr "Öffentliche IP-Adresse konnte nicht ermittelt werden.\n"
3747 3785
3748#: src/lib/util/program.c:287
3749#, fuzzy, c-format
3750msgid "Unreadable configuration file `%s', exiting ...\n"
3751msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n"
3752
3753#: src/lib/util/program.c:299
3754#, fuzzy, c-format
3755msgid "Malformed configuration file `%s', exiting ...\n"
3756msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n"
3757
3758#: src/lib/util/program.c:314 3786#: src/lib/util/program.c:314
3759#, fuzzy, c-format 3787#, fuzzy, c-format
3760msgid "Unreadable configuration file `%s'. Exiting ...\n" 3788msgid "Unreadable configuration file `%s'. Exiting ...\n"
@@ -3806,120 +3834,120 @@ msgstr "Standarddienst »%s« ist nicht korrekt eingerichtet!\n"
3806msgid "Could not resolve our FQDN: %s\n" 3834msgid "Could not resolve our FQDN: %s\n"
3807msgstr "`%s' konnte nicht aufgelöst werden: %s\n" 3835msgstr "`%s' konnte nicht aufgelöst werden: %s\n"
3808 3836
3809#: src/lib/util/service.c:654 3837#: src/lib/util/service.c:650
3810#, c-format 3838#, c-format
3811msgid "" 3839msgid ""
3812"Processing code for message of type %u did not call " 3840"Processing code for message of type %u did not call "
3813"`GNUNET_SERVICE_client_continue' after %s\n" 3841"`GNUNET_SERVICE_client_continue' after %s\n"
3814msgstr "" 3842msgstr ""
3815 3843
3816#: src/lib/util/service.c:838 3844#: src/lib/util/service.c:841
3817#, c-format 3845#, c-format
3818msgid "Unknown address family %d\n" 3846msgid "Unknown address family %d\n"
3819msgstr "" 3847msgstr ""
3820 3848
3821#: src/lib/util/service.c:951 3849#: src/lib/util/service.c:956
3822#, c-format 3850#, c-format
3823msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 3851msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
3824msgstr "" 3852msgstr ""
3825 3853
3826#: src/lib/util/service.c:992 3854#: src/lib/util/service.c:997
3827#, c-format 3855#, c-format
3828msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 3856msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
3829msgstr "" 3857msgstr ""
3830 3858
3831#: src/lib/util/service.c:1095 src/lib/util/service.c:1101 3859#: src/lib/util/service.c:1100 src/lib/util/service.c:1106
3832#: src/service/arm/gnunet-service-arm.c:412 3860#: src/service/arm/gnunet-service-arm.c:412
3833#: src/service/arm/gnunet-service-arm.c:418 3861#: src/service/arm/gnunet-service-arm.c:418
3834#, c-format 3862#, c-format
3835msgid "Require valid port number for service `%s' in configuration!\n" 3863msgid "Require valid port number for service `%s' in configuration!\n"
3836msgstr "" 3864msgstr ""
3837 3865
3838#: src/lib/util/service.c:1158 src/service/arm/gnunet-service-arm.c:484 3866#: src/lib/util/service.c:1163 src/service/arm/gnunet-service-arm.c:484
3839#, c-format 3867#, c-format
3840msgid "" 3868msgid ""
3841"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 3869"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
3842"domain socket: %s\n" 3870"domain socket: %s\n"
3843msgstr "" 3871msgstr ""
3844 3872
3845#: src/lib/util/service.c:1176 src/service/arm/gnunet-service-arm.c:505 3873#: src/lib/util/service.c:1181 src/service/arm/gnunet-service-arm.c:505
3846#, c-format 3874#, c-format
3847msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 3875msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
3848msgstr "" 3876msgstr ""
3849 3877
3850#: src/lib/util/service.c:1207 src/service/arm/gnunet-service-arm.c:536 3878#: src/lib/util/service.c:1212 src/service/arm/gnunet-service-arm.c:536
3851#, c-format 3879#, c-format
3852msgid "Failed to resolve `%s': %s\n" 3880msgid "Failed to resolve `%s': %s\n"
3853msgstr "»%s« konnte nicht aufgelöst werden: %s\n" 3881msgstr "»%s« konnte nicht aufgelöst werden: %s\n"
3854 3882
3855#: src/lib/util/service.c:1226 src/service/arm/gnunet-service-arm.c:555 3883#: src/lib/util/service.c:1231 src/service/arm/gnunet-service-arm.c:555
3856#, fuzzy, c-format 3884#, fuzzy, c-format
3857msgid "Failed to find %saddress for `%s'.\n" 3885msgid "Failed to find %saddress for `%s'.\n"
3858msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" 3886msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n"
3859 3887
3860#: src/lib/util/service.c:1401 3888#: src/lib/util/service.c:1406
3861#, fuzzy, c-format 3889#, fuzzy, c-format
3862msgid "`%s' failed for port %d (%s).\n" 3890msgid "`%s' failed for port %d (%s).\n"
3863msgstr "`%s' fehlgeschlagen für Laufwerk %s: %u\n" 3891msgstr "`%s' fehlgeschlagen für Laufwerk %s: %u\n"
3864 3892
3865#: src/lib/util/service.c:1413 3893#: src/lib/util/service.c:1418
3866#, fuzzy, c-format 3894#, fuzzy, c-format
3867msgid "`%s' failed for port %d (%s): address already in use\n" 3895msgid "`%s' failed for port %d (%s): address already in use\n"
3868msgstr "`%s' schlug fehl für Port %d: %s. Läuft gnunetd bereits?\n" 3896msgstr "`%s' schlug fehl für Port %d: %s. Läuft gnunetd bereits?\n"
3869 3897
3870#: src/lib/util/service.c:1420 3898#: src/lib/util/service.c:1425
3871#, fuzzy, c-format 3899#, fuzzy, c-format
3872msgid "`%s' failed for `%s': address already in use\n" 3900msgid "`%s' failed for `%s': address already in use\n"
3873msgstr "%s schlug fehl, Nachrichten Typ %d ist bereits in Verwendung.\n" 3901msgstr "%s schlug fehl, Nachrichten Typ %d ist bereits in Verwendung.\n"
3874 3902
3875#: src/lib/util/service.c:1481 3903#: src/lib/util/service.c:1486
3876#, c-format 3904#, c-format
3877msgid "Specified value for `%s' of service `%s' is invalid\n" 3905msgid "Specified value for `%s' of service `%s' is invalid\n"
3878msgstr "" 3906msgstr ""
3879 3907
3880#: src/lib/util/service.c:1505 3908#: src/lib/util/service.c:1510
3881#, c-format 3909#, c-format
3882msgid "Could not access pre-bound socket %u, will try to bind myself\n" 3910msgid "Could not access pre-bound socket %u, will try to bind myself\n"
3883msgstr "" 3911msgstr ""
3884 3912
3885#: src/lib/util/service.c:1573 3913#: src/lib/util/service.c:1583
3886msgid "" 3914msgid ""
3887"Could not bind to any of the ports I was supposed to, refusing to run!\n" 3915"Could not bind to any of the ports I was supposed to, refusing to run!\n"
3888msgstr "" 3916msgstr ""
3889 3917
3890#: src/lib/util/service.c:1644 3918#: src/lib/util/service.c:1653
3891msgid "No such user" 3919msgid "No such user"
3892msgstr "" 3920msgstr ""
3893 3921
3894#: src/lib/util/service.c:1658 3922#: src/lib/util/service.c:1668
3895#, c-format 3923#, c-format
3896msgid "Cannot change user/group to `%s': %s\n" 3924msgid "Cannot change user/group to `%s': %s\n"
3897msgstr "Benutzer/Gruppe kann nicht zu »%s« geändert werden: %s\n" 3925msgstr "Benutzer/Gruppe kann nicht zu »%s« geändert werden: %s\n"
3898 3926
3899#: src/lib/util/service.c:1751 3927#: src/lib/util/service.c:1767
3900msgid "Service process failed to initialize\n" 3928msgid "Service process failed to initialize\n"
3901msgstr "" 3929msgstr ""
3902 3930
3903#: src/lib/util/service.c:1756 3931#: src/lib/util/service.c:1772
3904msgid "Service process could not initialize server function\n" 3932msgid "Service process could not initialize server function\n"
3905msgstr "" 3933msgstr ""
3906 3934
3907#: src/lib/util/service.c:1761 3935#: src/lib/util/service.c:1777
3908msgid "Service process failed to report status\n" 3936msgid "Service process failed to report status\n"
3909msgstr "" 3937msgstr ""
3910 3938
3911#: src/lib/util/service.c:1960 src/lib/util/service.c:2255 3939#: src/lib/util/service.c:1990 src/lib/util/service.c:2304
3912msgid "do daemonize (detach from terminal)" 3940msgid "do daemonize (detach from terminal)"
3913msgstr "" 3941msgstr ""
3914 3942
3915#: src/lib/util/service.c:2036 src/lib/util/service.c:2048 3943#: src/lib/util/service.c:2065 src/lib/util/service.c:2080
3916#: src/lib/util/service.c:2298 src/lib/util/service.c:2310 3944#: src/lib/util/service.c:2353 src/lib/util/service.c:2368
3917#: src/service/transport/transport-testing-communicator.c:1055 3945#: src/service/transport/transport-testing-communicator.c:1059
3918#, fuzzy, c-format 3946#, fuzzy, c-format
3919msgid "Malformed configuration file `%s', exit ...\n" 3947msgid "Malformed configuration file `%s', exit ...\n"
3920msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" 3948msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n"
3921 3949
3922#: src/lib/util/service.c:2058 src/lib/util/service.c:2321 3950#: src/lib/util/service.c:2092 src/lib/util/service.c:2381
3923#, fuzzy 3951#, fuzzy
3924msgid "Malformed configuration, exit ...\n" 3952msgid "Malformed configuration, exit ...\n"
3925msgstr "GNUnet Konfiguration" 3953msgstr "GNUnet Konfiguration"
@@ -4379,6 +4407,11 @@ msgstr ""
4379msgid "Initiating shutdown as requested by client.\n" 4407msgid "Initiating shutdown as requested by client.\n"
4380msgstr "" 4408msgstr ""
4381 4409
4410#: src/service/arm/testing_arm_cmd_start_peer.c:197
4411#, c-format
4412msgid "Failed to start `%s': %s\n"
4413msgstr "»%s« konnte nicht gestartet werden: %s\n"
4414
4382#: src/service/core/gnunet-service-core.c:329 4415#: src/service/core/gnunet-service-core.c:329
4383#, fuzzy 4416#, fuzzy
4384msgid "# send requests dropped (disconnected)" 4417msgid "# send requests dropped (disconnected)"
@@ -4560,8 +4593,8 @@ msgstr "# Bytes entschlüsselt"
4560#: src/service/core/gnunet-service-core_sessions.c:337 4593#: src/service/core/gnunet-service-core_sessions.c:337
4561#: src/service/fs/gnunet-service-fs_cp.c:484 4594#: src/service/fs/gnunet-service-fs_cp.c:484
4562#: src/service/fs/gnunet-service-fs_cp.c:1377 4595#: src/service/fs/gnunet-service-fs_cp.c:1377
4563#: src/service/topology/gnunet-daemon-topology.c:551 4596#: src/service/topology/gnunet-daemon-topology.c:545
4564#: src/service/topology/gnunet-daemon-topology.c:633 4597#: src/service/topology/gnunet-daemon-topology.c:627
4565msgid "# peers connected" 4598msgid "# peers connected"
4566msgstr "# verbundener Knoten" 4599msgstr "# verbundener Knoten"
4567 4600
@@ -4691,7 +4724,7 @@ msgstr ""
4691#: src/service/datastore/gnunet-service-datastore.c:626 4724#: src/service/datastore/gnunet-service-datastore.c:626
4692#: src/service/datastore/gnunet-service-datastore.c:677 4725#: src/service/datastore/gnunet-service-datastore.c:677
4693#: src/service/datastore/gnunet-service-datastore.c:820 4726#: src/service/datastore/gnunet-service-datastore.c:820
4694#: src/service/datastore/gnunet-service-datastore.c:1428 4727#: src/service/datastore/gnunet-service-datastore.c:1431
4695msgid "# reserved" 4728msgid "# reserved"
4696msgstr "" 4729msgstr ""
4697 4730
@@ -4745,65 +4778,65 @@ msgstr ""
4745msgid "# REMOVE requests received" 4778msgid "# REMOVE requests received"
4746msgstr "# Client Trace-Anfragen empfangen" 4779msgstr "# Client Trace-Anfragen empfangen"
4747 4780
4748#: src/service/datastore/gnunet-service-datastore.c:1107 4781#: src/service/datastore/gnunet-service-datastore.c:1109
4749#, c-format 4782#, c-format
4750msgid "" 4783msgid ""
4751"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n" 4784"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n"
4752msgstr "" 4785msgstr ""
4753 4786
4754#: src/service/datastore/gnunet-service-datastore.c:1112 4787#: src/service/datastore/gnunet-service-datastore.c:1114
4755#: src/service/datastore/gnunet-service-datastore.c:1281 4788#: src/service/datastore/gnunet-service-datastore.c:1283
4756#, c-format 4789#, c-format
4757msgid "New payload: %lld\n" 4790msgid "New payload: %lld\n"
4758msgstr "" 4791msgstr ""
4759 4792
4760#: src/service/datastore/gnunet-service-datastore.c:1167 4793#: src/service/datastore/gnunet-service-datastore.c:1169
4761#, c-format 4794#, c-format
4762msgid "Loading `%s' datastore plugin\n" 4795msgid "Loading `%s' datastore plugin\n"
4763msgstr "" 4796msgstr ""
4764 4797
4765#: src/service/datastore/gnunet-service-datastore.c:1176 4798#: src/service/datastore/gnunet-service-datastore.c:1178
4766#, fuzzy, c-format 4799#, fuzzy, c-format
4767msgid "Failed to load datastore plugin for `%s'\n" 4800msgid "Failed to load datastore plugin for `%s'\n"
4768msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n" 4801msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n"
4769 4802
4770#: src/service/datastore/gnunet-service-datastore.c:1236 4803#: src/service/datastore/gnunet-service-datastore.c:1238
4771msgid "Bloomfilter construction complete.\n" 4804msgid "Bloomfilter construction complete.\n"
4772msgstr "" 4805msgstr ""
4773 4806
4774#: src/service/datastore/gnunet-service-datastore.c:1288 4807#: src/service/datastore/gnunet-service-datastore.c:1290
4775msgid "Rebuilding bloomfilter. Please be patient.\n" 4808msgid "Rebuilding bloomfilter. Please be patient.\n"
4776msgstr "" 4809msgstr ""
4777 4810
4778#: src/service/datastore/gnunet-service-datastore.c:1298 4811#: src/service/datastore/gnunet-service-datastore.c:1300
4779msgid "Plugin does not support get_keys function. Please fix!\n" 4812msgid "Plugin does not support get_keys function. Please fix!\n"
4780msgstr "" 4813msgstr ""
4781 4814
4782#: src/service/datastore/gnunet-service-datastore.c:1463 4815#: src/service/datastore/gnunet-service-datastore.c:1466
4783#, fuzzy, c-format 4816#, fuzzy, c-format
4784msgid "# bytes used in file-sharing datastore `%s'" 4817msgid "# bytes used in file-sharing datastore `%s'"
4785msgstr "# bytes erlaubt in der Datenbank" 4818msgstr "# bytes erlaubt in der Datenbank"
4786 4819
4787#: src/service/datastore/gnunet-service-datastore.c:1472 4820#: src/service/datastore/gnunet-service-datastore.c:1475
4788msgid "# quota" 4821msgid "# quota"
4789msgstr "# Kontingent" 4822msgstr "# Kontingent"
4790 4823
4791#: src/service/datastore/gnunet-service-datastore.c:1475 4824#: src/service/datastore/gnunet-service-datastore.c:1478
4792msgid "# cache size" 4825msgid "# cache size"
4793msgstr "# Zwischenspeichergröße" 4826msgstr "# Zwischenspeichergröße"
4794 4827
4795#: src/service/datastore/gnunet-service-datastore.c:1491 4828#: src/service/datastore/gnunet-service-datastore.c:1494
4796#, c-format 4829#, c-format
4797msgid "Could not use specified filename `%s' for bloomfilter.\n" 4830msgid "Could not use specified filename `%s' for bloomfilter.\n"
4798msgstr "" 4831msgstr ""
4799 4832
4800#: src/service/datastore/gnunet-service-datastore.c:1512 4833#: src/service/datastore/gnunet-service-datastore.c:1515
4801#: src/service/datastore/gnunet-service-datastore.c:1534 4834#: src/service/datastore/gnunet-service-datastore.c:1537
4802#, fuzzy, c-format 4835#, fuzzy, c-format
4803msgid "Failed to remove bogus bloomfilter file `%s'\n" 4836msgid "Failed to remove bogus bloomfilter file `%s'\n"
4804msgstr "Datei wurde als `%s' gespeichert.\n" 4837msgstr "Datei wurde als `%s' gespeichert.\n"
4805 4838
4806#: src/service/datastore/gnunet-service-datastore.c:1573 4839#: src/service/datastore/gnunet-service-datastore.c:1576
4807msgid "Failed to initialize bloomfilter.\n" 4840msgid "Failed to initialize bloomfilter.\n"
4808msgstr "Bloomfilter konnte nicht initialisiert werden.\n" 4841msgstr "Bloomfilter konnte nicht initialisiert werden.\n"
4809 4842
@@ -5606,7 +5639,7 @@ msgstr "GNUnet Konfiguration"
5606 5639
5607#: src/service/fs/gnunet-service-fs.c:1271 5640#: src/service/fs/gnunet-service-fs.c:1271
5608#: src/service/hostlist/gnunet-daemon-hostlist.c:343 5641#: src/service/hostlist/gnunet-daemon-hostlist.c:343
5609#: src/service/topology/gnunet-daemon-topology.c:1066 5642#: src/service/topology/gnunet-daemon-topology.c:1062
5610#, fuzzy, c-format 5643#, fuzzy, c-format
5611msgid "Failed to connect to `%s' service.\n" 5644msgid "Failed to connect to `%s' service.\n"
5612msgstr "`%s' Dienst konnte nicht initialisiert werden.\n" 5645msgstr "`%s' Dienst konnte nicht initialisiert werden.\n"
@@ -6430,7 +6463,7 @@ msgid "# hostlist advertisements send"
6430msgstr "# Bekanntmachungen von anderen übertragen" 6463msgstr "# Bekanntmachungen von anderen übertragen"
6431 6464
6432#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 6465#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483
6433#: src/service/topology/gnunet-daemon-topology.c:786 6466#: src/service/topology/gnunet-daemon-topology.c:781
6434#, fuzzy, c-format 6467#, fuzzy, c-format
6435msgid "Error in communication with PEERSTORE service: %s\n" 6468msgid "Error in communication with PEERSTORE service: %s\n"
6436msgstr "Informationen über andere GNUnet Knoten ausgeben." 6469msgstr "Informationen über andere GNUnet Knoten ausgeben."
@@ -6695,12 +6728,12 @@ msgstr ""
6695msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" 6728msgid "Malformed punched hole specification `%s' (IPv6 address invalid)"
6696msgstr "" 6729msgstr ""
6697 6730
6698#: src/service/nat/gnunet-service-nat.c:1861 6731#: src/service/nat/gnunet-service-nat.c:1860
6699#, fuzzy 6732#, fuzzy
6700msgid "Connection reversal request failed\n" 6733msgid "Connection reversal request failed\n"
6701msgstr " Verbindung fehlgeschlagen\n" 6734msgstr " Verbindung fehlgeschlagen\n"
6702 6735
6703#: src/service/nat/gnunet-service-nat.c:1935 6736#: src/service/nat/gnunet-service-nat.c:1999
6704msgid "" 6737msgid ""
6705"UPnP enabled in configuration, but UPnP client `upnpc` command not found, " 6738"UPnP enabled in configuration, but UPnP client `upnpc` command not found, "
6706"disabling UPnP\n" 6739"disabling UPnP\n"
@@ -6726,42 +6759,42 @@ msgstr "Kommando `%s' wurde nicht gefunden!\n"
6726msgid "`upnpc' command not found\n" 6759msgid "`upnpc' command not found\n"
6727msgstr "Kommando `%s' wurde nicht gefunden!\n" 6760msgstr "Kommando `%s' wurde nicht gefunden!\n"
6728 6761
6729#: src/service/peerstore/gnunet-service-peerstore.c:1141 6762#: src/service/peerstore/gnunet-service-peerstore.c:1150
6730#, fuzzy, c-format 6763#, fuzzy, c-format
6731msgid "Failed to parse HELLO in file `%s': %s\n" 6764msgid "Failed to parse HELLO in file `%s': %s\n"
6732msgstr "Datei wurde als `%s' gespeichert.\n" 6765msgstr "Datei wurde als `%s' gespeichert.\n"
6733 6766
6734#: src/service/peerstore/gnunet-service-peerstore.c:1214 6767#: src/service/peerstore/gnunet-service-peerstore.c:1223
6735#, fuzzy, c-format 6768#, fuzzy, c-format
6736msgid "Could not load database backend `%s'\n" 6769msgid "Could not load database backend `%s'\n"
6737msgstr "`%s' konnte nicht aufgelöst werden: %s\n" 6770msgstr "`%s' konnte nicht aufgelöst werden: %s\n"
6738 6771
6739#: src/service/peerstore/gnunet-service-peerstore.c:1233 6772#: src/service/peerstore/gnunet-service-peerstore.c:1242
6740#, c-format 6773#, c-format
6741msgid "Importing HELLOs from `%s'\n" 6774msgid "Importing HELLOs from `%s'\n"
6742msgstr "" 6775msgstr ""
6743 6776
6744#: src/service/peerstore/gnunet-service-peerstore.c:1244 6777#: src/service/peerstore/gnunet-service-peerstore.c:1253
6745msgid "Skipping import of included HELLOs\n" 6778msgid "Skipping import of included HELLOs\n"
6746msgstr "" 6779msgstr ""
6747 6780
6748#: src/service/peerstore/peerstore_api.c:574 6781#: src/service/peerstore/peerstore_api.c:579
6749#, fuzzy 6782#, fuzzy
6750msgid "Unexpected store response.\n" 6783msgid "Unexpected store response.\n"
6751msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" 6784msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n"
6752 6785
6753#: src/service/peerstore/peerstore_api.c:606 6786#: src/service/peerstore/peerstore_api.c:620
6754msgid "Unexpected iteration response.\n" 6787msgid "Unexpected iteration response.\n"
6755msgstr "" 6788msgstr ""
6756 6789
6757#: src/service/peerstore/peerstore_api.c:652 6790#: src/service/peerstore/peerstore_api.c:666
6758msgid "" 6791msgid ""
6759"Unexpected iteration response, no iterating client found, discarding " 6792"Unexpected iteration response, no iterating client found, discarding "
6760"message.\n" 6793"message.\n"
6761msgstr "" 6794msgstr ""
6762 6795
6763#: src/service/peerstore/peerstore_api.c:662 6796#: src/service/peerstore/peerstore_api.c:676
6764#: src/service/peerstore/peerstore_api_monitor.c:164 6797#: src/service/peerstore/peerstore_api_monitor.c:163
6765#, fuzzy 6798#, fuzzy
6766msgid "Received a malformed response from service." 6799msgid "Received a malformed response from service."
6767msgstr "Beschädigte Antwort auf `%s' von Knoten `%s' empfangen.\n" 6800msgstr "Beschädigte Antwort auf `%s' von Knoten `%s' empfangen.\n"
@@ -6933,12 +6966,12 @@ msgstr ""
6933msgid "Namestore REST API initialized\n" 6966msgid "Namestore REST API initialized\n"
6934msgstr " Verbindung fehlgeschlagen\n" 6967msgstr " Verbindung fehlgeschlagen\n"
6935 6968
6936#: src/service/rest/openid_plugin.c:3102 6969#: src/service/rest/openid_plugin.c:3121
6937#, fuzzy 6970#, fuzzy
6938msgid "OpenID Connect REST API initialized\n" 6971msgid "OpenID Connect REST API initialized\n"
6939msgstr " Verbindung fehlgeschlagen\n" 6972msgstr " Verbindung fehlgeschlagen\n"
6940 6973
6941#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1523 6974#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1494
6942#, fuzzy 6975#, fuzzy
6943msgid "Identity Provider REST API initialized\n" 6976msgid "Identity Provider REST API initialized\n"
6944msgstr " Verbindung fehlgeschlagen\n" 6977msgstr " Verbindung fehlgeschlagen\n"
@@ -6990,153 +7023,55 @@ msgstr "Dateien aus dem GNUnet herunterladen."
6990msgid "Could not save some persistent statistics\n" 7023msgid "Could not save some persistent statistics\n"
6991msgstr "" 7024msgstr ""
6992 7025
6993#: src/service/testing/gnunet-testing.c:185 7026#: src/service/testbed/gnunet-testbed.c:196
6994#, c-format
6995msgid "Could not extract hostkey %u (offset too large?)\n"
6996msgstr ""
6997
6998#: src/service/testing/gnunet-testing.c:275
6999#, c-format
7000msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
7001msgstr ""
7002
7003#: src/service/testing/gnunet-testing.c:386
7004#, fuzzy 7027#, fuzzy
7005msgid "create unique configuration files" 7028msgid "number of unique configuration files to create"
7006msgstr "" 7029msgstr ""
7007"Einen Wert aus der Konfigurationsdatei auf der Standardausgabe ausgeben" 7030"Einen Wert aus der Konfigurationsdatei auf der Standardausgabe ausgeben"
7008 7031
7009#: src/service/testing/gnunet-testing.c:392 7032#: src/service/testbed/gnunet-testbed.c:202
7010msgid "extract hostkey file from pre-computed hostkey list"
7011msgstr ""
7012
7013#: src/service/testing/gnunet-testing.c:400
7014msgid ""
7015"number of unique configuration files to create, or number of the hostkey to "
7016"extract"
7017msgstr ""
7018
7019#: src/service/testing/gnunet-testing.c:407
7020msgid "configuration template" 7033msgid "configuration template"
7021msgstr "Konfigurationsvorlage" 7034msgstr "Konfigurationsvorlage"
7022 7035
7023#: src/service/testing/gnunet-testing.c:415 7036#: src/service/testbed/gnunet-testbed.c:218
7024msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"
7025msgstr ""
7026
7027#: src/service/testing/gnunet-testing.c:432
7028msgid "Command line tool to access the testing library" 7037msgid "Command line tool to access the testing library"
7029msgstr "" 7038msgstr ""
7030 7039
7031#: src/service/testing/list-keys.c:92
7032msgid "list COUNT number of keys"
7033msgstr ""
7034
7035#: src/service/testing/testing.c:291
7036#, c-format
7037msgid "Hostkeys file not found: %s\n"
7038msgstr ""
7039
7040#: src/service/testing/testing.c:743
7041#, c-format
7042msgid "Key number %u does not exist\n"
7043msgstr ""
7044
7045#: src/service/testing/testing.c:1217
7046#, c-format
7047msgid ""
7048"You attempted to create a testbed with more than %u hosts. Please "
7049"precompute more hostkeys first.\n"
7050msgstr ""
7051
7052#: src/service/testing/testing.c:1226
7053#, fuzzy, c-format
7054msgid "Failed to initialize hostkey for peer %u\n"
7055msgstr "SQLite Datenbank konnte nicht initialisiert werden.\n"
7056
7057#: src/service/testing/testing.c:1236
7058msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
7059msgstr ""
7060
7061#: src/service/testing/testing.c:1249
7062msgid "Failed to create configuration for peer (not enough free ports?)\n"
7063msgstr ""
7064
7065#: src/service/testing/testing.c:1265
7066#, fuzzy, c-format
7067msgid "Cannot open hostkey file `%s': %s\n"
7068msgstr "Konfigurationsdatei `%s' konnte nicht geöffnet werden.\n"
7069
7070#: src/service/testing/testing.c:1279
7071#, fuzzy, c-format
7072msgid "Failed to write hostkey file for peer %u: %s\n"
7073msgstr "Datei wurde als `%s' gespeichert.\n"
7074
7075#: src/service/testing/testing.c:1307
7076#, fuzzy, c-format
7077msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7078msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':"
7079
7080#: src/service/testing/testing.c:1413
7081#, c-format
7082msgid "Failed to start `%s': %s\n"
7083msgstr "»%s« konnte nicht gestartet werden: %s\n"
7084
7085#: src/service/testing/testing.c:1664
7086#, c-format
7087msgid "Failed to load configuration from %s\n"
7088msgstr "Konfiguration konnte nicht aus %s geladen werden\n"
7089
7090#: src/service/testing/testing.c:2795
7091#, c-format
7092msgid "Topology file %s not found\n"
7093msgstr ""
7094
7095#: src/service/testing/testing.c:2803
7096#, c-format
7097msgid "Topology file %s has no data\n"
7098msgstr ""
7099
7100#: src/service/testing/testing.c:2811
7101#, c-format
7102msgid "Topology file %s cannot be read\n"
7103msgstr ""
7104
7105#: src/service/topology/gnunet-daemon-topology.c:286 7040#: src/service/topology/gnunet-daemon-topology.c:286
7106#, fuzzy 7041#, fuzzy
7107msgid "# connect requests issued to ATS" 7042msgid "# connect requests issued to ATS"
7108msgstr "# geschlossener Verbindungen (HANGUP gesendet)" 7043msgstr "# geschlossener Verbindungen (HANGUP gesendet)"
7109 7044
7110#: src/service/topology/gnunet-daemon-topology.c:480 7045#: src/service/topology/gnunet-daemon-topology.c:475
7111#, fuzzy 7046#, fuzzy
7112msgid "# HELLO messages gossipped" 7047msgid "# HELLO messages gossipped"
7113msgstr "# ausgehender Nachrichten verworfen" 7048msgstr "# ausgehender Nachrichten verworfen"
7114 7049
7115#: src/service/topology/gnunet-daemon-topology.c:752 7050#: src/service/topology/gnunet-daemon-topology.c:747
7116#, fuzzy 7051#, fuzzy
7117msgid "Error in communication with PEERSTORE service to monitor.\n" 7052msgid "Error in communication with PEERSTORE service to monitor.\n"
7118msgstr "Informationen über andere GNUnet Knoten ausgeben." 7053msgstr "Informationen über andere GNUnet Knoten ausgeben."
7119 7054
7120#: src/service/topology/gnunet-daemon-topology.c:761 7055#: src/service/topology/gnunet-daemon-topology.c:756
7121msgid "Finished initial PEERSTORE iteration in monitor.\n" 7056msgid "Finished initial PEERSTORE iteration in monitor.\n"
7122msgstr "" 7057msgstr ""
7123 7058
7124#: src/service/topology/gnunet-daemon-topology.c:869 7059#: src/service/topology/gnunet-daemon-topology.c:864
7125msgid "Failed to connect to core service, can not manage topology!\n" 7060msgid "Failed to connect to core service, can not manage topology!\n"
7126msgstr "" 7061msgstr ""
7127 7062
7128#: src/service/topology/gnunet-daemon-topology.c:943 7063#: src/service/topology/gnunet-daemon-topology.c:938
7129msgid "# HELLO messages received" 7064msgid "# HELLO messages received"
7130msgstr "# HELLO-Meldungen empfangen" 7065msgstr "# HELLO-Meldungen empfangen"
7131 7066
7132#: src/service/topology/gnunet-daemon-topology.c:1095 7067#: src/service/topology/gnunet-daemon-topology.c:1091
7133msgid "GNUnet topology control" 7068msgid "GNUnet topology control"
7134msgstr "" 7069msgstr ""
7135 7070
7136#: src/service/transport/gnunet-communicator-quic.c:1717 7071#: src/service/transport/gnunet-communicator-quic.c:1717
7137#: src/service/transport/gnunet-communicator-tcp.c:3777 7072#: src/service/transport/gnunet-communicator-tcp.c:3814
7138#: src/service/transport/gnunet-communicator-udp.c:3408 7073#: src/service/transport/gnunet-communicator-udp.c:3579
7139#: src/service/transport/gnunet-service-transport.c:12128 7074#: src/service/transport/gnunet-service-transport.c:12543
7140msgid "Transport service is lacking key configuration settings. Exiting.\n" 7075msgid "Transport service is lacking key configuration settings. Exiting.\n"
7141msgstr "" 7076msgstr ""
7142 7077
@@ -7144,11 +7079,11 @@ msgstr ""
7144msgid "GNUnet QUIC communicator" 7079msgid "GNUnet QUIC communicator"
7145msgstr "" 7080msgstr ""
7146 7081
7147#: src/service/transport/gnunet-communicator-tcp.c:4114 7082#: src/service/transport/gnunet-communicator-tcp.c:4171
7148msgid "GNUnet TCP communicator" 7083msgid "GNUnet TCP communicator"
7149msgstr "" 7084msgstr ""
7150 7085
7151#: src/service/transport/gnunet-communicator-udp.c:3483 7086#: src/service/transport/gnunet-communicator-udp.c:3654
7152msgid "GNUnet UDP communicator" 7087msgid "GNUnet UDP communicator"
7153msgstr "" 7088msgstr ""
7154 7089
@@ -7322,7 +7257,7 @@ msgstr ""
7322msgid "Direct access to transport service." 7257msgid "Direct access to transport service."
7323msgstr "Direkter Zugriff auf den Transportdienst" 7258msgstr "Direkter Zugriff auf den Transportdienst"
7324 7259
7325#: src/service/transport/transport_api2_communication.c:765 7260#: src/service/transport/transport_api2_communication.c:773
7326msgid "Dropped backchanel message: handler not provided by communicator\n" 7261msgid "Dropped backchanel message: handler not provided by communicator\n"
7327msgstr "" 7262msgstr ""
7328 7263
@@ -7453,6 +7388,26 @@ msgid "Failed to connect to the namestore!\n"
7453msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" 7388msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
7454 7389
7455#, fuzzy, c-format 7390#, fuzzy, c-format
7391#~ msgid "Failed to initialize hostkey for peer %u\n"
7392#~ msgstr "SQLite Datenbank konnte nicht initialisiert werden.\n"
7393
7394#, fuzzy, c-format
7395#~ msgid "Cannot open hostkey file `%s': %s\n"
7396#~ msgstr "Konfigurationsdatei `%s' konnte nicht geöffnet werden.\n"
7397
7398#, fuzzy, c-format
7399#~ msgid "Failed to write hostkey file for peer %u: %s\n"
7400#~ msgstr "Datei wurde als `%s' gespeichert.\n"
7401
7402#, fuzzy, c-format
7403#~ msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7404#~ msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':"
7405
7406#, c-format
7407#~ msgid "Failed to load configuration from %s\n"
7408#~ msgstr "Konfiguration konnte nicht aus %s geladen werden\n"
7409
7410#, fuzzy, c-format
7456#~ msgid "" 7411#~ msgid ""
7457#~ "Local peer: %s\n" 7412#~ "Local peer: %s\n"
7458#~ "\n" 7413#~ "\n"
@@ -8304,10 +8259,6 @@ msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n"
8304#~ msgstr "GNUnet Konfiguration" 8259#~ msgstr "GNUnet Konfiguration"
8305 8260
8306#, fuzzy 8261#, fuzzy
8307#~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n"
8308#~ msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n"
8309
8310#, fuzzy
8311#~ msgid "Unreadable or malformed configuration, exit ...\n" 8262#~ msgid "Unreadable or malformed configuration, exit ...\n"
8312#~ msgstr "GNUnet Konfiguration" 8263#~ msgstr "GNUnet Konfiguration"
8313 8264
diff --git a/po/es.po b/po/es.po
index 750fff717..741d67781 100644
--- a/po/es.po
+++ b/po/es.po
@@ -8,7 +8,7 @@ msgid ""
8msgstr "" 8msgstr ""
9"Project-Id-Version: gnunet 0.9.5a\n" 9"Project-Id-Version: gnunet 0.9.5a\n"
10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
11"POT-Creation-Date: 2024-03-02 14:38+0100\n" 11"POT-Creation-Date: 2024-05-20 20:21+0200\n"
12"PO-Revision-Date: 2013-02-23 17:50+0100\n" 12"PO-Revision-Date: 2013-02-23 17:50+0100\n"
13"Last-Translator: Miguel Ãngel Arruga Vivas <rosen644835@gmail.com>\n" 13"Last-Translator: Miguel Ãngel Arruga Vivas <rosen644835@gmail.com>\n"
14"Language-Team: Spanish <es@li.org>\n" 14"Language-Team: Spanish <es@li.org>\n"
@@ -360,23 +360,28 @@ msgstr "Se produjo un fallo al procesar la identidad del par «%s»\n"
360msgid "Failed to connect to CORE service!\n" 360msgid "Failed to connect to CORE service!\n"
361msgstr "¡Se produjo un fallo al conectar con el servicio DHT!\n" 361msgstr "¡Se produjo un fallo al conectar con el servicio DHT!\n"
362 362
363#: src/cli/core/gnunet-core.c:213
364#, fuzzy
365msgid "No argument given.\n"
366msgstr "No se han proporcionado opciones\n"
367
363# Miguel: ¿Quizá continuamente fuese mejor? 368# Miguel: ¿Quizá continuamente fuese mejor?
364#: src/cli/core/gnunet-core.c:230 src/service/transport/gnunet-transport.c:1389 369#: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389
365msgid "provide information about all current connections (continuously)" 370msgid "provide information about all current connections (continuously)"
366msgstr "" 371msgstr ""
367"provee información sobre todas las conexiones actuales (de forma continua)" 372"provee información sobre todas las conexiones actuales (de forma continua)"
368 373
369#: src/cli/core/gnunet-core.c:236 374#: src/cli/core/gnunet-core.c:244
370#, fuzzy 375#, fuzzy
371msgid "Show our current peer identity" 376msgid "Show our current peer identity"
372msgstr "identidad del par" 377msgstr "identidad del par"
373 378
374#: src/cli/core/gnunet-core.c:243 379#: src/cli/core/gnunet-core.c:251
375#, fuzzy 380#, fuzzy
376msgid "Show current connections" 381msgid "Show current connections"
377msgstr "# conexiones activas" 382msgstr "# conexiones activas"
378 383
379#: src/cli/core/gnunet-core.c:254 384#: src/cli/core/gnunet-core.c:262
380msgid "Print information about connected peers." 385msgid "Print information about connected peers."
381msgstr "Imprime información sobre los pares conectados." 386msgstr "Imprime información sobre los pares conectados."
382 387
@@ -1112,55 +1117,55 @@ msgstr "No se pudo empezar la operación de desindexado.\n"
1112msgid "Unindex a file that was previously indexed with gnunet-publish." 1117msgid "Unindex a file that was previously indexed with gnunet-publish."
1113msgstr "Desindexa un fichero previamente indexado con «gnunet-publish»." 1118msgstr "Desindexa un fichero previamente indexado con «gnunet-publish»."
1114 1119
1115#: src/cli/gns/gnunet-gns.c:268 1120#: src/cli/gns/gnunet-gns.c:269
1116#, fuzzy, c-format 1121#, fuzzy, c-format
1117msgid "`%s' is not a valid DNS domain name\n" 1122msgid "`%s' is not a valid DNS domain name\n"
1118msgstr "«%s» no es una dirección IP válida.\n" 1123msgstr "«%s» no es una dirección IP válida.\n"
1119 1124
1120#: src/cli/gns/gnunet-gns.c:279 src/lib/util/dnsparser.c:273 1125#: src/cli/gns/gnunet-gns.c:280 src/lib/util/dnsparser.c:273
1121#, c-format 1126#, c-format
1122msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" 1127msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
1123msgstr "" 1128msgstr ""
1124"Se produjo un fallo al convertir el nombre en formato DNS IDNA «%s» a UTF-8: " 1129"Se produjo un fallo al convertir el nombre en formato DNS IDNA «%s» a UTF-8: "
1125"%s\n" 1130"%s\n"
1126 1131
1127#: src/cli/gns/gnunet-gns.c:294 1132#: src/cli/gns/gnunet-gns.c:295
1128msgid "Cannot resolve using GNS: GNUnet peer not running\n" 1133msgid "Cannot resolve using GNS: GNUnet peer not running\n"
1129msgstr "" 1134msgstr ""
1130 1135
1131#: src/cli/gns/gnunet-gns.c:305 1136#: src/cli/gns/gnunet-gns.c:306
1132#: src/contrib/service/abd/gnunet-service-abd.c:1745 1137#: src/contrib/service/abd/gnunet-service-abd.c:1745
1133#, c-format 1138#, c-format
1134msgid "Failed to connect to GNS\n" 1139msgid "Failed to connect to GNS\n"
1135msgstr "Se produjo un fallo al conectar con GNS\n" 1140msgstr "Se produjo un fallo al conectar con GNS\n"
1136 1141
1137#: src/cli/gns/gnunet-gns.c:318 1142#: src/cli/gns/gnunet-gns.c:325
1138#, c-format 1143#, c-format
1139msgid "Invalid typename specified, assuming `ANY'\n" 1144msgid "Invalid typename specified, assuming `ANY'\n"
1140msgstr "" 1145msgstr ""
1141 1146
1142#: src/cli/gns/gnunet-gns.c:358 1147#: src/cli/gns/gnunet-gns.c:365
1143msgid "Lookup a record for the given name" 1148msgid "Lookup a record for the given name"
1144msgstr "Buscar el registro para el nombre dado" 1149msgstr "Buscar el registro para el nombre dado"
1145 1150
1146#: src/cli/gns/gnunet-gns.c:364 1151#: src/cli/gns/gnunet-gns.c:371
1147msgid "Specify the type of the record to lookup" 1152msgid "Specify the type of the record to lookup"
1148msgstr "Especificar el tipo del registro a buscar" 1153msgstr "Especificar el tipo del registro a buscar"
1149 1154
1150#: src/cli/gns/gnunet-gns.c:370 1155#: src/cli/gns/gnunet-gns.c:377
1151#, fuzzy 1156#, fuzzy
1152msgid "Specify a timeout for the lookup" 1157msgid "Specify a timeout for the lookup"
1153msgstr "Especificar el tipo del registro a buscar" 1158msgstr "Especificar el tipo del registro a buscar"
1154 1159
1155#: src/cli/gns/gnunet-gns.c:374 1160#: src/cli/gns/gnunet-gns.c:381
1156msgid "No unneeded output" 1161msgid "No unneeded output"
1157msgstr "Sin salida innecesaria" 1162msgstr "Sin salida innecesaria"
1158 1163
1159#: src/cli/gns/gnunet-gns.c:379 1164#: src/cli/gns/gnunet-gns.c:386
1160msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" 1165msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
1161msgstr "" 1166msgstr ""
1162 1167
1163#: src/cli/gns/gnunet-gns.c:393 1168#: src/cli/gns/gnunet-gns.c:400
1164#, fuzzy 1169#, fuzzy
1165msgid "GNUnet GNS resolver tool" 1170msgid "GNUnet GNS resolver tool"
1166msgstr "Herramienta de acceso GNUnet GNS" 1171msgstr "Herramienta de acceso GNUnet GNS"
@@ -1697,7 +1702,11 @@ msgstr "# pares desconectados debido a petición externa"
1697msgid "GNUnet NAT traversal autoconfigure daemon" 1702msgid "GNUnet NAT traversal autoconfigure daemon"
1698msgstr "Demonio de ayuda en las pruebas de recorrido NAT de GNUnet" 1703msgstr "Demonio de ayuda en las pruebas de recorrido NAT de GNUnet"
1699 1704
1700#: src/cli/nse/gnunet-nse.c:124 1705#: src/cli/nse/gnunet-nse.c:126
1706msgid "Monitor and output current estimates"
1707msgstr ""
1708
1709#: src/cli/nse/gnunet-nse.c:137
1701#, fuzzy 1710#, fuzzy
1702msgid "Show network size estimates from NSE service." 1711msgid "Show network size estimates from NSE service."
1703msgstr "# Estimaciones del tamaño de red recibidas" 1712msgstr "# Estimaciones del tamaño de red recibidas"
@@ -1746,87 +1755,91 @@ msgstr ""
1746msgid "The time until the DID Document is going to expire (e.g. 5d)" 1755msgid "The time until the DID Document is going to expire (e.g. 5d)"
1747msgstr "" 1756msgstr ""
1748 1757
1749#: src/cli/reclaim/gnunet-reclaim.c:805 1758#: src/cli/reclaim/gnunet-reclaim.c:813
1750#, fuzzy, c-format 1759#, fuzzy, c-format
1751msgid "Ego is required\n" 1760msgid "Ego is required\n"
1752msgstr "Las opción «%s» o «%s» es necesaria.\n" 1761msgstr "Las opción «%s» o «%s» es necesaria.\n"
1753 1762
1754#: src/cli/reclaim/gnunet-reclaim.c:812 1763#: src/cli/reclaim/gnunet-reclaim.c:820
1755#, c-format 1764#, c-format
1756msgid "Attribute value missing!\n" 1765msgid "Attribute value missing!\n"
1757msgstr "" 1766msgstr ""
1758 1767
1759#: src/cli/reclaim/gnunet-reclaim.c:819 1768#: src/cli/reclaim/gnunet-reclaim.c:827
1760#, fuzzy, c-format 1769#, fuzzy, c-format
1761msgid "Requesting party key is required!\n" 1770msgid "Requesting party key is required!\n"
1762msgstr "el parámetro --section es necesario\n" 1771msgstr "el parámetro --section es necesario\n"
1763 1772
1764#: src/cli/reclaim/gnunet-reclaim.c:837 1773#: src/cli/reclaim/gnunet-reclaim.c:846
1765msgid "Add or update an attribute NAME" 1774msgid "Add or update an attribute NAME"
1766msgstr "" 1775msgstr ""
1767 1776
1768#: src/cli/reclaim/gnunet-reclaim.c:842 1777#: src/cli/reclaim/gnunet-reclaim.c:851
1769msgid "Delete the attribute with ID" 1778msgid "Delete the attribute with ID"
1770msgstr "" 1779msgstr ""
1771 1780
1772#: src/cli/reclaim/gnunet-reclaim.c:847 1781#: src/cli/reclaim/gnunet-reclaim.c:856
1773msgid "The attribute VALUE" 1782msgid "The attribute VALUE"
1774msgstr "" 1783msgstr ""
1775 1784
1776#: src/cli/reclaim/gnunet-reclaim.c:852 1785#: src/cli/reclaim/gnunet-reclaim.c:861
1777#, fuzzy 1786#, fuzzy
1778msgid "The EGO to use" 1787msgid "The EGO to use"
1779msgstr "tamaño del mensaje" 1788msgstr "tamaño del mensaje"
1780 1789
1781#: src/cli/reclaim/gnunet-reclaim.c:858 1790#: src/cli/reclaim/gnunet-reclaim.c:867
1782msgid "Specify the relying party for issue" 1791msgid "Specify the relying party for issue"
1783msgstr "" 1792msgstr ""
1784 1793
1785#: src/cli/reclaim/gnunet-reclaim.c:862 1794#: src/cli/reclaim/gnunet-reclaim.c:873
1795msgid "Specify the relying party URI for a ticket to consume"
1796msgstr ""
1797
1798#: src/cli/reclaim/gnunet-reclaim.c:877
1786msgid "List attributes for EGO" 1799msgid "List attributes for EGO"
1787msgstr "" 1800msgstr ""
1788 1801
1789#: src/cli/reclaim/gnunet-reclaim.c:866 1802#: src/cli/reclaim/gnunet-reclaim.c:881
1790msgid "List credentials for EGO" 1803msgid "List credentials for EGO"
1791msgstr "" 1804msgstr ""
1792 1805
1793#: src/cli/reclaim/gnunet-reclaim.c:872 1806#: src/cli/reclaim/gnunet-reclaim.c:887
1794msgid "Credential to use for attribute" 1807msgid "Credential to use for attribute"
1795msgstr "" 1808msgstr ""
1796 1809
1797#: src/cli/reclaim/gnunet-reclaim.c:877 1810#: src/cli/reclaim/gnunet-reclaim.c:892
1798msgid "Credential name" 1811msgid "Credential name"
1799msgstr "" 1812msgstr ""
1800 1813
1801#: src/cli/reclaim/gnunet-reclaim.c:883 1814#: src/cli/reclaim/gnunet-reclaim.c:898
1802msgid "Issue a ticket for a set of attributes separated by comma" 1815msgid "Issue a ticket for a set of attributes separated by comma"
1803msgstr "" 1816msgstr ""
1804 1817
1805#: src/cli/reclaim/gnunet-reclaim.c:888 1818#: src/cli/reclaim/gnunet-reclaim.c:903
1806msgid "Consume a ticket" 1819msgid "Consume a ticket"
1807msgstr "" 1820msgstr ""
1808 1821
1809#: src/cli/reclaim/gnunet-reclaim.c:893 1822#: src/cli/reclaim/gnunet-reclaim.c:908
1810msgid "Revoke a ticket" 1823msgid "Revoke a ticket"
1811msgstr "" 1824msgstr ""
1812 1825
1813#: src/cli/reclaim/gnunet-reclaim.c:898 1826#: src/cli/reclaim/gnunet-reclaim.c:913
1814msgid "Type of attribute" 1827msgid "Type of attribute"
1815msgstr "" 1828msgstr ""
1816 1829
1817#: src/cli/reclaim/gnunet-reclaim.c:903 1830#: src/cli/reclaim/gnunet-reclaim.c:918
1818msgid "Type of credential" 1831msgid "Type of credential"
1819msgstr "" 1832msgstr ""
1820 1833
1821#: src/cli/reclaim/gnunet-reclaim.c:907 1834#: src/cli/reclaim/gnunet-reclaim.c:922
1822msgid "List tickets of ego" 1835msgid "List tickets of ego"
1823msgstr "" 1836msgstr ""
1824 1837
1825#: src/cli/reclaim/gnunet-reclaim.c:913 1838#: src/cli/reclaim/gnunet-reclaim.c:928
1826msgid "Expiration interval of the attribute" 1839msgid "Expiration interval of the attribute"
1827msgstr "" 1840msgstr ""
1828 1841
1829#: src/cli/reclaim/gnunet-reclaim.c:921 1842#: src/cli/reclaim/gnunet-reclaim.c:936
1830msgid "re:claimID command line tool" 1843msgid "re:claimID command line tool"
1831msgstr "" 1844msgstr ""
1832 1845
@@ -2066,33 +2079,59 @@ msgstr "Imprime estadísticas acerca de las operaciones de GNUnet."
2066msgid "run decoder modus, otherwise runs as encoder" 2079msgid "run decoder modus, otherwise runs as encoder"
2067msgstr "" 2080msgstr ""
2068 2081
2069#: src/cli/util/gnunet-config.c:154 2082#: src/cli/util/gnunet-config.c:101
2070msgid "test if the current installation supports the specified BACKEND" 2083msgid "test if the current installation supports the specified BACKEND"
2071msgstr "" 2084msgstr ""
2072 2085
2073#: src/cli/util/gnunet-config.c:160 2086#: src/cli/util/gnunet-config.c:107
2074msgid "" 2087msgid ""
2075"Provide an appropriate value for CFLAGS to applications building on top of " 2088"Provide an appropriate value for CFLAGS to applications building on top of "
2076"GNUnet" 2089"GNUnet"
2077msgstr "" 2090msgstr ""
2078 2091
2079#: src/cli/util/gnunet-config.c:165 2092#: src/cli/util/gnunet-config.c:112
2080msgid "Is this an experimental build of GNUnet" 2093msgid "Is this an experimental build of GNUnet"
2081msgstr "" 2094msgstr ""
2082 2095
2083#: src/cli/util/gnunet-config.c:171 2096#: src/cli/util/gnunet-config.c:118
2084msgid "" 2097msgid ""
2085"Provide an appropriate value for LIBS to applications building on top of " 2098"Provide an appropriate value for LIBS to applications building on top of "
2086"GNUnet" 2099"GNUnet"
2087msgstr "" 2100msgstr ""
2088 2101
2089#: src/cli/util/gnunet-config.c:177 2102#: src/cli/util/gnunet-config.c:123
2103#, fuzzy
2104msgid "Do not parse default configuration files"
2105msgstr "Manipular ficheros de configuración de GNUnet"
2106
2107#: src/cli/util/gnunet-config.c:129
2090msgid "Provide the path under which GNUnet was installed" 2108msgid "Provide the path under which GNUnet was installed"
2091msgstr "" 2109msgstr ""
2092 2110
2093#: src/cli/util/gnunet-config.c:192 2111#: src/cli/util/gnunet-config.c:136
2094msgid "Manipulate GNUnet configuration files" 2112msgid ""
2095msgstr "Manipular ficheros de configuración de GNUnet" 2113"Parse main configuration from this command-line argument and not from disk"
2114msgstr ""
2115
2116#: src/cli/util/gnunet-config.c:225
2117#, fuzzy
2118msgid "Failed to load default configuration, exiting ...\n"
2119msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
2120
2121#: src/cli/util/gnunet-config.c:237
2122#, fuzzy
2123msgid "Failed to parse configuration, exiting ...\n"
2124msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
2125
2126#: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287
2127#, fuzzy, c-format
2128msgid "Unreadable configuration file `%s', exiting ...\n"
2129msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
2130
2131#: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299
2132#, fuzzy, c-format
2133msgid "Malformed configuration file `%s', exiting ...\n"
2134msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
2096 2135
2097#: src/cli/util/gnunet-crypto-tvg.c:1588 2136#: src/cli/util/gnunet-crypto-tvg.c:1588
2098msgid "verify a test vector from stdin" 2137msgid "verify a test vector from stdin"
@@ -2141,57 +2180,56 @@ msgstr ""
2141msgid "Hostkeys file `%s' not found\n" 2180msgid "Hostkeys file `%s' not found\n"
2142msgstr "El fichero de máquinas %s no fue encontrado\n" 2181msgstr "El fichero de máquinas %s no fue encontrado\n"
2143 2182
2144#: src/cli/util/gnunet-ecc.c:314 2183#: src/cli/util/gnunet-ecc.c:318
2145#, fuzzy, c-format 2184#, fuzzy, c-format
2146msgid "Hostkeys file `%s' is empty\n" 2185msgid "Hostkeys file `%s' is empty\n"
2147msgstr "El archivo de amigos «%s» está vacío.\n" 2186msgstr "El archivo de amigos «%s» está vacío.\n"
2148 2187
2149#: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 2188#: src/cli/util/gnunet-ecc.c:324
2150#: src/service/testing/testing.c:308
2151#, c-format 2189#, c-format
2152msgid "Incorrect hostkey file format: %s\n" 2190msgid "Incorrect hostkey file format: %s\n"
2153msgstr "El fichero de máquinas no tiene el formato correcto: %s\n" 2191msgstr "El fichero de máquinas no tiene el formato correcto: %s\n"
2154 2192
2155#: src/cli/util/gnunet-ecc.c:334 2193#: src/cli/util/gnunet-ecc.c:340
2156#, fuzzy, c-format 2194#, fuzzy, c-format
2157msgid "Could not read hostkey file: %s\n" 2195msgid "Could not read hostkey file: %s\n"
2158msgstr "¡No se puede leer el fichero de claves de máquina!\n" 2196msgstr "¡No se puede leer el fichero de claves de máquina!\n"
2159 2197
2160#: src/cli/util/gnunet-ecc.c:388 2198#: src/cli/util/gnunet-ecc.c:394
2161msgid "No hostkey file specified on command line\n" 2199msgid "No hostkey file specified on command line\n"
2162msgstr "No se ha especificado la clave de máquina en la línea de comandos\n" 2200msgstr "No se ha especificado la clave de máquina en la línea de comandos\n"
2163 2201
2164#: src/cli/util/gnunet-ecc.c:452 2202#: src/cli/util/gnunet-ecc.c:458
2165msgid "list keys included in a file (for testing)" 2203msgid "list keys included in a file (for testing)"
2166msgstr "" 2204msgstr ""
2167 2205
2168#: src/cli/util/gnunet-ecc.c:458 2206#: src/cli/util/gnunet-ecc.c:464
2169msgid "number of keys to list included in a file (for testing)" 2207msgid "number of keys to list included in a file (for testing)"
2170msgstr "" 2208msgstr ""
2171 2209
2172#: src/cli/util/gnunet-ecc.c:464 2210#: src/cli/util/gnunet-ecc.c:470
2173msgid "create COUNT public-private key pairs (for testing)" 2211msgid "create COUNT public-private key pairs (for testing)"
2174msgstr "crea «COUNT» pares de claves pública-privada (para pruebas)" 2212msgstr "crea «COUNT» pares de claves pública-privada (para pruebas)"
2175 2213
2176#: src/cli/util/gnunet-ecc.c:469 2214#: src/cli/util/gnunet-ecc.c:475
2177msgid "print the public key in ASCII format" 2215msgid "print the public key in ASCII format"
2178msgstr "imprime la clave pública en formato ASCII" 2216msgstr "imprime la clave pública en formato ASCII"
2179 2217
2180#: src/cli/util/gnunet-ecc.c:474 2218#: src/cli/util/gnunet-ecc.c:480
2181#, fuzzy 2219#, fuzzy
2182msgid "print the private key in ASCII format" 2220msgid "print the private key in ASCII format"
2183msgstr "imprime la clave pública en formato ASCII" 2221msgstr "imprime la clave pública en formato ASCII"
2184 2222
2185#: src/cli/util/gnunet-ecc.c:479 2223#: src/cli/util/gnunet-ecc.c:485
2186#, fuzzy 2224#, fuzzy
2187msgid "print the public key in HEX format" 2225msgid "print the public key in HEX format"
2188msgstr "imprime la clave pública en formato ASCII" 2226msgstr "imprime la clave pública en formato ASCII"
2189 2227
2190#: src/cli/util/gnunet-ecc.c:485 2228#: src/cli/util/gnunet-ecc.c:491
2191msgid "print examples of ECC operations (used for compatibility testing)" 2229msgid "print examples of ECC operations (used for compatibility testing)"
2192msgstr "" 2230msgstr ""
2193 2231
2194#: src/cli/util/gnunet-ecc.c:499 2232#: src/cli/util/gnunet-ecc.c:505
2195msgid "Manipulate GNUnet private ECC key files" 2233msgid "Manipulate GNUnet private ECC key files"
2196msgstr "Manipular los ficheros de clave privada ECC de GNUnet" 2234msgstr "Manipular los ficheros de clave privada ECC de GNUnet"
2197 2235
@@ -3284,14 +3322,14 @@ msgstr ""
3284msgid "Invalid handle type while writing `%s'" 3322msgid "Invalid handle type while writing `%s'"
3285msgstr "Formato de tiempo no válido «%s»\n" 3323msgstr "Formato de tiempo no válido «%s»\n"
3286 3324
3287#: src/lib/util/client.c:531 src/lib/util/service.c:1134 3325#: src/lib/util/client.c:531 src/lib/util/service.c:1139
3288#: src/service/arm/gnunet-service-arm.c:452 3326#: src/service/arm/gnunet-service-arm.c:452
3289#, c-format 3327#, c-format
3290msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 3328msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
3291msgstr "" 3329msgstr ""
3292"La ruta tipo UNIX «%s» es demasiado larga, la longitud máxima es %llu\n" 3330"La ruta tipo UNIX «%s» es demasiado larga, la longitud máxima es %llu\n"
3293 3331
3294#: src/lib/util/client.c:536 src/lib/util/service.c:1138 3332#: src/lib/util/client.c:536 src/lib/util/service.c:1143
3295#: src/service/arm/gnunet-service-arm.c:456 3333#: src/service/arm/gnunet-service-arm.c:456
3296#, c-format 3334#, c-format
3297msgid "Using `%s' instead\n" 3335msgid "Using `%s' instead\n"
@@ -3426,17 +3464,17 @@ msgstr ""
3426msgid "`%s' failed at %s:%d with error: %s\n" 3464msgid "`%s' failed at %s:%d with error: %s\n"
3427msgstr "«%s» falló en %s: %d con el error: %s\n" 3465msgstr "«%s» falló en %s: %d con el error: %s\n"
3428 3466
3429#: src/lib/util/crypto_ecc.c:554 3467#: src/lib/util/crypto_ecc.c:569
3430#, c-format 3468#, c-format
3431msgid "ECC signing failed at %s:%d: %s\n" 3469msgid "ECC signing failed at %s:%d: %s\n"
3432msgstr "El firmado ECC falló en %s:%d: %s\n" 3470msgstr "El firmado ECC falló en %s:%d: %s\n"
3433 3471
3434#: src/lib/util/crypto_ecc.c:677 3472#: src/lib/util/crypto_ecc.c:692
3435#, fuzzy, c-format 3473#, fuzzy, c-format
3436msgid "ECDSA signature verification failed at %s:%d: %s\n" 3474msgid "ECDSA signature verification failed at %s:%d: %s\n"
3437msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n" 3475msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n"
3438 3476
3439#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:304 3477#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:305
3440#, fuzzy 3478#, fuzzy
3441msgid "Could not load peer's private key\n" 3479msgid "Could not load peer's private key\n"
3442msgstr "No se pudo acceder a la clave de máquina.\n" 3480msgstr "No se pudo acceder a la clave de máquina.\n"
@@ -3461,7 +3499,7 @@ msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n"
3461msgid "Expected `%s' to be a directory!\n" 3499msgid "Expected `%s' to be a directory!\n"
3462msgstr "¡Se esperaba que «%s» fuera un directorio!\n" 3500msgstr "¡Se esperaba que «%s» fuera un directorio!\n"
3463 3501
3464#: src/lib/util/disk.c:1222 src/lib/util/service.c:1642 3502#: src/lib/util/disk.c:1222 src/lib/util/service.c:1651
3465#, c-format 3503#, c-format
3466msgid "Cannot obtain information about user `%s': %s\n" 3504msgid "Cannot obtain information about user `%s': %s\n"
3467msgstr "No se pudo obtener información acerca del usuario «%s»: %s\n" 3505msgstr "No se pudo obtener información acerca del usuario «%s»: %s\n"
@@ -3656,102 +3694,102 @@ msgstr "Tienes que introducir un número en la opción «%s».\n"
3656msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 3694msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
3657msgstr "" 3695msgstr ""
3658 3696
3659#: src/lib/util/gnunet_error_codes.c:60 3697#: src/lib/util/gnunet_error_codes.c:59
3660msgid "No error (success)." 3698msgid "No error (success)."
3661msgstr "" 3699msgstr ""
3662 3700
3663#: src/lib/util/gnunet_error_codes.c:66 3701#: src/lib/util/gnunet_error_codes.c:65
3664#, fuzzy 3702#, fuzzy
3665msgid "Unknown and unspecified error." 3703msgid "Unknown and unspecified error."
3666msgstr "Error desconocido" 3704msgstr "Error desconocido"
3667 3705
3668# Miguel: ¿Conectar y conexión? 3706# Miguel: ¿Conectar y conexión?
3669#: src/lib/util/gnunet_error_codes.c:72 3707#: src/lib/util/gnunet_error_codes.c:71
3670#, fuzzy 3708#, fuzzy
3671msgid "Communication with service failed." 3709msgid "Communication with service failed."
3672msgstr "Error al comunicar con el servicio ARM.\n" 3710msgstr "Error al comunicar con el servicio ARM.\n"
3673 3711
3674#: src/lib/util/gnunet_error_codes.c:78 3712#: src/lib/util/gnunet_error_codes.c:77
3675#, fuzzy 3713#, fuzzy
3676msgid "Ego not found." 3714msgid "Ego not found."
3677msgstr "Contenido no encontrado" 3715msgstr "Contenido no encontrado"
3678 3716
3679#: src/lib/util/gnunet_error_codes.c:84 3717#: src/lib/util/gnunet_error_codes.c:83
3680msgid "Identifier already in use for another ego." 3718msgid "Identifier already in use for another ego."
3681msgstr "" 3719msgstr ""
3682 3720
3683#: src/lib/util/gnunet_error_codes.c:90 3721#: src/lib/util/gnunet_error_codes.c:89
3684msgid "The given ego is invalid or malformed." 3722msgid "The given ego is invalid or malformed."
3685msgstr "" 3723msgstr ""
3686 3724
3687#: src/lib/util/gnunet_error_codes.c:96 3725#: src/lib/util/gnunet_error_codes.c:95
3688#, fuzzy 3726#, fuzzy
3689msgid "Unknown namestore error." 3727msgid "Unknown namestore error."
3690msgstr "Error desconocido" 3728msgstr "Error desconocido"
3691 3729
3692#: src/lib/util/gnunet_error_codes.c:102 src/lib/util/gnunet_error_codes.c:120 3730#: src/lib/util/gnunet_error_codes.c:101 src/lib/util/gnunet_error_codes.c:119
3693#, fuzzy 3731#, fuzzy
3694msgid "Zone iteration failed." 3732msgid "Zone iteration failed."
3695msgstr "# sesiones wlan creadas" 3733msgstr "# sesiones wlan creadas"
3696 3734
3697#: src/lib/util/gnunet_error_codes.c:108 3735#: src/lib/util/gnunet_error_codes.c:107
3698#, fuzzy 3736#, fuzzy
3699msgid "Zone not found." 3737msgid "Zone not found."
3700msgstr "Contenido no encontrado" 3738msgstr "Contenido no encontrado"
3701 3739
3702#: src/lib/util/gnunet_error_codes.c:114 3740#: src/lib/util/gnunet_error_codes.c:113
3703#, fuzzy 3741#, fuzzy
3704msgid "Record not found." 3742msgid "Record not found."
3705msgstr "«upnpc» no encontrado\n" 3743msgstr "«upnpc» no encontrado\n"
3706 3744
3707#: src/lib/util/gnunet_error_codes.c:126 3745#: src/lib/util/gnunet_error_codes.c:125
3708#, fuzzy 3746#, fuzzy
3709msgid "Zone does not contain any records." 3747msgid "Zone does not contain any records."
3710msgstr "El fichero '%s' no contiene un pseudónimo.\n" 3748msgstr "El fichero '%s' no contiene un pseudónimo.\n"
3711 3749
3712#: src/lib/util/gnunet_error_codes.c:132 3750#: src/lib/util/gnunet_error_codes.c:131
3713#, fuzzy 3751#, fuzzy
3714msgid "Failed to lookup record." 3752msgid "Failed to lookup record."
3715msgstr "El almacén de nombres no pudo añadir el registro\n" 3753msgstr "El almacén de nombres no pudo añadir el registro\n"
3716 3754
3717#: src/lib/util/gnunet_error_codes.c:138 3755#: src/lib/util/gnunet_error_codes.c:137
3718#, fuzzy 3756#, fuzzy
3719msgid "No records given." 3757msgid "No records given."
3720msgstr "No se han proporcionado opciones\n" 3758msgstr "No se han proporcionado opciones\n"
3721 3759
3722#: src/lib/util/gnunet_error_codes.c:144 3760#: src/lib/util/gnunet_error_codes.c:143
3723msgid "Record data invalid." 3761msgid "Record data invalid."
3724msgstr "" 3762msgstr ""
3725 3763
3726#: src/lib/util/gnunet_error_codes.c:150 3764#: src/lib/util/gnunet_error_codes.c:149
3727#, fuzzy 3765#, fuzzy
3728msgid "No label given." 3766msgid "No label given."
3729msgstr "No se han proporcionado opciones\n" 3767msgstr "No se han proporcionado opciones\n"
3730 3768
3731#: src/lib/util/gnunet_error_codes.c:156 3769#: src/lib/util/gnunet_error_codes.c:155
3732#, fuzzy 3770#, fuzzy
3733msgid "No results given." 3771msgid "No results given."
3734msgstr "No se han proporcionado opciones\n" 3772msgstr "No se han proporcionado opciones\n"
3735 3773
3736#: src/lib/util/gnunet_error_codes.c:162 3774#: src/lib/util/gnunet_error_codes.c:161
3737#, fuzzy 3775#, fuzzy
3738msgid "Record already exists." 3776msgid "Record already exists."
3739msgstr "El registro ya existía en el almacén de nombres" 3777msgstr "El registro ya existía en el almacén de nombres"
3740 3778
3741#: src/lib/util/gnunet_error_codes.c:168 3779#: src/lib/util/gnunet_error_codes.c:167
3742msgid "Record size exceeds maximum limit." 3780msgid "Record size exceeds maximum limit."
3743msgstr "" 3781msgstr ""
3744 3782
3745#: src/lib/util/gnunet_error_codes.c:174 3783#: src/lib/util/gnunet_error_codes.c:173
3746msgid "There was an error in the database backend." 3784msgid "There was an error in the database backend."
3747msgstr "" 3785msgstr ""
3748 3786
3749#: src/lib/util/gnunet_error_codes.c:180 3787#: src/lib/util/gnunet_error_codes.c:179
3750#, fuzzy 3788#, fuzzy
3751msgid "Failed to store the given records." 3789msgid "Failed to store the given records."
3752msgstr "El almacén de nombres no pudo añadir el registro\n" 3790msgstr "El almacén de nombres no pudo añadir el registro\n"
3753 3791
3754#: src/lib/util/gnunet_error_codes.c:186 3792#: src/lib/util/gnunet_error_codes.c:185
3755msgid "Label invalid or malformed." 3793msgid "Label invalid or malformed."
3756msgstr "" 3794msgstr ""
3757 3795
@@ -3823,16 +3861,6 @@ msgstr "Falló «%s» para la biblioteca «%s» con error: %s\n"
3823msgid "Could not determine plugin installation path.\n" 3861msgid "Could not determine plugin installation path.\n"
3824msgstr "No se pudo determinar la ruta de instalación de los módulos.\n" 3862msgstr "No se pudo determinar la ruta de instalación de los módulos.\n"
3825 3863
3826#: src/lib/util/program.c:287
3827#, fuzzy, c-format
3828msgid "Unreadable configuration file `%s', exiting ...\n"
3829msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
3830
3831#: src/lib/util/program.c:299
3832#, fuzzy, c-format
3833msgid "Malformed configuration file `%s', exiting ...\n"
3834msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
3835
3836#: src/lib/util/program.c:314 3864#: src/lib/util/program.c:314
3837#, fuzzy, c-format 3865#, fuzzy, c-format
3838msgid "Unreadable configuration file `%s'. Exiting ...\n" 3866msgid "Unreadable configuration file `%s'. Exiting ...\n"
@@ -3888,7 +3916,7 @@ msgid "Could not resolve our FQDN: %s\n"
3888msgstr "" 3916msgstr ""
3889"No se pudo resolver nuestro nombre de dominio cualificado (FQDN) : %s\n" 3917"No se pudo resolver nuestro nombre de dominio cualificado (FQDN) : %s\n"
3890 3918
3891#: src/lib/util/service.c:654 3919#: src/lib/util/service.c:650
3892#, fuzzy, c-format 3920#, fuzzy, c-format
3893msgid "" 3921msgid ""
3894"Processing code for message of type %u did not call " 3922"Processing code for message of type %u did not call "
@@ -3897,22 +3925,22 @@ msgstr ""
3897"El código de procesado para el mensaje del tipo %u no llamó a " 3925"El código de procesado para el mensaje del tipo %u no llamó a "
3898"«GNUNET_SERVER_receive_done» después de %s\n" 3926"«GNUNET_SERVER_receive_done» después de %s\n"
3899 3927
3900#: src/lib/util/service.c:838 3928#: src/lib/util/service.c:841
3901#, c-format 3929#, c-format
3902msgid "Unknown address family %d\n" 3930msgid "Unknown address family %d\n"
3903msgstr "Familia de direcciones %d desconocida\n" 3931msgstr "Familia de direcciones %d desconocida\n"
3904 3932
3905#: src/lib/util/service.c:951 3933#: src/lib/util/service.c:956
3906#, c-format 3934#, c-format
3907msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 3935msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
3908msgstr "No se pudo procesar la especificación de red IPv4 «%s» para «%s:%s»\n" 3936msgstr "No se pudo procesar la especificación de red IPv4 «%s» para «%s:%s»\n"
3909 3937
3910#: src/lib/util/service.c:992 3938#: src/lib/util/service.c:997
3911#, c-format 3939#, c-format
3912msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 3940msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
3913msgstr "No se pudo procesar la especificación de red IPv6 «%s» para «%s:%s»\n" 3941msgstr "No se pudo procesar la especificación de red IPv6 «%s» para «%s:%s»\n"
3914 3942
3915#: src/lib/util/service.c:1095 src/lib/util/service.c:1101 3943#: src/lib/util/service.c:1100 src/lib/util/service.c:1106
3916#: src/service/arm/gnunet-service-arm.c:412 3944#: src/service/arm/gnunet-service-arm.c:412
3917#: src/service/arm/gnunet-service-arm.c:418 3945#: src/service/arm/gnunet-service-arm.c:418
3918#, c-format 3946#, c-format
@@ -3921,7 +3949,7 @@ msgstr ""
3921"¡Se requiere un número de puerto válido para el servicio «%s» en la " 3949"¡Se requiere un número de puerto válido para el servicio «%s» en la "
3922"configuración!\n" 3950"configuración!\n"
3923 3951
3924#: src/lib/util/service.c:1158 src/service/arm/gnunet-service-arm.c:484 3952#: src/lib/util/service.c:1163 src/service/arm/gnunet-service-arm.c:484
3925#, c-format 3953#, c-format
3926msgid "" 3954msgid ""
3927"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 3955"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
@@ -3930,89 +3958,89 @@ msgstr ""
3930"Deshabilitando el soporte de dominio de «sockets» UNIX para el servicio " 3958"Deshabilitando el soporte de dominio de «sockets» UNIX para el servicio "
3931"«%s», no se pudo crear un «socket» UNIX: %s\n" 3959"«%s», no se pudo crear un «socket» UNIX: %s\n"
3932 3960
3933#: src/lib/util/service.c:1176 src/service/arm/gnunet-service-arm.c:505 3961#: src/lib/util/service.c:1181 src/service/arm/gnunet-service-arm.c:505
3934#, c-format 3962#, c-format
3935msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 3963msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
3936msgstr "" 3964msgstr ""
3937"No hay ni puerto (PORT) ni ruta unix (UNIXPATH) para el servicio «%s», pero " 3965"No hay ni puerto (PORT) ni ruta unix (UNIXPATH) para el servicio «%s», pero "
3938"uno es necesario\n" 3966"uno es necesario\n"
3939 3967
3940#: src/lib/util/service.c:1207 src/service/arm/gnunet-service-arm.c:536 3968#: src/lib/util/service.c:1212 src/service/arm/gnunet-service-arm.c:536
3941#, c-format 3969#, c-format
3942msgid "Failed to resolve `%s': %s\n" 3970msgid "Failed to resolve `%s': %s\n"
3943msgstr "Se produjo un fallo al resolver «%s»: %s\n" 3971msgstr "Se produjo un fallo al resolver «%s»: %s\n"
3944 3972
3945#: src/lib/util/service.c:1226 src/service/arm/gnunet-service-arm.c:555 3973#: src/lib/util/service.c:1231 src/service/arm/gnunet-service-arm.c:555
3946#, c-format 3974#, c-format
3947msgid "Failed to find %saddress for `%s'.\n" 3975msgid "Failed to find %saddress for `%s'.\n"
3948msgstr "No se encontró la dirección %s para «%s».\n" 3976msgstr "No se encontró la dirección %s para «%s».\n"
3949 3977
3950#: src/lib/util/service.c:1401 3978#: src/lib/util/service.c:1406
3951#, c-format 3979#, c-format
3952msgid "`%s' failed for port %d (%s).\n" 3980msgid "`%s' failed for port %d (%s).\n"
3953msgstr "«%s» falló para el puerto %d (%s).\n" 3981msgstr "«%s» falló para el puerto %d (%s).\n"
3954 3982
3955#: src/lib/util/service.c:1413 3983#: src/lib/util/service.c:1418
3956#, c-format 3984#, c-format
3957msgid "`%s' failed for port %d (%s): address already in use\n" 3985msgid "`%s' failed for port %d (%s): address already in use\n"
3958msgstr "«%s» falló para el puerto %d (%s): dirección en uso actualmente\n" 3986msgstr "«%s» falló para el puerto %d (%s): dirección en uso actualmente\n"
3959 3987
3960#: src/lib/util/service.c:1420 3988#: src/lib/util/service.c:1425
3961#, fuzzy, c-format 3989#, fuzzy, c-format
3962msgid "`%s' failed for `%s': address already in use\n" 3990msgid "`%s' failed for `%s': address already in use\n"
3963msgstr "«%s» falló para «%.*s»: dirección en uso actualmente\n" 3991msgstr "«%s» falló para «%.*s»: dirección en uso actualmente\n"
3964 3992
3965#: src/lib/util/service.c:1481 3993#: src/lib/util/service.c:1486
3966#, c-format 3994#, c-format
3967msgid "Specified value for `%s' of service `%s' is invalid\n" 3995msgid "Specified value for `%s' of service `%s' is invalid\n"
3968msgstr "El valor especificado «%s» para el servicio «%s» no es válido\n" 3996msgstr "El valor especificado «%s» para el servicio «%s» no es válido\n"
3969 3997
3970#: src/lib/util/service.c:1505 3998#: src/lib/util/service.c:1510
3971#, c-format 3999#, c-format
3972msgid "Could not access pre-bound socket %u, will try to bind myself\n" 4000msgid "Could not access pre-bound socket %u, will try to bind myself\n"
3973msgstr "" 4001msgstr ""
3974"No se pudo acceder al «socket» pre-ascociado %u, lo intentaré asociar yo " 4002"No se pudo acceder al «socket» pre-ascociado %u, lo intentaré asociar yo "
3975"mismo\n" 4003"mismo\n"
3976 4004
3977#: src/lib/util/service.c:1573 4005#: src/lib/util/service.c:1583
3978msgid "" 4006msgid ""
3979"Could not bind to any of the ports I was supposed to, refusing to run!\n" 4007"Could not bind to any of the ports I was supposed to, refusing to run!\n"
3980msgstr "" 4008msgstr ""
3981 4009
3982#: src/lib/util/service.c:1644 4010#: src/lib/util/service.c:1653
3983msgid "No such user" 4011msgid "No such user"
3984msgstr "No existe tal usuario" 4012msgstr "No existe tal usuario"
3985 4013
3986#: src/lib/util/service.c:1658 4014#: src/lib/util/service.c:1668
3987#, c-format 4015#, c-format
3988msgid "Cannot change user/group to `%s': %s\n" 4016msgid "Cannot change user/group to `%s': %s\n"
3989msgstr "Imposible cambiar el usuario/grupo a «%s»: %s\n" 4017msgstr "Imposible cambiar el usuario/grupo a «%s»: %s\n"
3990 4018
3991#: src/lib/util/service.c:1751 4019#: src/lib/util/service.c:1767
3992msgid "Service process failed to initialize\n" 4020msgid "Service process failed to initialize\n"
3993msgstr "No se pudo inicializar el proceso del servicio\n" 4021msgstr "No se pudo inicializar el proceso del servicio\n"
3994 4022
3995#: src/lib/util/service.c:1756 4023#: src/lib/util/service.c:1772
3996msgid "Service process could not initialize server function\n" 4024msgid "Service process could not initialize server function\n"
3997msgstr "" 4025msgstr ""
3998"No se pudo inicializar la función del servidor en el proceso del servicio\n" 4026"No se pudo inicializar la función del servidor en el proceso del servicio\n"
3999 4027
4000#: src/lib/util/service.c:1761 4028#: src/lib/util/service.c:1777
4001msgid "Service process failed to report status\n" 4029msgid "Service process failed to report status\n"
4002msgstr "El proceso del servicio no devolvió un estado\n" 4030msgstr "El proceso del servicio no devolvió un estado\n"
4003 4031
4004#: src/lib/util/service.c:1960 src/lib/util/service.c:2255 4032#: src/lib/util/service.c:1990 src/lib/util/service.c:2304
4005msgid "do daemonize (detach from terminal)" 4033msgid "do daemonize (detach from terminal)"
4006msgstr "demonizar (desasociar del terminal)" 4034msgstr "demonizar (desasociar del terminal)"
4007 4035
4008#: src/lib/util/service.c:2036 src/lib/util/service.c:2048 4036#: src/lib/util/service.c:2065 src/lib/util/service.c:2080
4009#: src/lib/util/service.c:2298 src/lib/util/service.c:2310 4037#: src/lib/util/service.c:2353 src/lib/util/service.c:2368
4010#: src/service/transport/transport-testing-communicator.c:1055 4038#: src/service/transport/transport-testing-communicator.c:1059
4011#, fuzzy, c-format 4039#, fuzzy, c-format
4012msgid "Malformed configuration file `%s', exit ...\n" 4040msgid "Malformed configuration file `%s', exit ...\n"
4013msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" 4041msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
4014 4042
4015#: src/lib/util/service.c:2058 src/lib/util/service.c:2321 4043#: src/lib/util/service.c:2092 src/lib/util/service.c:2381
4016#, fuzzy 4044#, fuzzy
4017msgid "Malformed configuration, exit ...\n" 4045msgid "Malformed configuration, exit ...\n"
4018msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" 4046msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
@@ -4510,6 +4538,11 @@ msgstr "El servicio «%s» finalizó con estado %s/%d, se reiniciará en %llu ms
4510msgid "Initiating shutdown as requested by client.\n" 4538msgid "Initiating shutdown as requested by client.\n"
4511msgstr "Iniciando apagado bajo petición del cliente.\n" 4539msgstr "Iniciando apagado bajo petición del cliente.\n"
4512 4540
4541#: src/service/arm/testing_arm_cmd_start_peer.c:197
4542#, c-format
4543msgid "Failed to start `%s': %s\n"
4544msgstr "Se produjo un fallo al arrancar «%s»: %s\n"
4545
4513#: src/service/core/gnunet-service-core.c:329 4546#: src/service/core/gnunet-service-core.c:329
4514msgid "# send requests dropped (disconnected)" 4547msgid "# send requests dropped (disconnected)"
4515msgstr "# peticiones de envío descartadas (desconectado)" 4548msgstr "# peticiones de envío descartadas (desconectado)"
@@ -4683,8 +4716,8 @@ msgstr "# bytes de «payload» descifrados"
4683#: src/service/core/gnunet-service-core_sessions.c:337 4716#: src/service/core/gnunet-service-core_sessions.c:337
4684#: src/service/fs/gnunet-service-fs_cp.c:484 4717#: src/service/fs/gnunet-service-fs_cp.c:484
4685#: src/service/fs/gnunet-service-fs_cp.c:1377 4718#: src/service/fs/gnunet-service-fs_cp.c:1377
4686#: src/service/topology/gnunet-daemon-topology.c:551 4719#: src/service/topology/gnunet-daemon-topology.c:545
4687#: src/service/topology/gnunet-daemon-topology.c:633 4720#: src/service/topology/gnunet-daemon-topology.c:627
4688msgid "# peers connected" 4721msgid "# peers connected"
4689msgstr "# pares conectados" 4722msgstr "# pares conectados"
4690 4723
@@ -4814,7 +4847,7 @@ msgstr "Espacio insuficiente para satisfacer la petición"
4814#: src/service/datastore/gnunet-service-datastore.c:626 4847#: src/service/datastore/gnunet-service-datastore.c:626
4815#: src/service/datastore/gnunet-service-datastore.c:677 4848#: src/service/datastore/gnunet-service-datastore.c:677
4816#: src/service/datastore/gnunet-service-datastore.c:820 4849#: src/service/datastore/gnunet-service-datastore.c:820
4817#: src/service/datastore/gnunet-service-datastore.c:1428 4850#: src/service/datastore/gnunet-service-datastore.c:1431
4818msgid "# reserved" 4851msgid "# reserved"
4819msgstr "# reservado" 4852msgstr "# reservado"
4820 4853
@@ -4866,7 +4899,7 @@ msgid "# REMOVE requests received"
4866msgstr "# peticiones «REMOVE» recibidas" 4899msgstr "# peticiones «REMOVE» recibidas"
4867 4900
4868# Miguel: ¿Cómo traducir «payload»? ¿Código cargado? 4901# Miguel: ¿Cómo traducir «payload»? ¿Código cargado?
4869#: src/service/datastore/gnunet-service-datastore.c:1107 4902#: src/service/datastore/gnunet-service-datastore.c:1109
4870#, fuzzy, c-format 4903#, fuzzy, c-format
4871msgid "" 4904msgid ""
4872"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n" 4905"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n"
@@ -4874,63 +4907,63 @@ msgstr ""
4874"El «payload» del almacén de datos es impreciso (%lld < %lld). Intentando " 4907"El «payload» del almacén de datos es impreciso (%lld < %lld). Intentando "
4875"repararlo.\n" 4908"repararlo.\n"
4876 4909
4877#: src/service/datastore/gnunet-service-datastore.c:1112 4910#: src/service/datastore/gnunet-service-datastore.c:1114
4878#: src/service/datastore/gnunet-service-datastore.c:1281 4911#: src/service/datastore/gnunet-service-datastore.c:1283
4879#, c-format 4912#, c-format
4880msgid "New payload: %lld\n" 4913msgid "New payload: %lld\n"
4881msgstr "" 4914msgstr ""
4882 4915
4883#: src/service/datastore/gnunet-service-datastore.c:1167 4916#: src/service/datastore/gnunet-service-datastore.c:1169
4884#, c-format 4917#, c-format
4885msgid "Loading `%s' datastore plugin\n" 4918msgid "Loading `%s' datastore plugin\n"
4886msgstr "Cargando el módulo del almacén de datos «%s»\n" 4919msgstr "Cargando el módulo del almacén de datos «%s»\n"
4887 4920
4888#: src/service/datastore/gnunet-service-datastore.c:1176 4921#: src/service/datastore/gnunet-service-datastore.c:1178
4889#, c-format 4922#, c-format
4890msgid "Failed to load datastore plugin for `%s'\n" 4923msgid "Failed to load datastore plugin for `%s'\n"
4891msgstr "" 4924msgstr ""
4892"Se produjo un fallo al inicializar el módulo del almacén de datos para «%s»\n" 4925"Se produjo un fallo al inicializar el módulo del almacén de datos para «%s»\n"
4893 4926
4894#: src/service/datastore/gnunet-service-datastore.c:1236 4927#: src/service/datastore/gnunet-service-datastore.c:1238
4895msgid "Bloomfilter construction complete.\n" 4928msgid "Bloomfilter construction complete.\n"
4896msgstr "Construcción de «bloomfilter» completa.\n" 4929msgstr "Construcción de «bloomfilter» completa.\n"
4897 4930
4898#: src/service/datastore/gnunet-service-datastore.c:1288 4931#: src/service/datastore/gnunet-service-datastore.c:1290
4899msgid "Rebuilding bloomfilter. Please be patient.\n" 4932msgid "Rebuilding bloomfilter. Please be patient.\n"
4900msgstr "Reconstruyendo «bloomfilter». Por favor, tenga paciencia.\n" 4933msgstr "Reconstruyendo «bloomfilter». Por favor, tenga paciencia.\n"
4901 4934
4902#: src/service/datastore/gnunet-service-datastore.c:1298 4935#: src/service/datastore/gnunet-service-datastore.c:1300
4903msgid "Plugin does not support get_keys function. Please fix!\n" 4936msgid "Plugin does not support get_keys function. Please fix!\n"
4904msgstr "El módulo no soporta la función «get_keys». Por favor, corríjalo.\n" 4937msgstr "El módulo no soporta la función «get_keys». Por favor, corríjalo.\n"
4905 4938
4906#: src/service/datastore/gnunet-service-datastore.c:1463 4939#: src/service/datastore/gnunet-service-datastore.c:1466
4907#, c-format 4940#, c-format
4908msgid "# bytes used in file-sharing datastore `%s'" 4941msgid "# bytes used in file-sharing datastore `%s'"
4909msgstr "# bytes usados en el almacén de ficheros compartidos «%s»" 4942msgstr "# bytes usados en el almacén de ficheros compartidos «%s»"
4910 4943
4911#: src/service/datastore/gnunet-service-datastore.c:1472 4944#: src/service/datastore/gnunet-service-datastore.c:1475
4912msgid "# quota" 4945msgid "# quota"
4913msgstr "# cuota" 4946msgstr "# cuota"
4914 4947
4915#: src/service/datastore/gnunet-service-datastore.c:1475 4948#: src/service/datastore/gnunet-service-datastore.c:1478
4916msgid "# cache size" 4949msgid "# cache size"
4917msgstr "# tamaño de la caché" 4950msgstr "# tamaño de la caché"
4918 4951
4919#: src/service/datastore/gnunet-service-datastore.c:1491 4952#: src/service/datastore/gnunet-service-datastore.c:1494
4920#, c-format 4953#, c-format
4921msgid "Could not use specified filename `%s' for bloomfilter.\n" 4954msgid "Could not use specified filename `%s' for bloomfilter.\n"
4922msgstr "" 4955msgstr ""
4923"No se pudo usar el nombre de fichero especificado «%s» para «bloomfilter».\n" 4956"No se pudo usar el nombre de fichero especificado «%s» para «bloomfilter».\n"
4924 4957
4925#: src/service/datastore/gnunet-service-datastore.c:1512 4958#: src/service/datastore/gnunet-service-datastore.c:1515
4926#: src/service/datastore/gnunet-service-datastore.c:1534 4959#: src/service/datastore/gnunet-service-datastore.c:1537
4927#, c-format 4960#, c-format
4928msgid "Failed to remove bogus bloomfilter file `%s'\n" 4961msgid "Failed to remove bogus bloomfilter file `%s'\n"
4929msgstr "" 4962msgstr ""
4930"Se produjo un fallo al borrar el fichero de configuración defectuoso de " 4963"Se produjo un fallo al borrar el fichero de configuración defectuoso de "
4931"«bloomfilter» «%s»:\n" 4964"«bloomfilter» «%s»:\n"
4932 4965
4933#: src/service/datastore/gnunet-service-datastore.c:1573 4966#: src/service/datastore/gnunet-service-datastore.c:1576
4934msgid "Failed to initialize bloomfilter.\n" 4967msgid "Failed to initialize bloomfilter.\n"
4935msgstr "Se produjo un fallo al inicializar «bloomfilter».\n" 4968msgstr "Se produjo un fallo al inicializar «bloomfilter».\n"
4936 4969
@@ -5772,7 +5805,7 @@ msgstr ""
5772 5805
5773#: src/service/fs/gnunet-service-fs.c:1271 5806#: src/service/fs/gnunet-service-fs.c:1271
5774#: src/service/hostlist/gnunet-daemon-hostlist.c:343 5807#: src/service/hostlist/gnunet-daemon-hostlist.c:343
5775#: src/service/topology/gnunet-daemon-topology.c:1066 5808#: src/service/topology/gnunet-daemon-topology.c:1062
5776#, c-format 5809#, c-format
5777msgid "Failed to connect to `%s' service.\n" 5810msgid "Failed to connect to `%s' service.\n"
5778msgstr "Se produjo un fallo al conectar con el servicio «%s».\n" 5811msgstr "Se produjo un fallo al conectar con el servicio «%s».\n"
@@ -6601,7 +6634,7 @@ msgid "# hostlist advertisements send"
6601msgstr "# anuncios de listas de máquinas enviados" 6634msgstr "# anuncios de listas de máquinas enviados"
6602 6635
6603#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 6636#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483
6604#: src/service/topology/gnunet-daemon-topology.c:786 6637#: src/service/topology/gnunet-daemon-topology.c:781
6605#, fuzzy, c-format 6638#, fuzzy, c-format
6606msgid "Error in communication with PEERSTORE service: %s\n" 6639msgid "Error in communication with PEERSTORE service: %s\n"
6607msgstr "" 6640msgstr ""
@@ -6885,12 +6918,12 @@ msgstr ""
6885msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" 6918msgid "Malformed punched hole specification `%s' (IPv6 address invalid)"
6886msgstr "" 6919msgstr ""
6887 6920
6888#: src/service/nat/gnunet-service-nat.c:1861 6921#: src/service/nat/gnunet-service-nat.c:1860
6889#, fuzzy 6922#, fuzzy
6890msgid "Connection reversal request failed\n" 6923msgid "Connection reversal request failed\n"
6891msgstr "Colección detenida.\n" 6924msgstr "Colección detenida.\n"
6892 6925
6893#: src/service/nat/gnunet-service-nat.c:1935 6926#: src/service/nat/gnunet-service-nat.c:1999
6894msgid "" 6927msgid ""
6895"UPnP enabled in configuration, but UPnP client `upnpc` command not found, " 6928"UPnP enabled in configuration, but UPnP client `upnpc` command not found, "
6896"disabling UPnP\n" 6929"disabling UPnP\n"
@@ -6914,44 +6947,44 @@ msgstr "comando «external-ip» no encontrado\n"
6914msgid "`upnpc' command not found\n" 6947msgid "`upnpc' command not found\n"
6915msgstr "comando «upnpc» no encontrado\n" 6948msgstr "comando «upnpc» no encontrado\n"
6916 6949
6917#: src/service/peerstore/gnunet-service-peerstore.c:1141 6950#: src/service/peerstore/gnunet-service-peerstore.c:1150
6918#, fuzzy, c-format 6951#, fuzzy, c-format
6919msgid "Failed to parse HELLO in file `%s': %s\n" 6952msgid "Failed to parse HELLO in file `%s': %s\n"
6920msgstr "Se produjo un fallo al procesar «HELLO» en el fichero «%s»\n" 6953msgstr "Se produjo un fallo al procesar «HELLO» en el fichero «%s»\n"
6921 6954
6922#: src/service/peerstore/gnunet-service-peerstore.c:1214 6955#: src/service/peerstore/gnunet-service-peerstore.c:1223
6923#, fuzzy, c-format 6956#, fuzzy, c-format
6924msgid "Could not load database backend `%s'\n" 6957msgid "Could not load database backend `%s'\n"
6925msgstr "No se pudo leer el fichero de la lista negra «%s»\n" 6958msgstr "No se pudo leer el fichero de la lista negra «%s»\n"
6926 6959
6927#: src/service/peerstore/gnunet-service-peerstore.c:1233 6960#: src/service/peerstore/gnunet-service-peerstore.c:1242
6928#, c-format 6961#, c-format
6929msgid "Importing HELLOs from `%s'\n" 6962msgid "Importing HELLOs from `%s'\n"
6930msgstr "Importando HELLO de «%s»\n" 6963msgstr "Importando HELLO de «%s»\n"
6931 6964
6932#: src/service/peerstore/gnunet-service-peerstore.c:1244 6965#: src/service/peerstore/gnunet-service-peerstore.c:1253
6933msgid "Skipping import of included HELLOs\n" 6966msgid "Skipping import of included HELLOs\n"
6934msgstr "" 6967msgstr ""
6935 6968
6936#: src/service/peerstore/peerstore_api.c:574 6969#: src/service/peerstore/peerstore_api.c:579
6937#, fuzzy 6970#, fuzzy
6938msgid "Unexpected store response.\n" 6971msgid "Unexpected store response.\n"
6939msgstr "Respuesta inesperada a la operación '%s'.\n" 6972msgstr "Respuesta inesperada a la operación '%s'.\n"
6940 6973
6941#: src/service/peerstore/peerstore_api.c:606 6974#: src/service/peerstore/peerstore_api.c:620
6942#, fuzzy 6975#, fuzzy
6943msgid "Unexpected iteration response.\n" 6976msgid "Unexpected iteration response.\n"
6944msgstr "El formato de salida es desconocido, ésto no debería pasar.\n" 6977msgstr "El formato de salida es desconocido, ésto no debería pasar.\n"
6945 6978
6946#: src/service/peerstore/peerstore_api.c:652 6979#: src/service/peerstore/peerstore_api.c:666
6947#, fuzzy 6980#, fuzzy
6948msgid "" 6981msgid ""
6949"Unexpected iteration response, no iterating client found, discarding " 6982"Unexpected iteration response, no iterating client found, discarding "
6950"message.\n" 6983"message.\n"
6951msgstr "El formato de salida es desconocido, ésto no debería pasar.\n" 6984msgstr "El formato de salida es desconocido, ésto no debería pasar.\n"
6952 6985
6953#: src/service/peerstore/peerstore_api.c:662 6986#: src/service/peerstore/peerstore_api.c:676
6954#: src/service/peerstore/peerstore_api_monitor.c:164 6987#: src/service/peerstore/peerstore_api_monitor.c:163
6955#, fuzzy 6988#, fuzzy
6956msgid "Received a malformed response from service." 6989msgid "Received a malformed response from service."
6957msgstr "Recibida petición DNS mal formada de %s\n" 6990msgstr "Recibida petición DNS mal formada de %s\n"
@@ -7128,12 +7161,12 @@ msgstr "Conexión fallida\n"
7128msgid "Namestore REST API initialized\n" 7161msgid "Namestore REST API initialized\n"
7129msgstr "Conexión fallida\n" 7162msgstr "Conexión fallida\n"
7130 7163
7131#: src/service/rest/openid_plugin.c:3102 7164#: src/service/rest/openid_plugin.c:3121
7132#, fuzzy 7165#, fuzzy
7133msgid "OpenID Connect REST API initialized\n" 7166msgid "OpenID Connect REST API initialized\n"
7134msgstr "Conexión fallida\n" 7167msgstr "Conexión fallida\n"
7135 7168
7136#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1523 7169#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1494
7137#, fuzzy 7170#, fuzzy
7138msgid "Identity Provider REST API initialized\n" 7171msgid "Identity Provider REST API initialized\n"
7139msgstr "Conexión fallida\n" 7172msgstr "Conexión fallida\n"
@@ -7186,174 +7219,61 @@ msgstr "Cargando %llu bytes de estadísticas de «%s»\n"
7186msgid "Could not save some persistent statistics\n" 7219msgid "Could not save some persistent statistics\n"
7187msgstr "No se pudieron guardar algunas estadísticas persistentes\n" 7220msgstr "No se pudieron guardar algunas estadísticas persistentes\n"
7188 7221
7189#: src/service/testing/gnunet-testing.c:185 7222#: src/service/testbed/gnunet-testbed.c:196
7190#, c-format 7223#, fuzzy
7191msgid "Could not extract hostkey %u (offset too large?)\n" 7224msgid "number of unique configuration files to create"
7192msgstr ""
7193"No se pudo extraer la clave de máquina %u (¿desplazamiento demasiado "
7194"grande?)\n"
7195
7196#: src/service/testing/gnunet-testing.c:275
7197#, c-format
7198msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
7199msgstr "Comando desconocido, use «q» para salir o «r» para reiniciar el par\n"
7200
7201#: src/service/testing/gnunet-testing.c:386
7202msgid "create unique configuration files"
7203msgstr "crear ficheros de configuración únicos"
7204
7205#: src/service/testing/gnunet-testing.c:392
7206msgid "extract hostkey file from pre-computed hostkey list"
7207msgstr ""
7208"extraer los ficheros de claves de máquinas de una lista pre-computada de "
7209"claves de máquinas"
7210
7211#: src/service/testing/gnunet-testing.c:400
7212msgid ""
7213"number of unique configuration files to create, or number of the hostkey to "
7214"extract"
7215msgstr "" 7225msgstr ""
7216"número de ficheros de configuración únicos o claves de máquina a crear, o el " 7226"número de ficheros de configuración únicos o claves de máquina a crear, o el "
7217"número de claves de máquina a extraer" 7227"número de claves de máquina a extraer"
7218 7228
7219#: src/service/testing/gnunet-testing.c:407 7229#: src/service/testbed/gnunet-testbed.c:202
7220msgid "configuration template" 7230msgid "configuration template"
7221msgstr "plantilla de configuración" 7231msgstr "plantilla de configuración"
7222 7232
7223#: src/service/testing/gnunet-testing.c:415 7233#: src/service/testbed/gnunet-testbed.c:218
7224msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"
7225msgstr ""
7226
7227#: src/service/testing/gnunet-testing.c:432
7228msgid "Command line tool to access the testing library" 7234msgid "Command line tool to access the testing library"
7229msgstr "" 7235msgstr ""
7230"Herramienta de línea de comandos para acceder a la biblioteca de pruebas" 7236"Herramienta de línea de comandos para acceder a la biblioteca de pruebas"
7231 7237
7232#: src/service/testing/list-keys.c:92
7233#, fuzzy
7234msgid "list COUNT number of keys"
7235msgstr "crea «COUNT» número de pares"
7236
7237#: src/service/testing/testing.c:291
7238#, c-format
7239msgid "Hostkeys file not found: %s\n"
7240msgstr "El fichero de máquinas no fue encontrado: %s\n"
7241
7242#: src/service/testing/testing.c:743
7243#, c-format
7244msgid "Key number %u does not exist\n"
7245msgstr "El número de clave %u no existe\n"
7246
7247# Miguel: "testbed" lo he traducido como batería de pruebas, pero
7248# no es una traducción muy literal.
7249#: src/service/testing/testing.c:1217
7250#, c-format
7251msgid ""
7252"You attempted to create a testbed with more than %u hosts. Please "
7253"precompute more hostkeys first.\n"
7254msgstr ""
7255"Se ha intentado crear una batería de pruebas con más de %u máquinas. Por "
7256"favor, pre-compute más claves de máquinas primero.\n"
7257
7258#: src/service/testing/testing.c:1226
7259#, c-format
7260msgid "Failed to initialize hostkey for peer %u\n"
7261msgstr ""
7262"Se produjo un fallo al inicializar la clave de la máquina desde el par %u\n"
7263
7264#: src/service/testing/testing.c:1236
7265#, fuzzy
7266msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
7267msgstr "¡Falta la opción «%s» en la sección «%s» de la configuración!\n"
7268
7269#: src/service/testing/testing.c:1249
7270msgid "Failed to create configuration for peer (not enough free ports?)\n"
7271msgstr ""
7272"Se produjo un fallo al crear la configuración para el par (¿no hay "
7273"suficientes puertos libres?)\n"
7274
7275#: src/service/testing/testing.c:1265
7276#, fuzzy, c-format
7277msgid "Cannot open hostkey file `%s': %s\n"
7278msgstr "No se pudo abrir el fichero de claves de máquina: %s\n"
7279
7280#: src/service/testing/testing.c:1279
7281#, c-format
7282msgid "Failed to write hostkey file for peer %u: %s\n"
7283msgstr ""
7284"Se produjo un fallo al escribir la clave de la máquina para el par %u: %s\n"
7285
7286#: src/service/testing/testing.c:1307
7287#, c-format
7288msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7289msgstr ""
7290"Se produjo un fallo al escribir el fichero de configuración «%s» para el par "
7291"%u: %s\n"
7292
7293#: src/service/testing/testing.c:1413
7294#, c-format
7295msgid "Failed to start `%s': %s\n"
7296msgstr "Se produjo un fallo al arrancar «%s»: %s\n"
7297
7298#: src/service/testing/testing.c:1664
7299#, c-format
7300msgid "Failed to load configuration from %s\n"
7301msgstr "Se produjo un fallo al cargar la configuración de %s\n"
7302
7303#: src/service/testing/testing.c:2795
7304#, c-format
7305msgid "Topology file %s not found\n"
7306msgstr "El fichero de topología %s no fue encontrado\n"
7307
7308#: src/service/testing/testing.c:2803
7309#, c-format
7310msgid "Topology file %s has no data\n"
7311msgstr "El fichero de topología %s no tiene datos\n"
7312
7313#: src/service/testing/testing.c:2811
7314#, c-format
7315msgid "Topology file %s cannot be read\n"
7316msgstr "El fichero de topología %s no puede ser leido\n"
7317
7318#: src/service/topology/gnunet-daemon-topology.c:286 7238#: src/service/topology/gnunet-daemon-topology.c:286
7319#, fuzzy 7239#, fuzzy
7320msgid "# connect requests issued to ATS" 7240msgid "# connect requests issued to ATS"
7321msgstr "# peticiones de conexión requeridas al servicio de transporte" 7241msgstr "# peticiones de conexión requeridas al servicio de transporte"
7322 7242
7323# gossiped?? 7243# gossiped??
7324#: src/service/topology/gnunet-daemon-topology.c:480 7244#: src/service/topology/gnunet-daemon-topology.c:475
7325msgid "# HELLO messages gossipped" 7245msgid "# HELLO messages gossipped"
7326msgstr "# Mensajes «HELLO» rumoreados" 7246msgstr "# Mensajes «HELLO» rumoreados"
7327 7247
7328#: src/service/topology/gnunet-daemon-topology.c:752 7248#: src/service/topology/gnunet-daemon-topology.c:747
7329#, fuzzy 7249#, fuzzy
7330msgid "Error in communication with PEERSTORE service to monitor.\n" 7250msgid "Error in communication with PEERSTORE service to monitor.\n"
7331msgstr "" 7251msgstr ""
7332"Error en la comunicación con el servicio de información de pares (PEERINFO): " 7252"Error en la comunicación con el servicio de información de pares (PEERINFO): "
7333"%s\n" 7253"%s\n"
7334 7254
7335#: src/service/topology/gnunet-daemon-topology.c:761 7255#: src/service/topology/gnunet-daemon-topology.c:756
7336msgid "Finished initial PEERSTORE iteration in monitor.\n" 7256msgid "Finished initial PEERSTORE iteration in monitor.\n"
7337msgstr "" 7257msgstr ""
7338 7258
7339#: src/service/topology/gnunet-daemon-topology.c:869 7259#: src/service/topology/gnunet-daemon-topology.c:864
7340msgid "Failed to connect to core service, can not manage topology!\n" 7260msgid "Failed to connect to core service, can not manage topology!\n"
7341msgstr "" 7261msgstr ""
7342"¡Se produjo un fallo al conectar con el servicio principal, no se puede " 7262"¡Se produjo un fallo al conectar con el servicio principal, no se puede "
7343"gestionar la topología!\n" 7263"gestionar la topología!\n"
7344 7264
7345#: src/service/topology/gnunet-daemon-topology.c:943 7265#: src/service/topology/gnunet-daemon-topology.c:938
7346msgid "# HELLO messages received" 7266msgid "# HELLO messages received"
7347msgstr "# mensajes «HELLO» recibidos" 7267msgstr "# mensajes «HELLO» recibidos"
7348 7268
7349#: src/service/topology/gnunet-daemon-topology.c:1095 7269#: src/service/topology/gnunet-daemon-topology.c:1091
7350msgid "GNUnet topology control" 7270msgid "GNUnet topology control"
7351msgstr "" 7271msgstr ""
7352 7272
7353#: src/service/transport/gnunet-communicator-quic.c:1717 7273#: src/service/transport/gnunet-communicator-quic.c:1717
7354#: src/service/transport/gnunet-communicator-tcp.c:3777 7274#: src/service/transport/gnunet-communicator-tcp.c:3814
7355#: src/service/transport/gnunet-communicator-udp.c:3408 7275#: src/service/transport/gnunet-communicator-udp.c:3579
7356#: src/service/transport/gnunet-service-transport.c:12128 7276#: src/service/transport/gnunet-service-transport.c:12543
7357#, fuzzy 7277#, fuzzy
7358msgid "Transport service is lacking key configuration settings. Exiting.\n" 7278msgid "Transport service is lacking key configuration settings. Exiting.\n"
7359msgstr "" 7279msgstr ""
@@ -7365,12 +7285,12 @@ msgstr ""
7365msgid "GNUnet QUIC communicator" 7285msgid "GNUnet QUIC communicator"
7366msgstr "Configurador Gtk de GNUnet" 7286msgstr "Configurador Gtk de GNUnet"
7367 7287
7368#: src/service/transport/gnunet-communicator-tcp.c:4114 7288#: src/service/transport/gnunet-communicator-tcp.c:4171
7369#, fuzzy 7289#, fuzzy
7370msgid "GNUnet TCP communicator" 7290msgid "GNUnet TCP communicator"
7371msgstr "Configurador Gtk de GNUnet" 7291msgstr "Configurador Gtk de GNUnet"
7372 7292
7373#: src/service/transport/gnunet-communicator-udp.c:3483 7293#: src/service/transport/gnunet-communicator-udp.c:3654
7374#, fuzzy 7294#, fuzzy
7375msgid "GNUnet UDP communicator" 7295msgid "GNUnet UDP communicator"
7376msgstr "Configurador Gtk de GNUnet" 7296msgstr "Configurador Gtk de GNUnet"
@@ -7559,7 +7479,7 @@ msgstr "enviar data para prueba a otro par (hasta CTRL-C)"
7559msgid "Direct access to transport service." 7479msgid "Direct access to transport service."
7560msgstr "Acceso directo al servicio de transporte." 7480msgstr "Acceso directo al servicio de transporte."
7561 7481
7562#: src/service/transport/transport_api2_communication.c:765 7482#: src/service/transport/transport_api2_communication.c:773
7563msgid "Dropped backchanel message: handler not provided by communicator\n" 7483msgid "Dropped backchanel message: handler not provided by communicator\n"
7564msgstr "" 7484msgstr ""
7565 7485
@@ -7690,6 +7610,94 @@ msgstr "Se produjo un fallo al crear el espacio de nombres «%s»\n"
7690msgid "Failed to connect to the namestore!\n" 7610msgid "Failed to connect to the namestore!\n"
7691msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" 7611msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n"
7692 7612
7613#, c-format
7614#~ msgid "Could not extract hostkey %u (offset too large?)\n"
7615#~ msgstr ""
7616#~ "No se pudo extraer la clave de máquina %u (¿desplazamiento demasiado "
7617#~ "grande?)\n"
7618
7619#, c-format
7620#~ msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
7621#~ msgstr ""
7622#~ "Comando desconocido, use «q» para salir o «r» para reiniciar el par\n"
7623
7624#~ msgid "create unique configuration files"
7625#~ msgstr "crear ficheros de configuración únicos"
7626
7627#~ msgid "extract hostkey file from pre-computed hostkey list"
7628#~ msgstr ""
7629#~ "extraer los ficheros de claves de máquinas de una lista pre-computada de "
7630#~ "claves de máquinas"
7631
7632#, fuzzy
7633#~ msgid "list COUNT number of keys"
7634#~ msgstr "crea «COUNT» número de pares"
7635
7636#, c-format
7637#~ msgid "Hostkeys file not found: %s\n"
7638#~ msgstr "El fichero de máquinas no fue encontrado: %s\n"
7639
7640#, c-format
7641#~ msgid "Key number %u does not exist\n"
7642#~ msgstr "El número de clave %u no existe\n"
7643
7644# Miguel: "testbed" lo he traducido como batería de pruebas, pero
7645# no es una traducción muy literal.
7646#, c-format
7647#~ msgid ""
7648#~ "You attempted to create a testbed with more than %u hosts. Please "
7649#~ "precompute more hostkeys first.\n"
7650#~ msgstr ""
7651#~ "Se ha intentado crear una batería de pruebas con más de %u máquinas. Por "
7652#~ "favor, pre-compute más claves de máquinas primero.\n"
7653
7654#, c-format
7655#~ msgid "Failed to initialize hostkey for peer %u\n"
7656#~ msgstr ""
7657#~ "Se produjo un fallo al inicializar la clave de la máquina desde el par "
7658#~ "%u\n"
7659
7660#, fuzzy
7661#~ msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
7662#~ msgstr "¡Falta la opción «%s» en la sección «%s» de la configuración!\n"
7663
7664#~ msgid "Failed to create configuration for peer (not enough free ports?)\n"
7665#~ msgstr ""
7666#~ "Se produjo un fallo al crear la configuración para el par (¿no hay "
7667#~ "suficientes puertos libres?)\n"
7668
7669#, fuzzy, c-format
7670#~ msgid "Cannot open hostkey file `%s': %s\n"
7671#~ msgstr "No se pudo abrir el fichero de claves de máquina: %s\n"
7672
7673#, c-format
7674#~ msgid "Failed to write hostkey file for peer %u: %s\n"
7675#~ msgstr ""
7676#~ "Se produjo un fallo al escribir la clave de la máquina para el par %u: "
7677#~ "%s\n"
7678
7679#, c-format
7680#~ msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7681#~ msgstr ""
7682#~ "Se produjo un fallo al escribir el fichero de configuración «%s» para el "
7683#~ "par %u: %s\n"
7684
7685#, c-format
7686#~ msgid "Failed to load configuration from %s\n"
7687#~ msgstr "Se produjo un fallo al cargar la configuración de %s\n"
7688
7689#, c-format
7690#~ msgid "Topology file %s not found\n"
7691#~ msgstr "El fichero de topología %s no fue encontrado\n"
7692
7693#, c-format
7694#~ msgid "Topology file %s has no data\n"
7695#~ msgstr "El fichero de topología %s no tiene datos\n"
7696
7697#, c-format
7698#~ msgid "Topology file %s cannot be read\n"
7699#~ msgstr "El fichero de topología %s no puede ser leido\n"
7700
7693#, fuzzy, c-format 7701#, fuzzy, c-format
7694#~ msgid "" 7702#~ msgid ""
7695#~ "Local peer: %s\n" 7703#~ "Local peer: %s\n"
@@ -9366,10 +9374,6 @@ msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n"
9366#~ msgstr "valor a establecer" 9374#~ msgstr "valor a establecer"
9367 9375
9368#, fuzzy 9376#, fuzzy
9369#~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n"
9370#~ msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
9371
9372#, fuzzy
9373#~ msgid "Unreadable or malformed configuration, exit ...\n" 9377#~ msgid "Unreadable or malformed configuration, exit ...\n"
9374#~ msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" 9378#~ msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n"
9375 9379
diff --git a/po/fr.po b/po/fr.po
index cacebc656..7023d7ef6 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -7,7 +7,7 @@ msgid ""
7msgstr "" 7msgstr ""
8"Project-Id-Version: gnunet 0.10.1\n" 8"Project-Id-Version: gnunet 0.10.1\n"
9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
10"POT-Creation-Date: 2024-03-02 14:38+0100\n" 10"POT-Creation-Date: 2024-05-20 20:21+0200\n"
11"PO-Revision-Date: 2021-11-21 00:53+0100\n" 11"PO-Revision-Date: 2021-11-21 00:53+0100\n"
12"Last-Translator: Stéphane Aulery <lkppo@free.fr>\n" 12"Last-Translator: Stéphane Aulery <lkppo@free.fr>\n"
13"Language-Team: French <traduc@traduc.org>\n" 13"Language-Team: French <traduc@traduc.org>\n"
@@ -334,20 +334,25 @@ msgstr ""
334msgid "Failed to connect to CORE service!\n" 334msgid "Failed to connect to CORE service!\n"
335msgstr "" 335msgstr ""
336 336
337#: src/cli/core/gnunet-core.c:230 src/service/transport/gnunet-transport.c:1389 337#: src/cli/core/gnunet-core.c:213
338#, fuzzy
339msgid "No argument given.\n"
340msgstr "# résultats introuvables"
341
342#: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389
338msgid "provide information about all current connections (continuously)" 343msgid "provide information about all current connections (continuously)"
339msgstr "" 344msgstr ""
340 345
341#: src/cli/core/gnunet-core.c:236 346#: src/cli/core/gnunet-core.c:244
342msgid "Show our current peer identity" 347msgid "Show our current peer identity"
343msgstr "" 348msgstr ""
344 349
345#: src/cli/core/gnunet-core.c:243 350#: src/cli/core/gnunet-core.c:251
346#, fuzzy 351#, fuzzy
347msgid "Show current connections" 352msgid "Show current connections"
348msgstr "# Session TCP active" 353msgstr "# Session TCP active"
349 354
350#: src/cli/core/gnunet-core.c:254 355#: src/cli/core/gnunet-core.c:262
351msgid "Print information about connected peers." 356msgid "Print information about connected peers."
352msgstr "" 357msgstr ""
353 358
@@ -1040,52 +1045,52 @@ msgstr ""
1040msgid "Unindex a file that was previously indexed with gnunet-publish." 1045msgid "Unindex a file that was previously indexed with gnunet-publish."
1041msgstr "" 1046msgstr ""
1042 1047
1043#: src/cli/gns/gnunet-gns.c:268 1048#: src/cli/gns/gnunet-gns.c:269
1044#, c-format 1049#, c-format
1045msgid "`%s' is not a valid DNS domain name\n" 1050msgid "`%s' is not a valid DNS domain name\n"
1046msgstr "" 1051msgstr ""
1047 1052
1048#: src/cli/gns/gnunet-gns.c:279 src/lib/util/dnsparser.c:273 1053#: src/cli/gns/gnunet-gns.c:280 src/lib/util/dnsparser.c:273
1049#, c-format 1054#, c-format
1050msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" 1055msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
1051msgstr "" 1056msgstr ""
1052 1057
1053#: src/cli/gns/gnunet-gns.c:294 1058#: src/cli/gns/gnunet-gns.c:295
1054msgid "Cannot resolve using GNS: GNUnet peer not running\n" 1059msgid "Cannot resolve using GNS: GNUnet peer not running\n"
1055msgstr "" 1060msgstr ""
1056 1061
1057#: src/cli/gns/gnunet-gns.c:305 1062#: src/cli/gns/gnunet-gns.c:306
1058#: src/contrib/service/abd/gnunet-service-abd.c:1745 1063#: src/contrib/service/abd/gnunet-service-abd.c:1745
1059#, c-format 1064#, c-format
1060msgid "Failed to connect to GNS\n" 1065msgid "Failed to connect to GNS\n"
1061msgstr "" 1066msgstr ""
1062 1067
1063#: src/cli/gns/gnunet-gns.c:318 1068#: src/cli/gns/gnunet-gns.c:325
1064#, c-format 1069#, c-format
1065msgid "Invalid typename specified, assuming `ANY'\n" 1070msgid "Invalid typename specified, assuming `ANY'\n"
1066msgstr "" 1071msgstr ""
1067 1072
1068#: src/cli/gns/gnunet-gns.c:358 1073#: src/cli/gns/gnunet-gns.c:365
1069msgid "Lookup a record for the given name" 1074msgid "Lookup a record for the given name"
1070msgstr "" 1075msgstr ""
1071 1076
1072#: src/cli/gns/gnunet-gns.c:364 1077#: src/cli/gns/gnunet-gns.c:371
1073msgid "Specify the type of the record to lookup" 1078msgid "Specify the type of the record to lookup"
1074msgstr "" 1079msgstr ""
1075 1080
1076#: src/cli/gns/gnunet-gns.c:370 1081#: src/cli/gns/gnunet-gns.c:377
1077msgid "Specify a timeout for the lookup" 1082msgid "Specify a timeout for the lookup"
1078msgstr "" 1083msgstr ""
1079 1084
1080#: src/cli/gns/gnunet-gns.c:374 1085#: src/cli/gns/gnunet-gns.c:381
1081msgid "No unneeded output" 1086msgid "No unneeded output"
1082msgstr "" 1087msgstr ""
1083 1088
1084#: src/cli/gns/gnunet-gns.c:379 1089#: src/cli/gns/gnunet-gns.c:386
1085msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" 1090msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
1086msgstr "" 1091msgstr ""
1087 1092
1088#: src/cli/gns/gnunet-gns.c:393 1093#: src/cli/gns/gnunet-gns.c:400
1089msgid "GNUnet GNS resolver tool" 1094msgid "GNUnet GNS resolver tool"
1090msgstr "" 1095msgstr ""
1091 1096
@@ -1600,7 +1605,11 @@ msgstr ""
1600msgid "GNUnet NAT traversal autoconfigure daemon" 1605msgid "GNUnet NAT traversal autoconfigure daemon"
1601msgstr "" 1606msgstr ""
1602 1607
1603#: src/cli/nse/gnunet-nse.c:124 1608#: src/cli/nse/gnunet-nse.c:126
1609msgid "Monitor and output current estimates"
1610msgstr ""
1611
1612#: src/cli/nse/gnunet-nse.c:137
1604msgid "Show network size estimates from NSE service." 1613msgid "Show network size estimates from NSE service."
1605msgstr "" 1614msgstr ""
1606 1615
@@ -1648,86 +1657,90 @@ msgstr ""
1648msgid "The time until the DID Document is going to expire (e.g. 5d)" 1657msgid "The time until the DID Document is going to expire (e.g. 5d)"
1649msgstr "" 1658msgstr ""
1650 1659
1651#: src/cli/reclaim/gnunet-reclaim.c:805 1660#: src/cli/reclaim/gnunet-reclaim.c:813
1652#, c-format 1661#, c-format
1653msgid "Ego is required\n" 1662msgid "Ego is required\n"
1654msgstr "" 1663msgstr ""
1655 1664
1656#: src/cli/reclaim/gnunet-reclaim.c:812 1665#: src/cli/reclaim/gnunet-reclaim.c:820
1657#, c-format 1666#, c-format
1658msgid "Attribute value missing!\n" 1667msgid "Attribute value missing!\n"
1659msgstr "" 1668msgstr ""
1660 1669
1661#: src/cli/reclaim/gnunet-reclaim.c:819 1670#: src/cli/reclaim/gnunet-reclaim.c:827
1662#, c-format 1671#, c-format
1663msgid "Requesting party key is required!\n" 1672msgid "Requesting party key is required!\n"
1664msgstr "" 1673msgstr ""
1665 1674
1666#: src/cli/reclaim/gnunet-reclaim.c:837 1675#: src/cli/reclaim/gnunet-reclaim.c:846
1667msgid "Add or update an attribute NAME" 1676msgid "Add or update an attribute NAME"
1668msgstr "" 1677msgstr ""
1669 1678
1670#: src/cli/reclaim/gnunet-reclaim.c:842 1679#: src/cli/reclaim/gnunet-reclaim.c:851
1671msgid "Delete the attribute with ID" 1680msgid "Delete the attribute with ID"
1672msgstr "" 1681msgstr ""
1673 1682
1674#: src/cli/reclaim/gnunet-reclaim.c:847 1683#: src/cli/reclaim/gnunet-reclaim.c:856
1675msgid "The attribute VALUE" 1684msgid "The attribute VALUE"
1676msgstr "" 1685msgstr ""
1677 1686
1678#: src/cli/reclaim/gnunet-reclaim.c:852 1687#: src/cli/reclaim/gnunet-reclaim.c:861
1679msgid "The EGO to use" 1688msgid "The EGO to use"
1680msgstr "" 1689msgstr ""
1681 1690
1682#: src/cli/reclaim/gnunet-reclaim.c:858 1691#: src/cli/reclaim/gnunet-reclaim.c:867
1683msgid "Specify the relying party for issue" 1692msgid "Specify the relying party for issue"
1684msgstr "" 1693msgstr ""
1685 1694
1686#: src/cli/reclaim/gnunet-reclaim.c:862 1695#: src/cli/reclaim/gnunet-reclaim.c:873
1696msgid "Specify the relying party URI for a ticket to consume"
1697msgstr ""
1698
1699#: src/cli/reclaim/gnunet-reclaim.c:877
1687msgid "List attributes for EGO" 1700msgid "List attributes for EGO"
1688msgstr "" 1701msgstr ""
1689 1702
1690#: src/cli/reclaim/gnunet-reclaim.c:866 1703#: src/cli/reclaim/gnunet-reclaim.c:881
1691msgid "List credentials for EGO" 1704msgid "List credentials for EGO"
1692msgstr "" 1705msgstr ""
1693 1706
1694#: src/cli/reclaim/gnunet-reclaim.c:872 1707#: src/cli/reclaim/gnunet-reclaim.c:887
1695msgid "Credential to use for attribute" 1708msgid "Credential to use for attribute"
1696msgstr "" 1709msgstr ""
1697 1710
1698#: src/cli/reclaim/gnunet-reclaim.c:877 1711#: src/cli/reclaim/gnunet-reclaim.c:892
1699msgid "Credential name" 1712msgid "Credential name"
1700msgstr "" 1713msgstr ""
1701 1714
1702#: src/cli/reclaim/gnunet-reclaim.c:883 1715#: src/cli/reclaim/gnunet-reclaim.c:898
1703msgid "Issue a ticket for a set of attributes separated by comma" 1716msgid "Issue a ticket for a set of attributes separated by comma"
1704msgstr "" 1717msgstr ""
1705 1718
1706#: src/cli/reclaim/gnunet-reclaim.c:888 1719#: src/cli/reclaim/gnunet-reclaim.c:903
1707msgid "Consume a ticket" 1720msgid "Consume a ticket"
1708msgstr "" 1721msgstr ""
1709 1722
1710#: src/cli/reclaim/gnunet-reclaim.c:893 1723#: src/cli/reclaim/gnunet-reclaim.c:908
1711msgid "Revoke a ticket" 1724msgid "Revoke a ticket"
1712msgstr "" 1725msgstr ""
1713 1726
1714#: src/cli/reclaim/gnunet-reclaim.c:898 1727#: src/cli/reclaim/gnunet-reclaim.c:913
1715msgid "Type of attribute" 1728msgid "Type of attribute"
1716msgstr "" 1729msgstr ""
1717 1730
1718#: src/cli/reclaim/gnunet-reclaim.c:903 1731#: src/cli/reclaim/gnunet-reclaim.c:918
1719msgid "Type of credential" 1732msgid "Type of credential"
1720msgstr "" 1733msgstr ""
1721 1734
1722#: src/cli/reclaim/gnunet-reclaim.c:907 1735#: src/cli/reclaim/gnunet-reclaim.c:922
1723msgid "List tickets of ego" 1736msgid "List tickets of ego"
1724msgstr "" 1737msgstr ""
1725 1738
1726#: src/cli/reclaim/gnunet-reclaim.c:913 1739#: src/cli/reclaim/gnunet-reclaim.c:928
1727msgid "Expiration interval of the attribute" 1740msgid "Expiration interval of the attribute"
1728msgstr "" 1741msgstr ""
1729 1742
1730#: src/cli/reclaim/gnunet-reclaim.c:921 1743#: src/cli/reclaim/gnunet-reclaim.c:936
1731msgid "re:claimID command line tool" 1744msgid "re:claimID command line tool"
1732msgstr "" 1745msgstr ""
1733 1746
@@ -1959,32 +1972,58 @@ msgstr ""
1959msgid "run decoder modus, otherwise runs as encoder" 1972msgid "run decoder modus, otherwise runs as encoder"
1960msgstr "" 1973msgstr ""
1961 1974
1962#: src/cli/util/gnunet-config.c:154 1975#: src/cli/util/gnunet-config.c:101
1963msgid "test if the current installation supports the specified BACKEND" 1976msgid "test if the current installation supports the specified BACKEND"
1964msgstr "" 1977msgstr ""
1965 1978
1966#: src/cli/util/gnunet-config.c:160 1979#: src/cli/util/gnunet-config.c:107
1967msgid "" 1980msgid ""
1968"Provide an appropriate value for CFLAGS to applications building on top of " 1981"Provide an appropriate value for CFLAGS to applications building on top of "
1969"GNUnet" 1982"GNUnet"
1970msgstr "" 1983msgstr ""
1971 1984
1972#: src/cli/util/gnunet-config.c:165 1985#: src/cli/util/gnunet-config.c:112
1973msgid "Is this an experimental build of GNUnet" 1986msgid "Is this an experimental build of GNUnet"
1974msgstr "" 1987msgstr ""
1975 1988
1976#: src/cli/util/gnunet-config.c:171 1989#: src/cli/util/gnunet-config.c:118
1977msgid "" 1990msgid ""
1978"Provide an appropriate value for LIBS to applications building on top of " 1991"Provide an appropriate value for LIBS to applications building on top of "
1979"GNUnet" 1992"GNUnet"
1980msgstr "" 1993msgstr ""
1981 1994
1982#: src/cli/util/gnunet-config.c:177 1995#: src/cli/util/gnunet-config.c:123
1996#, fuzzy
1997msgid "Do not parse default configuration files"
1998msgstr "Résolution de « %s » échouée\n"
1999
2000#: src/cli/util/gnunet-config.c:129
1983msgid "Provide the path under which GNUnet was installed" 2001msgid "Provide the path under which GNUnet was installed"
1984msgstr "" 2002msgstr ""
1985 2003
1986#: src/cli/util/gnunet-config.c:192 2004#: src/cli/util/gnunet-config.c:136
1987msgid "Manipulate GNUnet configuration files" 2005msgid ""
2006"Parse main configuration from this command-line argument and not from disk"
2007msgstr ""
2008
2009#: src/cli/util/gnunet-config.c:225
2010#, fuzzy
2011msgid "Failed to load default configuration, exiting ...\n"
2012msgstr "Résolution de « %s » échouée\n"
2013
2014#: src/cli/util/gnunet-config.c:237
2015#, fuzzy
2016msgid "Failed to parse configuration, exiting ...\n"
2017msgstr "Résolution de « %s » échouée\n"
2018
2019#: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287
2020#, c-format
2021msgid "Unreadable configuration file `%s', exiting ...\n"
2022msgstr ""
2023
2024#: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299
2025#, c-format
2026msgid "Malformed configuration file `%s', exiting ...\n"
1988msgstr "" 2027msgstr ""
1989 2028
1990#: src/cli/util/gnunet-crypto-tvg.c:1588 2029#: src/cli/util/gnunet-crypto-tvg.c:1588
@@ -2034,55 +2073,54 @@ msgstr ""
2034msgid "Hostkeys file `%s' not found\n" 2073msgid "Hostkeys file `%s' not found\n"
2035msgstr "" 2074msgstr ""
2036 2075
2037#: src/cli/util/gnunet-ecc.c:314 2076#: src/cli/util/gnunet-ecc.c:318
2038#, c-format 2077#, c-format
2039msgid "Hostkeys file `%s' is empty\n" 2078msgid "Hostkeys file `%s' is empty\n"
2040msgstr "" 2079msgstr ""
2041 2080
2042#: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 2081#: src/cli/util/gnunet-ecc.c:324
2043#: src/service/testing/testing.c:308
2044#, c-format 2082#, c-format
2045msgid "Incorrect hostkey file format: %s\n" 2083msgid "Incorrect hostkey file format: %s\n"
2046msgstr "" 2084msgstr ""
2047 2085
2048#: src/cli/util/gnunet-ecc.c:334 2086#: src/cli/util/gnunet-ecc.c:340
2049#, c-format 2087#, c-format
2050msgid "Could not read hostkey file: %s\n" 2088msgid "Could not read hostkey file: %s\n"
2051msgstr "" 2089msgstr ""
2052 2090
2053#: src/cli/util/gnunet-ecc.c:388 2091#: src/cli/util/gnunet-ecc.c:394
2054msgid "No hostkey file specified on command line\n" 2092msgid "No hostkey file specified on command line\n"
2055msgstr "" 2093msgstr ""
2056 2094
2057#: src/cli/util/gnunet-ecc.c:452 2095#: src/cli/util/gnunet-ecc.c:458
2058msgid "list keys included in a file (for testing)" 2096msgid "list keys included in a file (for testing)"
2059msgstr "" 2097msgstr ""
2060 2098
2061#: src/cli/util/gnunet-ecc.c:458 2099#: src/cli/util/gnunet-ecc.c:464
2062msgid "number of keys to list included in a file (for testing)" 2100msgid "number of keys to list included in a file (for testing)"
2063msgstr "" 2101msgstr ""
2064 2102
2065#: src/cli/util/gnunet-ecc.c:464 2103#: src/cli/util/gnunet-ecc.c:470
2066msgid "create COUNT public-private key pairs (for testing)" 2104msgid "create COUNT public-private key pairs (for testing)"
2067msgstr "" 2105msgstr ""
2068 2106
2069#: src/cli/util/gnunet-ecc.c:469 2107#: src/cli/util/gnunet-ecc.c:475
2070msgid "print the public key in ASCII format" 2108msgid "print the public key in ASCII format"
2071msgstr "" 2109msgstr ""
2072 2110
2073#: src/cli/util/gnunet-ecc.c:474 2111#: src/cli/util/gnunet-ecc.c:480
2074msgid "print the private key in ASCII format" 2112msgid "print the private key in ASCII format"
2075msgstr "" 2113msgstr ""
2076 2114
2077#: src/cli/util/gnunet-ecc.c:479 2115#: src/cli/util/gnunet-ecc.c:485
2078msgid "print the public key in HEX format" 2116msgid "print the public key in HEX format"
2079msgstr "" 2117msgstr ""
2080 2118
2081#: src/cli/util/gnunet-ecc.c:485 2119#: src/cli/util/gnunet-ecc.c:491
2082msgid "print examples of ECC operations (used for compatibility testing)" 2120msgid "print examples of ECC operations (used for compatibility testing)"
2083msgstr "" 2121msgstr ""
2084 2122
2085#: src/cli/util/gnunet-ecc.c:499 2123#: src/cli/util/gnunet-ecc.c:505
2086msgid "Manipulate GNUnet private ECC key files" 2124msgid "Manipulate GNUnet private ECC key files"
2087msgstr "" 2125msgstr ""
2088 2126
@@ -3144,13 +3182,13 @@ msgstr ""
3144msgid "Invalid handle type while writing `%s'" 3182msgid "Invalid handle type while writing `%s'"
3145msgstr "" 3183msgstr ""
3146 3184
3147#: src/lib/util/client.c:531 src/lib/util/service.c:1134 3185#: src/lib/util/client.c:531 src/lib/util/service.c:1139
3148#: src/service/arm/gnunet-service-arm.c:452 3186#: src/service/arm/gnunet-service-arm.c:452
3149#, c-format 3187#, c-format
3150msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 3188msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
3151msgstr "" 3189msgstr ""
3152 3190
3153#: src/lib/util/client.c:536 src/lib/util/service.c:1138 3191#: src/lib/util/client.c:536 src/lib/util/service.c:1143
3154#: src/service/arm/gnunet-service-arm.c:456 3192#: src/service/arm/gnunet-service-arm.c:456
3155#, c-format 3193#, c-format
3156msgid "Using `%s' instead\n" 3194msgid "Using `%s' instead\n"
@@ -3278,17 +3316,17 @@ msgstr ""
3278msgid "`%s' failed at %s:%d with error: %s\n" 3316msgid "`%s' failed at %s:%d with error: %s\n"
3279msgstr "" 3317msgstr ""
3280 3318
3281#: src/lib/util/crypto_ecc.c:554 3319#: src/lib/util/crypto_ecc.c:569
3282#, c-format 3320#, c-format
3283msgid "ECC signing failed at %s:%d: %s\n" 3321msgid "ECC signing failed at %s:%d: %s\n"
3284msgstr "" 3322msgstr ""
3285 3323
3286#: src/lib/util/crypto_ecc.c:677 3324#: src/lib/util/crypto_ecc.c:692
3287#, c-format 3325#, c-format
3288msgid "ECDSA signature verification failed at %s:%d: %s\n" 3326msgid "ECDSA signature verification failed at %s:%d: %s\n"
3289msgstr "" 3327msgstr ""
3290 3328
3291#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:304 3329#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:305
3292msgid "Could not load peer's private key\n" 3330msgid "Could not load peer's private key\n"
3293msgstr "" 3331msgstr ""
3294 3332
@@ -3312,7 +3350,7 @@ msgstr ""
3312msgid "Expected `%s' to be a directory!\n" 3350msgid "Expected `%s' to be a directory!\n"
3313msgstr "" 3351msgstr ""
3314 3352
3315#: src/lib/util/disk.c:1222 src/lib/util/service.c:1642 3353#: src/lib/util/disk.c:1222 src/lib/util/service.c:1651
3316#, c-format 3354#, c-format
3317msgid "Cannot obtain information about user `%s': %s\n" 3355msgid "Cannot obtain information about user `%s': %s\n"
3318msgstr "" 3356msgstr ""
@@ -3502,96 +3540,96 @@ msgstr ""
3502msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 3540msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
3503msgstr "" 3541msgstr ""
3504 3542
3505#: src/lib/util/gnunet_error_codes.c:60 3543#: src/lib/util/gnunet_error_codes.c:59
3506msgid "No error (success)." 3544msgid "No error (success)."
3507msgstr "" 3545msgstr ""
3508 3546
3509#: src/lib/util/gnunet_error_codes.c:66 3547#: src/lib/util/gnunet_error_codes.c:65
3510#, fuzzy 3548#, fuzzy
3511msgid "Unknown and unspecified error." 3549msgid "Unknown and unspecified error."
3512msgstr "%.s Code d'erreur inconnu" 3550msgstr "%.s Code d'erreur inconnu"
3513 3551
3514#: src/lib/util/gnunet_error_codes.c:72 3552#: src/lib/util/gnunet_error_codes.c:71
3515msgid "Communication with service failed." 3553msgid "Communication with service failed."
3516msgstr "" 3554msgstr ""
3517 3555
3518#: src/lib/util/gnunet_error_codes.c:78 3556#: src/lib/util/gnunet_error_codes.c:77
3519#, fuzzy 3557#, fuzzy
3520msgid "Ego not found." 3558msgid "Ego not found."
3521msgstr "upnpc introuvable\n" 3559msgstr "upnpc introuvable\n"
3522 3560
3523#: src/lib/util/gnunet_error_codes.c:84 3561#: src/lib/util/gnunet_error_codes.c:83
3524msgid "Identifier already in use for another ego." 3562msgid "Identifier already in use for another ego."
3525msgstr "" 3563msgstr ""
3526 3564
3527#: src/lib/util/gnunet_error_codes.c:90 3565#: src/lib/util/gnunet_error_codes.c:89
3528msgid "The given ego is invalid or malformed." 3566msgid "The given ego is invalid or malformed."
3529msgstr "" 3567msgstr ""
3530 3568
3531#: src/lib/util/gnunet_error_codes.c:96 3569#: src/lib/util/gnunet_error_codes.c:95
3532#, fuzzy 3570#, fuzzy
3533msgid "Unknown namestore error." 3571msgid "Unknown namestore error."
3534msgstr "%.s Code d'erreur inconnu" 3572msgstr "%.s Code d'erreur inconnu"
3535 3573
3536#: src/lib/util/gnunet_error_codes.c:102 src/lib/util/gnunet_error_codes.c:120 3574#: src/lib/util/gnunet_error_codes.c:101 src/lib/util/gnunet_error_codes.c:119
3537#, fuzzy 3575#, fuzzy
3538msgid "Zone iteration failed." 3576msgid "Zone iteration failed."
3539msgstr "# Session TCP active" 3577msgstr "# Session TCP active"
3540 3578
3541#: src/lib/util/gnunet_error_codes.c:108 3579#: src/lib/util/gnunet_error_codes.c:107
3542#, fuzzy 3580#, fuzzy
3543msgid "Zone not found." 3581msgid "Zone not found."
3544msgstr "upnpc introuvable\n" 3582msgstr "upnpc introuvable\n"
3545 3583
3546#: src/lib/util/gnunet_error_codes.c:114 3584#: src/lib/util/gnunet_error_codes.c:113
3547#, fuzzy 3585#, fuzzy
3548msgid "Record not found." 3586msgid "Record not found."
3549msgstr "upnpc introuvable\n" 3587msgstr "upnpc introuvable\n"
3550 3588
3551#: src/lib/util/gnunet_error_codes.c:126 3589#: src/lib/util/gnunet_error_codes.c:125
3552msgid "Zone does not contain any records." 3590msgid "Zone does not contain any records."
3553msgstr "" 3591msgstr ""
3554 3592
3555#: src/lib/util/gnunet_error_codes.c:132 3593#: src/lib/util/gnunet_error_codes.c:131
3556#, fuzzy 3594#, fuzzy
3557msgid "Failed to lookup record." 3595msgid "Failed to lookup record."
3558msgstr "Échec du démarrage de %s\n" 3596msgstr "Échec du démarrage de %s\n"
3559 3597
3560#: src/lib/util/gnunet_error_codes.c:138 3598#: src/lib/util/gnunet_error_codes.c:137
3561msgid "No records given." 3599msgid "No records given."
3562msgstr "" 3600msgstr ""
3563 3601
3564#: src/lib/util/gnunet_error_codes.c:144 3602#: src/lib/util/gnunet_error_codes.c:143
3565msgid "Record data invalid." 3603msgid "Record data invalid."
3566msgstr "" 3604msgstr ""
3567 3605
3568#: src/lib/util/gnunet_error_codes.c:150 3606#: src/lib/util/gnunet_error_codes.c:149
3569msgid "No label given." 3607msgid "No label given."
3570msgstr "" 3608msgstr ""
3571 3609
3572#: src/lib/util/gnunet_error_codes.c:156 3610#: src/lib/util/gnunet_error_codes.c:155
3573#, fuzzy 3611#, fuzzy
3574msgid "No results given." 3612msgid "No results given."
3575msgstr "# résultats introuvables" 3613msgstr "# résultats introuvables"
3576 3614
3577#: src/lib/util/gnunet_error_codes.c:162 3615#: src/lib/util/gnunet_error_codes.c:161
3578msgid "Record already exists." 3616msgid "Record already exists."
3579msgstr "" 3617msgstr ""
3580 3618
3581#: src/lib/util/gnunet_error_codes.c:168 3619#: src/lib/util/gnunet_error_codes.c:167
3582msgid "Record size exceeds maximum limit." 3620msgid "Record size exceeds maximum limit."
3583msgstr "" 3621msgstr ""
3584 3622
3585#: src/lib/util/gnunet_error_codes.c:174 3623#: src/lib/util/gnunet_error_codes.c:173
3586msgid "There was an error in the database backend." 3624msgid "There was an error in the database backend."
3587msgstr "" 3625msgstr ""
3588 3626
3589#: src/lib/util/gnunet_error_codes.c:180 3627#: src/lib/util/gnunet_error_codes.c:179
3590#, fuzzy 3628#, fuzzy
3591msgid "Failed to store the given records." 3629msgid "Failed to store the given records."
3592msgstr "Échec du démarrage de %s\n" 3630msgstr "Échec du démarrage de %s\n"
3593 3631
3594#: src/lib/util/gnunet_error_codes.c:186 3632#: src/lib/util/gnunet_error_codes.c:185
3595msgid "Label invalid or malformed." 3633msgid "Label invalid or malformed."
3596msgstr "" 3634msgstr ""
3597 3635
@@ -3657,16 +3695,6 @@ msgstr ""
3657msgid "Could not determine plugin installation path.\n" 3695msgid "Could not determine plugin installation path.\n"
3658msgstr "" 3696msgstr ""
3659 3697
3660#: src/lib/util/program.c:287
3661#, c-format
3662msgid "Unreadable configuration file `%s', exiting ...\n"
3663msgstr ""
3664
3665#: src/lib/util/program.c:299
3666#, c-format
3667msgid "Malformed configuration file `%s', exiting ...\n"
3668msgstr ""
3669
3670#: src/lib/util/program.c:314 3698#: src/lib/util/program.c:314
3671#, c-format 3699#, c-format
3672msgid "Unreadable configuration file `%s'. Exiting ...\n" 3700msgid "Unreadable configuration file `%s'. Exiting ...\n"
@@ -3714,120 +3742,120 @@ msgstr ""
3714msgid "Could not resolve our FQDN: %s\n" 3742msgid "Could not resolve our FQDN: %s\n"
3715msgstr "Résolution de « %s » échouée : %s\n" 3743msgstr "Résolution de « %s » échouée : %s\n"
3716 3744
3717#: src/lib/util/service.c:654 3745#: src/lib/util/service.c:650
3718#, c-format 3746#, c-format
3719msgid "" 3747msgid ""
3720"Processing code for message of type %u did not call " 3748"Processing code for message of type %u did not call "
3721"`GNUNET_SERVICE_client_continue' after %s\n" 3749"`GNUNET_SERVICE_client_continue' after %s\n"
3722msgstr "" 3750msgstr ""
3723 3751
3724#: src/lib/util/service.c:838 3752#: src/lib/util/service.c:841
3725#, c-format 3753#, c-format
3726msgid "Unknown address family %d\n" 3754msgid "Unknown address family %d\n"
3727msgstr "" 3755msgstr ""
3728 3756
3729#: src/lib/util/service.c:951 3757#: src/lib/util/service.c:956
3730#, c-format 3758#, c-format
3731msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 3759msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
3732msgstr "" 3760msgstr ""
3733 3761
3734#: src/lib/util/service.c:992 3762#: src/lib/util/service.c:997
3735#, c-format 3763#, c-format
3736msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 3764msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
3737msgstr "" 3765msgstr ""
3738 3766
3739#: src/lib/util/service.c:1095 src/lib/util/service.c:1101 3767#: src/lib/util/service.c:1100 src/lib/util/service.c:1106
3740#: src/service/arm/gnunet-service-arm.c:412 3768#: src/service/arm/gnunet-service-arm.c:412
3741#: src/service/arm/gnunet-service-arm.c:418 3769#: src/service/arm/gnunet-service-arm.c:418
3742#, c-format 3770#, c-format
3743msgid "Require valid port number for service `%s' in configuration!\n" 3771msgid "Require valid port number for service `%s' in configuration!\n"
3744msgstr "" 3772msgstr ""
3745 3773
3746#: src/lib/util/service.c:1158 src/service/arm/gnunet-service-arm.c:484 3774#: src/lib/util/service.c:1163 src/service/arm/gnunet-service-arm.c:484
3747#, c-format 3775#, c-format
3748msgid "" 3776msgid ""
3749"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 3777"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
3750"domain socket: %s\n" 3778"domain socket: %s\n"
3751msgstr "" 3779msgstr ""
3752 3780
3753#: src/lib/util/service.c:1176 src/service/arm/gnunet-service-arm.c:505 3781#: src/lib/util/service.c:1181 src/service/arm/gnunet-service-arm.c:505
3754#, c-format 3782#, c-format
3755msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 3783msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
3756msgstr "" 3784msgstr ""
3757 3785
3758#: src/lib/util/service.c:1207 src/service/arm/gnunet-service-arm.c:536 3786#: src/lib/util/service.c:1212 src/service/arm/gnunet-service-arm.c:536
3759#, c-format 3787#, c-format
3760msgid "Failed to resolve `%s': %s\n" 3788msgid "Failed to resolve `%s': %s\n"
3761msgstr "Résolution de « %s » échouée : %s\n" 3789msgstr "Résolution de « %s » échouée : %s\n"
3762 3790
3763#: src/lib/util/service.c:1226 src/service/arm/gnunet-service-arm.c:555 3791#: src/lib/util/service.c:1231 src/service/arm/gnunet-service-arm.c:555
3764#, c-format 3792#, c-format
3765msgid "Failed to find %saddress for `%s'.\n" 3793msgid "Failed to find %saddress for `%s'.\n"
3766msgstr "" 3794msgstr ""
3767 3795
3768#: src/lib/util/service.c:1401 3796#: src/lib/util/service.c:1406
3769#, c-format 3797#, c-format
3770msgid "`%s' failed for port %d (%s).\n" 3798msgid "`%s' failed for port %d (%s).\n"
3771msgstr "" 3799msgstr ""
3772 3800
3773#: src/lib/util/service.c:1413 3801#: src/lib/util/service.c:1418
3774#, c-format 3802#, c-format
3775msgid "`%s' failed for port %d (%s): address already in use\n" 3803msgid "`%s' failed for port %d (%s): address already in use\n"
3776msgstr "" 3804msgstr ""
3777 3805
3778#: src/lib/util/service.c:1420 3806#: src/lib/util/service.c:1425
3779#, c-format 3807#, c-format
3780msgid "`%s' failed for `%s': address already in use\n" 3808msgid "`%s' failed for `%s': address already in use\n"
3781msgstr "" 3809msgstr ""
3782 3810
3783#: src/lib/util/service.c:1481 3811#: src/lib/util/service.c:1486
3784#, c-format 3812#, c-format
3785msgid "Specified value for `%s' of service `%s' is invalid\n" 3813msgid "Specified value for `%s' of service `%s' is invalid\n"
3786msgstr "" 3814msgstr ""
3787 3815
3788#: src/lib/util/service.c:1505 3816#: src/lib/util/service.c:1510
3789#, c-format 3817#, c-format
3790msgid "Could not access pre-bound socket %u, will try to bind myself\n" 3818msgid "Could not access pre-bound socket %u, will try to bind myself\n"
3791msgstr "" 3819msgstr ""
3792 3820
3793#: src/lib/util/service.c:1573 3821#: src/lib/util/service.c:1583
3794msgid "" 3822msgid ""
3795"Could not bind to any of the ports I was supposed to, refusing to run!\n" 3823"Could not bind to any of the ports I was supposed to, refusing to run!\n"
3796msgstr "" 3824msgstr ""
3797 3825
3798#: src/lib/util/service.c:1644 3826#: src/lib/util/service.c:1653
3799msgid "No such user" 3827msgid "No such user"
3800msgstr "Aucun utilisateur trouvé" 3828msgstr "Aucun utilisateur trouvé"
3801 3829
3802#: src/lib/util/service.c:1658 3830#: src/lib/util/service.c:1668
3803#, c-format 3831#, c-format
3804msgid "Cannot change user/group to `%s': %s\n" 3832msgid "Cannot change user/group to `%s': %s\n"
3805msgstr "" 3833msgstr ""
3806 3834
3807#: src/lib/util/service.c:1751 3835#: src/lib/util/service.c:1767
3808msgid "Service process failed to initialize\n" 3836msgid "Service process failed to initialize\n"
3809msgstr "" 3837msgstr ""
3810 3838
3811#: src/lib/util/service.c:1756 3839#: src/lib/util/service.c:1772
3812msgid "Service process could not initialize server function\n" 3840msgid "Service process could not initialize server function\n"
3813msgstr "" 3841msgstr ""
3814 3842
3815#: src/lib/util/service.c:1761 3843#: src/lib/util/service.c:1777
3816msgid "Service process failed to report status\n" 3844msgid "Service process failed to report status\n"
3817msgstr "" 3845msgstr ""
3818 3846
3819#: src/lib/util/service.c:1960 src/lib/util/service.c:2255 3847#: src/lib/util/service.c:1990 src/lib/util/service.c:2304
3820msgid "do daemonize (detach from terminal)" 3848msgid "do daemonize (detach from terminal)"
3821msgstr "" 3849msgstr ""
3822 3850
3823#: src/lib/util/service.c:2036 src/lib/util/service.c:2048 3851#: src/lib/util/service.c:2065 src/lib/util/service.c:2080
3824#: src/lib/util/service.c:2298 src/lib/util/service.c:2310 3852#: src/lib/util/service.c:2353 src/lib/util/service.c:2368
3825#: src/service/transport/transport-testing-communicator.c:1055 3853#: src/service/transport/transport-testing-communicator.c:1059
3826#, c-format 3854#, c-format
3827msgid "Malformed configuration file `%s', exit ...\n" 3855msgid "Malformed configuration file `%s', exit ...\n"
3828msgstr "" 3856msgstr ""
3829 3857
3830#: src/lib/util/service.c:2058 src/lib/util/service.c:2321 3858#: src/lib/util/service.c:2092 src/lib/util/service.c:2381
3831msgid "Malformed configuration, exit ...\n" 3859msgid "Malformed configuration, exit ...\n"
3832msgstr "" 3860msgstr ""
3833 3861
@@ -4280,6 +4308,11 @@ msgstr ""
4280msgid "Initiating shutdown as requested by client.\n" 4308msgid "Initiating shutdown as requested by client.\n"
4281msgstr "" 4309msgstr ""
4282 4310
4311#: src/service/arm/testing_arm_cmd_start_peer.c:197
4312#, c-format
4313msgid "Failed to start `%s': %s\n"
4314msgstr ""
4315
4283#: src/service/core/gnunet-service-core.c:329 4316#: src/service/core/gnunet-service-core.c:329
4284msgid "# send requests dropped (disconnected)" 4317msgid "# send requests dropped (disconnected)"
4285msgstr "" 4318msgstr ""
@@ -4441,8 +4474,8 @@ msgstr ""
4441#: src/service/core/gnunet-service-core_sessions.c:337 4474#: src/service/core/gnunet-service-core_sessions.c:337
4442#: src/service/fs/gnunet-service-fs_cp.c:484 4475#: src/service/fs/gnunet-service-fs_cp.c:484
4443#: src/service/fs/gnunet-service-fs_cp.c:1377 4476#: src/service/fs/gnunet-service-fs_cp.c:1377
4444#: src/service/topology/gnunet-daemon-topology.c:551 4477#: src/service/topology/gnunet-daemon-topology.c:545
4445#: src/service/topology/gnunet-daemon-topology.c:633 4478#: src/service/topology/gnunet-daemon-topology.c:627
4446msgid "# peers connected" 4479msgid "# peers connected"
4447msgstr "" 4480msgstr ""
4448 4481
@@ -4564,7 +4597,7 @@ msgstr ""
4564#: src/service/datastore/gnunet-service-datastore.c:626 4597#: src/service/datastore/gnunet-service-datastore.c:626
4565#: src/service/datastore/gnunet-service-datastore.c:677 4598#: src/service/datastore/gnunet-service-datastore.c:677
4566#: src/service/datastore/gnunet-service-datastore.c:820 4599#: src/service/datastore/gnunet-service-datastore.c:820
4567#: src/service/datastore/gnunet-service-datastore.c:1428 4600#: src/service/datastore/gnunet-service-datastore.c:1431
4568msgid "# reserved" 4601msgid "# reserved"
4569msgstr "# réservé" 4602msgstr "# réservé"
4570 4603
@@ -4613,65 +4646,65 @@ msgstr ""
4613msgid "# REMOVE requests received" 4646msgid "# REMOVE requests received"
4614msgstr "" 4647msgstr ""
4615 4648
4616#: src/service/datastore/gnunet-service-datastore.c:1107 4649#: src/service/datastore/gnunet-service-datastore.c:1109
4617#, c-format 4650#, c-format
4618msgid "" 4651msgid ""
4619"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n" 4652"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n"
4620msgstr "" 4653msgstr ""
4621 4654
4622#: src/service/datastore/gnunet-service-datastore.c:1112 4655#: src/service/datastore/gnunet-service-datastore.c:1114
4623#: src/service/datastore/gnunet-service-datastore.c:1281 4656#: src/service/datastore/gnunet-service-datastore.c:1283
4624#, c-format 4657#, c-format
4625msgid "New payload: %lld\n" 4658msgid "New payload: %lld\n"
4626msgstr "" 4659msgstr ""
4627 4660
4628#: src/service/datastore/gnunet-service-datastore.c:1167 4661#: src/service/datastore/gnunet-service-datastore.c:1169
4629#, c-format 4662#, c-format
4630msgid "Loading `%s' datastore plugin\n" 4663msgid "Loading `%s' datastore plugin\n"
4631msgstr "" 4664msgstr ""
4632 4665
4633#: src/service/datastore/gnunet-service-datastore.c:1176 4666#: src/service/datastore/gnunet-service-datastore.c:1178
4634#, c-format 4667#, c-format
4635msgid "Failed to load datastore plugin for `%s'\n" 4668msgid "Failed to load datastore plugin for `%s'\n"
4636msgstr "" 4669msgstr ""
4637 4670
4638#: src/service/datastore/gnunet-service-datastore.c:1236 4671#: src/service/datastore/gnunet-service-datastore.c:1238
4639msgid "Bloomfilter construction complete.\n" 4672msgid "Bloomfilter construction complete.\n"
4640msgstr "" 4673msgstr ""
4641 4674
4642#: src/service/datastore/gnunet-service-datastore.c:1288 4675#: src/service/datastore/gnunet-service-datastore.c:1290
4643msgid "Rebuilding bloomfilter. Please be patient.\n" 4676msgid "Rebuilding bloomfilter. Please be patient.\n"
4644msgstr "" 4677msgstr ""
4645 4678
4646#: src/service/datastore/gnunet-service-datastore.c:1298 4679#: src/service/datastore/gnunet-service-datastore.c:1300
4647msgid "Plugin does not support get_keys function. Please fix!\n" 4680msgid "Plugin does not support get_keys function. Please fix!\n"
4648msgstr "" 4681msgstr ""
4649 4682
4650#: src/service/datastore/gnunet-service-datastore.c:1463 4683#: src/service/datastore/gnunet-service-datastore.c:1466
4651#, c-format 4684#, c-format
4652msgid "# bytes used in file-sharing datastore `%s'" 4685msgid "# bytes used in file-sharing datastore `%s'"
4653msgstr "" 4686msgstr ""
4654 4687
4655#: src/service/datastore/gnunet-service-datastore.c:1472 4688#: src/service/datastore/gnunet-service-datastore.c:1475
4656msgid "# quota" 4689msgid "# quota"
4657msgstr "# quota" 4690msgstr "# quota"
4658 4691
4659#: src/service/datastore/gnunet-service-datastore.c:1475 4692#: src/service/datastore/gnunet-service-datastore.c:1478
4660msgid "# cache size" 4693msgid "# cache size"
4661msgstr "# taille du cache" 4694msgstr "# taille du cache"
4662 4695
4663#: src/service/datastore/gnunet-service-datastore.c:1491 4696#: src/service/datastore/gnunet-service-datastore.c:1494
4664#, c-format 4697#, c-format
4665msgid "Could not use specified filename `%s' for bloomfilter.\n" 4698msgid "Could not use specified filename `%s' for bloomfilter.\n"
4666msgstr "" 4699msgstr ""
4667 4700
4668#: src/service/datastore/gnunet-service-datastore.c:1512 4701#: src/service/datastore/gnunet-service-datastore.c:1515
4669#: src/service/datastore/gnunet-service-datastore.c:1534 4702#: src/service/datastore/gnunet-service-datastore.c:1537
4670#, c-format 4703#, c-format
4671msgid "Failed to remove bogus bloomfilter file `%s'\n" 4704msgid "Failed to remove bogus bloomfilter file `%s'\n"
4672msgstr "" 4705msgstr ""
4673 4706
4674#: src/service/datastore/gnunet-service-datastore.c:1573 4707#: src/service/datastore/gnunet-service-datastore.c:1576
4675msgid "Failed to initialize bloomfilter.\n" 4708msgid "Failed to initialize bloomfilter.\n"
4676msgstr "" 4709msgstr ""
4677 4710
@@ -5432,7 +5465,7 @@ msgstr ""
5432 5465
5433#: src/service/fs/gnunet-service-fs.c:1271 5466#: src/service/fs/gnunet-service-fs.c:1271
5434#: src/service/hostlist/gnunet-daemon-hostlist.c:343 5467#: src/service/hostlist/gnunet-daemon-hostlist.c:343
5435#: src/service/topology/gnunet-daemon-topology.c:1066 5468#: src/service/topology/gnunet-daemon-topology.c:1062
5436#, c-format 5469#, c-format
5437msgid "Failed to connect to `%s' service.\n" 5470msgid "Failed to connect to `%s' service.\n"
5438msgstr "" 5471msgstr ""
@@ -6217,7 +6250,7 @@ msgid "# hostlist advertisements send"
6217msgstr "" 6250msgstr ""
6218 6251
6219#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 6252#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483
6220#: src/service/topology/gnunet-daemon-topology.c:786 6253#: src/service/topology/gnunet-daemon-topology.c:781
6221#, c-format 6254#, c-format
6222msgid "Error in communication with PEERSTORE service: %s\n" 6255msgid "Error in communication with PEERSTORE service: %s\n"
6223msgstr "" 6256msgstr ""
@@ -6471,11 +6504,11 @@ msgstr ""
6471msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" 6504msgid "Malformed punched hole specification `%s' (IPv6 address invalid)"
6472msgstr "" 6505msgstr ""
6473 6506
6474#: src/service/nat/gnunet-service-nat.c:1861 6507#: src/service/nat/gnunet-service-nat.c:1860
6475msgid "Connection reversal request failed\n" 6508msgid "Connection reversal request failed\n"
6476msgstr "" 6509msgstr ""
6477 6510
6478#: src/service/nat/gnunet-service-nat.c:1935 6511#: src/service/nat/gnunet-service-nat.c:1999
6479msgid "" 6512msgid ""
6480"UPnP enabled in configuration, but UPnP client `upnpc` command not found, " 6513"UPnP enabled in configuration, but UPnP client `upnpc` command not found, "
6481"disabling UPnP\n" 6514"disabling UPnP\n"
@@ -6499,41 +6532,41 @@ msgstr ""
6499msgid "`upnpc' command not found\n" 6532msgid "`upnpc' command not found\n"
6500msgstr "" 6533msgstr ""
6501 6534
6502#: src/service/peerstore/gnunet-service-peerstore.c:1141 6535#: src/service/peerstore/gnunet-service-peerstore.c:1150
6503#, c-format 6536#, c-format
6504msgid "Failed to parse HELLO in file `%s': %s\n" 6537msgid "Failed to parse HELLO in file `%s': %s\n"
6505msgstr "" 6538msgstr ""
6506 6539
6507#: src/service/peerstore/gnunet-service-peerstore.c:1214 6540#: src/service/peerstore/gnunet-service-peerstore.c:1223
6508#, fuzzy, c-format 6541#, fuzzy, c-format
6509msgid "Could not load database backend `%s'\n" 6542msgid "Could not load database backend `%s'\n"
6510msgstr "Impossible d’ouvrir « %s ».\n" 6543msgstr "Impossible d’ouvrir « %s ».\n"
6511 6544
6512#: src/service/peerstore/gnunet-service-peerstore.c:1233 6545#: src/service/peerstore/gnunet-service-peerstore.c:1242
6513#, c-format 6546#, c-format
6514msgid "Importing HELLOs from `%s'\n" 6547msgid "Importing HELLOs from `%s'\n"
6515msgstr "" 6548msgstr ""
6516 6549
6517#: src/service/peerstore/gnunet-service-peerstore.c:1244 6550#: src/service/peerstore/gnunet-service-peerstore.c:1253
6518msgid "Skipping import of included HELLOs\n" 6551msgid "Skipping import of included HELLOs\n"
6519msgstr "" 6552msgstr ""
6520 6553
6521#: src/service/peerstore/peerstore_api.c:574 6554#: src/service/peerstore/peerstore_api.c:579
6522msgid "Unexpected store response.\n" 6555msgid "Unexpected store response.\n"
6523msgstr "" 6556msgstr ""
6524 6557
6525#: src/service/peerstore/peerstore_api.c:606 6558#: src/service/peerstore/peerstore_api.c:620
6526msgid "Unexpected iteration response.\n" 6559msgid "Unexpected iteration response.\n"
6527msgstr "" 6560msgstr ""
6528 6561
6529#: src/service/peerstore/peerstore_api.c:652 6562#: src/service/peerstore/peerstore_api.c:666
6530msgid "" 6563msgid ""
6531"Unexpected iteration response, no iterating client found, discarding " 6564"Unexpected iteration response, no iterating client found, discarding "
6532"message.\n" 6565"message.\n"
6533msgstr "" 6566msgstr ""
6534 6567
6535#: src/service/peerstore/peerstore_api.c:662 6568#: src/service/peerstore/peerstore_api.c:676
6536#: src/service/peerstore/peerstore_api_monitor.c:164 6569#: src/service/peerstore/peerstore_api_monitor.c:163
6537msgid "Received a malformed response from service." 6570msgid "Received a malformed response from service."
6538msgstr "" 6571msgstr ""
6539 6572
@@ -6691,11 +6724,11 @@ msgstr ""
6691msgid "Namestore REST API initialized\n" 6724msgid "Namestore REST API initialized\n"
6692msgstr "" 6725msgstr ""
6693 6726
6694#: src/service/rest/openid_plugin.c:3102 6727#: src/service/rest/openid_plugin.c:3121
6695msgid "OpenID Connect REST API initialized\n" 6728msgid "OpenID Connect REST API initialized\n"
6696msgstr "" 6729msgstr ""
6697 6730
6698#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1523 6731#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1494
6699msgid "Identity Provider REST API initialized\n" 6732msgid "Identity Provider REST API initialized\n"
6700msgstr "" 6733msgstr ""
6701 6734
@@ -6742,148 +6775,50 @@ msgstr ""
6742msgid "Could not save some persistent statistics\n" 6775msgid "Could not save some persistent statistics\n"
6743msgstr "" 6776msgstr ""
6744 6777
6745#: src/service/testing/gnunet-testing.c:185 6778#: src/service/testbed/gnunet-testbed.c:196
6746#, c-format 6779msgid "number of unique configuration files to create"
6747msgid "Could not extract hostkey %u (offset too large?)\n"
6748msgstr ""
6749
6750#: src/service/testing/gnunet-testing.c:275
6751#, c-format
6752msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
6753msgstr ""
6754
6755#: src/service/testing/gnunet-testing.c:386
6756msgid "create unique configuration files"
6757msgstr ""
6758
6759#: src/service/testing/gnunet-testing.c:392
6760msgid "extract hostkey file from pre-computed hostkey list"
6761msgstr ""
6762
6763#: src/service/testing/gnunet-testing.c:400
6764msgid ""
6765"number of unique configuration files to create, or number of the hostkey to "
6766"extract"
6767msgstr "" 6780msgstr ""
6768 6781
6769#: src/service/testing/gnunet-testing.c:407 6782#: src/service/testbed/gnunet-testbed.c:202
6770msgid "configuration template" 6783msgid "configuration template"
6771msgstr "" 6784msgstr ""
6772 6785
6773#: src/service/testing/gnunet-testing.c:415 6786#: src/service/testbed/gnunet-testbed.c:218
6774msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"
6775msgstr ""
6776
6777#: src/service/testing/gnunet-testing.c:432
6778msgid "Command line tool to access the testing library" 6787msgid "Command line tool to access the testing library"
6779msgstr "" 6788msgstr ""
6780 6789
6781#: src/service/testing/list-keys.c:92
6782msgid "list COUNT number of keys"
6783msgstr ""
6784
6785#: src/service/testing/testing.c:291
6786#, c-format
6787msgid "Hostkeys file not found: %s\n"
6788msgstr ""
6789
6790#: src/service/testing/testing.c:743
6791#, c-format
6792msgid "Key number %u does not exist\n"
6793msgstr ""
6794
6795#: src/service/testing/testing.c:1217
6796#, c-format
6797msgid ""
6798"You attempted to create a testbed with more than %u hosts. Please "
6799"precompute more hostkeys first.\n"
6800msgstr ""
6801
6802#: src/service/testing/testing.c:1226
6803#, c-format
6804msgid "Failed to initialize hostkey for peer %u\n"
6805msgstr ""
6806
6807#: src/service/testing/testing.c:1236
6808msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
6809msgstr ""
6810
6811#: src/service/testing/testing.c:1249
6812msgid "Failed to create configuration for peer (not enough free ports?)\n"
6813msgstr ""
6814
6815#: src/service/testing/testing.c:1265
6816#, c-format
6817msgid "Cannot open hostkey file `%s': %s\n"
6818msgstr ""
6819
6820#: src/service/testing/testing.c:1279
6821#, c-format
6822msgid "Failed to write hostkey file for peer %u: %s\n"
6823msgstr ""
6824
6825#: src/service/testing/testing.c:1307
6826#, c-format
6827msgid "Failed to write configuration file `%s' for peer %u: %s\n"
6828msgstr ""
6829
6830#: src/service/testing/testing.c:1413
6831#, c-format
6832msgid "Failed to start `%s': %s\n"
6833msgstr ""
6834
6835#: src/service/testing/testing.c:1664
6836#, c-format
6837msgid "Failed to load configuration from %s\n"
6838msgstr ""
6839
6840#: src/service/testing/testing.c:2795
6841#, c-format
6842msgid "Topology file %s not found\n"
6843msgstr ""
6844
6845#: src/service/testing/testing.c:2803
6846#, c-format
6847msgid "Topology file %s has no data\n"
6848msgstr ""
6849
6850#: src/service/testing/testing.c:2811
6851#, c-format
6852msgid "Topology file %s cannot be read\n"
6853msgstr ""
6854
6855#: src/service/topology/gnunet-daemon-topology.c:286 6790#: src/service/topology/gnunet-daemon-topology.c:286
6856msgid "# connect requests issued to ATS" 6791msgid "# connect requests issued to ATS"
6857msgstr "" 6792msgstr ""
6858 6793
6859#: src/service/topology/gnunet-daemon-topology.c:480 6794#: src/service/topology/gnunet-daemon-topology.c:475
6860msgid "# HELLO messages gossipped" 6795msgid "# HELLO messages gossipped"
6861msgstr "" 6796msgstr ""
6862 6797
6863#: src/service/topology/gnunet-daemon-topology.c:752 6798#: src/service/topology/gnunet-daemon-topology.c:747
6864msgid "Error in communication with PEERSTORE service to monitor.\n" 6799msgid "Error in communication with PEERSTORE service to monitor.\n"
6865msgstr "" 6800msgstr ""
6866 6801
6867#: src/service/topology/gnunet-daemon-topology.c:761 6802#: src/service/topology/gnunet-daemon-topology.c:756
6868msgid "Finished initial PEERSTORE iteration in monitor.\n" 6803msgid "Finished initial PEERSTORE iteration in monitor.\n"
6869msgstr "" 6804msgstr ""
6870 6805
6871#: src/service/topology/gnunet-daemon-topology.c:869 6806#: src/service/topology/gnunet-daemon-topology.c:864
6872msgid "Failed to connect to core service, can not manage topology!\n" 6807msgid "Failed to connect to core service, can not manage topology!\n"
6873msgstr "" 6808msgstr ""
6874 6809
6875#: src/service/topology/gnunet-daemon-topology.c:943 6810#: src/service/topology/gnunet-daemon-topology.c:938
6876msgid "# HELLO messages received" 6811msgid "# HELLO messages received"
6877msgstr "" 6812msgstr ""
6878 6813
6879#: src/service/topology/gnunet-daemon-topology.c:1095 6814#: src/service/topology/gnunet-daemon-topology.c:1091
6880msgid "GNUnet topology control" 6815msgid "GNUnet topology control"
6881msgstr "" 6816msgstr ""
6882 6817
6883#: src/service/transport/gnunet-communicator-quic.c:1717 6818#: src/service/transport/gnunet-communicator-quic.c:1717
6884#: src/service/transport/gnunet-communicator-tcp.c:3777 6819#: src/service/transport/gnunet-communicator-tcp.c:3814
6885#: src/service/transport/gnunet-communicator-udp.c:3408 6820#: src/service/transport/gnunet-communicator-udp.c:3579
6886#: src/service/transport/gnunet-service-transport.c:12128 6821#: src/service/transport/gnunet-service-transport.c:12543
6887msgid "Transport service is lacking key configuration settings. Exiting.\n" 6822msgid "Transport service is lacking key configuration settings. Exiting.\n"
6888msgstr "" 6823msgstr ""
6889 6824
@@ -6891,11 +6826,11 @@ msgstr ""
6891msgid "GNUnet QUIC communicator" 6826msgid "GNUnet QUIC communicator"
6892msgstr "" 6827msgstr ""
6893 6828
6894#: src/service/transport/gnunet-communicator-tcp.c:4114 6829#: src/service/transport/gnunet-communicator-tcp.c:4171
6895msgid "GNUnet TCP communicator" 6830msgid "GNUnet TCP communicator"
6896msgstr "" 6831msgstr ""
6897 6832
6898#: src/service/transport/gnunet-communicator-udp.c:3483 6833#: src/service/transport/gnunet-communicator-udp.c:3654
6899msgid "GNUnet UDP communicator" 6834msgid "GNUnet UDP communicator"
6900msgstr "" 6835msgstr ""
6901 6836
@@ -7064,7 +6999,7 @@ msgstr ""
7064msgid "Direct access to transport service." 6999msgid "Direct access to transport service."
7065msgstr "" 7000msgstr ""
7066 7001
7067#: src/service/transport/transport_api2_communication.c:765 7002#: src/service/transport/transport_api2_communication.c:773
7068msgid "Dropped backchanel message: handler not provided by communicator\n" 7003msgid "Dropped backchanel message: handler not provided by communicator\n"
7069msgstr "" 7004msgstr ""
7070 7005
diff --git a/po/it.po b/po/it.po
index 37f90db2c..3f56d09af 100644
--- a/po/it.po
+++ b/po/it.po
@@ -8,7 +8,7 @@ msgid ""
8msgstr "" 8msgstr ""
9"Project-Id-Version: gnunet 0.10.1\n" 9"Project-Id-Version: gnunet 0.10.1\n"
10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
11"POT-Creation-Date: 2024-03-02 14:38+0100\n" 11"POT-Creation-Date: 2024-05-20 20:21+0200\n"
12"PO-Revision-Date: 2019-10-16 11:00+0200\n" 12"PO-Revision-Date: 2019-10-16 11:00+0200\n"
13"Last-Translator: Sebastiano Pistore <sebastianopistore.info@protonmail.ch>\n" 13"Last-Translator: Sebastiano Pistore <sebastianopistore.info@protonmail.ch>\n"
14"Language-Team: Italian <tp@lists.linux.it>\n" 14"Language-Team: Italian <tp@lists.linux.it>\n"
@@ -335,20 +335,24 @@ msgstr ""
335msgid "Failed to connect to CORE service!\n" 335msgid "Failed to connect to CORE service!\n"
336msgstr "" 336msgstr ""
337 337
338#: src/cli/core/gnunet-core.c:230 src/service/transport/gnunet-transport.c:1389 338#: src/cli/core/gnunet-core.c:213
339msgid "No argument given.\n"
340msgstr ""
341
342#: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389
339msgid "provide information about all current connections (continuously)" 343msgid "provide information about all current connections (continuously)"
340msgstr "" 344msgstr ""
341 345
342#: src/cli/core/gnunet-core.c:236 346#: src/cli/core/gnunet-core.c:244
343msgid "Show our current peer identity" 347msgid "Show our current peer identity"
344msgstr "" 348msgstr ""
345 349
346#: src/cli/core/gnunet-core.c:243 350#: src/cli/core/gnunet-core.c:251
347#, fuzzy 351#, fuzzy
348msgid "Show current connections" 352msgid "Show current connections"
349msgstr "# connessioni attive" 353msgstr "# connessioni attive"
350 354
351#: src/cli/core/gnunet-core.c:254 355#: src/cli/core/gnunet-core.c:262
352msgid "Print information about connected peers." 356msgid "Print information about connected peers."
353msgstr "" 357msgstr ""
354 358
@@ -1043,52 +1047,52 @@ msgstr ""
1043msgid "Unindex a file that was previously indexed with gnunet-publish." 1047msgid "Unindex a file that was previously indexed with gnunet-publish."
1044msgstr "" 1048msgstr ""
1045 1049
1046#: src/cli/gns/gnunet-gns.c:268 1050#: src/cli/gns/gnunet-gns.c:269
1047#, fuzzy, c-format 1051#, fuzzy, c-format
1048msgid "`%s' is not a valid DNS domain name\n" 1052msgid "`%s' is not a valid DNS domain name\n"
1049msgstr "`%s' non è un indirizzo IP valido.\n" 1053msgstr "`%s' non è un indirizzo IP valido.\n"
1050 1054
1051#: src/cli/gns/gnunet-gns.c:279 src/lib/util/dnsparser.c:273 1055#: src/cli/gns/gnunet-gns.c:280 src/lib/util/dnsparser.c:273
1052#, c-format 1056#, c-format
1053msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" 1057msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
1054msgstr "" 1058msgstr ""
1055 1059
1056#: src/cli/gns/gnunet-gns.c:294 1060#: src/cli/gns/gnunet-gns.c:295
1057msgid "Cannot resolve using GNS: GNUnet peer not running\n" 1061msgid "Cannot resolve using GNS: GNUnet peer not running\n"
1058msgstr "" 1062msgstr ""
1059 1063
1060#: src/cli/gns/gnunet-gns.c:305 1064#: src/cli/gns/gnunet-gns.c:306
1061#: src/contrib/service/abd/gnunet-service-abd.c:1745 1065#: src/contrib/service/abd/gnunet-service-abd.c:1745
1062#, c-format 1066#, c-format
1063msgid "Failed to connect to GNS\n" 1067msgid "Failed to connect to GNS\n"
1064msgstr "" 1068msgstr ""
1065 1069
1066#: src/cli/gns/gnunet-gns.c:318 1070#: src/cli/gns/gnunet-gns.c:325
1067#, c-format 1071#, c-format
1068msgid "Invalid typename specified, assuming `ANY'\n" 1072msgid "Invalid typename specified, assuming `ANY'\n"
1069msgstr "" 1073msgstr ""
1070 1074
1071#: src/cli/gns/gnunet-gns.c:358 1075#: src/cli/gns/gnunet-gns.c:365
1072msgid "Lookup a record for the given name" 1076msgid "Lookup a record for the given name"
1073msgstr "" 1077msgstr ""
1074 1078
1075#: src/cli/gns/gnunet-gns.c:364 1079#: src/cli/gns/gnunet-gns.c:371
1076msgid "Specify the type of the record to lookup" 1080msgid "Specify the type of the record to lookup"
1077msgstr "" 1081msgstr ""
1078 1082
1079#: src/cli/gns/gnunet-gns.c:370 1083#: src/cli/gns/gnunet-gns.c:377
1080msgid "Specify a timeout for the lookup" 1084msgid "Specify a timeout for the lookup"
1081msgstr "" 1085msgstr ""
1082 1086
1083#: src/cli/gns/gnunet-gns.c:374 1087#: src/cli/gns/gnunet-gns.c:381
1084msgid "No unneeded output" 1088msgid "No unneeded output"
1085msgstr "" 1089msgstr ""
1086 1090
1087#: src/cli/gns/gnunet-gns.c:379 1091#: src/cli/gns/gnunet-gns.c:386
1088msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" 1092msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
1089msgstr "" 1093msgstr ""
1090 1094
1091#: src/cli/gns/gnunet-gns.c:393 1095#: src/cli/gns/gnunet-gns.c:400
1092msgid "GNUnet GNS resolver tool" 1096msgid "GNUnet GNS resolver tool"
1093msgstr "" 1097msgstr ""
1094 1098
@@ -1601,7 +1605,11 @@ msgstr ""
1601msgid "GNUnet NAT traversal autoconfigure daemon" 1605msgid "GNUnet NAT traversal autoconfigure daemon"
1602msgstr "" 1606msgstr ""
1603 1607
1604#: src/cli/nse/gnunet-nse.c:124 1608#: src/cli/nse/gnunet-nse.c:126
1609msgid "Monitor and output current estimates"
1610msgstr ""
1611
1612#: src/cli/nse/gnunet-nse.c:137
1605msgid "Show network size estimates from NSE service." 1613msgid "Show network size estimates from NSE service."
1606msgstr "" 1614msgstr ""
1607 1615
@@ -1649,86 +1657,90 @@ msgstr ""
1649msgid "The time until the DID Document is going to expire (e.g. 5d)" 1657msgid "The time until the DID Document is going to expire (e.g. 5d)"
1650msgstr "" 1658msgstr ""
1651 1659
1652#: src/cli/reclaim/gnunet-reclaim.c:805 1660#: src/cli/reclaim/gnunet-reclaim.c:813
1653#, c-format 1661#, c-format
1654msgid "Ego is required\n" 1662msgid "Ego is required\n"
1655msgstr "" 1663msgstr ""
1656 1664
1657#: src/cli/reclaim/gnunet-reclaim.c:812 1665#: src/cli/reclaim/gnunet-reclaim.c:820
1658#, c-format 1666#, c-format
1659msgid "Attribute value missing!\n" 1667msgid "Attribute value missing!\n"
1660msgstr "" 1668msgstr ""
1661 1669
1662#: src/cli/reclaim/gnunet-reclaim.c:819 1670#: src/cli/reclaim/gnunet-reclaim.c:827
1663#, c-format 1671#, c-format
1664msgid "Requesting party key is required!\n" 1672msgid "Requesting party key is required!\n"
1665msgstr "" 1673msgstr ""
1666 1674
1667#: src/cli/reclaim/gnunet-reclaim.c:837 1675#: src/cli/reclaim/gnunet-reclaim.c:846
1668msgid "Add or update an attribute NAME" 1676msgid "Add or update an attribute NAME"
1669msgstr "" 1677msgstr ""
1670 1678
1671#: src/cli/reclaim/gnunet-reclaim.c:842 1679#: src/cli/reclaim/gnunet-reclaim.c:851
1672msgid "Delete the attribute with ID" 1680msgid "Delete the attribute with ID"
1673msgstr "" 1681msgstr ""
1674 1682
1675#: src/cli/reclaim/gnunet-reclaim.c:847 1683#: src/cli/reclaim/gnunet-reclaim.c:856
1676msgid "The attribute VALUE" 1684msgid "The attribute VALUE"
1677msgstr "" 1685msgstr ""
1678 1686
1679#: src/cli/reclaim/gnunet-reclaim.c:852 1687#: src/cli/reclaim/gnunet-reclaim.c:861
1680msgid "The EGO to use" 1688msgid "The EGO to use"
1681msgstr "" 1689msgstr ""
1682 1690
1683#: src/cli/reclaim/gnunet-reclaim.c:858 1691#: src/cli/reclaim/gnunet-reclaim.c:867
1684msgid "Specify the relying party for issue" 1692msgid "Specify the relying party for issue"
1685msgstr "" 1693msgstr ""
1686 1694
1687#: src/cli/reclaim/gnunet-reclaim.c:862 1695#: src/cli/reclaim/gnunet-reclaim.c:873
1696msgid "Specify the relying party URI for a ticket to consume"
1697msgstr ""
1698
1699#: src/cli/reclaim/gnunet-reclaim.c:877
1688msgid "List attributes for EGO" 1700msgid "List attributes for EGO"
1689msgstr "" 1701msgstr ""
1690 1702
1691#: src/cli/reclaim/gnunet-reclaim.c:866 1703#: src/cli/reclaim/gnunet-reclaim.c:881
1692msgid "List credentials for EGO" 1704msgid "List credentials for EGO"
1693msgstr "" 1705msgstr ""
1694 1706
1695#: src/cli/reclaim/gnunet-reclaim.c:872 1707#: src/cli/reclaim/gnunet-reclaim.c:887
1696msgid "Credential to use for attribute" 1708msgid "Credential to use for attribute"
1697msgstr "" 1709msgstr ""
1698 1710
1699#: src/cli/reclaim/gnunet-reclaim.c:877 1711#: src/cli/reclaim/gnunet-reclaim.c:892
1700msgid "Credential name" 1712msgid "Credential name"
1701msgstr "" 1713msgstr ""
1702 1714
1703#: src/cli/reclaim/gnunet-reclaim.c:883 1715#: src/cli/reclaim/gnunet-reclaim.c:898
1704msgid "Issue a ticket for a set of attributes separated by comma" 1716msgid "Issue a ticket for a set of attributes separated by comma"
1705msgstr "" 1717msgstr ""
1706 1718
1707#: src/cli/reclaim/gnunet-reclaim.c:888 1719#: src/cli/reclaim/gnunet-reclaim.c:903
1708msgid "Consume a ticket" 1720msgid "Consume a ticket"
1709msgstr "" 1721msgstr ""
1710 1722
1711#: src/cli/reclaim/gnunet-reclaim.c:893 1723#: src/cli/reclaim/gnunet-reclaim.c:908
1712msgid "Revoke a ticket" 1724msgid "Revoke a ticket"
1713msgstr "" 1725msgstr ""
1714 1726
1715#: src/cli/reclaim/gnunet-reclaim.c:898 1727#: src/cli/reclaim/gnunet-reclaim.c:913
1716msgid "Type of attribute" 1728msgid "Type of attribute"
1717msgstr "" 1729msgstr ""
1718 1730
1719#: src/cli/reclaim/gnunet-reclaim.c:903 1731#: src/cli/reclaim/gnunet-reclaim.c:918
1720msgid "Type of credential" 1732msgid "Type of credential"
1721msgstr "" 1733msgstr ""
1722 1734
1723#: src/cli/reclaim/gnunet-reclaim.c:907 1735#: src/cli/reclaim/gnunet-reclaim.c:922
1724msgid "List tickets of ego" 1736msgid "List tickets of ego"
1725msgstr "" 1737msgstr ""
1726 1738
1727#: src/cli/reclaim/gnunet-reclaim.c:913 1739#: src/cli/reclaim/gnunet-reclaim.c:928
1728msgid "Expiration interval of the attribute" 1740msgid "Expiration interval of the attribute"
1729msgstr "" 1741msgstr ""
1730 1742
1731#: src/cli/reclaim/gnunet-reclaim.c:921 1743#: src/cli/reclaim/gnunet-reclaim.c:936
1732msgid "re:claimID command line tool" 1744msgid "re:claimID command line tool"
1733msgstr "" 1745msgstr ""
1734 1746
@@ -1960,34 +1972,60 @@ msgstr ""
1960msgid "run decoder modus, otherwise runs as encoder" 1972msgid "run decoder modus, otherwise runs as encoder"
1961msgstr "" 1973msgstr ""
1962 1974
1963#: src/cli/util/gnunet-config.c:154 1975#: src/cli/util/gnunet-config.c:101
1964msgid "test if the current installation supports the specified BACKEND" 1976msgid "test if the current installation supports the specified BACKEND"
1965msgstr "" 1977msgstr ""
1966 1978
1967#: src/cli/util/gnunet-config.c:160 1979#: src/cli/util/gnunet-config.c:107
1968msgid "" 1980msgid ""
1969"Provide an appropriate value for CFLAGS to applications building on top of " 1981"Provide an appropriate value for CFLAGS to applications building on top of "
1970"GNUnet" 1982"GNUnet"
1971msgstr "" 1983msgstr ""
1972 1984
1973#: src/cli/util/gnunet-config.c:165 1985#: src/cli/util/gnunet-config.c:112
1974msgid "Is this an experimental build of GNUnet" 1986msgid "Is this an experimental build of GNUnet"
1975msgstr "" 1987msgstr ""
1976 1988
1977#: src/cli/util/gnunet-config.c:171 1989#: src/cli/util/gnunet-config.c:118
1978msgid "" 1990msgid ""
1979"Provide an appropriate value for LIBS to applications building on top of " 1991"Provide an appropriate value for LIBS to applications building on top of "
1980"GNUnet" 1992"GNUnet"
1981msgstr "" 1993msgstr ""
1982 1994
1983#: src/cli/util/gnunet-config.c:177 1995#: src/cli/util/gnunet-config.c:123
1996#, fuzzy
1997msgid "Do not parse default configuration files"
1998msgstr "Impossibile avviare il servizio ' %s'\n"
1999
2000#: src/cli/util/gnunet-config.c:129
1984msgid "Provide the path under which GNUnet was installed" 2001msgid "Provide the path under which GNUnet was installed"
1985msgstr "" 2002msgstr ""
1986 2003
1987#: src/cli/util/gnunet-config.c:192 2004#: src/cli/util/gnunet-config.c:136
1988msgid "Manipulate GNUnet configuration files" 2005msgid ""
2006"Parse main configuration from this command-line argument and not from disk"
1989msgstr "" 2007msgstr ""
1990 2008
2009#: src/cli/util/gnunet-config.c:225
2010#, fuzzy
2011msgid "Failed to load default configuration, exiting ...\n"
2012msgstr "Impossibile avviare il servizio ' %s'\n"
2013
2014#: src/cli/util/gnunet-config.c:237
2015#, fuzzy
2016msgid "Failed to parse configuration, exiting ...\n"
2017msgstr "Impossibile avviare il servizio ' %s'\n"
2018
2019#: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287
2020#, fuzzy, c-format
2021msgid "Unreadable configuration file `%s', exiting ...\n"
2022msgstr "Impossibile avviare il servizio ' %s'\n"
2023
2024#: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299
2025#, fuzzy, c-format
2026msgid "Malformed configuration file `%s', exiting ...\n"
2027msgstr "Impossibile avviare il servizio ' %s'\n"
2028
1991#: src/cli/util/gnunet-crypto-tvg.c:1588 2029#: src/cli/util/gnunet-crypto-tvg.c:1588
1992msgid "verify a test vector from stdin" 2030msgid "verify a test vector from stdin"
1993msgstr "" 2031msgstr ""
@@ -2035,55 +2073,54 @@ msgstr ""
2035msgid "Hostkeys file `%s' not found\n" 2073msgid "Hostkeys file `%s' not found\n"
2036msgstr "" 2074msgstr ""
2037 2075
2038#: src/cli/util/gnunet-ecc.c:314 2076#: src/cli/util/gnunet-ecc.c:318
2039#, c-format 2077#, c-format
2040msgid "Hostkeys file `%s' is empty\n" 2078msgid "Hostkeys file `%s' is empty\n"
2041msgstr "" 2079msgstr ""
2042 2080
2043#: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 2081#: src/cli/util/gnunet-ecc.c:324
2044#: src/service/testing/testing.c:308
2045#, c-format 2082#, c-format
2046msgid "Incorrect hostkey file format: %s\n" 2083msgid "Incorrect hostkey file format: %s\n"
2047msgstr "" 2084msgstr ""
2048 2085
2049#: src/cli/util/gnunet-ecc.c:334 2086#: src/cli/util/gnunet-ecc.c:340
2050#, c-format 2087#, c-format
2051msgid "Could not read hostkey file: %s\n" 2088msgid "Could not read hostkey file: %s\n"
2052msgstr "" 2089msgstr ""
2053 2090
2054#: src/cli/util/gnunet-ecc.c:388 2091#: src/cli/util/gnunet-ecc.c:394
2055msgid "No hostkey file specified on command line\n" 2092msgid "No hostkey file specified on command line\n"
2056msgstr "" 2093msgstr ""
2057 2094
2058#: src/cli/util/gnunet-ecc.c:452 2095#: src/cli/util/gnunet-ecc.c:458
2059msgid "list keys included in a file (for testing)" 2096msgid "list keys included in a file (for testing)"
2060msgstr "" 2097msgstr ""
2061 2098
2062#: src/cli/util/gnunet-ecc.c:458 2099#: src/cli/util/gnunet-ecc.c:464
2063msgid "number of keys to list included in a file (for testing)" 2100msgid "number of keys to list included in a file (for testing)"
2064msgstr "" 2101msgstr ""
2065 2102
2066#: src/cli/util/gnunet-ecc.c:464 2103#: src/cli/util/gnunet-ecc.c:470
2067msgid "create COUNT public-private key pairs (for testing)" 2104msgid "create COUNT public-private key pairs (for testing)"
2068msgstr "" 2105msgstr ""
2069 2106
2070#: src/cli/util/gnunet-ecc.c:469 2107#: src/cli/util/gnunet-ecc.c:475
2071msgid "print the public key in ASCII format" 2108msgid "print the public key in ASCII format"
2072msgstr "" 2109msgstr ""
2073 2110
2074#: src/cli/util/gnunet-ecc.c:474 2111#: src/cli/util/gnunet-ecc.c:480
2075msgid "print the private key in ASCII format" 2112msgid "print the private key in ASCII format"
2076msgstr "" 2113msgstr ""
2077 2114
2078#: src/cli/util/gnunet-ecc.c:479 2115#: src/cli/util/gnunet-ecc.c:485
2079msgid "print the public key in HEX format" 2116msgid "print the public key in HEX format"
2080msgstr "" 2117msgstr ""
2081 2118
2082#: src/cli/util/gnunet-ecc.c:485 2119#: src/cli/util/gnunet-ecc.c:491
2083msgid "print examples of ECC operations (used for compatibility testing)" 2120msgid "print examples of ECC operations (used for compatibility testing)"
2084msgstr "" 2121msgstr ""
2085 2122
2086#: src/cli/util/gnunet-ecc.c:499 2123#: src/cli/util/gnunet-ecc.c:505
2087msgid "Manipulate GNUnet private ECC key files" 2124msgid "Manipulate GNUnet private ECC key files"
2088msgstr "" 2125msgstr ""
2089 2126
@@ -3146,13 +3183,13 @@ msgstr ""
3146msgid "Invalid handle type while writing `%s'" 3183msgid "Invalid handle type while writing `%s'"
3147msgstr "" 3184msgstr ""
3148 3185
3149#: src/lib/util/client.c:531 src/lib/util/service.c:1134 3186#: src/lib/util/client.c:531 src/lib/util/service.c:1139
3150#: src/service/arm/gnunet-service-arm.c:452 3187#: src/service/arm/gnunet-service-arm.c:452
3151#, c-format 3188#, c-format
3152msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 3189msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
3153msgstr "" 3190msgstr ""
3154 3191
3155#: src/lib/util/client.c:536 src/lib/util/service.c:1138 3192#: src/lib/util/client.c:536 src/lib/util/service.c:1143
3156#: src/service/arm/gnunet-service-arm.c:456 3193#: src/service/arm/gnunet-service-arm.c:456
3157#, c-format 3194#, c-format
3158msgid "Using `%s' instead\n" 3195msgid "Using `%s' instead\n"
@@ -3280,17 +3317,17 @@ msgstr ""
3280msgid "`%s' failed at %s:%d with error: %s\n" 3317msgid "`%s' failed at %s:%d with error: %s\n"
3281msgstr "" 3318msgstr ""
3282 3319
3283#: src/lib/util/crypto_ecc.c:554 3320#: src/lib/util/crypto_ecc.c:569
3284#, c-format 3321#, c-format
3285msgid "ECC signing failed at %s:%d: %s\n" 3322msgid "ECC signing failed at %s:%d: %s\n"
3286msgstr "" 3323msgstr ""
3287 3324
3288#: src/lib/util/crypto_ecc.c:677 3325#: src/lib/util/crypto_ecc.c:692
3289#, c-format 3326#, c-format
3290msgid "ECDSA signature verification failed at %s:%d: %s\n" 3327msgid "ECDSA signature verification failed at %s:%d: %s\n"
3291msgstr "" 3328msgstr ""
3292 3329
3293#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:304 3330#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:305
3294msgid "Could not load peer's private key\n" 3331msgid "Could not load peer's private key\n"
3295msgstr "" 3332msgstr ""
3296 3333
@@ -3314,7 +3351,7 @@ msgstr ""
3314msgid "Expected `%s' to be a directory!\n" 3351msgid "Expected `%s' to be a directory!\n"
3315msgstr "" 3352msgstr ""
3316 3353
3317#: src/lib/util/disk.c:1222 src/lib/util/service.c:1642 3354#: src/lib/util/disk.c:1222 src/lib/util/service.c:1651
3318#, c-format 3355#, c-format
3319msgid "Cannot obtain information about user `%s': %s\n" 3356msgid "Cannot obtain information about user `%s': %s\n"
3320msgstr "" 3357msgstr ""
@@ -3504,95 +3541,95 @@ msgstr ""
3504msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 3541msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
3505msgstr "" 3542msgstr ""
3506 3543
3507#: src/lib/util/gnunet_error_codes.c:60 3544#: src/lib/util/gnunet_error_codes.c:59
3508msgid "No error (success)." 3545msgid "No error (success)."
3509msgstr "" 3546msgstr ""
3510 3547
3511#: src/lib/util/gnunet_error_codes.c:66 3548#: src/lib/util/gnunet_error_codes.c:65
3512#, fuzzy 3549#, fuzzy
3513msgid "Unknown and unspecified error." 3550msgid "Unknown and unspecified error."
3514msgstr "Comando `%s' sconosciuto.\n" 3551msgstr "Comando `%s' sconosciuto.\n"
3515 3552
3516#: src/lib/util/gnunet_error_codes.c:72 3553#: src/lib/util/gnunet_error_codes.c:71
3517msgid "Communication with service failed." 3554msgid "Communication with service failed."
3518msgstr "" 3555msgstr ""
3519 3556
3520#: src/lib/util/gnunet_error_codes.c:78 3557#: src/lib/util/gnunet_error_codes.c:77
3521#, fuzzy 3558#, fuzzy
3522msgid "Ego not found." 3559msgid "Ego not found."
3523msgstr "Contenuto non trovato" 3560msgstr "Contenuto non trovato"
3524 3561
3525#: src/lib/util/gnunet_error_codes.c:84 3562#: src/lib/util/gnunet_error_codes.c:83
3526msgid "Identifier already in use for another ego." 3563msgid "Identifier already in use for another ego."
3527msgstr "" 3564msgstr ""
3528 3565
3529#: src/lib/util/gnunet_error_codes.c:90 3566#: src/lib/util/gnunet_error_codes.c:89
3530msgid "The given ego is invalid or malformed." 3567msgid "The given ego is invalid or malformed."
3531msgstr "" 3568msgstr ""
3532 3569
3533#: src/lib/util/gnunet_error_codes.c:96 3570#: src/lib/util/gnunet_error_codes.c:95
3534#, fuzzy 3571#, fuzzy
3535msgid "Unknown namestore error." 3572msgid "Unknown namestore error."
3536msgstr "Comando `%s' sconosciuto.\n" 3573msgstr "Comando `%s' sconosciuto.\n"
3537 3574
3538#: src/lib/util/gnunet_error_codes.c:102 src/lib/util/gnunet_error_codes.c:120 3575#: src/lib/util/gnunet_error_codes.c:101 src/lib/util/gnunet_error_codes.c:119
3539#, fuzzy 3576#, fuzzy
3540msgid "Zone iteration failed." 3577msgid "Zone iteration failed."
3541msgstr "# connessioni attive" 3578msgstr "# connessioni attive"
3542 3579
3543#: src/lib/util/gnunet_error_codes.c:108 3580#: src/lib/util/gnunet_error_codes.c:107
3544#, fuzzy 3581#, fuzzy
3545msgid "Zone not found." 3582msgid "Zone not found."
3546msgstr "Contenuto non trovato" 3583msgstr "Contenuto non trovato"
3547 3584
3548#: src/lib/util/gnunet_error_codes.c:114 3585#: src/lib/util/gnunet_error_codes.c:113
3549#, fuzzy 3586#, fuzzy
3550msgid "Record not found." 3587msgid "Record not found."
3551msgstr "upnpc non trovato\n" 3588msgstr "upnpc non trovato\n"
3552 3589
3553#: src/lib/util/gnunet_error_codes.c:126 3590#: src/lib/util/gnunet_error_codes.c:125
3554msgid "Zone does not contain any records." 3591msgid "Zone does not contain any records."
3555msgstr "" 3592msgstr ""
3556 3593
3557#: src/lib/util/gnunet_error_codes.c:132 3594#: src/lib/util/gnunet_error_codes.c:131
3558#, fuzzy 3595#, fuzzy
3559msgid "Failed to lookup record." 3596msgid "Failed to lookup record."
3560msgstr "Impossibile avviare il servizio.\n" 3597msgstr "Impossibile avviare il servizio.\n"
3561 3598
3562#: src/lib/util/gnunet_error_codes.c:138 3599#: src/lib/util/gnunet_error_codes.c:137
3563msgid "No records given." 3600msgid "No records given."
3564msgstr "" 3601msgstr ""
3565 3602
3566#: src/lib/util/gnunet_error_codes.c:144 3603#: src/lib/util/gnunet_error_codes.c:143
3567msgid "Record data invalid." 3604msgid "Record data invalid."
3568msgstr "" 3605msgstr ""
3569 3606
3570#: src/lib/util/gnunet_error_codes.c:150 3607#: src/lib/util/gnunet_error_codes.c:149
3571msgid "No label given." 3608msgid "No label given."
3572msgstr "" 3609msgstr ""
3573 3610
3574#: src/lib/util/gnunet_error_codes.c:156 3611#: src/lib/util/gnunet_error_codes.c:155
3575msgid "No results given." 3612msgid "No results given."
3576msgstr "" 3613msgstr ""
3577 3614
3578#: src/lib/util/gnunet_error_codes.c:162 3615#: src/lib/util/gnunet_error_codes.c:161
3579msgid "Record already exists." 3616msgid "Record already exists."
3580msgstr "" 3617msgstr ""
3581 3618
3582#: src/lib/util/gnunet_error_codes.c:168 3619#: src/lib/util/gnunet_error_codes.c:167
3583msgid "Record size exceeds maximum limit." 3620msgid "Record size exceeds maximum limit."
3584msgstr "" 3621msgstr ""
3585 3622
3586#: src/lib/util/gnunet_error_codes.c:174 3623#: src/lib/util/gnunet_error_codes.c:173
3587msgid "There was an error in the database backend." 3624msgid "There was an error in the database backend."
3588msgstr "" 3625msgstr ""
3589 3626
3590#: src/lib/util/gnunet_error_codes.c:180 3627#: src/lib/util/gnunet_error_codes.c:179
3591#, fuzzy 3628#, fuzzy
3592msgid "Failed to store the given records." 3629msgid "Failed to store the given records."
3593msgstr "Impossibile avviare il servizio.\n" 3630msgstr "Impossibile avviare il servizio.\n"
3594 3631
3595#: src/lib/util/gnunet_error_codes.c:186 3632#: src/lib/util/gnunet_error_codes.c:185
3596msgid "Label invalid or malformed." 3633msgid "Label invalid or malformed."
3597msgstr "" 3634msgstr ""
3598 3635
@@ -3658,16 +3695,6 @@ msgstr ""
3658msgid "Could not determine plugin installation path.\n" 3695msgid "Could not determine plugin installation path.\n"
3659msgstr "" 3696msgstr ""
3660 3697
3661#: src/lib/util/program.c:287
3662#, fuzzy, c-format
3663msgid "Unreadable configuration file `%s', exiting ...\n"
3664msgstr "Impossibile avviare il servizio ' %s'\n"
3665
3666#: src/lib/util/program.c:299
3667#, fuzzy, c-format
3668msgid "Malformed configuration file `%s', exiting ...\n"
3669msgstr "Impossibile avviare il servizio ' %s'\n"
3670
3671#: src/lib/util/program.c:314 3698#: src/lib/util/program.c:314
3672#, fuzzy, c-format 3699#, fuzzy, c-format
3673msgid "Unreadable configuration file `%s'. Exiting ...\n" 3700msgid "Unreadable configuration file `%s'. Exiting ...\n"
@@ -3716,120 +3743,120 @@ msgstr ""
3716msgid "Could not resolve our FQDN: %s\n" 3743msgid "Could not resolve our FQDN: %s\n"
3717msgstr "" 3744msgstr ""
3718 3745
3719#: src/lib/util/service.c:654 3746#: src/lib/util/service.c:650
3720#, c-format 3747#, c-format
3721msgid "" 3748msgid ""
3722"Processing code for message of type %u did not call " 3749"Processing code for message of type %u did not call "
3723"`GNUNET_SERVICE_client_continue' after %s\n" 3750"`GNUNET_SERVICE_client_continue' after %s\n"
3724msgstr "" 3751msgstr ""
3725 3752
3726#: src/lib/util/service.c:838 3753#: src/lib/util/service.c:841
3727#, c-format 3754#, c-format
3728msgid "Unknown address family %d\n" 3755msgid "Unknown address family %d\n"
3729msgstr "" 3756msgstr ""
3730 3757
3731#: src/lib/util/service.c:951 3758#: src/lib/util/service.c:956
3732#, c-format 3759#, c-format
3733msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 3760msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
3734msgstr "" 3761msgstr ""
3735 3762
3736#: src/lib/util/service.c:992 3763#: src/lib/util/service.c:997
3737#, c-format 3764#, c-format
3738msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 3765msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
3739msgstr "" 3766msgstr ""
3740 3767
3741#: src/lib/util/service.c:1095 src/lib/util/service.c:1101 3768#: src/lib/util/service.c:1100 src/lib/util/service.c:1106
3742#: src/service/arm/gnunet-service-arm.c:412 3769#: src/service/arm/gnunet-service-arm.c:412
3743#: src/service/arm/gnunet-service-arm.c:418 3770#: src/service/arm/gnunet-service-arm.c:418
3744#, c-format 3771#, c-format
3745msgid "Require valid port number for service `%s' in configuration!\n" 3772msgid "Require valid port number for service `%s' in configuration!\n"
3746msgstr "" 3773msgstr ""
3747 3774
3748#: src/lib/util/service.c:1158 src/service/arm/gnunet-service-arm.c:484 3775#: src/lib/util/service.c:1163 src/service/arm/gnunet-service-arm.c:484
3749#, c-format 3776#, c-format
3750msgid "" 3777msgid ""
3751"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 3778"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
3752"domain socket: %s\n" 3779"domain socket: %s\n"
3753msgstr "" 3780msgstr ""
3754 3781
3755#: src/lib/util/service.c:1176 src/service/arm/gnunet-service-arm.c:505 3782#: src/lib/util/service.c:1181 src/service/arm/gnunet-service-arm.c:505
3756#, c-format 3783#, c-format
3757msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 3784msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
3758msgstr "" 3785msgstr ""
3759 3786
3760#: src/lib/util/service.c:1207 src/service/arm/gnunet-service-arm.c:536 3787#: src/lib/util/service.c:1212 src/service/arm/gnunet-service-arm.c:536
3761#, c-format 3788#, c-format
3762msgid "Failed to resolve `%s': %s\n" 3789msgid "Failed to resolve `%s': %s\n"
3763msgstr "" 3790msgstr ""
3764 3791
3765#: src/lib/util/service.c:1226 src/service/arm/gnunet-service-arm.c:555 3792#: src/lib/util/service.c:1231 src/service/arm/gnunet-service-arm.c:555
3766#, c-format 3793#, c-format
3767msgid "Failed to find %saddress for `%s'.\n" 3794msgid "Failed to find %saddress for `%s'.\n"
3768msgstr "" 3795msgstr ""
3769 3796
3770#: src/lib/util/service.c:1401 3797#: src/lib/util/service.c:1406
3771#, c-format 3798#, c-format
3772msgid "`%s' failed for port %d (%s).\n" 3799msgid "`%s' failed for port %d (%s).\n"
3773msgstr "" 3800msgstr ""
3774 3801
3775#: src/lib/util/service.c:1413 3802#: src/lib/util/service.c:1418
3776#, c-format 3803#, c-format
3777msgid "`%s' failed for port %d (%s): address already in use\n" 3804msgid "`%s' failed for port %d (%s): address already in use\n"
3778msgstr "" 3805msgstr ""
3779 3806
3780#: src/lib/util/service.c:1420 3807#: src/lib/util/service.c:1425
3781#, c-format 3808#, c-format
3782msgid "`%s' failed for `%s': address already in use\n" 3809msgid "`%s' failed for `%s': address already in use\n"
3783msgstr "" 3810msgstr ""
3784 3811
3785#: src/lib/util/service.c:1481 3812#: src/lib/util/service.c:1486
3786#, c-format 3813#, c-format
3787msgid "Specified value for `%s' of service `%s' is invalid\n" 3814msgid "Specified value for `%s' of service `%s' is invalid\n"
3788msgstr "" 3815msgstr ""
3789 3816
3790#: src/lib/util/service.c:1505 3817#: src/lib/util/service.c:1510
3791#, c-format 3818#, c-format
3792msgid "Could not access pre-bound socket %u, will try to bind myself\n" 3819msgid "Could not access pre-bound socket %u, will try to bind myself\n"
3793msgstr "" 3820msgstr ""
3794 3821
3795#: src/lib/util/service.c:1573 3822#: src/lib/util/service.c:1583
3796msgid "" 3823msgid ""
3797"Could not bind to any of the ports I was supposed to, refusing to run!\n" 3824"Could not bind to any of the ports I was supposed to, refusing to run!\n"
3798msgstr "" 3825msgstr ""
3799 3826
3800#: src/lib/util/service.c:1644 3827#: src/lib/util/service.c:1653
3801msgid "No such user" 3828msgid "No such user"
3802msgstr "" 3829msgstr ""
3803 3830
3804#: src/lib/util/service.c:1658 3831#: src/lib/util/service.c:1668
3805#, c-format 3832#, c-format
3806msgid "Cannot change user/group to `%s': %s\n" 3833msgid "Cannot change user/group to `%s': %s\n"
3807msgstr "" 3834msgstr ""
3808 3835
3809#: src/lib/util/service.c:1751 3836#: src/lib/util/service.c:1767
3810msgid "Service process failed to initialize\n" 3837msgid "Service process failed to initialize\n"
3811msgstr "" 3838msgstr ""
3812 3839
3813#: src/lib/util/service.c:1756 3840#: src/lib/util/service.c:1772
3814msgid "Service process could not initialize server function\n" 3841msgid "Service process could not initialize server function\n"
3815msgstr "" 3842msgstr ""
3816 3843
3817#: src/lib/util/service.c:1761 3844#: src/lib/util/service.c:1777
3818msgid "Service process failed to report status\n" 3845msgid "Service process failed to report status\n"
3819msgstr "" 3846msgstr ""
3820 3847
3821#: src/lib/util/service.c:1960 src/lib/util/service.c:2255 3848#: src/lib/util/service.c:1990 src/lib/util/service.c:2304
3822msgid "do daemonize (detach from terminal)" 3849msgid "do daemonize (detach from terminal)"
3823msgstr "" 3850msgstr ""
3824 3851
3825#: src/lib/util/service.c:2036 src/lib/util/service.c:2048 3852#: src/lib/util/service.c:2065 src/lib/util/service.c:2080
3826#: src/lib/util/service.c:2298 src/lib/util/service.c:2310 3853#: src/lib/util/service.c:2353 src/lib/util/service.c:2368
3827#: src/service/transport/transport-testing-communicator.c:1055 3854#: src/service/transport/transport-testing-communicator.c:1059
3828#, c-format 3855#, c-format
3829msgid "Malformed configuration file `%s', exit ...\n" 3856msgid "Malformed configuration file `%s', exit ...\n"
3830msgstr "" 3857msgstr ""
3831 3858
3832#: src/lib/util/service.c:2058 src/lib/util/service.c:2321 3859#: src/lib/util/service.c:2092 src/lib/util/service.c:2381
3833msgid "Malformed configuration, exit ...\n" 3860msgid "Malformed configuration, exit ...\n"
3834msgstr "" 3861msgstr ""
3835 3862
@@ -4282,6 +4309,11 @@ msgstr ""
4282msgid "Initiating shutdown as requested by client.\n" 4309msgid "Initiating shutdown as requested by client.\n"
4283msgstr "" 4310msgstr ""
4284 4311
4312#: src/service/arm/testing_arm_cmd_start_peer.c:197
4313#, c-format
4314msgid "Failed to start `%s': %s\n"
4315msgstr ""
4316
4285#: src/service/core/gnunet-service-core.c:329 4317#: src/service/core/gnunet-service-core.c:329
4286msgid "# send requests dropped (disconnected)" 4318msgid "# send requests dropped (disconnected)"
4287msgstr "" 4319msgstr ""
@@ -4447,8 +4479,8 @@ msgstr ""
4447#: src/service/core/gnunet-service-core_sessions.c:337 4479#: src/service/core/gnunet-service-core_sessions.c:337
4448#: src/service/fs/gnunet-service-fs_cp.c:484 4480#: src/service/fs/gnunet-service-fs_cp.c:484
4449#: src/service/fs/gnunet-service-fs_cp.c:1377 4481#: src/service/fs/gnunet-service-fs_cp.c:1377
4450#: src/service/topology/gnunet-daemon-topology.c:551 4482#: src/service/topology/gnunet-daemon-topology.c:545
4451#: src/service/topology/gnunet-daemon-topology.c:633 4483#: src/service/topology/gnunet-daemon-topology.c:627
4452msgid "# peers connected" 4484msgid "# peers connected"
4453msgstr "# nodi connessi" 4485msgstr "# nodi connessi"
4454 4486
@@ -4570,7 +4602,7 @@ msgstr ""
4570#: src/service/datastore/gnunet-service-datastore.c:626 4602#: src/service/datastore/gnunet-service-datastore.c:626
4571#: src/service/datastore/gnunet-service-datastore.c:677 4603#: src/service/datastore/gnunet-service-datastore.c:677
4572#: src/service/datastore/gnunet-service-datastore.c:820 4604#: src/service/datastore/gnunet-service-datastore.c:820
4573#: src/service/datastore/gnunet-service-datastore.c:1428 4605#: src/service/datastore/gnunet-service-datastore.c:1431
4574msgid "# reserved" 4606msgid "# reserved"
4575msgstr "" 4607msgstr ""
4576 4608
@@ -4620,65 +4652,65 @@ msgstr ""
4620msgid "# REMOVE requests received" 4652msgid "# REMOVE requests received"
4621msgstr "" 4653msgstr ""
4622 4654
4623#: src/service/datastore/gnunet-service-datastore.c:1107 4655#: src/service/datastore/gnunet-service-datastore.c:1109
4624#, c-format 4656#, c-format
4625msgid "" 4657msgid ""
4626"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n" 4658"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n"
4627msgstr "" 4659msgstr ""
4628 4660
4629#: src/service/datastore/gnunet-service-datastore.c:1112 4661#: src/service/datastore/gnunet-service-datastore.c:1114
4630#: src/service/datastore/gnunet-service-datastore.c:1281 4662#: src/service/datastore/gnunet-service-datastore.c:1283
4631#, c-format 4663#, c-format
4632msgid "New payload: %lld\n" 4664msgid "New payload: %lld\n"
4633msgstr "" 4665msgstr ""
4634 4666
4635#: src/service/datastore/gnunet-service-datastore.c:1167 4667#: src/service/datastore/gnunet-service-datastore.c:1169
4636#, c-format 4668#, c-format
4637msgid "Loading `%s' datastore plugin\n" 4669msgid "Loading `%s' datastore plugin\n"
4638msgstr "" 4670msgstr ""
4639 4671
4640#: src/service/datastore/gnunet-service-datastore.c:1176 4672#: src/service/datastore/gnunet-service-datastore.c:1178
4641#, c-format 4673#, c-format
4642msgid "Failed to load datastore plugin for `%s'\n" 4674msgid "Failed to load datastore plugin for `%s'\n"
4643msgstr "" 4675msgstr ""
4644 4676
4645#: src/service/datastore/gnunet-service-datastore.c:1236 4677#: src/service/datastore/gnunet-service-datastore.c:1238
4646msgid "Bloomfilter construction complete.\n" 4678msgid "Bloomfilter construction complete.\n"
4647msgstr "" 4679msgstr ""
4648 4680
4649#: src/service/datastore/gnunet-service-datastore.c:1288 4681#: src/service/datastore/gnunet-service-datastore.c:1290
4650msgid "Rebuilding bloomfilter. Please be patient.\n" 4682msgid "Rebuilding bloomfilter. Please be patient.\n"
4651msgstr "" 4683msgstr ""
4652 4684
4653#: src/service/datastore/gnunet-service-datastore.c:1298 4685#: src/service/datastore/gnunet-service-datastore.c:1300
4654msgid "Plugin does not support get_keys function. Please fix!\n" 4686msgid "Plugin does not support get_keys function. Please fix!\n"
4655msgstr "" 4687msgstr ""
4656 4688
4657#: src/service/datastore/gnunet-service-datastore.c:1463 4689#: src/service/datastore/gnunet-service-datastore.c:1466
4658#, c-format 4690#, c-format
4659msgid "# bytes used in file-sharing datastore `%s'" 4691msgid "# bytes used in file-sharing datastore `%s'"
4660msgstr "" 4692msgstr ""
4661 4693
4662#: src/service/datastore/gnunet-service-datastore.c:1472 4694#: src/service/datastore/gnunet-service-datastore.c:1475
4663msgid "# quota" 4695msgid "# quota"
4664msgstr "" 4696msgstr ""
4665 4697
4666#: src/service/datastore/gnunet-service-datastore.c:1475 4698#: src/service/datastore/gnunet-service-datastore.c:1478
4667msgid "# cache size" 4699msgid "# cache size"
4668msgstr "# dimensione cache" 4700msgstr "# dimensione cache"
4669 4701
4670#: src/service/datastore/gnunet-service-datastore.c:1491 4702#: src/service/datastore/gnunet-service-datastore.c:1494
4671#, c-format 4703#, c-format
4672msgid "Could not use specified filename `%s' for bloomfilter.\n" 4704msgid "Could not use specified filename `%s' for bloomfilter.\n"
4673msgstr "" 4705msgstr ""
4674 4706
4675#: src/service/datastore/gnunet-service-datastore.c:1512 4707#: src/service/datastore/gnunet-service-datastore.c:1515
4676#: src/service/datastore/gnunet-service-datastore.c:1534 4708#: src/service/datastore/gnunet-service-datastore.c:1537
4677#, c-format 4709#, c-format
4678msgid "Failed to remove bogus bloomfilter file `%s'\n" 4710msgid "Failed to remove bogus bloomfilter file `%s'\n"
4679msgstr "" 4711msgstr ""
4680 4712
4681#: src/service/datastore/gnunet-service-datastore.c:1573 4713#: src/service/datastore/gnunet-service-datastore.c:1576
4682msgid "Failed to initialize bloomfilter.\n" 4714msgid "Failed to initialize bloomfilter.\n"
4683msgstr "" 4715msgstr ""
4684 4716
@@ -5448,7 +5480,7 @@ msgstr ""
5448 5480
5449#: src/service/fs/gnunet-service-fs.c:1271 5481#: src/service/fs/gnunet-service-fs.c:1271
5450#: src/service/hostlist/gnunet-daemon-hostlist.c:343 5482#: src/service/hostlist/gnunet-daemon-hostlist.c:343
5451#: src/service/topology/gnunet-daemon-topology.c:1066 5483#: src/service/topology/gnunet-daemon-topology.c:1062
5452#, c-format 5484#, c-format
5453msgid "Failed to connect to `%s' service.\n" 5485msgid "Failed to connect to `%s' service.\n"
5454msgstr "" 5486msgstr ""
@@ -6239,7 +6271,7 @@ msgid "# hostlist advertisements send"
6239msgstr "" 6271msgstr ""
6240 6272
6241#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 6273#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483
6242#: src/service/topology/gnunet-daemon-topology.c:786 6274#: src/service/topology/gnunet-daemon-topology.c:781
6243#, c-format 6275#, c-format
6244msgid "Error in communication with PEERSTORE service: %s\n" 6276msgid "Error in communication with PEERSTORE service: %s\n"
6245msgstr "" 6277msgstr ""
@@ -6496,11 +6528,11 @@ msgstr ""
6496msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" 6528msgid "Malformed punched hole specification `%s' (IPv6 address invalid)"
6497msgstr "" 6529msgstr ""
6498 6530
6499#: src/service/nat/gnunet-service-nat.c:1861 6531#: src/service/nat/gnunet-service-nat.c:1860
6500msgid "Connection reversal request failed\n" 6532msgid "Connection reversal request failed\n"
6501msgstr "" 6533msgstr ""
6502 6534
6503#: src/service/nat/gnunet-service-nat.c:1935 6535#: src/service/nat/gnunet-service-nat.c:1999
6504msgid "" 6536msgid ""
6505"UPnP enabled in configuration, but UPnP client `upnpc` command not found, " 6537"UPnP enabled in configuration, but UPnP client `upnpc` command not found, "
6506"disabling UPnP\n" 6538"disabling UPnP\n"
@@ -6524,41 +6556,41 @@ msgstr ""
6524msgid "`upnpc' command not found\n" 6556msgid "`upnpc' command not found\n"
6525msgstr "" 6557msgstr ""
6526 6558
6527#: src/service/peerstore/gnunet-service-peerstore.c:1141 6559#: src/service/peerstore/gnunet-service-peerstore.c:1150
6528#, c-format 6560#, c-format
6529msgid "Failed to parse HELLO in file `%s': %s\n" 6561msgid "Failed to parse HELLO in file `%s': %s\n"
6530msgstr "" 6562msgstr ""
6531 6563
6532#: src/service/peerstore/gnunet-service-peerstore.c:1214 6564#: src/service/peerstore/gnunet-service-peerstore.c:1223
6533#, c-format 6565#, c-format
6534msgid "Could not load database backend `%s'\n" 6566msgid "Could not load database backend `%s'\n"
6535msgstr "" 6567msgstr ""
6536 6568
6537#: src/service/peerstore/gnunet-service-peerstore.c:1233 6569#: src/service/peerstore/gnunet-service-peerstore.c:1242
6538#, c-format 6570#, c-format
6539msgid "Importing HELLOs from `%s'\n" 6571msgid "Importing HELLOs from `%s'\n"
6540msgstr "" 6572msgstr ""
6541 6573
6542#: src/service/peerstore/gnunet-service-peerstore.c:1244 6574#: src/service/peerstore/gnunet-service-peerstore.c:1253
6543msgid "Skipping import of included HELLOs\n" 6575msgid "Skipping import of included HELLOs\n"
6544msgstr "" 6576msgstr ""
6545 6577
6546#: src/service/peerstore/peerstore_api.c:574 6578#: src/service/peerstore/peerstore_api.c:579
6547msgid "Unexpected store response.\n" 6579msgid "Unexpected store response.\n"
6548msgstr "" 6580msgstr ""
6549 6581
6550#: src/service/peerstore/peerstore_api.c:606 6582#: src/service/peerstore/peerstore_api.c:620
6551msgid "Unexpected iteration response.\n" 6583msgid "Unexpected iteration response.\n"
6552msgstr "" 6584msgstr ""
6553 6585
6554#: src/service/peerstore/peerstore_api.c:652 6586#: src/service/peerstore/peerstore_api.c:666
6555msgid "" 6587msgid ""
6556"Unexpected iteration response, no iterating client found, discarding " 6588"Unexpected iteration response, no iterating client found, discarding "
6557"message.\n" 6589"message.\n"
6558msgstr "" 6590msgstr ""
6559 6591
6560#: src/service/peerstore/peerstore_api.c:662 6592#: src/service/peerstore/peerstore_api.c:676
6561#: src/service/peerstore/peerstore_api_monitor.c:164 6593#: src/service/peerstore/peerstore_api_monitor.c:163
6562msgid "Received a malformed response from service." 6594msgid "Received a malformed response from service."
6563msgstr "" 6595msgstr ""
6564 6596
@@ -6717,11 +6749,11 @@ msgstr ""
6717msgid "Namestore REST API initialized\n" 6749msgid "Namestore REST API initialized\n"
6718msgstr "" 6750msgstr ""
6719 6751
6720#: src/service/rest/openid_plugin.c:3102 6752#: src/service/rest/openid_plugin.c:3121
6721msgid "OpenID Connect REST API initialized\n" 6753msgid "OpenID Connect REST API initialized\n"
6722msgstr "" 6754msgstr ""
6723 6755
6724#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1523 6756#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1494
6725msgid "Identity Provider REST API initialized\n" 6757msgid "Identity Provider REST API initialized\n"
6726msgstr "" 6758msgstr ""
6727 6759
@@ -6769,148 +6801,50 @@ msgstr ""
6769msgid "Could not save some persistent statistics\n" 6801msgid "Could not save some persistent statistics\n"
6770msgstr "" 6802msgstr ""
6771 6803
6772#: src/service/testing/gnunet-testing.c:185 6804#: src/service/testbed/gnunet-testbed.c:196
6773#, c-format 6805msgid "number of unique configuration files to create"
6774msgid "Could not extract hostkey %u (offset too large?)\n"
6775msgstr "" 6806msgstr ""
6776 6807
6777#: src/service/testing/gnunet-testing.c:275 6808#: src/service/testbed/gnunet-testbed.c:202
6778#, c-format
6779msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
6780msgstr ""
6781
6782#: src/service/testing/gnunet-testing.c:386
6783msgid "create unique configuration files"
6784msgstr ""
6785
6786#: src/service/testing/gnunet-testing.c:392
6787msgid "extract hostkey file from pre-computed hostkey list"
6788msgstr ""
6789
6790#: src/service/testing/gnunet-testing.c:400
6791msgid ""
6792"number of unique configuration files to create, or number of the hostkey to "
6793"extract"
6794msgstr ""
6795
6796#: src/service/testing/gnunet-testing.c:407
6797msgid "configuration template" 6809msgid "configuration template"
6798msgstr "" 6810msgstr ""
6799 6811
6800#: src/service/testing/gnunet-testing.c:415 6812#: src/service/testbed/gnunet-testbed.c:218
6801msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"
6802msgstr ""
6803
6804#: src/service/testing/gnunet-testing.c:432
6805msgid "Command line tool to access the testing library" 6813msgid "Command line tool to access the testing library"
6806msgstr "" 6814msgstr ""
6807 6815
6808#: src/service/testing/list-keys.c:92
6809msgid "list COUNT number of keys"
6810msgstr ""
6811
6812#: src/service/testing/testing.c:291
6813#, c-format
6814msgid "Hostkeys file not found: %s\n"
6815msgstr ""
6816
6817#: src/service/testing/testing.c:743
6818#, c-format
6819msgid "Key number %u does not exist\n"
6820msgstr ""
6821
6822#: src/service/testing/testing.c:1217
6823#, c-format
6824msgid ""
6825"You attempted to create a testbed with more than %u hosts. Please "
6826"precompute more hostkeys first.\n"
6827msgstr ""
6828
6829#: src/service/testing/testing.c:1226
6830#, c-format
6831msgid "Failed to initialize hostkey for peer %u\n"
6832msgstr ""
6833
6834#: src/service/testing/testing.c:1236
6835msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
6836msgstr ""
6837
6838#: src/service/testing/testing.c:1249
6839msgid "Failed to create configuration for peer (not enough free ports?)\n"
6840msgstr ""
6841
6842#: src/service/testing/testing.c:1265
6843#, c-format
6844msgid "Cannot open hostkey file `%s': %s\n"
6845msgstr ""
6846
6847#: src/service/testing/testing.c:1279
6848#, c-format
6849msgid "Failed to write hostkey file for peer %u: %s\n"
6850msgstr ""
6851
6852#: src/service/testing/testing.c:1307
6853#, c-format
6854msgid "Failed to write configuration file `%s' for peer %u: %s\n"
6855msgstr ""
6856
6857#: src/service/testing/testing.c:1413
6858#, c-format
6859msgid "Failed to start `%s': %s\n"
6860msgstr ""
6861
6862#: src/service/testing/testing.c:1664
6863#, c-format
6864msgid "Failed to load configuration from %s\n"
6865msgstr ""
6866
6867#: src/service/testing/testing.c:2795
6868#, c-format
6869msgid "Topology file %s not found\n"
6870msgstr ""
6871
6872#: src/service/testing/testing.c:2803
6873#, c-format
6874msgid "Topology file %s has no data\n"
6875msgstr ""
6876
6877#: src/service/testing/testing.c:2811
6878#, c-format
6879msgid "Topology file %s cannot be read\n"
6880msgstr ""
6881
6882#: src/service/topology/gnunet-daemon-topology.c:286 6816#: src/service/topology/gnunet-daemon-topology.c:286
6883msgid "# connect requests issued to ATS" 6817msgid "# connect requests issued to ATS"
6884msgstr "" 6818msgstr ""
6885 6819
6886#: src/service/topology/gnunet-daemon-topology.c:480 6820#: src/service/topology/gnunet-daemon-topology.c:475
6887msgid "# HELLO messages gossipped" 6821msgid "# HELLO messages gossipped"
6888msgstr "" 6822msgstr ""
6889 6823
6890#: src/service/topology/gnunet-daemon-topology.c:752 6824#: src/service/topology/gnunet-daemon-topology.c:747
6891msgid "Error in communication with PEERSTORE service to monitor.\n" 6825msgid "Error in communication with PEERSTORE service to monitor.\n"
6892msgstr "" 6826msgstr ""
6893 6827
6894#: src/service/topology/gnunet-daemon-topology.c:761 6828#: src/service/topology/gnunet-daemon-topology.c:756
6895msgid "Finished initial PEERSTORE iteration in monitor.\n" 6829msgid "Finished initial PEERSTORE iteration in monitor.\n"
6896msgstr "" 6830msgstr ""
6897 6831
6898#: src/service/topology/gnunet-daemon-topology.c:869 6832#: src/service/topology/gnunet-daemon-topology.c:864
6899msgid "Failed to connect to core service, can not manage topology!\n" 6833msgid "Failed to connect to core service, can not manage topology!\n"
6900msgstr "" 6834msgstr ""
6901 6835
6902#: src/service/topology/gnunet-daemon-topology.c:943 6836#: src/service/topology/gnunet-daemon-topology.c:938
6903msgid "# HELLO messages received" 6837msgid "# HELLO messages received"
6904msgstr "" 6838msgstr ""
6905 6839
6906#: src/service/topology/gnunet-daemon-topology.c:1095 6840#: src/service/topology/gnunet-daemon-topology.c:1091
6907msgid "GNUnet topology control" 6841msgid "GNUnet topology control"
6908msgstr "" 6842msgstr ""
6909 6843
6910#: src/service/transport/gnunet-communicator-quic.c:1717 6844#: src/service/transport/gnunet-communicator-quic.c:1717
6911#: src/service/transport/gnunet-communicator-tcp.c:3777 6845#: src/service/transport/gnunet-communicator-tcp.c:3814
6912#: src/service/transport/gnunet-communicator-udp.c:3408 6846#: src/service/transport/gnunet-communicator-udp.c:3579
6913#: src/service/transport/gnunet-service-transport.c:12128 6847#: src/service/transport/gnunet-service-transport.c:12543
6914msgid "Transport service is lacking key configuration settings. Exiting.\n" 6848msgid "Transport service is lacking key configuration settings. Exiting.\n"
6915msgstr "" 6849msgstr ""
6916 6850
@@ -6918,11 +6852,11 @@ msgstr ""
6918msgid "GNUnet QUIC communicator" 6852msgid "GNUnet QUIC communicator"
6919msgstr "" 6853msgstr ""
6920 6854
6921#: src/service/transport/gnunet-communicator-tcp.c:4114 6855#: src/service/transport/gnunet-communicator-tcp.c:4171
6922msgid "GNUnet TCP communicator" 6856msgid "GNUnet TCP communicator"
6923msgstr "" 6857msgstr ""
6924 6858
6925#: src/service/transport/gnunet-communicator-udp.c:3483 6859#: src/service/transport/gnunet-communicator-udp.c:3654
6926msgid "GNUnet UDP communicator" 6860msgid "GNUnet UDP communicator"
6927msgstr "" 6861msgstr ""
6928 6862
@@ -7094,7 +7028,7 @@ msgstr ""
7094msgid "Direct access to transport service." 7028msgid "Direct access to transport service."
7095msgstr "" 7029msgstr ""
7096 7030
7097#: src/service/transport/transport_api2_communication.c:765 7031#: src/service/transport/transport_api2_communication.c:773
7098msgid "Dropped backchanel message: handler not provided by communicator\n" 7032msgid "Dropped backchanel message: handler not provided by communicator\n"
7099msgstr "" 7033msgstr ""
7100 7034
diff --git a/po/sr.po b/po/sr.po
index 1f6708847..9b4e07ef6 100644
--- a/po/sr.po
+++ b/po/sr.po
@@ -6,7 +6,7 @@ msgid ""
6msgstr "" 6msgstr ""
7"Project-Id-Version: gnunet-0.10.1\n" 7"Project-Id-Version: gnunet-0.10.1\n"
8"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 8"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
9"POT-Creation-Date: 2024-03-02 14:38+0100\n" 9"POT-Creation-Date: 2024-05-20 20:21+0200\n"
10"PO-Revision-Date: 2020-10-23 18:39+0200\n" 10"PO-Revision-Date: 2020-10-23 18:39+0200\n"
11"Last-Translator: МироÑлав Ðиколић <miroslavnikolic@rocketmail.com>\n" 11"Last-Translator: МироÑлав Ðиколић <miroslavnikolic@rocketmail.com>\n"
12"Language-Team: Serbian <(nothing)>\n" 12"Language-Team: Serbian <(nothing)>\n"
@@ -349,21 +349,26 @@ msgstr "ÐиÑам уÑпео да обрадим идентитет парњаÐ
349msgid "Failed to connect to CORE service!\n" 349msgid "Failed to connect to CORE service!\n"
350msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ЈЕЗГРЕÐОМ уÑлугом!\n" 350msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ЈЕЗГРЕÐОМ уÑлугом!\n"
351 351
352#: src/cli/core/gnunet-core.c:230 src/service/transport/gnunet-transport.c:1389 352#: src/cli/core/gnunet-core.c:213
353#, fuzzy
354msgid "No argument given.\n"
355msgstr "ÐиÑу дате опције\n"
356
357#: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389
353msgid "provide information about all current connections (continuously)" 358msgid "provide information about all current connections (continuously)"
354msgstr "обезбеђује податке о Ñвим тренутним везама (непрекидно)" 359msgstr "обезбеђује податке о Ñвим тренутним везама (непрекидно)"
355 360
356#: src/cli/core/gnunet-core.c:236 361#: src/cli/core/gnunet-core.c:244
357#, fuzzy 362#, fuzzy
358msgid "Show our current peer identity" 363msgid "Show our current peer identity"
359msgstr "идентитет парњака" 364msgstr "идентитет парњака"
360 365
361#: src/cli/core/gnunet-core.c:243 366#: src/cli/core/gnunet-core.c:251
362#, fuzzy 367#, fuzzy
363msgid "Show current connections" 368msgid "Show current connections"
364msgstr "# активних веза" 369msgstr "# активних веза"
365 370
366#: src/cli/core/gnunet-core.c:254 371#: src/cli/core/gnunet-core.c:262
367msgid "Print information about connected peers." 372msgid "Print information about connected peers."
368msgstr "ИÑпиÑује податке о повезаним парњацима." 373msgstr "ИÑпиÑује податке о повезаним парњацима."
369 374
@@ -1093,53 +1098,53 @@ msgstr ""
1093"Поништава индекÑирање датотеке која је претходно била индекÑирана Ñа „gnunet-" 1098"Поништава индекÑирање датотеке која је претходно била индекÑирана Ñа „gnunet-"
1094"publish“." 1099"publish“."
1095 1100
1096#: src/cli/gns/gnunet-gns.c:268 1101#: src/cli/gns/gnunet-gns.c:269
1097#, fuzzy, c-format 1102#, fuzzy, c-format
1098msgid "`%s' is not a valid DNS domain name\n" 1103msgid "`%s' is not a valid DNS domain name\n"
1099msgstr "„%s“ није иÑправна ИП адреÑа.\n" 1104msgstr "„%s“ није иÑправна ИП адреÑа.\n"
1100 1105
1101#: src/cli/gns/gnunet-gns.c:279 src/lib/util/dnsparser.c:273 1106#: src/cli/gns/gnunet-gns.c:280 src/lib/util/dnsparser.c:273
1102#, c-format 1107#, c-format
1103msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" 1108msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
1104msgstr "ÐиÑам уÑпео да претворим ДÐС ИДÐР„%s“ у УТФ-8: %s\n" 1109msgstr "ÐиÑам уÑпео да претворим ДÐС ИДÐР„%s“ у УТФ-8: %s\n"
1105 1110
1106#: src/cli/gns/gnunet-gns.c:294 1111#: src/cli/gns/gnunet-gns.c:295
1107msgid "Cannot resolve using GNS: GNUnet peer not running\n" 1112msgid "Cannot resolve using GNS: GNUnet peer not running\n"
1108msgstr "" 1113msgstr ""
1109 1114
1110#: src/cli/gns/gnunet-gns.c:305 1115#: src/cli/gns/gnunet-gns.c:306
1111#: src/contrib/service/abd/gnunet-service-abd.c:1745 1116#: src/contrib/service/abd/gnunet-service-abd.c:1745
1112#, c-format 1117#, c-format
1113msgid "Failed to connect to GNS\n" 1118msgid "Failed to connect to GNS\n"
1114msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ГÐС-ом\n" 1119msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ГÐС-ом\n"
1115 1120
1116#: src/cli/gns/gnunet-gns.c:318 1121#: src/cli/gns/gnunet-gns.c:325
1117#, c-format 1122#, c-format
1118msgid "Invalid typename specified, assuming `ANY'\n" 1123msgid "Invalid typename specified, assuming `ANY'\n"
1119msgstr "" 1124msgstr ""
1120 1125
1121#: src/cli/gns/gnunet-gns.c:358 1126#: src/cli/gns/gnunet-gns.c:365
1122msgid "Lookup a record for the given name" 1127msgid "Lookup a record for the given name"
1123msgstr "Претражује Ð·Ð°Ð¿Ð¸Ñ Ð·Ð° датим називом" 1128msgstr "Претражује Ð·Ð°Ð¿Ð¸Ñ Ð·Ð° датим називом"
1124 1129
1125#: src/cli/gns/gnunet-gns.c:364 1130#: src/cli/gns/gnunet-gns.c:371
1126msgid "Specify the type of the record to lookup" 1131msgid "Specify the type of the record to lookup"
1127msgstr "Ðаводи врÑту запиÑа за претраживање" 1132msgstr "Ðаводи врÑту запиÑа за претраживање"
1128 1133
1129#: src/cli/gns/gnunet-gns.c:370 1134#: src/cli/gns/gnunet-gns.c:377
1130#, fuzzy 1135#, fuzzy
1131msgid "Specify a timeout for the lookup" 1136msgid "Specify a timeout for the lookup"
1132msgstr "Ðаводи време иÑтека за претраживање" 1137msgstr "Ðаводи време иÑтека за претраживање"
1133 1138
1134#: src/cli/gns/gnunet-gns.c:374 1139#: src/cli/gns/gnunet-gns.c:381
1135msgid "No unneeded output" 1140msgid "No unneeded output"
1136msgstr "Ðема непотребног излаза" 1141msgstr "Ðема непотребног излаза"
1137 1142
1138#: src/cli/gns/gnunet-gns.c:379 1143#: src/cli/gns/gnunet-gns.c:386
1139msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" 1144msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
1140msgstr "" 1145msgstr ""
1141 1146
1142#: src/cli/gns/gnunet-gns.c:393 1147#: src/cli/gns/gnunet-gns.c:400
1143msgid "GNUnet GNS resolver tool" 1148msgid "GNUnet GNS resolver tool"
1144msgstr "Ðлат ГÐУнет ГÐС решавача" 1149msgstr "Ðлат ГÐУнет ГÐС решавача"
1145 1150
@@ -1668,7 +1673,11 @@ msgstr ""
1668msgid "GNUnet NAT traversal autoconfigure daemon" 1673msgid "GNUnet NAT traversal autoconfigure daemon"
1669msgstr "Демон помоћника теÑта ГÐУнет ÐÐТ попречника" 1674msgstr "Демон помоћника теÑта ГÐУнет ÐÐТ попречника"
1670 1675
1671#: src/cli/nse/gnunet-nse.c:124 1676#: src/cli/nse/gnunet-nse.c:126
1677msgid "Monitor and output current estimates"
1678msgstr ""
1679
1680#: src/cli/nse/gnunet-nse.c:137
1672msgid "Show network size estimates from NSE service." 1681msgid "Show network size estimates from NSE service."
1673msgstr "Показује процене величине мреже из ÐСЕ уÑлуге." 1682msgstr "Показује процене величине мреже из ÐСЕ уÑлуге."
1674 1683
@@ -1716,86 +1725,90 @@ msgstr ""
1716msgid "The time until the DID Document is going to expire (e.g. 5d)" 1725msgid "The time until the DID Document is going to expire (e.g. 5d)"
1717msgstr "" 1726msgstr ""
1718 1727
1719#: src/cli/reclaim/gnunet-reclaim.c:805 1728#: src/cli/reclaim/gnunet-reclaim.c:813
1720#, fuzzy, c-format 1729#, fuzzy, c-format
1721msgid "Ego is required\n" 1730msgid "Ego is required\n"
1722msgstr "Потребна је иÑправна врÑта\n" 1731msgstr "Потребна је иÑправна врÑта\n"
1723 1732
1724#: src/cli/reclaim/gnunet-reclaim.c:812 1733#: src/cli/reclaim/gnunet-reclaim.c:820
1725#, c-format 1734#, c-format
1726msgid "Attribute value missing!\n" 1735msgid "Attribute value missing!\n"
1727msgstr "" 1736msgstr ""
1728 1737
1729#: src/cli/reclaim/gnunet-reclaim.c:819 1738#: src/cli/reclaim/gnunet-reclaim.c:827
1730#, fuzzy, c-format 1739#, fuzzy, c-format
1731msgid "Requesting party key is required!\n" 1740msgid "Requesting party key is required!\n"
1732msgstr "аргумент „--section“ је потребан\n" 1741msgstr "аргумент „--section“ је потребан\n"
1733 1742
1734#: src/cli/reclaim/gnunet-reclaim.c:837 1743#: src/cli/reclaim/gnunet-reclaim.c:846
1735msgid "Add or update an attribute NAME" 1744msgid "Add or update an attribute NAME"
1736msgstr "" 1745msgstr ""
1737 1746
1738#: src/cli/reclaim/gnunet-reclaim.c:842 1747#: src/cli/reclaim/gnunet-reclaim.c:851
1739msgid "Delete the attribute with ID" 1748msgid "Delete the attribute with ID"
1740msgstr "" 1749msgstr ""
1741 1750
1742#: src/cli/reclaim/gnunet-reclaim.c:847 1751#: src/cli/reclaim/gnunet-reclaim.c:856
1743msgid "The attribute VALUE" 1752msgid "The attribute VALUE"
1744msgstr "" 1753msgstr ""
1745 1754
1746#: src/cli/reclaim/gnunet-reclaim.c:852 1755#: src/cli/reclaim/gnunet-reclaim.c:861
1747msgid "The EGO to use" 1756msgid "The EGO to use"
1748msgstr "" 1757msgstr ""
1749 1758
1750#: src/cli/reclaim/gnunet-reclaim.c:858 1759#: src/cli/reclaim/gnunet-reclaim.c:867
1751msgid "Specify the relying party for issue" 1760msgid "Specify the relying party for issue"
1752msgstr "" 1761msgstr ""
1753 1762
1754#: src/cli/reclaim/gnunet-reclaim.c:862 1763#: src/cli/reclaim/gnunet-reclaim.c:873
1764msgid "Specify the relying party URI for a ticket to consume"
1765msgstr ""
1766
1767#: src/cli/reclaim/gnunet-reclaim.c:877
1755msgid "List attributes for EGO" 1768msgid "List attributes for EGO"
1756msgstr "" 1769msgstr ""
1757 1770
1758#: src/cli/reclaim/gnunet-reclaim.c:866 1771#: src/cli/reclaim/gnunet-reclaim.c:881
1759msgid "List credentials for EGO" 1772msgid "List credentials for EGO"
1760msgstr "" 1773msgstr ""
1761 1774
1762#: src/cli/reclaim/gnunet-reclaim.c:872 1775#: src/cli/reclaim/gnunet-reclaim.c:887
1763msgid "Credential to use for attribute" 1776msgid "Credential to use for attribute"
1764msgstr "" 1777msgstr ""
1765 1778
1766#: src/cli/reclaim/gnunet-reclaim.c:877 1779#: src/cli/reclaim/gnunet-reclaim.c:892
1767msgid "Credential name" 1780msgid "Credential name"
1768msgstr "" 1781msgstr ""
1769 1782
1770#: src/cli/reclaim/gnunet-reclaim.c:883 1783#: src/cli/reclaim/gnunet-reclaim.c:898
1771msgid "Issue a ticket for a set of attributes separated by comma" 1784msgid "Issue a ticket for a set of attributes separated by comma"
1772msgstr "" 1785msgstr ""
1773 1786
1774#: src/cli/reclaim/gnunet-reclaim.c:888 1787#: src/cli/reclaim/gnunet-reclaim.c:903
1775msgid "Consume a ticket" 1788msgid "Consume a ticket"
1776msgstr "" 1789msgstr ""
1777 1790
1778#: src/cli/reclaim/gnunet-reclaim.c:893 1791#: src/cli/reclaim/gnunet-reclaim.c:908
1779msgid "Revoke a ticket" 1792msgid "Revoke a ticket"
1780msgstr "" 1793msgstr ""
1781 1794
1782#: src/cli/reclaim/gnunet-reclaim.c:898 1795#: src/cli/reclaim/gnunet-reclaim.c:913
1783msgid "Type of attribute" 1796msgid "Type of attribute"
1784msgstr "" 1797msgstr ""
1785 1798
1786#: src/cli/reclaim/gnunet-reclaim.c:903 1799#: src/cli/reclaim/gnunet-reclaim.c:918
1787msgid "Type of credential" 1800msgid "Type of credential"
1788msgstr "" 1801msgstr ""
1789 1802
1790#: src/cli/reclaim/gnunet-reclaim.c:907 1803#: src/cli/reclaim/gnunet-reclaim.c:922
1791msgid "List tickets of ego" 1804msgid "List tickets of ego"
1792msgstr "" 1805msgstr ""
1793 1806
1794#: src/cli/reclaim/gnunet-reclaim.c:913 1807#: src/cli/reclaim/gnunet-reclaim.c:928
1795msgid "Expiration interval of the attribute" 1808msgid "Expiration interval of the attribute"
1796msgstr "" 1809msgstr ""
1797 1810
1798#: src/cli/reclaim/gnunet-reclaim.c:921 1811#: src/cli/reclaim/gnunet-reclaim.c:936
1799msgid "re:claimID command line tool" 1812msgid "re:claimID command line tool"
1800msgstr "" 1813msgstr ""
1801 1814
@@ -2030,33 +2043,59 @@ msgstr "ИÑпиÑује ÑтатиÑтику о ГÐУнет радњама."
2030msgid "run decoder modus, otherwise runs as encoder" 2043msgid "run decoder modus, otherwise runs as encoder"
2031msgstr "" 2044msgstr ""
2032 2045
2033#: src/cli/util/gnunet-config.c:154 2046#: src/cli/util/gnunet-config.c:101
2034msgid "test if the current installation supports the specified BACKEND" 2047msgid "test if the current installation supports the specified BACKEND"
2035msgstr "" 2048msgstr ""
2036 2049
2037#: src/cli/util/gnunet-config.c:160 2050#: src/cli/util/gnunet-config.c:107
2038msgid "" 2051msgid ""
2039"Provide an appropriate value for CFLAGS to applications building on top of " 2052"Provide an appropriate value for CFLAGS to applications building on top of "
2040"GNUnet" 2053"GNUnet"
2041msgstr "" 2054msgstr ""
2042 2055
2043#: src/cli/util/gnunet-config.c:165 2056#: src/cli/util/gnunet-config.c:112
2044msgid "Is this an experimental build of GNUnet" 2057msgid "Is this an experimental build of GNUnet"
2045msgstr "" 2058msgstr ""
2046 2059
2047#: src/cli/util/gnunet-config.c:171 2060#: src/cli/util/gnunet-config.c:118
2048msgid "" 2061msgid ""
2049"Provide an appropriate value for LIBS to applications building on top of " 2062"Provide an appropriate value for LIBS to applications building on top of "
2050"GNUnet" 2063"GNUnet"
2051msgstr "" 2064msgstr ""
2052 2065
2053#: src/cli/util/gnunet-config.c:177 2066#: src/cli/util/gnunet-config.c:123
2067#, fuzzy
2068msgid "Do not parse default configuration files"
2069msgstr "Управља ГÐУнет датотекама подешавања"
2070
2071#: src/cli/util/gnunet-config.c:129
2054msgid "Provide the path under which GNUnet was installed" 2072msgid "Provide the path under which GNUnet was installed"
2055msgstr "" 2073msgstr ""
2056 2074
2057#: src/cli/util/gnunet-config.c:192 2075#: src/cli/util/gnunet-config.c:136
2058msgid "Manipulate GNUnet configuration files" 2076msgid ""
2059msgstr "Управља ГÐУнет датотекама подешавања" 2077"Parse main configuration from this command-line argument and not from disk"
2078msgstr ""
2079
2080#: src/cli/util/gnunet-config.c:225
2081#, fuzzy
2082msgid "Failed to load default configuration, exiting ...\n"
2083msgstr "Лоша датотека подешавања „%s“, излазим ...\n"
2084
2085#: src/cli/util/gnunet-config.c:237
2086#, fuzzy
2087msgid "Failed to parse configuration, exiting ...\n"
2088msgstr "ÐиÑам уÑпео да уклоним датотеку подешавања „%s“\n"
2089
2090#: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287
2091#, fuzzy, c-format
2092msgid "Unreadable configuration file `%s', exiting ...\n"
2093msgstr "Лоша датотека подешавања „%s“, излазим ...\n"
2094
2095#: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299
2096#, fuzzy, c-format
2097msgid "Malformed configuration file `%s', exiting ...\n"
2098msgstr "Лоша датотека подешавања „%s“, излазим ...\n"
2060 2099
2061#: src/cli/util/gnunet-crypto-tvg.c:1588 2100#: src/cli/util/gnunet-crypto-tvg.c:1588
2062msgid "verify a test vector from stdin" 2101msgid "verify a test vector from stdin"
@@ -2109,57 +2148,56 @@ msgstr ""
2109msgid "Hostkeys file `%s' not found\n" 2148msgid "Hostkeys file `%s' not found\n"
2110msgstr "ÐиÑам нашао датотеку кључа домаћина „%s“\n" 2149msgstr "ÐиÑам нашао датотеку кључа домаћина „%s“\n"
2111 2150
2112#: src/cli/util/gnunet-ecc.c:314 2151#: src/cli/util/gnunet-ecc.c:318
2113#, c-format 2152#, c-format
2114msgid "Hostkeys file `%s' is empty\n" 2153msgid "Hostkeys file `%s' is empty\n"
2115msgstr "Датотека кључа домаћина „%s“ је празна\n" 2154msgstr "Датотека кључа домаћина „%s“ је празна\n"
2116 2155
2117#: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 2156#: src/cli/util/gnunet-ecc.c:324
2118#: src/service/testing/testing.c:308
2119#, c-format 2157#, c-format
2120msgid "Incorrect hostkey file format: %s\n" 2158msgid "Incorrect hostkey file format: %s\n"
2121msgstr "Ðетачан формат датотеке кључа домаћина: %s\n" 2159msgstr "Ðетачан формат датотеке кључа домаћина: %s\n"
2122 2160
2123#: src/cli/util/gnunet-ecc.c:334 2161#: src/cli/util/gnunet-ecc.c:340
2124#, c-format 2162#, c-format
2125msgid "Could not read hostkey file: %s\n" 2163msgid "Could not read hostkey file: %s\n"
2126msgstr "Ðе могу да прочитам датотеку кључа домаћина: %s\n" 2164msgstr "Ðе могу да прочитам датотеку кључа домаћина: %s\n"
2127 2165
2128#: src/cli/util/gnunet-ecc.c:388 2166#: src/cli/util/gnunet-ecc.c:394
2129msgid "No hostkey file specified on command line\n" 2167msgid "No hostkey file specified on command line\n"
2130msgstr "Ðије наведена датотека кључа домаћина на линији наредби\n" 2168msgstr "Ðије наведена датотека кључа домаћина на линији наредби\n"
2131 2169
2132#: src/cli/util/gnunet-ecc.c:452 2170#: src/cli/util/gnunet-ecc.c:458
2133msgid "list keys included in a file (for testing)" 2171msgid "list keys included in a file (for testing)"
2134msgstr "иÑпиÑује кључеве укључене у датотеци (за теÑтирање)" 2172msgstr "иÑпиÑује кључеве укључене у датотеци (за теÑтирање)"
2135 2173
2136#: src/cli/util/gnunet-ecc.c:458 2174#: src/cli/util/gnunet-ecc.c:464
2137msgid "number of keys to list included in a file (for testing)" 2175msgid "number of keys to list included in a file (for testing)"
2138msgstr "број кључева за иÑÐ¿Ð¸Ñ ÑƒÐºÑ™ÑƒÑ‡ÐµÐ½Ð¸Ñ… у датотеци (за теÑтирање)" 2176msgstr "број кључева за иÑÐ¿Ð¸Ñ ÑƒÐºÑ™ÑƒÑ‡ÐµÐ½Ð¸Ñ… у датотеци (за теÑтирање)"
2139 2177
2140#: src/cli/util/gnunet-ecc.c:464 2178#: src/cli/util/gnunet-ecc.c:470
2141msgid "create COUNT public-private key pairs (for testing)" 2179msgid "create COUNT public-private key pairs (for testing)"
2142msgstr "Ñтвара БРОЈ пара јавног-личног кључа (за теÑтирање)" 2180msgstr "Ñтвара БРОЈ пара јавног-личног кључа (за теÑтирање)"
2143 2181
2144#: src/cli/util/gnunet-ecc.c:469 2182#: src/cli/util/gnunet-ecc.c:475
2145msgid "print the public key in ASCII format" 2183msgid "print the public key in ASCII format"
2146msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату" 2184msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату"
2147 2185
2148#: src/cli/util/gnunet-ecc.c:474 2186#: src/cli/util/gnunet-ecc.c:480
2149#, fuzzy 2187#, fuzzy
2150msgid "print the private key in ASCII format" 2188msgid "print the private key in ASCII format"
2151msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату" 2189msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату"
2152 2190
2153#: src/cli/util/gnunet-ecc.c:479 2191#: src/cli/util/gnunet-ecc.c:485
2154#, fuzzy 2192#, fuzzy
2155msgid "print the public key in HEX format" 2193msgid "print the public key in HEX format"
2156msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату" 2194msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату"
2157 2195
2158#: src/cli/util/gnunet-ecc.c:485 2196#: src/cli/util/gnunet-ecc.c:491
2159msgid "print examples of ECC operations (used for compatibility testing)" 2197msgid "print examples of ECC operations (used for compatibility testing)"
2160msgstr "иÑпиÑује примере ЕЦЦ операција (кориÑти Ñе за теÑтирање ÑаглаÑноÑти)" 2198msgstr "иÑпиÑује примере ЕЦЦ операција (кориÑти Ñе за теÑтирање ÑаглаÑноÑти)"
2161 2199
2162#: src/cli/util/gnunet-ecc.c:499 2200#: src/cli/util/gnunet-ecc.c:505
2163msgid "Manipulate GNUnet private ECC key files" 2201msgid "Manipulate GNUnet private ECC key files"
2164msgstr "Управља ГÐУнет датотекама личног ЕЦЦ кључа" 2202msgstr "Управља ГÐУнет датотекама личног ЕЦЦ кључа"
2165 2203
@@ -3255,13 +3293,13 @@ msgstr ""
3255msgid "Invalid handle type while writing `%s'" 3293msgid "Invalid handle type while writing `%s'"
3256msgstr "ÐеиÑправан формат времена „%s“\n" 3294msgstr "ÐеиÑправан формат времена „%s“\n"
3257 3295
3258#: src/lib/util/client.c:531 src/lib/util/service.c:1134 3296#: src/lib/util/client.c:531 src/lib/util/service.c:1139
3259#: src/service/arm/gnunet-service-arm.c:452 3297#: src/service/arm/gnunet-service-arm.c:452
3260#, c-format 3298#, c-format
3261msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 3299msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
3262msgstr "ЈУÐИКС_ПУТÐЊР„%s“ је предуга, највећа дужина је %llu\n" 3300msgstr "ЈУÐИКС_ПУТÐЊР„%s“ је предуга, највећа дужина је %llu\n"
3263 3301
3264#: src/lib/util/client.c:536 src/lib/util/service.c:1138 3302#: src/lib/util/client.c:536 src/lib/util/service.c:1143
3265#: src/service/arm/gnunet-service-arm.c:456 3303#: src/service/arm/gnunet-service-arm.c:456
3266#, c-format 3304#, c-format
3267msgid "Using `%s' instead\n" 3305msgid "Using `%s' instead\n"
@@ -3394,17 +3432,17 @@ msgstr ""
3394msgid "`%s' failed at %s:%d with error: %s\n" 3432msgid "`%s' failed at %s:%d with error: %s\n"
3395msgstr "„%s“ није уÑпело на %s:%d Ñа грешком: %s\n" 3433msgstr "„%s“ није уÑпело на %s:%d Ñа грешком: %s\n"
3396 3434
3397#: src/lib/util/crypto_ecc.c:554 3435#: src/lib/util/crypto_ecc.c:569
3398#, c-format 3436#, c-format
3399msgid "ECC signing failed at %s:%d: %s\n" 3437msgid "ECC signing failed at %s:%d: %s\n"
3400msgstr "„ECC“ потпиÑивање није уÑпело на %s:%d: %s\n" 3438msgstr "„ECC“ потпиÑивање није уÑпело на %s:%d: %s\n"
3401 3439
3402#: src/lib/util/crypto_ecc.c:677 3440#: src/lib/util/crypto_ecc.c:692
3403#, c-format 3441#, c-format
3404msgid "ECDSA signature verification failed at %s:%d: %s\n" 3442msgid "ECDSA signature verification failed at %s:%d: %s\n"
3405msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s:%d: %s\n" 3443msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s:%d: %s\n"
3406 3444
3407#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:304 3445#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:305
3408msgid "Could not load peer's private key\n" 3446msgid "Could not load peer's private key\n"
3409msgstr "Ðе могу да учитам лични кључ парњака\n" 3447msgstr "Ðе могу да учитам лични кључ парњака\n"
3410 3448
@@ -3428,7 +3466,7 @@ msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s:
3428msgid "Expected `%s' to be a directory!\n" 3466msgid "Expected `%s' to be a directory!\n"
3429msgstr "Очекивах да „%s“ буде директоријум!\n" 3467msgstr "Очекивах да „%s“ буде директоријум!\n"
3430 3468
3431#: src/lib/util/disk.c:1222 src/lib/util/service.c:1642 3469#: src/lib/util/disk.c:1222 src/lib/util/service.c:1651
3432#, c-format 3470#, c-format
3433msgid "Cannot obtain information about user `%s': %s\n" 3471msgid "Cannot obtain information about user `%s': %s\n"
3434msgstr "Ðе могу да добијем податке о кориÑнику „%s“: %s\n" 3472msgstr "Ðе могу да добијем податке о кориÑнику „%s“: %s\n"
@@ -3620,101 +3658,101 @@ msgstr "Морате да проÑледите број опцији „%s“.\n
3620msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 3658msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
3621msgstr "" 3659msgstr ""
3622 3660
3623#: src/lib/util/gnunet_error_codes.c:60 3661#: src/lib/util/gnunet_error_codes.c:59
3624msgid "No error (success)." 3662msgid "No error (success)."
3625msgstr "" 3663msgstr ""
3626 3664
3627#: src/lib/util/gnunet_error_codes.c:66 3665#: src/lib/util/gnunet_error_codes.c:65
3628#, fuzzy 3666#, fuzzy
3629msgid "Unknown and unspecified error." 3667msgid "Unknown and unspecified error."
3630msgstr "%.s Ðепознат код резултата." 3668msgstr "%.s Ðепознат код резултата."
3631 3669
3632#: src/lib/util/gnunet_error_codes.c:72 3670#: src/lib/util/gnunet_error_codes.c:71
3633#, fuzzy 3671#, fuzzy
3634msgid "Communication with service failed." 3672msgid "Communication with service failed."
3635msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n" 3673msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n"
3636 3674
3637#: src/lib/util/gnunet_error_codes.c:78 3675#: src/lib/util/gnunet_error_codes.c:77
3638#, fuzzy 3676#, fuzzy
3639msgid "Ego not found." 3677msgid "Ego not found."
3640msgstr "ÐиÑам нашао Ñадржај" 3678msgstr "ÐиÑам нашао Ñадржај"
3641 3679
3642#: src/lib/util/gnunet_error_codes.c:84 3680#: src/lib/util/gnunet_error_codes.c:83
3643#, fuzzy 3681#, fuzzy
3644msgid "Identifier already in use for another ego." 3682msgid "Identifier already in use for another ego."
3645msgstr "одредник Ñе већ кориÑти за други его" 3683msgstr "одредник Ñе већ кориÑти за други его"
3646 3684
3647#: src/lib/util/gnunet_error_codes.c:90 3685#: src/lib/util/gnunet_error_codes.c:89
3648msgid "The given ego is invalid or malformed." 3686msgid "The given ego is invalid or malformed."
3649msgstr "" 3687msgstr ""
3650 3688
3651#: src/lib/util/gnunet_error_codes.c:96 3689#: src/lib/util/gnunet_error_codes.c:95
3652#, fuzzy 3690#, fuzzy
3653msgid "Unknown namestore error." 3691msgid "Unknown namestore error."
3654msgstr "%.s Ðепознат код резултата." 3692msgstr "%.s Ðепознат код резултата."
3655 3693
3656#: src/lib/util/gnunet_error_codes.c:102 src/lib/util/gnunet_error_codes.c:120 3694#: src/lib/util/gnunet_error_codes.c:101 src/lib/util/gnunet_error_codes.c:119
3657#, fuzzy 3695#, fuzzy
3658msgid "Zone iteration failed." 3696msgid "Zone iteration failed."
3659msgstr "# Бирање парњака није уÑпело" 3697msgstr "# Бирање парњака није уÑпело"
3660 3698
3661#: src/lib/util/gnunet_error_codes.c:108 3699#: src/lib/util/gnunet_error_codes.c:107
3662#, fuzzy 3700#, fuzzy
3663msgid "Zone not found." 3701msgid "Zone not found."
3664msgstr "ÐиÑам нашао Ñадржај" 3702msgstr "ÐиÑам нашао Ñадржај"
3665 3703
3666#: src/lib/util/gnunet_error_codes.c:114 3704#: src/lib/util/gnunet_error_codes.c:113
3667#, fuzzy 3705#, fuzzy
3668msgid "Record not found." 3706msgid "Record not found."
3669msgstr "ниÑам нашао „upnpc“\n" 3707msgstr "ниÑам нашао „upnpc“\n"
3670 3708
3671#: src/lib/util/gnunet_error_codes.c:126 3709#: src/lib/util/gnunet_error_codes.c:125
3672msgid "Zone does not contain any records." 3710msgid "Zone does not contain any records."
3673msgstr "" 3711msgstr ""
3674 3712
3675#: src/lib/util/gnunet_error_codes.c:132 3713#: src/lib/util/gnunet_error_codes.c:131
3676#, fuzzy 3714#, fuzzy
3677msgid "Failed to lookup record." 3715msgid "Failed to lookup record."
3678msgstr "Смештај назива није уÑпео да ÑмеÑти запиÑ\n" 3716msgstr "Смештај назива није уÑпео да ÑмеÑти запиÑ\n"
3679 3717
3680#: src/lib/util/gnunet_error_codes.c:138 3718#: src/lib/util/gnunet_error_codes.c:137
3681#, fuzzy 3719#, fuzzy
3682msgid "No records given." 3720msgid "No records given."
3683msgstr "Ðије дат парњак!\n" 3721msgstr "Ðије дат парњак!\n"
3684 3722
3685#: src/lib/util/gnunet_error_codes.c:144 3723#: src/lib/util/gnunet_error_codes.c:143
3686msgid "Record data invalid." 3724msgid "Record data invalid."
3687msgstr "" 3725msgstr ""
3688 3726
3689#: src/lib/util/gnunet_error_codes.c:150 3727#: src/lib/util/gnunet_error_codes.c:149
3690#, fuzzy 3728#, fuzzy
3691msgid "No label given." 3729msgid "No label given."
3692msgstr "Ðије дат парњак!\n" 3730msgstr "Ðије дат парњак!\n"
3693 3731
3694#: src/lib/util/gnunet_error_codes.c:156 3732#: src/lib/util/gnunet_error_codes.c:155
3695#, fuzzy 3733#, fuzzy
3696msgid "No results given." 3734msgid "No results given."
3697msgstr "ÐиÑу дате опције\n" 3735msgstr "ÐиÑу дате опције\n"
3698 3736
3699#: src/lib/util/gnunet_error_codes.c:162 3737#: src/lib/util/gnunet_error_codes.c:161
3700#, fuzzy 3738#, fuzzy
3701msgid "Record already exists." 3739msgid "Record already exists."
3702msgstr "назив мете већ поÑтоји" 3740msgstr "назив мете већ поÑтоји"
3703 3741
3704#: src/lib/util/gnunet_error_codes.c:168 3742#: src/lib/util/gnunet_error_codes.c:167
3705msgid "Record size exceeds maximum limit." 3743msgid "Record size exceeds maximum limit."
3706msgstr "" 3744msgstr ""
3707 3745
3708#: src/lib/util/gnunet_error_codes.c:174 3746#: src/lib/util/gnunet_error_codes.c:173
3709msgid "There was an error in the database backend." 3747msgid "There was an error in the database backend."
3710msgstr "" 3748msgstr ""
3711 3749
3712#: src/lib/util/gnunet_error_codes.c:180 3750#: src/lib/util/gnunet_error_codes.c:179
3713#, fuzzy 3751#, fuzzy
3714msgid "Failed to store the given records." 3752msgid "Failed to store the given records."
3715msgstr "Смештај назива није уÑпео да ÑмеÑти запиÑ\n" 3753msgstr "Смештај назива није уÑпео да ÑмеÑти запиÑ\n"
3716 3754
3717#: src/lib/util/gnunet_error_codes.c:186 3755#: src/lib/util/gnunet_error_codes.c:185
3718msgid "Label invalid or malformed." 3756msgid "Label invalid or malformed."
3719msgstr "" 3757msgstr ""
3720 3758
@@ -3785,16 +3823,6 @@ msgstr "„%s“ није уÑпело за библиотеку '%s' Ñа грÐ
3785msgid "Could not determine plugin installation path.\n" 3823msgid "Could not determine plugin installation path.\n"
3786msgstr "Ðе могу да одредим путању инÑталирања прикључка.\n" 3824msgstr "Ðе могу да одредим путању инÑталирања прикључка.\n"
3787 3825
3788#: src/lib/util/program.c:287
3789#, fuzzy, c-format
3790msgid "Unreadable configuration file `%s', exiting ...\n"
3791msgstr "Лоша датотека подешавања „%s“, излазим ...\n"
3792
3793#: src/lib/util/program.c:299
3794#, fuzzy, c-format
3795msgid "Malformed configuration file `%s', exiting ...\n"
3796msgstr "Лоша датотека подешавања „%s“, излазим ...\n"
3797
3798#: src/lib/util/program.c:314 3826#: src/lib/util/program.c:314
3799#, fuzzy, c-format 3827#, fuzzy, c-format
3800msgid "Unreadable configuration file `%s'. Exiting ...\n" 3828msgid "Unreadable configuration file `%s'. Exiting ...\n"
@@ -3845,7 +3873,7 @@ msgstr "ОÑновна уÑлуга „%s“ није подешена иÑпрÐ
3845msgid "Could not resolve our FQDN: %s\n" 3873msgid "Could not resolve our FQDN: %s\n"
3846msgstr "Ðе могу да решим наш „FQDN“ : %s\n" 3874msgstr "Ðе могу да решим наш „FQDN“ : %s\n"
3847 3875
3848#: src/lib/util/service.c:654 3876#: src/lib/util/service.c:650
3849#, fuzzy, c-format 3877#, fuzzy, c-format
3850msgid "" 3878msgid ""
3851"Processing code for message of type %u did not call " 3879"Processing code for message of type %u did not call "
@@ -3854,29 +3882,29 @@ msgstr ""
3854"Обрађивачки код за поруку врÑте %u није позвао „GNUNET_SERVER_receive_done“ " 3882"Обрађивачки код за поруку врÑте %u није позвао „GNUNET_SERVER_receive_done“ "
3855"након „%s“\n" 3883"након „%s“\n"
3856 3884
3857#: src/lib/util/service.c:838 3885#: src/lib/util/service.c:841
3858#, c-format 3886#, c-format
3859msgid "Unknown address family %d\n" 3887msgid "Unknown address family %d\n"
3860msgstr "Ðепозната породица адреÑе „%d“\n" 3888msgstr "Ðепозната породица адреÑе „%d“\n"
3861 3889
3862#: src/lib/util/service.c:951 3890#: src/lib/util/service.c:956
3863#, c-format 3891#, c-format
3864msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 3892msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
3865msgstr "Ðе могу да обрадим Ñпецификацију ИПв4 мреже „%s“ за `%s:%s'\n" 3893msgstr "Ðе могу да обрадим Ñпецификацију ИПв4 мреже „%s“ за `%s:%s'\n"
3866 3894
3867#: src/lib/util/service.c:992 3895#: src/lib/util/service.c:997
3868#, c-format 3896#, c-format
3869msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 3897msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
3870msgstr "Ðе могу да обрадим Ñпецификацију ИПв6 мреже „%s“ за `%s:%s'\n" 3898msgstr "Ðе могу да обрадим Ñпецификацију ИПв6 мреже „%s“ за `%s:%s'\n"
3871 3899
3872#: src/lib/util/service.c:1095 src/lib/util/service.c:1101 3900#: src/lib/util/service.c:1100 src/lib/util/service.c:1106
3873#: src/service/arm/gnunet-service-arm.c:412 3901#: src/service/arm/gnunet-service-arm.c:412
3874#: src/service/arm/gnunet-service-arm.c:418 3902#: src/service/arm/gnunet-service-arm.c:418
3875#, c-format 3903#, c-format
3876msgid "Require valid port number for service `%s' in configuration!\n" 3904msgid "Require valid port number for service `%s' in configuration!\n"
3877msgstr "Захтева иÑправан број прикључника за уÑлугу „%s“ у подешавањима!\n" 3905msgstr "Захтева иÑправан број прикључника за уÑлугу „%s“ у подешавањима!\n"
3878 3906
3879#: src/lib/util/service.c:1158 src/service/arm/gnunet-service-arm.c:484 3907#: src/lib/util/service.c:1163 src/service/arm/gnunet-service-arm.c:484
3880#, c-format 3908#, c-format
3881msgid "" 3909msgid ""
3882"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 3910"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
@@ -3885,87 +3913,87 @@ msgstr ""
3885"ИÑкључујем подршку прикључнице ЈУÐИКС домена за уÑлугу „%s“, ниÑм уÑпео да " 3913"ИÑкључујем подршку прикључнице ЈУÐИКС домена за уÑлугу „%s“, ниÑм уÑпео да "
3886"направим прикључницу ЈУÐИКС домена: %s\n" 3914"направим прикључницу ЈУÐИКС домена: %s\n"
3887 3915
3888#: src/lib/util/service.c:1176 src/service/arm/gnunet-service-arm.c:505 3916#: src/lib/util/service.c:1181 src/service/arm/gnunet-service-arm.c:505
3889#, c-format 3917#, c-format
3890msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 3918msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
3891msgstr "" 3919msgstr ""
3892"Ðемам ни ПРИКЉУЧÐИК ни ЈУÐИКС_ПУТÐЊУ за уÑлугу „%s“, али је једно потребно\n" 3920"Ðемам ни ПРИКЉУЧÐИК ни ЈУÐИКС_ПУТÐЊУ за уÑлугу „%s“, али је једно потребно\n"
3893 3921
3894#: src/lib/util/service.c:1207 src/service/arm/gnunet-service-arm.c:536 3922#: src/lib/util/service.c:1212 src/service/arm/gnunet-service-arm.c:536
3895#, c-format 3923#, c-format
3896msgid "Failed to resolve `%s': %s\n" 3924msgid "Failed to resolve `%s': %s\n"
3897msgstr "ÐиÑам уÑпео да решим „%s“: %s\n" 3925msgstr "ÐиÑам уÑпео да решим „%s“: %s\n"
3898 3926
3899#: src/lib/util/service.c:1226 src/service/arm/gnunet-service-arm.c:555 3927#: src/lib/util/service.c:1231 src/service/arm/gnunet-service-arm.c:555
3900#, c-format 3928#, c-format
3901msgid "Failed to find %saddress for `%s'.\n" 3929msgid "Failed to find %saddress for `%s'.\n"
3902msgstr "ÐиÑам уÑпео да нађем %s адреÑу за „%s“.\n" 3930msgstr "ÐиÑам уÑпео да нађем %s адреÑу за „%s“.\n"
3903 3931
3904#: src/lib/util/service.c:1401 3932#: src/lib/util/service.c:1406
3905#, c-format 3933#, c-format
3906msgid "`%s' failed for port %d (%s).\n" 3934msgid "`%s' failed for port %d (%s).\n"
3907msgstr "„%s“ није уÑпело за прикључник %d (%s).\n" 3935msgstr "„%s“ није уÑпело за прикључник %d (%s).\n"
3908 3936
3909#: src/lib/util/service.c:1413 3937#: src/lib/util/service.c:1418
3910#, c-format 3938#, c-format
3911msgid "`%s' failed for port %d (%s): address already in use\n" 3939msgid "`%s' failed for port %d (%s): address already in use\n"
3912msgstr "„%s“ није уÑпело за прикључник %d (%s): адреÑа је већ у употреби\n" 3940msgstr "„%s“ није уÑпело за прикључник %d (%s): адреÑа је већ у употреби\n"
3913 3941
3914#: src/lib/util/service.c:1420 3942#: src/lib/util/service.c:1425
3915#, c-format 3943#, c-format
3916msgid "`%s' failed for `%s': address already in use\n" 3944msgid "`%s' failed for `%s': address already in use\n"
3917msgstr "„%s“ није уÑпело за „%s“: адреÑа је већ у употреби\n" 3945msgstr "„%s“ није уÑпело за „%s“: адреÑа је већ у употреби\n"
3918 3946
3919#: src/lib/util/service.c:1481 3947#: src/lib/util/service.c:1486
3920#, c-format 3948#, c-format
3921msgid "Specified value for `%s' of service `%s' is invalid\n" 3949msgid "Specified value for `%s' of service `%s' is invalid\n"
3922msgstr "Ðаведена вредноÑÑ‚ за „%s“ уÑлуге „%s“ је неиÑправна\n" 3950msgstr "Ðаведена вредноÑÑ‚ за „%s“ уÑлуге „%s“ је неиÑправна\n"
3923 3951
3924#: src/lib/util/service.c:1505 3952#: src/lib/util/service.c:1510
3925#, c-format 3953#, c-format
3926msgid "Could not access pre-bound socket %u, will try to bind myself\n" 3954msgid "Could not access pre-bound socket %u, will try to bind myself\n"
3927msgstr "" 3955msgstr ""
3928"Ðе могу да приÑтупим унапред Ñвезаној прикључници %u, покушаћу да Ñвежем " 3956"Ðе могу да приÑтупим унапред Ñвезаној прикључници %u, покушаћу да Ñвежем "
3929"Ñебе Ñамог\n" 3957"Ñебе Ñамог\n"
3930 3958
3931#: src/lib/util/service.c:1573 3959#: src/lib/util/service.c:1583
3932msgid "" 3960msgid ""
3933"Could not bind to any of the ports I was supposed to, refusing to run!\n" 3961"Could not bind to any of the ports I was supposed to, refusing to run!\n"
3934msgstr "" 3962msgstr ""
3935 3963
3936#: src/lib/util/service.c:1644 3964#: src/lib/util/service.c:1653
3937msgid "No such user" 3965msgid "No such user"
3938msgstr "Ðема таквог кориÑника" 3966msgstr "Ðема таквог кориÑника"
3939 3967
3940#: src/lib/util/service.c:1658 3968#: src/lib/util/service.c:1668
3941#, c-format 3969#, c-format
3942msgid "Cannot change user/group to `%s': %s\n" 3970msgid "Cannot change user/group to `%s': %s\n"
3943msgstr "Ðе могу да променим влаÑника/групу на „%s“: %s\n" 3971msgstr "Ðе могу да променим влаÑника/групу на „%s“: %s\n"
3944 3972
3945#: src/lib/util/service.c:1751 3973#: src/lib/util/service.c:1767
3946msgid "Service process failed to initialize\n" 3974msgid "Service process failed to initialize\n"
3947msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да Ñе покрене\n" 3975msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да Ñе покрене\n"
3948 3976
3949#: src/lib/util/service.c:1756 3977#: src/lib/util/service.c:1772
3950msgid "Service process could not initialize server function\n" 3978msgid "Service process could not initialize server function\n"
3951msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге не може да покрене функцију Ñервера\n" 3979msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге не може да покрене функцију Ñервера\n"
3952 3980
3953#: src/lib/util/service.c:1761 3981#: src/lib/util/service.c:1777
3954msgid "Service process failed to report status\n" 3982msgid "Service process failed to report status\n"
3955msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да извеÑти о Ñтању\n" 3983msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да извеÑти о Ñтању\n"
3956 3984
3957#: src/lib/util/service.c:1960 src/lib/util/service.c:2255 3985#: src/lib/util/service.c:1990 src/lib/util/service.c:2304
3958msgid "do daemonize (detach from terminal)" 3986msgid "do daemonize (detach from terminal)"
3959msgstr "ради демонизацију (откачиње од терминала)" 3987msgstr "ради демонизацију (откачиње од терминала)"
3960 3988
3961#: src/lib/util/service.c:2036 src/lib/util/service.c:2048 3989#: src/lib/util/service.c:2065 src/lib/util/service.c:2080
3962#: src/lib/util/service.c:2298 src/lib/util/service.c:2310 3990#: src/lib/util/service.c:2353 src/lib/util/service.c:2368
3963#: src/service/transport/transport-testing-communicator.c:1055 3991#: src/service/transport/transport-testing-communicator.c:1059
3964#, c-format 3992#, c-format
3965msgid "Malformed configuration file `%s', exit ...\n" 3993msgid "Malformed configuration file `%s', exit ...\n"
3966msgstr "Лоша датотека подешавања „%s“, излазим ...\n" 3994msgstr "Лоша датотека подешавања „%s“, излазим ...\n"
3967 3995
3968#: src/lib/util/service.c:2058 src/lib/util/service.c:2321 3996#: src/lib/util/service.c:2092 src/lib/util/service.c:2381
3969msgid "Malformed configuration, exit ...\n" 3997msgid "Malformed configuration, exit ...\n"
3970msgstr "Лоше подешавање, излазим ...\n" 3998msgstr "Лоше подешавање, излазим ...\n"
3971 3999
@@ -4435,6 +4463,11 @@ msgstr ""
4435msgid "Initiating shutdown as requested by client.\n" 4463msgid "Initiating shutdown as requested by client.\n"
4436msgstr "Започињем гашење као што је затражио клијент.\n" 4464msgstr "Започињем гашење као што је затражио клијент.\n"
4437 4465
4466#: src/service/arm/testing_arm_cmd_start_peer.c:197
4467#, c-format
4468msgid "Failed to start `%s': %s\n"
4469msgstr "ÐиÑам уÑпео да покренем „%s“: %s\n"
4470
4438#: src/service/core/gnunet-service-core.c:329 4471#: src/service/core/gnunet-service-core.c:329
4439msgid "# send requests dropped (disconnected)" 4472msgid "# send requests dropped (disconnected)"
4440msgstr "# захтеви Ñлања Ñу одбачени (веза је прекинута)" 4473msgstr "# захтеви Ñлања Ñу одбачени (веза је прекинута)"
@@ -4604,8 +4637,8 @@ msgstr "# бајтови утовара Ñу дешифровани"
4604#: src/service/core/gnunet-service-core_sessions.c:337 4637#: src/service/core/gnunet-service-core_sessions.c:337
4605#: src/service/fs/gnunet-service-fs_cp.c:484 4638#: src/service/fs/gnunet-service-fs_cp.c:484
4606#: src/service/fs/gnunet-service-fs_cp.c:1377 4639#: src/service/fs/gnunet-service-fs_cp.c:1377
4607#: src/service/topology/gnunet-daemon-topology.c:551 4640#: src/service/topology/gnunet-daemon-topology.c:545
4608#: src/service/topology/gnunet-daemon-topology.c:633 4641#: src/service/topology/gnunet-daemon-topology.c:627
4609msgid "# peers connected" 4642msgid "# peers connected"
4610msgstr "# парњаци Ñу повезани" 4643msgstr "# парњаци Ñу повезани"
4611 4644
@@ -4734,7 +4767,7 @@ msgstr "Ðедовољно проÑтора за задовољавање зах
4734#: src/service/datastore/gnunet-service-datastore.c:626 4767#: src/service/datastore/gnunet-service-datastore.c:626
4735#: src/service/datastore/gnunet-service-datastore.c:677 4768#: src/service/datastore/gnunet-service-datastore.c:677
4736#: src/service/datastore/gnunet-service-datastore.c:820 4769#: src/service/datastore/gnunet-service-datastore.c:820
4737#: src/service/datastore/gnunet-service-datastore.c:1428 4770#: src/service/datastore/gnunet-service-datastore.c:1431
4738msgid "# reserved" 4771msgid "# reserved"
4739msgstr "# је резервиÑано" 4772msgstr "# је резервиÑано"
4740 4773
@@ -4785,66 +4818,66 @@ msgstr "# бајта је уклоњено (изричити захтев)"
4785msgid "# REMOVE requests received" 4818msgid "# REMOVE requests received"
4786msgstr "# захтеви УКЛОÐИ Ñу уклоњени" 4819msgstr "# захтеви УКЛОÐИ Ñу уклоњени"
4787 4820
4788#: src/service/datastore/gnunet-service-datastore.c:1107 4821#: src/service/datastore/gnunet-service-datastore.c:1109
4789#, fuzzy, c-format 4822#, fuzzy, c-format
4790msgid "" 4823msgid ""
4791"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n" 4824"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n"
4792msgstr "" 4825msgstr ""
4793"Утовар Ñмештаја података није тачан (%lld < %lld). Покушавам да поправим.\n" 4826"Утовар Ñмештаја података није тачан (%lld < %lld). Покушавам да поправим.\n"
4794 4827
4795#: src/service/datastore/gnunet-service-datastore.c:1112 4828#: src/service/datastore/gnunet-service-datastore.c:1114
4796#: src/service/datastore/gnunet-service-datastore.c:1281 4829#: src/service/datastore/gnunet-service-datastore.c:1283
4797#, c-format 4830#, c-format
4798msgid "New payload: %lld\n" 4831msgid "New payload: %lld\n"
4799msgstr "" 4832msgstr ""
4800 4833
4801#: src/service/datastore/gnunet-service-datastore.c:1167 4834#: src/service/datastore/gnunet-service-datastore.c:1169
4802#, c-format 4835#, c-format
4803msgid "Loading `%s' datastore plugin\n" 4836msgid "Loading `%s' datastore plugin\n"
4804msgstr "Учитавам прикључак „%s“ Ñмештаја података\n" 4837msgstr "Учитавам прикључак „%s“ Ñмештаја података\n"
4805 4838
4806#: src/service/datastore/gnunet-service-datastore.c:1176 4839#: src/service/datastore/gnunet-service-datastore.c:1178
4807#, c-format 4840#, c-format
4808msgid "Failed to load datastore plugin for `%s'\n" 4841msgid "Failed to load datastore plugin for `%s'\n"
4809msgstr "ÐиÑам уÑпео да учитам прикључак Ñмештаја података за „%s“\n" 4842msgstr "ÐиÑам уÑпео да учитам прикључак Ñмештаја података за „%s“\n"
4810 4843
4811#: src/service/datastore/gnunet-service-datastore.c:1236 4844#: src/service/datastore/gnunet-service-datastore.c:1238
4812msgid "Bloomfilter construction complete.\n" 4845msgid "Bloomfilter construction complete.\n"
4813msgstr "Изградња блумфилтера је завршена.\n" 4846msgstr "Изградња блумфилтера је завршена.\n"
4814 4847
4815#: src/service/datastore/gnunet-service-datastore.c:1288 4848#: src/service/datastore/gnunet-service-datastore.c:1290
4816msgid "Rebuilding bloomfilter. Please be patient.\n" 4849msgid "Rebuilding bloomfilter. Please be patient.\n"
4817msgstr "Поново градим блумфилтер. Будите Ñтрпљиви.\n" 4850msgstr "Поново градим блумфилтер. Будите Ñтрпљиви.\n"
4818 4851
4819#: src/service/datastore/gnunet-service-datastore.c:1298 4852#: src/service/datastore/gnunet-service-datastore.c:1300
4820msgid "Plugin does not support get_keys function. Please fix!\n" 4853msgid "Plugin does not support get_keys function. Please fix!\n"
4821msgstr "Прикључак не подржава функцију „get_keys“. Поправите то!\n" 4854msgstr "Прикључак не подржава функцију „get_keys“. Поправите то!\n"
4822 4855
4823#: src/service/datastore/gnunet-service-datastore.c:1463 4856#: src/service/datastore/gnunet-service-datastore.c:1466
4824#, c-format 4857#, c-format
4825msgid "# bytes used in file-sharing datastore `%s'" 4858msgid "# bytes used in file-sharing datastore `%s'"
4826msgstr "# бајтови Ñу коришћени у Ñмештају података дељења датотека „%s“" 4859msgstr "# бајтови Ñу коришћени у Ñмештају података дељења датотека „%s“"
4827 4860
4828#: src/service/datastore/gnunet-service-datastore.c:1472 4861#: src/service/datastore/gnunet-service-datastore.c:1475
4829msgid "# quota" 4862msgid "# quota"
4830msgstr "# квота" 4863msgstr "# квота"
4831 4864
4832#: src/service/datastore/gnunet-service-datastore.c:1475 4865#: src/service/datastore/gnunet-service-datastore.c:1478
4833msgid "# cache size" 4866msgid "# cache size"
4834msgstr "# величина кеша" 4867msgstr "# величина кеша"
4835 4868
4836#: src/service/datastore/gnunet-service-datastore.c:1491 4869#: src/service/datastore/gnunet-service-datastore.c:1494
4837#, c-format 4870#, c-format
4838msgid "Could not use specified filename `%s' for bloomfilter.\n" 4871msgid "Could not use specified filename `%s' for bloomfilter.\n"
4839msgstr "Ðе могу да кориÑтим наведени назив датотеке „%s“ за блумфилтер.\n" 4872msgstr "Ðе могу да кориÑтим наведени назив датотеке „%s“ за блумфилтер.\n"
4840 4873
4841#: src/service/datastore/gnunet-service-datastore.c:1512 4874#: src/service/datastore/gnunet-service-datastore.c:1515
4842#: src/service/datastore/gnunet-service-datastore.c:1534 4875#: src/service/datastore/gnunet-service-datastore.c:1537
4843#, c-format 4876#, c-format
4844msgid "Failed to remove bogus bloomfilter file `%s'\n" 4877msgid "Failed to remove bogus bloomfilter file `%s'\n"
4845msgstr "ÐиÑам уÑпео да уклоним лажну датотеку блумфилтера „%s“\n" 4878msgstr "ÐиÑам уÑпео да уклоним лажну датотеку блумфилтера „%s“\n"
4846 4879
4847#: src/service/datastore/gnunet-service-datastore.c:1573 4880#: src/service/datastore/gnunet-service-datastore.c:1576
4848msgid "Failed to initialize bloomfilter.\n" 4881msgid "Failed to initialize bloomfilter.\n"
4849msgstr "ÐиÑам уÑпео да покренем блумфилтер.\n" 4882msgstr "ÐиÑам уÑпео да покренем блумфилтер.\n"
4850 4883
@@ -5657,7 +5690,7 @@ msgstr ""
5657 5690
5658#: src/service/fs/gnunet-service-fs.c:1271 5691#: src/service/fs/gnunet-service-fs.c:1271
5659#: src/service/hostlist/gnunet-daemon-hostlist.c:343 5692#: src/service/hostlist/gnunet-daemon-hostlist.c:343
5660#: src/service/topology/gnunet-daemon-topology.c:1066 5693#: src/service/topology/gnunet-daemon-topology.c:1062
5661#, c-format 5694#, c-format
5662msgid "Failed to connect to `%s' service.\n" 5695msgid "Failed to connect to `%s' service.\n"
5663msgstr "ÐиÑам уÑпео да Ñе повежем Ñа „%s“ уÑлугом.\n" 5696msgstr "ÐиÑам уÑпео да Ñе повежем Ñа „%s“ уÑлугом.\n"
@@ -6469,7 +6502,7 @@ msgid "# hostlist advertisements send"
6469msgstr "# рекламе ÑпиÑка домаћина Ñу поÑлате" 6502msgstr "# рекламе ÑпиÑка домаћина Ñу поÑлате"
6470 6503
6471#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 6504#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483
6472#: src/service/topology/gnunet-daemon-topology.c:786 6505#: src/service/topology/gnunet-daemon-topology.c:781
6473#, fuzzy, c-format 6506#, fuzzy, c-format
6474msgid "Error in communication with PEERSTORE service: %s\n" 6507msgid "Error in communication with PEERSTORE service: %s\n"
6475msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n" 6508msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n"
@@ -6740,12 +6773,12 @@ msgstr ""
6740msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" 6773msgid "Malformed punched hole specification `%s' (IPv6 address invalid)"
6741msgstr "" 6774msgstr ""
6742 6775
6743#: src/service/nat/gnunet-service-nat.c:1861 6776#: src/service/nat/gnunet-service-nat.c:1860
6744#, fuzzy 6777#, fuzzy
6745msgid "Connection reversal request failed\n" 6778msgid "Connection reversal request failed\n"
6746msgstr "Веза је уÑпоÑтављена.\n" 6779msgstr "Веза је уÑпоÑтављена.\n"
6747 6780
6748#: src/service/nat/gnunet-service-nat.c:1935 6781#: src/service/nat/gnunet-service-nat.c:1999
6749msgid "" 6782msgid ""
6750"UPnP enabled in configuration, but UPnP client `upnpc` command not found, " 6783"UPnP enabled in configuration, but UPnP client `upnpc` command not found, "
6751"disabling UPnP\n" 6784"disabling UPnP\n"
@@ -6769,43 +6802,43 @@ msgstr "ниÑам нашао наредбу „external-ip“\n"
6769msgid "`upnpc' command not found\n" 6802msgid "`upnpc' command not found\n"
6770msgstr "ниÑам нашао „upnpc“ наредбу\n" 6803msgstr "ниÑам нашао „upnpc“ наредбу\n"
6771 6804
6772#: src/service/peerstore/gnunet-service-peerstore.c:1141 6805#: src/service/peerstore/gnunet-service-peerstore.c:1150
6773#, c-format 6806#, c-format
6774msgid "Failed to parse HELLO in file `%s': %s\n" 6807msgid "Failed to parse HELLO in file `%s': %s\n"
6775msgstr "ÐиÑам уÑпео да обрадим „HELLO“ у датотеци „%s“: %s\n" 6808msgstr "ÐиÑам уÑпео да обрадим „HELLO“ у датотеци „%s“: %s\n"
6776 6809
6777#: src/service/peerstore/gnunet-service-peerstore.c:1214 6810#: src/service/peerstore/gnunet-service-peerstore.c:1223
6778#, fuzzy, c-format 6811#, fuzzy, c-format
6779msgid "Could not load database backend `%s'\n" 6812msgid "Could not load database backend `%s'\n"
6780msgstr "Ðе могу да отворим „%s“.\n" 6813msgstr "Ðе могу да отворим „%s“.\n"
6781 6814
6782#: src/service/peerstore/gnunet-service-peerstore.c:1233 6815#: src/service/peerstore/gnunet-service-peerstore.c:1242
6783#, c-format 6816#, c-format
6784msgid "Importing HELLOs from `%s'\n" 6817msgid "Importing HELLOs from `%s'\n"
6785msgstr "Увозим „HELLO“-е из „%s“\n" 6818msgstr "Увозим „HELLO“-е из „%s“\n"
6786 6819
6787#: src/service/peerstore/gnunet-service-peerstore.c:1244 6820#: src/service/peerstore/gnunet-service-peerstore.c:1253
6788msgid "Skipping import of included HELLOs\n" 6821msgid "Skipping import of included HELLOs\n"
6789msgstr "ПреÑкачем увоз укључених „HELLO“-а\n" 6822msgstr "ПреÑкачем увоз укључених „HELLO“-а\n"
6790 6823
6791#: src/service/peerstore/peerstore_api.c:574 6824#: src/service/peerstore/peerstore_api.c:579
6792#, fuzzy 6825#, fuzzy
6793msgid "Unexpected store response.\n" 6826msgid "Unexpected store response.\n"
6794msgstr "Ðеочекивано време за одговор Ñа „fs“ уÑлуге." 6827msgstr "Ðеочекивано време за одговор Ñа „fs“ уÑлуге."
6795 6828
6796#: src/service/peerstore/peerstore_api.c:606 6829#: src/service/peerstore/peerstore_api.c:620
6797#, fuzzy 6830#, fuzzy
6798msgid "Unexpected iteration response.\n" 6831msgid "Unexpected iteration response.\n"
6799msgstr "Ðеочекивано време за одговор Ñа „fs“ уÑлуге." 6832msgstr "Ðеочекивано време за одговор Ñа „fs“ уÑлуге."
6800 6833
6801#: src/service/peerstore/peerstore_api.c:652 6834#: src/service/peerstore/peerstore_api.c:666
6802msgid "" 6835msgid ""
6803"Unexpected iteration response, no iterating client found, discarding " 6836"Unexpected iteration response, no iterating client found, discarding "
6804"message.\n" 6837"message.\n"
6805msgstr "" 6838msgstr ""
6806 6839
6807#: src/service/peerstore/peerstore_api.c:662 6840#: src/service/peerstore/peerstore_api.c:676
6808#: src/service/peerstore/peerstore_api_monitor.c:164 6841#: src/service/peerstore/peerstore_api_monitor.c:163
6809#, fuzzy 6842#, fuzzy
6810msgid "Received a malformed response from service." 6843msgid "Received a malformed response from service."
6811msgstr "Примих лош ДÐС захтев од „%s“\n" 6844msgstr "Примих лош ДÐС захтев од „%s“\n"
@@ -6969,11 +7002,11 @@ msgstr ""
6969msgid "Namestore REST API initialized\n" 7002msgid "Namestore REST API initialized\n"
6970msgstr "Меш је покренут\n" 7003msgstr "Меш је покренут\n"
6971 7004
6972#: src/service/rest/openid_plugin.c:3102 7005#: src/service/rest/openid_plugin.c:3121
6973msgid "OpenID Connect REST API initialized\n" 7006msgid "OpenID Connect REST API initialized\n"
6974msgstr "" 7007msgstr ""
6975 7008
6976#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1523 7009#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1494
6977msgid "Identity Provider REST API initialized\n" 7010msgid "Identity Provider REST API initialized\n"
6978msgstr "" 7011msgstr ""
6979 7012
@@ -7024,162 +7057,56 @@ msgstr "Учитавам %llu бајта ÑтатиÑтике из „%s“\n"
7024msgid "Could not save some persistent statistics\n" 7057msgid "Could not save some persistent statistics\n"
7025msgstr "Ðе могу да Ñачувам нешто од трајне ÑтатиÑтике\n" 7058msgstr "Ðе могу да Ñачувам нешто од трајне ÑтатиÑтике\n"
7026 7059
7027#: src/service/testing/gnunet-testing.c:185 7060#: src/service/testbed/gnunet-testbed.c:196
7028#, c-format 7061#, fuzzy
7029msgid "Could not extract hostkey %u (offset too large?)\n" 7062msgid "number of unique configuration files to create"
7030msgstr "Ðе могу да извучем кључ домаћина %u (померај је превелик?)\n"
7031
7032#: src/service/testing/gnunet-testing.c:275
7033#, c-format
7034msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
7035msgstr ""
7036"Ðепозната наредба, кориÑтите „q“ да прекинете или „r“ да поново покренете "
7037"парњака\n"
7038
7039#: src/service/testing/gnunet-testing.c:386
7040msgid "create unique configuration files"
7041msgstr "Ñтвара јединÑтвене датотеке подешавања"
7042
7043#: src/service/testing/gnunet-testing.c:392
7044msgid "extract hostkey file from pre-computed hostkey list"
7045msgstr ""
7046"извлачи датотеку кључа доамћина из унапред прорачунатог ÑпиÑка кључа домаћина"
7047
7048#: src/service/testing/gnunet-testing.c:400
7049msgid ""
7050"number of unique configuration files to create, or number of the hostkey to "
7051"extract"
7052msgstr "" 7063msgstr ""
7053"број јединÑтвених датотека подешавања за Ñтварање, или број кључа домаћина " 7064"број јединÑтвених датотека подешавања за Ñтварање, или број кључа домаћина "
7054"за извлачење" 7065"за извлачење"
7055 7066
7056#: src/service/testing/gnunet-testing.c:407 7067#: src/service/testbed/gnunet-testbed.c:202
7057msgid "configuration template" 7068msgid "configuration template"
7058msgstr "шаблон подешавања" 7069msgstr "шаблон подешавања"
7059 7070
7060#: src/service/testing/gnunet-testing.c:415 7071#: src/service/testbed/gnunet-testbed.c:218
7061msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"
7062msgstr ""
7063"покреће дату уÑлугу, чека на Ñтандардном улазу за „r“ (поновно покретање) "
7064"или „q“ (излази)"
7065
7066#: src/service/testing/gnunet-testing.c:432
7067msgid "Command line tool to access the testing library" 7072msgid "Command line tool to access the testing library"
7068msgstr "Ðлат линије наредби за приезуп библиотеци теÑтирања" 7073msgstr "Ðлат линије наредби за приезуп библиотеци теÑтирања"
7069 7074
7070#: src/service/testing/list-keys.c:92
7071msgid "list COUNT number of keys"
7072msgstr "иÑпиÑује УКУПÐОСТ број парњака"
7073
7074#: src/service/testing/testing.c:291
7075#, c-format
7076msgid "Hostkeys file not found: %s\n"
7077msgstr "ÐиÑам нашао датотеку кључева домаћина: %s\n"
7078
7079#: src/service/testing/testing.c:743
7080#, c-format
7081msgid "Key number %u does not exist\n"
7082msgstr "Број кључа %u не поÑтоји\n"
7083
7084#: src/service/testing/testing.c:1217
7085#, c-format
7086msgid ""
7087"You attempted to create a testbed with more than %u hosts. Please "
7088"precompute more hostkeys first.\n"
7089msgstr ""
7090"Покушали Ñте да направите пробно меÑто Ñа више од %u домаћина. Прво пре "
7091"Ñвега израчунајте више кључева домаћина.\n"
7092
7093#: src/service/testing/testing.c:1226
7094#, c-format
7095msgid "Failed to initialize hostkey for peer %u\n"
7096msgstr "ÐиÑам уÑпео да покренем кључ домаћина за парњака %u\n"
7097
7098#: src/service/testing/testing.c:1236
7099msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
7100msgstr "опција „PRIVATE_KEY“ у одељку „PEER“ недоÑтаје у подешавањима\n"
7101
7102#: src/service/testing/testing.c:1249
7103msgid "Failed to create configuration for peer (not enough free ports?)\n"
7104msgstr ""
7105"ÐиÑам уÑпео да направим подешавање за парњака (нема довољно Ñлободних "
7106"прикључника?)\n"
7107
7108#: src/service/testing/testing.c:1265
7109#, c-format
7110msgid "Cannot open hostkey file `%s': %s\n"
7111msgstr "Ðе могу да отворим датотеку кључа домаћина „%s“: %s\n"
7112
7113#: src/service/testing/testing.c:1279
7114#, c-format
7115msgid "Failed to write hostkey file for peer %u: %s\n"
7116msgstr "ÐиÑам уÑпео да запишем датотеку кључа домаћина за парњака %u: %s\n"
7117
7118#: src/service/testing/testing.c:1307
7119#, c-format
7120msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7121msgstr "ÐиÑам уÑпео да запишем датотеку подешавања „%s“ за парњака %u: %s\n"
7122
7123#: src/service/testing/testing.c:1413
7124#, c-format
7125msgid "Failed to start `%s': %s\n"
7126msgstr "ÐиÑам уÑпео да покренем „%s“: %s\n"
7127
7128#: src/service/testing/testing.c:1664
7129#, c-format
7130msgid "Failed to load configuration from %s\n"
7131msgstr "ÐиÑам уÑпео да учитам подешавање за „%s“\n"
7132
7133#: src/service/testing/testing.c:2795
7134#, c-format
7135msgid "Topology file %s not found\n"
7136msgstr "ÐиÑам нашао датотеку размештаја „%s“\n"
7137
7138#: src/service/testing/testing.c:2803
7139#, c-format
7140msgid "Topology file %s has no data\n"
7141msgstr "Датотека размештаја „%s“ нема података\n"
7142
7143#: src/service/testing/testing.c:2811
7144#, c-format
7145msgid "Topology file %s cannot be read\n"
7146msgstr "Ðе могу да прочитам датотеку размештаја „%s“\n"
7147
7148#: src/service/topology/gnunet-daemon-topology.c:286 7075#: src/service/topology/gnunet-daemon-topology.c:286
7149#, fuzzy 7076#, fuzzy
7150msgid "# connect requests issued to ATS" 7077msgid "# connect requests issued to ATS"
7151msgstr "# захтеви везе Ñу издати преноÑу" 7078msgstr "# захтеви везе Ñу издати преноÑу"
7152 7079
7153#: src/service/topology/gnunet-daemon-topology.c:480 7080#: src/service/topology/gnunet-daemon-topology.c:475
7154msgid "# HELLO messages gossipped" 7081msgid "# HELLO messages gossipped"
7155msgstr "# „HELLO“ поруке Ñу наклопљене" 7082msgstr "# „HELLO“ поруке Ñу наклопљене"
7156 7083
7157#: src/service/topology/gnunet-daemon-topology.c:752 7084#: src/service/topology/gnunet-daemon-topology.c:747
7158#, fuzzy 7085#, fuzzy
7159msgid "Error in communication with PEERSTORE service to monitor.\n" 7086msgid "Error in communication with PEERSTORE service to monitor.\n"
7160msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n" 7087msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n"
7161 7088
7162#: src/service/topology/gnunet-daemon-topology.c:761 7089#: src/service/topology/gnunet-daemon-topology.c:756
7163msgid "Finished initial PEERSTORE iteration in monitor.\n" 7090msgid "Finished initial PEERSTORE iteration in monitor.\n"
7164msgstr "" 7091msgstr ""
7165 7092
7166#: src/service/topology/gnunet-daemon-topology.c:869 7093#: src/service/topology/gnunet-daemon-topology.c:864
7167msgid "Failed to connect to core service, can not manage topology!\n" 7094msgid "Failed to connect to core service, can not manage topology!\n"
7168msgstr "" 7095msgstr ""
7169"ÐиÑам уÑпео да Ñе повежем Ñа уÑлугом језгра, не могу да радим размештајем!\n" 7096"ÐиÑам уÑпео да Ñе повежем Ñа уÑлугом језгра, не могу да радим размештајем!\n"
7170 7097
7171#: src/service/topology/gnunet-daemon-topology.c:943 7098#: src/service/topology/gnunet-daemon-topology.c:938
7172msgid "# HELLO messages received" 7099msgid "# HELLO messages received"
7173msgstr "# „HELLO“ поруке Ñу примљене" 7100msgstr "# „HELLO“ поруке Ñу примљене"
7174 7101
7175#: src/service/topology/gnunet-daemon-topology.c:1095 7102#: src/service/topology/gnunet-daemon-topology.c:1091
7176msgid "GNUnet topology control" 7103msgid "GNUnet topology control"
7177msgstr "" 7104msgstr ""
7178 7105
7179#: src/service/transport/gnunet-communicator-quic.c:1717 7106#: src/service/transport/gnunet-communicator-quic.c:1717
7180#: src/service/transport/gnunet-communicator-tcp.c:3777 7107#: src/service/transport/gnunet-communicator-tcp.c:3814
7181#: src/service/transport/gnunet-communicator-udp.c:3408 7108#: src/service/transport/gnunet-communicator-udp.c:3579
7182#: src/service/transport/gnunet-service-transport.c:12128 7109#: src/service/transport/gnunet-service-transport.c:12543
7183msgid "Transport service is lacking key configuration settings. Exiting.\n" 7110msgid "Transport service is lacking key configuration settings. Exiting.\n"
7184msgstr "УÑлузи преноÑа недоÑтају поÑтавке подешавања кључа. Излазим.\n" 7111msgstr "УÑлузи преноÑа недоÑтају поÑтавке подешавања кључа. Излазим.\n"
7185 7112
@@ -7187,11 +7114,11 @@ msgstr "УÑлузи преноÑа недоÑтају поÑтавке поде
7187msgid "GNUnet QUIC communicator" 7114msgid "GNUnet QUIC communicator"
7188msgstr "" 7115msgstr ""
7189 7116
7190#: src/service/transport/gnunet-communicator-tcp.c:4114 7117#: src/service/transport/gnunet-communicator-tcp.c:4171
7191msgid "GNUnet TCP communicator" 7118msgid "GNUnet TCP communicator"
7192msgstr "" 7119msgstr ""
7193 7120
7194#: src/service/transport/gnunet-communicator-udp.c:3483 7121#: src/service/transport/gnunet-communicator-udp.c:3654
7195msgid "GNUnet UDP communicator" 7122msgid "GNUnet UDP communicator"
7196msgstr "" 7123msgstr ""
7197 7124
@@ -7370,7 +7297,7 @@ msgstr "шаље податке за оцењивање другим парњаÑ
7370msgid "Direct access to transport service." 7297msgid "Direct access to transport service."
7371msgstr "ÐепоÑредан приÑтуп уÑлузи преноÑа." 7298msgstr "ÐепоÑредан приÑтуп уÑлузи преноÑа."
7372 7299
7373#: src/service/transport/transport_api2_communication.c:765 7300#: src/service/transport/transport_api2_communication.c:773
7374msgid "Dropped backchanel message: handler not provided by communicator\n" 7301msgid "Dropped backchanel message: handler not provided by communicator\n"
7375msgstr "" 7302msgstr ""
7376 7303
@@ -7495,6 +7422,88 @@ msgstr "ÐиÑам уÑпео да реплицирам блок у оÑтави
7495msgid "Failed to connect to the namestore!\n" 7422msgid "Failed to connect to the namestore!\n"
7496msgstr "ÐиÑам уÑпео да Ñе повежем Ñа Ñмештајем назива!\n" 7423msgstr "ÐиÑам уÑпео да Ñе повежем Ñа Ñмештајем назива!\n"
7497 7424
7425#, c-format
7426#~ msgid "Could not extract hostkey %u (offset too large?)\n"
7427#~ msgstr "Ðе могу да извучем кључ домаћина %u (померај је превелик?)\n"
7428
7429#, c-format
7430#~ msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
7431#~ msgstr ""
7432#~ "Ðепозната наредба, кориÑтите „q“ да прекинете или „r“ да поново покренете "
7433#~ "парњака\n"
7434
7435#~ msgid "create unique configuration files"
7436#~ msgstr "Ñтвара јединÑтвене датотеке подешавања"
7437
7438#~ msgid "extract hostkey file from pre-computed hostkey list"
7439#~ msgstr ""
7440#~ "извлачи датотеку кључа доамћина из унапред прорачунатог ÑпиÑка кључа "
7441#~ "домаћина"
7442
7443#~ msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"
7444#~ msgstr ""
7445#~ "покреће дату уÑлугу, чека на Ñтандардном улазу за „r“ (поновно покретање) "
7446#~ "или „q“ (излази)"
7447
7448#~ msgid "list COUNT number of keys"
7449#~ msgstr "иÑпиÑује УКУПÐОСТ број парњака"
7450
7451#, c-format
7452#~ msgid "Hostkeys file not found: %s\n"
7453#~ msgstr "ÐиÑам нашао датотеку кључева домаћина: %s\n"
7454
7455#, c-format
7456#~ msgid "Key number %u does not exist\n"
7457#~ msgstr "Број кључа %u не поÑтоји\n"
7458
7459#, c-format
7460#~ msgid ""
7461#~ "You attempted to create a testbed with more than %u hosts. Please "
7462#~ "precompute more hostkeys first.\n"
7463#~ msgstr ""
7464#~ "Покушали Ñте да направите пробно меÑто Ñа више од %u домаћина. Прво пре "
7465#~ "Ñвега израчунајте више кључева домаћина.\n"
7466
7467#, c-format
7468#~ msgid "Failed to initialize hostkey for peer %u\n"
7469#~ msgstr "ÐиÑам уÑпео да покренем кључ домаћина за парњака %u\n"
7470
7471#~ msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
7472#~ msgstr "опција „PRIVATE_KEY“ у одељку „PEER“ недоÑтаје у подешавањима\n"
7473
7474#~ msgid "Failed to create configuration for peer (not enough free ports?)\n"
7475#~ msgstr ""
7476#~ "ÐиÑам уÑпео да направим подешавање за парњака (нема довољно Ñлободних "
7477#~ "прикључника?)\n"
7478
7479#, c-format
7480#~ msgid "Cannot open hostkey file `%s': %s\n"
7481#~ msgstr "Ðе могу да отворим датотеку кључа домаћина „%s“: %s\n"
7482
7483#, c-format
7484#~ msgid "Failed to write hostkey file for peer %u: %s\n"
7485#~ msgstr "ÐиÑам уÑпео да запишем датотеку кључа домаћина за парњака %u: %s\n"
7486
7487#, c-format
7488#~ msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7489#~ msgstr "ÐиÑам уÑпео да запишем датотеку подешавања „%s“ за парњака %u: %s\n"
7490
7491#, c-format
7492#~ msgid "Failed to load configuration from %s\n"
7493#~ msgstr "ÐиÑам уÑпео да учитам подешавање за „%s“\n"
7494
7495#, c-format
7496#~ msgid "Topology file %s not found\n"
7497#~ msgstr "ÐиÑам нашао датотеку размештаја „%s“\n"
7498
7499#, c-format
7500#~ msgid "Topology file %s has no data\n"
7501#~ msgstr "Датотека размештаја „%s“ нема података\n"
7502
7503#, c-format
7504#~ msgid "Topology file %s cannot be read\n"
7505#~ msgstr "Ðе могу да прочитам датотеку размештаја „%s“\n"
7506
7498#, fuzzy, c-format 7507#, fuzzy, c-format
7499#~ msgid "" 7508#~ msgid ""
7500#~ "Local peer: %s\n" 7509#~ "Local peer: %s\n"
@@ -9275,10 +9284,6 @@ msgstr "ÐиÑам уÑпео да Ñе повежем Ñа Ñмештајем Ð
9275#~ msgstr "вредноÑÑ‚ за поÑтављање" 9284#~ msgstr "вредноÑÑ‚ за поÑтављање"
9276 9285
9277#, fuzzy 9286#, fuzzy
9278#~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n"
9279#~ msgstr "Лоша датотека подешавања „%s“, излазим ...\n"
9280
9281#, fuzzy
9282#~ msgid "Unreadable or malformed configuration, exit ...\n" 9287#~ msgid "Unreadable or malformed configuration, exit ...\n"
9283#~ msgstr "Лоше подешавање, излазим ...\n" 9288#~ msgstr "Лоше подешавање, излазим ...\n"
9284 9289
diff --git a/po/sv.po b/po/sv.po
index 32f9e5b9f..46ebace36 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -7,7 +7,7 @@ msgid ""
7msgstr "" 7msgstr ""
8"Project-Id-Version: GNUnet 0.7.0b\n" 8"Project-Id-Version: GNUnet 0.7.0b\n"
9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
10"POT-Creation-Date: 2024-03-02 14:38+0100\n" 10"POT-Creation-Date: 2024-05-20 20:21+0200\n"
11"PO-Revision-Date: 2006-01-21 17:16+0100\n" 11"PO-Revision-Date: 2006-01-21 17:16+0100\n"
12"Last-Translator: Daniel Nylander <po@danielnylander.se>\n" 12"Last-Translator: Daniel Nylander <po@danielnylander.se>\n"
13"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" 13"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
@@ -349,21 +349,26 @@ msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
349msgid "Failed to connect to CORE service!\n" 349msgid "Failed to connect to CORE service!\n"
350msgstr "Misslyckades att ansluta till gnunetd.\n" 350msgstr "Misslyckades att ansluta till gnunetd.\n"
351 351
352#: src/cli/core/gnunet-core.c:230 src/service/transport/gnunet-transport.c:1389 352#: src/cli/core/gnunet-core.c:213
353#, fuzzy
354msgid "No argument given.\n"
355msgstr "# byte mottogs via TCP"
356
357#: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389
353#, fuzzy 358#, fuzzy
354msgid "provide information about all current connections (continuously)" 359msgid "provide information about all current connections (continuously)"
355msgstr "Skriv ut information om GNUnets motparter." 360msgstr "Skriv ut information om GNUnets motparter."
356 361
357#: src/cli/core/gnunet-core.c:236 362#: src/cli/core/gnunet-core.c:244
358msgid "Show our current peer identity" 363msgid "Show our current peer identity"
359msgstr "" 364msgstr ""
360 365
361#: src/cli/core/gnunet-core.c:243 366#: src/cli/core/gnunet-core.c:251
362#, fuzzy 367#, fuzzy
363msgid "Show current connections" 368msgid "Show current connections"
364msgstr "Nätverksanslutning" 369msgstr "Nätverksanslutning"
365 370
366#: src/cli/core/gnunet-core.c:254 371#: src/cli/core/gnunet-core.c:262
367#, fuzzy 372#, fuzzy
368msgid "Print information about connected peers." 373msgid "Print information about connected peers."
369msgstr "Skriv ut information om GNUnets motparter." 374msgstr "Skriv ut information om GNUnets motparter."
@@ -1076,54 +1081,54 @@ msgstr "Kunde inte komma åt namnrymdsinformation.\n"
1076msgid "Unindex a file that was previously indexed with gnunet-publish." 1081msgid "Unindex a file that was previously indexed with gnunet-publish."
1077msgstr "" 1082msgstr ""
1078 1083
1079#: src/cli/gns/gnunet-gns.c:268 1084#: src/cli/gns/gnunet-gns.c:269
1080#, fuzzy, c-format 1085#, fuzzy, c-format
1081msgid "`%s' is not a valid DNS domain name\n" 1086msgid "`%s' is not a valid DNS domain name\n"
1082msgstr "\"%s\" är inte tillgänglig." 1087msgstr "\"%s\" är inte tillgänglig."
1083 1088
1084#: src/cli/gns/gnunet-gns.c:279 src/lib/util/dnsparser.c:273 1089#: src/cli/gns/gnunet-gns.c:280 src/lib/util/dnsparser.c:273
1085#, fuzzy, c-format 1090#, fuzzy, c-format
1086msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" 1091msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
1087msgstr "Misslyckades att leverera \"%s\" meddelande.\n" 1092msgstr "Misslyckades att leverera \"%s\" meddelande.\n"
1088 1093
1089#: src/cli/gns/gnunet-gns.c:294 1094#: src/cli/gns/gnunet-gns.c:295
1090msgid "Cannot resolve using GNS: GNUnet peer not running\n" 1095msgid "Cannot resolve using GNS: GNUnet peer not running\n"
1091msgstr "" 1096msgstr ""
1092 1097
1093#: src/cli/gns/gnunet-gns.c:305 1098#: src/cli/gns/gnunet-gns.c:306
1094#: src/contrib/service/abd/gnunet-service-abd.c:1745 1099#: src/contrib/service/abd/gnunet-service-abd.c:1745
1095#, fuzzy, c-format 1100#, fuzzy, c-format
1096msgid "Failed to connect to GNS\n" 1101msgid "Failed to connect to GNS\n"
1097msgstr "Misslyckades att ansluta till gnunetd.\n" 1102msgstr "Misslyckades att ansluta till gnunetd.\n"
1098 1103
1099#: src/cli/gns/gnunet-gns.c:318 1104#: src/cli/gns/gnunet-gns.c:325
1100#, c-format 1105#, c-format
1101msgid "Invalid typename specified, assuming `ANY'\n" 1106msgid "Invalid typename specified, assuming `ANY'\n"
1102msgstr "" 1107msgstr ""
1103 1108
1104#: src/cli/gns/gnunet-gns.c:358 1109#: src/cli/gns/gnunet-gns.c:365
1105msgid "Lookup a record for the given name" 1110msgid "Lookup a record for the given name"
1106msgstr "" 1111msgstr ""
1107 1112
1108#: src/cli/gns/gnunet-gns.c:364 1113#: src/cli/gns/gnunet-gns.c:371
1109#, fuzzy 1114#, fuzzy
1110msgid "Specify the type of the record to lookup" 1115msgid "Specify the type of the record to lookup"
1111msgstr "ange prioritet för innehållet" 1116msgstr "ange prioritet för innehållet"
1112 1117
1113#: src/cli/gns/gnunet-gns.c:370 1118#: src/cli/gns/gnunet-gns.c:377
1114#, fuzzy 1119#, fuzzy
1115msgid "Specify a timeout for the lookup" 1120msgid "Specify a timeout for the lookup"
1116msgstr "ange prioritet för innehållet" 1121msgstr "ange prioritet för innehållet"
1117 1122
1118#: src/cli/gns/gnunet-gns.c:374 1123#: src/cli/gns/gnunet-gns.c:381
1119msgid "No unneeded output" 1124msgid "No unneeded output"
1120msgstr "" 1125msgstr ""
1121 1126
1122#: src/cli/gns/gnunet-gns.c:379 1127#: src/cli/gns/gnunet-gns.c:386
1123msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" 1128msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
1124msgstr "" 1129msgstr ""
1125 1130
1126#: src/cli/gns/gnunet-gns.c:393 1131#: src/cli/gns/gnunet-gns.c:400
1127#, fuzzy 1132#, fuzzy
1128msgid "GNUnet GNS resolver tool" 1133msgid "GNUnet GNS resolver tool"
1129msgstr "Spåra GNUnets nätverkstopologi." 1134msgstr "Spåra GNUnets nätverkstopologi."
@@ -1654,7 +1659,11 @@ msgstr ""
1654msgid "GNUnet NAT traversal autoconfigure daemon" 1659msgid "GNUnet NAT traversal autoconfigure daemon"
1655msgstr "" 1660msgstr ""
1656 1661
1657#: src/cli/nse/gnunet-nse.c:124 1662#: src/cli/nse/gnunet-nse.c:126
1663msgid "Monitor and output current estimates"
1664msgstr ""
1665
1666#: src/cli/nse/gnunet-nse.c:137
1658#, fuzzy 1667#, fuzzy
1659msgid "Show network size estimates from NSE service." 1668msgid "Show network size estimates from NSE service."
1660msgstr "# byte mottogs via TCP" 1669msgstr "# byte mottogs via TCP"
@@ -1703,87 +1712,91 @@ msgstr ""
1703msgid "The time until the DID Document is going to expire (e.g. 5d)" 1712msgid "The time until the DID Document is going to expire (e.g. 5d)"
1704msgstr "" 1713msgstr ""
1705 1714
1706#: src/cli/reclaim/gnunet-reclaim.c:805 1715#: src/cli/reclaim/gnunet-reclaim.c:813
1707#, fuzzy, c-format 1716#, fuzzy, c-format
1708msgid "Ego is required\n" 1717msgid "Ego is required\n"
1709msgstr "%s: flagga \"%s\" är tvetydig\n" 1718msgstr "%s: flagga \"%s\" är tvetydig\n"
1710 1719
1711#: src/cli/reclaim/gnunet-reclaim.c:812 1720#: src/cli/reclaim/gnunet-reclaim.c:820
1712#, c-format 1721#, c-format
1713msgid "Attribute value missing!\n" 1722msgid "Attribute value missing!\n"
1714msgstr "" 1723msgstr ""
1715 1724
1716#: src/cli/reclaim/gnunet-reclaim.c:819 1725#: src/cli/reclaim/gnunet-reclaim.c:827
1717#, fuzzy, c-format 1726#, fuzzy, c-format
1718msgid "Requesting party key is required!\n" 1727msgid "Requesting party key is required!\n"
1719msgstr "%s: flagga \"%s\" är tvetydig\n" 1728msgstr "%s: flagga \"%s\" är tvetydig\n"
1720 1729
1721#: src/cli/reclaim/gnunet-reclaim.c:837 1730#: src/cli/reclaim/gnunet-reclaim.c:846
1722msgid "Add or update an attribute NAME" 1731msgid "Add or update an attribute NAME"
1723msgstr "" 1732msgstr ""
1724 1733
1725#: src/cli/reclaim/gnunet-reclaim.c:842 1734#: src/cli/reclaim/gnunet-reclaim.c:851
1726msgid "Delete the attribute with ID" 1735msgid "Delete the attribute with ID"
1727msgstr "" 1736msgstr ""
1728 1737
1729#: src/cli/reclaim/gnunet-reclaim.c:847 1738#: src/cli/reclaim/gnunet-reclaim.c:856
1730msgid "The attribute VALUE" 1739msgid "The attribute VALUE"
1731msgstr "" 1740msgstr ""
1732 1741
1733#: src/cli/reclaim/gnunet-reclaim.c:852 1742#: src/cli/reclaim/gnunet-reclaim.c:861
1734#, fuzzy 1743#, fuzzy
1735msgid "The EGO to use" 1744msgid "The EGO to use"
1736msgstr "meddelandestorlek" 1745msgstr "meddelandestorlek"
1737 1746
1738#: src/cli/reclaim/gnunet-reclaim.c:858 1747#: src/cli/reclaim/gnunet-reclaim.c:867
1739msgid "Specify the relying party for issue" 1748msgid "Specify the relying party for issue"
1740msgstr "" 1749msgstr ""
1741 1750
1742#: src/cli/reclaim/gnunet-reclaim.c:862 1751#: src/cli/reclaim/gnunet-reclaim.c:873
1752msgid "Specify the relying party URI for a ticket to consume"
1753msgstr ""
1754
1755#: src/cli/reclaim/gnunet-reclaim.c:877
1743msgid "List attributes for EGO" 1756msgid "List attributes for EGO"
1744msgstr "" 1757msgstr ""
1745 1758
1746#: src/cli/reclaim/gnunet-reclaim.c:866 1759#: src/cli/reclaim/gnunet-reclaim.c:881
1747msgid "List credentials for EGO" 1760msgid "List credentials for EGO"
1748msgstr "" 1761msgstr ""
1749 1762
1750#: src/cli/reclaim/gnunet-reclaim.c:872 1763#: src/cli/reclaim/gnunet-reclaim.c:887
1751msgid "Credential to use for attribute" 1764msgid "Credential to use for attribute"
1752msgstr "" 1765msgstr ""
1753 1766
1754#: src/cli/reclaim/gnunet-reclaim.c:877 1767#: src/cli/reclaim/gnunet-reclaim.c:892
1755msgid "Credential name" 1768msgid "Credential name"
1756msgstr "" 1769msgstr ""
1757 1770
1758#: src/cli/reclaim/gnunet-reclaim.c:883 1771#: src/cli/reclaim/gnunet-reclaim.c:898
1759msgid "Issue a ticket for a set of attributes separated by comma" 1772msgid "Issue a ticket for a set of attributes separated by comma"
1760msgstr "" 1773msgstr ""
1761 1774
1762#: src/cli/reclaim/gnunet-reclaim.c:888 1775#: src/cli/reclaim/gnunet-reclaim.c:903
1763msgid "Consume a ticket" 1776msgid "Consume a ticket"
1764msgstr "" 1777msgstr ""
1765 1778
1766#: src/cli/reclaim/gnunet-reclaim.c:893 1779#: src/cli/reclaim/gnunet-reclaim.c:908
1767msgid "Revoke a ticket" 1780msgid "Revoke a ticket"
1768msgstr "" 1781msgstr ""
1769 1782
1770#: src/cli/reclaim/gnunet-reclaim.c:898 1783#: src/cli/reclaim/gnunet-reclaim.c:913
1771msgid "Type of attribute" 1784msgid "Type of attribute"
1772msgstr "" 1785msgstr ""
1773 1786
1774#: src/cli/reclaim/gnunet-reclaim.c:903 1787#: src/cli/reclaim/gnunet-reclaim.c:918
1775msgid "Type of credential" 1788msgid "Type of credential"
1776msgstr "" 1789msgstr ""
1777 1790
1778#: src/cli/reclaim/gnunet-reclaim.c:907 1791#: src/cli/reclaim/gnunet-reclaim.c:922
1779msgid "List tickets of ego" 1792msgid "List tickets of ego"
1780msgstr "" 1793msgstr ""
1781 1794
1782#: src/cli/reclaim/gnunet-reclaim.c:913 1795#: src/cli/reclaim/gnunet-reclaim.c:928
1783msgid "Expiration interval of the attribute" 1796msgid "Expiration interval of the attribute"
1784msgstr "" 1797msgstr ""
1785 1798
1786#: src/cli/reclaim/gnunet-reclaim.c:921 1799#: src/cli/reclaim/gnunet-reclaim.c:936
1787msgid "re:claimID command line tool" 1800msgid "re:claimID command line tool"
1788msgstr "" 1801msgstr ""
1789 1802
@@ -2022,34 +2035,59 @@ msgstr "Skriv ut statistik om GNUnet-operationer."
2022msgid "run decoder modus, otherwise runs as encoder" 2035msgid "run decoder modus, otherwise runs as encoder"
2023msgstr "" 2036msgstr ""
2024 2037
2025#: src/cli/util/gnunet-config.c:154 2038#: src/cli/util/gnunet-config.c:101
2026msgid "test if the current installation supports the specified BACKEND" 2039msgid "test if the current installation supports the specified BACKEND"
2027msgstr "" 2040msgstr ""
2028 2041
2029#: src/cli/util/gnunet-config.c:160 2042#: src/cli/util/gnunet-config.c:107
2030msgid "" 2043msgid ""
2031"Provide an appropriate value for CFLAGS to applications building on top of " 2044"Provide an appropriate value for CFLAGS to applications building on top of "
2032"GNUnet" 2045"GNUnet"
2033msgstr "" 2046msgstr ""
2034 2047
2035#: src/cli/util/gnunet-config.c:165 2048#: src/cli/util/gnunet-config.c:112
2036msgid "Is this an experimental build of GNUnet" 2049msgid "Is this an experimental build of GNUnet"
2037msgstr "" 2050msgstr ""
2038 2051
2039#: src/cli/util/gnunet-config.c:171 2052#: src/cli/util/gnunet-config.c:118
2040msgid "" 2053msgid ""
2041"Provide an appropriate value for LIBS to applications building on top of " 2054"Provide an appropriate value for LIBS to applications building on top of "
2042"GNUnet" 2055"GNUnet"
2043msgstr "" 2056msgstr ""
2044 2057
2045#: src/cli/util/gnunet-config.c:177 2058#: src/cli/util/gnunet-config.c:123
2059#, fuzzy
2060msgid "Do not parse default configuration files"
2061msgstr "skriv ut ett värde från konfigurationsfilen till standard ut"
2062
2063#: src/cli/util/gnunet-config.c:129
2046msgid "Provide the path under which GNUnet was installed" 2064msgid "Provide the path under which GNUnet was installed"
2047msgstr "" 2065msgstr ""
2048 2066
2049#: src/cli/util/gnunet-config.c:192 2067#: src/cli/util/gnunet-config.c:136
2068msgid ""
2069"Parse main configuration from this command-line argument and not from disk"
2070msgstr ""
2071
2072#: src/cli/util/gnunet-config.c:225
2050#, fuzzy 2073#, fuzzy
2051msgid "Manipulate GNUnet configuration files" 2074msgid "Failed to load default configuration, exiting ...\n"
2052msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" 2075msgstr "Kunde inte spara konfigurationsfil \"%s\":"
2076
2077#: src/cli/util/gnunet-config.c:237
2078#, fuzzy
2079msgid "Failed to parse configuration, exiting ...\n"
2080msgstr "Kunde inte spara konfigurationsfil \"%s\":"
2081
2082#: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287
2083#, fuzzy, c-format
2084msgid "Unreadable configuration file `%s', exiting ...\n"
2085msgstr "Kunde inte spara konfigurationsfil \"%s\":"
2086
2087#: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299
2088#, fuzzy, c-format
2089msgid "Malformed configuration file `%s', exiting ...\n"
2090msgstr "Kunde inte spara konfigurationsfil \"%s\":"
2053 2091
2054#: src/cli/util/gnunet-crypto-tvg.c:1588 2092#: src/cli/util/gnunet-crypto-tvg.c:1588
2055msgid "verify a test vector from stdin" 2093msgid "verify a test vector from stdin"
@@ -2096,55 +2134,54 @@ msgstr ""
2096msgid "Hostkeys file `%s' not found\n" 2134msgid "Hostkeys file `%s' not found\n"
2097msgstr "\"%s\" misslyckades: tabell hittades inte!\n" 2135msgstr "\"%s\" misslyckades: tabell hittades inte!\n"
2098 2136
2099#: src/cli/util/gnunet-ecc.c:314 2137#: src/cli/util/gnunet-ecc.c:318
2100#, fuzzy, c-format 2138#, fuzzy, c-format
2101msgid "Hostkeys file `%s' is empty\n" 2139msgid "Hostkeys file `%s' is empty\n"
2102msgstr "antal meddelanden att använda per iteration" 2140msgstr "antal meddelanden att använda per iteration"
2103 2141
2104#: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 2142#: src/cli/util/gnunet-ecc.c:324
2105#: src/service/testing/testing.c:308
2106#, c-format 2143#, c-format
2107msgid "Incorrect hostkey file format: %s\n" 2144msgid "Incorrect hostkey file format: %s\n"
2108msgstr "" 2145msgstr ""
2109 2146
2110#: src/cli/util/gnunet-ecc.c:334 2147#: src/cli/util/gnunet-ecc.c:340
2111#, fuzzy, c-format 2148#, fuzzy, c-format
2112msgid "Could not read hostkey file: %s\n" 2149msgid "Could not read hostkey file: %s\n"
2113msgstr "Kunde inte skapa värdnyckel!\n" 2150msgstr "Kunde inte skapa värdnyckel!\n"
2114 2151
2115#: src/cli/util/gnunet-ecc.c:388 2152#: src/cli/util/gnunet-ecc.c:394
2116msgid "No hostkey file specified on command line\n" 2153msgid "No hostkey file specified on command line\n"
2117msgstr "" 2154msgstr ""
2118 2155
2119#: src/cli/util/gnunet-ecc.c:452 2156#: src/cli/util/gnunet-ecc.c:458
2120msgid "list keys included in a file (for testing)" 2157msgid "list keys included in a file (for testing)"
2121msgstr "" 2158msgstr ""
2122 2159
2123#: src/cli/util/gnunet-ecc.c:458 2160#: src/cli/util/gnunet-ecc.c:464
2124msgid "number of keys to list included in a file (for testing)" 2161msgid "number of keys to list included in a file (for testing)"
2125msgstr "" 2162msgstr ""
2126 2163
2127#: src/cli/util/gnunet-ecc.c:464 2164#: src/cli/util/gnunet-ecc.c:470
2128msgid "create COUNT public-private key pairs (for testing)" 2165msgid "create COUNT public-private key pairs (for testing)"
2129msgstr "" 2166msgstr ""
2130 2167
2131#: src/cli/util/gnunet-ecc.c:469 2168#: src/cli/util/gnunet-ecc.c:475
2132msgid "print the public key in ASCII format" 2169msgid "print the public key in ASCII format"
2133msgstr "" 2170msgstr ""
2134 2171
2135#: src/cli/util/gnunet-ecc.c:474 2172#: src/cli/util/gnunet-ecc.c:480
2136msgid "print the private key in ASCII format" 2173msgid "print the private key in ASCII format"
2137msgstr "" 2174msgstr ""
2138 2175
2139#: src/cli/util/gnunet-ecc.c:479 2176#: src/cli/util/gnunet-ecc.c:485
2140msgid "print the public key in HEX format" 2177msgid "print the public key in HEX format"
2141msgstr "" 2178msgstr ""
2142 2179
2143#: src/cli/util/gnunet-ecc.c:485 2180#: src/cli/util/gnunet-ecc.c:491
2144msgid "print examples of ECC operations (used for compatibility testing)" 2181msgid "print examples of ECC operations (used for compatibility testing)"
2145msgstr "" 2182msgstr ""
2146 2183
2147#: src/cli/util/gnunet-ecc.c:499 2184#: src/cli/util/gnunet-ecc.c:505
2148#, fuzzy 2185#, fuzzy
2149msgid "Manipulate GNUnet private ECC key files" 2186msgid "Manipulate GNUnet private ECC key files"
2150msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" 2187msgstr "skriv ut ett värde från konfigurationsfilen till standard ut"
@@ -3236,13 +3273,13 @@ msgstr ""
3236msgid "Invalid handle type while writing `%s'" 3273msgid "Invalid handle type while writing `%s'"
3237msgstr "Ogiltigt format för IP: \"%s\"\n" 3274msgstr "Ogiltigt format för IP: \"%s\"\n"
3238 3275
3239#: src/lib/util/client.c:531 src/lib/util/service.c:1134 3276#: src/lib/util/client.c:531 src/lib/util/service.c:1139
3240#: src/service/arm/gnunet-service-arm.c:452 3277#: src/service/arm/gnunet-service-arm.c:452
3241#, c-format 3278#, c-format
3242msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 3279msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
3243msgstr "" 3280msgstr ""
3244 3281
3245#: src/lib/util/client.c:536 src/lib/util/service.c:1138 3282#: src/lib/util/client.c:536 src/lib/util/service.c:1143
3246#: src/service/arm/gnunet-service-arm.c:456 3283#: src/service/arm/gnunet-service-arm.c:456
3247#, fuzzy, c-format 3284#, fuzzy, c-format
3248msgid "Using `%s' instead\n" 3285msgid "Using `%s' instead\n"
@@ -3371,17 +3408,17 @@ msgstr ""
3371msgid "`%s' failed at %s:%d with error: %s\n" 3408msgid "`%s' failed at %s:%d with error: %s\n"
3372msgstr "\"%s\" misslyckades vid %s:%d med fel: %s\n" 3409msgstr "\"%s\" misslyckades vid %s:%d med fel: %s\n"
3373 3410
3374#: src/lib/util/crypto_ecc.c:554 3411#: src/lib/util/crypto_ecc.c:569
3375#, fuzzy, c-format 3412#, fuzzy, c-format
3376msgid "ECC signing failed at %s:%d: %s\n" 3413msgid "ECC signing failed at %s:%d: %s\n"
3377msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" 3414msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n"
3378 3415
3379#: src/lib/util/crypto_ecc.c:677 3416#: src/lib/util/crypto_ecc.c:692
3380#, fuzzy, c-format 3417#, fuzzy, c-format
3381msgid "ECDSA signature verification failed at %s:%d: %s\n" 3418msgid "ECDSA signature verification failed at %s:%d: %s\n"
3382msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" 3419msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n"
3383 3420
3384#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:304 3421#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:305
3385#, fuzzy 3422#, fuzzy
3386msgid "Could not load peer's private key\n" 3423msgid "Could not load peer's private key\n"
3387msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n" 3424msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n"
@@ -3406,7 +3443,7 @@ msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n"
3406msgid "Expected `%s' to be a directory!\n" 3443msgid "Expected `%s' to be a directory!\n"
3407msgstr "\"%s\" förväntade att \"%s\" skulle vara en katalog!\n" 3444msgstr "\"%s\" förväntade att \"%s\" skulle vara en katalog!\n"
3408 3445
3409#: src/lib/util/disk.c:1222 src/lib/util/service.c:1642 3446#: src/lib/util/disk.c:1222 src/lib/util/service.c:1651
3410#, fuzzy, c-format 3447#, fuzzy, c-format
3411msgid "Cannot obtain information about user `%s': %s\n" 3448msgid "Cannot obtain information about user `%s': %s\n"
3412msgstr "Kan inte öppna konfigurationsfil \"%s\".\n" 3449msgstr "Kan inte öppna konfigurationsfil \"%s\".\n"
@@ -3599,98 +3636,98 @@ msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n"
3599msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 3636msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
3600msgstr "" 3637msgstr ""
3601 3638
3602#: src/lib/util/gnunet_error_codes.c:60 3639#: src/lib/util/gnunet_error_codes.c:59
3603msgid "No error (success)." 3640msgid "No error (success)."
3604msgstr "" 3641msgstr ""
3605 3642
3606#: src/lib/util/gnunet_error_codes.c:66 3643#: src/lib/util/gnunet_error_codes.c:65
3607#, fuzzy 3644#, fuzzy
3608msgid "Unknown and unspecified error." 3645msgid "Unknown and unspecified error."
3609msgstr "Okänt fel" 3646msgstr "Okänt fel"
3610 3647
3611#: src/lib/util/gnunet_error_codes.c:72 3648#: src/lib/util/gnunet_error_codes.c:71
3612#, fuzzy 3649#, fuzzy
3613msgid "Communication with service failed." 3650msgid "Communication with service failed."
3614msgstr "Skriv ut information om GNUnets motparter." 3651msgstr "Skriv ut information om GNUnets motparter."
3615 3652
3616#: src/lib/util/gnunet_error_codes.c:78 3653#: src/lib/util/gnunet_error_codes.c:77
3617#, fuzzy 3654#, fuzzy
3618msgid "Ego not found." 3655msgid "Ego not found."
3619msgstr "Kommando \"%s\" hittades inte!\n" 3656msgstr "Kommando \"%s\" hittades inte!\n"
3620 3657
3621#: src/lib/util/gnunet_error_codes.c:84 3658#: src/lib/util/gnunet_error_codes.c:83
3622msgid "Identifier already in use for another ego." 3659msgid "Identifier already in use for another ego."
3623msgstr "" 3660msgstr ""
3624 3661
3625#: src/lib/util/gnunet_error_codes.c:90 3662#: src/lib/util/gnunet_error_codes.c:89
3626msgid "The given ego is invalid or malformed." 3663msgid "The given ego is invalid or malformed."
3627msgstr "" 3664msgstr ""
3628 3665
3629#: src/lib/util/gnunet_error_codes.c:96 3666#: src/lib/util/gnunet_error_codes.c:95
3630#, fuzzy 3667#, fuzzy
3631msgid "Unknown namestore error." 3668msgid "Unknown namestore error."
3632msgstr "Okänt fel" 3669msgstr "Okänt fel"
3633 3670
3634#: src/lib/util/gnunet_error_codes.c:102 src/lib/util/gnunet_error_codes.c:120 3671#: src/lib/util/gnunet_error_codes.c:101 src/lib/util/gnunet_error_codes.c:119
3635#, fuzzy 3672#, fuzzy
3636msgid "Zone iteration failed." 3673msgid "Zone iteration failed."
3637msgstr "# sessionsnycklar accepterade" 3674msgstr "# sessionsnycklar accepterade"
3638 3675
3639#: src/lib/util/gnunet_error_codes.c:108 3676#: src/lib/util/gnunet_error_codes.c:107
3640#, fuzzy 3677#, fuzzy
3641msgid "Zone not found." 3678msgid "Zone not found."
3642msgstr "Kommando \"%s\" hittades inte!\n" 3679msgstr "Kommando \"%s\" hittades inte!\n"
3643 3680
3644#: src/lib/util/gnunet_error_codes.c:114 3681#: src/lib/util/gnunet_error_codes.c:113
3645#, fuzzy 3682#, fuzzy
3646msgid "Record not found." 3683msgid "Record not found."
3647msgstr "Kommando \"%s\" hittades inte!\n" 3684msgstr "Kommando \"%s\" hittades inte!\n"
3648 3685
3649#: src/lib/util/gnunet_error_codes.c:126 3686#: src/lib/util/gnunet_error_codes.c:125
3650msgid "Zone does not contain any records." 3687msgid "Zone does not contain any records."
3651msgstr "" 3688msgstr ""
3652 3689
3653#: src/lib/util/gnunet_error_codes.c:132 3690#: src/lib/util/gnunet_error_codes.c:131
3654#, fuzzy 3691#, fuzzy
3655msgid "Failed to lookup record." 3692msgid "Failed to lookup record."
3656msgstr "Misslyckades att starta samling.\n" 3693msgstr "Misslyckades att starta samling.\n"
3657 3694
3658#: src/lib/util/gnunet_error_codes.c:138 3695#: src/lib/util/gnunet_error_codes.c:137
3659#, fuzzy 3696#, fuzzy
3660msgid "No records given." 3697msgid "No records given."
3661msgstr "Skriv ut information om GNUnets motparter." 3698msgstr "Skriv ut information om GNUnets motparter."
3662 3699
3663#: src/lib/util/gnunet_error_codes.c:144 3700#: src/lib/util/gnunet_error_codes.c:143
3664msgid "Record data invalid." 3701msgid "Record data invalid."
3665msgstr "" 3702msgstr ""
3666 3703
3667#: src/lib/util/gnunet_error_codes.c:150 3704#: src/lib/util/gnunet_error_codes.c:149
3668msgid "No label given." 3705msgid "No label given."
3669msgstr "" 3706msgstr ""
3670 3707
3671#: src/lib/util/gnunet_error_codes.c:156 3708#: src/lib/util/gnunet_error_codes.c:155
3672#, fuzzy 3709#, fuzzy
3673msgid "No results given." 3710msgid "No results given."
3674msgstr "# byte mottogs via TCP" 3711msgstr "# byte mottogs via TCP"
3675 3712
3676#: src/lib/util/gnunet_error_codes.c:162 3713#: src/lib/util/gnunet_error_codes.c:161
3677msgid "Record already exists." 3714msgid "Record already exists."
3678msgstr "" 3715msgstr ""
3679 3716
3680#: src/lib/util/gnunet_error_codes.c:168 3717#: src/lib/util/gnunet_error_codes.c:167
3681msgid "Record size exceeds maximum limit." 3718msgid "Record size exceeds maximum limit."
3682msgstr "" 3719msgstr ""
3683 3720
3684#: src/lib/util/gnunet_error_codes.c:174 3721#: src/lib/util/gnunet_error_codes.c:173
3685msgid "There was an error in the database backend." 3722msgid "There was an error in the database backend."
3686msgstr "" 3723msgstr ""
3687 3724
3688#: src/lib/util/gnunet_error_codes.c:180 3725#: src/lib/util/gnunet_error_codes.c:179
3689#, fuzzy 3726#, fuzzy
3690msgid "Failed to store the given records." 3727msgid "Failed to store the given records."
3691msgstr "Misslyckades att starta samling.\n" 3728msgstr "Misslyckades att starta samling.\n"
3692 3729
3693#: src/lib/util/gnunet_error_codes.c:186 3730#: src/lib/util/gnunet_error_codes.c:185
3694msgid "Label invalid or malformed." 3731msgid "Label invalid or malformed."
3695msgstr "" 3732msgstr ""
3696 3733
@@ -3757,16 +3794,6 @@ msgstr "\"%s\" misslyckades vid %s:%d med fel: %s\n"
3757msgid "Could not determine plugin installation path.\n" 3794msgid "Could not determine plugin installation path.\n"
3758msgstr "Kunde inte fastställa min publika IPv6-adress.\n" 3795msgstr "Kunde inte fastställa min publika IPv6-adress.\n"
3759 3796
3760#: src/lib/util/program.c:287
3761#, fuzzy, c-format
3762msgid "Unreadable configuration file `%s', exiting ...\n"
3763msgstr "Kunde inte spara konfigurationsfil \"%s\":"
3764
3765#: src/lib/util/program.c:299
3766#, fuzzy, c-format
3767msgid "Malformed configuration file `%s', exiting ...\n"
3768msgstr "Kunde inte spara konfigurationsfil \"%s\":"
3769
3770#: src/lib/util/program.c:314 3797#: src/lib/util/program.c:314
3771#, fuzzy, c-format 3798#, fuzzy, c-format
3772msgid "Unreadable configuration file `%s'. Exiting ...\n" 3799msgid "Unreadable configuration file `%s'. Exiting ...\n"
@@ -3817,121 +3844,121 @@ msgstr ""
3817msgid "Could not resolve our FQDN: %s\n" 3844msgid "Could not resolve our FQDN: %s\n"
3818msgstr "Kunde inte slå upp \"%s\": %s\n" 3845msgstr "Kunde inte slå upp \"%s\": %s\n"
3819 3846
3820#: src/lib/util/service.c:654 3847#: src/lib/util/service.c:650
3821#, c-format 3848#, c-format
3822msgid "" 3849msgid ""
3823"Processing code for message of type %u did not call " 3850"Processing code for message of type %u did not call "
3824"`GNUNET_SERVICE_client_continue' after %s\n" 3851"`GNUNET_SERVICE_client_continue' after %s\n"
3825msgstr "" 3852msgstr ""
3826 3853
3827#: src/lib/util/service.c:838 3854#: src/lib/util/service.c:841
3828#, fuzzy, c-format 3855#, fuzzy, c-format
3829msgid "Unknown address family %d\n" 3856msgid "Unknown address family %d\n"
3830msgstr "Okänd operation \"%s\"\n" 3857msgstr "Okänd operation \"%s\"\n"
3831 3858
3832#: src/lib/util/service.c:951 3859#: src/lib/util/service.c:956
3833#, c-format 3860#, c-format
3834msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 3861msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
3835msgstr "" 3862msgstr ""
3836 3863
3837#: src/lib/util/service.c:992 3864#: src/lib/util/service.c:997
3838#, c-format 3865#, c-format
3839msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 3866msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
3840msgstr "" 3867msgstr ""
3841 3868
3842#: src/lib/util/service.c:1095 src/lib/util/service.c:1101 3869#: src/lib/util/service.c:1100 src/lib/util/service.c:1106
3843#: src/service/arm/gnunet-service-arm.c:412 3870#: src/service/arm/gnunet-service-arm.c:412
3844#: src/service/arm/gnunet-service-arm.c:418 3871#: src/service/arm/gnunet-service-arm.c:418
3845#, c-format 3872#, c-format
3846msgid "Require valid port number for service `%s' in configuration!\n" 3873msgid "Require valid port number for service `%s' in configuration!\n"
3847msgstr "" 3874msgstr ""
3848 3875
3849#: src/lib/util/service.c:1158 src/service/arm/gnunet-service-arm.c:484 3876#: src/lib/util/service.c:1163 src/service/arm/gnunet-service-arm.c:484
3850#, c-format 3877#, c-format
3851msgid "" 3878msgid ""
3852"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 3879"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
3853"domain socket: %s\n" 3880"domain socket: %s\n"
3854msgstr "" 3881msgstr ""
3855 3882
3856#: src/lib/util/service.c:1176 src/service/arm/gnunet-service-arm.c:505 3883#: src/lib/util/service.c:1181 src/service/arm/gnunet-service-arm.c:505
3857#, c-format 3884#, c-format
3858msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 3885msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
3859msgstr "" 3886msgstr ""
3860 3887
3861#: src/lib/util/service.c:1207 src/service/arm/gnunet-service-arm.c:536 3888#: src/lib/util/service.c:1212 src/service/arm/gnunet-service-arm.c:536
3862#, fuzzy, c-format 3889#, fuzzy, c-format
3863msgid "Failed to resolve `%s': %s\n" 3890msgid "Failed to resolve `%s': %s\n"
3864msgstr "Misslyckades att leverera \"%s\" meddelande.\n" 3891msgstr "Misslyckades att leverera \"%s\" meddelande.\n"
3865 3892
3866#: src/lib/util/service.c:1226 src/service/arm/gnunet-service-arm.c:555 3893#: src/lib/util/service.c:1231 src/service/arm/gnunet-service-arm.c:555
3867#, fuzzy, c-format 3894#, fuzzy, c-format
3868msgid "Failed to find %saddress for `%s'.\n" 3895msgid "Failed to find %saddress for `%s'.\n"
3869msgstr "Misslyckades att binda till UDP-port %d.\n" 3896msgstr "Misslyckades att binda till UDP-port %d.\n"
3870 3897
3871# drive = hard drive ? 3898# drive = hard drive ?
3872#: src/lib/util/service.c:1401 3899#: src/lib/util/service.c:1406
3873#, fuzzy, c-format 3900#, fuzzy, c-format
3874msgid "`%s' failed for port %d (%s).\n" 3901msgid "`%s' failed for port %d (%s).\n"
3875msgstr "\"%s\" misslyckades för enhet %s: %u\n" 3902msgstr "\"%s\" misslyckades för enhet %s: %u\n"
3876 3903
3877#: src/lib/util/service.c:1413 3904#: src/lib/util/service.c:1418
3878#, fuzzy, c-format 3905#, fuzzy, c-format
3879msgid "`%s' failed for port %d (%s): address already in use\n" 3906msgid "`%s' failed for port %d (%s): address already in use\n"
3880msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n" 3907msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n"
3881 3908
3882#: src/lib/util/service.c:1420 3909#: src/lib/util/service.c:1425
3883#, fuzzy, c-format 3910#, fuzzy, c-format
3884msgid "`%s' failed for `%s': address already in use\n" 3911msgid "`%s' failed for `%s': address already in use\n"
3885msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n" 3912msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n"
3886 3913
3887#: src/lib/util/service.c:1481 3914#: src/lib/util/service.c:1486
3888#, c-format 3915#, c-format
3889msgid "Specified value for `%s' of service `%s' is invalid\n" 3916msgid "Specified value for `%s' of service `%s' is invalid\n"
3890msgstr "" 3917msgstr ""
3891 3918
3892#: src/lib/util/service.c:1505 3919#: src/lib/util/service.c:1510
3893#, c-format 3920#, c-format
3894msgid "Could not access pre-bound socket %u, will try to bind myself\n" 3921msgid "Could not access pre-bound socket %u, will try to bind myself\n"
3895msgstr "" 3922msgstr ""
3896 3923
3897#: src/lib/util/service.c:1573 3924#: src/lib/util/service.c:1583
3898msgid "" 3925msgid ""
3899"Could not bind to any of the ports I was supposed to, refusing to run!\n" 3926"Could not bind to any of the ports I was supposed to, refusing to run!\n"
3900msgstr "" 3927msgstr ""
3901 3928
3902#: src/lib/util/service.c:1644 3929#: src/lib/util/service.c:1653
3903msgid "No such user" 3930msgid "No such user"
3904msgstr "" 3931msgstr ""
3905 3932
3906#: src/lib/util/service.c:1658 3933#: src/lib/util/service.c:1668
3907#, c-format 3934#, c-format
3908msgid "Cannot change user/group to `%s': %s\n" 3935msgid "Cannot change user/group to `%s': %s\n"
3909msgstr "Kan inte ändra användare/grupp till \"%s\": %s\n" 3936msgstr "Kan inte ändra användare/grupp till \"%s\": %s\n"
3910 3937
3911#: src/lib/util/service.c:1751 3938#: src/lib/util/service.c:1767
3912msgid "Service process failed to initialize\n" 3939msgid "Service process failed to initialize\n"
3913msgstr "" 3940msgstr ""
3914 3941
3915#: src/lib/util/service.c:1756 3942#: src/lib/util/service.c:1772
3916msgid "Service process could not initialize server function\n" 3943msgid "Service process could not initialize server function\n"
3917msgstr "" 3944msgstr ""
3918 3945
3919#: src/lib/util/service.c:1761 3946#: src/lib/util/service.c:1777
3920msgid "Service process failed to report status\n" 3947msgid "Service process failed to report status\n"
3921msgstr "" 3948msgstr ""
3922 3949
3923#: src/lib/util/service.c:1960 src/lib/util/service.c:2255 3950#: src/lib/util/service.c:1990 src/lib/util/service.c:2304
3924msgid "do daemonize (detach from terminal)" 3951msgid "do daemonize (detach from terminal)"
3925msgstr "" 3952msgstr ""
3926 3953
3927#: src/lib/util/service.c:2036 src/lib/util/service.c:2048 3954#: src/lib/util/service.c:2065 src/lib/util/service.c:2080
3928#: src/lib/util/service.c:2298 src/lib/util/service.c:2310 3955#: src/lib/util/service.c:2353 src/lib/util/service.c:2368
3929#: src/service/transport/transport-testing-communicator.c:1055 3956#: src/service/transport/transport-testing-communicator.c:1059
3930#, fuzzy, c-format 3957#, fuzzy, c-format
3931msgid "Malformed configuration file `%s', exit ...\n" 3958msgid "Malformed configuration file `%s', exit ...\n"
3932msgstr "Kunde inte spara konfigurationsfil \"%s\":" 3959msgstr "Kunde inte spara konfigurationsfil \"%s\":"
3933 3960
3934#: src/lib/util/service.c:2058 src/lib/util/service.c:2321 3961#: src/lib/util/service.c:2092 src/lib/util/service.c:2381
3935#, fuzzy 3962#, fuzzy
3936msgid "Malformed configuration, exit ...\n" 3963msgid "Malformed configuration, exit ...\n"
3937msgstr "Kunde inte spara konfigurationsfil \"%s\":" 3964msgstr "Kunde inte spara konfigurationsfil \"%s\":"
@@ -4389,6 +4416,11 @@ msgstr ""
4389msgid "Initiating shutdown as requested by client.\n" 4416msgid "Initiating shutdown as requested by client.\n"
4390msgstr "" 4417msgstr ""
4391 4418
4419#: src/service/arm/testing_arm_cmd_start_peer.c:197
4420#, fuzzy, c-format
4421msgid "Failed to start `%s': %s\n"
4422msgstr "Fel vid %s:%d.\n"
4423
4392#: src/service/core/gnunet-service-core.c:329 4424#: src/service/core/gnunet-service-core.c:329
4393msgid "# send requests dropped (disconnected)" 4425msgid "# send requests dropped (disconnected)"
4394msgstr "" 4426msgstr ""
@@ -4575,8 +4607,8 @@ msgstr "# byte dekrypterade"
4575#: src/service/core/gnunet-service-core_sessions.c:337 4607#: src/service/core/gnunet-service-core_sessions.c:337
4576#: src/service/fs/gnunet-service-fs_cp.c:484 4608#: src/service/fs/gnunet-service-fs_cp.c:484
4577#: src/service/fs/gnunet-service-fs_cp.c:1377 4609#: src/service/fs/gnunet-service-fs_cp.c:1377
4578#: src/service/topology/gnunet-daemon-topology.c:551 4610#: src/service/topology/gnunet-daemon-topology.c:545
4579#: src/service/topology/gnunet-daemon-topology.c:633 4611#: src/service/topology/gnunet-daemon-topology.c:627
4580#, fuzzy 4612#, fuzzy
4581msgid "# peers connected" 4613msgid "# peers connected"
4582msgstr "# av anslutna parter" 4614msgstr "# av anslutna parter"
@@ -4707,7 +4739,7 @@ msgstr ""
4707#: src/service/datastore/gnunet-service-datastore.c:626 4739#: src/service/datastore/gnunet-service-datastore.c:626
4708#: src/service/datastore/gnunet-service-datastore.c:677 4740#: src/service/datastore/gnunet-service-datastore.c:677
4709#: src/service/datastore/gnunet-service-datastore.c:820 4741#: src/service/datastore/gnunet-service-datastore.c:820
4710#: src/service/datastore/gnunet-service-datastore.c:1428 4742#: src/service/datastore/gnunet-service-datastore.c:1431
4711msgid "# reserved" 4743msgid "# reserved"
4712msgstr "" 4744msgstr ""
4713 4745
@@ -4761,65 +4793,65 @@ msgstr ""
4761msgid "# REMOVE requests received" 4793msgid "# REMOVE requests received"
4762msgstr "# byte mottogs via TCP" 4794msgstr "# byte mottogs via TCP"
4763 4795
4764#: src/service/datastore/gnunet-service-datastore.c:1107 4796#: src/service/datastore/gnunet-service-datastore.c:1109
4765#, c-format 4797#, c-format
4766msgid "" 4798msgid ""
4767"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n" 4799"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n"
4768msgstr "" 4800msgstr ""
4769 4801
4770#: src/service/datastore/gnunet-service-datastore.c:1112 4802#: src/service/datastore/gnunet-service-datastore.c:1114
4771#: src/service/datastore/gnunet-service-datastore.c:1281 4803#: src/service/datastore/gnunet-service-datastore.c:1283
4772#, c-format 4804#, c-format
4773msgid "New payload: %lld\n" 4805msgid "New payload: %lld\n"
4774msgstr "" 4806msgstr ""
4775 4807
4776#: src/service/datastore/gnunet-service-datastore.c:1167 4808#: src/service/datastore/gnunet-service-datastore.c:1169
4777#, c-format 4809#, c-format
4778msgid "Loading `%s' datastore plugin\n" 4810msgid "Loading `%s' datastore plugin\n"
4779msgstr "" 4811msgstr ""
4780 4812
4781#: src/service/datastore/gnunet-service-datastore.c:1176 4813#: src/service/datastore/gnunet-service-datastore.c:1178
4782#, fuzzy, c-format 4814#, fuzzy, c-format
4783msgid "Failed to load datastore plugin for `%s'\n" 4815msgid "Failed to load datastore plugin for `%s'\n"
4784msgstr "Kunde inte slå upp \"%s\": %s\n" 4816msgstr "Kunde inte slå upp \"%s\": %s\n"
4785 4817
4786#: src/service/datastore/gnunet-service-datastore.c:1236 4818#: src/service/datastore/gnunet-service-datastore.c:1238
4787msgid "Bloomfilter construction complete.\n" 4819msgid "Bloomfilter construction complete.\n"
4788msgstr "" 4820msgstr ""
4789 4821
4790#: src/service/datastore/gnunet-service-datastore.c:1288 4822#: src/service/datastore/gnunet-service-datastore.c:1290
4791msgid "Rebuilding bloomfilter. Please be patient.\n" 4823msgid "Rebuilding bloomfilter. Please be patient.\n"
4792msgstr "" 4824msgstr ""
4793 4825
4794#: src/service/datastore/gnunet-service-datastore.c:1298 4826#: src/service/datastore/gnunet-service-datastore.c:1300
4795msgid "Plugin does not support get_keys function. Please fix!\n" 4827msgid "Plugin does not support get_keys function. Please fix!\n"
4796msgstr "" 4828msgstr ""
4797 4829
4798#: src/service/datastore/gnunet-service-datastore.c:1463 4830#: src/service/datastore/gnunet-service-datastore.c:1466
4799#, fuzzy, c-format 4831#, fuzzy, c-format
4800msgid "# bytes used in file-sharing datastore `%s'" 4832msgid "# bytes used in file-sharing datastore `%s'"
4801msgstr "# byte krypterade" 4833msgstr "# byte krypterade"
4802 4834
4803#: src/service/datastore/gnunet-service-datastore.c:1472 4835#: src/service/datastore/gnunet-service-datastore.c:1475
4804msgid "# quota" 4836msgid "# quota"
4805msgstr "" 4837msgstr ""
4806 4838
4807#: src/service/datastore/gnunet-service-datastore.c:1475 4839#: src/service/datastore/gnunet-service-datastore.c:1478
4808msgid "# cache size" 4840msgid "# cache size"
4809msgstr "" 4841msgstr ""
4810 4842
4811#: src/service/datastore/gnunet-service-datastore.c:1491 4843#: src/service/datastore/gnunet-service-datastore.c:1494
4812#, c-format 4844#, c-format
4813msgid "Could not use specified filename `%s' for bloomfilter.\n" 4845msgid "Could not use specified filename `%s' for bloomfilter.\n"
4814msgstr "" 4846msgstr ""
4815 4847
4816#: src/service/datastore/gnunet-service-datastore.c:1512 4848#: src/service/datastore/gnunet-service-datastore.c:1515
4817#: src/service/datastore/gnunet-service-datastore.c:1534 4849#: src/service/datastore/gnunet-service-datastore.c:1537
4818#, fuzzy, c-format 4850#, fuzzy, c-format
4819msgid "Failed to remove bogus bloomfilter file `%s'\n" 4851msgid "Failed to remove bogus bloomfilter file `%s'\n"
4820msgstr "Kunde inte spara konfigurationsfil \"%s\":" 4852msgstr "Kunde inte spara konfigurationsfil \"%s\":"
4821 4853
4822#: src/service/datastore/gnunet-service-datastore.c:1573 4854#: src/service/datastore/gnunet-service-datastore.c:1576
4823#, fuzzy 4855#, fuzzy
4824msgid "Failed to initialize bloomfilter.\n" 4856msgid "Failed to initialize bloomfilter.\n"
4825msgstr "Misslyckades att initiera tjänsten \"%s\".\n" 4857msgstr "Misslyckades att initiera tjänsten \"%s\".\n"
@@ -5626,7 +5658,7 @@ msgstr "GNUnet-konfiguration"
5626 5658
5627#: src/service/fs/gnunet-service-fs.c:1271 5659#: src/service/fs/gnunet-service-fs.c:1271
5628#: src/service/hostlist/gnunet-daemon-hostlist.c:343 5660#: src/service/hostlist/gnunet-daemon-hostlist.c:343
5629#: src/service/topology/gnunet-daemon-topology.c:1066 5661#: src/service/topology/gnunet-daemon-topology.c:1062
5630#, fuzzy, c-format 5662#, fuzzy, c-format
5631msgid "Failed to connect to `%s' service.\n" 5663msgid "Failed to connect to `%s' service.\n"
5632msgstr "Misslyckades att initiera tjänsten \"%s\".\n" 5664msgstr "Misslyckades att initiera tjänsten \"%s\".\n"
@@ -6445,7 +6477,7 @@ msgid "# hostlist advertisements send"
6445msgstr "" 6477msgstr ""
6446 6478
6447#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 6479#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483
6448#: src/service/topology/gnunet-daemon-topology.c:786 6480#: src/service/topology/gnunet-daemon-topology.c:781
6449#, fuzzy, c-format 6481#, fuzzy, c-format
6450msgid "Error in communication with PEERSTORE service: %s\n" 6482msgid "Error in communication with PEERSTORE service: %s\n"
6451msgstr "Skriv ut information om GNUnets motparter." 6483msgstr "Skriv ut information om GNUnets motparter."
@@ -6714,12 +6746,12 @@ msgstr ""
6714msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" 6746msgid "Malformed punched hole specification `%s' (IPv6 address invalid)"
6715msgstr "" 6747msgstr ""
6716 6748
6717#: src/service/nat/gnunet-service-nat.c:1861 6749#: src/service/nat/gnunet-service-nat.c:1860
6718#, fuzzy 6750#, fuzzy
6719msgid "Connection reversal request failed\n" 6751msgid "Connection reversal request failed\n"
6720msgstr "Samling stoppad.\n" 6752msgstr "Samling stoppad.\n"
6721 6753
6722#: src/service/nat/gnunet-service-nat.c:1935 6754#: src/service/nat/gnunet-service-nat.c:1999
6723msgid "" 6755msgid ""
6724"UPnP enabled in configuration, but UPnP client `upnpc` command not found, " 6756"UPnP enabled in configuration, but UPnP client `upnpc` command not found, "
6725"disabling UPnP\n" 6757"disabling UPnP\n"
@@ -6743,44 +6775,44 @@ msgstr ""
6743msgid "`upnpc' command not found\n" 6775msgid "`upnpc' command not found\n"
6744msgstr "" 6776msgstr ""
6745 6777
6746#: src/service/peerstore/gnunet-service-peerstore.c:1141 6778#: src/service/peerstore/gnunet-service-peerstore.c:1150
6747#, fuzzy, c-format 6779#, fuzzy, c-format
6748msgid "Failed to parse HELLO in file `%s': %s\n" 6780msgid "Failed to parse HELLO in file `%s': %s\n"
6749msgstr "Misslyckades att läsa kompislista från \"%s\"\n" 6781msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
6750 6782
6751#: src/service/peerstore/gnunet-service-peerstore.c:1214 6783#: src/service/peerstore/gnunet-service-peerstore.c:1223
6752#, fuzzy, c-format 6784#, fuzzy, c-format
6753msgid "Could not load database backend `%s'\n" 6785msgid "Could not load database backend `%s'\n"
6754msgstr "Misslyckades att läsa kompislista från \"%s\"\n" 6786msgstr "Misslyckades att läsa kompislista från \"%s\"\n"
6755 6787
6756#: src/service/peerstore/gnunet-service-peerstore.c:1233 6788#: src/service/peerstore/gnunet-service-peerstore.c:1242
6757#, c-format 6789#, c-format
6758msgid "Importing HELLOs from `%s'\n" 6790msgid "Importing HELLOs from `%s'\n"
6759msgstr "" 6791msgstr ""
6760 6792
6761#: src/service/peerstore/gnunet-service-peerstore.c:1244 6793#: src/service/peerstore/gnunet-service-peerstore.c:1253
6762msgid "Skipping import of included HELLOs\n" 6794msgid "Skipping import of included HELLOs\n"
6763msgstr "" 6795msgstr ""
6764 6796
6765#: src/service/peerstore/peerstore_api.c:574 6797#: src/service/peerstore/peerstore_api.c:579
6766#, fuzzy 6798#, fuzzy
6767msgid "Unexpected store response.\n" 6799msgid "Unexpected store response.\n"
6768msgstr "Oväntat svar till \"%s\" operation.\n" 6800msgstr "Oväntat svar till \"%s\" operation.\n"
6769 6801
6770#: src/service/peerstore/peerstore_api.c:606 6802#: src/service/peerstore/peerstore_api.c:620
6771#, fuzzy 6803#, fuzzy
6772msgid "Unexpected iteration response.\n" 6804msgid "Unexpected iteration response.\n"
6773msgstr "Utdataformat är inte känt, detta bör inte hända.\n" 6805msgstr "Utdataformat är inte känt, detta bör inte hända.\n"
6774 6806
6775#: src/service/peerstore/peerstore_api.c:652 6807#: src/service/peerstore/peerstore_api.c:666
6776#, fuzzy 6808#, fuzzy
6777msgid "" 6809msgid ""
6778"Unexpected iteration response, no iterating client found, discarding " 6810"Unexpected iteration response, no iterating client found, discarding "
6779"message.\n" 6811"message.\n"
6780msgstr "Utdataformat är inte känt, detta bör inte hända.\n" 6812msgstr "Utdataformat är inte känt, detta bör inte hända.\n"
6781 6813
6782#: src/service/peerstore/peerstore_api.c:662 6814#: src/service/peerstore/peerstore_api.c:676
6783#: src/service/peerstore/peerstore_api_monitor.c:164 6815#: src/service/peerstore/peerstore_api_monitor.c:163
6784#, fuzzy 6816#, fuzzy
6785msgid "Received a malformed response from service." 6817msgid "Received a malformed response from service."
6786msgstr "Mottog ogiltig \"%s\" begäran (storlek %d)\n" 6818msgstr "Mottog ogiltig \"%s\" begäran (storlek %d)\n"
@@ -6959,12 +6991,12 @@ msgstr " Anslutning misslyckades\n"
6959msgid "Namestore REST API initialized\n" 6991msgid "Namestore REST API initialized\n"
6960msgstr " Anslutning misslyckades\n" 6992msgstr " Anslutning misslyckades\n"
6961 6993
6962#: src/service/rest/openid_plugin.c:3102 6994#: src/service/rest/openid_plugin.c:3121
6963#, fuzzy 6995#, fuzzy
6964msgid "OpenID Connect REST API initialized\n" 6996msgid "OpenID Connect REST API initialized\n"
6965msgstr " Anslutning misslyckades\n" 6997msgstr " Anslutning misslyckades\n"
6966 6998
6967#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1523 6999#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1494
6968#, fuzzy 7000#, fuzzy
6969msgid "Identity Provider REST API initialized\n" 7001msgid "Identity Provider REST API initialized\n"
6970msgstr " Anslutning misslyckades\n" 7002msgstr " Anslutning misslyckades\n"
@@ -7018,156 +7050,55 @@ msgstr "Ladda ner filer från GNUnet."
7018msgid "Could not save some persistent statistics\n" 7050msgid "Could not save some persistent statistics\n"
7019msgstr "Kunde inte skapa värdnyckel!\n" 7051msgstr "Kunde inte skapa värdnyckel!\n"
7020 7052
7021#: src/service/testing/gnunet-testing.c:185 7053#: src/service/testbed/gnunet-testbed.c:196
7022#, fuzzy, c-format
7023msgid "Could not extract hostkey %u (offset too large?)\n"
7024msgstr "Kunde inte skapa värdnyckel!\n"
7025
7026#: src/service/testing/gnunet-testing.c:275
7027#, c-format
7028msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
7029msgstr ""
7030
7031#: src/service/testing/gnunet-testing.c:386
7032#, fuzzy 7054#, fuzzy
7033msgid "create unique configuration files" 7055msgid "number of unique configuration files to create"
7034msgstr "skriv ut ett värde från konfigurationsfilen till standard ut"
7035
7036#: src/service/testing/gnunet-testing.c:392
7037msgid "extract hostkey file from pre-computed hostkey list"
7038msgstr ""
7039
7040#: src/service/testing/gnunet-testing.c:400
7041#, fuzzy
7042msgid ""
7043"number of unique configuration files to create, or number of the hostkey to "
7044"extract"
7045msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" 7056msgstr "skriv ut ett värde från konfigurationsfilen till standard ut"
7046 7057
7047#: src/service/testing/gnunet-testing.c:407 7058#: src/service/testbed/gnunet-testbed.c:202
7048#, fuzzy 7059#, fuzzy
7049msgid "configuration template" 7060msgid "configuration template"
7050msgstr "Konfigurationsfil \"%s\" skapad.\n" 7061msgstr "Konfigurationsfil \"%s\" skapad.\n"
7051 7062
7052#: src/service/testing/gnunet-testing.c:415 7063#: src/service/testbed/gnunet-testbed.c:218
7053msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"
7054msgstr ""
7055
7056#: src/service/testing/gnunet-testing.c:432
7057msgid "Command line tool to access the testing library" 7064msgid "Command line tool to access the testing library"
7058msgstr "" 7065msgstr ""
7059 7066
7060#: src/service/testing/list-keys.c:92
7061msgid "list COUNT number of keys"
7062msgstr ""
7063
7064#: src/service/testing/testing.c:291
7065#, c-format
7066msgid "Hostkeys file not found: %s\n"
7067msgstr ""
7068
7069#: src/service/testing/testing.c:743
7070#, fuzzy, c-format
7071msgid "Key number %u does not exist\n"
7072msgstr "antal meddelanden att använda per iteration"
7073
7074#: src/service/testing/testing.c:1217
7075#, c-format
7076msgid ""
7077"You attempted to create a testbed with more than %u hosts. Please "
7078"precompute more hostkeys first.\n"
7079msgstr ""
7080
7081#: src/service/testing/testing.c:1226
7082#, fuzzy, c-format
7083msgid "Failed to initialize hostkey for peer %u\n"
7084msgstr "Misslyckades att initiera tjänsten \"%s\".\n"
7085
7086#: src/service/testing/testing.c:1236
7087#, fuzzy
7088msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
7089msgstr "Inga applikationer definierade i konfiguration!\n"
7090
7091#: src/service/testing/testing.c:1249
7092#, fuzzy
7093msgid "Failed to create configuration for peer (not enough free ports?)\n"
7094msgstr "Kunde inte komma åt namnrymdsinformation.\n"
7095
7096#: src/service/testing/testing.c:1265
7097#, fuzzy, c-format
7098msgid "Cannot open hostkey file `%s': %s\n"
7099msgstr "Kunde inte skapa värdnyckel!\n"
7100
7101#: src/service/testing/testing.c:1279
7102#, fuzzy, c-format
7103msgid "Failed to write hostkey file for peer %u: %s\n"
7104msgstr "Kunde inte skapa användarkonto:"
7105
7106#: src/service/testing/testing.c:1307
7107#, fuzzy, c-format
7108msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7109msgstr "Kunde inte spara konfigurationsfil \"%s\":"
7110
7111#: src/service/testing/testing.c:1413
7112#, fuzzy, c-format
7113msgid "Failed to start `%s': %s\n"
7114msgstr "Fel vid %s:%d.\n"
7115
7116#: src/service/testing/testing.c:1664
7117#, fuzzy, c-format
7118msgid "Failed to load configuration from %s\n"
7119msgstr "Kunde inte spara konfigurationsfil \"%s\":"
7120
7121#: src/service/testing/testing.c:2795
7122#, fuzzy, c-format
7123msgid "Topology file %s not found\n"
7124msgstr "\"%s\" misslyckades: tabell hittades inte!\n"
7125
7126#: src/service/testing/testing.c:2803
7127#, c-format
7128msgid "Topology file %s has no data\n"
7129msgstr ""
7130
7131#: src/service/testing/testing.c:2811
7132#, c-format
7133msgid "Topology file %s cannot be read\n"
7134msgstr ""
7135
7136#: src/service/topology/gnunet-daemon-topology.c:286 7067#: src/service/topology/gnunet-daemon-topology.c:286
7137#, fuzzy 7068#, fuzzy
7138msgid "# connect requests issued to ATS" 7069msgid "# connect requests issued to ATS"
7139msgstr "# byte mottogs via TCP" 7070msgstr "# byte mottogs via TCP"
7140 7071
7141#: src/service/topology/gnunet-daemon-topology.c:480 7072#: src/service/topology/gnunet-daemon-topology.c:475
7142msgid "# HELLO messages gossipped" 7073msgid "# HELLO messages gossipped"
7143msgstr "" 7074msgstr ""
7144 7075
7145#: src/service/topology/gnunet-daemon-topology.c:752 7076#: src/service/topology/gnunet-daemon-topology.c:747
7146#, fuzzy 7077#, fuzzy
7147msgid "Error in communication with PEERSTORE service to monitor.\n" 7078msgid "Error in communication with PEERSTORE service to monitor.\n"
7148msgstr "Skriv ut information om GNUnets motparter." 7079msgstr "Skriv ut information om GNUnets motparter."
7149 7080
7150#: src/service/topology/gnunet-daemon-topology.c:761 7081#: src/service/topology/gnunet-daemon-topology.c:756
7151msgid "Finished initial PEERSTORE iteration in monitor.\n" 7082msgid "Finished initial PEERSTORE iteration in monitor.\n"
7152msgstr "" 7083msgstr ""
7153 7084
7154#: src/service/topology/gnunet-daemon-topology.c:869 7085#: src/service/topology/gnunet-daemon-topology.c:864
7155msgid "Failed to connect to core service, can not manage topology!\n" 7086msgid "Failed to connect to core service, can not manage topology!\n"
7156msgstr "" 7087msgstr ""
7157 7088
7158#: src/service/topology/gnunet-daemon-topology.c:943 7089#: src/service/topology/gnunet-daemon-topology.c:938
7159#, fuzzy 7090#, fuzzy
7160msgid "# HELLO messages received" 7091msgid "# HELLO messages received"
7161msgstr "# krypterade PONG-meddelanden mottagna" 7092msgstr "# krypterade PONG-meddelanden mottagna"
7162 7093
7163#: src/service/topology/gnunet-daemon-topology.c:1095 7094#: src/service/topology/gnunet-daemon-topology.c:1091
7164msgid "GNUnet topology control" 7095msgid "GNUnet topology control"
7165msgstr "" 7096msgstr ""
7166 7097
7167#: src/service/transport/gnunet-communicator-quic.c:1717 7098#: src/service/transport/gnunet-communicator-quic.c:1717
7168#: src/service/transport/gnunet-communicator-tcp.c:3777 7099#: src/service/transport/gnunet-communicator-tcp.c:3814
7169#: src/service/transport/gnunet-communicator-udp.c:3408 7100#: src/service/transport/gnunet-communicator-udp.c:3579
7170#: src/service/transport/gnunet-service-transport.c:12128 7101#: src/service/transport/gnunet-service-transport.c:12543
7171#, fuzzy 7102#, fuzzy
7172msgid "Transport service is lacking key configuration settings. Exiting.\n" 7103msgid "Transport service is lacking key configuration settings. Exiting.\n"
7173msgstr "GNUnet-konfiguration" 7104msgstr "GNUnet-konfiguration"
@@ -7176,11 +7107,11 @@ msgstr "GNUnet-konfiguration"
7176msgid "GNUnet QUIC communicator" 7107msgid "GNUnet QUIC communicator"
7177msgstr "" 7108msgstr ""
7178 7109
7179#: src/service/transport/gnunet-communicator-tcp.c:4114 7110#: src/service/transport/gnunet-communicator-tcp.c:4171
7180msgid "GNUnet TCP communicator" 7111msgid "GNUnet TCP communicator"
7181msgstr "" 7112msgstr ""
7182 7113
7183#: src/service/transport/gnunet-communicator-udp.c:3483 7114#: src/service/transport/gnunet-communicator-udp.c:3654
7184msgid "GNUnet UDP communicator" 7115msgid "GNUnet UDP communicator"
7185msgstr "" 7116msgstr ""
7186 7117
@@ -7362,7 +7293,7 @@ msgstr ""
7362msgid "Direct access to transport service." 7293msgid "Direct access to transport service."
7363msgstr "Misslyckades att ansluta till gnunetd.\n" 7294msgstr "Misslyckades att ansluta till gnunetd.\n"
7364 7295
7365#: src/service/transport/transport_api2_communication.c:765 7296#: src/service/transport/transport_api2_communication.c:773
7366msgid "Dropped backchanel message: handler not provided by communicator\n" 7297msgid "Dropped backchanel message: handler not provided by communicator\n"
7367msgstr "" 7298msgstr ""
7368 7299
@@ -7494,6 +7425,50 @@ msgid "Failed to connect to the namestore!\n"
7494msgstr "Misslyckades att ansluta till gnunetd.\n" 7425msgstr "Misslyckades att ansluta till gnunetd.\n"
7495 7426
7496#, fuzzy, c-format 7427#, fuzzy, c-format
7428#~ msgid "Could not extract hostkey %u (offset too large?)\n"
7429#~ msgstr "Kunde inte skapa värdnyckel!\n"
7430
7431#, fuzzy
7432#~ msgid "create unique configuration files"
7433#~ msgstr "skriv ut ett värde från konfigurationsfilen till standard ut"
7434
7435#, fuzzy, c-format
7436#~ msgid "Key number %u does not exist\n"
7437#~ msgstr "antal meddelanden att använda per iteration"
7438
7439#, fuzzy, c-format
7440#~ msgid "Failed to initialize hostkey for peer %u\n"
7441#~ msgstr "Misslyckades att initiera tjänsten \"%s\".\n"
7442
7443#, fuzzy
7444#~ msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
7445#~ msgstr "Inga applikationer definierade i konfiguration!\n"
7446
7447#, fuzzy
7448#~ msgid "Failed to create configuration for peer (not enough free ports?)\n"
7449#~ msgstr "Kunde inte komma åt namnrymdsinformation.\n"
7450
7451#, fuzzy, c-format
7452#~ msgid "Cannot open hostkey file `%s': %s\n"
7453#~ msgstr "Kunde inte skapa värdnyckel!\n"
7454
7455#, fuzzy, c-format
7456#~ msgid "Failed to write hostkey file for peer %u: %s\n"
7457#~ msgstr "Kunde inte skapa användarkonto:"
7458
7459#, fuzzy, c-format
7460#~ msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7461#~ msgstr "Kunde inte spara konfigurationsfil \"%s\":"
7462
7463#, fuzzy, c-format
7464#~ msgid "Failed to load configuration from %s\n"
7465#~ msgstr "Kunde inte spara konfigurationsfil \"%s\":"
7466
7467#, fuzzy, c-format
7468#~ msgid "Topology file %s not found\n"
7469#~ msgstr "\"%s\" misslyckades: tabell hittades inte!\n"
7470
7471#, fuzzy, c-format
7497#~ msgid "" 7472#~ msgid ""
7498#~ "Local peer: %s\n" 7473#~ "Local peer: %s\n"
7499#~ "\n" 7474#~ "\n"
@@ -8460,10 +8435,6 @@ msgstr "Misslyckades att ansluta till gnunetd.\n"
8460#~ msgstr "GNUnet-konfiguration" 8435#~ msgstr "GNUnet-konfiguration"
8461 8436
8462#, fuzzy 8437#, fuzzy
8463#~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n"
8464#~ msgstr "Kunde inte spara konfigurationsfil \"%s\":"
8465
8466#, fuzzy
8467#~ msgid "Unreadable or malformed configuration, exit ...\n" 8438#~ msgid "Unreadable or malformed configuration, exit ...\n"
8468#~ msgstr "Kunde inte spara konfigurationsfil \"%s\":" 8439#~ msgstr "Kunde inte spara konfigurationsfil \"%s\":"
8469 8440
diff --git a/po/vi.po b/po/vi.po
index dc0f72aec..1d23f55d9 100644
--- a/po/vi.po
+++ b/po/vi.po
@@ -8,7 +8,7 @@ msgid ""
8msgstr "" 8msgstr ""
9"Project-Id-Version: gnunet 0.8.0a\n" 9"Project-Id-Version: gnunet 0.8.0a\n"
10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 10"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
11"POT-Creation-Date: 2024-03-02 14:38+0100\n" 11"POT-Creation-Date: 2024-05-20 20:21+0200\n"
12"PO-Revision-Date: 2008-09-10 22:05+0930\n" 12"PO-Revision-Date: 2008-09-10 22:05+0930\n"
13"Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n" 13"Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n"
14"Language-Team: Vietnamese <vi-VN@googlegroups.com>\n" 14"Language-Team: Vietnamese <vi-VN@googlegroups.com>\n"
@@ -356,21 +356,26 @@ msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n"
356msgid "Failed to connect to CORE service!\n" 356msgid "Failed to connect to CORE service!\n"
357msgstr "Lỗi kết nối đến gnunetd.\n" 357msgstr "Lỗi kết nối đến gnunetd.\n"
358 358
359#: src/cli/core/gnunet-core.c:230 src/service/transport/gnunet-transport.c:1389 359#: src/cli/core/gnunet-core.c:213
360#, fuzzy
361msgid "No argument given.\n"
362msgstr "chưa đưa ra tên"
363
364#: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389
360#, fuzzy 365#, fuzzy
361msgid "provide information about all current connections (continuously)" 366msgid "provide information about all current connections (continuously)"
362msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." 367msgstr "In ra thông tin vỠcác đồng đẳng GNUnet."
363 368
364#: src/cli/core/gnunet-core.c:236 369#: src/cli/core/gnunet-core.c:244
365msgid "Show our current peer identity" 370msgid "Show our current peer identity"
366msgstr "" 371msgstr ""
367 372
368#: src/cli/core/gnunet-core.c:243 373#: src/cli/core/gnunet-core.c:251
369#, fuzzy 374#, fuzzy
370msgid "Show current connections" 375msgid "Show current connections"
371msgstr "# các kết nối dht" 376msgstr "# các kết nối dht"
372 377
373#: src/cli/core/gnunet-core.c:254 378#: src/cli/core/gnunet-core.c:262
374#, fuzzy 379#, fuzzy
375msgid "Print information about connected peers." 380msgid "Print information about connected peers."
376msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." 381msgstr "In ra thông tin vỠcác đồng đẳng GNUnet."
@@ -1103,54 +1108,54 @@ msgstr "Không thể truy cập đến thông tin vỠkhông gian tên.\n"
1103msgid "Unindex a file that was previously indexed with gnunet-publish." 1108msgid "Unindex a file that was previously indexed with gnunet-publish."
1104msgstr "" 1109msgstr ""
1105 1110
1106#: src/cli/gns/gnunet-gns.c:268 1111#: src/cli/gns/gnunet-gns.c:269
1107#, fuzzy, c-format 1112#, fuzzy, c-format
1108msgid "`%s' is not a valid DNS domain name\n" 1113msgid "`%s' is not a valid DNS domain name\n"
1109msgstr "« %s » không sẵn sàng.\n" 1114msgstr "« %s » không sẵn sàng.\n"
1110 1115
1111#: src/cli/gns/gnunet-gns.c:279 src/lib/util/dnsparser.c:273 1116#: src/cli/gns/gnunet-gns.c:280 src/lib/util/dnsparser.c:273
1112#, fuzzy, c-format 1117#, fuzzy, c-format
1113msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" 1118msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
1114msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n" 1119msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n"
1115 1120
1116#: src/cli/gns/gnunet-gns.c:294 1121#: src/cli/gns/gnunet-gns.c:295
1117msgid "Cannot resolve using GNS: GNUnet peer not running\n" 1122msgid "Cannot resolve using GNS: GNUnet peer not running\n"
1118msgstr "" 1123msgstr ""
1119 1124
1120#: src/cli/gns/gnunet-gns.c:305 1125#: src/cli/gns/gnunet-gns.c:306
1121#: src/contrib/service/abd/gnunet-service-abd.c:1745 1126#: src/contrib/service/abd/gnunet-service-abd.c:1745
1122#, fuzzy, c-format 1127#, fuzzy, c-format
1123msgid "Failed to connect to GNS\n" 1128msgid "Failed to connect to GNS\n"
1124msgstr "Lỗi kết nối đến gnunetd.\n" 1129msgstr "Lỗi kết nối đến gnunetd.\n"
1125 1130
1126#: src/cli/gns/gnunet-gns.c:318 1131#: src/cli/gns/gnunet-gns.c:325
1127#, c-format 1132#, c-format
1128msgid "Invalid typename specified, assuming `ANY'\n" 1133msgid "Invalid typename specified, assuming `ANY'\n"
1129msgstr "" 1134msgstr ""
1130 1135
1131#: src/cli/gns/gnunet-gns.c:358 1136#: src/cli/gns/gnunet-gns.c:365
1132msgid "Lookup a record for the given name" 1137msgid "Lookup a record for the given name"
1133msgstr "" 1138msgstr ""
1134 1139
1135#: src/cli/gns/gnunet-gns.c:364 1140#: src/cli/gns/gnunet-gns.c:371
1136#, fuzzy 1141#, fuzzy
1137msgid "Specify the type of the record to lookup" 1142msgid "Specify the type of the record to lookup"
1138msgstr "xác định mức ưu tiên của nội dung" 1143msgstr "xác định mức ưu tiên của nội dung"
1139 1144
1140#: src/cli/gns/gnunet-gns.c:370 1145#: src/cli/gns/gnunet-gns.c:377
1141#, fuzzy 1146#, fuzzy
1142msgid "Specify a timeout for the lookup" 1147msgid "Specify a timeout for the lookup"
1143msgstr "xác định mức ưu tiên của nội dung" 1148msgstr "xác định mức ưu tiên của nội dung"
1144 1149
1145#: src/cli/gns/gnunet-gns.c:374 1150#: src/cli/gns/gnunet-gns.c:381
1146msgid "No unneeded output" 1151msgid "No unneeded output"
1147msgstr "" 1152msgstr ""
1148 1153
1149#: src/cli/gns/gnunet-gns.c:379 1154#: src/cli/gns/gnunet-gns.c:386
1150msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" 1155msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
1151msgstr "" 1156msgstr ""
1152 1157
1153#: src/cli/gns/gnunet-gns.c:393 1158#: src/cli/gns/gnunet-gns.c:400
1154#, fuzzy 1159#, fuzzy
1155msgid "GNUnet GNS resolver tool" 1160msgid "GNUnet GNS resolver tool"
1156msgstr "Bản ghi lỗi GNUnet" 1161msgstr "Bản ghi lỗi GNUnet"
@@ -1678,7 +1683,11 @@ msgstr ""
1678msgid "GNUnet NAT traversal autoconfigure daemon" 1683msgid "GNUnet NAT traversal autoconfigure daemon"
1679msgstr "" 1684msgstr ""
1680 1685
1681#: src/cli/nse/gnunet-nse.c:124 1686#: src/cli/nse/gnunet-nse.c:126
1687msgid "Monitor and output current estimates"
1688msgstr ""
1689
1690#: src/cli/nse/gnunet-nse.c:137
1682#, fuzzy 1691#, fuzzy
1683msgid "Show network size estimates from NSE service." 1692msgid "Show network size estimates from NSE service."
1684msgstr "# các yêu cầu get (lấy) dht được nhận" 1693msgstr "# các yêu cầu get (lấy) dht được nhận"
@@ -1727,87 +1736,91 @@ msgstr ""
1727msgid "The time until the DID Document is going to expire (e.g. 5d)" 1736msgid "The time until the DID Document is going to expire (e.g. 5d)"
1728msgstr "" 1737msgstr ""
1729 1738
1730#: src/cli/reclaim/gnunet-reclaim.c:805 1739#: src/cli/reclaim/gnunet-reclaim.c:813
1731#, fuzzy, c-format 1740#, fuzzy, c-format
1732msgid "Ego is required\n" 1741msgid "Ego is required\n"
1733msgstr "Bị từ chối đặt tùy chá»n « %s » trong phần « %s » thành « %s ».\n" 1742msgstr "Bị từ chối đặt tùy chá»n « %s » trong phần « %s » thành « %s ».\n"
1734 1743
1735#: src/cli/reclaim/gnunet-reclaim.c:812 1744#: src/cli/reclaim/gnunet-reclaim.c:820
1736#, c-format 1745#, c-format
1737msgid "Attribute value missing!\n" 1746msgid "Attribute value missing!\n"
1738msgstr "" 1747msgstr ""
1739 1748
1740#: src/cli/reclaim/gnunet-reclaim.c:819 1749#: src/cli/reclaim/gnunet-reclaim.c:827
1741#, fuzzy, c-format 1750#, fuzzy, c-format
1742msgid "Requesting party key is required!\n" 1751msgid "Requesting party key is required!\n"
1743msgstr "đặt tên hiệu cần dùng (cần thiết)" 1752msgstr "đặt tên hiệu cần dùng (cần thiết)"
1744 1753
1745#: src/cli/reclaim/gnunet-reclaim.c:837 1754#: src/cli/reclaim/gnunet-reclaim.c:846
1746msgid "Add or update an attribute NAME" 1755msgid "Add or update an attribute NAME"
1747msgstr "" 1756msgstr ""
1748 1757
1749#: src/cli/reclaim/gnunet-reclaim.c:842 1758#: src/cli/reclaim/gnunet-reclaim.c:851
1750msgid "Delete the attribute with ID" 1759msgid "Delete the attribute with ID"
1751msgstr "" 1760msgstr ""
1752 1761
1753#: src/cli/reclaim/gnunet-reclaim.c:847 1762#: src/cli/reclaim/gnunet-reclaim.c:856
1754msgid "The attribute VALUE" 1763msgid "The attribute VALUE"
1755msgstr "" 1764msgstr ""
1756 1765
1757#: src/cli/reclaim/gnunet-reclaim.c:852 1766#: src/cli/reclaim/gnunet-reclaim.c:861
1758#, fuzzy 1767#, fuzzy
1759msgid "The EGO to use" 1768msgid "The EGO to use"
1760msgstr "kích cỡ tin nhắn" 1769msgstr "kích cỡ tin nhắn"
1761 1770
1762#: src/cli/reclaim/gnunet-reclaim.c:858 1771#: src/cli/reclaim/gnunet-reclaim.c:867
1763msgid "Specify the relying party for issue" 1772msgid "Specify the relying party for issue"
1764msgstr "" 1773msgstr ""
1765 1774
1766#: src/cli/reclaim/gnunet-reclaim.c:862 1775#: src/cli/reclaim/gnunet-reclaim.c:873
1776msgid "Specify the relying party URI for a ticket to consume"
1777msgstr ""
1778
1779#: src/cli/reclaim/gnunet-reclaim.c:877
1767msgid "List attributes for EGO" 1780msgid "List attributes for EGO"
1768msgstr "" 1781msgstr ""
1769 1782
1770#: src/cli/reclaim/gnunet-reclaim.c:866 1783#: src/cli/reclaim/gnunet-reclaim.c:881
1771msgid "List credentials for EGO" 1784msgid "List credentials for EGO"
1772msgstr "" 1785msgstr ""
1773 1786
1774#: src/cli/reclaim/gnunet-reclaim.c:872 1787#: src/cli/reclaim/gnunet-reclaim.c:887
1775msgid "Credential to use for attribute" 1788msgid "Credential to use for attribute"
1776msgstr "" 1789msgstr ""
1777 1790
1778#: src/cli/reclaim/gnunet-reclaim.c:877 1791#: src/cli/reclaim/gnunet-reclaim.c:892
1779msgid "Credential name" 1792msgid "Credential name"
1780msgstr "" 1793msgstr ""
1781 1794
1782#: src/cli/reclaim/gnunet-reclaim.c:883 1795#: src/cli/reclaim/gnunet-reclaim.c:898
1783msgid "Issue a ticket for a set of attributes separated by comma" 1796msgid "Issue a ticket for a set of attributes separated by comma"
1784msgstr "" 1797msgstr ""
1785 1798
1786#: src/cli/reclaim/gnunet-reclaim.c:888 1799#: src/cli/reclaim/gnunet-reclaim.c:903
1787msgid "Consume a ticket" 1800msgid "Consume a ticket"
1788msgstr "" 1801msgstr ""
1789 1802
1790#: src/cli/reclaim/gnunet-reclaim.c:893 1803#: src/cli/reclaim/gnunet-reclaim.c:908
1791msgid "Revoke a ticket" 1804msgid "Revoke a ticket"
1792msgstr "" 1805msgstr ""
1793 1806
1794#: src/cli/reclaim/gnunet-reclaim.c:898 1807#: src/cli/reclaim/gnunet-reclaim.c:913
1795msgid "Type of attribute" 1808msgid "Type of attribute"
1796msgstr "" 1809msgstr ""
1797 1810
1798#: src/cli/reclaim/gnunet-reclaim.c:903 1811#: src/cli/reclaim/gnunet-reclaim.c:918
1799msgid "Type of credential" 1812msgid "Type of credential"
1800msgstr "" 1813msgstr ""
1801 1814
1802#: src/cli/reclaim/gnunet-reclaim.c:907 1815#: src/cli/reclaim/gnunet-reclaim.c:922
1803msgid "List tickets of ego" 1816msgid "List tickets of ego"
1804msgstr "" 1817msgstr ""
1805 1818
1806#: src/cli/reclaim/gnunet-reclaim.c:913 1819#: src/cli/reclaim/gnunet-reclaim.c:928
1807msgid "Expiration interval of the attribute" 1820msgid "Expiration interval of the attribute"
1808msgstr "" 1821msgstr ""
1809 1822
1810#: src/cli/reclaim/gnunet-reclaim.c:921 1823#: src/cli/reclaim/gnunet-reclaim.c:936
1811msgid "re:claimID command line tool" 1824msgid "re:claimID command line tool"
1812msgstr "" 1825msgstr ""
1813 1826
@@ -2045,34 +2058,59 @@ msgstr "In ra thống kê vỠcác thao tác GNUnet."
2045msgid "run decoder modus, otherwise runs as encoder" 2058msgid "run decoder modus, otherwise runs as encoder"
2046msgstr "" 2059msgstr ""
2047 2060
2048#: src/cli/util/gnunet-config.c:154 2061#: src/cli/util/gnunet-config.c:101
2049msgid "test if the current installation supports the specified BACKEND" 2062msgid "test if the current installation supports the specified BACKEND"
2050msgstr "" 2063msgstr ""
2051 2064
2052#: src/cli/util/gnunet-config.c:160 2065#: src/cli/util/gnunet-config.c:107
2053msgid "" 2066msgid ""
2054"Provide an appropriate value for CFLAGS to applications building on top of " 2067"Provide an appropriate value for CFLAGS to applications building on top of "
2055"GNUnet" 2068"GNUnet"
2056msgstr "" 2069msgstr ""
2057 2070
2058#: src/cli/util/gnunet-config.c:165 2071#: src/cli/util/gnunet-config.c:112
2059msgid "Is this an experimental build of GNUnet" 2072msgid "Is this an experimental build of GNUnet"
2060msgstr "" 2073msgstr ""
2061 2074
2062#: src/cli/util/gnunet-config.c:171 2075#: src/cli/util/gnunet-config.c:118
2063msgid "" 2076msgid ""
2064"Provide an appropriate value for LIBS to applications building on top of " 2077"Provide an appropriate value for LIBS to applications building on top of "
2065"GNUnet" 2078"GNUnet"
2066msgstr "" 2079msgstr ""
2067 2080
2068#: src/cli/util/gnunet-config.c:177 2081#: src/cli/util/gnunet-config.c:123
2082#, fuzzy
2083msgid "Do not parse default configuration files"
2084msgstr "cập nhật một giá trị trong tập tin cấu hình"
2085
2086#: src/cli/util/gnunet-config.c:129
2069msgid "Provide the path under which GNUnet was installed" 2087msgid "Provide the path under which GNUnet was installed"
2070msgstr "" 2088msgstr ""
2071 2089
2072#: src/cli/util/gnunet-config.c:192 2090#: src/cli/util/gnunet-config.c:136
2091msgid ""
2092"Parse main configuration from this command-line argument and not from disk"
2093msgstr ""
2094
2095#: src/cli/util/gnunet-config.c:225
2073#, fuzzy 2096#, fuzzy
2074msgid "Manipulate GNUnet configuration files" 2097msgid "Failed to load default configuration, exiting ...\n"
2075msgstr "cập nhật một giá trị trong tập tin cấu hình" 2098msgstr "Không thể lưu tập tin cấu hình « %s »:"
2099
2100#: src/cli/util/gnunet-config.c:237
2101#, fuzzy
2102msgid "Failed to parse configuration, exiting ...\n"
2103msgstr "Không thể lưu tập tin cấu hình « %s »:"
2104
2105#: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287
2106#, fuzzy, c-format
2107msgid "Unreadable configuration file `%s', exiting ...\n"
2108msgstr "Không thể lưu tập tin cấu hình « %s »:"
2109
2110#: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299
2111#, fuzzy, c-format
2112msgid "Malformed configuration file `%s', exiting ...\n"
2113msgstr "Không thể lưu tập tin cấu hình « %s »:"
2076 2114
2077#: src/cli/util/gnunet-crypto-tvg.c:1588 2115#: src/cli/util/gnunet-crypto-tvg.c:1588
2078msgid "verify a test vector from stdin" 2116msgid "verify a test vector from stdin"
@@ -2119,55 +2157,54 @@ msgstr ""
2119msgid "Hostkeys file `%s' not found\n" 2157msgid "Hostkeys file `%s' not found\n"
2120msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" 2158msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
2121 2159
2122#: src/cli/util/gnunet-ecc.c:314 2160#: src/cli/util/gnunet-ecc.c:318
2123#, fuzzy, c-format 2161#, fuzzy, c-format
2124msgid "Hostkeys file `%s' is empty\n" 2162msgid "Hostkeys file `%s' is empty\n"
2125msgstr "Äịnh dạng của tập tin « %s » là không hợp lệ.\n" 2163msgstr "Äịnh dạng của tập tin « %s » là không hợp lệ.\n"
2126 2164
2127#: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 2165#: src/cli/util/gnunet-ecc.c:324
2128#: src/service/testing/testing.c:308
2129#, c-format 2166#, c-format
2130msgid "Incorrect hostkey file format: %s\n" 2167msgid "Incorrect hostkey file format: %s\n"
2131msgstr "" 2168msgstr ""
2132 2169
2133#: src/cli/util/gnunet-ecc.c:334 2170#: src/cli/util/gnunet-ecc.c:340
2134#, fuzzy, c-format 2171#, fuzzy, c-format
2135msgid "Could not read hostkey file: %s\n" 2172msgid "Could not read hostkey file: %s\n"
2136msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" 2173msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n"
2137 2174
2138#: src/cli/util/gnunet-ecc.c:388 2175#: src/cli/util/gnunet-ecc.c:394
2139msgid "No hostkey file specified on command line\n" 2176msgid "No hostkey file specified on command line\n"
2140msgstr "" 2177msgstr ""
2141 2178
2142#: src/cli/util/gnunet-ecc.c:452 2179#: src/cli/util/gnunet-ecc.c:458
2143msgid "list keys included in a file (for testing)" 2180msgid "list keys included in a file (for testing)"
2144msgstr "" 2181msgstr ""
2145 2182
2146#: src/cli/util/gnunet-ecc.c:458 2183#: src/cli/util/gnunet-ecc.c:464
2147msgid "number of keys to list included in a file (for testing)" 2184msgid "number of keys to list included in a file (for testing)"
2148msgstr "" 2185msgstr ""
2149 2186
2150#: src/cli/util/gnunet-ecc.c:464 2187#: src/cli/util/gnunet-ecc.c:470
2151msgid "create COUNT public-private key pairs (for testing)" 2188msgid "create COUNT public-private key pairs (for testing)"
2152msgstr "" 2189msgstr ""
2153 2190
2154#: src/cli/util/gnunet-ecc.c:469 2191#: src/cli/util/gnunet-ecc.c:475
2155msgid "print the public key in ASCII format" 2192msgid "print the public key in ASCII format"
2156msgstr "" 2193msgstr ""
2157 2194
2158#: src/cli/util/gnunet-ecc.c:474 2195#: src/cli/util/gnunet-ecc.c:480
2159msgid "print the private key in ASCII format" 2196msgid "print the private key in ASCII format"
2160msgstr "" 2197msgstr ""
2161 2198
2162#: src/cli/util/gnunet-ecc.c:479 2199#: src/cli/util/gnunet-ecc.c:485
2163msgid "print the public key in HEX format" 2200msgid "print the public key in HEX format"
2164msgstr "" 2201msgstr ""
2165 2202
2166#: src/cli/util/gnunet-ecc.c:485 2203#: src/cli/util/gnunet-ecc.c:491
2167msgid "print examples of ECC operations (used for compatibility testing)" 2204msgid "print examples of ECC operations (used for compatibility testing)"
2168msgstr "" 2205msgstr ""
2169 2206
2170#: src/cli/util/gnunet-ecc.c:499 2207#: src/cli/util/gnunet-ecc.c:505
2171#, fuzzy 2208#, fuzzy
2172msgid "Manipulate GNUnet private ECC key files" 2209msgid "Manipulate GNUnet private ECC key files"
2173msgstr "cập nhật một giá trị trong tập tin cấu hình" 2210msgstr "cập nhật một giá trị trong tập tin cấu hình"
@@ -3257,13 +3294,13 @@ msgstr ""
3257msgid "Invalid handle type while writing `%s'" 3294msgid "Invalid handle type while writing `%s'"
3258msgstr "Äịa chỉ IP định dạng sai: %s\n" 3295msgstr "Äịa chỉ IP định dạng sai: %s\n"
3259 3296
3260#: src/lib/util/client.c:531 src/lib/util/service.c:1134 3297#: src/lib/util/client.c:531 src/lib/util/service.c:1139
3261#: src/service/arm/gnunet-service-arm.c:452 3298#: src/service/arm/gnunet-service-arm.c:452
3262#, c-format 3299#, c-format
3263msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 3300msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
3264msgstr "" 3301msgstr ""
3265 3302
3266#: src/lib/util/client.c:536 src/lib/util/service.c:1138 3303#: src/lib/util/client.c:536 src/lib/util/service.c:1143
3267#: src/service/arm/gnunet-service-arm.c:456 3304#: src/service/arm/gnunet-service-arm.c:456
3268#, fuzzy, c-format 3305#, fuzzy, c-format
3269msgid "Using `%s' instead\n" 3306msgid "Using `%s' instead\n"
@@ -3396,17 +3433,17 @@ msgstr ""
3396msgid "`%s' failed at %s:%d with error: %s\n" 3433msgid "`%s' failed at %s:%d with error: %s\n"
3397msgstr "« %s » bị lỗi tại %s:%d với lỗi: %s\n" 3434msgstr "« %s » bị lỗi tại %s:%d với lỗi: %s\n"
3398 3435
3399#: src/lib/util/crypto_ecc.c:554 3436#: src/lib/util/crypto_ecc.c:569
3400#, fuzzy, c-format 3437#, fuzzy, c-format
3401msgid "ECC signing failed at %s:%d: %s\n" 3438msgid "ECC signing failed at %s:%d: %s\n"
3402msgstr "%s bị lỗi tại %s:%d: « %s »\n" 3439msgstr "%s bị lỗi tại %s:%d: « %s »\n"
3403 3440
3404#: src/lib/util/crypto_ecc.c:677 3441#: src/lib/util/crypto_ecc.c:692
3405#, fuzzy, c-format 3442#, fuzzy, c-format
3406msgid "ECDSA signature verification failed at %s:%d: %s\n" 3443msgid "ECDSA signature verification failed at %s:%d: %s\n"
3407msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" 3444msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n"
3408 3445
3409#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:304 3446#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:305
3410#, fuzzy 3447#, fuzzy
3411msgid "Could not load peer's private key\n" 3448msgid "Could not load peer's private key\n"
3412msgstr "Không thể truy cập đến tập tin gnunet-directory « %s »\n" 3449msgstr "Không thể truy cập đến tập tin gnunet-directory « %s »\n"
@@ -3431,7 +3468,7 @@ msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n"
3431msgid "Expected `%s' to be a directory!\n" 3468msgid "Expected `%s' to be a directory!\n"
3432msgstr "Mong đợi « %s » là một thư mục.\n" 3469msgstr "Mong đợi « %s » là một thư mục.\n"
3433 3470
3434#: src/lib/util/disk.c:1222 src/lib/util/service.c:1642 3471#: src/lib/util/disk.c:1222 src/lib/util/service.c:1651
3435#, c-format 3472#, c-format
3436msgid "Cannot obtain information about user `%s': %s\n" 3473msgid "Cannot obtain information about user `%s': %s\n"
3437msgstr "Không thể lấy thông tin vá» ngÆ°á»i dùng « %s »: %s\n" 3474msgstr "Không thể lấy thông tin vá» ngÆ°á»i dùng « %s »: %s\n"
@@ -3626,100 +3663,100 @@ msgstr "Phải gá»­i má»™t con số cho tùy chá»n « %s ».\n"
3626msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 3663msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
3627msgstr "" 3664msgstr ""
3628 3665
3629#: src/lib/util/gnunet_error_codes.c:60 3666#: src/lib/util/gnunet_error_codes.c:59
3630msgid "No error (success)." 3667msgid "No error (success)."
3631msgstr "" 3668msgstr ""
3632 3669
3633#: src/lib/util/gnunet_error_codes.c:66 3670#: src/lib/util/gnunet_error_codes.c:65
3634#, fuzzy 3671#, fuzzy
3635msgid "Unknown and unspecified error." 3672msgid "Unknown and unspecified error."
3636msgstr "Lỗi không rõ.\n" 3673msgstr "Lỗi không rõ.\n"
3637 3674
3638#: src/lib/util/gnunet_error_codes.c:72 3675#: src/lib/util/gnunet_error_codes.c:71
3639#, fuzzy 3676#, fuzzy
3640msgid "Communication with service failed." 3677msgid "Communication with service failed."
3641msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" 3678msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet"
3642 3679
3643#: src/lib/util/gnunet_error_codes.c:78 3680#: src/lib/util/gnunet_error_codes.c:77
3644#, fuzzy 3681#, fuzzy
3645msgid "Ego not found." 3682msgid "Ego not found."
3646msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" 3683msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
3647 3684
3648#: src/lib/util/gnunet_error_codes.c:84 3685#: src/lib/util/gnunet_error_codes.c:83
3649msgid "Identifier already in use for another ego." 3686msgid "Identifier already in use for another ego."
3650msgstr "" 3687msgstr ""
3651 3688
3652#: src/lib/util/gnunet_error_codes.c:90 3689#: src/lib/util/gnunet_error_codes.c:89
3653msgid "The given ego is invalid or malformed." 3690msgid "The given ego is invalid or malformed."
3654msgstr "" 3691msgstr ""
3655 3692
3656#: src/lib/util/gnunet_error_codes.c:96 3693#: src/lib/util/gnunet_error_codes.c:95
3657#, fuzzy 3694#, fuzzy
3658msgid "Unknown namestore error." 3695msgid "Unknown namestore error."
3659msgstr "Lỗi không rõ.\n" 3696msgstr "Lỗi không rõ.\n"
3660 3697
3661#: src/lib/util/gnunet_error_codes.c:102 src/lib/util/gnunet_error_codes.c:120 3698#: src/lib/util/gnunet_error_codes.c:101 src/lib/util/gnunet_error_codes.c:119
3662#, fuzzy 3699#, fuzzy
3663msgid "Zone iteration failed." 3700msgid "Zone iteration failed."
3664msgstr "# các khoá phiên chạy được chấp nhận" 3701msgstr "# các khoá phiên chạy được chấp nhận"
3665 3702
3666#: src/lib/util/gnunet_error_codes.c:108 3703#: src/lib/util/gnunet_error_codes.c:107
3667#, fuzzy 3704#, fuzzy
3668msgid "Zone not found." 3705msgid "Zone not found."
3669msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" 3706msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
3670 3707
3671#: src/lib/util/gnunet_error_codes.c:114 3708#: src/lib/util/gnunet_error_codes.c:113
3672#, fuzzy 3709#, fuzzy
3673msgid "Record not found." 3710msgid "Record not found."
3674msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" 3711msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
3675 3712
3676#: src/lib/util/gnunet_error_codes.c:126 3713#: src/lib/util/gnunet_error_codes.c:125
3677#, fuzzy 3714#, fuzzy
3678msgid "Zone does not contain any records." 3715msgid "Zone does not contain any records."
3679msgstr "Tập tin « %s » không chứa biệt hiệu.\n" 3716msgstr "Tập tin « %s » không chứa biệt hiệu.\n"
3680 3717
3681#: src/lib/util/gnunet_error_codes.c:132 3718#: src/lib/util/gnunet_error_codes.c:131
3682#, fuzzy 3719#, fuzzy
3683msgid "Failed to lookup record." 3720msgid "Failed to lookup record."
3684msgstr "Lỗi bắt đầu thu thập.\n" 3721msgstr "Lỗi bắt đầu thu thập.\n"
3685 3722
3686#: src/lib/util/gnunet_error_codes.c:138 3723#: src/lib/util/gnunet_error_codes.c:137
3687#, fuzzy 3724#, fuzzy
3688msgid "No records given." 3725msgid "No records given."
3689msgstr "chưa đưa ra tên" 3726msgstr "chưa đưa ra tên"
3690 3727
3691#: src/lib/util/gnunet_error_codes.c:144 3728#: src/lib/util/gnunet_error_codes.c:143
3692msgid "Record data invalid." 3729msgid "Record data invalid."
3693msgstr "" 3730msgstr ""
3694 3731
3695#: src/lib/util/gnunet_error_codes.c:150 3732#: src/lib/util/gnunet_error_codes.c:149
3696#, fuzzy 3733#, fuzzy
3697msgid "No label given." 3734msgid "No label given."
3698msgstr "chưa đưa ra tên" 3735msgstr "chưa đưa ra tên"
3699 3736
3700#: src/lib/util/gnunet_error_codes.c:156 3737#: src/lib/util/gnunet_error_codes.c:155
3701#, fuzzy 3738#, fuzzy
3702msgid "No results given." 3739msgid "No results given."
3703msgstr "chưa đưa ra tên" 3740msgstr "chưa đưa ra tên"
3704 3741
3705#: src/lib/util/gnunet_error_codes.c:162 3742#: src/lib/util/gnunet_error_codes.c:161
3706msgid "Record already exists." 3743msgid "Record already exists."
3707msgstr "" 3744msgstr ""
3708 3745
3709#: src/lib/util/gnunet_error_codes.c:168 3746#: src/lib/util/gnunet_error_codes.c:167
3710msgid "Record size exceeds maximum limit." 3747msgid "Record size exceeds maximum limit."
3711msgstr "" 3748msgstr ""
3712 3749
3713#: src/lib/util/gnunet_error_codes.c:174 3750#: src/lib/util/gnunet_error_codes.c:173
3714msgid "There was an error in the database backend." 3751msgid "There was an error in the database backend."
3715msgstr "" 3752msgstr ""
3716 3753
3717#: src/lib/util/gnunet_error_codes.c:180 3754#: src/lib/util/gnunet_error_codes.c:179
3718#, fuzzy 3755#, fuzzy
3719msgid "Failed to store the given records." 3756msgid "Failed to store the given records."
3720msgstr "Lỗi bắt đầu thu thập.\n" 3757msgstr "Lỗi bắt đầu thu thập.\n"
3721 3758
3722#: src/lib/util/gnunet_error_codes.c:186 3759#: src/lib/util/gnunet_error_codes.c:185
3723msgid "Label invalid or malformed." 3760msgid "Label invalid or malformed."
3724msgstr "" 3761msgstr ""
3725 3762
@@ -3786,16 +3823,6 @@ msgstr "« %s » thất bại cho thư viện « %s » với lỗi: %s\n"
3786msgid "Could not determine plugin installation path.\n" 3823msgid "Could not determine plugin installation path.\n"
3787msgstr "Không thể truy cập đến thông tin vỠkhông gian tên.\n" 3824msgstr "Không thể truy cập đến thông tin vỠkhông gian tên.\n"
3788 3825
3789#: src/lib/util/program.c:287
3790#, fuzzy, c-format
3791msgid "Unreadable configuration file `%s', exiting ...\n"
3792msgstr "Không thể lưu tập tin cấu hình « %s »:"
3793
3794#: src/lib/util/program.c:299
3795#, fuzzy, c-format
3796msgid "Malformed configuration file `%s', exiting ...\n"
3797msgstr "Không thể lưu tập tin cấu hình « %s »:"
3798
3799#: src/lib/util/program.c:314 3826#: src/lib/util/program.c:314
3800#, fuzzy, c-format 3827#, fuzzy, c-format
3801msgid "Unreadable configuration file `%s'. Exiting ...\n" 3828msgid "Unreadable configuration file `%s'. Exiting ...\n"
@@ -3844,120 +3871,120 @@ msgstr ""
3844msgid "Could not resolve our FQDN: %s\n" 3871msgid "Could not resolve our FQDN: %s\n"
3845msgstr "Không thể giải quyết « %s » (%s): %s\n" 3872msgstr "Không thể giải quyết « %s » (%s): %s\n"
3846 3873
3847#: src/lib/util/service.c:654 3874#: src/lib/util/service.c:650
3848#, c-format 3875#, c-format
3849msgid "" 3876msgid ""
3850"Processing code for message of type %u did not call " 3877"Processing code for message of type %u did not call "
3851"`GNUNET_SERVICE_client_continue' after %s\n" 3878"`GNUNET_SERVICE_client_continue' after %s\n"
3852msgstr "" 3879msgstr ""
3853 3880
3854#: src/lib/util/service.c:838 3881#: src/lib/util/service.c:841
3855#, fuzzy, c-format 3882#, fuzzy, c-format
3856msgid "Unknown address family %d\n" 3883msgid "Unknown address family %d\n"
3857msgstr "\tKhông rõ miá»n tên « %s »\n" 3884msgstr "\tKhông rõ miá»n tên « %s »\n"
3858 3885
3859#: src/lib/util/service.c:951 3886#: src/lib/util/service.c:956
3860#, c-format 3887#, c-format
3861msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 3888msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
3862msgstr "" 3889msgstr ""
3863 3890
3864#: src/lib/util/service.c:992 3891#: src/lib/util/service.c:997
3865#, c-format 3892#, c-format
3866msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 3893msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
3867msgstr "" 3894msgstr ""
3868 3895
3869#: src/lib/util/service.c:1095 src/lib/util/service.c:1101 3896#: src/lib/util/service.c:1100 src/lib/util/service.c:1106
3870#: src/service/arm/gnunet-service-arm.c:412 3897#: src/service/arm/gnunet-service-arm.c:412
3871#: src/service/arm/gnunet-service-arm.c:418 3898#: src/service/arm/gnunet-service-arm.c:418
3872#, c-format 3899#, c-format
3873msgid "Require valid port number for service `%s' in configuration!\n" 3900msgid "Require valid port number for service `%s' in configuration!\n"
3874msgstr "" 3901msgstr ""
3875 3902
3876#: src/lib/util/service.c:1158 src/service/arm/gnunet-service-arm.c:484 3903#: src/lib/util/service.c:1163 src/service/arm/gnunet-service-arm.c:484
3877#, c-format 3904#, c-format
3878msgid "" 3905msgid ""
3879"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 3906"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
3880"domain socket: %s\n" 3907"domain socket: %s\n"
3881msgstr "" 3908msgstr ""
3882 3909
3883#: src/lib/util/service.c:1176 src/service/arm/gnunet-service-arm.c:505 3910#: src/lib/util/service.c:1181 src/service/arm/gnunet-service-arm.c:505
3884#, c-format 3911#, c-format
3885msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 3912msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
3886msgstr "" 3913msgstr ""
3887 3914
3888#: src/lib/util/service.c:1207 src/service/arm/gnunet-service-arm.c:536 3915#: src/lib/util/service.c:1212 src/service/arm/gnunet-service-arm.c:536
3889#, fuzzy, c-format 3916#, fuzzy, c-format
3890msgid "Failed to resolve `%s': %s\n" 3917msgid "Failed to resolve `%s': %s\n"
3891msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n" 3918msgstr "Lỗi mở tập tin ghi sự kiện « %s »: %s\n"
3892 3919
3893#: src/lib/util/service.c:1226 src/service/arm/gnunet-service-arm.c:555 3920#: src/lib/util/service.c:1231 src/service/arm/gnunet-service-arm.c:555
3894#, fuzzy, c-format 3921#, fuzzy, c-format
3895msgid "Failed to find %saddress for `%s'.\n" 3922msgid "Failed to find %saddress for `%s'.\n"
3896msgstr "Lỗi đóng kết đến cổng %s %d.\n" 3923msgstr "Lỗi đóng kết đến cổng %s %d.\n"
3897 3924
3898#: src/lib/util/service.c:1401 3925#: src/lib/util/service.c:1406
3899#, fuzzy, c-format 3926#, fuzzy, c-format
3900msgid "`%s' failed for port %d (%s).\n" 3927msgid "`%s' failed for port %d (%s).\n"
3901msgstr "« %s » thất bại cho ổ đĩa « %s »: %u\n" 3928msgstr "« %s » thất bại cho ổ đĩa « %s »: %u\n"
3902 3929
3903#: src/lib/util/service.c:1413 3930#: src/lib/util/service.c:1418
3904#, fuzzy, c-format 3931#, fuzzy, c-format
3905msgid "`%s' failed for port %d (%s): address already in use\n" 3932msgid "`%s' failed for port %d (%s): address already in use\n"
3906msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n" 3933msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n"
3907 3934
3908#: src/lib/util/service.c:1420 3935#: src/lib/util/service.c:1425
3909#, fuzzy, c-format 3936#, fuzzy, c-format
3910msgid "`%s' failed for `%s': address already in use\n" 3937msgid "`%s' failed for `%s': address already in use\n"
3911msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n" 3938msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n"
3912 3939
3913#: src/lib/util/service.c:1481 3940#: src/lib/util/service.c:1486
3914#, c-format 3941#, c-format
3915msgid "Specified value for `%s' of service `%s' is invalid\n" 3942msgid "Specified value for `%s' of service `%s' is invalid\n"
3916msgstr "" 3943msgstr ""
3917 3944
3918#: src/lib/util/service.c:1505 3945#: src/lib/util/service.c:1510
3919#, c-format 3946#, c-format
3920msgid "Could not access pre-bound socket %u, will try to bind myself\n" 3947msgid "Could not access pre-bound socket %u, will try to bind myself\n"
3921msgstr "" 3948msgstr ""
3922 3949
3923#: src/lib/util/service.c:1573 3950#: src/lib/util/service.c:1583
3924msgid "" 3951msgid ""
3925"Could not bind to any of the ports I was supposed to, refusing to run!\n" 3952"Could not bind to any of the ports I was supposed to, refusing to run!\n"
3926msgstr "" 3953msgstr ""
3927 3954
3928#: src/lib/util/service.c:1644 3955#: src/lib/util/service.c:1653
3929msgid "No such user" 3956msgid "No such user"
3930msgstr "Không có ngÆ°á»i dùng nhÆ° vậy" 3957msgstr "Không có ngÆ°á»i dùng nhÆ° vậy"
3931 3958
3932#: src/lib/util/service.c:1658 3959#: src/lib/util/service.c:1668
3933#, c-format 3960#, c-format
3934msgid "Cannot change user/group to `%s': %s\n" 3961msgid "Cannot change user/group to `%s': %s\n"
3935msgstr "Không thể thay đổi ngÆ°á»i dùng/nhóm thành « %s »: %s\n" 3962msgstr "Không thể thay đổi ngÆ°á»i dùng/nhóm thành « %s »: %s\n"
3936 3963
3937#: src/lib/util/service.c:1751 3964#: src/lib/util/service.c:1767
3938msgid "Service process failed to initialize\n" 3965msgid "Service process failed to initialize\n"
3939msgstr "" 3966msgstr ""
3940 3967
3941#: src/lib/util/service.c:1756 3968#: src/lib/util/service.c:1772
3942msgid "Service process could not initialize server function\n" 3969msgid "Service process could not initialize server function\n"
3943msgstr "" 3970msgstr ""
3944 3971
3945#: src/lib/util/service.c:1761 3972#: src/lib/util/service.c:1777
3946msgid "Service process failed to report status\n" 3973msgid "Service process failed to report status\n"
3947msgstr "" 3974msgstr ""
3948 3975
3949#: src/lib/util/service.c:1960 src/lib/util/service.c:2255 3976#: src/lib/util/service.c:1990 src/lib/util/service.c:2304
3950msgid "do daemonize (detach from terminal)" 3977msgid "do daemonize (detach from terminal)"
3951msgstr "" 3978msgstr ""
3952 3979
3953#: src/lib/util/service.c:2036 src/lib/util/service.c:2048 3980#: src/lib/util/service.c:2065 src/lib/util/service.c:2080
3954#: src/lib/util/service.c:2298 src/lib/util/service.c:2310 3981#: src/lib/util/service.c:2353 src/lib/util/service.c:2368
3955#: src/service/transport/transport-testing-communicator.c:1055 3982#: src/service/transport/transport-testing-communicator.c:1059
3956#, fuzzy, c-format 3983#, fuzzy, c-format
3957msgid "Malformed configuration file `%s', exit ...\n" 3984msgid "Malformed configuration file `%s', exit ...\n"
3958msgstr "Không thể lưu tập tin cấu hình « %s »:" 3985msgstr "Không thể lưu tập tin cấu hình « %s »:"
3959 3986
3960#: src/lib/util/service.c:2058 src/lib/util/service.c:2321 3987#: src/lib/util/service.c:2092 src/lib/util/service.c:2381
3961#, fuzzy 3988#, fuzzy
3962msgid "Malformed configuration, exit ...\n" 3989msgid "Malformed configuration, exit ...\n"
3963msgstr "Không thể lưu tập tin cấu hình « %s »:" 3990msgstr "Không thể lưu tập tin cấu hình « %s »:"
@@ -4424,6 +4451,11 @@ msgstr ""
4424msgid "Initiating shutdown as requested by client.\n" 4451msgid "Initiating shutdown as requested by client.\n"
4425msgstr "" 4452msgstr ""
4426 4453
4454#: src/service/arm/testing_arm_cmd_start_peer.c:197
4455#, fuzzy, c-format
4456msgid "Failed to start `%s': %s\n"
4457msgstr "Lỗi chạy %s: %s %d\n"
4458
4427#: src/service/core/gnunet-service-core.c:329 4459#: src/service/core/gnunet-service-core.c:329
4428#, fuzzy 4460#, fuzzy
4429msgid "# send requests dropped (disconnected)" 4461msgid "# send requests dropped (disconnected)"
@@ -4611,8 +4643,8 @@ msgstr "# các byte đã giải mã"
4611#: src/service/core/gnunet-service-core_sessions.c:337 4643#: src/service/core/gnunet-service-core_sessions.c:337
4612#: src/service/fs/gnunet-service-fs_cp.c:484 4644#: src/service/fs/gnunet-service-fs_cp.c:484
4613#: src/service/fs/gnunet-service-fs_cp.c:1377 4645#: src/service/fs/gnunet-service-fs_cp.c:1377
4614#: src/service/topology/gnunet-daemon-topology.c:551 4646#: src/service/topology/gnunet-daemon-topology.c:545
4615#: src/service/topology/gnunet-daemon-topology.c:633 4647#: src/service/topology/gnunet-daemon-topology.c:627
4616#, fuzzy 4648#, fuzzy
4617msgid "# peers connected" 4649msgid "# peers connected"
4618msgstr "# của các đồng đẳng đã kết nối" 4650msgstr "# của các đồng đẳng đã kết nối"
@@ -4748,7 +4780,7 @@ msgstr ""
4748#: src/service/datastore/gnunet-service-datastore.c:626 4780#: src/service/datastore/gnunet-service-datastore.c:626
4749#: src/service/datastore/gnunet-service-datastore.c:677 4781#: src/service/datastore/gnunet-service-datastore.c:677
4750#: src/service/datastore/gnunet-service-datastore.c:820 4782#: src/service/datastore/gnunet-service-datastore.c:820
4751#: src/service/datastore/gnunet-service-datastore.c:1428 4783#: src/service/datastore/gnunet-service-datastore.c:1431
4752msgid "# reserved" 4784msgid "# reserved"
4753msgstr "" 4785msgstr ""
4754 4786
@@ -4804,65 +4836,65 @@ msgstr ""
4804msgid "# REMOVE requests received" 4836msgid "# REMOVE requests received"
4805msgstr "# các yêu cầu get (lấy) dht được nhận" 4837msgstr "# các yêu cầu get (lấy) dht được nhận"
4806 4838
4807#: src/service/datastore/gnunet-service-datastore.c:1107 4839#: src/service/datastore/gnunet-service-datastore.c:1109
4808#, c-format 4840#, c-format
4809msgid "" 4841msgid ""
4810"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n" 4842"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n"
4811msgstr "" 4843msgstr ""
4812 4844
4813#: src/service/datastore/gnunet-service-datastore.c:1112 4845#: src/service/datastore/gnunet-service-datastore.c:1114
4814#: src/service/datastore/gnunet-service-datastore.c:1281 4846#: src/service/datastore/gnunet-service-datastore.c:1283
4815#, c-format 4847#, c-format
4816msgid "New payload: %lld\n" 4848msgid "New payload: %lld\n"
4817msgstr "" 4849msgstr ""
4818 4850
4819#: src/service/datastore/gnunet-service-datastore.c:1167 4851#: src/service/datastore/gnunet-service-datastore.c:1169
4820#, c-format 4852#, c-format
4821msgid "Loading `%s' datastore plugin\n" 4853msgid "Loading `%s' datastore plugin\n"
4822msgstr "" 4854msgstr ""
4823 4855
4824#: src/service/datastore/gnunet-service-datastore.c:1176 4856#: src/service/datastore/gnunet-service-datastore.c:1178
4825#, fuzzy, c-format 4857#, fuzzy, c-format
4826msgid "Failed to load datastore plugin for `%s'\n" 4858msgid "Failed to load datastore plugin for `%s'\n"
4827msgstr "Không thể nạp phần bổ sung truyá»n tải « %s »\n" 4859msgstr "Không thể nạp phần bổ sung truyá»n tải « %s »\n"
4828 4860
4829#: src/service/datastore/gnunet-service-datastore.c:1236 4861#: src/service/datastore/gnunet-service-datastore.c:1238
4830msgid "Bloomfilter construction complete.\n" 4862msgid "Bloomfilter construction complete.\n"
4831msgstr "" 4863msgstr ""
4832 4864
4833#: src/service/datastore/gnunet-service-datastore.c:1288 4865#: src/service/datastore/gnunet-service-datastore.c:1290
4834msgid "Rebuilding bloomfilter. Please be patient.\n" 4866msgid "Rebuilding bloomfilter. Please be patient.\n"
4835msgstr "" 4867msgstr ""
4836 4868
4837#: src/service/datastore/gnunet-service-datastore.c:1298 4869#: src/service/datastore/gnunet-service-datastore.c:1300
4838msgid "Plugin does not support get_keys function. Please fix!\n" 4870msgid "Plugin does not support get_keys function. Please fix!\n"
4839msgstr "" 4871msgstr ""
4840 4872
4841#: src/service/datastore/gnunet-service-datastore.c:1463 4873#: src/service/datastore/gnunet-service-datastore.c:1466
4842#, fuzzy, c-format 4874#, fuzzy, c-format
4843msgid "# bytes used in file-sharing datastore `%s'" 4875msgid "# bytes used in file-sharing datastore `%s'"
4844msgstr "# các byte được phép trong kho dữ liệu" 4876msgstr "# các byte được phép trong kho dữ liệu"
4845 4877
4846#: src/service/datastore/gnunet-service-datastore.c:1472 4878#: src/service/datastore/gnunet-service-datastore.c:1475
4847msgid "# quota" 4879msgid "# quota"
4848msgstr "" 4880msgstr ""
4849 4881
4850#: src/service/datastore/gnunet-service-datastore.c:1475 4882#: src/service/datastore/gnunet-service-datastore.c:1478
4851msgid "# cache size" 4883msgid "# cache size"
4852msgstr "" 4884msgstr ""
4853 4885
4854#: src/service/datastore/gnunet-service-datastore.c:1491 4886#: src/service/datastore/gnunet-service-datastore.c:1494
4855#, c-format 4887#, c-format
4856msgid "Could not use specified filename `%s' for bloomfilter.\n" 4888msgid "Could not use specified filename `%s' for bloomfilter.\n"
4857msgstr "" 4889msgstr ""
4858 4890
4859#: src/service/datastore/gnunet-service-datastore.c:1512 4891#: src/service/datastore/gnunet-service-datastore.c:1515
4860#: src/service/datastore/gnunet-service-datastore.c:1534 4892#: src/service/datastore/gnunet-service-datastore.c:1537
4861#, fuzzy, c-format 4893#, fuzzy, c-format
4862msgid "Failed to remove bogus bloomfilter file `%s'\n" 4894msgid "Failed to remove bogus bloomfilter file `%s'\n"
4863msgstr "Không thể lưu tập tin cấu hình « %s »:" 4895msgstr "Không thể lưu tập tin cấu hình « %s »:"
4864 4896
4865#: src/service/datastore/gnunet-service-datastore.c:1573 4897#: src/service/datastore/gnunet-service-datastore.c:1576
4866#, fuzzy 4898#, fuzzy
4867msgid "Failed to initialize bloomfilter.\n" 4899msgid "Failed to initialize bloomfilter.\n"
4868msgstr "Lỗi sơ khởi dịch vụ « %s ».\n" 4900msgstr "Lỗi sơ khởi dịch vụ « %s ».\n"
@@ -5665,7 +5697,7 @@ msgstr "Lưu cấu hình ngay bây giỠkhông?"
5665 5697
5666#: src/service/fs/gnunet-service-fs.c:1271 5698#: src/service/fs/gnunet-service-fs.c:1271
5667#: src/service/hostlist/gnunet-daemon-hostlist.c:343 5699#: src/service/hostlist/gnunet-daemon-hostlist.c:343
5668#: src/service/topology/gnunet-daemon-topology.c:1066 5700#: src/service/topology/gnunet-daemon-topology.c:1062
5669#, fuzzy, c-format 5701#, fuzzy, c-format
5670msgid "Failed to connect to `%s' service.\n" 5702msgid "Failed to connect to `%s' service.\n"
5671msgstr "Lỗi sơ khởi dịch vụ « %s ».\n" 5703msgstr "Lỗi sơ khởi dịch vụ « %s ».\n"
@@ -6505,7 +6537,7 @@ msgid "# hostlist advertisements send"
6505msgstr "# Các quảng cáo ngoại được chuyển tiếp" 6537msgstr "# Các quảng cáo ngoại được chuyển tiếp"
6506 6538
6507#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 6539#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483
6508#: src/service/topology/gnunet-daemon-topology.c:786 6540#: src/service/topology/gnunet-daemon-topology.c:781
6509#, fuzzy, c-format 6541#, fuzzy, c-format
6510msgid "Error in communication with PEERSTORE service: %s\n" 6542msgid "Error in communication with PEERSTORE service: %s\n"
6511msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" 6543msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet"
@@ -6769,12 +6801,12 @@ msgstr ""
6769msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" 6801msgid "Malformed punched hole specification `%s' (IPv6 address invalid)"
6770msgstr "" 6802msgstr ""
6771 6803
6772#: src/service/nat/gnunet-service-nat.c:1861 6804#: src/service/nat/gnunet-service-nat.c:1860
6773#, fuzzy 6805#, fuzzy
6774msgid "Connection reversal request failed\n" 6806msgid "Connection reversal request failed\n"
6775msgstr "Thu thập bị dừng.\n" 6807msgstr "Thu thập bị dừng.\n"
6776 6808
6777#: src/service/nat/gnunet-service-nat.c:1935 6809#: src/service/nat/gnunet-service-nat.c:1999
6778msgid "" 6810msgid ""
6779"UPnP enabled in configuration, but UPnP client `upnpc` command not found, " 6811"UPnP enabled in configuration, but UPnP client `upnpc` command not found, "
6780"disabling UPnP\n" 6812"disabling UPnP\n"
@@ -6798,44 +6830,44 @@ msgstr ""
6798msgid "`upnpc' command not found\n" 6830msgid "`upnpc' command not found\n"
6799msgstr "" 6831msgstr ""
6800 6832
6801#: src/service/peerstore/gnunet-service-peerstore.c:1141 6833#: src/service/peerstore/gnunet-service-peerstore.c:1150
6802#, fuzzy, c-format 6834#, fuzzy, c-format
6803msgid "Failed to parse HELLO in file `%s': %s\n" 6835msgid "Failed to parse HELLO in file `%s': %s\n"
6804msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" 6836msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n"
6805 6837
6806#: src/service/peerstore/gnunet-service-peerstore.c:1214 6838#: src/service/peerstore/gnunet-service-peerstore.c:1223
6807#, fuzzy, c-format 6839#, fuzzy, c-format
6808msgid "Could not load database backend `%s'\n" 6840msgid "Could not load database backend `%s'\n"
6809msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" 6841msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n"
6810 6842
6811#: src/service/peerstore/gnunet-service-peerstore.c:1233 6843#: src/service/peerstore/gnunet-service-peerstore.c:1242
6812#, c-format 6844#, c-format
6813msgid "Importing HELLOs from `%s'\n" 6845msgid "Importing HELLOs from `%s'\n"
6814msgstr "" 6846msgstr ""
6815 6847
6816#: src/service/peerstore/gnunet-service-peerstore.c:1244 6848#: src/service/peerstore/gnunet-service-peerstore.c:1253
6817msgid "Skipping import of included HELLOs\n" 6849msgid "Skipping import of included HELLOs\n"
6818msgstr "" 6850msgstr ""
6819 6851
6820#: src/service/peerstore/peerstore_api.c:574 6852#: src/service/peerstore/peerstore_api.c:579
6821#, fuzzy 6853#, fuzzy
6822msgid "Unexpected store response.\n" 6854msgid "Unexpected store response.\n"
6823msgstr "Gặp sá»± kiện bất thÆ°á»ng: %d\n" 6855msgstr "Gặp sá»± kiện bất thÆ°á»ng: %d\n"
6824 6856
6825#: src/service/peerstore/peerstore_api.c:606 6857#: src/service/peerstore/peerstore_api.c:620
6826#, fuzzy 6858#, fuzzy
6827msgid "Unexpected iteration response.\n" 6859msgid "Unexpected iteration response.\n"
6828msgstr "Äịnh dạng kết xuất không rõ, Ä‘iá»u này không nên xảy ra.\n" 6860msgstr "Äịnh dạng kết xuất không rõ, Ä‘iá»u này không nên xảy ra.\n"
6829 6861
6830#: src/service/peerstore/peerstore_api.c:652 6862#: src/service/peerstore/peerstore_api.c:666
6831#, fuzzy 6863#, fuzzy
6832msgid "" 6864msgid ""
6833"Unexpected iteration response, no iterating client found, discarding " 6865"Unexpected iteration response, no iterating client found, discarding "
6834"message.\n" 6866"message.\n"
6835msgstr "Äịnh dạng kết xuất không rõ, Ä‘iá»u này không nên xảy ra.\n" 6867msgstr "Äịnh dạng kết xuất không rõ, Ä‘iá»u này không nên xảy ra.\n"
6836 6868
6837#: src/service/peerstore/peerstore_api.c:662 6869#: src/service/peerstore/peerstore_api.c:676
6838#: src/service/peerstore/peerstore_api_monitor.c:164 6870#: src/service/peerstore/peerstore_api_monitor.c:163
6839#, fuzzy 6871#, fuzzy
6840msgid "Received a malformed response from service." 6872msgid "Received a malformed response from service."
6841msgstr "Nhận yêu cầu định tuyến\n" 6873msgstr "Nhận yêu cầu định tuyến\n"
@@ -7013,12 +7045,12 @@ msgstr "Lỗi sơ khởi lõi.\n"
7013msgid "Namestore REST API initialized\n" 7045msgid "Namestore REST API initialized\n"
7014msgstr "Lỗi sơ khởi lõi.\n" 7046msgstr "Lỗi sơ khởi lõi.\n"
7015 7047
7016#: src/service/rest/openid_plugin.c:3102 7048#: src/service/rest/openid_plugin.c:3121
7017#, fuzzy 7049#, fuzzy
7018msgid "OpenID Connect REST API initialized\n" 7050msgid "OpenID Connect REST API initialized\n"
7019msgstr "Lỗi sơ khởi lõi.\n" 7051msgstr "Lỗi sơ khởi lõi.\n"
7020 7052
7021#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1523 7053#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1494
7022#, fuzzy 7054#, fuzzy
7023msgid "Identity Provider REST API initialized\n" 7055msgid "Identity Provider REST API initialized\n"
7024msgstr "Lỗi sơ khởi lõi.\n" 7056msgstr "Lỗi sơ khởi lõi.\n"
@@ -7072,156 +7104,56 @@ msgstr "Äã tải %llu byte xuống « %s ».\n"
7072msgid "Could not save some persistent statistics\n" 7104msgid "Could not save some persistent statistics\n"
7073msgstr "Không thể tạo miá»n tên.\n" 7105msgstr "Không thể tạo miá»n tên.\n"
7074 7106
7075#: src/service/testing/gnunet-testing.c:185 7107#: src/service/testbed/gnunet-testbed.c:196
7076#, fuzzy, c-format
7077msgid "Could not extract hostkey %u (offset too large?)\n"
7078msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n"
7079
7080#: src/service/testing/gnunet-testing.c:275
7081#, c-format
7082msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
7083msgstr ""
7084
7085#: src/service/testing/gnunet-testing.c:386
7086#, fuzzy 7108#, fuzzy
7087msgid "create unique configuration files" 7109msgid "number of unique configuration files to create"
7088msgstr "cập nhật một giá trị trong tập tin cấu hình"
7089
7090#: src/service/testing/gnunet-testing.c:392
7091msgid "extract hostkey file from pre-computed hostkey list"
7092msgstr ""
7093
7094#: src/service/testing/gnunet-testing.c:400
7095#, fuzzy
7096msgid ""
7097"number of unique configuration files to create, or number of the hostkey to "
7098"extract"
7099msgstr "in ra đầu ra tiêu chuẩn một giá trị từ tập tin cấu hình" 7110msgstr "in ra đầu ra tiêu chuẩn một giá trị từ tập tin cấu hình"
7100 7111
7101#: src/service/testing/gnunet-testing.c:407 7112#: src/service/testbed/gnunet-testbed.c:202
7102#, fuzzy 7113#, fuzzy
7103msgid "configuration template" 7114msgid "configuration template"
7104msgstr "Cấu hình đã được lưu." 7115msgstr "Cấu hình đã được lưu."
7105 7116
7106#: src/service/testing/gnunet-testing.c:415 7117#: src/service/testbed/gnunet-testbed.c:218
7107msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"
7108msgstr ""
7109
7110#: src/service/testing/gnunet-testing.c:432
7111msgid "Command line tool to access the testing library" 7118msgid "Command line tool to access the testing library"
7112msgstr "" 7119msgstr ""
7113 7120
7114#: src/service/testing/list-keys.c:92
7115msgid "list COUNT number of keys"
7116msgstr ""
7117
7118#: src/service/testing/testing.c:291
7119#, c-format
7120msgid "Hostkeys file not found: %s\n"
7121msgstr ""
7122
7123#: src/service/testing/testing.c:743
7124#, fuzzy, c-format
7125msgid "Key number %u does not exist\n"
7126msgstr "đặt số trình ná»n cần khởi chạy"
7127
7128#: src/service/testing/testing.c:1217
7129#, c-format
7130msgid ""
7131"You attempted to create a testbed with more than %u hosts. Please "
7132"precompute more hostkeys first.\n"
7133msgstr ""
7134
7135#: src/service/testing/testing.c:1226
7136#, fuzzy, c-format
7137msgid "Failed to initialize hostkey for peer %u\n"
7138msgstr "Lỗi sơ khởi dịch vụ « %s ».\n"
7139
7140#: src/service/testing/testing.c:1236
7141msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
7142msgstr ""
7143
7144#: src/service/testing/testing.c:1249
7145#, fuzzy
7146msgid "Failed to create configuration for peer (not enough free ports?)\n"
7147msgstr "Không thể truy cập đến thông tin vỠkhông gian tên.\n"
7148
7149#: src/service/testing/testing.c:1265
7150#, fuzzy, c-format
7151msgid "Cannot open hostkey file `%s': %s\n"
7152msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n"
7153
7154#: src/service/testing/testing.c:1279
7155#, fuzzy, c-format
7156msgid "Failed to write hostkey file for peer %u: %s\n"
7157msgstr "Lá»—i tạo thÆ° mục tạm thá»i."
7158
7159#: src/service/testing/testing.c:1307
7160#, fuzzy, c-format
7161msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7162msgstr "Không thể lưu tập tin cấu hình « %s »:"
7163
7164#: src/service/testing/testing.c:1413
7165#, fuzzy, c-format
7166msgid "Failed to start `%s': %s\n"
7167msgstr "Lỗi chạy %s: %s %d\n"
7168
7169#: src/service/testing/testing.c:1664
7170#, fuzzy, c-format
7171msgid "Failed to load configuration from %s\n"
7172msgstr "Không thể lưu tập tin cấu hình « %s »:"
7173
7174#: src/service/testing/testing.c:2795
7175#, fuzzy, c-format
7176msgid "Topology file %s not found\n"
7177msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
7178
7179#: src/service/testing/testing.c:2803
7180#, fuzzy, c-format
7181msgid "Topology file %s has no data\n"
7182msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
7183
7184#: src/service/testing/testing.c:2811
7185#, fuzzy, c-format
7186msgid "Topology file %s cannot be read\n"
7187msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
7188
7189#: src/service/topology/gnunet-daemon-topology.c:286 7121#: src/service/topology/gnunet-daemon-topology.c:286
7190#, fuzzy 7122#, fuzzy
7191msgid "# connect requests issued to ATS" 7123msgid "# connect requests issued to ATS"
7192msgstr "# các yêu cầu máy/trình khách lỗ hổng được phun vào" 7124msgstr "# các yêu cầu máy/trình khách lỗ hổng được phun vào"
7193 7125
7194#: src/service/topology/gnunet-daemon-topology.c:480 7126#: src/service/topology/gnunet-daemon-topology.c:475
7195#, fuzzy 7127#, fuzzy
7196msgid "# HELLO messages gossipped" 7128msgid "# HELLO messages gossipped"
7197msgstr "# các thông báo gá»­i Ä‘i bị loại bá»" 7129msgstr "# các thông báo gá»­i Ä‘i bị loại bá»"
7198 7130
7199#: src/service/topology/gnunet-daemon-topology.c:752 7131#: src/service/topology/gnunet-daemon-topology.c:747
7200#, fuzzy 7132#, fuzzy
7201msgid "Error in communication with PEERSTORE service to monitor.\n" 7133msgid "Error in communication with PEERSTORE service to monitor.\n"
7202msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" 7134msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet"
7203 7135
7204#: src/service/topology/gnunet-daemon-topology.c:761 7136#: src/service/topology/gnunet-daemon-topology.c:756
7205msgid "Finished initial PEERSTORE iteration in monitor.\n" 7137msgid "Finished initial PEERSTORE iteration in monitor.\n"
7206msgstr "" 7138msgstr ""
7207 7139
7208#: src/service/topology/gnunet-daemon-topology.c:869 7140#: src/service/topology/gnunet-daemon-topology.c:864
7209msgid "Failed to connect to core service, can not manage topology!\n" 7141msgid "Failed to connect to core service, can not manage topology!\n"
7210msgstr "" 7142msgstr ""
7211 7143
7212#: src/service/topology/gnunet-daemon-topology.c:943 7144#: src/service/topology/gnunet-daemon-topology.c:938
7213#, fuzzy 7145#, fuzzy
7214msgid "# HELLO messages received" 7146msgid "# HELLO messages received"
7215msgstr "# các thông báo PONG đã mật mã được nhận" 7147msgstr "# các thông báo PONG đã mật mã được nhận"
7216 7148
7217#: src/service/topology/gnunet-daemon-topology.c:1095 7149#: src/service/topology/gnunet-daemon-topology.c:1091
7218msgid "GNUnet topology control" 7150msgid "GNUnet topology control"
7219msgstr "" 7151msgstr ""
7220 7152
7221#: src/service/transport/gnunet-communicator-quic.c:1717 7153#: src/service/transport/gnunet-communicator-quic.c:1717
7222#: src/service/transport/gnunet-communicator-tcp.c:3777 7154#: src/service/transport/gnunet-communicator-tcp.c:3814
7223#: src/service/transport/gnunet-communicator-udp.c:3408 7155#: src/service/transport/gnunet-communicator-udp.c:3579
7224#: src/service/transport/gnunet-service-transport.c:12128 7156#: src/service/transport/gnunet-service-transport.c:12543
7225#, fuzzy 7157#, fuzzy
7226msgid "Transport service is lacking key configuration settings. Exiting.\n" 7158msgid "Transport service is lacking key configuration settings. Exiting.\n"
7227msgstr "Lưu cấu hình ngay bây giỠkhông?" 7159msgstr "Lưu cấu hình ngay bây giỠkhông?"
@@ -7230,11 +7162,11 @@ msgstr "Lưu cấu hình ngay bây giỠkhông?"
7230msgid "GNUnet QUIC communicator" 7162msgid "GNUnet QUIC communicator"
7231msgstr "" 7163msgstr ""
7232 7164
7233#: src/service/transport/gnunet-communicator-tcp.c:4114 7165#: src/service/transport/gnunet-communicator-tcp.c:4171
7234msgid "GNUnet TCP communicator" 7166msgid "GNUnet TCP communicator"
7235msgstr "" 7167msgstr ""
7236 7168
7237#: src/service/transport/gnunet-communicator-udp.c:3483 7169#: src/service/transport/gnunet-communicator-udp.c:3654
7238msgid "GNUnet UDP communicator" 7170msgid "GNUnet UDP communicator"
7239msgstr "" 7171msgstr ""
7240 7172
@@ -7416,7 +7348,7 @@ msgstr ""
7416msgid "Direct access to transport service." 7348msgid "Direct access to transport service."
7417msgstr "Lỗi kết nối đến gnunetd.\n" 7349msgstr "Lỗi kết nối đến gnunetd.\n"
7418 7350
7419#: src/service/transport/transport_api2_communication.c:765 7351#: src/service/transport/transport_api2_communication.c:773
7420msgid "Dropped backchanel message: handler not provided by communicator\n" 7352msgid "Dropped backchanel message: handler not provided by communicator\n"
7421msgstr "" 7353msgstr ""
7422 7354
@@ -7548,6 +7480,54 @@ msgid "Failed to connect to the namestore!\n"
7548msgstr "Không kết nối được đến trình ná»n gnunetd." 7480msgstr "Không kết nối được đến trình ná»n gnunetd."
7549 7481
7550#, fuzzy, c-format 7482#, fuzzy, c-format
7483#~ msgid "Could not extract hostkey %u (offset too large?)\n"
7484#~ msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n"
7485
7486#, fuzzy
7487#~ msgid "create unique configuration files"
7488#~ msgstr "cập nhật một giá trị trong tập tin cấu hình"
7489
7490#, fuzzy, c-format
7491#~ msgid "Key number %u does not exist\n"
7492#~ msgstr "đặt số trình ná»n cần khởi chạy"
7493
7494#, fuzzy, c-format
7495#~ msgid "Failed to initialize hostkey for peer %u\n"
7496#~ msgstr "Lỗi sơ khởi dịch vụ « %s ».\n"
7497
7498#, fuzzy
7499#~ msgid "Failed to create configuration for peer (not enough free ports?)\n"
7500#~ msgstr "Không thể truy cập đến thông tin vỠkhông gian tên.\n"
7501
7502#, fuzzy, c-format
7503#~ msgid "Cannot open hostkey file `%s': %s\n"
7504#~ msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n"
7505
7506#, fuzzy, c-format
7507#~ msgid "Failed to write hostkey file for peer %u: %s\n"
7508#~ msgstr "Lá»—i tạo thÆ° mục tạm thá»i."
7509
7510#, fuzzy, c-format
7511#~ msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7512#~ msgstr "Không thể lưu tập tin cấu hình « %s »:"
7513
7514#, fuzzy, c-format
7515#~ msgid "Failed to load configuration from %s\n"
7516#~ msgstr "Không thể lưu tập tin cấu hình « %s »:"
7517
7518#, fuzzy, c-format
7519#~ msgid "Topology file %s not found\n"
7520#~ msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
7521
7522#, fuzzy, c-format
7523#~ msgid "Topology file %s has no data\n"
7524#~ msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
7525
7526#, fuzzy, c-format
7527#~ msgid "Topology file %s cannot be read\n"
7528#~ msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n"
7529
7530#, fuzzy, c-format
7551#~ msgid "" 7531#~ msgid ""
7552#~ "Local peer: %s\n" 7532#~ "Local peer: %s\n"
7553#~ "\n" 7533#~ "\n"
@@ -8601,10 +8581,6 @@ msgstr "Không kết nối được đến trình ná»n gnunetd."
8601#~ msgstr "Lưu cấu hình ngay bây giỠkhông?" 8581#~ msgstr "Lưu cấu hình ngay bây giỠkhông?"
8602 8582
8603#, fuzzy 8583#, fuzzy
8604#~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n"
8605#~ msgstr "Không thể lưu tập tin cấu hình « %s »:"
8606
8607#, fuzzy
8608#~ msgid "Unreadable or malformed configuration, exit ...\n" 8584#~ msgid "Unreadable or malformed configuration, exit ...\n"
8609#~ msgstr "Không thể lưu tập tin cấu hình « %s »:" 8585#~ msgstr "Không thể lưu tập tin cấu hình « %s »:"
8610 8586
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 342f8a707..b459071c3 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -7,7 +7,7 @@ msgid ""
7msgstr "" 7msgstr ""
8"Project-Id-Version: gnunet-0.8.1\n" 8"Project-Id-Version: gnunet-0.8.1\n"
9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" 9"Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n"
10"POT-Creation-Date: 2024-03-02 14:38+0100\n" 10"POT-Creation-Date: 2024-05-20 20:21+0200\n"
11"PO-Revision-Date: 2011-07-09 12:12+0800\n" 11"PO-Revision-Date: 2011-07-09 12:12+0800\n"
12"Last-Translator: Wylmer Wang <wantinghard@gmail.com>\n" 12"Last-Translator: Wylmer Wang <wantinghard@gmail.com>\n"
13"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n" 13"Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n"
@@ -343,22 +343,27 @@ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
343msgid "Failed to connect to CORE service!\n" 343msgid "Failed to connect to CORE service!\n"
344msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" 344msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
345 345
346#: src/cli/core/gnunet-core.c:230 src/service/transport/gnunet-transport.c:1389 346#: src/cli/core/gnunet-core.c:213
347#, fuzzy
348msgid "No argument given.\n"
349msgstr "无法获å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n"
350
351#: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389
347msgid "provide information about all current connections (continuously)" 352msgid "provide information about all current connections (continuously)"
348msgstr "" 353msgstr ""
349 354
350#: src/cli/core/gnunet-core.c:236 355#: src/cli/core/gnunet-core.c:244
351msgid "Show our current peer identity" 356msgid "Show our current peer identity"
352msgstr "" 357msgstr ""
353 358
354#: src/cli/core/gnunet-core.c:243 359#: src/cli/core/gnunet-core.c:251
355#, fuzzy 360#, fuzzy
356msgid "Show current connections" 361msgid "Show current connections"
357msgstr "" 362msgstr ""
358"\n" 363"\n"
359"按任æ„键继续\n" 364"按任æ„键继续\n"
360 365
361#: src/cli/core/gnunet-core.c:254 366#: src/cli/core/gnunet-core.c:262
362msgid "Print information about connected peers." 367msgid "Print information about connected peers."
363msgstr "" 368msgstr ""
364 369
@@ -1055,52 +1060,52 @@ msgstr ""
1055msgid "Unindex a file that was previously indexed with gnunet-publish." 1060msgid "Unindex a file that was previously indexed with gnunet-publish."
1056msgstr "" 1061msgstr ""
1057 1062
1058#: src/cli/gns/gnunet-gns.c:268 1063#: src/cli/gns/gnunet-gns.c:269
1059#, fuzzy, c-format 1064#, fuzzy, c-format
1060msgid "`%s' is not a valid DNS domain name\n" 1065msgid "`%s' is not a valid DNS domain name\n"
1061msgstr "“%sâ€ä¸å¯ç”¨ã€‚\n" 1066msgstr "“%sâ€ä¸å¯ç”¨ã€‚\n"
1062 1067
1063#: src/cli/gns/gnunet-gns.c:279 src/lib/util/dnsparser.c:273 1068#: src/cli/gns/gnunet-gns.c:280 src/lib/util/dnsparser.c:273
1064#, fuzzy, c-format 1069#, fuzzy, c-format
1065msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" 1070msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n"
1066msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" 1071msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n"
1067 1072
1068#: src/cli/gns/gnunet-gns.c:294 1073#: src/cli/gns/gnunet-gns.c:295
1069msgid "Cannot resolve using GNS: GNUnet peer not running\n" 1074msgid "Cannot resolve using GNS: GNUnet peer not running\n"
1070msgstr "" 1075msgstr ""
1071 1076
1072#: src/cli/gns/gnunet-gns.c:305 1077#: src/cli/gns/gnunet-gns.c:306
1073#: src/contrib/service/abd/gnunet-service-abd.c:1745 1078#: src/contrib/service/abd/gnunet-service-abd.c:1745
1074#, fuzzy, c-format 1079#, fuzzy, c-format
1075msgid "Failed to connect to GNS\n" 1080msgid "Failed to connect to GNS\n"
1076msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" 1081msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
1077 1082
1078#: src/cli/gns/gnunet-gns.c:318 1083#: src/cli/gns/gnunet-gns.c:325
1079#, c-format 1084#, c-format
1080msgid "Invalid typename specified, assuming `ANY'\n" 1085msgid "Invalid typename specified, assuming `ANY'\n"
1081msgstr "" 1086msgstr ""
1082 1087
1083#: src/cli/gns/gnunet-gns.c:358 1088#: src/cli/gns/gnunet-gns.c:365
1084msgid "Lookup a record for the given name" 1089msgid "Lookup a record for the given name"
1085msgstr "" 1090msgstr ""
1086 1091
1087#: src/cli/gns/gnunet-gns.c:364 1092#: src/cli/gns/gnunet-gns.c:371
1088msgid "Specify the type of the record to lookup" 1093msgid "Specify the type of the record to lookup"
1089msgstr "" 1094msgstr ""
1090 1095
1091#: src/cli/gns/gnunet-gns.c:370 1096#: src/cli/gns/gnunet-gns.c:377
1092msgid "Specify a timeout for the lookup" 1097msgid "Specify a timeout for the lookup"
1093msgstr "" 1098msgstr ""
1094 1099
1095#: src/cli/gns/gnunet-gns.c:374 1100#: src/cli/gns/gnunet-gns.c:381
1096msgid "No unneeded output" 1101msgid "No unneeded output"
1097msgstr "" 1102msgstr ""
1098 1103
1099#: src/cli/gns/gnunet-gns.c:379 1104#: src/cli/gns/gnunet-gns.c:386
1100msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" 1105msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8"
1101msgstr "" 1106msgstr ""
1102 1107
1103#: src/cli/gns/gnunet-gns.c:393 1108#: src/cli/gns/gnunet-gns.c:400
1104#, fuzzy 1109#, fuzzy
1105msgid "GNUnet GNS resolver tool" 1110msgid "GNUnet GNS resolver tool"
1106msgstr "GNUnet 错误日志" 1111msgstr "GNUnet 错误日志"
@@ -1627,7 +1632,11 @@ msgstr ""
1627msgid "GNUnet NAT traversal autoconfigure daemon" 1632msgid "GNUnet NAT traversal autoconfigure daemon"
1628msgstr "" 1633msgstr ""
1629 1634
1630#: src/cli/nse/gnunet-nse.c:124 1635#: src/cli/nse/gnunet-nse.c:126
1636msgid "Monitor and output current estimates"
1637msgstr ""
1638
1639#: src/cli/nse/gnunet-nse.c:137
1631msgid "Show network size estimates from NSE service." 1640msgid "Show network size estimates from NSE service."
1632msgstr "" 1641msgstr ""
1633 1642
@@ -1675,87 +1684,91 @@ msgstr ""
1675msgid "The time until the DID Document is going to expire (e.g. 5d)" 1684msgid "The time until the DID Document is going to expire (e.g. 5d)"
1676msgstr "" 1685msgstr ""
1677 1686
1678#: src/cli/reclaim/gnunet-reclaim.c:805 1687#: src/cli/reclaim/gnunet-reclaim.c:813
1679#, fuzzy, c-format 1688#, fuzzy, c-format
1680msgid "Ego is required\n" 1689msgid "Ego is required\n"
1681msgstr "%s:选项“%sâ€æœ‰æ­§ä¹‰\n" 1690msgstr "%s:选项“%sâ€æœ‰æ­§ä¹‰\n"
1682 1691
1683#: src/cli/reclaim/gnunet-reclaim.c:812 1692#: src/cli/reclaim/gnunet-reclaim.c:820
1684#, c-format 1693#, c-format
1685msgid "Attribute value missing!\n" 1694msgid "Attribute value missing!\n"
1686msgstr "" 1695msgstr ""
1687 1696
1688#: src/cli/reclaim/gnunet-reclaim.c:819 1697#: src/cli/reclaim/gnunet-reclaim.c:827
1689#, fuzzy, c-format 1698#, fuzzy, c-format
1690msgid "Requesting party key is required!\n" 1699msgid "Requesting party key is required!\n"
1691msgstr "设置è¦ä½¿ç”¨çš„昵称(å¿…é¡»)" 1700msgstr "设置è¦ä½¿ç”¨çš„昵称(å¿…é¡»)"
1692 1701
1693#: src/cli/reclaim/gnunet-reclaim.c:837 1702#: src/cli/reclaim/gnunet-reclaim.c:846
1694msgid "Add or update an attribute NAME" 1703msgid "Add or update an attribute NAME"
1695msgstr "" 1704msgstr ""
1696 1705
1697#: src/cli/reclaim/gnunet-reclaim.c:842 1706#: src/cli/reclaim/gnunet-reclaim.c:851
1698msgid "Delete the attribute with ID" 1707msgid "Delete the attribute with ID"
1699msgstr "" 1708msgstr ""
1700 1709
1701#: src/cli/reclaim/gnunet-reclaim.c:847 1710#: src/cli/reclaim/gnunet-reclaim.c:856
1702msgid "The attribute VALUE" 1711msgid "The attribute VALUE"
1703msgstr "" 1712msgstr ""
1704 1713
1705#: src/cli/reclaim/gnunet-reclaim.c:852 1714#: src/cli/reclaim/gnunet-reclaim.c:861
1706#, fuzzy 1715#, fuzzy
1707msgid "The EGO to use" 1716msgid "The EGO to use"
1708msgstr "消æ¯å°ºå¯¸" 1717msgstr "消æ¯å°ºå¯¸"
1709 1718
1710#: src/cli/reclaim/gnunet-reclaim.c:858 1719#: src/cli/reclaim/gnunet-reclaim.c:867
1711msgid "Specify the relying party for issue" 1720msgid "Specify the relying party for issue"
1712msgstr "" 1721msgstr ""
1713 1722
1714#: src/cli/reclaim/gnunet-reclaim.c:862 1723#: src/cli/reclaim/gnunet-reclaim.c:873
1724msgid "Specify the relying party URI for a ticket to consume"
1725msgstr ""
1726
1727#: src/cli/reclaim/gnunet-reclaim.c:877
1715msgid "List attributes for EGO" 1728msgid "List attributes for EGO"
1716msgstr "" 1729msgstr ""
1717 1730
1718#: src/cli/reclaim/gnunet-reclaim.c:866 1731#: src/cli/reclaim/gnunet-reclaim.c:881
1719msgid "List credentials for EGO" 1732msgid "List credentials for EGO"
1720msgstr "" 1733msgstr ""
1721 1734
1722#: src/cli/reclaim/gnunet-reclaim.c:872 1735#: src/cli/reclaim/gnunet-reclaim.c:887
1723msgid "Credential to use for attribute" 1736msgid "Credential to use for attribute"
1724msgstr "" 1737msgstr ""
1725 1738
1726#: src/cli/reclaim/gnunet-reclaim.c:877 1739#: src/cli/reclaim/gnunet-reclaim.c:892
1727msgid "Credential name" 1740msgid "Credential name"
1728msgstr "" 1741msgstr ""
1729 1742
1730#: src/cli/reclaim/gnunet-reclaim.c:883 1743#: src/cli/reclaim/gnunet-reclaim.c:898
1731msgid "Issue a ticket for a set of attributes separated by comma" 1744msgid "Issue a ticket for a set of attributes separated by comma"
1732msgstr "" 1745msgstr ""
1733 1746
1734#: src/cli/reclaim/gnunet-reclaim.c:888 1747#: src/cli/reclaim/gnunet-reclaim.c:903
1735msgid "Consume a ticket" 1748msgid "Consume a ticket"
1736msgstr "" 1749msgstr ""
1737 1750
1738#: src/cli/reclaim/gnunet-reclaim.c:893 1751#: src/cli/reclaim/gnunet-reclaim.c:908
1739msgid "Revoke a ticket" 1752msgid "Revoke a ticket"
1740msgstr "" 1753msgstr ""
1741 1754
1742#: src/cli/reclaim/gnunet-reclaim.c:898 1755#: src/cli/reclaim/gnunet-reclaim.c:913
1743msgid "Type of attribute" 1756msgid "Type of attribute"
1744msgstr "" 1757msgstr ""
1745 1758
1746#: src/cli/reclaim/gnunet-reclaim.c:903 1759#: src/cli/reclaim/gnunet-reclaim.c:918
1747msgid "Type of credential" 1760msgid "Type of credential"
1748msgstr "" 1761msgstr ""
1749 1762
1750#: src/cli/reclaim/gnunet-reclaim.c:907 1763#: src/cli/reclaim/gnunet-reclaim.c:922
1751msgid "List tickets of ego" 1764msgid "List tickets of ego"
1752msgstr "" 1765msgstr ""
1753 1766
1754#: src/cli/reclaim/gnunet-reclaim.c:913 1767#: src/cli/reclaim/gnunet-reclaim.c:928
1755msgid "Expiration interval of the attribute" 1768msgid "Expiration interval of the attribute"
1756msgstr "" 1769msgstr ""
1757 1770
1758#: src/cli/reclaim/gnunet-reclaim.c:921 1771#: src/cli/reclaim/gnunet-reclaim.c:936
1759msgid "re:claimID command line tool" 1772msgid "re:claimID command line tool"
1760msgstr "" 1773msgstr ""
1761 1774
@@ -1992,34 +2005,59 @@ msgstr ""
1992msgid "run decoder modus, otherwise runs as encoder" 2005msgid "run decoder modus, otherwise runs as encoder"
1993msgstr "" 2006msgstr ""
1994 2007
1995#: src/cli/util/gnunet-config.c:154 2008#: src/cli/util/gnunet-config.c:101
1996msgid "test if the current installation supports the specified BACKEND" 2009msgid "test if the current installation supports the specified BACKEND"
1997msgstr "" 2010msgstr ""
1998 2011
1999#: src/cli/util/gnunet-config.c:160 2012#: src/cli/util/gnunet-config.c:107
2000msgid "" 2013msgid ""
2001"Provide an appropriate value for CFLAGS to applications building on top of " 2014"Provide an appropriate value for CFLAGS to applications building on top of "
2002"GNUnet" 2015"GNUnet"
2003msgstr "" 2016msgstr ""
2004 2017
2005#: src/cli/util/gnunet-config.c:165 2018#: src/cli/util/gnunet-config.c:112
2006msgid "Is this an experimental build of GNUnet" 2019msgid "Is this an experimental build of GNUnet"
2007msgstr "" 2020msgstr ""
2008 2021
2009#: src/cli/util/gnunet-config.c:171 2022#: src/cli/util/gnunet-config.c:118
2010msgid "" 2023msgid ""
2011"Provide an appropriate value for LIBS to applications building on top of " 2024"Provide an appropriate value for LIBS to applications building on top of "
2012"GNUnet" 2025"GNUnet"
2013msgstr "" 2026msgstr ""
2014 2027
2015#: src/cli/util/gnunet-config.c:177 2028#: src/cli/util/gnunet-config.c:123
2029#, fuzzy
2030msgid "Do not parse default configuration files"
2031msgstr "更改é…置文件中的一个值"
2032
2033#: src/cli/util/gnunet-config.c:129
2016msgid "Provide the path under which GNUnet was installed" 2034msgid "Provide the path under which GNUnet was installed"
2017msgstr "" 2035msgstr ""
2018 2036
2019#: src/cli/util/gnunet-config.c:192 2037#: src/cli/util/gnunet-config.c:136
2038msgid ""
2039"Parse main configuration from this command-line argument and not from disk"
2040msgstr ""
2041
2042#: src/cli/util/gnunet-config.c:225
2020#, fuzzy 2043#, fuzzy
2021msgid "Manipulate GNUnet configuration files" 2044msgid "Failed to load default configuration, exiting ...\n"
2022msgstr "更改é…置文件中的一个值" 2045msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
2046
2047#: src/cli/util/gnunet-config.c:237
2048#, fuzzy
2049msgid "Failed to parse configuration, exiting ...\n"
2050msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
2051
2052#: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287
2053#, fuzzy, c-format
2054msgid "Unreadable configuration file `%s', exiting ...\n"
2055msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
2056
2057#: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299
2058#, fuzzy, c-format
2059msgid "Malformed configuration file `%s', exiting ...\n"
2060msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
2023 2061
2024#: src/cli/util/gnunet-crypto-tvg.c:1588 2062#: src/cli/util/gnunet-crypto-tvg.c:1588
2025msgid "verify a test vector from stdin" 2063msgid "verify a test vector from stdin"
@@ -2066,55 +2104,54 @@ msgstr ""
2066msgid "Hostkeys file `%s' not found\n" 2104msgid "Hostkeys file `%s' not found\n"
2067msgstr "" 2105msgstr ""
2068 2106
2069#: src/cli/util/gnunet-ecc.c:314 2107#: src/cli/util/gnunet-ecc.c:318
2070#, fuzzy, c-format 2108#, fuzzy, c-format
2071msgid "Hostkeys file `%s' is empty\n" 2109msgid "Hostkeys file `%s' is empty\n"
2072msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" 2110msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n"
2073 2111
2074#: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 2112#: src/cli/util/gnunet-ecc.c:324
2075#: src/service/testing/testing.c:308
2076#, c-format 2113#, c-format
2077msgid "Incorrect hostkey file format: %s\n" 2114msgid "Incorrect hostkey file format: %s\n"
2078msgstr "" 2115msgstr ""
2079 2116
2080#: src/cli/util/gnunet-ecc.c:334 2117#: src/cli/util/gnunet-ecc.c:340
2081#, fuzzy, c-format 2118#, fuzzy, c-format
2082msgid "Could not read hostkey file: %s\n" 2119msgid "Could not read hostkey file: %s\n"
2083msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" 2120msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n"
2084 2121
2085#: src/cli/util/gnunet-ecc.c:388 2122#: src/cli/util/gnunet-ecc.c:394
2086msgid "No hostkey file specified on command line\n" 2123msgid "No hostkey file specified on command line\n"
2087msgstr "" 2124msgstr ""
2088 2125
2089#: src/cli/util/gnunet-ecc.c:452 2126#: src/cli/util/gnunet-ecc.c:458
2090msgid "list keys included in a file (for testing)" 2127msgid "list keys included in a file (for testing)"
2091msgstr "" 2128msgstr ""
2092 2129
2093#: src/cli/util/gnunet-ecc.c:458 2130#: src/cli/util/gnunet-ecc.c:464
2094msgid "number of keys to list included in a file (for testing)" 2131msgid "number of keys to list included in a file (for testing)"
2095msgstr "" 2132msgstr ""
2096 2133
2097#: src/cli/util/gnunet-ecc.c:464 2134#: src/cli/util/gnunet-ecc.c:470
2098msgid "create COUNT public-private key pairs (for testing)" 2135msgid "create COUNT public-private key pairs (for testing)"
2099msgstr "" 2136msgstr ""
2100 2137
2101#: src/cli/util/gnunet-ecc.c:469 2138#: src/cli/util/gnunet-ecc.c:475
2102msgid "print the public key in ASCII format" 2139msgid "print the public key in ASCII format"
2103msgstr "" 2140msgstr ""
2104 2141
2105#: src/cli/util/gnunet-ecc.c:474 2142#: src/cli/util/gnunet-ecc.c:480
2106msgid "print the private key in ASCII format" 2143msgid "print the private key in ASCII format"
2107msgstr "" 2144msgstr ""
2108 2145
2109#: src/cli/util/gnunet-ecc.c:479 2146#: src/cli/util/gnunet-ecc.c:485
2110msgid "print the public key in HEX format" 2147msgid "print the public key in HEX format"
2111msgstr "" 2148msgstr ""
2112 2149
2113#: src/cli/util/gnunet-ecc.c:485 2150#: src/cli/util/gnunet-ecc.c:491
2114msgid "print examples of ECC operations (used for compatibility testing)" 2151msgid "print examples of ECC operations (used for compatibility testing)"
2115msgstr "" 2152msgstr ""
2116 2153
2117#: src/cli/util/gnunet-ecc.c:499 2154#: src/cli/util/gnunet-ecc.c:505
2118#, fuzzy 2155#, fuzzy
2119msgid "Manipulate GNUnet private ECC key files" 2156msgid "Manipulate GNUnet private ECC key files"
2120msgstr "更改é…置文件中的一个值" 2157msgstr "更改é…置文件中的一个值"
@@ -3192,13 +3229,13 @@ msgstr ""
3192msgid "Invalid handle type while writing `%s'" 3229msgid "Invalid handle type while writing `%s'"
3193msgstr "IP æ ¼å¼æ— æ•ˆï¼šâ€œ%sâ€\n" 3230msgstr "IP æ ¼å¼æ— æ•ˆï¼šâ€œ%sâ€\n"
3194 3231
3195#: src/lib/util/client.c:531 src/lib/util/service.c:1134 3232#: src/lib/util/client.c:531 src/lib/util/service.c:1139
3196#: src/service/arm/gnunet-service-arm.c:452 3233#: src/service/arm/gnunet-service-arm.c:452
3197#, c-format 3234#, c-format
3198msgid "UNIXPATH `%s' too long, maximum length is %llu\n" 3235msgid "UNIXPATH `%s' too long, maximum length is %llu\n"
3199msgstr "" 3236msgstr ""
3200 3237
3201#: src/lib/util/client.c:536 src/lib/util/service.c:1138 3238#: src/lib/util/client.c:536 src/lib/util/service.c:1143
3202#: src/service/arm/gnunet-service-arm.c:456 3239#: src/service/arm/gnunet-service-arm.c:456
3203#, fuzzy, c-format 3240#, fuzzy, c-format
3204msgid "Using `%s' instead\n" 3241msgid "Using `%s' instead\n"
@@ -3327,17 +3364,17 @@ msgstr ""
3327msgid "`%s' failed at %s:%d with error: %s\n" 3364msgid "`%s' failed at %s:%d with error: %s\n"
3328msgstr "“%sâ€äºŽ %s:%d 处失败,错误为:%s\n" 3365msgstr "“%sâ€äºŽ %s:%d 处失败,错误为:%s\n"
3329 3366
3330#: src/lib/util/crypto_ecc.c:554 3367#: src/lib/util/crypto_ecc.c:569
3331#, fuzzy, c-format 3368#, fuzzy, c-format
3332msgid "ECC signing failed at %s:%d: %s\n" 3369msgid "ECC signing failed at %s:%d: %s\n"
3333msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" 3370msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n"
3334 3371
3335#: src/lib/util/crypto_ecc.c:677 3372#: src/lib/util/crypto_ecc.c:692
3336#, fuzzy, c-format 3373#, fuzzy, c-format
3337msgid "ECDSA signature verification failed at %s:%d: %s\n" 3374msgid "ECDSA signature verification failed at %s:%d: %s\n"
3338msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" 3375msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n"
3339 3376
3340#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:304 3377#: src/lib/util/crypto_ecc_setup.c:282 src/lib/util/crypto_ecc_setup.c:305
3341#, fuzzy 3378#, fuzzy
3342msgid "Could not load peer's private key\n" 3379msgid "Could not load peer's private key\n"
3343msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" 3380msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n"
@@ -3362,7 +3399,7 @@ msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n"
3362msgid "Expected `%s' to be a directory!\n" 3399msgid "Expected `%s' to be a directory!\n"
3363msgstr "“%sâ€åº”为目录ï¼\n" 3400msgstr "“%sâ€åº”为目录ï¼\n"
3364 3401
3365#: src/lib/util/disk.c:1222 src/lib/util/service.c:1642 3402#: src/lib/util/disk.c:1222 src/lib/util/service.c:1651
3366#, c-format 3403#, c-format
3367msgid "Cannot obtain information about user `%s': %s\n" 3404msgid "Cannot obtain information about user `%s': %s\n"
3368msgstr "无法获å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" 3405msgstr "无法获å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n"
@@ -3553,94 +3590,94 @@ msgstr "您必须å‘“%sâ€é€‰é¡¹ä¼ é€’一个数字。\n"
3553msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" 3590msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n"
3554msgstr "" 3591msgstr ""
3555 3592
3556#: src/lib/util/gnunet_error_codes.c:60 3593#: src/lib/util/gnunet_error_codes.c:59
3557msgid "No error (success)." 3594msgid "No error (success)."
3558msgstr "" 3595msgstr ""
3559 3596
3560#: src/lib/util/gnunet_error_codes.c:66 3597#: src/lib/util/gnunet_error_codes.c:65
3561#, fuzzy 3598#, fuzzy
3562msgid "Unknown and unspecified error." 3599msgid "Unknown and unspecified error."
3563msgstr "未知的用户“%sâ€\n" 3600msgstr "未知的用户“%sâ€\n"
3564 3601
3565#: src/lib/util/gnunet_error_codes.c:72 3602#: src/lib/util/gnunet_error_codes.c:71
3566#, fuzzy 3603#, fuzzy
3567msgid "Communication with service failed." 3604msgid "Communication with service failed."
3568msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n" 3605msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n"
3569 3606
3570#: src/lib/util/gnunet_error_codes.c:78 3607#: src/lib/util/gnunet_error_codes.c:77
3571msgid "Ego not found." 3608msgid "Ego not found."
3572msgstr "" 3609msgstr ""
3573 3610
3574#: src/lib/util/gnunet_error_codes.c:84 3611#: src/lib/util/gnunet_error_codes.c:83
3575msgid "Identifier already in use for another ego." 3612msgid "Identifier already in use for another ego."
3576msgstr "" 3613msgstr ""
3577 3614
3578#: src/lib/util/gnunet_error_codes.c:90 3615#: src/lib/util/gnunet_error_codes.c:89
3579msgid "The given ego is invalid or malformed." 3616msgid "The given ego is invalid or malformed."
3580msgstr "" 3617msgstr ""
3581 3618
3582#: src/lib/util/gnunet_error_codes.c:96 3619#: src/lib/util/gnunet_error_codes.c:95
3583#, fuzzy 3620#, fuzzy
3584msgid "Unknown namestore error." 3621msgid "Unknown namestore error."
3585msgstr "未知的用户“%sâ€\n" 3622msgstr "未知的用户“%sâ€\n"
3586 3623
3587#: src/lib/util/gnunet_error_codes.c:102 src/lib/util/gnunet_error_codes.c:120 3624#: src/lib/util/gnunet_error_codes.c:101 src/lib/util/gnunet_error_codes.c:119
3588msgid "Zone iteration failed." 3625msgid "Zone iteration failed."
3589msgstr "" 3626msgstr ""
3590 3627
3591#: src/lib/util/gnunet_error_codes.c:108 3628#: src/lib/util/gnunet_error_codes.c:107
3592msgid "Zone not found." 3629msgid "Zone not found."
3593msgstr "" 3630msgstr ""
3594 3631
3595#: src/lib/util/gnunet_error_codes.c:114 3632#: src/lib/util/gnunet_error_codes.c:113
3596msgid "Record not found." 3633msgid "Record not found."
3597msgstr "" 3634msgstr ""
3598 3635
3599#: src/lib/util/gnunet_error_codes.c:126 3636#: src/lib/util/gnunet_error_codes.c:125
3600msgid "Zone does not contain any records." 3637msgid "Zone does not contain any records."
3601msgstr "" 3638msgstr ""
3602 3639
3603#: src/lib/util/gnunet_error_codes.c:132 3640#: src/lib/util/gnunet_error_codes.c:131
3604#, fuzzy 3641#, fuzzy
3605msgid "Failed to lookup record." 3642msgid "Failed to lookup record."
3606msgstr "è¿è¡Œ %s失败:%s %d\n" 3643msgstr "è¿è¡Œ %s失败:%s %d\n"
3607 3644
3608#: src/lib/util/gnunet_error_codes.c:138 3645#: src/lib/util/gnunet_error_codes.c:137
3609#, fuzzy 3646#, fuzzy
3610msgid "No records given." 3647msgid "No records given."
3611msgstr "无法获å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" 3648msgstr "无法获å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n"
3612 3649
3613#: src/lib/util/gnunet_error_codes.c:144 3650#: src/lib/util/gnunet_error_codes.c:143
3614msgid "Record data invalid." 3651msgid "Record data invalid."
3615msgstr "" 3652msgstr ""
3616 3653
3617#: src/lib/util/gnunet_error_codes.c:150 3654#: src/lib/util/gnunet_error_codes.c:149
3618msgid "No label given." 3655msgid "No label given."
3619msgstr "" 3656msgstr ""
3620 3657
3621#: src/lib/util/gnunet_error_codes.c:156 3658#: src/lib/util/gnunet_error_codes.c:155
3622#, fuzzy 3659#, fuzzy
3623msgid "No results given." 3660msgid "No results given."
3624msgstr "无法获å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" 3661msgstr "无法获å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n"
3625 3662
3626#: src/lib/util/gnunet_error_codes.c:162 3663#: src/lib/util/gnunet_error_codes.c:161
3627msgid "Record already exists." 3664msgid "Record already exists."
3628msgstr "" 3665msgstr ""
3629 3666
3630#: src/lib/util/gnunet_error_codes.c:168 3667#: src/lib/util/gnunet_error_codes.c:167
3631msgid "Record size exceeds maximum limit." 3668msgid "Record size exceeds maximum limit."
3632msgstr "" 3669msgstr ""
3633 3670
3634#: src/lib/util/gnunet_error_codes.c:174 3671#: src/lib/util/gnunet_error_codes.c:173
3635msgid "There was an error in the database backend." 3672msgid "There was an error in the database backend."
3636msgstr "" 3673msgstr ""
3637 3674
3638#: src/lib/util/gnunet_error_codes.c:180 3675#: src/lib/util/gnunet_error_codes.c:179
3639#, fuzzy 3676#, fuzzy
3640msgid "Failed to store the given records." 3677msgid "Failed to store the given records."
3641msgstr "è¿è¡Œ %s失败:%s %d\n" 3678msgstr "è¿è¡Œ %s失败:%s %d\n"
3642 3679
3643#: src/lib/util/gnunet_error_codes.c:186 3680#: src/lib/util/gnunet_error_codes.c:185
3644msgid "Label invalid or malformed." 3681msgid "Label invalid or malformed."
3645msgstr "" 3682msgstr ""
3646 3683
@@ -3707,16 +3744,6 @@ msgstr ""
3707msgid "Could not determine plugin installation path.\n" 3744msgid "Could not determine plugin installation path.\n"
3708msgstr "无法确定用户界é¢å®šä¹‰æ–‡ä»¶ã€‚" 3745msgstr "无法确定用户界é¢å®šä¹‰æ–‡ä»¶ã€‚"
3709 3746
3710#: src/lib/util/program.c:287
3711#, fuzzy, c-format
3712msgid "Unreadable configuration file `%s', exiting ...\n"
3713msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
3714
3715#: src/lib/util/program.c:299
3716#, fuzzy, c-format
3717msgid "Malformed configuration file `%s', exiting ...\n"
3718msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
3719
3720#: src/lib/util/program.c:314 3747#: src/lib/util/program.c:314
3721#, fuzzy, c-format 3748#, fuzzy, c-format
3722msgid "Unreadable configuration file `%s'. Exiting ...\n" 3749msgid "Unreadable configuration file `%s'. Exiting ...\n"
@@ -3765,120 +3792,120 @@ msgstr ""
3765msgid "Could not resolve our FQDN: %s\n" 3792msgid "Could not resolve our FQDN: %s\n"
3766msgstr "无法解æžâ€œ%sâ€(%s):%s\n" 3793msgstr "无法解æžâ€œ%sâ€(%s):%s\n"
3767 3794
3768#: src/lib/util/service.c:654 3795#: src/lib/util/service.c:650
3769#, c-format 3796#, c-format
3770msgid "" 3797msgid ""
3771"Processing code for message of type %u did not call " 3798"Processing code for message of type %u did not call "
3772"`GNUNET_SERVICE_client_continue' after %s\n" 3799"`GNUNET_SERVICE_client_continue' after %s\n"
3773msgstr "" 3800msgstr ""
3774 3801
3775#: src/lib/util/service.c:838 3802#: src/lib/util/service.c:841
3776#, c-format 3803#, c-format
3777msgid "Unknown address family %d\n" 3804msgid "Unknown address family %d\n"
3778msgstr "" 3805msgstr ""
3779 3806
3780#: src/lib/util/service.c:951 3807#: src/lib/util/service.c:956
3781#, c-format 3808#, c-format
3782msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" 3809msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n"
3783msgstr "" 3810msgstr ""
3784 3811
3785#: src/lib/util/service.c:992 3812#: src/lib/util/service.c:997
3786#, c-format 3813#, c-format
3787msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" 3814msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n"
3788msgstr "" 3815msgstr ""
3789 3816
3790#: src/lib/util/service.c:1095 src/lib/util/service.c:1101 3817#: src/lib/util/service.c:1100 src/lib/util/service.c:1106
3791#: src/service/arm/gnunet-service-arm.c:412 3818#: src/service/arm/gnunet-service-arm.c:412
3792#: src/service/arm/gnunet-service-arm.c:418 3819#: src/service/arm/gnunet-service-arm.c:418
3793#, c-format 3820#, c-format
3794msgid "Require valid port number for service `%s' in configuration!\n" 3821msgid "Require valid port number for service `%s' in configuration!\n"
3795msgstr "" 3822msgstr ""
3796 3823
3797#: src/lib/util/service.c:1158 src/service/arm/gnunet-service-arm.c:484 3824#: src/lib/util/service.c:1163 src/service/arm/gnunet-service-arm.c:484
3798#, c-format 3825#, c-format
3799msgid "" 3826msgid ""
3800"Disabling UNIX domain socket support for service `%s', failed to create UNIX " 3827"Disabling UNIX domain socket support for service `%s', failed to create UNIX "
3801"domain socket: %s\n" 3828"domain socket: %s\n"
3802msgstr "" 3829msgstr ""
3803 3830
3804#: src/lib/util/service.c:1176 src/service/arm/gnunet-service-arm.c:505 3831#: src/lib/util/service.c:1181 src/service/arm/gnunet-service-arm.c:505
3805#, c-format 3832#, c-format
3806msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" 3833msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n"
3807msgstr "" 3834msgstr ""
3808 3835
3809#: src/lib/util/service.c:1207 src/service/arm/gnunet-service-arm.c:536 3836#: src/lib/util/service.c:1212 src/service/arm/gnunet-service-arm.c:536
3810#, fuzzy, c-format 3837#, fuzzy, c-format
3811msgid "Failed to resolve `%s': %s\n" 3838msgid "Failed to resolve `%s': %s\n"
3812msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" 3839msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n"
3813 3840
3814#: src/lib/util/service.c:1226 src/service/arm/gnunet-service-arm.c:555 3841#: src/lib/util/service.c:1231 src/service/arm/gnunet-service-arm.c:555
3815#, fuzzy, c-format 3842#, fuzzy, c-format
3816msgid "Failed to find %saddress for `%s'.\n" 3843msgid "Failed to find %saddress for `%s'.\n"
3817msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" 3844msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n"
3818 3845
3819#: src/lib/util/service.c:1401 3846#: src/lib/util/service.c:1406
3820#, fuzzy, c-format 3847#, fuzzy, c-format
3821msgid "`%s' failed for port %d (%s).\n" 3848msgid "`%s' failed for port %d (%s).\n"
3822msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" 3849msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n"
3823 3850
3824#: src/lib/util/service.c:1413 3851#: src/lib/util/service.c:1418
3825#, c-format 3852#, c-format
3826msgid "`%s' failed for port %d (%s): address already in use\n" 3853msgid "`%s' failed for port %d (%s): address already in use\n"
3827msgstr "" 3854msgstr ""
3828 3855
3829#: src/lib/util/service.c:1420 3856#: src/lib/util/service.c:1425
3830#, fuzzy, c-format 3857#, fuzzy, c-format
3831msgid "`%s' failed for `%s': address already in use\n" 3858msgid "`%s' failed for `%s': address already in use\n"
3832msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" 3859msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n"
3833 3860
3834#: src/lib/util/service.c:1481 3861#: src/lib/util/service.c:1486
3835#, c-format 3862#, c-format
3836msgid "Specified value for `%s' of service `%s' is invalid\n" 3863msgid "Specified value for `%s' of service `%s' is invalid\n"
3837msgstr "" 3864msgstr ""
3838 3865
3839#: src/lib/util/service.c:1505 3866#: src/lib/util/service.c:1510
3840#, c-format 3867#, c-format
3841msgid "Could not access pre-bound socket %u, will try to bind myself\n" 3868msgid "Could not access pre-bound socket %u, will try to bind myself\n"
3842msgstr "" 3869msgstr ""
3843 3870
3844#: src/lib/util/service.c:1573 3871#: src/lib/util/service.c:1583
3845msgid "" 3872msgid ""
3846"Could not bind to any of the ports I was supposed to, refusing to run!\n" 3873"Could not bind to any of the ports I was supposed to, refusing to run!\n"
3847msgstr "" 3874msgstr ""
3848 3875
3849#: src/lib/util/service.c:1644 3876#: src/lib/util/service.c:1653
3850msgid "No such user" 3877msgid "No such user"
3851msgstr "无此用户" 3878msgstr "无此用户"
3852 3879
3853#: src/lib/util/service.c:1658 3880#: src/lib/util/service.c:1668
3854#, c-format 3881#, c-format
3855msgid "Cannot change user/group to `%s': %s\n" 3882msgid "Cannot change user/group to `%s': %s\n"
3856msgstr "无法更改用户/组为“%sâ€ï¼š%s\n" 3883msgstr "无法更改用户/组为“%sâ€ï¼š%s\n"
3857 3884
3858#: src/lib/util/service.c:1751 3885#: src/lib/util/service.c:1767
3859msgid "Service process failed to initialize\n" 3886msgid "Service process failed to initialize\n"
3860msgstr "" 3887msgstr ""
3861 3888
3862#: src/lib/util/service.c:1756 3889#: src/lib/util/service.c:1772
3863msgid "Service process could not initialize server function\n" 3890msgid "Service process could not initialize server function\n"
3864msgstr "" 3891msgstr ""
3865 3892
3866#: src/lib/util/service.c:1761 3893#: src/lib/util/service.c:1777
3867msgid "Service process failed to report status\n" 3894msgid "Service process failed to report status\n"
3868msgstr "" 3895msgstr ""
3869 3896
3870#: src/lib/util/service.c:1960 src/lib/util/service.c:2255 3897#: src/lib/util/service.c:1990 src/lib/util/service.c:2304
3871msgid "do daemonize (detach from terminal)" 3898msgid "do daemonize (detach from terminal)"
3872msgstr "" 3899msgstr ""
3873 3900
3874#: src/lib/util/service.c:2036 src/lib/util/service.c:2048 3901#: src/lib/util/service.c:2065 src/lib/util/service.c:2080
3875#: src/lib/util/service.c:2298 src/lib/util/service.c:2310 3902#: src/lib/util/service.c:2353 src/lib/util/service.c:2368
3876#: src/service/transport/transport-testing-communicator.c:1055 3903#: src/service/transport/transport-testing-communicator.c:1059
3877#, fuzzy, c-format 3904#, fuzzy, c-format
3878msgid "Malformed configuration file `%s', exit ...\n" 3905msgid "Malformed configuration file `%s', exit ...\n"
3879msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" 3906msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
3880 3907
3881#: src/lib/util/service.c:2058 src/lib/util/service.c:2321 3908#: src/lib/util/service.c:2092 src/lib/util/service.c:2381
3882#, fuzzy 3909#, fuzzy
3883msgid "Malformed configuration, exit ...\n" 3910msgid "Malformed configuration, exit ...\n"
3884msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" 3911msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
@@ -4342,6 +4369,11 @@ msgstr ""
4342msgid "Initiating shutdown as requested by client.\n" 4369msgid "Initiating shutdown as requested by client.\n"
4343msgstr "" 4370msgstr ""
4344 4371
4372#: src/service/arm/testing_arm_cmd_start_peer.c:197
4373#, fuzzy, c-format
4374msgid "Failed to start `%s': %s\n"
4375msgstr "è¿è¡Œ %s失败:%s %d\n"
4376
4345#: src/service/core/gnunet-service-core.c:329 4377#: src/service/core/gnunet-service-core.c:329
4346msgid "# send requests dropped (disconnected)" 4378msgid "# send requests dropped (disconnected)"
4347msgstr "" 4379msgstr ""
@@ -4506,8 +4538,8 @@ msgstr ""
4506#: src/service/core/gnunet-service-core_sessions.c:337 4538#: src/service/core/gnunet-service-core_sessions.c:337
4507#: src/service/fs/gnunet-service-fs_cp.c:484 4539#: src/service/fs/gnunet-service-fs_cp.c:484
4508#: src/service/fs/gnunet-service-fs_cp.c:1377 4540#: src/service/fs/gnunet-service-fs_cp.c:1377
4509#: src/service/topology/gnunet-daemon-topology.c:551 4541#: src/service/topology/gnunet-daemon-topology.c:545
4510#: src/service/topology/gnunet-daemon-topology.c:633 4542#: src/service/topology/gnunet-daemon-topology.c:627
4511msgid "# peers connected" 4543msgid "# peers connected"
4512msgstr "" 4544msgstr ""
4513 4545
@@ -4631,7 +4663,7 @@ msgstr ""
4631#: src/service/datastore/gnunet-service-datastore.c:626 4663#: src/service/datastore/gnunet-service-datastore.c:626
4632#: src/service/datastore/gnunet-service-datastore.c:677 4664#: src/service/datastore/gnunet-service-datastore.c:677
4633#: src/service/datastore/gnunet-service-datastore.c:820 4665#: src/service/datastore/gnunet-service-datastore.c:820
4634#: src/service/datastore/gnunet-service-datastore.c:1428 4666#: src/service/datastore/gnunet-service-datastore.c:1431
4635msgid "# reserved" 4667msgid "# reserved"
4636msgstr "" 4668msgstr ""
4637 4669
@@ -4680,65 +4712,65 @@ msgstr ""
4680msgid "# REMOVE requests received" 4712msgid "# REMOVE requests received"
4681msgstr "" 4713msgstr ""
4682 4714
4683#: src/service/datastore/gnunet-service-datastore.c:1107 4715#: src/service/datastore/gnunet-service-datastore.c:1109
4684#, c-format 4716#, c-format
4685msgid "" 4717msgid ""
4686"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n" 4718"Datastore payload must have been inaccurate (%lld < %lld). Recomputing it.\n"
4687msgstr "" 4719msgstr ""
4688 4720
4689#: src/service/datastore/gnunet-service-datastore.c:1112 4721#: src/service/datastore/gnunet-service-datastore.c:1114
4690#: src/service/datastore/gnunet-service-datastore.c:1281 4722#: src/service/datastore/gnunet-service-datastore.c:1283
4691#, c-format 4723#, c-format
4692msgid "New payload: %lld\n" 4724msgid "New payload: %lld\n"
4693msgstr "" 4725msgstr ""
4694 4726
4695#: src/service/datastore/gnunet-service-datastore.c:1167 4727#: src/service/datastore/gnunet-service-datastore.c:1169
4696#, c-format 4728#, c-format
4697msgid "Loading `%s' datastore plugin\n" 4729msgid "Loading `%s' datastore plugin\n"
4698msgstr "" 4730msgstr ""
4699 4731
4700#: src/service/datastore/gnunet-service-datastore.c:1176 4732#: src/service/datastore/gnunet-service-datastore.c:1178
4701#, fuzzy, c-format 4733#, fuzzy, c-format
4702msgid "Failed to load datastore plugin for `%s'\n" 4734msgid "Failed to load datastore plugin for `%s'\n"
4703msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" 4735msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
4704 4736
4705#: src/service/datastore/gnunet-service-datastore.c:1236 4737#: src/service/datastore/gnunet-service-datastore.c:1238
4706msgid "Bloomfilter construction complete.\n" 4738msgid "Bloomfilter construction complete.\n"
4707msgstr "" 4739msgstr ""
4708 4740
4709#: src/service/datastore/gnunet-service-datastore.c:1288 4741#: src/service/datastore/gnunet-service-datastore.c:1290
4710msgid "Rebuilding bloomfilter. Please be patient.\n" 4742msgid "Rebuilding bloomfilter. Please be patient.\n"
4711msgstr "" 4743msgstr ""
4712 4744
4713#: src/service/datastore/gnunet-service-datastore.c:1298 4745#: src/service/datastore/gnunet-service-datastore.c:1300
4714msgid "Plugin does not support get_keys function. Please fix!\n" 4746msgid "Plugin does not support get_keys function. Please fix!\n"
4715msgstr "" 4747msgstr ""
4716 4748
4717#: src/service/datastore/gnunet-service-datastore.c:1463 4749#: src/service/datastore/gnunet-service-datastore.c:1466
4718#, c-format 4750#, c-format
4719msgid "# bytes used in file-sharing datastore `%s'" 4751msgid "# bytes used in file-sharing datastore `%s'"
4720msgstr "" 4752msgstr ""
4721 4753
4722#: src/service/datastore/gnunet-service-datastore.c:1472 4754#: src/service/datastore/gnunet-service-datastore.c:1475
4723msgid "# quota" 4755msgid "# quota"
4724msgstr "" 4756msgstr ""
4725 4757
4726#: src/service/datastore/gnunet-service-datastore.c:1475 4758#: src/service/datastore/gnunet-service-datastore.c:1478
4727msgid "# cache size" 4759msgid "# cache size"
4728msgstr "" 4760msgstr ""
4729 4761
4730#: src/service/datastore/gnunet-service-datastore.c:1491 4762#: src/service/datastore/gnunet-service-datastore.c:1494
4731#, c-format 4763#, c-format
4732msgid "Could not use specified filename `%s' for bloomfilter.\n" 4764msgid "Could not use specified filename `%s' for bloomfilter.\n"
4733msgstr "" 4765msgstr ""
4734 4766
4735#: src/service/datastore/gnunet-service-datastore.c:1512 4767#: src/service/datastore/gnunet-service-datastore.c:1515
4736#: src/service/datastore/gnunet-service-datastore.c:1534 4768#: src/service/datastore/gnunet-service-datastore.c:1537
4737#, fuzzy, c-format 4769#, fuzzy, c-format
4738msgid "Failed to remove bogus bloomfilter file `%s'\n" 4770msgid "Failed to remove bogus bloomfilter file `%s'\n"
4739msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" 4771msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
4740 4772
4741#: src/service/datastore/gnunet-service-datastore.c:1573 4773#: src/service/datastore/gnunet-service-datastore.c:1576
4742#, fuzzy 4774#, fuzzy
4743msgid "Failed to initialize bloomfilter.\n" 4775msgid "Failed to initialize bloomfilter.\n"
4744msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" 4776msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
@@ -5518,7 +5550,7 @@ msgstr "ç«‹å³ä¿å­˜é…置?"
5518 5550
5519#: src/service/fs/gnunet-service-fs.c:1271 5551#: src/service/fs/gnunet-service-fs.c:1271
5520#: src/service/hostlist/gnunet-daemon-hostlist.c:343 5552#: src/service/hostlist/gnunet-daemon-hostlist.c:343
5521#: src/service/topology/gnunet-daemon-topology.c:1066 5553#: src/service/topology/gnunet-daemon-topology.c:1062
5522#, fuzzy, c-format 5554#, fuzzy, c-format
5523msgid "Failed to connect to `%s' service.\n" 5555msgid "Failed to connect to `%s' service.\n"
5524msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" 5556msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
@@ -6317,7 +6349,7 @@ msgid "# hostlist advertisements send"
6317msgstr "" 6349msgstr ""
6318 6350
6319#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 6351#: src/service/hostlist/gnunet-daemon-hostlist_server.c:483
6320#: src/service/topology/gnunet-daemon-topology.c:786 6352#: src/service/topology/gnunet-daemon-topology.c:781
6321#, fuzzy, c-format 6353#, fuzzy, c-format
6322msgid "Error in communication with PEERSTORE service: %s\n" 6354msgid "Error in communication with PEERSTORE service: %s\n"
6323msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n" 6355msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n"
@@ -6579,11 +6611,11 @@ msgstr ""
6579msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" 6611msgid "Malformed punched hole specification `%s' (IPv6 address invalid)"
6580msgstr "" 6612msgstr ""
6581 6613
6582#: src/service/nat/gnunet-service-nat.c:1861 6614#: src/service/nat/gnunet-service-nat.c:1860
6583msgid "Connection reversal request failed\n" 6615msgid "Connection reversal request failed\n"
6584msgstr "" 6616msgstr ""
6585 6617
6586#: src/service/nat/gnunet-service-nat.c:1935 6618#: src/service/nat/gnunet-service-nat.c:1999
6587msgid "" 6619msgid ""
6588"UPnP enabled in configuration, but UPnP client `upnpc` command not found, " 6620"UPnP enabled in configuration, but UPnP client `upnpc` command not found, "
6589"disabling UPnP\n" 6621"disabling UPnP\n"
@@ -6607,44 +6639,44 @@ msgstr ""
6607msgid "`upnpc' command not found\n" 6639msgid "`upnpc' command not found\n"
6608msgstr "" 6640msgstr ""
6609 6641
6610#: src/service/peerstore/gnunet-service-peerstore.c:1141 6642#: src/service/peerstore/gnunet-service-peerstore.c:1150
6611#, fuzzy, c-format 6643#, fuzzy, c-format
6612msgid "Failed to parse HELLO in file `%s': %s\n" 6644msgid "Failed to parse HELLO in file `%s': %s\n"
6613msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" 6645msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
6614 6646
6615#: src/service/peerstore/gnunet-service-peerstore.c:1214 6647#: src/service/peerstore/gnunet-service-peerstore.c:1223
6616#, fuzzy, c-format 6648#, fuzzy, c-format
6617msgid "Could not load database backend `%s'\n" 6649msgid "Could not load database backend `%s'\n"
6618msgstr "无法解æžâ€œ%sâ€(%s):%s\n" 6650msgstr "无法解æžâ€œ%sâ€(%s):%s\n"
6619 6651
6620#: src/service/peerstore/gnunet-service-peerstore.c:1233 6652#: src/service/peerstore/gnunet-service-peerstore.c:1242
6621#, c-format 6653#, c-format
6622msgid "Importing HELLOs from `%s'\n" 6654msgid "Importing HELLOs from `%s'\n"
6623msgstr "" 6655msgstr ""
6624 6656
6625#: src/service/peerstore/gnunet-service-peerstore.c:1244 6657#: src/service/peerstore/gnunet-service-peerstore.c:1253
6626msgid "Skipping import of included HELLOs\n" 6658msgid "Skipping import of included HELLOs\n"
6627msgstr "" 6659msgstr ""
6628 6660
6629#: src/service/peerstore/peerstore_api.c:574 6661#: src/service/peerstore/peerstore_api.c:579
6630#, fuzzy 6662#, fuzzy
6631msgid "Unexpected store response.\n" 6663msgid "Unexpected store response.\n"
6632msgstr "已完æˆæ•°æ®ä»“库轮æ¢ã€‚\n" 6664msgstr "已完æˆæ•°æ®ä»“库轮æ¢ã€‚\n"
6633 6665
6634#: src/service/peerstore/peerstore_api.c:606 6666#: src/service/peerstore/peerstore_api.c:620
6635#, fuzzy 6667#, fuzzy
6636msgid "Unexpected iteration response.\n" 6668msgid "Unexpected iteration response.\n"
6637msgstr "输出格å¼æœªçŸ¥ï¼Œä¸åº”出现这ç§æƒ…况。\n" 6669msgstr "输出格å¼æœªçŸ¥ï¼Œä¸åº”出现这ç§æƒ…况。\n"
6638 6670
6639#: src/service/peerstore/peerstore_api.c:652 6671#: src/service/peerstore/peerstore_api.c:666
6640#, fuzzy 6672#, fuzzy
6641msgid "" 6673msgid ""
6642"Unexpected iteration response, no iterating client found, discarding " 6674"Unexpected iteration response, no iterating client found, discarding "
6643"message.\n" 6675"message.\n"
6644msgstr "输出格å¼æœªçŸ¥ï¼Œä¸åº”出现这ç§æƒ…况。\n" 6676msgstr "输出格å¼æœªçŸ¥ï¼Œä¸åº”出现这ç§æƒ…况。\n"
6645 6677
6646#: src/service/peerstore/peerstore_api.c:662 6678#: src/service/peerstore/peerstore_api.c:676
6647#: src/service/peerstore/peerstore_api_monitor.c:164 6679#: src/service/peerstore/peerstore_api_monitor.c:163
6648#, fuzzy 6680#, fuzzy
6649msgid "Received a malformed response from service." 6681msgid "Received a malformed response from service."
6650msgstr "“%sâ€çš„å‚数无效。\n" 6682msgstr "“%sâ€çš„å‚数无效。\n"
@@ -6808,11 +6840,11 @@ msgstr ""
6808msgid "Namestore REST API initialized\n" 6840msgid "Namestore REST API initialized\n"
6809msgstr "" 6841msgstr ""
6810 6842
6811#: src/service/rest/openid_plugin.c:3102 6843#: src/service/rest/openid_plugin.c:3121
6812msgid "OpenID Connect REST API initialized\n" 6844msgid "OpenID Connect REST API initialized\n"
6813msgstr "" 6845msgstr ""
6814 6846
6815#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1523 6847#: src/service/rest/pabc_plugin.c:637 src/service/rest/reclaim_plugin.c:1494
6816msgid "Identity Provider REST API initialized\n" 6848msgid "Identity Provider REST API initialized\n"
6817msgstr "" 6849msgstr ""
6818 6850
@@ -6864,153 +6896,53 @@ msgstr ""
6864msgid "Could not save some persistent statistics\n" 6896msgid "Could not save some persistent statistics\n"
6865msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" 6897msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
6866 6898
6867#: src/service/testing/gnunet-testing.c:185 6899#: src/service/testbed/gnunet-testbed.c:196
6868#, fuzzy, c-format
6869msgid "Could not extract hostkey %u (offset too large?)\n"
6870msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n"
6871
6872#: src/service/testing/gnunet-testing.c:275
6873#, c-format
6874msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n"
6875msgstr ""
6876
6877#: src/service/testing/gnunet-testing.c:386
6878#, fuzzy 6900#, fuzzy
6879msgid "create unique configuration files" 6901msgid "number of unique configuration files to create"
6880msgstr "更改é…置文件中的一个值"
6881
6882#: src/service/testing/gnunet-testing.c:392
6883msgid "extract hostkey file from pre-computed hostkey list"
6884msgstr ""
6885
6886#: src/service/testing/gnunet-testing.c:400
6887#, fuzzy
6888msgid ""
6889"number of unique configuration files to create, or number of the hostkey to "
6890"extract"
6891msgstr "打å°é…置文件中的一个值到标准输出" 6902msgstr "打å°é…置文件中的一个值到标准输出"
6892 6903
6893#: src/service/testing/gnunet-testing.c:407 6904#: src/service/testbed/gnunet-testbed.c:202
6894#, fuzzy 6905#, fuzzy
6895msgid "configuration template" 6906msgid "configuration template"
6896msgstr "é…置已ä¿å­˜" 6907msgstr "é…置已ä¿å­˜"
6897 6908
6898#: src/service/testing/gnunet-testing.c:415 6909#: src/service/testbed/gnunet-testbed.c:218
6899msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"
6900msgstr ""
6901
6902#: src/service/testing/gnunet-testing.c:432
6903msgid "Command line tool to access the testing library" 6910msgid "Command line tool to access the testing library"
6904msgstr "" 6911msgstr ""
6905 6912
6906#: src/service/testing/list-keys.c:92
6907msgid "list COUNT number of keys"
6908msgstr ""
6909
6910#: src/service/testing/testing.c:291
6911#, c-format
6912msgid "Hostkeys file not found: %s\n"
6913msgstr ""
6914
6915#: src/service/testing/testing.c:743
6916#, c-format
6917msgid "Key number %u does not exist\n"
6918msgstr ""
6919
6920#: src/service/testing/testing.c:1217
6921#, c-format
6922msgid ""
6923"You attempted to create a testbed with more than %u hosts. Please "
6924"precompute more hostkeys first.\n"
6925msgstr ""
6926
6927#: src/service/testing/testing.c:1226
6928#, fuzzy, c-format
6929msgid "Failed to initialize hostkey for peer %u\n"
6930msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
6931
6932#: src/service/testing/testing.c:1236
6933msgid "PRIVATE_KEY option in PEER section missing in configuration\n"
6934msgstr ""
6935
6936#: src/service/testing/testing.c:1249
6937#, fuzzy
6938msgid "Failed to create configuration for peer (not enough free ports?)\n"
6939msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
6940
6941#: src/service/testing/testing.c:1265
6942#, fuzzy, c-format
6943msgid "Cannot open hostkey file `%s': %s\n"
6944msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n"
6945
6946#: src/service/testing/testing.c:1279
6947#, fuzzy, c-format
6948msgid "Failed to write hostkey file for peer %u: %s\n"
6949msgstr "å‘é€æ¶ˆæ¯å¤±è´¥ã€‚\n"
6950
6951#: src/service/testing/testing.c:1307
6952#, fuzzy, c-format
6953msgid "Failed to write configuration file `%s' for peer %u: %s\n"
6954msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
6955
6956#: src/service/testing/testing.c:1413
6957#, fuzzy, c-format
6958msgid "Failed to start `%s': %s\n"
6959msgstr "è¿è¡Œ %s失败:%s %d\n"
6960
6961#: src/service/testing/testing.c:1664
6962#, fuzzy, c-format
6963msgid "Failed to load configuration from %s\n"
6964msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
6965
6966#: src/service/testing/testing.c:2795
6967#, c-format
6968msgid "Topology file %s not found\n"
6969msgstr ""
6970
6971#: src/service/testing/testing.c:2803
6972#, c-format
6973msgid "Topology file %s has no data\n"
6974msgstr ""
6975
6976#: src/service/testing/testing.c:2811
6977#, c-format
6978msgid "Topology file %s cannot be read\n"
6979msgstr ""
6980
6981#: src/service/topology/gnunet-daemon-topology.c:286 6913#: src/service/topology/gnunet-daemon-topology.c:286
6982msgid "# connect requests issued to ATS" 6914msgid "# connect requests issued to ATS"
6983msgstr "" 6915msgstr ""
6984 6916
6985#: src/service/topology/gnunet-daemon-topology.c:480 6917#: src/service/topology/gnunet-daemon-topology.c:475
6986msgid "# HELLO messages gossipped" 6918msgid "# HELLO messages gossipped"
6987msgstr "" 6919msgstr ""
6988 6920
6989#: src/service/topology/gnunet-daemon-topology.c:752 6921#: src/service/topology/gnunet-daemon-topology.c:747
6990#, fuzzy 6922#, fuzzy
6991msgid "Error in communication with PEERSTORE service to monitor.\n" 6923msgid "Error in communication with PEERSTORE service to monitor.\n"
6992msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n" 6924msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n"
6993 6925
6994#: src/service/topology/gnunet-daemon-topology.c:761 6926#: src/service/topology/gnunet-daemon-topology.c:756
6995msgid "Finished initial PEERSTORE iteration in monitor.\n" 6927msgid "Finished initial PEERSTORE iteration in monitor.\n"
6996msgstr "" 6928msgstr ""
6997 6929
6998#: src/service/topology/gnunet-daemon-topology.c:869 6930#: src/service/topology/gnunet-daemon-topology.c:864
6999msgid "Failed to connect to core service, can not manage topology!\n" 6931msgid "Failed to connect to core service, can not manage topology!\n"
7000msgstr "" 6932msgstr ""
7001 6933
7002#: src/service/topology/gnunet-daemon-topology.c:943 6934#: src/service/topology/gnunet-daemon-topology.c:938
7003msgid "# HELLO messages received" 6935msgid "# HELLO messages received"
7004msgstr "" 6936msgstr ""
7005 6937
7006#: src/service/topology/gnunet-daemon-topology.c:1095 6938#: src/service/topology/gnunet-daemon-topology.c:1091
7007msgid "GNUnet topology control" 6939msgid "GNUnet topology control"
7008msgstr "" 6940msgstr ""
7009 6941
7010#: src/service/transport/gnunet-communicator-quic.c:1717 6942#: src/service/transport/gnunet-communicator-quic.c:1717
7011#: src/service/transport/gnunet-communicator-tcp.c:3777 6943#: src/service/transport/gnunet-communicator-tcp.c:3814
7012#: src/service/transport/gnunet-communicator-udp.c:3408 6944#: src/service/transport/gnunet-communicator-udp.c:3579
7013#: src/service/transport/gnunet-service-transport.c:12128 6945#: src/service/transport/gnunet-service-transport.c:12543
7014#, fuzzy 6946#, fuzzy
7015msgid "Transport service is lacking key configuration settings. Exiting.\n" 6947msgid "Transport service is lacking key configuration settings. Exiting.\n"
7016msgstr "ç«‹å³ä¿å­˜é…置?" 6948msgstr "ç«‹å³ä¿å­˜é…置?"
@@ -7019,11 +6951,11 @@ msgstr "ç«‹å³ä¿å­˜é…置?"
7019msgid "GNUnet QUIC communicator" 6951msgid "GNUnet QUIC communicator"
7020msgstr "" 6952msgstr ""
7021 6953
7022#: src/service/transport/gnunet-communicator-tcp.c:4114 6954#: src/service/transport/gnunet-communicator-tcp.c:4171
7023msgid "GNUnet TCP communicator" 6955msgid "GNUnet TCP communicator"
7024msgstr "" 6956msgstr ""
7025 6957
7026#: src/service/transport/gnunet-communicator-udp.c:3483 6958#: src/service/transport/gnunet-communicator-udp.c:3654
7027msgid "GNUnet UDP communicator" 6959msgid "GNUnet UDP communicator"
7028msgstr "" 6960msgstr ""
7029 6961
@@ -7202,7 +7134,7 @@ msgstr ""
7202msgid "Direct access to transport service." 7134msgid "Direct access to transport service."
7203msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" 7135msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
7204 7136
7205#: src/service/transport/transport_api2_communication.c:765 7137#: src/service/transport/transport_api2_communication.c:773
7206msgid "Dropped backchanel message: handler not provided by communicator\n" 7138msgid "Dropped backchanel message: handler not provided by communicator\n"
7207msgstr "" 7139msgstr ""
7208 7140
@@ -7327,6 +7259,38 @@ msgstr "å‘é€æ¶ˆæ¯å¤±è´¥ã€‚\n"
7327msgid "Failed to connect to the namestore!\n" 7259msgid "Failed to connect to the namestore!\n"
7328msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" 7260msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
7329 7261
7262#, fuzzy, c-format
7263#~ msgid "Could not extract hostkey %u (offset too large?)\n"
7264#~ msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n"
7265
7266#, fuzzy
7267#~ msgid "create unique configuration files"
7268#~ msgstr "更改é…置文件中的一个值"
7269
7270#, fuzzy, c-format
7271#~ msgid "Failed to initialize hostkey for peer %u\n"
7272#~ msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
7273
7274#, fuzzy
7275#~ msgid "Failed to create configuration for peer (not enough free ports?)\n"
7276#~ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
7277
7278#, fuzzy, c-format
7279#~ msgid "Cannot open hostkey file `%s': %s\n"
7280#~ msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n"
7281
7282#, fuzzy, c-format
7283#~ msgid "Failed to write hostkey file for peer %u: %s\n"
7284#~ msgstr "å‘é€æ¶ˆæ¯å¤±è´¥ã€‚\n"
7285
7286#, fuzzy, c-format
7287#~ msgid "Failed to write configuration file `%s' for peer %u: %s\n"
7288#~ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
7289
7290#, fuzzy, c-format
7291#~ msgid "Failed to load configuration from %s\n"
7292#~ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
7293
7330#, fuzzy 7294#, fuzzy
7331#~ msgid "number of PeerIDs to request" 7295#~ msgid "number of PeerIDs to request"
7332#~ msgstr "迭代次数" 7296#~ msgstr "迭代次数"
@@ -7784,10 +7748,6 @@ msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n"
7784#~ msgstr "ç«‹å³ä¿å­˜é…置?" 7748#~ msgstr "ç«‹å³ä¿å­˜é…置?"
7785 7749
7786#, fuzzy 7750#, fuzzy
7787#~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n"
7788#~ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
7789
7790#, fuzzy
7791#~ msgid "Unreadable or malformed configuration, exit ...\n" 7751#~ msgid "Unreadable or malformed configuration, exit ...\n"
7792#~ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" 7752#~ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n"
7793 7753
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 994d90952..4eb089997 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -3,9 +3,9 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_builddir)/src/include
3 3
4dist_pkgdata_DATA = \ 4dist_pkgdata_DATA = \
5 netjail/netjail_core.sh \ 5 netjail/netjail_core.sh \
6 netjail/netjail_exec.sh \
7 netjail/netjail_start.sh \ 6 netjail/netjail_start.sh \
8 netjail/netjail_stop.sh \ 7 netjail/netjail_stop.sh \
8 netjail/netjail_test_master.sh \
9 netjail/topo.sh \ 9 netjail/topo.sh \
10 testing-ng/block.sh 10 testing-ng/block.sh
11 11
@@ -20,11 +20,11 @@ EXTRA_DIST = \
20 sphinx_update.sh 20 sphinx_update.sh
21 21
22install-data-hook: 22install-data-hook:
23 chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_core.sh' 23 chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_core.sh'
24 chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_start.sh' 24 chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_start.sh'
25 chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_stop.sh' 25 chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_stop.sh'
26 chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_exec.sh' 26 chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_test_master.sh'
27 chmod o+x '$(DESTDIR)$(pkgdatadir)/topo.sh' 27 chmod +x '$(DESTDIR)$(pkgdatadir)/topo.sh'
28 chmod o+x '$(DESTDIR)$(pkgdatadir)/block.sh' 28 chmod +x '$(DESTDIR)$(pkgdatadir)/block.sh'
29 29
30## EOF 30## EOF
diff --git a/scripts/meson.build b/scripts/meson.build
index 1628bfd13..e36a90578 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -1,6 +1,5 @@
1install_data([ 1install_data([
2 'netjail'/'netjail_core.sh', 2 'netjail'/'netjail_core.sh',
3 'netjail'/'netjail_exec.sh',
4 'netjail'/'netjail_start.sh', 3 'netjail'/'netjail_start.sh',
5 'netjail'/'netjail_stop.sh', 4 'netjail'/'netjail_stop.sh',
6 'netjail'/'topo.sh', 5 'netjail'/'topo.sh',
@@ -25,4 +24,3 @@ foreach f : binfiles
25 output : f, 24 output : f,
26 copy: true) 25 copy: true)
27endforeach 26endforeach
28
diff --git a/scripts/netjail/netjail_core.sh b/scripts/netjail/netjail_core.sh
index b71b51451..8a039cd2f 100755
--- a/scripts/netjail/netjail_core.sh
+++ b/scripts/netjail/netjail_core.sh
@@ -52,7 +52,7 @@ netjail_opts() {
52 local OPT=$1 52 local OPT=$1
53 local DEF=$2 53 local DEF=$2
54 shift 2 54 shift 2
55 55
56 while [ $# -gt 0 ]; do 56 while [ $# -gt 0 ]; do
57 if [ "$1" = "$OPT" ]; then 57 if [ "$1" = "$OPT" ]; then
58 printf "$2" 58 printf "$2"
@@ -61,7 +61,7 @@ netjail_opts() {
61 61
62 shift 1 62 shift 1
63 done 63 done
64 64
65 RESULT="$DEF" 65 RESULT="$DEF"
66} 66}
67 67
@@ -100,7 +100,7 @@ netjail_bridge() {
100 100
101 ip link add $BRIDGE type bridge 101 ip link add $BRIDGE type bridge
102 ip link set dev $BRIDGE up 102 ip link set dev $BRIDGE up
103 103
104 RESULT=$BRIDGE 104 RESULT=$BRIDGE
105} 105}
106 106
@@ -108,7 +108,7 @@ netjail_bridge_name() {
108 netjail_next_interface 108 netjail_next_interface
109 local NUM=$RESULT 109 local NUM=$RESULT
110 local BRIDGE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM) 110 local BRIDGE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM)
111 111
112 RESULT=$BRIDGE 112 RESULT=$BRIDGE
113} 113}
114 114
@@ -124,7 +124,7 @@ netjail_node() {
124 local NODE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM) 124 local NODE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM)
125 125
126 ip netns add $NODE 126 ip netns add $NODE
127 127
128 RESULT=$NODE 128 RESULT=$NODE
129} 129}
130 130
@@ -132,7 +132,7 @@ netjail_node_name() {
132 netjail_next_namespace 132 netjail_next_namespace
133 local NUM=$RESULT 133 local NUM=$RESULT
134 local NODE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM) 134 local NODE=$(printf $INTERFACE_FORMAT_STRING $PREPREFIX $PREFIX $NUM)
135 135
136 RESULT=$NODE 136 RESULT=$NODE
137} 137}
138 138
@@ -215,21 +215,6 @@ netjail_node_exec() {
215 ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN 215 ip netns exec $NODE sudo -u $JAILOR -- $@ 1>& $FD_OUT 0<& $FD_IN
216} 216}
217 217
218netjail_node_exec_without_fds() {
219 JAILOR=${SUDO_USER:?must run in sudo}
220 NODE=$1
221 shift 1
222
223 ip netns exec $NODE sudo -u $JAILOR -- $@
224}
225
226netjail_node_exec_without_fds_and_sudo() {
227 NODE=$1
228 shift 1
229
230 ip netns exec $NODE $@
231}
232
233netjail_kill() { 218netjail_kill() {
234 local PID=$1 219 local PID=$1
235 local MATCH=$(ps --pid $PID | awk "{ if ( \$1 == $PID ) { print \$1 } }" | wc -l) 220 local MATCH=$(ps --pid $PID | awk "{ if ( \$1 == $PID ) { print \$1 } }" | wc -l)
@@ -264,4 +249,3 @@ netjail_waitall() {
264 done 249 done
265 fi 250 fi
266} 251}
267
diff --git a/scripts/netjail/netjail_exec.sh b/scripts/netjail/netjail_exec.sh
deleted file mode 100755
index 34edf56bf..000000000
--- a/scripts/netjail/netjail_exec.sh
+++ /dev/null
@@ -1,15 +0,0 @@
1#!/bin/bash
2. "$(dirname $0)/netjail_core.sh"
3
4set -eu
5set -x
6
7export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
8
9M=$1
10N=$2
11
12NODE=$6
13
14#netjail_node_exec_without_fds_and_sudo $NODE valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --trace-children=yes $3 $4 $5 $1 $2 $7 $8
15netjail_node_exec_without_fds_and_sudo $NODE $3 $4 $5 $1 $2 $7 $8
diff --git a/scripts/netjail/netjail_start.sh b/scripts/netjail/netjail_start.sh
index 5e1dd2b1f..1bf9d427a 100755
--- a/scripts/netjail/netjail_start.sh
+++ b/scripts/netjail/netjail_start.sh
@@ -8,11 +8,14 @@ set -x
8export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 8export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
9 9
10filename=$1 10filename=$1
11PREFIX=$2 11PREFIX=$PPID
12readfile=$3 12readfile=$2
13 13
14BROADCAST=0 14BROADCAST=0
15 15
16# FIXME: We need to test CGNAT. Therefore we have to change the address spaces.
17# We have the backbone network with 192.168.1.X/16 for the global reachable CGN routers and 192.168.2.X/16 for global reachable GNUnet nodes. Every CGN router spans a 10.X.0.0 carrier network for the home router subnets resp. mobile devices. With them given adresses like 10.X.Y.0 with Y being the number of those systems. Home router span a subnet 10.X.Y.0 with device getting address like 10.X.Y.Z with Z being the number of those devices.
18
16if [ $readfile -eq 0 ] 19if [ $readfile -eq 0 ]
17then 20then
18 read_topology_string "$filename" 21 read_topology_string "$filename"
diff --git a/scripts/netjail/netjail_stop.sh b/scripts/netjail/netjail_stop.sh
index 8f6c07f50..c17a4d6ca 100755
--- a/scripts/netjail/netjail_stop.sh
+++ b/scripts/netjail/netjail_stop.sh
@@ -8,7 +8,7 @@ set -x
8export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 8export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
9 9
10filename=$1 10filename=$1
11PREFIX=$2 11PREFIX=$PPID
12readfile=$3 12readfile=$3
13 13
14if [ $readfile -eq 0 ] 14if [ $readfile -eq 0 ]
diff --git a/scripts/netjail/netjail_test_master.sh b/scripts/netjail/netjail_test_master.sh
new file mode 100755
index 000000000..9487f3106
--- /dev/null
+++ b/scripts/netjail/netjail_test_master.sh
@@ -0,0 +1,18 @@
1#!/bin/bash
2if ! [ -d "/run/netns" ];
3then
4 echo "You have to create the directory '/run/netns'."
5 exit 77
6fi
7if [ -f /proc/sys/kernel/unprivileged_userns_clone ];
8then
9 if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" != 1 ];
10 then
11 echo -e "Error during test setup: The kernel parameter 'kernel.unprivileged_userns_clone' has to be set to 1! One has to execute\n\n sysctl kernel.unprivileged_userns_clone=1\n"
12 exit 77
13 fi
14else
15 echo -e "Error during test setup: The kernel lacks the parameter 'kernel.unprivileged_userns_clone'\n"
16 exit 77
17fi
18exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; $*"
diff --git a/src/cli/core/gnunet-core.c b/src/cli/core/gnunet-core.c
index 9d6eccb81..00b08eefc 100644
--- a/src/cli/core/gnunet-core.c
+++ b/src/cli/core/gnunet-core.c
@@ -204,9 +204,17 @@ run (void *cls,
204 if (NULL == mh) 204 if (NULL == mh)
205 { 205 {
206 fprintf (stderr, "%s", _ ("Failed to connect to CORE service!\n")); 206 fprintf (stderr, "%s", _ ("Failed to connect to CORE service!\n"));
207 GNUNET_free (keyfile);
207 return; 208 return;
208 } 209 }
209 } 210 }
211 if (! show_pid && ! show_conns && ! monitor_connections)
212 {
213 fprintf (stderr, "%s", _ ("No argument given.\n"));
214 GNUNET_free (keyfile);
215 return;
216 }
217 GNUNET_free (keyfile);
210 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); 218 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
211} 219}
212 220
diff --git a/src/cli/dht/gnunet-dht-put.c b/src/cli/dht/gnunet-dht-put.c
index 37e7911b5..8f8e098e4 100644
--- a/src/cli/dht/gnunet-dht-put.c
+++ b/src/cli/dht/gnunet-dht-put.c
@@ -233,21 +233,22 @@ main (int argc, char *const *argv)
233 &argc, &argv)) 233 &argc, &argv))
234 return 2; 234 return 2;
235 expiration = GNUNET_TIME_UNIT_HOURS; 235 expiration = GNUNET_TIME_UNIT_HOURS;
236 return (GNUNET_OK == 236 ret = (GNUNET_OK ==
237 GNUNET_PROGRAM_run ( 237 GNUNET_PROGRAM_run (
238 argc, 238 argc,
239 argv, 239 argv,
240 "gnunet-dht-put", 240 "gnunet-dht-put",
241 gettext_noop ( 241 gettext_noop (
242 "Issue a PUT request to the GNUnet DHT insert DATA under KEY."), 242 "Issue a PUT request to the GNUnet DHT insert DATA under KEY."),
243 options, 243 options,
244 &run, 244 &run,
245 NULL)) 245 NULL))
246 ? ret 246 ? ret
247 : 1; 247 : 1;
248 // This is ugly, but meh. The GNUNET_STRINGS_get_utf8_args allows us to do this. 248 // This is ugly, but meh. The GNUNET_STRINGS_get_utf8_args allows us to do this.
249 u8_argv = (char*) argv; 249 u8_argv = (char*) argv;
250 GNUNET_free (u8_argv); 250 GNUNET_free (u8_argv);
251 return ret;
251} 252}
252 253
253 254
diff --git a/src/cli/gns/gnunet-gns.c b/src/cli/gns/gnunet-gns.c
index 19b3fc903..724fbce24 100644
--- a/src/cli/gns/gnunet-gns.c
+++ b/src/cli/gns/gnunet-gns.c
@@ -241,6 +241,7 @@ run (void *cls,
241 const char *cfgfile, 241 const char *cfgfile,
242 const struct GNUNET_CONFIGURATION_Handle *c) 242 const struct GNUNET_CONFIGURATION_Handle *c)
243{ 243{
244 const char *effective_lookup_type;
244 (void) cls; 245 (void) cls;
245 (void) args; 246 (void) args;
246 (void) cfgfile; 247 (void) cfgfile;
@@ -309,9 +310,15 @@ run (void *cls,
309 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, 310 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
310 NULL); 311 NULL);
311 if (NULL != lookup_type) 312 if (NULL != lookup_type)
313 {
314 effective_lookup_type = lookup_type;
312 rtype = GNUNET_GNSRECORD_typename_to_number (lookup_type); 315 rtype = GNUNET_GNSRECORD_typename_to_number (lookup_type);
316 }
313 else 317 else
318 {
319 effective_lookup_type = "A";
314 rtype = GNUNET_DNSPARSER_TYPE_A; 320 rtype = GNUNET_DNSPARSER_TYPE_A;
321 }
315 if (UINT32_MAX == rtype) 322 if (UINT32_MAX == rtype)
316 { 323 {
317 fprintf (stderr, 324 fprintf (stderr,
@@ -321,7 +328,7 @@ run (void *cls,
321 if (! raw) 328 if (! raw)
322 { 329 {
323 printf (">>> Looking for `%s' records under `%s'\n", 330 printf (">>> Looking for `%s' records under `%s'\n",
324 lookup_type, lookup_name); 331 effective_lookup_type, lookup_name);
325 } 332 }
326 lr = GNUNET_GNS_lookup_with_tld (gns, 333 lr = GNUNET_GNS_lookup_with_tld (gns,
327 lookup_name, 334 lookup_name,
diff --git a/src/cli/messenger/gnunet-messenger.c b/src/cli/messenger/gnunet-messenger.c
index e3c10d509..6bff0b25d 100644
--- a/src/cli/messenger/gnunet-messenger.c
+++ b/src/cli/messenger/gnunet-messenger.c
@@ -23,11 +23,12 @@
23 * @brief Print information about messenger groups. 23 * @brief Print information about messenger groups.
24 */ 24 */
25 25
26#include "platform.h"
27#include <stdio.h> 26#include <stdio.h>
27#include <unistd.h>
28 28
29#include "gnunet_util_lib.h" 29#include "gnunet_identity_service.h"
30#include "gnunet_messenger_service.h" 30#include "gnunet_messenger_service.h"
31#include "gnunet_util_lib.h"
31 32
32const struct GNUNET_CONFIGURATION_Handle *config; 33const struct GNUNET_CONFIGURATION_Handle *config;
33struct GNUNET_MESSENGER_Handle *messenger; 34struct GNUNET_MESSENGER_Handle *messenger;
diff --git a/src/cli/nse/gnunet-nse.c b/src/cli/nse/gnunet-nse.c
index edb73c0fc..b88697695 100644
--- a/src/cli/nse/gnunet-nse.c
+++ b/src/cli/nse/gnunet-nse.c
@@ -26,6 +26,7 @@
26 26
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_nse_service.h" 28#include "gnunet_nse_service.h"
29#include <gnunet_util_lib.h>
29 30
30/** 31/**
31 * The handle to the NSE service 32 * The handle to the NSE service
@@ -37,6 +38,11 @@ static struct GNUNET_NSE_Handle *nse;
37 */ 38 */
38static int status; 39static int status;
39 40
41/**
42 * Monitor flag.
43 */
44static int monitor;
45
40 46
41/** 47/**
42 * Task to shutdown and clean up all state 48 * Task to shutdown and clean up all state
@@ -73,11 +79,13 @@ handle_estimate (void *cls,
73 (void) cls; 79 (void) cls;
74 status = 0; 80 status = 0;
75 fprintf (stdout, 81 fprintf (stdout,
76 "%llu %f %f %f\n", 82 "%s: #peers=%f (ld(#peers)=%f, stddev=%f)\n",
77 (unsigned long long) timestamp.abs_value_us, 83 GNUNET_STRINGS_absolute_time_to_string (timestamp),
78 GNUNET_NSE_log_estimate_to_n (estimate), 84 GNUNET_NSE_log_estimate_to_n (estimate),
79 estimate, 85 estimate,
80 std_dev); 86 std_dev);
87 if (! monitor)
88 GNUNET_SCHEDULER_shutdown ();
81} 89}
82 90
83 91
@@ -111,7 +119,12 @@ run (void *cls,
111int 119int
112main (int argc, char *const *argv) 120main (int argc, char *const *argv)
113{ 121{
114 static struct GNUNET_GETOPT_CommandLineOption options[] = { 122 struct GNUNET_GETOPT_CommandLineOption options[] = {
123 GNUNET_GETOPT_option_flag ('m',
124 "monitor",
125 gettext_noop (
126 "Monitor and output current estimates"),
127 &monitor),
115 GNUNET_GETOPT_OPTION_END 128 GNUNET_GETOPT_OPTION_END
116 }; 129 };
117 130
diff --git a/src/cli/reclaim/gnunet-reclaim.c b/src/cli/reclaim/gnunet-reclaim.c
index efb2c2902..94bceb8da 100644
--- a/src/cli/reclaim/gnunet-reclaim.c
+++ b/src/cli/reclaim/gnunet-reclaim.c
@@ -53,6 +53,11 @@ static int list_credentials;
53static char *credential_id; 53static char *credential_id;
54 54
55/** 55/**
56 * The expected RP URI
57 */
58static char *ex_rp_uri;
59
60/**
56 * Credential ID 61 * Credential ID
57 */ 62 */
58static struct GNUNET_RECLAIM_Identifier credential; 63static struct GNUNET_RECLAIM_Identifier credential;
@@ -155,11 +160,6 @@ static struct GNUNET_RECLAIM_TicketIterator *ticket_iterator;
155static const struct GNUNET_CRYPTO_PrivateKey *pkey; 160static const struct GNUNET_CRYPTO_PrivateKey *pkey;
156 161
157/** 162/**
158 * rp public key
159 */
160static struct GNUNET_CRYPTO_PublicKey rp_key;
161
162/**
163 * Ticket to consume 163 * Ticket to consume
164 */ 164 */
165static struct GNUNET_RECLAIM_Ticket ticket; 165static struct GNUNET_RECLAIM_Ticket ticket;
@@ -234,17 +234,10 @@ ticket_issue_cb (void *cls,
234 const struct GNUNET_RECLAIM_Ticket *ticket, 234 const struct GNUNET_RECLAIM_Ticket *ticket,
235 const struct GNUNET_RECLAIM_PresentationList *presentations) 235 const struct GNUNET_RECLAIM_PresentationList *presentations)
236{ 236{
237 char *ticket_str;
238
239 reclaim_op = NULL; 237 reclaim_op = NULL;
240 if (NULL != ticket) 238 if (NULL != ticket)
241 { 239 {
242 ticket_str = 240 printf ("%s\n", ticket->gns_name);
243 GNUNET_STRINGS_data_to_string_alloc (ticket,
244 sizeof(
245 struct GNUNET_RECLAIM_Ticket));
246 printf ("%s\n", ticket_str);
247 GNUNET_free (ticket_str);
248 } 241 }
249 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 242 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
250} 243}
@@ -340,24 +333,9 @@ ticket_iter_fin (void *cls)
340 333
341 334
342static void 335static void
343ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) 336ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket, const char* rp_uri)
344{ 337{
345 char *aud; 338 fprintf (stdout, "Ticket: %s | RP URI: %s\n", ticket->gns_name, rp_uri);
346 char *ref;
347 char *tkt;
348
349 aud =
350 GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
351 sizeof(struct
352 GNUNET_CRYPTO_PublicKey));
353 ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
354 tkt =
355 GNUNET_STRINGS_data_to_string_alloc (ticket,
356 sizeof(struct GNUNET_RECLAIM_Ticket));
357 fprintf (stdout, "Ticket: %s | ID: %s | Audience: %s\n", tkt, ref, aud);
358 GNUNET_free (aud);
359 GNUNET_free (ref);
360 GNUNET_free (tkt);
361 GNUNET_RECLAIM_ticket_iteration_next (ticket_iterator); 339 GNUNET_RECLAIM_ticket_iteration_next (ticket_iterator);
362} 340}
363 341
@@ -413,6 +391,9 @@ process_delete (void *cls, int success, const char *msg)
413static void 391static void
414iter_finished (void *cls) 392iter_finished (void *cls)
415{ 393{
394 struct GNUNET_RECLAIM_AttributeListEntry *le;
395 char *attrs_tmp;
396 char *attr_str;
416 char *data; 397 char *data;
417 size_t data_size; 398 size_t data_size;
418 int type; 399 int type;
@@ -426,9 +407,41 @@ iter_finished (void *cls)
426 407
427 if (issue_attrs) 408 if (issue_attrs)
428 { 409 {
410 attrs_tmp = GNUNET_strdup (issue_attrs);
411 attr_str = strtok (attrs_tmp, ",");
412 while (NULL != attr_str)
413 {
414 le = attr_list->list_head;
415 while (le)
416 {
417 if (0 == strcasecmp (attr_str, le->attribute->name))
418 break;
419
420 le = le->next;
421 }
422
423 if (! le)
424 {
425 fprintf (stdout, "No such attribute ``%s''\n", attr_str);
426 break;
427 }
428 attr_str = strtok (NULL, ",");
429 }
430 GNUNET_free (attrs_tmp);
431 if (NULL != attr_str)
432 {
433 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
434 return;
435 }
436 if (NULL == ex_rp_uri)
437 {
438 fprintf (stdout, "No RP URI provided\n");
439 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
440 return;
441 }
429 reclaim_op = GNUNET_RECLAIM_ticket_issue (reclaim_handle, 442 reclaim_op = GNUNET_RECLAIM_ticket_issue (reclaim_handle,
430 pkey, 443 pkey,
431 &rp_key, 444 ex_rp_uri,
432 attr_list, 445 attr_list,
433 &ticket_issue_cb, 446 &ticket_issue_cb,
434 NULL); 447 NULL);
@@ -436,9 +449,15 @@ iter_finished (void *cls)
436 } 449 }
437 if (consume_ticket) 450 if (consume_ticket)
438 { 451 {
452 if (NULL == ex_rp_uri)
453 {
454 fprintf (stderr, "Expected an RP URI to consume ticket\n");
455 GNUNET_SCHEDULER_add_now(&do_cleanup, NULL);
456 return;
457 }
439 reclaim_op = GNUNET_RECLAIM_ticket_consume (reclaim_handle, 458 reclaim_op = GNUNET_RECLAIM_ticket_consume (reclaim_handle,
440 pkey,
441 &ticket, 459 &ticket,
460 ex_rp_uri,
442 &process_attrs, 461 &process_attrs,
443 NULL); 462 NULL);
444 timeout = GNUNET_SCHEDULER_add_delayed ( 463 timeout = GNUNET_SCHEDULER_add_delayed (
@@ -736,19 +755,8 @@ start_process ()
736 return; 755 return;
737 } 756 }
738 757
739 if ((NULL != rp) &&
740 (GNUNET_OK !=
741 GNUNET_CRYPTO_public_key_from_string (rp, &rp_key)) )
742 {
743 fprintf (stderr, "%s is not a public key!\n", rp);
744 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
745 return;
746 }
747 if (NULL != consume_ticket) 758 if (NULL != consume_ticket)
748 GNUNET_STRINGS_string_to_data (consume_ticket, 759 memcpy (ticket.gns_name, consume_ticket, strlen (consume_ticket) + 1);
749 strlen (consume_ticket),
750 &ticket,
751 sizeof(struct GNUNET_RECLAIM_Ticket));
752 if (NULL != revoke_ticket) 760 if (NULL != revoke_ticket)
753 GNUNET_STRINGS_string_to_data (revoke_ticket, 761 GNUNET_STRINGS_string_to_data (revoke_ticket,
754 strlen (revoke_ticket), 762 strlen (revoke_ticket),
@@ -834,7 +842,8 @@ main (int argc, char *const argv[])
834 GNUNET_GETOPT_option_string ('a', 842 GNUNET_GETOPT_option_string ('a',
835 "add", 843 "add",
836 "NAME", 844 "NAME",
837 gettext_noop ("Add or update an attribute NAME"), 845 gettext_noop (
846 "Add or update an attribute NAME"),
838 &attr_name), 847 &attr_name),
839 GNUNET_GETOPT_option_string ('d', 848 GNUNET_GETOPT_option_string ('d',
840 "delete", 849 "delete",
@@ -857,6 +866,12 @@ main (int argc, char *const argv[])
857 gettext_noop ( 866 gettext_noop (
858 "Specify the relying party for issue"), 867 "Specify the relying party for issue"),
859 &rp), 868 &rp),
869 GNUNET_GETOPT_option_string ('U',
870 "rpuri",
871 "RPURI",
872 gettext_noop (
873 "Specify the relying party URI for a ticket to consume"),
874 &ex_rp_uri),
860 GNUNET_GETOPT_option_flag ('D', 875 GNUNET_GETOPT_option_flag ('D',
861 "dump", 876 "dump",
862 gettext_noop ("List attributes for EGO"), 877 gettext_noop ("List attributes for EGO"),
diff --git a/src/cli/reclaim/test_reclaim.conf b/src/cli/reclaim/test_reclaim.conf
index faa195ae1..a8d2c808a 100644
--- a/src/cli/reclaim/test_reclaim.conf
+++ b/src/cli/reclaim/test_reclaim.conf
@@ -8,7 +8,8 @@ START_ON_DEMAND = YES
8 8
9[rest] 9[rest]
10START_ON_DEMAND = YES 10START_ON_DEMAND = YES
11PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/restlog 11# PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/restlog
12BASIC_AUTH_ENABLED = NO
12 13
13[transport] 14[transport]
14PLUGINS = 15PLUGINS =
@@ -18,6 +19,7 @@ START_ON_DEMAND = YES
18IMMEDIATE_START = YES 19IMMEDIATE_START = YES
19 20
20[reclaim] 21[reclaim]
22IMMEDIATE_START = YES
21START_ON_DEMAND = YES 23START_ON_DEMAND = YES
22TICKET_REFRESH_INTERVAL = 1 h 24TICKET_REFRESH_INTERVAL = 1 h
23#PREFIX = valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file=$GNUNET_TMP/idplog 25#PREFIX = valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file=$GNUNET_TMP/idplog
@@ -33,6 +35,10 @@ ZONE_PUBLISH_TIME_WINDOW = 1 h
33DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0 35DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
34 36
35[reclaim-rest-plugin] 37[reclaim-rest-plugin]
36address = http://localhost:8000/#/login
37psw = mysupersecretpassword
38expiration_time = 3600 38expiration_time = 3600
39JWT_SECRET = secret
40OIDC_USERINFO_CONSUME_TIMEOUT = 5s
41OIDC_DIR = $GNUNET_DATA_HOME/oidc
42OIDC_CLIENT_HMAC_SECRET = secret
43OIDC_JSON_WEB_ALGORITHM = RS256
44ADDRESS = https://ui.reclaim/#/login
diff --git a/src/cli/reclaim/test_reclaim_consume.sh b/src/cli/reclaim/test_reclaim_consume.sh
index 8a88136c6..00076fbf8 100755
--- a/src/cli/reclaim/test_reclaim_consume.sh
+++ b/src/cli/reclaim/test_reclaim_consume.sh
@@ -32,11 +32,13 @@ SUBJECT_KEY=$(gnunet-identity -d -e rpego -q -c test_reclaim.conf)
32TEST_KEY=$(gnunet-identity -d -e testego -q -c test_reclaim.conf) 32TEST_KEY=$(gnunet-identity -d -e testego -q -c test_reclaim.conf)
33gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf 33gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf
34gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf 34gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf
35TICKET=$(gnunet-reclaim -e testego -i "email,name" -r $SUBJECT_KEY -c test_reclaim.conf | awk '{print $1}') 35TICKET=$(gnunet-reclaim -e testego -U "urn:gns:$TEST_KEY" -i "email,name" -r $SUBJECT_KEY -c test_reclaim.conf | awk '{print $1}')
36echo "Ticket: $TICKET"
37gnunet-gns -u $TICKET -c test_reclaim.conf
36gnunet-namestore -z testego -D -c test_reclaim.conf 38gnunet-namestore -z testego -D -c test_reclaim.conf
37gnunet-identity -d -c test_reclaim.conf 39gnunet-identity -d -c test_reclaim.conf
38sleep 1 40sleep 1
39gnunet-reclaim -e rpego -C $TICKET -c test_reclaim.conf 41gnunet-reclaim -e rpego -U "urn:gns:$TEST_KEY" -C $TICKET -c test_reclaim.conf
40 42
41RES=$? 43RES=$?
42gnunet-identity -D testego -c test_reclaim.conf 44gnunet-identity -D testego -c test_reclaim.conf
diff --git a/src/cli/reclaim/test_reclaim_issue.sh b/src/cli/reclaim/test_reclaim_issue.sh
index 63140e54c..39e614d19 100755
--- a/src/cli/reclaim/test_reclaim_issue.sh
+++ b/src/cli/reclaim/test_reclaim_issue.sh
@@ -32,7 +32,7 @@ TEST_KEY=$(gnunet-identity -d -e testego -q -c test_reclaim.conf)
32gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf 32gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf
33gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf 33gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf
34#gnunet-reclaim -e testego -D -c test_reclaim.conf 34#gnunet-reclaim -e testego -D -c test_reclaim.conf
35gnunet-reclaim -e testego -i "email,name" -r $SUBJECT_KEY -c test_reclaim.conf > /dev/null 2>&1 35gnunet-reclaim -e testego -u "urn:gns:$TEST_KEY" -i "email,name" -r $SUBJECT_KEY -c test_reclaim.conf > /dev/null 2>&1
36if test $? != 0 36if test $? != 0
37then 37then
38 echo "Failed." 38 echo "Failed."
diff --git a/src/cli/reclaim/test_reclaim_oidc.sh b/src/cli/reclaim/test_reclaim_oidc.sh
new file mode 100755
index 000000000..cdea61a03
--- /dev/null
+++ b/src/cli/reclaim/test_reclaim_oidc.sh
@@ -0,0 +1,57 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_reclaim.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1>/dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f`
17
18which timeout >/dev/null 2>&1 && DO_TIMEOUT="timeout 30"
19
20RES=0
21TEST_ATTR="test"
22REDIRECT_URI="https://example.gns.alt/my_cb"
23SCOPE="\"openid email name\""
24gnunet-arm -s -c test_reclaim.conf
25gnunet-arm -i rest -c test_reclaim.conf
26gnunet-arm -I
27gnunet-identity -C testego -c test_reclaim.conf
28gnunet-identity -C rpego -c test_reclaim.conf
29TEST_KEY=$(gnunet-identity -d -e rpego -q -c test_reclaim.conf)
30SUBJECT_KEY=$(gnunet-identity -d -e testego -q -c test_reclaim.conf)
31gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf
32gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf
33
34# Register client
35gnunet-namestore -z rpego -a -n @ -t RECLAIM_OIDC_CLIENT -V "My RP" -e 1d -p -c test_reclaim.conf
36gnunet-namestore -z rpego -a -n @ -t RECLAIM_OIDC_REDIRECT -V $REDIRECT_URI -e 1d -p -c test_reclaim.conf
37
38gnunet-gns -u @.$TEST_KEY -t RECLAIM_OIDC_REDIRECT -c test_reclaim.conf
39curl -v -X POST -H -v "http://localhost:7776/openid/login" --data "{\"identity\": \"$SUBJECT_KEY\"}"
40
41PKCE_CHALLENGE=$(echo -n secret | openssl dgst -binary -sha256 | openssl base64 | sed 's/\=//g' | sed 's/+/-/g' | sed 's/\//_/g')
42
43CODE=$(curl -H "Cookie: Identity=$SUBJECT_KEY" "http://localhost:7776/openid/authorize?client_id=$TEST_KEY&response_type=code&redirect_uri=$REDIRECT_URI&scope=openid&claims=%7B%22userinfo%22%3A%20%7B%22email%22%3A%20%7B%22essential%22%20%20%20%20%3A%20true%7D%7D%2C%22id_token%22%3A%20%7B%22email%22%3A%20%7B%22essential%22%3A%20true%7D%7D%7D&state=xyz&code_challenge=$PKCE_CHALLENGE&code_challenge_method=S256" \
44 -sS -D - -o /dev/null | grep "Location: " | cut -d" " -f2 | cut -d"?" -f2 | cut -d"&" -f1 | cut -d"=" -f2)
45
46echo "Code: $CODE"
47
48curl -v -X POST -u$TEST_KEY:"secret" "http://localhost:7776/openid/token?client_id=$TEST_KEY&response_type=code&redirect_uri=$REDIRECT_URI&scope=openid&claims=%7B%22userinfo%22%3A%20%7B%22email%22%3A%20%7B%22essential%22%20%20%20%20%3A%20true%7D%7D%2C%22id_token%22%3A%20%7B%22email%22%3A%20%7B%22essential%22%3A%20true%7D%7D%7D&state=xyz&grant_type=authorization_code&code=$CODE&code_verifier=secret"
49
50gnunet-identity -D testego -c test_reclaim.conf
51gnunet-identity -D rpego -c test_reclaim.conf
52gnunet-arm -e -c test_reclaim.conf
53if test $RES != 0
54then
55 echo "Failed."
56fi
57
diff --git a/src/cli/util/gnunet-config.c b/src/cli/util/gnunet-config.c
index 714c683dd..979f0b3f4 100644
--- a/src/cli/util/gnunet-config.c
+++ b/src/cli/util/gnunet-config.c
@@ -35,7 +35,6 @@
35 */ 35 */
36static char *backend_check; 36static char *backend_check;
37 37
38
39/** 38/**
40 * If printing the value of CFLAGS has been requested. 39 * If printing the value of CFLAGS has been requested.
41 */ 40 */
@@ -46,13 +45,21 @@ static int cflags;
46 */ 45 */
47static int is_experimental; 46static int is_experimental;
48 47
48/**
49 * Do not load default configuration
50 */
51static int no_defaults;
52
53/**
54 * Parse configuration from this memory.
55 */
56static char *ram_config;
49 57
50/** 58/**
51 * If printing the value of LIBS has been requested. 59 * If printing the value of LIBS has been requested.
52 */ 60 */
53static int libs; 61static int libs;
54 62
55
56/** 63/**
57 * If printing the value of PREFIX has been requested. 64 * If printing the value of PREFIX has been requested.
58 */ 65 */
@@ -60,76 +67,6 @@ static int prefix;
60 67
61 68
62/** 69/**
63 * Print each option in a given section.
64 * Main task to run to perform operations typical for
65 * gnunet-config as per the configuration settings
66 * given in @a cls.
67 *
68 * @param cls closure with the `struct GNUNET_CONFIGURATION_ConfigSettings`
69 * @param args remaining command-line arguments
70 * @param cfgfile name of the configuration file used (for saving,
71 * can be NULL!)
72 * @param cfg configuration
73 */
74static void
75run (void *cls,
76 char *const *args,
77 const char *cfgfile,
78 const struct GNUNET_CONFIGURATION_Handle *cfg)
79{
80 struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls;
81
82 if (1 == is_experimental)
83 {
84#ifdef GNUNET_EXPERIMENTAL
85 cs->global_ret = 0;
86#else
87 cs->global_ret = 1;
88#endif
89 return;
90 }
91 if (1 == cflags || 1 == libs || 1 == prefix)
92 {
93 char *prefixdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
94 char *libdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR);
95
96 if (1 == cflags)
97 {
98 fprintf (stdout, "-I%sinclude\n", prefixdir);
99 }
100 if (1 == libs)
101 {
102 fprintf (stdout, "-L%s -lgnunetutil\n", libdir);
103 }
104 if (1 == prefix)
105 {
106 fprintf (stdout, "%s\n", prefixdir);
107 }
108 cs->global_ret = 0;
109 GNUNET_free (prefixdir);
110 GNUNET_free (libdir);
111 return;
112 }
113 if (NULL != backend_check)
114 {
115 char *name;
116
117 GNUNET_asprintf (&name,
118 "libgnunet_plugin_%s",
119 backend_check);
120 cs->global_ret = (GNUNET_OK ==
121 GNUNET_PLUGIN_test (name)) ? 0 : 77;
122 GNUNET_free (name);
123 return;
124 }
125 GNUNET_CONFIGURATION_config_tool_run (cs,
126 args,
127 cfgfile,
128 cfg);
129}
130
131
132/**
133 * Program to manipulate configuration files. 70 * Program to manipulate configuration files.
134 * 71 *
135 * @param argc number of arguments from the command line 72 * @param argc number of arguments from the command line
@@ -144,7 +81,17 @@ main (int argc,
144 .api_version = GNUNET_UTIL_VERSION, 81 .api_version = GNUNET_UTIL_VERSION,
145 .global_ret = EXIT_SUCCESS 82 .global_ret = EXIT_SUCCESS
146 }; 83 };
84 const struct GNUNET_OS_ProjectData *pd
85 = GNUNET_OS_project_data_get ();
86 char *cfgfile = NULL;
87 char *loglev = NULL;
88 char *logfile = NULL;
147 struct GNUNET_GETOPT_CommandLineOption options[] = { 89 struct GNUNET_GETOPT_CommandLineOption options[] = {
90 GNUNET_GETOPT_option_cfgfile (&cfgfile),
91 GNUNET_GETOPT_option_help ("gnunet-config [OPTIONS]"),
92 GNUNET_GETOPT_option_loglevel (&loglev),
93 GNUNET_GETOPT_option_logfile (&logfile),
94 GNUNET_GETOPT_option_version (pd->version),
148 GNUNET_GETOPT_option_exclusive ( 95 GNUNET_GETOPT_option_exclusive (
149 GNUNET_GETOPT_option_string ( 96 GNUNET_GETOPT_option_string (
150 'b', 97 'b',
@@ -171,34 +118,163 @@ main (int argc,
171 "Provide an appropriate value for LIBS to applications building on top of GNUnet"), 118 "Provide an appropriate value for LIBS to applications building on top of GNUnet"),
172 &libs), 119 &libs),
173 GNUNET_GETOPT_option_flag ( 120 GNUNET_GETOPT_option_flag (
121 'n',
122 "no-defaults",
123 gettext_noop ("Do not parse default configuration files"),
124 &no_defaults),
125 GNUNET_GETOPT_option_flag (
174 'p', 126 'p',
175 "prefix", 127 "prefix",
176 gettext_noop ( 128 gettext_noop (
177 "Provide the path under which GNUnet was installed"), 129 "Provide the path under which GNUnet was installed"),
178 &prefix), 130 &prefix),
131 GNUNET_GETOPT_option_string (
132 'R',
133 "ram-config",
134 "CONFIG_DATA",
135 gettext_noop (
136 "Parse main configuration from this command-line argument and not from disk"),
137 &ram_config),
179 GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), 138 GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs),
180 GNUNET_GETOPT_OPTION_END 139 GNUNET_GETOPT_OPTION_END
181 }; 140 };
182 enum GNUNET_GenericReturnValue ret; 141 int iret;
183 142
184 if (GNUNET_OK != 143 if (GNUNET_OK !=
185 GNUNET_STRINGS_get_utf8_args (argc, argv, 144 GNUNET_STRINGS_get_utf8_args (argc, argv,
186 &argc, &argv)) 145 &argc, &argv))
187 return EXIT_FAILURE; 146 return EXIT_FAILURE;
188 ret = 147 if ( (NULL != pd->config_file) &&
189 GNUNET_PROGRAM_run (argc, 148 (NULL != pd->user_config_file) )
190 argv, 149 cfgfile = GNUNET_CONFIGURATION_default_filename ();
191 "gnunet-config [OPTIONS]", 150 iret = GNUNET_GETOPT_run ("gnunet-config",
192 gettext_noop ("Manipulate GNUnet configuration files"), 151 options,
193 options, 152 argc,
194 &run, 153 argv);
195 &cs); 154 if (GNUNET_SYSERR == iret)
196 GNUNET_free_nz ((void *) argv); 155 {
197 GNUNET_CONFIGURATION_config_settings_free (&cs); 156 GNUNET_free_nz ((void *) argv);
198 if (GNUNET_NO == ret)
199 return 0;
200 if (GNUNET_SYSERR == ret)
201 return EXIT_INVALIDARGUMENT; 157 return EXIT_INVALIDARGUMENT;
158 }
159 if (GNUNET_OK !=
160 GNUNET_log_setup ("gnunet-config",
161 loglev,
162 logfile))
163 {
164 GNUNET_free_nz ((void *) argv);
165 return EXIT_FAILURE;
166 }
167 if (1 == is_experimental)
168 {
169 GNUNET_free_nz ((void *) argv);
170#ifdef GNUNET_EXPERIMENTAL
171 return 0;
172#else
173 return 1;
174#endif
175 }
176 if (1 == cflags || 1 == libs || 1 == prefix)
177 {
178 char *prefixdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
179 char *libdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR);
180
181 if (1 == cflags)
182 {
183 fprintf (stdout, "-I%sinclude\n", prefixdir);
184 }
185 if (1 == libs)
186 {
187 fprintf (stdout, "-L%s -lgnunetutil\n", libdir);
188 }
189 if (1 == prefix)
190 {
191 fprintf (stdout, "%s\n", prefixdir);
192 }
193 GNUNET_free (prefixdir);
194 GNUNET_free (libdir);
195 GNUNET_free_nz ((void *) argv);
196 return 0;
197 }
198 if (NULL != backend_check)
199 {
200 char *name;
201
202 GNUNET_asprintf (&name,
203 "libgnunet_plugin_%s",
204 backend_check);
205 iret = (GNUNET_OK ==
206 GNUNET_PLUGIN_test (name)) ? 0 : 77;
207 GNUNET_free (name);
208 GNUNET_free_nz ((void *) argv);
209 return iret;
210 }
211
212 {
213 struct GNUNET_CONFIGURATION_Handle *cfg;
214
215 cfg = GNUNET_CONFIGURATION_create ();
216
217 if (NULL != ram_config)
218 {
219 if ( (! no_defaults) &&
220 (GNUNET_SYSERR ==
221 GNUNET_CONFIGURATION_load (cfg,
222 NULL)) )
223 {
224 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
225 _ ("Failed to load default configuration, exiting ...\n"));
226 GNUNET_free_nz ((void *) argv);
227 GNUNET_CONFIGURATION_destroy (cfg);
228 return EXIT_FAILURE;
229 }
230 if (GNUNET_OK !=
231 GNUNET_CONFIGURATION_deserialize (cfg,
232 ram_config,
233 strlen (ram_config),
234 NULL))
235 {
236 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
237 _ ("Failed to parse configuration, exiting ...\n"));
238 GNUNET_free_nz ((void *) argv);
239 GNUNET_CONFIGURATION_destroy (cfg);
240 return EXIT_FAILURE;
241 }
242 }
243 else
244 {
245 if (GNUNET_YES !=
246 GNUNET_DISK_file_test (cfgfile))
247 {
248 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
249 _ ("Unreadable configuration file `%s', exiting ...\n"),
250 cfgfile);
251 GNUNET_free_nz ((void *) argv);
252 GNUNET_CONFIGURATION_destroy (cfg);
253 return EXIT_FAILURE;
254 }
255 if (GNUNET_SYSERR ==
256 (no_defaults
257 ? GNUNET_CONFIGURATION_parse (cfg,
258 cfgfile)
259 : GNUNET_CONFIGURATION_load (cfg,
260 cfgfile)) )
261 {
262 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
263 _ ("Malformed configuration file `%s', exiting ...\n"),
264 cfgfile);
265 GNUNET_free_nz ((void *) argv);
266 GNUNET_CONFIGURATION_destroy (cfg);
267 return EXIT_FAILURE;
268 }
269 }
270 GNUNET_CONFIGURATION_config_tool_run (&cs,
271 &argv[iret],
272 cfgfile,
273 cfg);
274 GNUNET_free_nz ((void *) argv);
275 GNUNET_CONFIGURATION_config_settings_free (&cs);
276 GNUNET_CONFIGURATION_destroy (cfg);
277 }
202 return cs.global_ret; 278 return cs.global_ret;
203} 279}
204 280
diff --git a/src/cli/util/gnunet-ecc.c b/src/cli/util/gnunet-ecc.c
index 812745085..9a9fc17e4 100644
--- a/src/cli/util/gnunet-ecc.c
+++ b/src/cli/util/gnunet-ecc.c
@@ -168,10 +168,10 @@ create_keys (const char *fn, const char *prefix)
168 } 168 }
169 } 169 }
170 } 170 }
171 if (GNUNET_TESTING_HOSTKEYFILESIZE != 171 if (sizeof (struct GNUNET_PeerIdentity) !=
172 fwrite (&pk, 172 fwrite (&pk,
173 1, 173 1,
174 GNUNET_TESTING_HOSTKEYFILESIZE, 174 sizeof (struct GNUNET_PeerIdentity),
175 f)) 175 f))
176 { 176 {
177 fprintf (stderr, 177 fprintf (stderr,
@@ -307,16 +307,22 @@ print_key (const char *filename)
307 307
308 /* Check hostkey file size, read entire thing into memory */ 308 /* Check hostkey file size, read entire thing into memory */
309 if (GNUNET_OK != 309 if (GNUNET_OK !=
310 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) 310 GNUNET_DISK_file_size (filename,
311 &fs,
312 GNUNET_YES,
313 GNUNET_YES))
311 fs = 0; 314 fs = 0;
312 if (0 == fs) 315 if (0 == fs)
313 { 316 {
314 fprintf (stderr, _ ("Hostkeys file `%s' is empty\n"), filename); 317 fprintf (stderr,
318 _ ("Hostkeys file `%s' is empty\n"), filename);
315 return; /* File is empty */ 319 return; /* File is empty */
316 } 320 }
317 if (0 != (fs % GNUNET_TESTING_HOSTKEYFILESIZE)) 321 if (0 != (fs % sizeof (struct GNUNET_PeerIdentity)))
318 { 322 {
319 fprintf (stderr, _ ("Incorrect hostkey file format: %s\n"), filename); 323 fprintf (stderr,
324 _ ("Incorrect hostkey file format: %s\n"),
325 filename);
320 return; 326 return;
321 } 327 }
322 fd = GNUNET_DISK_file_open (filename, 328 fd = GNUNET_DISK_file_open (filename,
@@ -340,12 +346,12 @@ print_key (const char *filename)
340 346
341 if (NULL == hostkeys_data) 347 if (NULL == hostkeys_data)
342 return; 348 return;
343 total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE; 349 total_hostkeys = fs / sizeof (struct GNUNET_PeerIdentity);
344 for (c = 0; (c < total_hostkeys) && (c < list_keys_count); c++) 350 for (c = 0; (c < total_hostkeys) && (c < list_keys_count); c++)
345 { 351 {
346 GNUNET_memcpy (&private_key, 352 GNUNET_memcpy (&private_key,
347 hostkeys_data + (c * GNUNET_TESTING_HOSTKEYFILESIZE), 353 hostkeys_data + (c * sizeof (struct GNUNET_PeerIdentity)),
348 GNUNET_TESTING_HOSTKEYFILESIZE); 354 sizeof (struct GNUNET_PeerIdentity));
349 GNUNET_CRYPTO_eddsa_key_get_public (&private_key, &public_key); 355 GNUNET_CRYPTO_eddsa_key_get_public (&private_key, &public_key);
350 hostkey_str = GNUNET_CRYPTO_eddsa_public_key_to_string (&public_key); 356 hostkey_str = GNUNET_CRYPTO_eddsa_public_key_to_string (&public_key);
351 if (NULL != hostkey_str) 357 if (NULL != hostkey_str)
diff --git a/src/contrib/service/consensus/Makefile.am b/src/contrib/service/consensus/Makefile.am
index 6b4db05fc..35ac47203 100644
--- a/src/contrib/service/consensus/Makefile.am
+++ b/src/contrib/service/consensus/Makefile.am
@@ -80,8 +80,8 @@ libgnunet_plugin_block_consensus_la_LDFLAGS = \
80 80
81 81
82 82
83check_PROGRAMS = \ 83#check_PROGRAMS = \
84 test_consensus_api 84# test_consensus_api
85 85
86if ENABLE_TEST_RUN 86if ENABLE_TEST_RUN
87AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 87AM_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/contrib/service/consensus/meson.build b/src/contrib/service/consensus/meson.build
index 86cc0663b..361268c85 100644
--- a/src/contrib/service/consensus/meson.build
+++ b/src/contrib/service/consensus/meson.build
@@ -47,6 +47,7 @@ executable ('gnunet-service-consensus',
47 install_dir: get_option('libdir') / 'gnunet' / 'libexec') 47 install_dir: get_option('libdir') / 'gnunet' / 'libexec')
48 48
49# FIXME do we need evil stuff and ENABLE_MALICIOUS? 49# FIXME do we need evil stuff and ENABLE_MALICIOUS?
50if false
50 51
51testconsensusapi = executable ('test_consensus_api', 52testconsensusapi = executable ('test_consensus_api',
52 ['test_consensus_api.c'], 53 ['test_consensus_api.c'],
@@ -64,3 +65,5 @@ configure_file(input : 'test_consensus.conf',
64test('test_consensus_api', testconsensusapi, 65test('test_consensus_api', testconsensusapi,
65 workdir: meson.current_build_dir(), 66 workdir: meson.current_build_dir(),
66 suite: ['consensus', 'contrib']) 67 suite: ['consensus', 'contrib'])
68
69endif \ No newline at end of file
diff --git a/src/contrib/service/conversation/Makefile.am b/src/contrib/service/conversation/Makefile.am
index b573208e6..7c5960c94 100644
--- a/src/contrib/service/conversation/Makefile.am
+++ b/src/contrib/service/conversation/Makefile.am
@@ -22,10 +22,10 @@ bin_PROGRAMS = \
22libexec_PROGRAMS = \ 22libexec_PROGRAMS = \
23 gnunet-service-conversation 23 gnunet-service-conversation
24 24
25check_PROGRAMS = \ 25#check_PROGRAMS = \
26 test_conversation_api \ 26# test_conversation_api \
27 test_conversation_api_reject \ 27# test_conversation_api_reject \
28 test_conversation_api_twocalls 28# test_conversation_api_twocalls
29 29
30pkgcfg_DATA = conversation.conf 30pkgcfg_DATA = conversation.conf
31endif 31endif
@@ -83,17 +83,17 @@ libgnunetconversation_la_LDFLAGS = \
83if BUILD_PULSE_HELPERS 83if BUILD_PULSE_HELPERS
84AUDIO_HELPER_RECD=gnunet-helper-audio-record 84AUDIO_HELPER_RECD=gnunet-helper-audio-record
85AUDIO_HELPER_PLAY=gnunet-helper-audio-playback 85AUDIO_HELPER_PLAY=gnunet-helper-audio-playback
86AUDIO_TESTS=$(check_PROGRAMS) 86#AUDIO_TESTS=$(check_PROGRAMS)
87else 87else
88if BUILD_GST_HELPERS 88if BUILD_GST_HELPERS
89AUDIO_HELPER_RECD=gnunet-helper-audio-record 89AUDIO_HELPER_RECD=gnunet-helper-audio-record
90AUDIO_HELPER_PLAY=gnunet-helper-audio-playback 90AUDIO_HELPER_PLAY=gnunet-helper-audio-playback
91AUDIO_TESTS=$(check_PROGRAMS) 91#AUDIO_TESTS=$(check_PROGRAMS)
92else 92else
93if BUILD_EXPERIMENTAL_HELPERS 93if BUILD_EXPERIMENTAL_HELPERS
94AUDIO_HELPER_RECD=gnunet-helper-audio-record 94AUDIO_HELPER_RECD=gnunet-helper-audio-record
95AUDIO_HELPER_PLAY=gnunet-helper-audio-playback 95AUDIO_HELPER_PLAY=gnunet-helper-audio-playback
96AUDIO_TESTS=$(check_PROGRAMS) 96#AUDIO_TESTS=$(check_PROGRAMS)
97endif 97endif
98endif 98endif
99endif 99endif
@@ -117,7 +117,7 @@ gnunet_helper_audio_record_LDADD = \
117 -lpulse -lopus -logg \ 117 -lpulse -lopus -logg \
118 $(INTLLIBS) 118 $(INTLLIBS)
119#gnunet_helper_audio_record_LDFLAGS = \ 119#gnunet_helper_audio_record_LDFLAGS = \
120# 120#
121 121
122gnunet_helper_audio_playback_SOURCES = \ 122gnunet_helper_audio_playback_SOURCES = \
123 gnunet-helper-audio-playback.c 123 gnunet-helper-audio-playback.c
@@ -126,7 +126,7 @@ gnunet_helper_audio_playback_LDADD = \
126 -lpulse -lopus -logg \ 126 -lpulse -lopus -logg \
127 $(INTLLIBS) 127 $(INTLLIBS)
128#gnunet_helper_audio_playback_LDFLAGS = \ 128#gnunet_helper_audio_playback_LDFLAGS = \
129# 129#
130else 130else
131if BUILD_GST_HELPERS 131if BUILD_GST_HELPERS
132gnunet_helper_audio_record_SOURCES = \ 132gnunet_helper_audio_record_SOURCES = \
@@ -188,7 +188,7 @@ gnunet_service_conversation_LDADD = \
188 $(top_builddir)/src/service/identity/libgnunetidentity.la \ 188 $(top_builddir)/src/service/identity/libgnunetidentity.la \
189 $(INTLLIBS) 189 $(INTLLIBS)
190#gnunet_service_conversation_LDFLAGS = \ 190#gnunet_service_conversation_LDFLAGS = \
191# 191#
192 192
193gnunet_conversation_SOURCES = \ 193gnunet_conversation_SOURCES = \
194 gnunet-conversation.c 194 gnunet-conversation.c
@@ -203,7 +203,7 @@ gnunet_conversation_LDADD = \
203 $(top_builddir)/src/lib/util/libgnunetutil.la \ 203 $(top_builddir)/src/lib/util/libgnunetutil.la \
204 $(INTLLIBS) 204 $(INTLLIBS)
205#gnunet_conversation_LDFLAGS = \ 205#gnunet_conversation_LDFLAGS = \
206# 206#
207 207
208gnunet_conversation_test_SOURCES = \ 208gnunet_conversation_test_SOURCES = \
209 gnunet-conversation-test.c 209 gnunet-conversation-test.c
@@ -213,7 +213,7 @@ gnunet_conversation_test_LDADD = \
213 $(top_builddir)/src/lib/util/libgnunetutil.la \ 213 $(top_builddir)/src/lib/util/libgnunetutil.la \
214 $(INTLLIBS) 214 $(INTLLIBS)
215#gnunet_conversation_test_LDFLAGS = \ 215#gnunet_conversation_test_LDFLAGS = \
216# 216#
217 217
218 218
219test_conversation_api_SOURCES = \ 219test_conversation_api_SOURCES = \
diff --git a/src/contrib/service/conversation/meson.build b/src/contrib/service/conversation/meson.build
index 4ecc0fc93..70e68f094 100644
--- a/src/contrib/service/conversation/meson.build
+++ b/src/contrib/service/conversation/meson.build
@@ -145,6 +145,8 @@ executable ('gnunet-helper-audio-playback',
145 install: true, 145 install: true,
146 install_dir: get_option('libdir') / 'gnunet' / 'libexec') 146 install_dir: get_option('libdir') / 'gnunet' / 'libexec')
147 147
148if false
149
148testconvapi = executable ('test_conversation_api', 150testconvapi = executable ('test_conversation_api',
149 ['test_conversation_api.c'], 151 ['test_conversation_api.c'],
150 dependencies: [libgnunetconversation_dep, 152 dependencies: [libgnunetconversation_dep,
@@ -201,3 +203,4 @@ test('test_conversation_api_twocalls', testconvapitwo, workdir: meson.current_bu
201test('test_conversation_api_reject', testconvapireject, workdir: meson.current_build_dir(), 203test('test_conversation_api_reject', testconvapireject, workdir: meson.current_build_dir(),
202 suite: ['conversation', 'contrib']) 204 suite: ['conversation', 'contrib'])
203 205
206endif \ No newline at end of file
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 8f39faab6..6942d2d0e 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -33,7 +33,6 @@ gnunetinclude_HEADERS = \
33 gnunet_container_lib.h \ 33 gnunet_container_lib.h \
34 gnunet_conversation_service.h \ 34 gnunet_conversation_service.h \
35 gnunet_core_service.h \ 35 gnunet_core_service.h \
36 gnunet_core_testing_lib.h \
37 gnunet_crypto_lib.h \ 36 gnunet_crypto_lib.h \
38 gnunet_curl_lib.h \ 37 gnunet_curl_lib.h \
39 gnunet_datacache_lib.h \ 38 gnunet_datacache_lib.h \
@@ -110,18 +109,17 @@ gnunetinclude_HEADERS = \
110 gnunet_sq_lib.h \ 109 gnunet_sq_lib.h \
111 gnunet_statistics_service.h \ 110 gnunet_statistics_service.h \
112 gnunet_strings_lib.h \ 111 gnunet_strings_lib.h \
113 gnunet_testing_barrier.h \
114 gnunet_testing_lib.h \ 112 gnunet_testing_lib.h \
115 gnunet_testing_plugin.h \ 113 gnunet_testing_arm_lib.h \
116 gnunet_testing_ng_lib.h \ 114 gnunet_testing_core_lib.h \
117 gnunet_testing_loop_lib.h \ 115 gnunet_testing_testbed_lib.h \
118 gnunet_testing_netjail_lib.h \ 116 gnunet_testing_transport_lib.h \
117 gnunet_testbed_lib.h \
119 gnunet_time_lib.h \ 118 gnunet_time_lib.h \
120 gnunet_transport_application_service.h \ 119 gnunet_transport_application_service.h \
121 gnunet_transport_communication_service.h \ 120 gnunet_transport_communication_service.h \
122 gnunet_transport_monitor_service.h \ 121 gnunet_transport_monitor_service.h \
123 gnunet_transport_core_service.h \ 122 gnunet_transport_core_service.h \
124 gnunet_transport_testing_ng_lib.h \
125 gnunet_tun_lib.h \ 123 gnunet_tun_lib.h \
126 gnunet_uri_lib.h \ 124 gnunet_uri_lib.h \
127 gnunet_util_lib.h \ 125 gnunet_util_lib.h \
diff --git a/src/include/gnunet_arm_service.h b/src/include/gnunet_arm_service.h
index 639e723c5..ef860bff4 100644
--- a/src/include/gnunet_arm_service.h
+++ b/src/include/gnunet_arm_service.h
@@ -244,8 +244,9 @@ struct GNUNET_ARM_Operation;
244 * #GNUNET_SYSERR if there was an error. 244 * #GNUNET_SYSERR if there was an error.
245 */ 245 */
246typedef void 246typedef void
247(*GNUNET_ARM_ConnectionStatusCallback) (void *cls, 247(*GNUNET_ARM_ConnectionStatusCallback) (
248 int connected); 248 void *cls,
249 enum GNUNET_GenericReturnValue connected);
249 250
250 251
251/** 252/**
@@ -259,9 +260,10 @@ typedef void
259 * @param result result of the operation 260 * @param result result of the operation
260 */ 261 */
261typedef void 262typedef void
262(*GNUNET_ARM_ResultCallback) (void *cls, 263(*GNUNET_ARM_ResultCallback) (
263 enum GNUNET_ARM_RequestStatus rs, 264 void *cls,
264 enum GNUNET_ARM_Result result); 265 enum GNUNET_ARM_RequestStatus rs,
266 enum GNUNET_ARM_Result result);
265 267
266 268
267/** 269/**
@@ -276,10 +278,11 @@ typedef void
276 * @param list list of services managed by arm 278 * @param list list of services managed by arm
277 */ 279 */
278typedef void 280typedef void
279(*GNUNET_ARM_ServiceListCallback) (void *cls, 281(*GNUNET_ARM_ServiceListCallback) (
280 enum GNUNET_ARM_RequestStatus rs, 282 void *cls,
281 unsigned int count, 283 enum GNUNET_ARM_RequestStatus rs,
282 const struct GNUNET_ARM_ServiceInfo *list); 284 unsigned int count,
285 const struct GNUNET_ARM_ServiceInfo *list);
283 286
284 287
285/** 288/**
@@ -294,18 +297,20 @@ typedef void
294 * @return context to use for further ARM operations, NULL on error. 297 * @return context to use for further ARM operations, NULL on error.
295 */ 298 */
296struct GNUNET_ARM_Handle * 299struct GNUNET_ARM_Handle *
297GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 300GNUNET_ARM_connect (
298 GNUNET_ARM_ConnectionStatusCallback conn_status, 301 const struct GNUNET_CONFIGURATION_Handle *cfg,
299 void *conn_status_cls); 302 GNUNET_ARM_ConnectionStatusCallback conn_status,
303 void *conn_status_cls);
300 304
301 305
302/** 306/**
303 * Disconnect from the ARM service and destroy the handle. 307 * Disconnect from the ARM service and destroy the handle.
304 * 308 *
305 * @param h the handle that was being used 309 * @param[in] h the handle that was being used
306 */ 310 */
307void 311void
308GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h); 312GNUNET_ARM_disconnect (
313 struct GNUNET_ARM_Handle *h);
309 314
310 315
311/** 316/**
@@ -315,7 +320,8 @@ GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h);
315 * @param op operation to cancel 320 * @param op operation to cancel
316 */ 321 */
317void 322void
318GNUNET_ARM_operation_cancel (struct GNUNET_ARM_Operation *op); 323GNUNET_ARM_operation_cancel (
324 struct GNUNET_ARM_Operation *op);
319 325
320 326
321/** 327/**
@@ -327,9 +333,10 @@ GNUNET_ARM_operation_cancel (struct GNUNET_ARM_Operation *op);
327 * @return handle for the operation, NULL on error 333 * @return handle for the operation, NULL on error
328 */ 334 */
329struct GNUNET_ARM_Operation * 335struct GNUNET_ARM_Operation *
330GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, 336GNUNET_ARM_request_service_list (
331 GNUNET_ARM_ServiceListCallback cont, 337 struct GNUNET_ARM_Handle *h,
332 void *cont_cls); 338 GNUNET_ARM_ServiceListCallback cont,
339 void *cont_cls);
333 340
334 341
335/** 342/**
@@ -347,10 +354,11 @@ GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h,
347 * @return handle for the operation, NULL on error 354 * @return handle for the operation, NULL on error
348 */ 355 */
349struct GNUNET_ARM_Operation * 356struct GNUNET_ARM_Operation *
350GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, 357GNUNET_ARM_request_service_stop (
351 const char *service_name, 358 struct GNUNET_ARM_Handle *h,
352 GNUNET_ARM_ResultCallback cont, 359 const char *service_name,
353 void *cont_cls); 360 GNUNET_ARM_ResultCallback cont,
361 void *cont_cls);
354 362
355 363
356/** 364/**
@@ -364,12 +372,12 @@ GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
364 * @return handle for the operation, NULL on error 372 * @return handle for the operation, NULL on error
365 */ 373 */
366struct GNUNET_ARM_Operation * 374struct GNUNET_ARM_Operation *
367GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, 375GNUNET_ARM_request_service_start (
368 const char *service_name, 376 struct GNUNET_ARM_Handle *h,
369 enum GNUNET_OS_InheritStdioFlags 377 const char *service_name,
370 std_inheritance, 378 enum GNUNET_OS_InheritStdioFlags std_inheritance,
371 GNUNET_ARM_ResultCallback cont, 379 GNUNET_ARM_ResultCallback cont,
372 void *cont_cls); 380 void *cont_cls);
373 381
374 382
375/** 383/**
@@ -386,10 +394,10 @@ struct GNUNET_ARM_MonitorHandle;
386 * @param status status of the service 394 * @param status status of the service
387 */ 395 */
388typedef void 396typedef void
389(*GNUNET_ARM_ServiceMonitorCallback) (void *cls, 397(*GNUNET_ARM_ServiceMonitorCallback) (
390 const char *service, 398 void *cls,
391 enum GNUNET_ARM_ServiceMonitorStatus 399 const char *service,
392 status); 400 enum GNUNET_ARM_ServiceMonitorStatus status);
393 401
394 402
395/** 403/**
@@ -404,9 +412,10 @@ typedef void
404 * @return context to use for further ARM monitor operations, NULL on error. 412 * @return context to use for further ARM monitor operations, NULL on error.
405 */ 413 */
406struct GNUNET_ARM_MonitorHandle * 414struct GNUNET_ARM_MonitorHandle *
407GNUNET_ARM_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, 415GNUNET_ARM_monitor_start (
408 GNUNET_ARM_ServiceMonitorCallback cont, 416 const struct GNUNET_CONFIGURATION_Handle *cfg,
409 void *cont_cls); 417 GNUNET_ARM_ServiceMonitorCallback cont,
418 void *cont_cls);
410 419
411 420
412/** 421/**
@@ -415,7 +424,8 @@ GNUNET_ARM_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
415 * @param h the handle that was being used 424 * @param h the handle that was being used
416 */ 425 */
417void 426void
418GNUNET_ARM_monitor_stop (struct GNUNET_ARM_MonitorHandle *h); 427GNUNET_ARM_monitor_stop (
428 struct GNUNET_ARM_MonitorHandle *h);
419 429
420#if 0 /* keep Emacsens' auto-indent happy */ 430#if 0 /* keep Emacsens' auto-indent happy */
421{ 431{
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 9fa3de37d..c5885e7c4 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -55,20 +55,20 @@
55#if defined(__FreeBSD__) 55#if defined(__FreeBSD__)
56 56
57#include <sys/endian.h> 57#include <sys/endian.h>
58#define bswap_32(x) bswap32(x) 58#define bswap_32(x) bswap32 (x)
59#define bswap_64(x) bswap64(x) 59#define bswap_64(x) bswap64 (x)
60 60
61#elif defined(__OpenBSD__) 61#elif defined(__OpenBSD__)
62 62
63#define bswap_32(x) swap32(x) 63#define bswap_32(x) swap32 (x)
64#define bswap_64(x) swap64(x) 64#define bswap_64(x) swap64 (x)
65 65
66#elif defined(__NetBSD__) 66#elif defined(__NetBSD__)
67 67
68#include <machine/bswap.h> 68#include <machine/bswap.h>
69#if defined(__BSWAP_RENAME) && !defined(__bswap_32) 69#if defined(__BSWAP_RENAME) && ! defined(__bswap_32)
70#define bswap_32(x) bswap32(x) 70#define bswap_32(x) bswap32 (x)
71#define bswap_64(x) bswap64(x) 71#define bswap_64(x) bswap64 (x)
72#endif 72#endif
73 73
74#elif defined(__linux__) || defined(GNU) 74#elif defined(__linux__) || defined(GNU)
@@ -166,15 +166,19 @@ enum GNUNET_GenericReturnValue
166#define BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) 166#define BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8))
167 167
168#define BYTE_SWAP_32(x) \ 168#define BYTE_SWAP_32(x) \
169 ((((x) & 0x000000ffU) << 24) | (((x) & 0x0000ff00U) << 8) \ 169 ((((x) & 0x000000ffU) << 24) | (((x) & 0x0000ff00U) << 8) \
170 | (((x) & 0x00ff0000U) >> 8) | (((x) & 0xff000000U) >> 24)) 170 | (((x) & 0x00ff0000U) >> 8) | (((x) & 0xff000000U) >> 24))
171 171
172#define BYTE_SWAP_64(x) \ 172#define BYTE_SWAP_64(x) \
173 ((((x) & 0x00000000000000ffUL) << 56) | (((x) & 0x000000000000ff00UL) << 40) \ 173 ((((x) & 0x00000000000000ffUL) << 56) | (((x) & 0x000000000000ff00UL) << \
174 | (((x) & 0x0000000000ff0000UL) << 24) | (((x) & 0x00000000ff000000UL) << 8) \ 174 40) \
175 | (((x) & 0x000000ff00000000UL) >> 8) | (((x) & 0x0000ff0000000000UL) >> 24) \ 175 | (((x) & 0x0000000000ff0000UL) << 24) | (((x) & 0x00000000ff000000UL) \
176 | (((x) & 0x00ff000000000000UL) >> 40) | (((x) & 0xff00000000000000UL) >> \ 176 << 8) \
177 56)) 177 | (((x) & 0x000000ff00000000UL) >> 8) | (((x) & 0x0000ff0000000000UL) \
178 >> 24) \
179 | (((x) & 0x00ff000000000000UL) >> 40) | (((x) & 0xff00000000000000UL) \
180 >> \
181 56))
178#endif 182#endif
179 183
180#if __BYTE_ORDER == __LITTLE_ENDIAN 184#if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -479,7 +483,7 @@ GNUNET_get_log_call_status (int caller_level,
479 483
480#endif 484#endif
481 485
482 486/* *INDENT-OFF* */
483/** 487/**
484 * @ingroup logging 488 * @ingroup logging
485 * Main log function. 489 * Main log function.
@@ -489,13 +493,15 @@ GNUNET_get_log_call_status (int caller_level,
489 * @param ... arguments for format string 493 * @param ... arguments for format string
490 */ 494 */
491void 495void
492GNUNET_log_nocheck (enum GNUNET_ErrorType kind, const char *message, ...) 496GNUNET_log_nocheck (enum GNUNET_ErrorType kind,
497 const char *message,
498 ...)
493__attribute__ ((format (printf, 2, 3))); 499__attribute__ ((format (printf, 2, 3)));
494 500
495/* from glib */ 501/* from glib */
496#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) 502#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
497#define _GNUNET_BOOLEAN_EXPR(expr) \ 503#define _GNUNET_BOOLEAN_EXPR(expr) \
498 __extension__ ({ \ 504 __extension__ ({ \
499 int _gnunet_boolean_var_; \ 505 int _gnunet_boolean_var_; \
500 if (expr) \ 506 if (expr) \
501 _gnunet_boolean_var_ = 1; \ 507 _gnunet_boolean_var_ = 1; \
@@ -513,6 +519,7 @@ __attribute__ ((format (printf, 2, 3)));
513#if ! defined(GNUNET_LOG_CALL_STATUS) 519#if ! defined(GNUNET_LOG_CALL_STATUS)
514#define GNUNET_LOG_CALL_STATUS -1 520#define GNUNET_LOG_CALL_STATUS -1
515#endif 521#endif
522/* *INDENT-ON* */
516 523
517 524
518/** 525/**
@@ -534,56 +541,56 @@ __attribute__ ((format (printf, 3, 4)));
534 541
535#if ! defined(GNUNET_CULL_LOGGING) 542#if ! defined(GNUNET_CULL_LOGGING)
536#define GNUNET_log_from(kind, comp, ...) \ 543#define GNUNET_log_from(kind, comp, ...) \
537 do \ 544 do \
538 { \ 545 { \
539 static int log_call_enabled = GNUNET_LOG_CALL_STATUS; \ 546 static int log_call_enabled = GNUNET_LOG_CALL_STATUS; \
540 if ((GNUNET_EXTRA_LOGGING > 0) || \ 547 if ((GNUNET_EXTRA_LOGGING > 0) || \
541 ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) \ 548 ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) \
542 { \ 549 { \
543 if (GN_UNLIKELY (log_call_enabled == -1)) \ 550 if (GN_UNLIKELY (log_call_enabled == -1)) \
544 log_call_enabled = \ 551 log_call_enabled = \
545 GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \ 552 GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \
546 (comp), \ 553 (comp), \
547 __FILE__, \ 554 __FILE__, \
548 __FUNCTION__, \ 555 __FUNCTION__, \
549 __LINE__); \ 556 __LINE__); \
550 if (GN_UNLIKELY (GNUNET_get_log_skip () > 0)) \ 557 if (GN_UNLIKELY (GNUNET_get_log_skip () > 0)) \
551 { \ 558 { \
552 GNUNET_log_skip (-1, GNUNET_NO); \ 559 GNUNET_log_skip (-1, GNUNET_NO); \
553 } \ 560 } \
554 else \ 561 else \
555 { \ 562 { \
556 if (GN_UNLIKELY (log_call_enabled)) \ 563 if (GN_UNLIKELY (log_call_enabled)) \
557 GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \ 564 GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \
558 } \ 565 } \
559 } \ 566 } \
560 } while (0) 567 } while (0)
561 568
562#define GNUNET_log(kind, ...) \ 569#define GNUNET_log(kind, ...) \
563 do \ 570 do \
564 { \ 571 { \
565 static int log_call_enabled = GNUNET_LOG_CALL_STATUS; \ 572 static int log_call_enabled = GNUNET_LOG_CALL_STATUS; \
566 if ((GNUNET_EXTRA_LOGGING > 0) || \ 573 if ((GNUNET_EXTRA_LOGGING > 0) || \
567 ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) \ 574 ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) \
568 { \ 575 { \
569 if (GN_UNLIKELY (log_call_enabled == -1)) \ 576 if (GN_UNLIKELY (log_call_enabled == -1)) \
570 log_call_enabled = \ 577 log_call_enabled = \
571 GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \ 578 GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \
572 NULL, \ 579 NULL, \
573 __FILE__, \ 580 __FILE__, \
574 __FUNCTION__, \ 581 __FUNCTION__, \
575 __LINE__); \ 582 __LINE__); \
576 if (GN_UNLIKELY (GNUNET_get_log_skip () > 0)) \ 583 if (GN_UNLIKELY (GNUNET_get_log_skip () > 0)) \
577 { \ 584 { \
578 GNUNET_log_skip (-1, GNUNET_NO); \ 585 GNUNET_log_skip (-1, GNUNET_NO); \
579 } \ 586 } \
580 else \ 587 else \
581 { \ 588 { \
582 if (GN_UNLIKELY (log_call_enabled)) \ 589 if (GN_UNLIKELY (log_call_enabled)) \
583 GNUNET_log_nocheck ((kind), __VA_ARGS__); \ 590 GNUNET_log_nocheck ((kind), __VA_ARGS__); \
584 } \ 591 } \
585 } \ 592 } \
586 } while (0) 593 } while (0)
587#else 594#else
588#define GNUNET_log(...) 595#define GNUNET_log(...)
589#define GNUNET_log_from(...) 596#define GNUNET_log_from(...)
@@ -642,7 +649,7 @@ GNUNET_abort_ (void) GNUNET_NORETURN;
642 */ 649 */
643const char * 650const char *
644GNUNET_b2s (const void *buf, 651GNUNET_b2s (const void *buf,
645 size_t buf_size); 652 size_t buf_size);
646 653
647 654
648/** 655/**
@@ -676,7 +683,9 @@ GNUNET_log_skip (int n, int check_reset);
676 * @return #GNUNET_OK on success, #GNUNET_SYSERR if logfile could not be opened 683 * @return #GNUNET_OK on success, #GNUNET_SYSERR if logfile could not be opened
677 */ 684 */
678enum GNUNET_GenericReturnValue 685enum GNUNET_GenericReturnValue
679GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile); 686GNUNET_log_setup (const char *comp,
687 const char *loglevel,
688 const char *logfile);
680 689
681 690
682/** 691/**
@@ -690,7 +699,8 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile);
690 * @param logger_cls closure for @a logger 699 * @param logger_cls closure for @a logger
691 */ 700 */
692void 701void
693GNUNET_logger_add (GNUNET_Logger logger, void *logger_cls); 702GNUNET_logger_add (GNUNET_Logger logger,
703 void *logger_cls);
694 704
695 705
696/** 706/**
@@ -701,7 +711,8 @@ GNUNET_logger_add (GNUNET_Logger logger, void *logger_cls);
701 * @param logger_cls closure for @a logger 711 * @param logger_cls closure for @a logger
702 */ 712 */
703void 713void
704GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls); 714GNUNET_logger_remove (GNUNET_Logger logger,
715 void *logger_cls);
705 716
706 717
707/** 718/**
@@ -916,36 +927,37 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
916 * @ingroup logging 927 * @ingroup logging
917 * Use this for fatal errors that cannot be handled 928 * Use this for fatal errors that cannot be handled
918 */ 929 */
919#if __GNUC__ >= 6 || __clang_major__ >= 6 930#if __GNUC__ >= 6 || __clang_major__ >= 6
920#define GNUNET_assert(cond) \ 931#define GNUNET_assert(cond) \
921 do \ 932 do \
922 { \ 933 { \
923 _Pragma("GCC diagnostic push") \ 934 _Pragma("GCC diagnostic push") \
924 _Pragma("GCC diagnostic ignored \"-Wtautological-compare\"") \ 935 _Pragma("GCC diagnostic ignored \"-Wtautological-compare\"") \
925 if (! (cond)) \ 936 if (! (cond)) \
926 { \ 937 { \
927 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ 938 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
928 dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \ 939 dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \
929 __FILE__, \ 940 __FILE__, \
930 __LINE__); \ 941 __LINE__); \
931 GNUNET_abort_ (); \ 942 GNUNET_abort_ (); \
932 } \ 943 } \
933 _Pragma("GCC diagnostic pop") \ 944 _Pragma("GCC diagnostic pop") \
934 } while (0) 945 } while (0)
935#else 946#else
936/* older GCC/clangs do not support -Wtautological-compare */ 947/* older GCC/clangs do not support -Wtautological-compare */
937#define GNUNET_assert(cond) \ 948#define GNUNET_assert(cond) \
938 do \ 949 do \
939 { \ 950 { \
940 if (! (cond)) \ 951 if (! (cond)) \
941 { \ 952 { \
942 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ 953 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
943 dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \ 954 dgettext ("gnunet", \
944 __FILE__, \ 955 "Assertion failed at %s:%d. Aborting.\n"), \
945 __LINE__); \ 956 __FILE__, \
946 GNUNET_abort_ (); \ 957 __LINE__); \
947 } \ 958 GNUNET_abort_ (); \
948 } while (0) 959 } \
960 } while (0)
949#endif 961#endif
950 962
951/** 963/**
@@ -953,17 +965,18 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
953 * Use this for fatal errors that cannot be handled 965 * Use this for fatal errors that cannot be handled
954 */ 966 */
955#define GNUNET_assert_at(cond, f, l) \ 967#define GNUNET_assert_at(cond, f, l) \
956 do \ 968 do \
957 { \ 969 { \
958 if (! (cond)) \ 970 if (! (cond)) \
959 { \ 971 { \
960 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ 972 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
961 dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \ 973 dgettext ("gnunet", \
962 f, \ 974 "Assertion failed at %s:%d. Aborting.\n"), \
963 l); \ 975 f, \
964 GNUNET_abort_ (); \ 976 l); \
965 } \ 977 GNUNET_abort_ (); \
966 } while (0) 978 } \
979 } while (0)
967 980
968 981
969/** 982/**
@@ -974,18 +987,20 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
974 * @param comp Component string to use for logging 987 * @param comp Component string to use for logging
975 */ 988 */
976#define GNUNET_assert_from(cond, comp) \ 989#define GNUNET_assert_from(cond, comp) \
977 do \ 990 do \
978 { \ 991 { \
979 if (! (cond)) \ 992 if (! (cond)) \
980 { \ 993 { \
981 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, \ 994 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, \
982 comp, \ 995 comp, \
983 dgettext ("gnunet", "Assertion failed at %s:%d. Aborting.\n"), \ 996 dgettext ("gnunet", \
984 __FILE__, \ 997 "Assertion failed at %s:%d. Aborting.\n") \
985 __LINE__); \ 998 , \
986 GNUNET_abort_ (); \ 999 __FILE__, \
987 } \ 1000 __LINE__); \
988 } while (0) 1001 GNUNET_abort_ (); \
1002 } \
1003 } while (0)
989 1004
990 1005
991#ifdef _Static_assert 1006#ifdef _Static_assert
@@ -1016,16 +1031,16 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1016 * not fatal (can be handled) but should not occur. 1031 * not fatal (can be handled) but should not occur.
1017 */ 1032 */
1018#define GNUNET_break(cond) \ 1033#define GNUNET_break(cond) \
1019 do \ 1034 do \
1020 { \ 1035 { \
1021 if (! (cond)) \ 1036 if (! (cond)) \
1022 { \ 1037 { \
1023 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \ 1038 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
1024 dgettext ("gnunet", "Assertion failed at %s:%d.\n"), \ 1039 dgettext ("gnunet", "Assertion failed at %s:%d.\n"), \
1025 __FILE__, \ 1040 __FILE__, \
1026 __LINE__); \ 1041 __LINE__); \
1027 } \ 1042 } \
1028 } while (0) 1043 } while (0)
1029 1044
1030 1045
1031/** 1046/**
@@ -1038,16 +1053,17 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1038 * development and testing. "OP == other peer". 1053 * development and testing. "OP == other peer".
1039 */ 1054 */
1040#define GNUNET_break_op(cond) \ 1055#define GNUNET_break_op(cond) \
1041 do \ 1056 do \
1042 { \ 1057 { \
1043 if (! (cond)) \ 1058 if (! (cond)) \
1044 { \ 1059 { \
1045 GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, \ 1060 GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, \
1046 dgettext ("gnunet", "External protocol violation detected at %s:%d.\n"), \ 1061 dgettext ("gnunet", \
1047 __FILE__, \ 1062 "External protocol violation detected at %s:%d.\n"), \
1048 __LINE__); \ 1063 __FILE__, \
1049 } \ 1064 __LINE__); \
1050 } while (0) 1065 } \
1066 } while (0)
1051 1067
1052 1068
1053/** 1069/**
@@ -1057,15 +1073,16 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1057 * by strerror(errno). 1073 * by strerror(errno).
1058 */ 1074 */
1059#define GNUNET_log_strerror(level, cmd) \ 1075#define GNUNET_log_strerror(level, cmd) \
1060 do \ 1076 do \
1061 { \ 1077 { \
1062 GNUNET_log (level, \ 1078 GNUNET_log (level, \
1063 dgettext ("gnunet", "`%s' failed at %s:%d with error: %s\n"), \ 1079 dgettext ("gnunet", \
1064 cmd, \ 1080 "`%s' failed at %s:%d with error: %s\n"), \
1065 __FILE__, \ 1081 cmd, \
1066 __LINE__, \ 1082 __FILE__, \
1067 strerror (errno)); \ 1083 __LINE__, \
1068 } while (0) 1084 strerror (errno)); \
1085 } while (0)
1069 1086
1070 1087
1071/** 1088/**
@@ -1075,16 +1092,17 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1075 * by strerror(errno). 1092 * by strerror(errno).
1076 */ 1093 */
1077#define GNUNET_log_from_strerror(level, component, cmd) \ 1094#define GNUNET_log_from_strerror(level, component, cmd) \
1078 do \ 1095 do \
1079 { \ 1096 { \
1080 GNUNET_log_from (level, \ 1097 GNUNET_log_from (level, \
1081 component, \ 1098 component, \
1082 dgettext ("gnunet", "`%s' failed at %s:%d with error: %s\n"), \ 1099 dgettext ("gnunet", \
1083 cmd, \ 1100 "`%s' failed at %s:%d with error: %s\n"), \
1084 __FILE__, \ 1101 cmd, \
1085 __LINE__, \ 1102 __FILE__, \
1086 strerror (errno)); \ 1103 __LINE__, \
1087 } while (0) 1104 strerror (errno)); \
1105 } while (0)
1088 1106
1089 1107
1090/** 1108/**
@@ -1094,16 +1112,17 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1094 * by strerror(errno). 1112 * by strerror(errno).
1095 */ 1113 */
1096#define GNUNET_log_strerror_file(level, cmd, filename) \ 1114#define GNUNET_log_strerror_file(level, cmd, filename) \
1097 do \ 1115 do \
1098 { \ 1116 { \
1099 GNUNET_log (level, \ 1117 GNUNET_log (level, \
1100 dgettext ("gnunet", "`%s' failed on file `%s' at %s:%d with error: %s\n"), \ 1118 dgettext ("gnunet", \
1101 cmd, \ 1119 "`%s' failed on file `%s' at %s:%d with error: %s\n"), \
1102 filename, \ 1120 cmd, \
1103 __FILE__, \ 1121 filename, \
1104 __LINE__, \ 1122 __FILE__, \
1105 strerror (errno)); \ 1123 __LINE__, \
1106 } while (0) 1124 strerror (errno)); \
1125 } while (0)
1107 1126
1108 1127
1109/** 1128/**
@@ -1113,17 +1132,18 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind);
1113 * by strerror(errno). 1132 * by strerror(errno).
1114 */ 1133 */
1115#define GNUNET_log_from_strerror_file(level, component, cmd, filename) \ 1134#define GNUNET_log_from_strerror_file(level, component, cmd, filename) \
1116 do \ 1135 do \
1117 { \ 1136 { \
1118 GNUNET_log_from (level, \ 1137 GNUNET_log_from (level, \
1119 component, \ 1138 component, \
1120 dgettext ("gnunet", "`%s' failed on file `%s' at %s:%d with error: %s\n"), \ 1139 dgettext ("gnunet", \
1121 cmd, \ 1140 "`%s' failed on file `%s' at %s:%d with error: %s\n"), \
1122 filename, \ 1141 cmd, \
1123 __FILE__, \ 1142 filename, \
1124 __LINE__, \ 1143 __FILE__, \
1125 strerror (errno)); \ 1144 __LINE__, \
1126 } while (0) 1145 strerror (errno)); \
1146 } while (0)
1127 1147
1128/* ************************* endianness conversion ****************** */ 1148/* ************************* endianness conversion ****************** */
1129 1149
@@ -1216,7 +1236,7 @@ GNUNET_ntoh_double (double d);
1216 * the first element! 1236 * the first element!
1217 */ 1237 */
1218#define GNUNET_memcmp(a, b) \ 1238#define GNUNET_memcmp(a, b) \
1219 ({ \ 1239 ({ \
1220 const typeof (*b) * _a = (a); \ 1240 const typeof (*b) * _a = (a); \
1221 const typeof (*a) * _b = (b); \ 1241 const typeof (*a) * _b = (b); \
1222 memcmp (_a, _b, sizeof(*a)); \ 1242 memcmp (_a, _b, sizeof(*a)); \
@@ -1245,7 +1265,7 @@ GNUNET_memcmp_ct_ (const void *b1,
1245 * the first element! 1265 * the first element!
1246 */ 1266 */
1247#define GNUNET_memcmp_priv(a, b) \ 1267#define GNUNET_memcmp_priv(a, b) \
1248 ({ \ 1268 ({ \
1249 const typeof (*b) * _a = (a); \ 1269 const typeof (*b) * _a = (a); \
1250 const typeof (*a) * _b = (b); \ 1270 const typeof (*a) * _b = (b); \
1251 GNUNET_memcmp_ct_ (_a, _b, sizeof(*a)); \ 1271 GNUNET_memcmp_ct_ (_a, _b, sizeof(*a)); \
@@ -1258,9 +1278,9 @@ GNUNET_memcmp_ct_ (const void *b1,
1258 * @param a pointer to @a n bytes which should be tested for the 1278 * @param a pointer to @a n bytes which should be tested for the
1259 * entire memory being zero'ed out. 1279 * entire memory being zero'ed out.
1260 * @param n number of bytes in @a to be tested 1280 * @param n number of bytes in @a to be tested
1261 * @return GNUNET_YES if a is zero, GNUNET_NO otherwise 1281 * @return true if @a a is zero, false_NO otherwise
1262 */ 1282 */
1263enum GNUNET_GenericReturnValue 1283bool
1264GNUNET_is_zero_ (const void *a, 1284GNUNET_is_zero_ (const void *a,
1265 size_t n); 1285 size_t n);
1266 1286
@@ -1273,7 +1293,7 @@ GNUNET_is_zero_ (const void *a,
1273 * @return GNUNET_YES if a is zero, GNUNET_NO otherwise 1293 * @return GNUNET_YES if a is zero, GNUNET_NO otherwise
1274 */ 1294 */
1275#define GNUNET_is_zero(a) \ 1295#define GNUNET_is_zero(a) \
1276 GNUNET_is_zero_ ((a), sizeof (*(a))) 1296 GNUNET_is_zero_ ((a), sizeof (*(a)))
1277 1297
1278 1298
1279/** 1299/**
@@ -1286,15 +1306,16 @@ GNUNET_is_zero_ (const void *a,
1286 * @param n number of bytes to copy 1306 * @param n number of bytes to copy
1287 */ 1307 */
1288#define GNUNET_memcpy(dst, src, n) \ 1308#define GNUNET_memcpy(dst, src, n) \
1289 do \ 1309 do \
1290 { \ 1310 { \
1291 if (0 != n) \ 1311 if (0 != n) \
1292 { \ 1312 { \
1293 (void) memcpy (dst, src, n); \ 1313 (void) memcpy (dst, src, n); \
1294 } \ 1314 } \
1295 } while (0) 1315 } while (0)
1296 1316
1297 1317
1318/* *INDENT-OFF* */
1298/** 1319/**
1299 * @ingroup memory 1320 * @ingroup memory
1300 * Allocate a size @a n array with structs or unions of the given @a type. 1321 * Allocate a size @a n array with structs or unions of the given @a type.
@@ -1308,6 +1329,7 @@ GNUNET_is_zero_ (const void *a,
1308 GNUNET_assert (SIZE_MAX / sizeof (type) >= n); \ 1329 GNUNET_assert (SIZE_MAX / sizeof (type) >= n); \
1309 (type *) GNUNET_malloc ((n) * sizeof(type)); \ 1330 (type *) GNUNET_malloc ((n) * sizeof(type)); \
1310 }) 1331 })
1332/* *INDENT-ON* */
1311 1333
1312/** 1334/**
1313 * @ingroup memory 1335 * @ingroup memory
@@ -1319,7 +1341,7 @@ GNUNET_is_zero_ (const void *a,
1319 * @param type name of the struct or union, i.e. pass 'struct Foo'. 1341 * @param type name of the struct or union, i.e. pass 'struct Foo'.
1320 */ 1342 */
1321#define GNUNET_new_array_2d(n, m, type) \ 1343#define GNUNET_new_array_2d(n, m, type) \
1322 (type **) GNUNET_xnew_array_2d_ (n, m, sizeof(type), __FILE__, __LINE__) 1344 (type **) GNUNET_xnew_array_2d_ (n, m, sizeof(type), __FILE__, __LINE__)
1323 1345
1324/** 1346/**
1325 * @ingroup memory 1347 * @ingroup memory
@@ -1332,7 +1354,8 @@ GNUNET_is_zero_ (const void *a,
1332 * @param type name of the struct or union, i.e. pass 'struct Foo'. 1354 * @param type name of the struct or union, i.e. pass 'struct Foo'.
1333 */ 1355 */
1334#define GNUNET_new_array_3d(n, m, o, type) \ 1356#define GNUNET_new_array_3d(n, m, o, type) \
1335 (type ***) GNUNET_xnew_array_3d_ (n, m, o, sizeof(type), __FILE__, __LINE__) 1357 (type ***) GNUNET_xnew_array_3d_ (n, m, o, sizeof(type), __FILE__, \
1358 __LINE__)
1336 1359
1337/** 1360/**
1338 * @ingroup memory 1361 * @ingroup memory
@@ -1364,7 +1387,7 @@ GNUNET_is_zero_ (const void *a,
1364 * @return pointer to size bytes of memory, NULL if we do not have enough memory 1387 * @return pointer to size bytes of memory, NULL if we do not have enough memory
1365 */ 1388 */
1366#define GNUNET_malloc_large(size) \ 1389#define GNUNET_malloc_large(size) \
1367 GNUNET_xmalloc_unchecked_ (size, __FILE__, __LINE__) 1390 GNUNET_xmalloc_unchecked_ (size, __FILE__, __LINE__)
1368 1391
1369 1392
1370/** 1393/**
@@ -1377,7 +1400,7 @@ GNUNET_is_zero_ (const void *a,
1377 * @return pointer to size bytes of memory 1400 * @return pointer to size bytes of memory
1378 */ 1401 */
1379#define GNUNET_realloc(ptr, size) \ 1402#define GNUNET_realloc(ptr, size) \
1380 GNUNET_xrealloc_ (ptr, size, __FILE__, __LINE__) 1403 GNUNET_xrealloc_ (ptr, size, __FILE__, __LINE__)
1381 1404
1382 1405
1383/** 1406/**
@@ -1404,8 +1427,8 @@ GNUNET_is_zero_ (const void *a,
1404 * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. NULL is allowed. 1427 * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. NULL is allowed.
1405 */ 1428 */
1406#define GNUNET_free(ptr) do { \ 1429#define GNUNET_free(ptr) do { \
1407 GNUNET_xfree_ (ptr, __FILE__, __LINE__); \ 1430 GNUNET_xfree_ (ptr, __FILE__, __LINE__); \
1408 ptr = NULL; \ 1431 ptr = NULL; \
1409} while (0) 1432} while (0)
1410 1433
1411 1434
@@ -1419,6 +1442,7 @@ GNUNET_is_zero_ (const void *a,
1419 */ 1442 */
1420#define GNUNET_strdup(a) GNUNET_xstrdup_ (a, __FILE__, __LINE__) 1443#define GNUNET_strdup(a) GNUNET_xstrdup_ (a, __FILE__, __LINE__)
1421 1444
1445
1422/** 1446/**
1423 * @ingroup memory 1447 * @ingroup memory
1424 * Wrapper around #GNUNET_xstrndup_. Makes a partial copy of the string 1448 * Wrapper around #GNUNET_xstrndup_. Makes a partial copy of the string
@@ -1429,7 +1453,7 @@ GNUNET_is_zero_ (const void *a,
1429 * @return a partial copy of the string including zero-termination 1453 * @return a partial copy of the string including zero-termination
1430 */ 1454 */
1431#define GNUNET_strndup(a, length) \ 1455#define GNUNET_strndup(a, length) \
1432 GNUNET_xstrndup_ (a, length, __FILE__, __LINE__) 1456 GNUNET_xstrndup_ (a, length, __FILE__, __LINE__)
1433 1457
1434/** 1458/**
1435 * @ingroup memory 1459 * @ingroup memory
@@ -1467,12 +1491,12 @@ GNUNET_is_zero_ (const void *a,
1467 * free the vector (then, arr will be NULL afterwards). 1491 * free the vector (then, arr will be NULL afterwards).
1468 */ 1492 */
1469#define GNUNET_array_grow(arr, size, tsize) \ 1493#define GNUNET_array_grow(arr, size, tsize) \
1470 GNUNET_xgrow_ ((void **) &(arr), \ 1494 GNUNET_xgrow_ ((void **) &(arr), \
1471 sizeof((arr)[0]), \ 1495 sizeof((arr)[0]), \
1472 &size, \ 1496 &size, \
1473 tsize, \ 1497 tsize, \
1474 __FILE__, \ 1498 __FILE__, \
1475 __LINE__) 1499 __LINE__)
1476 1500
1477/** 1501/**
1478 * @ingroup memory 1502 * @ingroup memory
@@ -1488,12 +1512,12 @@ GNUNET_is_zero_ (const void *a,
1488 * @param element the element that will be appended to the array 1512 * @param element the element that will be appended to the array
1489 */ 1513 */
1490#define GNUNET_array_append(arr, len, element) \ 1514#define GNUNET_array_append(arr, len, element) \
1491 do \ 1515 do \
1492 { \ 1516 { \
1493 GNUNET_assert ((len) + 1 > (len)); \ 1517 GNUNET_assert ((len) + 1 > (len)); \
1494 GNUNET_array_grow (arr, len, len + 1); \ 1518 GNUNET_array_grow (arr, len, len + 1); \
1495 (arr) [len - 1] = element; \ 1519 (arr) [len - 1] = element; \
1496 } while (0) 1520 } while (0)
1497 1521
1498 1522
1499/** 1523/**
@@ -1520,15 +1544,15 @@ GNUNET_is_zero_ (const void *a,
1520 1544
1521 */ 1545 */
1522#define GNUNET_array_concatenate(arr1, len1, arr2, len2) \ 1546#define GNUNET_array_concatenate(arr1, len1, arr2, len2) \
1523 do \ 1547 do \
1524 { \ 1548 { \
1525 const typeof (*arr2) * _a1 = (arr1); \ 1549 const typeof (*arr2) * _a1 = (arr1); \
1526 const typeof (*arr1) * _a2 = (arr2); \ 1550 const typeof (*arr1) * _a2 = (arr2); \
1527 GNUNET_assert ((len1) + (len2) >= (len1)); \ 1551 GNUNET_assert ((len1) + (len2) >= (len1)); \
1528 GNUNET_assert (SIZE_MAX / sizeof (*_a1) >= ((len1) + (len2))); \ 1552 GNUNET_assert (SIZE_MAX / sizeof (*_a1) >= ((len1) + (len2))); \
1529 GNUNET_array_grow (arr1, len1, (len1) + (len2)); \ 1553 GNUNET_array_grow (arr1, len1, (len1) + (len2)); \
1530 memcpy (&(arr1) [(len1) - (len2)], _a2, (len2) * sizeof (*arr1)); \ 1554 memcpy (&(arr1) [(len1) - (len2)], _a2, (len2) * sizeof (*arr1)); \
1531 } while (0) 1555 } while (0)
1532 1556
1533 1557
1534/** 1558/**
@@ -1579,7 +1603,9 @@ __attribute__ ((format (printf, 2, 3)));
1579 * @return allocated memory, never NULL 1603 * @return allocated memory, never NULL
1580 */ 1604 */
1581void * 1605void *
1582GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber); 1606GNUNET_xmalloc_ (size_t size,
1607 const char *filename,
1608 int linenumber);
1583 1609
1584 1610
1585/** 1611/**
@@ -1659,7 +1685,9 @@ GNUNET_xmemdup_ (const void *buf,
1659 * @return pointer to size bytes of memory, NULL if we do not have enough memory 1685 * @return pointer to size bytes of memory, NULL if we do not have enough memory
1660 */ 1686 */
1661void * 1687void *
1662GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber); 1688GNUNET_xmalloc_unchecked_ (size_t size,
1689 const char *filename,
1690 int linenumber);
1663 1691
1664 1692
1665/** 1693/**
@@ -1667,7 +1695,10 @@ GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber);
1667 * memory is available. 1695 * memory is available.
1668 */ 1696 */
1669void * 1697void *
1670GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber); 1698GNUNET_xrealloc_ (void *ptr,
1699 size_t n,
1700 const char *filename,
1701 int linenumber);
1671 1702
1672 1703
1673/** 1704/**
@@ -1680,7 +1711,9 @@ GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber);
1680 * @param linenumber line where this call is being made (for debugging) 1711 * @param linenumber line where this call is being made (for debugging)
1681 */ 1712 */
1682void 1713void
1683GNUNET_xfree_ (void *ptr, const char *filename, int linenumber); 1714GNUNET_xfree_ (void *ptr,
1715 const char *filename,
1716 int linenumber);
1684 1717
1685 1718
1686/** 1719/**
@@ -1691,7 +1724,9 @@ GNUNET_xfree_ (void *ptr, const char *filename, int linenumber);
1691 * @return the duplicated string 1724 * @return the duplicated string
1692 */ 1725 */
1693char * 1726char *
1694GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber); 1727GNUNET_xstrdup_ (const char *str,
1728 const char *filename,
1729 int linenumber);
1695 1730
1696/** 1731/**
1697 * Dup partially a string. Don't call GNUNET_xstrndup_ directly. Use the #GNUNET_strndup macro. 1732 * Dup partially a string. Don't call GNUNET_xstrndup_ directly. Use the #GNUNET_strndup macro.
@@ -1861,6 +1896,8 @@ enum GNUNET_SCHEDULER_Priority
1861}; 1896};
1862 1897
1863 1898
1899/* *INDENT-OFF* */
1900
1864#if 0 /* keep Emacsens' auto-indent happy */ 1901#if 0 /* keep Emacsens' auto-indent happy */
1865{ 1902{
1866#endif 1903#endif
@@ -1869,5 +1906,3 @@ enum GNUNET_SCHEDULER_Priority
1869#endif 1906#endif
1870 1907
1871#endif /* GNUNET_COMMON_H */ 1908#endif /* GNUNET_COMMON_H */
1872
1873/** @} */ /* end of group addition */
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index 3b9be5849..132172516 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -66,7 +66,8 @@ GNUNET_CONFIGURATION_create (void);
66 * @return duplicate configuration 66 * @return duplicate configuration
67 */ 67 */
68struct GNUNET_CONFIGURATION_Handle * 68struct GNUNET_CONFIGURATION_Handle *
69GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg); 69GNUNET_CONFIGURATION_dup (
70 const struct GNUNET_CONFIGURATION_Handle *cfg);
70 71
71 72
72/** 73/**
@@ -75,7 +76,8 @@ GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg);
75 * @param cfg configuration to destroy 76 * @param cfg configuration to destroy
76 */ 77 */
77void 78void
78GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg); 79GNUNET_CONFIGURATION_destroy (
80 struct GNUNET_CONFIGURATION_Handle *cfg);
79 81
80 82
81/** 83/**
@@ -88,8 +90,9 @@ GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg);
88 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 90 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
89 */ 91 */
90enum GNUNET_GenericReturnValue 92enum GNUNET_GenericReturnValue
91GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, 93GNUNET_CONFIGURATION_load (
92 const char *filename); 94 struct GNUNET_CONFIGURATION_Handle *cfg,
95 const char *filename);
93 96
94 97
95/** 98/**
@@ -101,8 +104,9 @@ GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
101 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 104 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
102 */ 105 */
103enum GNUNET_GenericReturnValue 106enum GNUNET_GenericReturnValue
104GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, 107GNUNET_CONFIGURATION_load_from (
105 const char *defaults_d); 108 struct GNUNET_CONFIGURATION_Handle *cfg,
109 const char *defaults_d);
106 110
107 111
108/** 112/**
@@ -138,8 +142,9 @@ GNUNET_CONFIGURATION_default_filename (void);
138 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 142 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
139 */ 143 */
140enum GNUNET_GenericReturnValue 144enum GNUNET_GenericReturnValue
141GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, 145GNUNET_CONFIGURATION_parse (
142 const char *filename); 146 struct GNUNET_CONFIGURATION_Handle *cfg,
147 const char *filename);
143 148
144 149
145/** 150/**
@@ -151,8 +156,9 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
151 * present. This memory should be freed by the caller 156 * present. This memory should be freed by the caller
152 */ 157 */
153char * 158char *
154GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, 159GNUNET_CONFIGURATION_serialize (
155 size_t *size); 160 const struct GNUNET_CONFIGURATION_Handle *cfg,
161 size_t *size);
156 162
157 163
158/** 164/**
@@ -168,6 +174,7 @@ char *
168GNUNET_CONFIGURATION_serialize_diagnostics ( 174GNUNET_CONFIGURATION_serialize_diagnostics (
169 const struct GNUNET_CONFIGURATION_Handle *cfg); 175 const struct GNUNET_CONFIGURATION_Handle *cfg);
170 176
177
171/** 178/**
172 * De-serializes configuration 179 * De-serializes configuration
173 * 180 *
@@ -179,10 +186,11 @@ GNUNET_CONFIGURATION_serialize_diagnostics (
179 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 186 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
180 */ 187 */
181enum GNUNET_GenericReturnValue 188enum GNUNET_GenericReturnValue
182GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, 189GNUNET_CONFIGURATION_deserialize (
183 const char *mem, 190 struct GNUNET_CONFIGURATION_Handle *cfg,
184 size_t size, 191 const char *mem,
185 const char *source_filename); 192 size_t size,
193 const char *source_filename);
186 194
187 195
188/** 196/**
@@ -193,8 +201,9 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg,
193 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 201 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
194 */ 202 */
195enum GNUNET_GenericReturnValue 203enum GNUNET_GenericReturnValue
196GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, 204GNUNET_CONFIGURATION_write (
197 const char *filename); 205 struct GNUNET_CONFIGURATION_Handle *cfg,
206 const char *filename);
198 207
199 208
200/** 209/**
@@ -233,7 +242,8 @@ GNUNET_CONFIGURATION_get_diff (
233 * @return #GNUNET_NO if clean, #GNUNET_YES if dirty, #GNUNET_SYSERR on error (i.e. last save failed) 242 * @return #GNUNET_NO if clean, #GNUNET_YES if dirty, #GNUNET_SYSERR on error (i.e. last save failed)
234 */ 243 */
235enum GNUNET_GenericReturnValue 244enum GNUNET_GenericReturnValue
236GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); 245GNUNET_CONFIGURATION_is_dirty (
246 const struct GNUNET_CONFIGURATION_Handle *cfg);
237 247
238 248
239/** 249/**
@@ -244,8 +254,9 @@ GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg);
244 * @return status code 254 * @return status code
245 */ 255 */
246typedef enum GNUNET_GenericReturnValue 256typedef enum GNUNET_GenericReturnValue
247(*GNUNET_CONFIGURATION_Callback)(void *cls, 257(*GNUNET_CONFIGURATION_Callback)(
248 const struct GNUNET_CONFIGURATION_Handle *cfg); 258 void *cls,
259 const struct GNUNET_CONFIGURATION_Handle *cfg);
249 260
250 261
251/** 262/**
@@ -260,9 +271,10 @@ typedef enum GNUNET_GenericReturnValue
260 * otherwise return value from @a cb. 271 * otherwise return value from @a cb.
261 */ 272 */
262enum GNUNET_GenericReturnValue 273enum GNUNET_GenericReturnValue
263GNUNET_CONFIGURATION_parse_and_run (const char *filename, 274GNUNET_CONFIGURATION_parse_and_run (
264 GNUNET_CONFIGURATION_Callback cb, 275 const char *filename,
265 void *cb_cls); 276 GNUNET_CONFIGURATION_Callback cb,
277 void *cb_cls);
266 278
267/** 279/**
268 * Enable extra diagnostics. Will produce more log output 280 * Enable extra diagnostics. Will produce more log output
@@ -309,9 +321,10 @@ typedef void
309 * @param iter_cls closure for @a iter 321 * @param iter_cls closure for @a iter
310 */ 322 */
311void 323void
312GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, 324GNUNET_CONFIGURATION_iterate (
313 GNUNET_CONFIGURATION_Iterator iter, 325 const struct GNUNET_CONFIGURATION_Handle *cfg,
314 void *iter_cls); 326 GNUNET_CONFIGURATION_Iterator iter,
327 void *iter_cls);
315 328
316 329
317/** 330/**
@@ -335,8 +348,9 @@ GNUNET_CONFIGURATION_iterate_sections (
335 * @param section name of the section to remove 348 * @param section name of the section to remove
336 */ 349 */
337void 350void
338GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg, 351GNUNET_CONFIGURATION_remove_section (
339 const char *section); 352 struct GNUNET_CONFIGURATION_Handle *cfg,
353 const char *section);
340 354
341 355
342/** 356/**
@@ -596,10 +610,11 @@ GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle *cfg,
596 * @param value value to set 610 * @param value value to set
597 */ 611 */
598void 612void
599GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg, 613GNUNET_CONFIGURATION_set_value_string (
600 const char *section, 614 struct GNUNET_CONFIGURATION_Handle *cfg,
601 const char *option, 615 const char *section,
602 const char *value); 616 const char *option,
617 const char *value);
603 618
604 619
605/** 620/**
@@ -649,10 +664,8 @@ struct GNUNET_CONFIGURATION_ConfigSettings
649{ 664{
650 665
651 /** 666 /**
652 * Must be set to the API version, i.e. 667 * Must be set to the API version, i.e. #GNUNET_UTIL_VERSION. Used to
653 * #GNUNET_UTIL_VERSION. Used to detect 668 * detect which version of the struct the client is using.
654 * which version of the struct the client
655 * is using.
656 */ 669 */
657 unsigned int api_version; 670 unsigned int api_version;
658 671
@@ -696,7 +709,6 @@ struct GNUNET_CONFIGURATION_ConfigSettings
696 */ 709 */
697 int full; 710 int full;
698 711
699
700 /** 712 /**
701 * Return value from the operation, to be returned 713 * Return value from the operation, to be returned
702 * from 'main'. 714 * from 'main'.
@@ -714,50 +726,52 @@ struct GNUNET_CONFIGURATION_ConfigSettings
714 * @param cs configuration settings to initialize 726 * @param cs configuration settings to initialize
715 */ 727 */
716#define GNUNET_CONFIGURATION_CONFIG_OPTIONS(cs) \ 728#define GNUNET_CONFIGURATION_CONFIG_OPTIONS(cs) \
717 GNUNET_GETOPT_option_flag ( \ 729 GNUNET_GETOPT_option_flag ( \
718 'F', \ 730 'F', \
719 "full", \ 731 "full", \
720 gettext_noop ( \ 732 gettext_noop ( \
721 "write the full configuration file, including default values"), \ 733 "write the full configuration file, including default values"), \
722 &(cs)->full), \ 734 &(cs)->full), \
723 GNUNET_GETOPT_option_flag ( \ 735 GNUNET_GETOPT_option_flag ( \
724 'f', \ 736 'f', \
725 "filename", \ 737 "filename", \
726 gettext_noop ("interpret option value as a filename (with $-expansion)"), \ 738 gettext_noop ( \
727 &(cs)->is_filename), \ 739 "interpret option value as a filename (with $-expansion)"), \
728 GNUNET_GETOPT_option_string ('o', \ 740 &(cs)->is_filename), \
729 "option", \ 741 GNUNET_GETOPT_option_string ('o', \
730 "OPTION", \ 742 "option", \
731 gettext_noop ("name of the option to access"), \ 743 "OPTION", \
732 &(cs)->option), \ 744 gettext_noop ( \
733 GNUNET_GETOPT_option_flag ( \ 745 "name of the option to access"), \
734 'r', \ 746 &(cs)->option), \
735 "rewrite", \ 747 GNUNET_GETOPT_option_flag ( \
736 gettext_noop ( \ 748 'r', \
737 "rewrite the configuration file, even if nothing changed"), \ 749 "rewrite", \
738 &(cs)->rewrite), \ 750 gettext_noop ( \
739 GNUNET_GETOPT_option_flag ( \ 751 "rewrite the configuration file, even if nothing changed"), \
740 'd', \ 752 &(cs)->rewrite), \
741 "diagnostics", \ 753 GNUNET_GETOPT_option_flag ( \
742 gettext_noop ( \ 754 'd', \
743 "output extra diagnostics"), \ 755 "diagnostics", \
744 &(cs)->diagnostics), \ 756 gettext_noop ( \
745 GNUNET_GETOPT_option_flag ('S', \ 757 "output extra diagnostics"), \
746 "list-sections", \ 758 &(cs)->diagnostics), \
747 gettext_noop ( \ 759 GNUNET_GETOPT_option_flag ('S', \
748 "print available configuration sections"), \ 760 "list-sections", \
749 &(cs)->list_sections), \ 761 gettext_noop ( \
750 GNUNET_GETOPT_option_string ('s', \ 762 "print available configuration sections"), \
751 "section", \ 763 &(cs)->list_sections), \
752 "SECTION", \ 764 GNUNET_GETOPT_option_string ('s', \
753 gettext_noop ( \ 765 "section", \
754 "name of the section to access"), \ 766 "SECTION", \
755 &(cs)->section), \ 767 gettext_noop ( \
756 GNUNET_GETOPT_option_string ('V', \ 768 "name of the section to access"), \
757 "value", \ 769 &(cs)->section), \
758 "VALUE", \ 770 GNUNET_GETOPT_option_string ('V', \
759 gettext_noop ("value to set"), \ 771 "value", \
760 &(cs)->value) 772 "VALUE", \
773 gettext_noop ("value to set"), \
774 &(cs)->value)
761 775
762 776
763/** 777/**
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 4580f795d..b74bbcd1e 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -973,7 +973,7 @@ GNUNET_CRYPTO_hash_from_string2 (const char *enc,
973 * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding 973 * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding
974 */ 974 */
975#define GNUNET_CRYPTO_hash_from_string(enc, result) \ 975#define GNUNET_CRYPTO_hash_from_string(enc, result) \
976 GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result) 976 GNUNET_CRYPTO_hash_from_string2 (enc, strlen (enc), result)
977 977
978 978
979/** 979/**
@@ -1736,6 +1736,15 @@ GNUNET_CRYPTO_edx25519_key_clear (struct GNUNET_CRYPTO_Edx25519PrivateKey *pk);
1736void 1736void
1737GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk); 1737GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk);
1738 1738
1739/**
1740 * @ingroup crypto
1741 * Clear memory that was used to store a private key.
1742 *
1743 * @param pk location of the key
1744 */
1745void
1746GNUNET_CRYPTO_private_key_clear (struct GNUNET_CRYPTO_PrivateKey *pk);
1747
1739 1748
1740/** 1749/**
1741 * @ingroup crypto 1750 * @ingroup crypto
@@ -2215,15 +2224,15 @@ GNUNET_CRYPTO_eddsa_sign_ (
2215 * @param[out] sig where to write the signature 2224 * @param[out] sig where to write the signature
2216 */ 2225 */
2217#define GNUNET_CRYPTO_eddsa_sign(priv,ps,sig) do { \ 2226#define GNUNET_CRYPTO_eddsa_sign(priv,ps,sig) do { \
2218 /* check size is set correctly */ \ 2227 /* check size is set correctly */ \
2219 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*ps)); \ 2228 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*ps)); \
2220 /* check 'ps' begins with the purpose */ \ 2229 /* check 'ps' begins with the purpose */ \
2221 GNUNET_static_assert (((void*) (ps)) == \ 2230 GNUNET_static_assert (((void*) (ps)) == \
2222 ((void*) &(ps)->purpose)); \ 2231 ((void*) &(ps)->purpose)); \
2223 GNUNET_assert (GNUNET_OK == \ 2232 GNUNET_assert (GNUNET_OK == \
2224 GNUNET_CRYPTO_eddsa_sign_ (priv, \ 2233 GNUNET_CRYPTO_eddsa_sign_ (priv, \
2225 &(ps)->purpose, \ 2234 &(ps)->purpose, \
2226 sig)); \ 2235 sig)); \
2227} while (0) 2236} while (0)
2228 2237
2229 2238
@@ -2277,15 +2286,15 @@ GNUNET_CRYPTO_eddsa_sign_raw (
2277 * @param[out] sig where to write the signature 2286 * @param[out] sig where to write the signature
2278 */ 2287 */
2279#define GNUNET_CRYPTO_ecdsa_sign(priv,ps,sig) do { \ 2288#define GNUNET_CRYPTO_ecdsa_sign(priv,ps,sig) do { \
2280 /* check size is set correctly */ \ 2289 /* check size is set correctly */ \
2281 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ 2290 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2282 /* check 'ps' begins with the purpose */ \ 2291 /* check 'ps' begins with the purpose */ \
2283 GNUNET_static_assert (((void*) (ps)) == \ 2292 GNUNET_static_assert (((void*) (ps)) == \
2284 ((void*) &(ps)->purpose)); \ 2293 ((void*) &(ps)->purpose)); \
2285 GNUNET_assert (GNUNET_OK == \ 2294 GNUNET_assert (GNUNET_OK == \
2286 GNUNET_CRYPTO_ecdsa_sign_ (priv, \ 2295 GNUNET_CRYPTO_ecdsa_sign_ (priv, \
2287 &(ps)->purpose, \ 2296 &(ps)->purpose, \
2288 sig)); \ 2297 sig)); \
2289} while (0) 2298} while (0)
2290 2299
2291/** 2300/**
@@ -2324,15 +2333,15 @@ GNUNET_CRYPTO_edx25519_sign_ (
2324 * @param[out] sig where to write the signature 2333 * @param[out] sig where to write the signature
2325 */ 2334 */
2326#define GNUNET_CRYPTO_edx25519_sign(priv,ps,sig) do { \ 2335#define GNUNET_CRYPTO_edx25519_sign(priv,ps,sig) do { \
2327 /* check size is set correctly */ \ 2336 /* check size is set correctly */ \
2328 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ 2337 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
2329 /* check 'ps' begins with the purpose */ \ 2338 /* check 'ps' begins with the purpose */ \
2330 GNUNET_static_assert (((void*) (ps)) == \ 2339 GNUNET_static_assert (((void*) (ps)) == \
2331 ((void*) &(ps)->purpose)); \ 2340 ((void*) &(ps)->purpose)); \
2332 GNUNET_assert (GNUNET_OK == \ 2341 GNUNET_assert (GNUNET_OK == \
2333 GNUNET_CRYPTO_edx25519_sign_ (priv, \ 2342 GNUNET_CRYPTO_edx25519_sign_ (priv, \
2334 &(ps)->purpose, \ 2343 &(ps)->purpose, \
2335 sig)); \ 2344 sig)); \
2336} while (0) 2345} while (0)
2337 2346
2338 2347
@@ -2664,90 +2673,97 @@ GNUNET_CRYPTO_edx25519_public_key_derive (
2664 size_t seedsize, 2673 size_t seedsize,
2665 struct GNUNET_CRYPTO_Edx25519PublicKey *result); 2674 struct GNUNET_CRYPTO_Edx25519PublicKey *result);
2666 2675
2667/**
2668 * Note: Included in header for testing purposes. GNUNET_CRYPTO_ecdhe_elligator_decoding will be the correct API for the direct map.
2669 * TODO: Make static.
2670 * @ingroup crypto
2671 * Encodes an element of the underlying finite field, so called representative, of Curve25519 to a point on the curve
2672 * This transformation is deterministic
2673 *
2674 * @param representative element of the finite field
2675 * @param point destination for the calculated point on the curve
2676 * @param high_y destination set to "True" if corresponding y-coordinate is > 2 ^ 254 - 10
2677 */
2678bool
2679GNUNET_CRYPTO_ecdhe_elligator_direct_map (uint8_t *point, bool *high_y,
2680 uint8_t *representative);
2681
2682 2676
2683/** 2677/**
2684 * @ingroup crypto 2678 * @ingroup crypto
2685 * Clears the most significant bit and second most significant bit to the serialized representaive before applying elligator direct map. 2679 * Clears the most significant bit and second most significant bit of the serialized representaive before applying elligator direct map.
2686 * 2680 *
2687 * @param serialized_representative serialized version of an element of Curves25519's finite field 2681 * @param representative serialized elligator representative of an element of Curves25519's finite field
2688 * @param point destination for the calculated point on the curve 2682 * @param point destination for the calculated point on the curve
2689 * @param high_y destination set to "True" if corresponding y-coordinate is > 2 ^ 254 - 10 2683 * @param high_y bool pointed to will be set to 'true' if corresponding y-coordinate is > 2 ^ 254 - 10, otherwise 0. Can be set to NULL if not needed.
2690 */ 2684 */
2691bool 2685void
2692GNUNET_CRYPTO_ecdhe_elligator_decoding (struct 2686GNUNET_CRYPTO_ecdhe_elligator_decoding (
2693 GNUNET_CRYPTO_EcdhePublicKey *point, 2687 struct GNUNET_CRYPTO_EcdhePublicKey *point,
2694 bool *high_y, 2688 bool *high_y,
2695 struct 2689 const struct GNUNET_CRYPTO_ElligatorRepresentative *representative);
2696 GNUNET_CRYPTO_ElligatorRepresentative *
2697 seriliazed_representative);
2698 2690
2699/** 2691/**
2700 * @ingroup crypto 2692 * @ingroup crypto
2701 * Encodes a point on Curve25519 to a an element of the underlying finite field 2693 * Encodes a point on Curve25519 to a an element of the underlying finite field.
2702 * This transformation is deterministic 2694 * This transformation is deterministic.
2703 * 2695 *
2704 * @param point a point on the curve 2696 * @param r storage for the calculated representative
2697 * @param pub a point on the curve
2705 * @param high_y encodes if y-coordinate is > 2 ^254 - 10, which determines the representative value out of two 2698 * @param high_y encodes if y-coordinate is > 2 ^254 - 10, which determines the representative value out of two
2706 * @param representative destination for the calculated element of the finite field 2699 * @return 'true' if the given point can be encoded into a representative. Otherwise 'false' is returned and the content of the representative storage is undefined
2707 */ 2700 */
2708bool 2701bool
2709GNUNET_CRYPTO_ecdhe_elligator_inverse_map (uint8_t *representative, const 2702GNUNET_CRYPTO_ecdhe_elligator_encoding (
2710 uint8_t *point, 2703 struct GNUNET_CRYPTO_ElligatorRepresentative *r,
2711 bool high_y); 2704 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
2705 bool high_y);
2712 2706
2713 2707
2714/** 2708/**
2715* Initializes the elligator library
2716* THis function is thread safe
2717*/
2718void
2719GNUNET_CRYPTO_ecdhe_elligator_initialize (void);
2720
2721/**
2722 * @ingroup crypto 2709 * @ingroup crypto
2723 * Generates a valid public key for elligator's inverse map by adding a lower order point to a prime order point. 2710 * Generates a valid public key for elligator's inverse map by adding a lower order point to a prime order point.
2711 * Following Method 1 in description https://elligator.org/key-exchange section Step 2: Generate a “special†public key.
2724 * 2712 *
2725 * @param pub valid public key for elligator inverse map 2713 * @param pub valid public key for elligator inverse map
2726 * @param pk private key for generating valid public key 2714 * @param pk private key for generating valid public key
2715 * @return GNUNET_OK on success
2727 */ 2716 */
2728int 2717enum GNUNET_GenericReturnValue
2729GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (unsigned char 2718GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (
2730 pub[ 2719 struct GNUNET_CRYPTO_EcdhePublicKey *pub,
2731 crypto_scalarmult_SCALARBYTES 2720 struct GNUNET_CRYPTO_EcdhePrivateKey *pk);
2732 ],
2733 struct
2734 GNUNET_CRYPTO_EcdhePrivateKey
2735 *pk);
2736 2721
2737 2722
2738/** 2723/**
2739 * @ingroup crypto 2724 * @ingroup crypto
2740 * Generates a private key for Curve25519 and the elligator representative of the corresponding public key 2725 * Generates a private key for Curve25519 and the elligator representative of the corresponding public key.
2741 * 2726 *
2742 * @param repr representative of the public key 2727 * @param repr representative of the public key
2743 * @param pk Curve25519 private key 2728 * @param pk Curve25519 private key
2744 * @return GNUNET_OK if creation successful
2745 */ 2729 */
2746enum GNUNET_GenericReturnValue 2730void
2747GNUNET_CRYPTO_ecdhe_elligator_key_create ( 2731GNUNET_CRYPTO_ecdhe_elligator_key_create (
2748 struct GNUNET_CRYPTO_ElligatorRepresentative *repr, 2732 struct GNUNET_CRYPTO_ElligatorRepresentative *repr,
2749 struct GNUNET_CRYPTO_EcdhePrivateKey *pk); 2733 struct GNUNET_CRYPTO_EcdhePrivateKey *pk);
2750 2734
2735/**
2736 * @ingroup crypto
2737 * Carries out ecdh encapsulation with given public key and the private key from a freshly created ephemeral key pair.
2738 * Following the terminology in https://eprint.iacr.org/2021/509.pdf.
2739 *
2740 * @param pub given edwards curve public key (X)
2741 * @param r representative of ephemeral public key A to use for the ECDH (direct_map(r)=A=aG)
2742 * @param key_material where to write the key material H(aX)=H(x(aG))
2743 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
2744 */
2745enum GNUNET_GenericReturnValue
2746GNUNET_CRYPTO_eddsa_elligator_kem_encaps (
2747 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
2748 struct GNUNET_CRYPTO_ElligatorRepresentative *r,
2749 struct GNUNET_HashCode *key_material);
2750
2751/**
2752 * @ingroup crypto
2753 * Carries out ecdh decapsulation with own private key and the representative of the received public key.
2754 * Following the terminology in https://eprint.iacr.org/2021/509.pdf.
2755 *
2756 * @param priv own private key (x)
2757 * @param r received representative r, from which we can obtain the public key A (direct_map(r)=A=aG)
2758 * @param key_material where to write the key material H(xA)=H(a(xG))
2759 * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
2760 */
2761enum GNUNET_GenericReturnValue
2762GNUNET_CRYPTO_eddsa_elligator_kem_decaps (
2763 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
2764 const struct GNUNET_CRYPTO_ElligatorRepresentative *r,
2765 struct GNUNET_HashCode *key_material);
2766
2751 2767
2752/** 2768/**
2753 * Output the given MPI value to the given buffer in network 2769 * Output the given MPI value to the given buffer in network
@@ -4232,15 +4248,15 @@ GNUNET_CRYPTO_sign_raw_ (
4232 * @param[out] sig where to write the signature 4248 * @param[out] sig where to write the signature
4233 */ 4249 */
4234#define GNUNET_CRYPTO_sign(priv,ps,sig) do { \ 4250#define GNUNET_CRYPTO_sign(priv,ps,sig) do { \
4235 /* check size is set correctly */ \ 4251 /* check size is set correctly */ \
4236 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \ 4252 GNUNET_assert (ntohl ((ps)->purpose.size) == sizeof (*(ps))); \
4237 /* check 'ps' begins with the purpose */ \ 4253 /* check 'ps' begins with the purpose */ \
4238 GNUNET_static_assert (((void*) (ps)) == \ 4254 GNUNET_static_assert (((void*) (ps)) == \
4239 ((void*) &(ps)->purpose)); \ 4255 ((void*) &(ps)->purpose)); \
4240 GNUNET_assert (GNUNET_OK == \ 4256 GNUNET_assert (GNUNET_OK == \
4241 GNUNET_CRYPTO_sign_ (priv, \ 4257 GNUNET_CRYPTO_sign_ (priv, \
4242 &(ps)->purpose, \ 4258 &(ps)->purpose, \
4243 sig)); \ 4259 sig)); \
4244} while (0) 4260} while (0)
4245 4261
4246 4262
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index 5c271c71f..a05e07ac5 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -525,6 +525,17 @@ GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri);
525 525
526 526
527/** 527/**
528 * What is the hash of the original file's content
529 * that this URI refers to?
530 *
531 * @param uri the CHK URI to inspect
532 * @return hash of the file as specified in the CHK URI
533 */
534const struct GNUNET_HashCode*
535GNUNET_FS_uri_chk_get_file_hash (const struct GNUNET_FS_Uri *uri);
536
537
538/**
528 * Is this a location URI? 539 * Is this a location URI?
529 * 540 *
530 * @param uri the uri to check 541 * @param uri the uri to check
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h
index 390e8c153..91ba362e5 100644
--- a/src/include/gnunet_getopt_lib.h
+++ b/src/include/gnunet_getopt_lib.h
@@ -33,7 +33,7 @@
33 * @{ 33 * @{
34 */ 34 */
35 35
36#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) 36#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__)
37#error "Only <gnunet_util_lib.h> can be included directly." 37#error "Only <gnunet_util_lib.h> can be included directly."
38#endif 38#endif
39 39
@@ -275,12 +275,12 @@ GNUNET_GETOPT_option_base32_fixed_size (char shortName,
275 argumentHelp, \ 275 argumentHelp, \
276 description, \ 276 description, \
277 val) \ 277 val) \
278 GNUNET_GETOPT_option_base32_fixed_size (shortName, \ 278 GNUNET_GETOPT_option_base32_fixed_size (shortName, \
279 name, \ 279 name, \
280 argumentHelp, \ 280 argumentHelp, \
281 description, \ 281 description, \
282 val, \ 282 val, \
283 sizeof(*val)) 283 sizeof(*val))
284 284
285 285
286/** 286/**
@@ -481,9 +481,9 @@ GNUNET_GETOPT_option_exclusive (struct GNUNET_GETOPT_CommandLineOption opt);
481 * Marker for the end of the list of options. 481 * Marker for the end of the list of options.
482 */ 482 */
483#define GNUNET_GETOPT_OPTION_END \ 483#define GNUNET_GETOPT_OPTION_END \
484 { \ 484 { \
485 '\0', NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL \ 485 '\0', NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL \
486 } 486 }
487 487
488 488
489/** 489/**
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h
index 1f19e58ac..e7ed2d3c2 100644
--- a/src/include/gnunet_gns_service.h
+++ b/src/include/gnunet_gns_service.h
@@ -227,6 +227,16 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
227void * 227void *
228GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr); 228GNUNET_GNS_lookup_with_tld_cancel (struct GNUNET_GNS_LookupWithTldRequest *ltr);
229 229
230/**
231 * Try to parse the zTLD into a public key.
232 *
233 * @param[in] name the name to parse
234 * @param[out] ztld_key the identity key (must be allocated by caller). Only set of #GNUNET_OK is returned.
235 * @return GNUNET_OK on success.
236 */
237enum GNUNET_GenericReturnValue
238GNUNET_GNS_parse_ztld (const char *name,
239 struct GNUNET_CRYPTO_PublicKey *ztld_key);
230 240
231#if 0 /* keep Emacsens' auto-indent happy */ 241#if 0 /* keep Emacsens' auto-indent happy */
232{ 242{
diff --git a/src/include/gnunet_helper_lib.h b/src/include/gnunet_helper_lib.h
index c329c4a33..57630c45c 100644
--- a/src/include/gnunet_helper_lib.h
+++ b/src/include/gnunet_helper_lib.h
@@ -173,7 +173,7 @@ struct GNUNET_HELPER_SendHandle;
173struct GNUNET_HELPER_SendHandle * 173struct GNUNET_HELPER_SendHandle *
174GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, 174GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
175 const struct GNUNET_MessageHeader *msg, 175 const struct GNUNET_MessageHeader *msg,
176 int can_drop, 176 bool can_drop,
177 GNUNET_HELPER_Continuation cont, 177 GNUNET_HELPER_Continuation cont,
178 void *cont_cls); 178 void *cont_cls);
179 179
diff --git a/src/include/gnunet_json_lib.h b/src/include/gnunet_json_lib.h
index 203976b5c..2059e127f 100644
--- a/src/include/gnunet_json_lib.h
+++ b/src/include/gnunet_json_lib.h
@@ -430,6 +430,39 @@ GNUNET_JSON_spec_rsa_signature (const char *name,
430 struct GNUNET_CRYPTO_RsaSignature **sig); 430 struct GNUNET_CRYPTO_RsaSignature **sig);
431 431
432 432
433/**
434 * Specification for parsing a blinded message.
435 *
436 * @param name name of the JSON field
437 * @param sig where to store the blinded message found under @a name
438 */
439struct GNUNET_JSON_Specification
440GNUNET_JSON_spec_blinded_message (const char *name,
441 struct GNUNET_CRYPTO_BlindedMessage **msg);
442
443
444/**
445 * Specification for parsing a blinded signature.
446 *
447 * @param name name of the JSON field
448 * @param sig where to store the blinded signature found under @a name
449 */
450struct GNUNET_JSON_Specification
451GNUNET_JSON_spec_blinded_signature (const char *field,
452 struct GNUNET_CRYPTO_BlindedSignature **b_sig);
453
454
455/**
456 * Specification for parsing a unblinded signature.
457 *
458 * @param name name of the JSON field
459 * @param sig where to store the unblinded signature found under @a name
460 */
461struct GNUNET_JSON_Specification
462GNUNET_JSON_spec_unblinded_signature (const char *field,
463 struct GNUNET_CRYPTO_UnblindedSignature **ub_sig);
464
465
433/* ****************** Generic generator interface ******************* */ 466/* ****************** Generic generator interface ******************* */
434 467
435 468
@@ -966,6 +999,44 @@ GNUNET_JSON_pack_rsa_signature (const char *name,
966 const struct GNUNET_CRYPTO_RsaSignature *sig); 999 const struct GNUNET_CRYPTO_RsaSignature *sig);
967 1000
968 1001
1002/**
1003 * Generate packer instruction for a JSON field of type
1004 * unblinded signature.
1005 *
1006 * @param name name of the field to add to the object
1007 * @param sig unblinded signature
1008 * @return json pack specification
1009 */
1010struct GNUNET_JSON_PackSpec
1011GNUNET_JSON_pack_unblinded_signature (const char *name,
1012 const struct GNUNET_CRYPTO_UnblindedSignature *sig);
1013
1014
1015/**
1016 * Generate packer instruction for a JSON field of type
1017 * blinded message.
1018 *
1019 * @param name name of the field to add to the object
1020 * @param msg blinded message
1021 * @return json pack specification
1022 */
1023struct GNUNET_JSON_PackSpec
1024GNUNET_JSON_pack_blinded_message (const char *name,
1025 const struct GNUNET_CRYPTO_BlindedMessage *msg);
1026
1027
1028/**
1029 * Generate packer instruction for a JSON field of type
1030 * blinded signature.
1031 *
1032 * @param name name of the field to add to the object
1033 * @param sig blinded signature
1034 * @return json pack specification
1035 */
1036struct GNUNET_JSON_PackSpec
1037GNUNET_JSON_pack_blinded_sig (const char *name,
1038 const struct GNUNET_CRYPTO_BlindedSignature *sig);
1039
969#endif 1040#endif
970 1041
971/* end of gnunet_json_lib.h */ 1042/* end of gnunet_json_lib.h */
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h
index 1bc68b87b..3f039f944 100644
--- a/src/include/gnunet_messenger_service.h
+++ b/src/include/gnunet_messenger_service.h
@@ -39,21 +39,14 @@ extern "C" {
39#endif 39#endif
40#endif 40#endif
41 41
42#include "gnunet_common.h"
43#include "gnunet_configuration_lib.h"
44#include "gnunet_identity_service.h"
45#include "gnunet_reclaim_lib.h"
46#include "gnunet_reclaim_service.h"
47#include "gnunet_scheduler_lib.h"
48#include "gnunet_time_lib.h"
49#include "gnunet_util_lib.h" 42#include "gnunet_util_lib.h"
50 43
51/** 44/**
52 * Version number of GNUnet Messenger API. 45 * Version number of GNUnet Messenger API.
53 * 46 *
54 * Current version of the Messenger: 0.3 47 * Current version of the Messenger: 0.4
55 */ 48 */
56#define GNUNET_MESSENGER_VERSION 0x00000003 49#define GNUNET_MESSENGER_VERSION 0x00000004
57 50
58/** 51/**
59 * Identifier of GNUnet MESSENGER Service. 52 * Identifier of GNUnet MESSENGER Service.
@@ -91,7 +84,7 @@ struct GNUNET_MESSENGER_RoomEntryRecord
91 /** 84 /**
92 * The hash identifying the port of the room. 85 * The hash identifying the port of the room.
93 */ 86 */
94 struct GNUNET_HashCode key; 87 struct GNUNET_HashCode key GNUNET_PACKED;
95}; 88};
96 89
97GNUNET_NETWORK_STRUCT_END 90GNUNET_NETWORK_STRUCT_END
@@ -536,14 +529,14 @@ struct GNUNET_MESSENGER_MessageConnection
536 * A ticket message body 529 * A ticket message body
537 * This allows to exchange ticket identifiers with an audience. 530 * This allows to exchange ticket identifiers with an audience.
538 * 531 *
539 * Message-body-size: 32 bytes 532 * Message-body-size: 0+ bytes
540 */ 533 */
541struct GNUNET_MESSENGER_MessageTicket 534struct GNUNET_MESSENGER_MessageTicket
542{ 535{
543 /** 536 /**
544 * The identifier of a RECLAIM ticket. 537 * The identifier of a ticket.
545 */ 538 */
546 struct GNUNET_RECLAIM_Identifier identifier; 539 char *identifier;
547}; 540};
548 541
549/** 542/**
@@ -1010,22 +1003,6 @@ GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room,
1010 GNUNET_MESSENGER_MemberCallback callback, 1003 GNUNET_MESSENGER_MemberCallback callback,
1011 void *cls); 1004 void *cls);
1012 1005
1013/**
1014 * Send a <i>ticket</i> into a <i>room</i>. The ticket will automatically be converted
1015 * into a message to be sent only to its audience as a private message.
1016 *
1017 * A ticket can only be sent with this function if its issuer's public key is the one
1018 * being used by the messenger. The audience's public key is not allowed to be the
1019 * anonymous public key. The room needs to contain a member using the audience's public
1020 * key.
1021 *
1022 * @param[in,out] room Room handle
1023 * @param[in] ticket Ticket to send
1024 */
1025void
1026GNUNET_MESSENGER_send_ticket (struct GNUNET_MESSENGER_Room *room,
1027 const struct GNUNET_RECLAIM_Ticket *ticket);
1028
1029#if 0 /* keep Emacsens' auto-indent happy */ 1006#if 0 /* keep Emacsens' auto-indent happy */
1030{ 1007{
1031#endif 1008#endif
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h
index 3eca71f0f..b40693cdb 100644
--- a/src/include/gnunet_mq_lib.h
+++ b/src/include/gnunet_mq_lib.h
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21#include "gnunet_common.h" 21#include "gnunet_common.h"
22#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__) 22#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__)
23#error "Only <gnunet_util_lib.h> can be included directly." 23#error "Only <gnunet_util_lib.h> can be included directly."
24#endif 24#endif
25 25
@@ -61,9 +61,9 @@
61 * @return the MQ message 61 * @return the MQ message
62 */ 62 */
63#define GNUNET_MQ_msg_extra(mvar, esize, type) \ 63#define GNUNET_MQ_msg_extra(mvar, esize, type) \
64 GNUNET_MQ_msg_ (((struct GNUNET_MessageHeader **) &(mvar)), \ 64 GNUNET_MQ_msg_ (((struct GNUNET_MessageHeader **) &(mvar)), \
65 (esize) + sizeof *(mvar), \ 65 (esize) + sizeof *(mvar), \
66 (type)) 66 (type))
67 67
68/** 68/**
69 * Allocate a GNUNET_MQ_Envelope. 69 * Allocate a GNUNET_MQ_Envelope.
@@ -85,7 +85,7 @@
85 * @param type type of the message 85 * @param type type of the message
86 */ 86 */
87#define GNUNET_MQ_msg_header(type) \ 87#define GNUNET_MQ_msg_header(type) \
88 GNUNET_MQ_msg_ (NULL, sizeof(struct GNUNET_MessageHeader), type) 88 GNUNET_MQ_msg_ (NULL, sizeof(struct GNUNET_MessageHeader), type)
89 89
90 90
91/** 91/**
@@ -97,7 +97,8 @@
97 * @param type type of the message 97 * @param type type of the message
98 */ 98 */
99#define GNUNET_MQ_msg_header_extra(mh, esize, type) \ 99#define GNUNET_MQ_msg_header_extra(mh, esize, type) \
100 GNUNET_MQ_msg_ (&mh, (esize) + sizeof(struct GNUNET_MessageHeader), type) 100 GNUNET_MQ_msg_ (&mh, (esize) + sizeof(struct GNUNET_MessageHeader), type \
101 )
101 102
102 103
103/** 104/**
@@ -111,7 +112,7 @@
111 * @return a newly allocated 'struct GNUNET_MQ_Envelope *' 112 * @return a newly allocated 'struct GNUNET_MQ_Envelope *'
112 */ 113 */
113#define GNUNET_MQ_msg_nested_mh(mvar, type, mh) \ 114#define GNUNET_MQ_msg_nested_mh(mvar, type, mh) \
114 ({ \ 115 ({ \
115 struct GNUNET_MQ_Envelope *_ev; \ 116 struct GNUNET_MQ_Envelope *_ev; \
116 _ev = GNUNET_MQ_msg_nested_mh_ ((struct GNUNET_MessageHeader **) &(mvar), \ 117 _ev = GNUNET_MQ_msg_nested_mh_ ((struct GNUNET_MessageHeader **) &(mvar), \
117 sizeof(*(mvar)), \ 118 sizeof(*(mvar)), \
@@ -131,8 +132,8 @@
131 * or NULL if the given message in @a var does not have any space after the message struct 132 * or NULL if the given message in @a var does not have any space after the message struct
132 */ 133 */
133#define GNUNET_MQ_extract_nested_mh(var) \ 134#define GNUNET_MQ_extract_nested_mh(var) \
134 GNUNET_MQ_extract_nested_mh_ ((struct GNUNET_MessageHeader *) (var), \ 135 GNUNET_MQ_extract_nested_mh_ ((struct GNUNET_MessageHeader *) (var), \
135 sizeof(*(var))) 136 sizeof(*(var)))
136 137
137 138
138/** 139/**
@@ -330,7 +331,7 @@ typedef void
330 * @return #GNUNET_OK if the message is well-formed, 331 * @return #GNUNET_OK if the message is well-formed,
331 * #GNUNET_SYSERR if not 332 * #GNUNET_SYSERR if not
332 */ 333 */
333typedef int 334typedef enum GNUNET_GenericReturnValue
334(*GNUNET_MQ_MessageValidationCallback) ( 335(*GNUNET_MQ_MessageValidationCallback) (
335 void *cls, 336 void *cls,
336 const struct GNUNET_MessageHeader *msg); 337 const struct GNUNET_MessageHeader *msg);
@@ -530,9 +531,9 @@ struct GNUNET_MQ_MessageHandler
530 * End-marker for the handlers array 531 * End-marker for the handlers array
531 */ 532 */
532#define GNUNET_MQ_handler_end() \ 533#define GNUNET_MQ_handler_end() \
533 { \ 534 { \
534 NULL, NULL, NULL, 0, 0 \ 535 NULL, NULL, NULL, 0, 0 \
535 } 536 }
536 537
537 538
538/** 539/**
@@ -564,7 +565,7 @@ struct GNUNET_MQ_MessageHandler
564 * @param ctx context for the callbacks 565 * @param ctx context for the callbacks
565 */ 566 */
566#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx) \ 567#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx) \
567 ({ \ 568 ({ \
568 void (*_cb)(void *cls, const str *msg) = &handle_ ## name; \ 569 void (*_cb)(void *cls, const str *msg) = &handle_ ## name; \
569 ((struct GNUNET_MQ_MessageHandler){ NULL, \ 570 ((struct GNUNET_MQ_MessageHandler){ NULL, \
570 (GNUNET_MQ_MessageCallback) _cb, \ 571 (GNUNET_MQ_MessageCallback) _cb, \
@@ -616,7 +617,7 @@ struct GNUNET_MQ_MessageHandler
616 * @param ctx context for the callbacks 617 * @param ctx context for the callbacks
617 */ 618 */
618#define GNUNET_MQ_hd_var_size(name, code, str, ctx) \ 619#define GNUNET_MQ_hd_var_size(name, code, str, ctx) \
619 __extension__ ({ \ 620 __extension__ ({ \
620 int (*_mv)(void *cls, const str *msg) = &check_ ## name; \ 621 int (*_mv)(void *cls, const str *msg) = &check_ ## name; \
621 void (*_cb)(void *cls, const str *msg) = &handle_ ## name; \ 622 void (*_cb)(void *cls, const str *msg) = &handle_ ## name; \
622 ((struct GNUNET_MQ_MessageHandler){ (GNUNET_MQ_MessageValidationCallback) \ 623 ((struct GNUNET_MQ_MessageHandler){ (GNUNET_MQ_MessageValidationCallback) \
@@ -639,17 +640,17 @@ struct GNUNET_MQ_MessageHandler
639 * the size, starting with a `struct GNUNET_MessageHeader` 640 * the size, starting with a `struct GNUNET_MessageHeader`
640 */ 641 */
641#define GNUNET_MQ_check_zero_termination(m) \ 642#define GNUNET_MQ_check_zero_termination(m) \
642 { \ 643 { \
643 const char *str = (const char *) &m[1]; \ 644 const char *str = (const char *) &m[1]; \
644 const struct GNUNET_MessageHeader *hdr = \ 645 const struct GNUNET_MessageHeader *hdr = \
645 (const struct GNUNET_MessageHeader *) m; \ 646 (const struct GNUNET_MessageHeader *) m; \
646 uint16_t slen = ntohs (hdr->size) - sizeof(*m); \ 647 uint16_t slen = ntohs (hdr->size) - sizeof(*m); \
647 if ((0 == slen) || (memchr (str, 0, slen) != &str[slen - 1])) \ 648 if ((0 == slen) || (memchr (str, 0, slen) != &str[slen - 1])) \
648 { \ 649 { \
649 GNUNET_break (0); \ 650 GNUNET_break (0); \
650 return GNUNET_NO; \ 651 return GNUNET_NO; \
651 } \ 652 } \
652 } 653 }
653 654
654 655
655/** 656/**
@@ -665,19 +666,19 @@ struct GNUNET_MQ_MessageHandler
665 * the size, starting with a `struct GNUNET_MessageHeader` 666 * the size, starting with a `struct GNUNET_MessageHeader`
666 */ 667 */
667#define GNUNET_MQ_check_boxed_message(m) \ 668#define GNUNET_MQ_check_boxed_message(m) \
668 { \ 669 { \
669 const struct GNUNET_MessageHeader *inbox = \ 670 const struct GNUNET_MessageHeader *inbox = \
670 (const struct GNUNET_MessageHeader *) &m[1]; \ 671 (const struct GNUNET_MessageHeader *) &m[1]; \
671 const struct GNUNET_MessageHeader *hdr = \ 672 const struct GNUNET_MessageHeader *hdr = \
672 (const struct GNUNET_MessageHeader *) m; \ 673 (const struct GNUNET_MessageHeader *) m; \
673 uint16_t slen = ntohs (hdr->size) - sizeof(*m); \ 674 uint16_t slen = ntohs (hdr->size) - sizeof(*m); \
674 if ((slen < sizeof(struct GNUNET_MessageHeader)) || \ 675 if ((slen < sizeof(struct GNUNET_MessageHeader)) || \
675 (slen != ntohs (inbox->size))) \ 676 (slen != ntohs (inbox->size))) \
676 { \ 677 { \
677 GNUNET_break (0); \ 678 GNUNET_break (0); \
678 return GNUNET_NO; \ 679 return GNUNET_NO; \
679 } \ 680 } \
680 } 681 }
681 682
682 683
683/** 684/**
diff --git a/src/include/gnunet_nat_service.h b/src/include/gnunet_nat_service.h
index f2854a0be..ba9f252a0 100644
--- a/src/include/gnunet_nat_service.h
+++ b/src/include/gnunet_nat_service.h
@@ -345,6 +345,19 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
345 345
346 346
347/** 347/**
348 * Add global address to the list of addresses and notify clients.
349 *
350 * @param nh the handle returned by register
351 * @param addr IP address to add.
352 * @param address_length number of bytes in @a addr
353 */
354void
355GNUNET_NAT_add_global_address (struct GNUNET_NAT_Handle *nh,
356 char *addr,
357 unsigned int address_length);
358
359
360/**
348 * Test if the given address is (currently) a plausible IP address for 361 * Test if the given address is (currently) a plausible IP address for
349 * this peer. Mostly a convenience function so that clients do not 362 * this peer. Mostly a convenience function so that clients do not
350 * have to explicitly track all IPs that the #GNUNET_NAT_AddressCallback 363 * have to explicitly track all IPs that the #GNUNET_NAT_AddressCallback
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h
index 3d9c12cb2..7501bee12 100644
--- a/src/include/gnunet_pq_lib.h
+++ b/src/include/gnunet_pq_lib.h
@@ -577,7 +577,7 @@ GNUNET_PQ_query_param_uint32 (const uint32_t *x);
577 577
578 578
579/** 579/**
580 * Generate query parameter for an uint16_t in host byte order. 580 * Generate query parameter for an uint64_t in host byte order.
581 * 581 *
582 * @param x pointer to the query parameter to pass 582 * @param x pointer to the query parameter to pass
583 * @return query parameter to use 583 * @return query parameter to use
@@ -586,6 +586,37 @@ struct GNUNET_PQ_QueryParam
586GNUNET_PQ_query_param_uint64 (const uint64_t *x); 586GNUNET_PQ_query_param_uint64 (const uint64_t *x);
587 587
588 588
589/**
590 * Generate query parameter for an int64_t in host byte order.
591 *
592 * @param x pointer to the query parameter to pass
593 * @return query parameter to use
594 */
595struct GNUNET_PQ_QueryParam
596GNUNET_PQ_query_param_int64 (const int64_t *x);
597
598/**
599 * Generate query parameter for a blind sign public key.
600 * Internally, the various attributes of the public key
601 * will be serialized into on variable-size BLOB.
602 *
603 * @param pub pointer to the query parameter to pass
604 *
605 */
606struct GNUNET_PQ_QueryParam
607GNUNET_PQ_query_param_blind_sign_pub (
608 const struct GNUNET_CRYPTO_BlindSignPublicKey *pub);
609
610/**
611 * Generate query parameter for a blind sign private key of variable size.
612 *
613 * @param priv pointer to the query parameter to pass
614 *
615 */
616struct GNUNET_PQ_QueryParam
617GNUNET_PQ_query_param_blind_sign_priv (
618 const struct GNUNET_CRYPTO_BlindSignPrivateKey *priv);
619
589/* ************************* pq_result_helper.c functions ************************ */ 620/* ************************* pq_result_helper.c functions ************************ */
590 621
591 622
@@ -895,6 +926,19 @@ struct GNUNET_PQ_ResultSpec
895GNUNET_PQ_result_spec_uint64 (const char *name, 926GNUNET_PQ_result_spec_uint64 (const char *name,
896 uint64_t *u64); 927 uint64_t *u64);
897 928
929
930/**
931 * int64_t expected.
932 *
933 * @param name name of the field in the table
934 * @param[out] i64 where to store the result
935 * @return array entry for the result specification to use
936 */
937struct GNUNET_PQ_ResultSpec
938GNUNET_PQ_result_spec_int64 (const char *name,
939 int64_t *i64);
940
941
898/** 942/**
899 * array of bool expected. 943 * array of bool expected.
900 * 944 *
@@ -1081,6 +1125,32 @@ GNUNET_PQ_result_spec_array_string (
1081 size_t *num, 1125 size_t *num,
1082 char **dst); 1126 char **dst);
1083 1127
1128
1129/**
1130 * Blind sign public key expected.
1131 *
1132 * @param name name of the field in the table
1133 * @param[out] public_key where to store the denomination signature
1134 * @return array entry for the result specification to use
1135 */
1136struct GNUNET_PQ_ResultSpec
1137GNUNET_PQ_result_spec_blind_sign_pub (
1138 const char *name,
1139 struct GNUNET_CRYPTO_BlindSignPublicKey **public_key);
1140
1141
1142/**
1143 * Blind sign private key expected.
1144 *
1145 * @param name name of the field in the table
1146 * @param[out] private_key where to store the denomination signature
1147 * @return array entry for the result specification to use
1148 */
1149struct GNUNET_PQ_ResultSpec
1150GNUNET_PQ_result_spec_blind_sign_priv (
1151 const char *name,
1152 struct GNUNET_CRYPTO_BlindSignPrivateKey **private_key);
1153
1084/* ************************* pq.c functions ************************ */ 1154/* ************************* pq.c functions ************************ */
1085 1155
1086/** 1156/**
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 8638703db..6ab008d16 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -3216,6 +3216,11 @@ extern "C" {
3216#define GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE 1064 3216#define GNUNET_MESSAGE_TYPE_NAT_ADDRESS_CHANGE 1064
3217 3217
3218/** 3218/**
3219 * Message to ask NAT service to notify all clients about a new global address.
3220 */
3221#define GNUNET_MESSAGE_TYPE_NAT_ADD_GLOBAL_ADDRESS 1065
3222
3223/**
3219 * Message to ask NAT service to request autoconfiguration. 3224 * Message to ask NAT service to request autoconfiguration.
3220 */ 3225 */
3221#define GNUNET_MESSAGE_TYPE_NAT_AUTO_REQUEST_CFG 1067 3226#define GNUNET_MESSAGE_TYPE_NAT_AUTO_REQUEST_CFG 1067
diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h
index a8ab8776e..086c3f021 100644
--- a/src/include/gnunet_reclaim_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -49,7 +49,7 @@ extern "C" {
49/** 49/**
50 * Version number of the re:claimID API. 50 * Version number of the re:claimID API.
51 */ 51 */
52#define GNUNET_RECLAIM_VERSION 0x00000001 52#define GNUNET_RECLAIM_VERSION 0x00000002
53 53
54/** 54/**
55 * Opaque handle to access the service. 55 * Opaque handle to access the service.
@@ -62,6 +62,9 @@ struct GNUNET_RECLAIM_Handle;
62 */ 62 */
63struct GNUNET_RECLAIM_Operation; 63struct GNUNET_RECLAIM_Operation;
64 64
65#define GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN 256
66
67#define GNUNET_RECLAIM_TICKET_RP_URI_URN_PREFIX "urn:gns:"
65 68
66/** 69/**
67 * The authorization ticket. This ticket is meant to be transferred 70 * The authorization ticket. This ticket is meant to be transferred
@@ -72,19 +75,30 @@ struct GNUNET_RECLAIM_Operation;
72struct GNUNET_RECLAIM_Ticket 75struct GNUNET_RECLAIM_Ticket
73{ 76{
74 /** 77 /**
75 * The ticket issuer (= the user) 78 * The ticket. A GNS name ending in the
79 * zTLD for identity.
80 * Base32(rnd).zTLD(identity)
81 * 0-terminated string.
76 */ 82 */
77 struct GNUNET_CRYPTO_PublicKey identity; 83 char gns_name[GNUNET_DNSPARSER_MAX_LABEL_LENGTH * 2 + 2];
78 84
79 /** 85 /**
80 * The ticket audience (= relying party) 86 * The ticket issuer (= the user)
81 */ 87 */
82 struct GNUNET_CRYPTO_PublicKey audience; 88 //struct GNUNET_CRYPTO_PublicKey identity;
83 89
84 /** 90 /**
85 * The ticket random identifier 91 * The ticket random identifier
86 */ 92 */
87 struct GNUNET_RECLAIM_Identifier rnd; 93 //struct GNUNET_RECLAIM_Identifier rnd;
94
95
96 /**
97 * Followed by the ticket audience (= relying party) URI.
98 * 0-terminated string.
99 * Example: "urn:gns:000G002B4RF1XPBXDPGZA0PT16BHQCS427YQK4NC84KZMK7TK8C2Z5GMK8"
100 */
101 //char rp_uri[GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN];
88}; 102};
89 103
90 104
@@ -95,10 +109,12 @@ struct GNUNET_RECLAIM_Ticket
95 * 109 *
96 * @param cls closure 110 * @param cls closure
97 * @param ticket the ticket 111 * @param ticket the ticket
112 * @param rp_uri the RP URI of the ticket
98 */ 113 */
99typedef void (*GNUNET_RECLAIM_TicketCallback) ( 114typedef void (*GNUNET_RECLAIM_TicketCallback) (
100 void *cls, 115 void *cls,
101 const struct GNUNET_RECLAIM_Ticket *ticket); 116 const struct GNUNET_RECLAIM_Ticket *ticket,
117 const char* rp_uri);
102 118
103/** 119/**
104 * Method called when a token has been issued. 120 * Method called when a token has been issued.
@@ -376,7 +392,7 @@ GNUNET_RECLAIM_get_credentials_stop (
376 * 392 *
377 * @param h the identity provider to use 393 * @param h the identity provider to use
378 * @param iss the issuing identity (= the user) 394 * @param iss the issuing identity (= the user)
379 * @param rp the subject of the ticket (= the relying party) 395 * @param rp_uri the subject of the ticket (= the relying party) see #GNUNET_RECLAIM_Ticket
380 * @param attrs the attributes that the relying party is given access to 396 * @param attrs the attributes that the relying party is given access to
381 * @param cb the callback 397 * @param cb the callback
382 * @param cb_cls the callback closure 398 * @param cb_cls the callback closure
@@ -386,7 +402,7 @@ struct GNUNET_RECLAIM_Operation *
386GNUNET_RECLAIM_ticket_issue ( 402GNUNET_RECLAIM_ticket_issue (
387 struct GNUNET_RECLAIM_Handle *h, 403 struct GNUNET_RECLAIM_Handle *h,
388 const struct GNUNET_CRYPTO_PrivateKey *iss, 404 const struct GNUNET_CRYPTO_PrivateKey *iss,
389 const struct GNUNET_CRYPTO_PublicKey *rp, 405 const char *rp_uri,
390 const struct GNUNET_RECLAIM_AttributeList *attrs, 406 const struct GNUNET_RECLAIM_AttributeList *attrs,
391 GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls); 407 GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls);
392 408
@@ -417,9 +433,8 @@ GNUNET_RECLAIM_ticket_revoke (
417 * information from the issuer 433 * information from the issuer
418 * 434 *
419 * @param h the identity provider to use 435 * @param h the identity provider to use
420 * @param identity the identity that is the subject of the issued ticket (the
421 * relying party)
422 * @param ticket the issued ticket to consume 436 * @param ticket the issued ticket to consume
437 * @param rp_uri the RP URI
423 * @param cb the callback to call 438 * @param cb the callback to call
424 * @param cb_cls the callback closure 439 * @param cb_cls the callback closure
425 * @return handle to abort the operation 440 * @return handle to abort the operation
@@ -427,8 +442,8 @@ GNUNET_RECLAIM_ticket_revoke (
427struct GNUNET_RECLAIM_Operation * 442struct GNUNET_RECLAIM_Operation *
428GNUNET_RECLAIM_ticket_consume ( 443GNUNET_RECLAIM_ticket_consume (
429 struct GNUNET_RECLAIM_Handle *h, 444 struct GNUNET_RECLAIM_Handle *h,
430 const struct GNUNET_CRYPTO_PrivateKey *identity,
431 const struct GNUNET_RECLAIM_Ticket *ticket, 445 const struct GNUNET_RECLAIM_Ticket *ticket,
446 const char *rp_uri,
432 GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls); 447 GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls);
433 448
434 449
@@ -499,44 +514,6 @@ GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h);
499void 514void
500GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op); 515GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op);
501 516
502/**
503 * Get serialized ticket size
504 *
505 * @param tkt the ticket
506 * @return the buffer length requirement for a serialization
507 */
508size_t
509GNUNET_RECLAIM_ticket_serialize_get_size (const struct GNUNET_RECLAIM_Ticket *tkt);
510
511/**
512 * Deserializes a ticket
513 *
514 * @param buffer the buffer to read from
515 * @param len the length of the buffer
516 * @param tkt the ticket to write to (must be allocated)
517 * @param kb_read how many bytes were read from buffer
518 * @return GNUNET_SYSERR on error
519 */
520enum GNUNET_GenericReturnValue
521GNUNET_RECLAIM_read_ticket_from_buffer (const void *buffer,
522 size_t len,
523 struct GNUNET_RECLAIM_Ticket *tkt,
524 size_t *tb_read);
525
526/**
527 * Serializes a ticket
528 *
529 * @param tkt the ticket to serialize
530 * @param buffer the buffer to serialize to (must be allocated with sufficient size
531 * @param len the length of the buffer
532 * @return the number of written bytes or < 0 on error
533 */
534ssize_t
535GNUNET_RECLAIM_write_ticket_to_buffer (const struct
536 GNUNET_RECLAIM_Ticket *tkt,
537 void *buffer,
538 size_t len);
539
540#if 0 /* keep Emacsens' auto-indent happy */ 517#if 0 /* keep Emacsens' auto-indent happy */
541{ 518{
542#endif 519#endif
diff --git a/src/include/gnunet_testbed_lib.h b/src/include/gnunet_testbed_lib.h
new file mode 100644
index 000000000..e33f31ee1
--- /dev/null
+++ b/src/include/gnunet_testbed_lib.h
@@ -0,0 +1,130 @@
1#ifndef GNUNET_TESTBED_LIB_H
2#define GNUNET_TESTBED_LIB_H
3
4/**
5 * FIXME.
6 */
7struct GNUNET_TESTBED_System;
8
9#define GNUNET_TESTBED_PREFIX "GNUNET_TESTBED_PREFIX"
10
11/**
12 * Create a system handle. There must only be one system
13 * handle per operating system.
14 *
15 * @param testdir only the directory name without any path. This is used for
16 * all service homes; the directory will be created in a temporary
17 * location depending on the underlying OS. This variable will be
18 * overridden with the value of the environmental variable
19 * GNUNET_TESTBED_PREFIX, if it exists.
20 * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
21 * service configurations generated to allow control connections from
22 * this ip. This can either be a single ip address or a network address
23 * in CIDR notation.
24 * @param hostname the hostname of the system we are using for testing; NULL for
25 * localhost
26 * @param lowport lowest port number this system is allowed to allocate (inclusive)
27 * @param highport highest port number this system is allowed to allocate (exclusive)
28 * @return handle to this system, NULL on error
29 */
30struct GNUNET_TESTBED_System *
31GNUNET_TESTBED_system_create_with_portrange (
32 const char *testdir,
33 const char *trusted_ip,
34 const char *hostname,
35 uint16_t lowport,
36 uint16_t highport);
37
38
39/**
40 * Create a system handle. There must only be one system handle per operating
41 * system. Uses a default range for allowed ports. Ports are still tested for
42 * availability.
43 *
44 * @param testdir only the directory name without any path. This is used for all
45 * service homes; the directory will be created in a temporary location
46 * depending on the underlying OS. This variable will be
47 * overridden with the value of the environmental variable
48 * GNUNET_TESTBED_PREFIX, if it exists.
49 * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
50 * service configurations generated to allow control connections from
51 * this ip. This can either be a single ip address or a network address
52 * in CIDR notation.
53 * @param hostname the hostname of the system we are using for testing; NULL for
54 * localhost
55 * @param shared_services NULL terminated array describing services that are to
56 * be shared among peers
57 * @return handle to this system, NULL on error
58 */
59struct GNUNET_TESTBED_System *
60GNUNET_TESTBED_system_create (
61 const char *testdir,
62 const char *trusted_ip,
63 const char *hostname);
64
65
66/**
67 * Free system resources.
68 *
69 * @param system system to be freed
70 * @param remove_paths should the 'testdir' and all subdirectories
71 * be removed (clean up on shutdown)?
72 */
73void
74GNUNET_TESTBED_system_destroy (
75 struct GNUNET_TESTBED_System *system,
76 bool remove_paths);
77
78
79/**
80 * Reserve a TCP or UDP port for a peer.
81 *
82 * @param system system to use for reservation tracking
83 * @return 0 if no free port was available
84 */
85uint16_t
86GNUNET_TESTBED_reserve_port (
87 struct GNUNET_TESTBED_System *system);
88
89
90/**
91 * Release reservation of a TCP or UDP port for a peer
92 * (used during #GNUNET_TESTBED_peer_destroy()).
93 *
94 * @param system system to use for reservation tracking
95 * @param port reserved port to release
96 */
97void
98GNUNET_TESTBED_release_port (
99 struct GNUNET_TESTBED_System *system,
100 uint16_t port);
101
102
103/**
104 * Create a new configuration using the given configuration as a template;
105 * ports and paths will be modified to select available ports on the local
106 * system. The default configuration will be available in PATHS section under
107 * the option DEFAULTCONFIG after the call. GNUNET_HOME is also set in PATHS
108 * section to the temporary directory specific to this configuration. If we run
109 * out of "*port" numbers, return #GNUNET_SYSERR.
110 *
111 * This is primarily a helper function used internally
112 * by 'GNUNET_TESTBED_peer_configure'.
113 *
114 * @param system system to use to coordinate resource usage
115 * @param cfg template configuration to update
116 * @param ports array with port numbers used in the created configuration.
117 * Will be updated upon successful return. Can be NULL
118 * @param nports the size of the `ports' array. Will be updated.
119 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error - the configuration will
120 * be incomplete and should not be used there upon
121 */
122enum GNUNET_GenericReturnValue
123GNUNET_TESTBED_configuration_create (
124 struct GNUNET_TESTBED_System *system,
125 struct GNUNET_CONFIGURATION_Handle *cfg,
126 uint16_t **ports,
127 unsigned int *nports);
128
129
130#endif
diff --git a/src/include/gnunet_testing_arm_lib.h b/src/include/gnunet_testing_arm_lib.h
new file mode 100644
index 000000000..66852b506
--- /dev/null
+++ b/src/include/gnunet_testing_arm_lib.h
@@ -0,0 +1,47 @@
1#ifndef GNUNET_TESTING_ARM_LIB_H
2#define GNUNET_TESTING_ARM_LIB_H
3
4#include "gnunet_arm_service.h"
5
6/**
7 * Create command.
8 *
9 * @param label name for command.
10 * @param system_label Label of the cmd to setup a test environment.
11 * @param cfgname Configuration file name for this peer.
12 * @return command.
13 */
14struct GNUNET_TESTING_Command
15GNUNET_TESTING_ARM_cmd_start_peer (
16 const char *label,
17 const char *system_label,
18 const char *cfgname);
19
20
21/**
22 * Create command.
23 *
24 * @param label name for command.
25 * @param start_label Label of the cmd to start the peer.
26 * @return command.
27 */
28struct GNUNET_TESTING_Command
29GNUNET_TESTING_cmd_stop_peer (
30 const char *label,
31 const char *start_label);
32
33
34/**
35 * Call #op on all simple traits.
36 */
37#define GNUNET_TESTING_ARM_SIMPLE_TRAITS(op, prefix) \
38 op (prefix, \
39 arm_handle, \
40 struct GNUNET_ARM_Handle)
41
42
43GNUNET_TESTING_ARM_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
44 GNUNET_TESTING_ARM)
45
46
47#endif
diff --git a/src/include/gnunet_testing_barrier.h b/src/include/gnunet_testing_barrier.h
deleted file mode 100644
index b0f4e1c03..000000000
--- a/src/include/gnunet_testing_barrier.h
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file include/gnunet_testing_barrier.h
23 * @brief API to manage barriers.
24 * @author t3sserakt
25 */
26
27#ifndef GNUNET_TESTING_BARRIER_LIB_H
28#define GNUNET_TESTING_BARRIER_LIB_H
29
30#include "gnunet_testing_plugin.h"
31
32
33struct GNUNET_TESTING_Barrier;
34
35
36#define GNUNET_TESTING_BARRIER_MAX 32
37
38/**
39 * An entry for a barrier list
40 * FIXME: why is this in the public API!??!
41 */
42struct GNUNET_TESTING_BarrierListEntry
43{
44 /* DLL */
45 struct GNUNET_TESTING_BarrierListEntry *next;
46
47 /* DLL */
48 struct GNUNET_TESTING_BarrierListEntry *prev;
49
50 /* The barrier name*/
51 char *barrier_name;
52
53 /**
54 * Number of commands attached to the barrier.
55 */
56 unsigned int expected_reaches;
57 };
58
59/**
60 * A list to hold barriers provided by plugins
61 * FIXME: why is this in the public API!??!
62 */
63struct GNUNET_TESTING_BarrierList
64{
65 /** List head **/
66 struct GNUNET_TESTING_BarrierListEntry *head;
67
68 /** List tail **/
69 struct GNUNET_TESTING_BarrierListEntry *tail;
70};
71
72
73/**
74 * Command to create a barrier.
75 *
76 * FIXME: high-level it is baffling how we need both the GNUNET_TESTING_Barrier
77 * and the Command that creates barriers. Conceptually this seems to be
78 * very much separate. Can we move _Barrier completely into testing as private?
79 *
80 * @param label The label of this command.
81 * @param percentage_to_be_reached If this percentage of processes reached
82 * this barrier, all processes waiting at
83 * this barrier can pass it. Must not be
84 * used together with number_to_be_reached.
85 * @param number_to_be_reached If this number of processes reached
86 * this barrier, all processes waiting at
87 * this barrier can pass it. Must not be
88 * used together with percentage_to_be_reached.
89 */
90struct GNUNET_TESTING_Command
91GNUNET_TESTING_cmd_barrier_create (
92 const char *label,
93 double percentage_to_be_reached,
94 unsigned int number_to_be_reached);
95
96
97/**
98 * If this command is executed the the process is signaling the master process
99 * that it reached a barrier. If this command is synchronous it will block.
100 *
101 * FIXME: Now this, as it returns a Command, seems to me like it should be
102 * part of the public API?
103 *
104 * @param label name for command.
105 * @param barrier_label The name of the barrier we waited for and which was reached.
106 * @param asynchronous_finish If #GNUNET_YES this command will not block.
107 * @param node_number The global number of the node the cmd runs on.
108 * @param running_on_master Is this cmd running on the master loop?
109 * @param write_message Callback to write messages to the master loop.
110 * @return command.
111 */
112struct GNUNET_TESTING_Command
113GNUNET_TESTING_cmd_barrier_reached (
114 const char *label,
115 const char *barrier_label,
116 unsigned int asynchronous_finish, /* FIXME: why not a bool? */
117 unsigned int node_number,
118 unsigned int running_on_master, /* FIXME: why not a bool? */
119 GNUNET_TESTING_cmd_helper_write_cb write_message); /* FIXME: no 'cls' closure argument!? */
120
121#endif
122/* end of testing_barrier.h */
diff --git a/src/include/gnunet_core_testing_lib.h b/src/include/gnunet_testing_core_lib.h
index bf6f416d9..cf96b395d 100644
--- a/src/include/gnunet_core_testing_lib.h
+++ b/src/include/gnunet_testing_core_lib.h
@@ -22,12 +22,12 @@
22 * @brief API for cmds working with core sub system provided by libgnunetcoretesting 22 * @brief API for cmds working with core sub system provided by libgnunetcoretesting
23 * @author t3sserakt 23 * @author t3sserakt
24 */ 24 */
25#ifndef GNUNET_CORE_TESTING_LIB_H 25#ifndef GNUNET_TESTING_CORE_LIB_H
26#define GNUNET_CORE_TESTING_LIB_H 26#define GNUNET_TESTING_CORE_LIB_H
27 27
28 28
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_testing_ng_lib.h" 30#include "gnunet_testing_lib.h"
31 31
32 32
33/** 33/**
@@ -149,10 +149,11 @@ GNUNET_CORE_cmd_connect_peers (
149 * Call #op on all simple traits. 149 * Call #op on all simple traits.
150 */ 150 */
151#define GNUNET_CORE_TESTING_SIMPLE_TRAITS(op, prefix) \ 151#define GNUNET_CORE_TESTING_SIMPLE_TRAITS(op, prefix) \
152 op (prefix, connect_peer_state, const struct GNUNET_TESTING_ConnectPeersState) 152 op (prefix, connect_peer_state, const struct \
153 153 GNUNET_TESTING_ConnectPeersState)
154GNUNET_CORE_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_CORE_TESTING)
155 154
155GNUNET_CORE_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
156 GNUNET_CORE_TESTING)
156 157
157 158
158#endif 159#endif
diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h
index 0d74de8c2..0ee3a68b8 100644
--- a/src/include/gnunet_testing_lib.h
+++ b/src/include/gnunet_testing_lib.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 GNUnet e.V. 3 Copyright (C) 2021, 2023, 2024 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -19,445 +19,959 @@
19 */ 19 */
20 20
21/** 21/**
22 * @addtogroup Testing 22 * @brief Central interpreter and command loop for writing an interpreter to test asynchronous systems
23 * @{ 23 * @author Christian Grothoff <christian@grothoff.org>
24 * 24 * @author Marcello Stanisci
25 * @author Christian Grothoff 25 * @author t3sserakt
26 * 26 */
27 * @file 27#ifndef GNUNET_TESTING_LIB_H
28 * Convenience API for writing testcases for GNUnet 28#define GNUNET_TESTING_LIB_H
29
30#include "gnunet_util_lib.h"
31
32/**
33 * Maximum length of label in command
34 */
35#define GNUNET_TESTING_CMD_MAX_LABEL_LENGTH 127
36
37/* ********************* Helper functions ********************* */
38
39/**
40 * Print failing line number and trigger shutdown. Useful
41 * quite any time after the command "run" method has been called.
42 * Returns from the current function.
43 */
44#define GNUNET_TESTING_FAIL(is) \
45 do { \
46 GNUNET_break (0); \
47 GNUNET_TESTING_interpreter_fail (is); \
48 return; \
49 } while (0)
50
51
52/**
53 * Log an error message about a command not having run to completion.
29 * 54 *
30 * @defgroup testing Testing library 55 * @param is interpreter
31 * Library for writing testcases for GNUnet. 56 * @param label command label of the incomplete command
57 */
58#define GNUNET_TESTING_command_incomplete(is,label) \
59 do { \
60 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, \
61 "Command %s (%s:%u) did not complete (at %s)\n", \
62 label, \
63 __FILE__, \
64 __LINE__, \
65 GNUNET_TESTING_interpreter_current_cmd_get_label (is)); \
66 } while (0)
67
68
69/* ******************* Generic interpreter logic ************ */
70
71/**
72 * Global state of the interpreter, used by a command
73 * to access information about other commands.
74 */
75struct GNUNET_TESTING_Interpreter;
76
77/**
78 * State each asynchronous command must have in its closure.
79 */
80struct GNUNET_TESTING_AsyncContext
81{
82
83 /**
84 * Interpreter we are part of. Initialized when
85 * the global interpreter starts.
86 */
87 struct GNUNET_TESTING_Interpreter *is;
88
89 /**
90 * Function to call when async operation is done.
91 */
92 GNUNET_SCHEDULER_TaskCallback notify_finished;
93
94 /**
95 * Closure for @e notify_finished.
96 */
97 void *notify_finished_cls;
98
99 /**
100 * Indication if the command finished (#GNUNET_OK).
101 * #GNUNET_NO if it did not finish,
102 * #GNUNET_SYSERR if it failed.
103 */
104 enum GNUNET_GenericReturnValue finished;
105
106 /**
107 * Set to true if interpreter_next() has already been
108 * called for this command.
109 */
110 bool next_called;
111};
112
113
114/**
115 * The asynchronous command of @a ac has failed.
32 * 116 *
33 * It can start/stop one or more peers on a system; testing is responsible for 117 * @param ac command-specific context
34 * managing private keys, ports and paths; it is a low-level library that does 118 */
35 * not support higher-level functions such as P2P connection, topology 119void
36 * management or distributed testbed maintenance (those are provided by the 120GNUNET_TESTING_async_fail (
37 * [Testbed service](@ref testbed)) 121 struct GNUNET_TESTING_AsyncContext *ac);
122
123
124/**
125 * The asynchronous command of @a ac has finished.
38 * 126 *
39 * @see [Documentation](https://gnunet.org/writing_testcases) 127 * @param ac command-specific context
128 */
129void
130GNUNET_TESTING_async_finish (
131 struct GNUNET_TESTING_AsyncContext *ac);
132
133
134/**
135 * Signature of a function used to start executing a command of a test. Runs
136 * the command. Note that upon return, the interpreter will not automatically
137 * run the next command if this is an asynchronous command unless the command
138 * was wrapped in #GNUNET_TESTING_cmd_make_unblocking(), as the command may
139 * then continue asynchronously in other scheduler tasks. In this case,
140 * #GNUNET_TESTING_async_finish() must be called to run the next task.
40 * 141 *
41 * @{ 142 * @param cls closure
143 * @param is interpreter running the command
42 */ 144 */
145typedef void
146(*GNUNET_TESTING_CommandRunRoutine)(
147 void *cls,
148 struct GNUNET_TESTING_Interpreter *is);
43 149
44#ifndef GNUNET_TESTING_LIB_H
45#define GNUNET_TESTING_LIB_H
46 150
151/**
152 * Signature of a function used to clean up resources allocated
153 * by a command.
154 *
155 * @param cls closure
156 */
157typedef void
158(*GNUNET_TESTING_CommandCleanupRoutine)(void *cls);
47 159
48#include "gnunet_util_lib.h"
49#include "gnunet_statistics_service.h"
50#include "gnunet_arm_service.h"
51 160
52#ifdef __cplusplus 161/**
53extern "C" 162 * Signature of a function used to extract traits exposed by a
54{ 163 * command.
55#if 0 /* keep Emacsens' auto-indent happy */ 164 *
56} 165 * @param cls closure
57#endif 166 * @param[out] ret where to return the trait data
58#endif 167 * @param trait name of the trait to return
168 * @param index index of the trait (for traits that are indexed)
169 * @return #GNUNET_OK on success
170 */
171typedef enum GNUNET_GenericReturnValue
172(*GNUNET_TESTING_CommandGetTraits) (void *cls,
173 const void **ret,
174 const char *trait,
175 unsigned int index);
59 176
60/** 177/**
61 * Size of each hostkey in the hostkey file (in BYTES). 178 * Create a new command that may be asynchronous.
179 *
180 * @param cls the closure
181 * @param label the Label. Maximum length is #GNUNET_TESTING_CMD_MAX_LABEL_LENGTH
182 * @param run the run routing
183 * @param cleanup the cleanup function
184 * @param traits the traits function (optional)
185 * @param ac the async context, NULL if command is always
186 * synchronous
187 * @return the command the function cannot fail
62 */ 188 */
63#define GNUNET_TESTING_HOSTKEYFILESIZE sizeof(struct \ 189struct GNUNET_TESTING_Command
64 GNUNET_CRYPTO_EddsaPrivateKey) 190GNUNET_TESTING_command_new_ac (
191 void *cls,
192 const char *label,
193 GNUNET_TESTING_CommandRunRoutine run,
194 GNUNET_TESTING_CommandCleanupRoutine cleanup,
195 GNUNET_TESTING_CommandGetTraits traits,
196 struct GNUNET_TESTING_AsyncContext *ac);
197
65 198
66/** 199/**
67 * The environmental variable, if set, that dictates where testing should place 200 * Create a new command
68 * generated peer configurations 201 *
202 * @param cls the closure
203 * @param label the Label. Maximum length is #GNUNET_TESTING_CMD_MAX_LABEL_LENGTH
204 * @param run the run routing
205 * @param cleanup the cleanup function
206 * @param traits the traits function (optional)
207 * @return the command the function cannot fail
69 */ 208 */
70#define GNUNET_TESTING_PREFIX "GNUNET_TESTING_PREFIX" 209#define GNUNET_TESTING_command_new(cls,label,run,cleanup,traits) \
210 GNUNET_TESTING_command_new_ac (cls,label,run,cleanup,traits,NULL)
71 211
72 212
73/** 213/**
74 * Handle for a system on which GNUnet peers are executed; 214 * Structure with storage space for a label.
75 * a system is used for reserving unique paths and ports.
76 */ 215 */
77struct GNUNET_TESTING_System; 216struct GNUNET_TESTING_CommandLabel
217{
218 char value[GNUNET_TESTING_CMD_MAX_LABEL_LENGTH + 1];
219};
78 220
79 221
80/** 222/**
81 * Handle for a GNUnet peer controlled by testing. 223 * Set @a label to @a value. Asserts that @a value is
224 * not longer than #GNUNET_TESTING_CMD_MAX_LABEL_LENGTH.
225 *
226 * @param[out] label label to initialize
227 * @param value value to store into @a label
82 */ 228 */
83struct GNUNET_TESTING_Peer; 229void
230GNUNET_TESTING_set_label (
231 struct GNUNET_TESTING_CommandLabel *label,
232 const char *value);
84 233
85 234
86/** 235/**
87 * Specification of a service that is to be shared among peers 236 * A command to be run by the interpreter.
88 */ 237 */
89struct GNUNET_TESTING_SharedService 238struct GNUNET_TESTING_Command
90{ 239{
240
241 /**
242 * Label for the command.
243 */
244 struct GNUNET_TESTING_CommandLabel label;
245
246 /**
247 * Closure for all commands with command-specific context information.
248 */
249 void *cls;
250
251 /**
252 * Variable name for the command, NULL for none.
253 */
254 const char *name;
255
256 /**
257 * Runs the command. Note that upon return, the interpreter
258 * will not automatically run the next command, as the command
259 * may continue asynchronously in other scheduler tasks. Thus,
260 * the command must ensure to eventually call
261 * #GNUNET_TESTING_interpreter_next() or
262 * #GNUNET_TESTING_interpreter_fail().
263 *
264 * If this function creates some asynchronous activity, it should
265 * initialize @e finish to a function that can be used to wait for
266 * the asynchronous activity to terminate.
267 *
268 * @param cls closure
269 * @param is interpreter state
270 */
271 GNUNET_TESTING_CommandRunRoutine run;
272
273 /**
274 * Pointer to the asynchronous context in the command's
275 * closure. Used by the
276 * #GNUNET_TESTING_async_finish() and
277 * #GNUNET_TESTING_async_fail() functions.
278 *
279 * Must be NULL if a command is synchronous.
280 */
281 struct GNUNET_TESTING_AsyncContext *ac;
282
91 /** 283 /**
92 * The name of the service. 284 * Clean up after the command. Run during forced termination
285 * (CTRL-C) or test failure or test success.
286 *
287 * @param cls closure
93 */ 288 */
94 const char *service; 289 GNUNET_TESTING_CommandCleanupRoutine cleanup;
95 290
96 /** 291 /**
97 * The configuration template for the service. Cannot be NULL 292 * Extract information from a command that is useful for other
293 * commands. Can be NULL if a command has no traits.
294 *
295 * @param cls closure
296 * @param[out] ret result (could be anything)
297 * @param trait name of the trait
298 * @param index index number of the object to extract.
299 * @return #GNUNET_OK on success,
300 * #GNUNET_NO if no trait was found
98 */ 301 */
99 const struct GNUNET_CONFIGURATION_Handle *cfg; 302 GNUNET_TESTING_CommandGetTraits traits;
100 303
101 /** 304 /**
102 * The number of peers which share an instance of the service. 0 for sharing 305 * When did the execution of this command start?
103 * among all peers
104 */ 306 */
105 unsigned int share; 307 struct GNUNET_TIME_Absolute start_time;
308
309 /**
310 * When did the execution of this command finish?
311 */
312 struct GNUNET_TIME_Absolute finish_time;
313
314 /**
315 * When did we start the last run of this command? Delta to @e finish_time
316 * gives the latency for the last successful run. Useful in case @e
317 * num_tries was positive and the command was run multiple times. In that
318 * case, the @e start_time gives the time when we first tried to run the
319 * command, so the difference between @e start_time and @e finish_time would
320 * be the time all of the @e num_tries took, while the delta to @e
321 * last_req_time is the time the last (successful) execution took.
322 */
323 struct GNUNET_TIME_Absolute last_req_time;
324
325 /**
326 * How often did we try to execute this command? (In case it is a request
327 * that is repated.) Note that a command must have some built-in retry
328 * mechanism for this value to be useful.
329 */
330 unsigned int num_tries;
331
332 /**
333 * If "true", the interpreter should not immediately run the next command,
334 * even if this command did not complete via #GNUNET_TESTING_async_finish().
335 * Otherwise, #GNUNET_TESTING_cmd_finish() must be used to ensure that a
336 * command actually completed.
337 */
338 bool asynchronous_finish;
339
106}; 340};
107 341
108 342
109/** 343/**
110 * Create a system handle. There must only be one system handle per operating 344 * Lookup command by label.
111 * system. Uses a default range for allowed ports. Ports are still tested for 345 *
112 * availability. 346 * @param is interpreter to lookup command in
113 * 347 * @param label label of the command to lookup.
114 * @param testdir only the directory name without any path. This is used for all 348 * @return the command, if it is found, or NULL.
115 * service homes; the directory will be created in a temporary location 349 */
116 * depending on the underlying OS. This variable will be 350const struct GNUNET_TESTING_Command *
117 * overridden with the value of the environmental variable 351GNUNET_TESTING_interpreter_lookup_command (
118 * GNUNET_TESTING_PREFIX, if it exists. 352 struct GNUNET_TESTING_Interpreter *is,
119 * @param trusted_ip the ip address which will be set as TRUSTED HOST in all 353 const char *label);
120 * service configurations generated to allow control connections from 354
121 * this ip. This can either be a single ip address or a network address 355
122 * in CIDR notation. 356/**
123 * @param hostname the hostname of the system we are using for testing; NULL for 357 * Get command from hash map by variable name.
124 * localhost 358 *
125 * @param shared_services NULL terminated array describing services that are to 359 * @param is interpreter state.
126 * be shared among peers 360 * @param name name of the variable to get command by
127 * @return handle to this system, NULL on error 361 * @return the command, if it is found, or NULL.
128 */ 362 */
129struct GNUNET_TESTING_System * 363const struct GNUNET_TESTING_Command *
130GNUNET_TESTING_system_create (const char *testdir, 364GNUNET_TESTING_interpreter_get_command (
131 const char *trusted_ip, 365 struct GNUNET_TESTING_Interpreter *is,
132 const char *hostname, 366 const char *name);
133 const struct GNUNET_TESTING_SharedService * 367
134 shared_services); 368
135 369/**
136 370 * Update the last request time of the current command
137/** 371 * to the current time.
138 * Create a system handle. There must only be one system 372 *
139 * handle per operating system. Use this function directly 373 * @param[in,out] is interpreter state where to show
140 * if multiple system objects are created for the same host 374 * that we are doing something
141 * (only really useful when testing --- or to make the port
142 * range configurable).
143 *
144 * @param testdir only the directory name without any path. This is used for
145 * all service homes; the directory will be created in a temporary
146 * location depending on the underlying OS. This variable will be
147 * overridden with the value of the environmental variable
148 * GNUNET_TESTING_PREFIX, if it exists.
149 * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
150 * service configurations generated to allow control connections from
151 * this ip. This can either be a single ip address or a network address
152 * in CIDR notation.
153 * @param hostname the hostname of the system we are using for testing; NULL for
154 * localhost
155 * @param shared_services NULL terminated array describing services that are to
156 * be shared among peers
157 * @param lowport lowest port number this system is allowed to allocate (inclusive)
158 * @param highport highest port number this system is allowed to allocate (exclusive)
159 * @return handle to this system, NULL on error
160 */
161struct GNUNET_TESTING_System *
162GNUNET_TESTING_system_create_with_portrange (const char *testdir,
163 const char *trusted_ip,
164 const char *hostname,
165 const struct
166 GNUNET_TESTING_SharedService *
167 shared_services,
168 uint16_t lowport,
169 uint16_t highport);
170
171
172/**
173 * Free system resources.
174 *
175 * @param system system to be freed
176 * @param remove_paths should the 'testdir' and all subdirectories
177 * be removed (clean up on shutdown)?
178 */ 375 */
179void 376void
180GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, 377GNUNET_TESTING_interpreter_current_cmd_touch (
181 int remove_paths); 378 struct GNUNET_TESTING_Interpreter *is);
182 379
183 380
184/** 381/**
185 * Testing includes a number of pre-created hostkeys for 382 * Increment the 'num_tries' counter for the current command.
186 * faster peer startup. This function can be used to
187 * access the n-th key of those pre-created hostkeys; note
188 * that these keys are ONLY useful for testing and not
189 * secure as the private keys are part of the public
190 * GNUnet source code.
191 * 383 *
192 * This is primarily a helper function used internally 384 * @param[in,out] is interpreter state where to
193 * by #GNUNET_TESTING_peer_configure(). 385 * increment the counter
386 */
387void
388GNUNET_TESTING_interpreter_current_cmd_inc_tries (
389 struct GNUNET_TESTING_Interpreter *is);
390
391
392/**
393 * Obtain label of the command being now run.
194 * 394 *
195 * @param system the testing system handle 395 * @param is interpreter state.
196 * @param key_number desired pre-created hostkey to obtain 396 * @return the label.
197 * @param id set to the peer's identity (hash of the public
198 * key; if NULL, #GNUNET_SYSERR is returned immediately
199 * @return NULL on error (not enough keys)
200 */ 397 */
201struct GNUNET_CRYPTO_EddsaPrivateKey * 398const char *
202GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, 399GNUNET_TESTING_interpreter_current_cmd_get_label (
203 uint32_t key_number, 400 struct GNUNET_TESTING_Interpreter *is);
204 struct GNUNET_PeerIdentity *id);
205 401
206 402
207/** 403/**
208 * Reserve a port for a peer. 404 * Current command failed, clean up and fail the test case.
209 * 405 *
210 * @param system system to use for reservation tracking 406 * @param is interpreter state.
211 * @return 0 if no free port was available
212 */ 407 */
213uint16_t 408void
214GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system); 409GNUNET_TESTING_interpreter_fail (
410 struct GNUNET_TESTING_Interpreter *is);
215 411
216 412
217/** 413/**
218 * Release reservation of a TCP or UDP port for a peer 414 * Skips the current test, the environment is
219 * (used during GNUNET_TESTING_peer_destroy). 415 * not prepared correctly.
220 * 416 *
221 * @param system system to use for reservation tracking 417 * @param is interpreter state.
222 * @param port reserved port to release
223 */ 418 */
224void 419void
225GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system, 420GNUNET_TESTING_interpreter_skip (
226 uint16_t port); 421 struct GNUNET_TESTING_Interpreter *is);
227 422
228 423
229/** 424/**
230 * Create a new configuration using the given configuration as a template; 425 * Callback over commands of an interpreter.
231 * ports and paths will be modified to select available ports on the local
232 * system. The default configuration will be available in PATHS section under
233 * the option DEFAULTCONFIG after the call. SERVICE_HOME is also set in PATHS
234 * section to the temporary directory specific to this configuration. If we run
235 * out of "*port" numbers, return #GNUNET_SYSERR.
236 * 426 *
237 * This is primarily a helper function used internally 427 * @param cls closure
238 * by #GNUNET_TESTING_peer_configure(). 428 * @param cmd a command to process
429 */
430typedef void
431(*GNUNET_TESTING_CommandIterator)(
432 void *cls,
433 const struct GNUNET_TESTING_Command *cmd);
434
435
436/**
437 * Iterates over all of the top-level commands of an
438 * interpreter.
239 * 439 *
240 * @param system system to use to coordinate resource usage 440 * @param[in] is interpreter to iterate over
241 * @param cfg template configuration to update 441 * @param asc true in execution order, false for reverse execution order
242 * @return #GNUNET_OK on success, 442 * @param cb function to call on each command
243 * #GNUNET_SYSERR on error - the configuration will 443 * @param cb_cls closure for cb
244 * be incomplete and should not be used there upon
245 */ 444 */
246int 445void
247GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system, 446GNUNET_TESTING_interpreter_commands_iterate (
248 struct GNUNET_CONFIGURATION_Handle *cfg); 447 struct GNUNET_TESTING_Interpreter *is,
448 bool asc,
449 GNUNET_TESTING_CommandIterator cb,
450 void *cb_cls);
249 451
250// FIXME: add dual to 'release' ports again... 452
453/* ************** Fundamental interpreter commands ************ */
251 454
252 455
253/** 456/**
254 * Configure a GNUnet peer. GNUnet must be installed on the local 457 * Create command array terminator.
255 * system and available in the PATH.
256 * 458 *
257 * @param system system to use to coordinate resource usage 459 * @return a end-command.
258 * @param cfg configuration to use; will be UPDATED (to reflect needed
259 * changes in port numbers and paths)
260 * @param key_number number of the hostkey to use for the peer
261 * @param id identifier for the daemon, will be set, can be NULL
262 * @param emsg set to freshly allocated error message (set to NULL on success),
263 * can be NULL
264 * @return handle to the peer, NULL on error
265 */ 460 */
266struct GNUNET_TESTING_Peer * 461struct GNUNET_TESTING_Command
267GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, 462GNUNET_TESTING_cmd_end (void);
268 struct GNUNET_CONFIGURATION_Handle *cfg,
269 uint32_t key_number,
270 struct GNUNET_PeerIdentity *id,
271 char **emsg);
272 463
273 464
274/** 465/**
275 * Obtain the peer identity from a peer handle. 466 * Create a "batch" command. Such command takes a end_CMD-terminated array of
467 * CMDs and executed them. Once it hits the end CMD, it passes the control to
468 * the next top-level CMD, regardless of it being another batch or ordinary
469 * CMD.
276 * 470 *
277 * @param peer peer handle for which we want the peer's identity 471 * @param label the command label.
278 * @param id identifier for the daemon, will be set 472 * @param batch array of CMDs to execute.
473 * @return the command.
279 */ 474 */
280void 475struct GNUNET_TESTING_Command
281GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer, 476GNUNET_TESTING_cmd_batch (
282 struct GNUNET_PeerIdentity *id); 477 const char *label,
478 struct GNUNET_TESTING_Command *batch);
479
480
481/**
482 * Performance counter.
483 */
484struct GNUNET_TESTING_Timer
485{
486 /**
487 * For which type of commands.
488 */
489 const char *prefix;
490
491 /**
492 * Total time spend in all commands of this type.
493 */
494 struct GNUNET_TIME_Relative total_duration;
495
496 /**
497 * Total time spend waiting for the *successful* exeuction
498 * in all commands of this type.
499 */
500 struct GNUNET_TIME_Relative success_latency;
501
502 /**
503 * Number of commands summed up.
504 */
505 unsigned int num_commands;
283 506
507 /**
508 * Number of retries summed up.
509 */
510 unsigned int num_retries;
511};
284 512
285/** 513/**
286 * Start the peer. 514 * Obtain performance data from the interpreter.
287 * 515 *
288 * @param peer peer to start 516 * @param label command label.
289 * @return #GNUNET_OK on success, 517 * @param[in,out] timers NULL-prefix terminated array that specifies what commands (by label) to obtain runtimes for
290 * #GNUNET_SYSERR on error (i.e. peer already running) 518 * @return the command
291 */ 519 */
292int 520struct GNUNET_TESTING_Command
293GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer); 521GNUNET_TESTING_cmd_stat (
522 const char *label,
523 struct GNUNET_TESTING_Timer *timers);
294 524
295 525
296/** 526/**
297 * Stop the peer. This call is blocking as it kills the peer's main ARM process 527 * Set variable to command as side-effect of
298 * by sending a SIGTERM and waits on it. For asynchronous shutdown of peer, see 528 * running a command.
299 * GNUNET_TESTING_peer_stop_async().
300 * 529 *
301 * @param peer peer to stop 530 * @param name name of the variable to set
302 * @return #GNUNET_OK on success, 531 * @param cmd command to set to variable when run
303 * #GNUNET_SYSERR on error (i.e. peer not running) 532 * @return modified command
304 */ 533 */
305int 534struct GNUNET_TESTING_Command
306GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer); 535GNUNET_TESTING_cmd_set_var (
536 const char *name,
537 struct GNUNET_TESTING_Command cmd);
307 538
308 539
309/** 540/**
310 * Destroy the peer. Releases resources locked during peer configuration. 541 * Command to create a barrier.
311 * If the peer is still running, it will be stopped AND a warning will be
312 * printed (users of the API should stop the peer explicitly first).
313 * 542 *
314 * @param peer peer to destroy 543 * @param label The label of this command.
544 * @param number_to_be_reached If this number of processes reached
545 * this barrier, all processes waiting at
546 * this barrier can pass it.
315 */ 547 */
316void 548struct GNUNET_TESTING_Command
317GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer); 549GNUNET_TESTING_cmd_barrier_create (
550 const char *label,
551 unsigned int number_to_be_reached);
318 552
319 553
320/** 554/**
321 * Sends SIGTERM to the peer's main process 555 * If this command is executed the the process is signaling the master process
556 * that it reached a barrier. If this command is synchronous it will block.
322 * 557 *
323 * @param peer the handle to the peer 558 * @param label name for command.
324 * @return #GNUNET_OK if successful; #GNUNET_SYSERR if the main process is NULL 559 * @param barrier_label The name of the barrier we waited for and which was reached.
325 * or upon any error while sending SIGTERM 560 * @return command.
326 */ 561 */
327int 562struct GNUNET_TESTING_Command
328GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer *peer); 563GNUNET_TESTING_cmd_barrier_reached (
564 const char *label,
565 const char *barrier_label);
566
329 567
568#define GNUNET_TESTING_NETJAIL_START_SCRIPT "netjail_start.sh"
569
570#define GNUNET_TESTING_NETJAIL_STOP_SCRIPT "netjail_stop.sh"
330 571
331/** 572/**
332 * Waits for a peer to terminate. The peer's main process will also be destroyed. 573 * Create command.
333 * 574 *
334 * @param peer the handle to the peer 575 * @param label Name for the command.
335 * @return #GNUNET_OK if successful; #GNUNET_SYSERR if the main process is NULL 576 * @param topology_data topology data
336 * or upon any error while waiting 577 * @param timeout Before this timeout is reached this cmd MUST finish.
578 * @return command.
337 */ 579 */
338int 580struct GNUNET_TESTING_Command
339GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer); 581GNUNET_TESTING_cmd_netjail_start_helpers (
582 const char *label,
583 const char *topology_cmd_label,
584 struct GNUNET_TIME_Relative timeout);
340 585
341 586
342/** 587/**
343 * Callback to inform whether the peer is running or stopped. 588 * This command executes a shell script to setup the netjail environment.
344 * 589 *
345 * @param cls the closure given to GNUNET_TESTING_peer_stop_async() 590 * @param label name for command.
346 * @param peer the respective peer whose status is being reported 591 * @param script which script to run, e.g. #GNUNET_TESTING_NETJAIL_START_SCRIPT
347 * @param success #GNUNET_YES if the peer is stopped; #GNUNET_SYSERR upon any 592 * @param topology_config Configuration file for the test topology.
348 * error 593 * @param read_file Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data.
594 * @return command.
349 */ 595 */
350typedef void 596struct GNUNET_TESTING_Command
351(*GNUNET_TESTING_PeerStopCallback) (void *cls, 597GNUNET_TESTING_cmd_netjail_setup (
352 struct GNUNET_TESTING_Peer *peer, 598 const char *label,
353 int success); 599 const char *script,
600 const char *topology_cmd_label);
601
602
603struct GNUNET_TESTING_Command
604GNUNET_TESTING_cmd_load_topology_from_file (
605 const char *label,
606 const char *filename);
607
608
609struct GNUNET_TESTING_Command
610GNUNET_TESTING_cmd_load_topology_from_string (
611 const char *label,
612 const char *topology_data);
354 613
355 614
356/** 615/**
357 * Stop a peer asynchronously using ARM API. Peer's shutdown is signaled 616 * Turn asynchronous command into non-blocking command by setting
358 * through the GNUNET_TESTING_PeerStopCallback(). 617 * asynchronous_finish to true. Modifies (and then returns) @a cmd simply
618 * setting the bit. By default, most commands are blocking, and by wrapping
619 * the command construction in this function a blocking command can be turned
620 * into an asynchronous command where the interpreter continues after
621 * initiating the asynchronous action. Does nothing if the command is
622 * fundamentally synchronous.
359 * 623 *
360 * @param peer the peer to stop 624 * @param[in,out] cmd command to make non-blocking
361 * @param cb the callback to signal peer shutdown 625 * @return a finish-command.
362 * @param cb_cls closure for the @a cb
363 * @return #GNUNET_OK upon successfully giving the request to the ARM API (this
364 * does not mean that the peer is successfully stopped); #GNUNET_SYSERR
365 * upon any error.
366 */ 626 */
367int 627struct GNUNET_TESTING_Command
368GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer, 628GNUNET_TESTING_cmd_make_unblocking (
369 GNUNET_TESTING_PeerStopCallback cb, 629 struct GNUNET_TESTING_Command cmd);
370 void *cb_cls);
371 630
372 631
373/** 632/**
374 * Cancel a previous asynchronous peer stop request. 633 * Create (synchronous) command that waits for another command to finish.
375 * GNUNET_TESTING_peer_stop_async() should have been called before on the given 634 * If @a cmd_ref did not finish after @a timeout, this command will fail
376 * peer. It is an error to call this function if the peer stop callback was 635 * the test case.
377 * already called
378 * 636 *
379 * @param peer the peer on which GNUNET_TESTING_peer_stop_async() was called 637 * @param finish_label label for this command
380 * before. 638 * @param cmd_ref reference to a previous command which we should
639 * wait for (call `finish()` on)
640 * @param timeout how long to wait at most for @a cmd_ref to finish
641 * @return a finish-command.
381 */ 642 */
382void 643const struct GNUNET_TESTING_Command
383GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer); 644GNUNET_TESTING_cmd_finish (
645 const char *finish_label,
646 const char *cmd_ref,
647 struct GNUNET_TIME_Relative timeout);
648
649
650/**
651 * Create a "signal" CMD.
652 *
653 * @param label command label.
654 * @param process_label label of a command that has a process trait
655 * @param signal signal to send to @a process.
656 * @return the command.
657 */
658struct GNUNET_TESTING_Command
659GNUNET_TESTING_cmd_signal (
660 const char *label,
661 const char *process_label,
662 int signal);
663
664
665/**
666 * Sleep for @a duration.
667 *
668 * @param label command label.
669 * @param duration time to sleep
670 * @return the command.
671 */
672struct GNUNET_TESTING_Command
673GNUNET_TESTING_cmd_sleep (
674 const char *label,
675 struct GNUNET_TIME_Relative duration);
676
677
678/**
679 * Command to execute a command.
680 *
681 * @param label Label of the command.
682*/
683const struct GNUNET_TESTING_Command
684GNUNET_TESTING_cmd_exec (
685 const char *label,
686 enum GNUNET_OS_ProcessStatusType expected_type,
687 unsigned long int expected_exit_code,
688 char *const script_argv[]);
689
690
691/**
692 * Command to execute a command.
693 *
694 * @param label Label of the command.
695*/
696const struct GNUNET_TESTING_Command
697GNUNET_TESTING_cmd_exec_va (
698 const char *label,
699 enum GNUNET_OS_ProcessStatusType expected_type,
700 unsigned long int expected_exit_code,
701 ...);
384 702
385 703
386/** 704/**
387 * Signature of the 'main' function for a (single-peer) testcase that 705 * Make the instruction pointer point to @a target_label
388 * is run using #GNUNET_TESTING_peer_run(). 706 * only if @a counter is greater than zero. Note that
707 * the command that will be executed next in this case
708 * is the one AFTER @a target_label, as the command we
709 * jump to is skipped by the advancing IP after the
710 * rewind.
711 *
712 * @param label command label
713 * @param target_label label of the new instruction pointer's destination after the jump;
714 * must be before the current instruction (and the command at the @a target_label itself will not be run, but the one afterwards)
715 * @param counter counts how many times the rewinding is to happen.
716 */
717struct GNUNET_TESTING_Command
718GNUNET_TESTING_cmd_rewind_ip (
719 const char *label,
720 const char *target_label,
721 unsigned int counter);
722
723
724/* ***************** main loop logic ************* */
725
726/**
727 * Function called with the final result of the test.
389 * 728 *
390 * @param cls closure 729 * @param cls closure
391 * @param cfg configuration of the peer that was started 730 * @param rv #GNUNET_OK if the test passed
392 * @param peer identity of the peer that was created
393 */ 731 */
394typedef void 732typedef void
395(*GNUNET_TESTING_TestMain) (void *cls, 733(*GNUNET_TESTING_ResultCallback)(
396 const struct GNUNET_CONFIGURATION_Handle *cfg, 734 void *cls,
397 struct GNUNET_TESTING_Peer *peer); 735 enum GNUNET_GenericReturnValue rv);
398 736
399 737
400/** 738/**
401 * Start a single peer and run a test using the testing library. 739 * Run the testsuite. Note, CMDs are copied into the interpreter state
402 * Starts a peer using the given configuration and then invokes the 740 * because they are _usually_ defined into the "run" method that returns after
403 * given callback. This function ALSO initializes the scheduler loop 741 * having scheduled the test interpreter.
404 * and should thus be called directly from "main". The testcase
405 * should self-terminate by invoking #GNUNET_SCHEDULER_shutdown().
406 * 742 *
407 * @param testdir only the directory name without any path. This is used for 743 * @param commands the array of command to execute
408 * all service homes; the directory will be created in a temporary 744 * @param timeout how long to wait for each command to execute
409 * location depending on the underlying OS 745 * @param rc function to call with the final result
410 * @param cfgfilename name of the configuration file to use; 746 * @param rc_cls closure for @a rc
411 * use NULL to only run with defaults 747 * @return The interpreter.
412 * @param tm main function of the testcase
413 * @param tm_cls closure for @a tm
414 * @return 0 on success, 1 on error
415 */ 748 */
416int 749struct GNUNET_TESTING_Interpreter *
417GNUNET_TESTING_peer_run (const char *testdir, 750GNUNET_TESTING_run (
418 const char *cfgfilename, 751 const struct GNUNET_TESTING_Command *commands,
419 GNUNET_TESTING_TestMain tm, 752 struct GNUNET_TIME_Relative timeout,
420 void *tm_cls); 753 GNUNET_TESTING_ResultCallback rc,
754 void *rc_cls);
421 755
422 756
423/** 757/**
424 * Start a single service (no ARM, except of course if the given 758 * Start a GNUnet scheduler event loop and run the testsuite. Return 0 upon
425 * service name is 'arm') and run a test using the testing library. 759 * success. Expected to be called directly from main().
426 * Starts a service using the given configuration and then invokes the
427 * given callback. This function ALSO initializes the scheduler loop
428 * and should thus be called directly from "main". The testcase
429 * should self-terminate by invoking #GNUNET_SCHEDULER_shutdown().
430 * 760 *
431 * This function is useful if the testcase is for a single service 761 * @param commands the list of command to execute
432 * and if that service doesn't itself depend on other services. 762 * @param timeout how long to wait for each command to execute
433 * 763 * @return EXIT_SUCCESS on success, EXIT_FAILURE on failure
434 * @param testdir only the directory name without any path. This is used for
435 * all service homes; the directory will be created in a temporary
436 * location depending on the underlying OS
437 * @param service_name name of the service to run
438 * @param cfgfilename name of the configuration file to use;
439 * use NULL to only run with defaults
440 * @param tm main function of the testcase
441 * @param tm_cls closure for @a tm
442 * @return 0 on success, 1 on error
443 */ 764 */
444int 765int
445GNUNET_TESTING_service_run (const char *testdir, 766GNUNET_TESTING_main (
446 const char *service_name, 767 const struct GNUNET_TESTING_Command *commands,
447 const char *cfgfilename, 768 struct GNUNET_TIME_Relative timeout);
448 GNUNET_TESTING_TestMain tm, 769
449 void *tm_cls); 770
771/* ***************** plugin logic ************* */
772
773
774/**
775 * The plugin API every test case plugin has to implement.
776 */
777struct GNUNET_TESTING_PluginFunctions;
778
779
780struct GNUNET_TESTING_PluginFunctions *
781GNUNET_TESTING_make_plugin (
782 const struct GNUNET_TESTING_Command *commands);
783
784#define GNUNET_TESTING_MAKE_PLUGIN(prefix,name,...) \
785 void * \
786 prefix ## _plugin_ ## name ## _init (void *cls) { \
787 const char *my_node_id = cls; (void) my_node_id; \
788 struct GNUNET_TESTING_Command commands[] = { \
789 __VA_ARGS__, \
790 GNUNET_TESTING_cmd_end () \
791 }; \
792 return GNUNET_TESTING_make_plugin (commands); \
793 } \
794 void * \
795 prefix ## _plugin_ ## name ## _done (void *cls) { \
796 struct GNUNET_TESTING_PluginFunctions *api = cls; \
797 GNUNET_free (api); \
798 return NULL; \
799 }
450 800
451 801
452#if 0 /* keep Emacsens' auto-indent happy */ 802/* *** Generic trait logic for implementing traits ********* */
803
804/**
805 * A `struct GNUNET_TESTING_Trait` can be used to exchange data between cmds.
806 *
807 * Therefor the cmd which like to provide data to other cmds has to implement
808 * the trait function, where an array of traits is defined with the help of
809 * the #GNUNET_TESTING_make_trait_ macro. The data can be retrieved with the
810 * help of the #GNUNET_TESTING_get_trait_ macro. Traits name and type must be
811 * defined to make use of the macros.
812 */
813struct GNUNET_TESTING_Trait
453{ 814{
454#endif 815 /**
455#ifdef __cplusplus 816 * Index number associated with the trait. This gives the
456} 817 * possibility to have _multiple_ traits on offer under the
457#endif 818 * same name.
819 */
820 unsigned int index;
821
822 /**
823 * Trait type, for example "reserve-pub" or "coin-priv".
824 */
825 const char *trait_name;
826
827 /**
828 * Pointer to the piece of data to offer.
829 */
830 const void *ptr;
831};
458 832
459#endif
460 833
461/** @} */ /* end of group */ 834/**
835 * "end" of traits array. Because traits are offered into arrays, this type
836 * of trait is used to mark the end of such arrays; useful when iterating over
837 * those.
838 */
839struct GNUNET_TESTING_Trait
840GNUNET_TESTING_trait_end (void);
462 841
463/** @} */ /* end of group addition */ 842
843/**
844 * Obtain value of a trait from a command.
845 *
846 * @param traits the array of all the traits.
847 * @param[out] ret where to store the result.
848 * @param trait type of the trait to extract.
849 * @param index index number of the trait to extract.
850 * @return #GNUNET_OK when the trait is found.
851 */
852enum GNUNET_GenericReturnValue
853GNUNET_TESTING_get_trait (
854 const struct GNUNET_TESTING_Trait *traits,
855 const void **ret,
856 const char *trait,
857 unsigned int index);
858
859
860/**
861 * Create headers for a trait with name @a name for
862 * statically allocated data of type @a type.
863 *
864 * @param prefix symbol prefix to use
865 * @param name name of the trait
866 * @param type data type for the trait
867 */
868#define GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(prefix,name,type) \
869 enum GNUNET_GenericReturnValue \
870 prefix ## _get_trait_ ## name ( \
871 const struct GNUNET_TESTING_Command *cmd, \
872 type * *ret); \
873 struct GNUNET_TESTING_Trait \
874 prefix ## _make_trait_ ## name ( \
875 type * value);
876
877
878/**
879 * Create C implementation for a trait with name @a name for statically
880 * allocated data of type @a type.
881 *
882 * @param prefix symbol prefix to use
883 * @param name name of the trait
884 * @param type data type for the trait
885 */
886#define GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT(prefix,name,type) \
887 enum GNUNET_GenericReturnValue \
888 prefix ## _get_trait_ ## name ( \
889 const struct GNUNET_TESTING_Command *cmd, \
890 type * *ret) \
891 { \
892 if (NULL == cmd->traits) return GNUNET_SYSERR; \
893 return cmd->traits (cmd->cls, \
894 (const void **) ret, \
895 GNUNET_S (name), \
896 0); \
897 } \
898 struct GNUNET_TESTING_Trait \
899 prefix ## _make_trait_ ## name ( \
900 type * value) \
901 { \
902 struct GNUNET_TESTING_Trait ret = { \
903 .trait_name = GNUNET_S (name), \
904 .ptr = (const void *) value \
905 }; \
906 return ret; \
907 }
908
909
910/**
911 * Create headers for a trait with name @a name for
912 * statically allocated data of type @a type.
913 *
914 * @param prefix symbol prefix to use
915 * @param name name of the trait
916 * @param type data type for the trait
917 */
918#define GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT(prefix,name,type) \
919 enum GNUNET_GenericReturnValue \
920 prefix ## _get_trait_ ## name ( \
921 const struct GNUNET_TESTING_Command *cmd, \
922 unsigned int index, \
923 type * *ret); \
924 struct GNUNET_TESTING_Trait \
925 prefix ## _make_trait_ ## name ( \
926 unsigned int index, \
927 type * value);
928
929
930/**
931 * Create C implementation for a trait with name @a name for statically
932 * allocated data of type @a type.
933 */
934#define GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT(prefix,name,type) \
935 enum GNUNET_GenericReturnValue \
936 prefix ## _get_trait_ ## name ( \
937 const struct GNUNET_TESTING_Command *cmd, \
938 unsigned int index, \
939 type * *ret) \
940 { \
941 if (NULL == cmd->traits) return GNUNET_SYSERR; \
942 return cmd->traits (cmd->cls, \
943 (const void **) ret, \
944 GNUNET_S (name), \
945 index); \
946 } \
947 struct GNUNET_TESTING_Trait \
948 prefix ## _make_trait_ ## name ( \
949 unsigned int index, \
950 type * value) \
951 { \
952 struct GNUNET_TESTING_Trait ret = { \
953 .index = index, \
954 .trait_name = GNUNET_S (name), \
955 .ptr = (const void *) value \
956 }; \
957 return ret; \
958 }
959
960
961/**
962 * Call #op on all simple traits needed by testing core logic.
963 *
964 * @param op operation to perform
965 * @param prefix prefix to pass to @e op
966 */
967#define GNUNET_TESTING_SIMPLE_TRAITS(op,prefix) \
968 op (prefix, process, struct GNUNET_OS_Process *) \
969 op (prefix, cmd, const struct GNUNET_TESTING_Command) \
970 op (prefix, batch_cmds, struct GNUNET_TESTING_Command *)
971
972
973GNUNET_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
974 GNUNET_TESTING)
975
976
977#endif
diff --git a/src/include/gnunet_testing_loop_lib.h b/src/include/gnunet_testing_loop_lib.h
deleted file mode 100644
index 7e13edfab..000000000
--- a/src/include/gnunet_testing_loop_lib.h
+++ /dev/null
@@ -1,697 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021, 2023 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @brief Central interpreter and command loop for writing an interpreter to test asynchronous systems
23 * @author Christian Grothoff <christian@grothoff.org>
24 * @author Marcello Stanisci
25 * @author t3sserakt
26 */
27#ifndef GNUNET_TESTING_LOOP_LIB_H
28#define GNUNET_TESTING_LOOP_LIB_H
29
30/**
31 * Maximum length of label in command
32 */
33#define GNUNET_TESTING_CMD_MAX_LABEL_LENGTH 127
34
35/* ********************* Helper functions ********************* */
36
37/**
38 * Print failing line number and trigger shutdown. Useful
39 * quite any time after the command "run" method has been called.
40 */
41#define GNUNET_TESTING_FAIL(is) \
42 do \
43 { \
44 GNUNET_break (0); \
45 GNUNET_TESTING_interpreter_fail (is); \
46 return; \
47 } while (0)
48
49
50/* ******************* Generic interpreter logic ************ */
51
52/**
53 * Global state of the interpreter, used by a command
54 * to access information about other commands.
55 */
56struct GNUNET_TESTING_Interpreter;
57
58/**
59 * State each asynchronous command must have in its closure.
60 */
61struct GNUNET_TESTING_AsyncContext
62{
63
64 /**
65 * Interpreter we are part of.
66 */
67 struct GNUNET_TESTING_Interpreter *is; // FIXME: Why needed? When available?
68
69 /**
70 * Function to call when done.
71 */
72 GNUNET_SCHEDULER_TaskCallback cont;
73
74 /**
75 * Closure for @e cont.
76 */
77 void *cont_cls;
78
79 /**
80 * Indication if the command finished (#GNUNET_OK).
81 * #GNUNET_NO if it did not finish,
82 * #GNUNET_SYSERR if it failed.
83 */
84 enum GNUNET_GenericReturnValue finished;
85};
86
87
88/**
89 * The asynchronous command of @a ac has failed.
90 *
91 * @param ac command-specific context
92 */
93void
94GNUNET_TESTING_async_fail (struct GNUNET_TESTING_AsyncContext *ac);
95
96
97/**
98 * The asynchronous command of @a ac has finished.
99 *
100 * @param ac command-specific context
101 */
102void
103GNUNET_TESTING_async_finish (struct GNUNET_TESTING_AsyncContext *ac);
104
105
106/**
107 * Signature of a function used to start executing a command
108 * of a test.
109 *
110 * @param cls closure
111 * @param is interpreter running the command
112 */
113typedef void
114(*GNUNET_TESTING_CommandRunRoutine)(void *cls,
115 struct GNUNET_TESTING_Interpreter *is);
116
117
118/**
119 * Signature of a function used to clean up resources allocated
120 * by a command.
121 *
122 * @param cls closure
123 */
124typedef void
125(*GNUNET_TESTING_CommandCleanupRoutine)(void *cls);
126
127
128/**
129 * Signature of a function used to extract traits exposed by a
130 * command.
131 *
132 * @param cls closure
133 * @param[out] ret where to return the trait data
134 * @param trait name of the trait to return
135 * @param index index of the trait (for traits that are indexed)
136 * @return #GNUNET_OK on success
137 */
138typedef enum GNUNET_GenericReturnValue
139(*GNUNET_TESTING_CommandGetTraits) (void *cls,
140 const void **ret,
141 const char *trait,
142 unsigned int index);
143
144/**
145 * Create a new command
146 *
147 * @param cls the closure
148 * @param label the Label. Maximum length is GNUNET_TESTING_CMD_MAX_LABEL_LENGTH
149 * @param run the run routing
150 * @param cleanup the cleanup function
151 * @param traits the traits function (optional)
152 * @param the async context
153 * @return the command the function cannot fail
154 */
155struct GNUNET_TESTING_Command
156GNUNET_TESTING_command_new (void *cls,
157 const char *label,
158 GNUNET_TESTING_CommandRunRoutine run,
159 GNUNET_TESTING_CommandCleanupRoutine cleanup,
160 GNUNET_TESTING_CommandGetTraits traits,
161 struct GNUNET_TESTING_AsyncContext *ac);
162
163
164/**
165 * Structure with storage space for a label.
166 */
167struct GNUNET_TESTING_CommandLabel
168{
169 char value[GNUNET_TESTING_CMD_MAX_LABEL_LENGTH + 1];
170};
171
172
173/**
174 * Set @a label to @a value. Asserts that @a value is
175 * not longer than #GNUNET_TESTING_CMD_MAX_LABEL_LENGTH.
176 *
177 * @param[out] label label to initialize
178 * @param value value to store into @a label
179 */
180void
181GNUNET_TESTING_set_label (struct GNUNET_TESTING_CommandLabel *label,
182 const char *value);
183
184
185/**
186 * A command to be run by the interpreter.
187 */
188struct GNUNET_TESTING_Command
189{
190 /**
191 * Closure for all commands with command-specific context information.
192 */
193 void *cls;
194
195 /**
196 * Label for the command.
197 */
198 struct GNUNET_TESTING_CommandLabel label;
199
200 /**
201 * Runs the command. Note that upon return, the interpreter
202 * will not automatically run the next command, as the command
203 * may continue asynchronously in other scheduler tasks. Thus,
204 * the command must ensure to eventually call
205 * #GNUNET_TESTING_interpreter_next() or
206 * #GNUNET_TESTING_interpreter_fail().
207 *
208 * If this function creates some asynchronous activity, it should
209 * initialize @e finish to a function that can be used to wait for
210 * the asynchronous activity to terminate.
211 *
212 * @param cls closure
213 * @param is interpreter state
214 */
215 GNUNET_TESTING_CommandRunRoutine run;
216
217 /**
218 * Pointer to the asynchronous context in the command's
219 * closure. Used by the
220 * #GNUNET_TESTING_async_finish() and
221 * #GNUNET_TESTING_async_fail() functions.
222 *
223 * Must be NULL if a command is synchronous.
224 */
225 struct GNUNET_TESTING_AsyncContext *ac;
226
227 /**
228 * Clean up after the command. Run during forced termination
229 * (CTRL-C) or test failure or test success.
230 *
231 * @param cls closure
232 */
233 GNUNET_TESTING_CommandCleanupRoutine cleanup;
234
235 /**
236 * Extract information from a command that is useful for other
237 * commands. Can be NULL if a command has no traits.
238 *
239 * @param cls closure
240 * @param[out] ret result (could be anything)
241 * @param trait name of the trait
242 * @param index index number of the object to extract.
243 * @return #GNUNET_OK on success,
244 * #GNUNET_NO if no trait was found
245 */
246 GNUNET_TESTING_CommandGetTraits traits;
247
248 /**
249 * When did the execution of this command start?
250 */
251 struct GNUNET_TIME_Absolute start_time;
252
253 /**
254 * When did the execution of this command finish?
255 */
256 struct GNUNET_TIME_Absolute finish_time;
257
258 /**
259 * When did we start the last run of this command? Delta to @e finish_time
260 * gives the latency for the last successful run. Useful in case @e
261 * num_tries was positive and the command was run multiple times. In that
262 * case, the @e start_time gives the time when we first tried to run the
263 * command, so the difference between @e start_time and @e finish_time would
264 * be the time all of the @e num_tries took, while the delta to @e
265 * last_req_time is the time the last (successful) execution took.
266 */
267 struct GNUNET_TIME_Absolute last_req_time;
268
269 /**
270 * In case @e asynchronous_finish is true, how long should we wait for this
271 * command to complete? If @e finish did not complete after this amount of
272 * time, the interpreter will fail. Should be set generously to ensure
273 * tests do not fail on slow systems.
274 */
275 struct GNUNET_TIME_Relative default_timeout;
276
277 /**
278 * How often did we try to execute this command? (In case it is a request
279 * that is repated.) Note that a command must have some built-in retry
280 * mechanism for this value to be useful.
281 */
282 unsigned int num_tries;
283
284 /**
285 * If "true", the interpreter should not immediately call
286 * @e finish, even if @e finish is non-NULL. Otherwise,
287 * #GNUNET_TESTING_cmd_finish() must be used
288 * to ensure that a command actually completed.
289 */
290 bool asynchronous_finish;
291
292};
293
294
295/**
296 * Lookup command by label.
297 * Only future commands are looked up.
298 *
299 * @param is interpreter to lookup command in
300 * @param label label of the command to lookup.
301 * @return the command, if it is found, or NULL.
302 * @deprecated (still in use in a very odd way)
303 */
304// FIXME: think harder about whether this is actually needed, likely not.
305const struct GNUNET_TESTING_Command *
306GNUNET_TESTING_interpreter_lookup_future_command (
307 struct GNUNET_TESTING_Interpreter *is,
308 const char *label);
309
310
311/**
312 * Lookup command by label.
313 *
314 * @param is interpreter to lookup command in
315 * @param label label of the command to lookup.
316 * @return the command, if it is found, or NULL.
317 */
318const struct GNUNET_TESTING_Command *
319GNUNET_TESTING_interpreter_lookup_command (
320 struct GNUNET_TESTING_Interpreter *is,
321 const char *label);
322
323
324/**
325 * Lookup command by label.
326 * All commands, first into the past, then into the future are looked up.
327 *
328 * @param is interpreter to lookup command in
329 * @param label label of the command to lookup.
330 * @return the command, if it is found, or NULL.
331 * @deprecated (still in use in a very odd way)
332 */
333const struct GNUNET_TESTING_Command *
334GNUNET_TESTING_interpreter_lookup_command_all (
335 struct GNUNET_TESTING_Interpreter *is,
336 const char *label);
337
338
339/**
340 * Current command failed, clean up and fail the test case.
341 *
342 * @param is interpreter state.
343 */
344void
345GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is);
346
347
348/**
349 * Turn asynchronous command into non-blocking command by setting
350 * asynchronous_finish to true. Modifies (and then returns) @a cmd simply
351 * setting the bit. By default, most commands are blocking, and by wrapping
352 * the command construction in this function a blocking command can be turned
353 * into an asynchronous command where the interpreter continues after
354 * initiating the asynchronous action. Does nothing if the command is
355 * fundamentally synchronous.
356 *
357 * @param[in,out] cmd command to make non-blocking
358 * @return a finish-command.
359 */
360struct GNUNET_TESTING_Command
361GNUNET_TESTING_cmd_make_unblocking (struct GNUNET_TESTING_Command cmd);
362
363
364/**
365 * Create (synchronous) command that waits for another command to finish.
366 * If @a cmd_ref did not finish after @a timeout, this command will fail
367 * the test case.
368 *
369 * @param finish_label label for this command
370 * @param cmd_ref reference to a previous command which we should
371 * wait for (call `finish()` on)
372 * @param timeout how long to wait at most for @a cmd_ref to finish
373 * @return a finish-command.
374 */
375const struct GNUNET_TESTING_Command
376GNUNET_TESTING_cmd_finish (const char *finish_label,
377 const char *cmd_ref,
378 struct GNUNET_TIME_Relative timeout);
379
380
381/**
382 * Make the instruction pointer point to @a target_label
383 * only if @a counter is greater than zero.
384 *
385 * @param label command label
386 * @param target_label label of the new instruction pointer's destination after the jump;
387 * must be before the current instruction
388 * @param counter counts how many times the rewinding is to happen.
389 */
390struct GNUNET_TESTING_Command
391GNUNET_TESTING_cmd_rewind_ip (const char *label,
392 const char *target_label,
393 unsigned int counter);
394
395
396/**
397 * Function called with the final result of the test.
398 * FIXME: This may want to use a GNUNET_ErrorCode (namespaced, e.g.
399 * GNUNET_EC_TESTING_*)
400 *
401 * @param cls closure
402 * @param rv #GNUNET_OK if the test passed
403 */
404typedef void
405(*GNUNET_TESTING_ResultCallback)(void *cls,
406 enum GNUNET_GenericReturnValue rv);
407
408
409/**
410 * Run the testsuite. Note, CMDs are copied into
411 * the interpreter state because they are _usually_
412 * defined into the "run" method that returns after
413 * having scheduled the test interpreter.
414 *
415 * @param commands the array of command to execute
416 * @param timeout how long to wait for each command to execute
417 * @param rc function to call with the final result
418 * @param rc_cls closure for @a rc
419 * @return The interpreter.
420 */
421struct GNUNET_TESTING_Interpreter *
422GNUNET_TESTING_run (const struct GNUNET_TESTING_Command *commands,
423 struct GNUNET_TIME_Relative timeout,
424 GNUNET_TESTING_ResultCallback rc,
425 void *rc_cls);
426
427
428/**
429 * Start a GNUnet scheduler event loop and
430 * run the testsuite. Return 0 upon success.
431 * Expected to be called directly from main().
432 * FIXME: Why is this commands array here not const?
433 *
434 * @param commands the list of command to execute
435 * @param timeout how long to wait for each command to execute
436 * @return EXIT_SUCCESS on success, EXIT_FAILURE on failure
437 */
438int
439GNUNET_TESTING_main (struct GNUNET_TESTING_Command *commands,
440 struct GNUNET_TIME_Relative timeout);
441
442
443
444/* ************** Fundamental interpreter commands ************ */
445
446
447/**
448 * Create command array terminator.
449 *
450 * @return a end-command.
451 */
452struct GNUNET_TESTING_Command
453GNUNET_TESTING_cmd_end (void);
454
455
456/**
457 * Create a "batch" command. Such command takes a end_CMD-terminated array of
458 * CMDs and executed them. Once it hits the end CMD, it passes the control to
459 * the next top-level CMD, regardless of it being another batch or ordinary
460 * CMD.
461 *
462 * @param label the command label.
463 * @param batch array of CMDs to execute.
464 * @return the command.
465 */
466struct GNUNET_TESTING_Command
467GNUNET_TESTING_cmd_batch (const char *label,
468 struct GNUNET_TESTING_Command *batch);
469
470
471/**
472 * Performance counter.
473 */
474struct GNUNET_TESTING_Timer
475{
476 /**
477 * For which type of commands.
478 */
479 const char *prefix;
480
481 /**
482 * Total time spend in all commands of this type.
483 */
484 struct GNUNET_TIME_Relative total_duration;
485
486 /**
487 * Total time spend waiting for the *successful* exeuction
488 * in all commands of this type.
489 */
490 struct GNUNET_TIME_Relative success_latency;
491
492 /**
493 * Number of commands summed up.
494 */
495 unsigned int num_commands;
496
497 /**
498 * Number of retries summed up.
499 */
500 unsigned int num_retries;
501};
502
503/**
504 * Obtain performance data from the interpreter.
505 *
506 * @param[in,out] timers what commands (by label) to obtain runtimes for
507 * @return the command
508 */
509struct GNUNET_TESTING_Command
510GNUNET_TESTING_cmd_stat (struct GNUNET_TESTING_Timer *timers);
511
512
513/* *** Generic trait logic for implementing traits ********* */
514
515/**
516 * A `struct GNUNET_TESTING_Trait` can be used to exchange data between cmds.
517 *
518 * Therefor the cmd which like to provide data to other cmds has to implement
519 * the trait function, where an array of traits is defined with the help of the
520 * #GNUNET_TESTING_make_trait_ macro. The data can be retrieved with the help of the
521 * #GNUNET_TESTING_get_trait_ macro. Traits name and type must be defined to make
522 * use of the macros.
523 */
524struct GNUNET_TESTING_Trait
525{
526 /**
527 * Index number associated with the trait. This gives the
528 * possibility to have _multiple_ traits on offer under the
529 * same name.
530 */
531 unsigned int index;
532
533 /**
534 * Trait type, for example "reserve-pub" or "coin-priv".
535 */
536 const char *trait_name;
537
538 /**
539 * Pointer to the piece of data to offer.
540 */
541 const void *ptr;
542};
543
544
545/**
546 * "end" of traits array. Because traits are offered into arrays, this type
547 * of trait is used to mark the end of such arrays; useful when iterating over
548 * those.
549 */
550struct GNUNET_TESTING_Trait
551GNUNET_TESTING_trait_end (void);
552
553
554/**
555 * Obtain value of a trait from a command.
556 *
557 * @param traits the array of all the traits.
558 * @param[out] ret where to store the result.
559 * @param trait type of the trait to extract.
560 * @param index index number of the trait to extract.
561 * @return #GNUNET_OK when the trait is found.
562 */
563enum GNUNET_GenericReturnValue
564GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits,
565 const void **ret,
566 const char *trait,
567 unsigned int index);
568
569
570
571/**
572 * Create headers for a trait with name @a name for
573 * statically allocated data of type @a type.
574 *
575 * @param prefix symbol prefix to use
576 * @param name name of the trait
577 * @param type data type for the trait
578 */
579#define GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT(prefix,name,type) \
580 enum GNUNET_GenericReturnValue \
581 prefix ## _get_trait_ ## name ( \
582 const struct GNUNET_TESTING_Command *cmd, \
583 type **ret); \
584 struct GNUNET_TESTING_Trait \
585 prefix ## _make_trait_ ## name ( \
586 type * value);
587
588
589/**
590 * Create C implementation for a trait with name @a name for statically
591 * allocated data of type @a type.
592 *
593 * @param prefix symbol prefix to use
594 * @param name name of the trait
595 * @param type data type for the trait
596 */
597#define GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT(prefix,name,type) \
598 enum GNUNET_GenericReturnValue \
599 prefix ## _get_trait_ ## name ( \
600 const struct GNUNET_TESTING_Command *cmd, \
601 type * *ret) \
602 { \
603 if (NULL == cmd->traits) return GNUNET_SYSERR; \
604 return cmd->traits (cmd->cls, \
605 (const void **) ret, \
606 GNUNET_S (name), \
607 0); \
608 } \
609 struct GNUNET_TESTING_Trait \
610 prefix ## _make_trait_ ## name ( \
611 type * value) \
612 { \
613 struct GNUNET_TESTING_Trait ret = { \
614 .trait_name = GNUNET_S (name), \
615 .ptr = (const void *) value \
616 }; \
617 return ret; \
618 }
619
620
621/**
622 * Create headers for a trait with name @a name for
623 * statically allocated data of type @a type.
624 *
625 * @param prefix symbol prefix to use
626 * @param name name of the trait
627 * @param type data type for the trait
628 */
629#define GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT(prefix,name,type) \
630 enum GNUNET_GenericReturnValue \
631 prefix ## _get_trait_ ## name ( \
632 const struct GNUNET_TESTING_Command *cmd, \
633 unsigned int index, \
634 type **ret); \
635 struct GNUNET_TESTING_Trait \
636 prefix ## _make_trait_ ## name ( \
637 unsigned int index, \
638 type *value);
639
640
641/**
642 * Create C implementation for a trait with name @a name for statically
643 * allocated data of type @a type.
644 */
645#define GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT(prefix,name,type) \
646 enum GNUNET_GenericReturnValue \
647 prefix ## _get_trait_ ## name ( \
648 const struct GNUNET_TESTING_Command *cmd, \
649 unsigned int index, \
650 type * *ret) \
651 { \
652 if (NULL == cmd->traits) return GNUNET_SYSERR; \
653 return cmd->traits (cmd->cls, \
654 (const void **) ret, \
655 GNUNET_S (name), \
656 index); \
657 } \
658 struct GNUNET_TESTING_Trait \
659 prefix ## _make_trait_ ## name ( \
660 unsigned int index, \
661 type * value) \
662 { \
663 struct GNUNET_TESTING_Trait ret = { \
664 .index = index, \
665 .trait_name = GNUNET_S (name), \
666 .ptr = (const void *) value \
667 }; \
668 return ret; \
669 }
670
671
672/**
673 * Call #op on all simple traits needed by loop logic.
674 *
675 * @param op operation to perform
676 * @param prefix prefix to pass to @e op
677 */
678#define GNUNET_TESTING_LOOP_SIMPLE_TRAITS(op,prefix) \
679 op (prefix, batch_cmds, struct GNUNET_TESTING_Command *)
680
681
682GNUNET_TESTING_LOOP_SIMPLE_TRAITS(GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_TESTING)
683
684
685/**
686 * Call #op on all indexed traits needed by loop logic.
687 *
688 * @param op operation to perform
689 * @param prefix prefix to pass to @e op
690 */
691#define GNUNET_TESTING_LOOP_INDEXED_TRAITS(op,prefix) \
692 op (prefix, cmd, const struct GNUNET_TESTING_Command)
693
694GNUNET_TESTING_LOOP_INDEXED_TRAITS (GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT, GNUNET_TESTING)
695
696
697#endif
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h
deleted file mode 100644
index 407f50bb7..000000000
--- a/src/include/gnunet_testing_ng_lib.h
+++ /dev/null
@@ -1,115 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021, 2023 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @brief Meta-header for next-generation testing logic
23 * @author Christian Grothoff <christian@grothoff.org>
24 * @author Marcello Stanisci
25 * @author t3sserakt
26 */
27#ifndef GNUNET_TESTING_NG_LIB_H
28#define GNUNET_TESTING_NG_LIB_H
29
30
31#include "gnunet_util_lib.h"
32
33/* FIXME: legacy test header, to be removed!! */
34#include "gnunet_testing_lib.h"
35
36#include "gnunet_testing_plugin.h"
37#include "gnunet_testing_loop_lib.h"
38#include "gnunet_testing_netjail_lib.h"
39
40
41/**
42 * Create a "signal" CMD.
43 *
44 * @param label command label.
45 * @param process_label label of a command that has a process trait
46 * @param signal signal to send to @a process.
47 * @return the command.
48 */
49struct GNUNET_TESTING_Command
50GNUNET_TESTING_cmd_signal (const char *label,
51 const char *process_label,
52 int signal);
53
54
55/**
56 * Sleep for @a duration.
57 *
58 * @param label command label.
59 * @param duration time to sleep
60 * @return the command.
61 */
62struct GNUNET_TESTING_Command
63GNUNET_TESTING_cmd_sleep (const char *label,
64 struct GNUNET_TIME_Relative duration);
65
66
67/**
68 * Command to execute a script synchronously.
69 *
70 * FIXME: is this accurate? How is this limited to BASH scripts or even scripts?
71 *
72 * @param label Label of the command.
73 * @param script The name of the script.
74 * @param script_argv The arguments of the script.
75*/
76const struct GNUNET_TESTING_Command
77GNUNET_TESTING_cmd_exec_bash_script (const char *label,
78 const char *script,
79 char *const script_argv[],
80 // FIXME: wtf are these two args here for!?
81 int argc,
82 GNUNET_ChildCompletedCallback cb);
83
84
85
86/* ****** Specific traits needed by this component ******* */
87
88
89/**
90 * Call #op on all simple traits.
91 */
92#define GNUNET_TESTING_SIMPLE_TRAITS(op, prefix) \
93 op (prefix, process, struct GNUNET_OS_Process *)
94
95
96GNUNET_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_TESTING)
97
98/**
99 * Call #op on all indexed traits.
100 */
101#define GNUNET_TESTING_INDEXED_TRAITS(op, prefix) \
102 op (prefix, uint32, const uint32_t) \
103 op (prefix, uint64, const uint64_t) \
104 op (prefix, int64, const int64_t) \
105 op (prefix, uint, const unsigned int) \
106 op (prefix, string, const char) \
107 op (prefix, uuid, const struct GNUNET_Uuid) \
108 op (prefix, time, const struct GNUNET_TIME_Absolute) \
109 op (prefix, absolute_time, const struct GNUNET_TIME_Absolute) \
110 op (prefix, relative_time, const struct GNUNET_TIME_Relative)
111
112GNUNET_TESTING_INDEXED_TRAITS (GNUNET_TESTING_MAKE_DECL_INDEXED_TRAIT, GNUNET_TESTING)
113
114
115#endif
diff --git a/src/include/gnunet_testing_plugin.h b/src/include/gnunet_testing_plugin.h
deleted file mode 100644
index b030bc8a8..000000000
--- a/src/include/gnunet_testing_plugin.h
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 *
23 * @author t3sserakt
24 *
25 * Plugin API to start test cases.
26 *
27 */
28#ifndef GNUNET_TESTING_PLUGIN_H
29#define GNUNET_TESTING_PLUGIN_H
30
31#include "gnunet_common.h"
32
33#ifdef __cplusplus
34extern "C"
35{
36#if 0 /* keep Emacsens' auto-indent happy */
37}
38#endif
39#endif
40
41
42/**
43 * Callback function to write messages from the helper process running on a netjail node to the master process.
44 *
45 * @param message The message to write.
46 * @param msg_length The length of the message.
47 */
48typedef void
49(*GNUNET_TESTING_cmd_helper_write_cb) (struct GNUNET_MessageHeader *message,
50 size_t msg_length);
51
52/**
53 * Callback function which writes a message from the helper process running on a netjail node to the master process * signaling that the test case running on the netjail node finished.
54 */
55typedef void
56(*GNUNET_TESTING_cmd_helper_finish_cb) ();
57
58
59/**
60 * Function to be implemented for each test case plugin which starts the test case on a netjail node.
61 *
62 * @param write_message Callback function to write messages from the helper process running on a
63 * netjail node to the master process.
64 * @param router_ip Global address of the network namespace, if the helper process is for a node in a subnet.
65 * @param node_ip The IP address of the node.
66 * @param m The number of the node in a network namespace.
67 * @param n The number of the network namespace.
68 * @param local_m The number of nodes in a network namespace.
69 * @param topology_data A file name for the file containing the topology configuration, or a string containing
70 * the topology configuration.
71 * @param read_file If read_file is GNUNET_YES this string is the filename for the topology configuration,
72 * if read_file is GNUNET_NO the string contains the topology configuration.
73 * @param finish_cb Callback function which writes a message from the helper process running on a netjail
74 * node to the master process * signaling that the test case running on the netjail node finished.
75 * @return Returns The struct GNUNET_TESTING_Interpreter of the command loop running on this netjail node.
76 */
77typedef struct GNUNET_TESTING_Interpreter *
78(*GNUNET_TESTING_PLUGIN_StartTestCase) (
79 GNUNET_TESTING_cmd_helper_write_cb write_message,
80 const char *router_ip,
81 const char *node_ip,
82 const char *n,
83 const char *m,
84 const char *local_m,
85 const char *topology_data,
86 unsigned int *read_file,
87 GNUNET_TESTING_cmd_helper_finish_cb
88 finish_cb);
89
90/**
91 * DEPRECATED
92 * The helper process received a message of type
93 * GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED. This will finish the blocking command
94 * GNUNET_TESTING_cmd_block_until_external_trigger which was execute right after the command
95 * GNUNET_TESTING_cmd_send_peer_ready.
96 */
97typedef void
98(*GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED) ();
99
100/**
101 * DEPRECATED
102 * The helper process received a message of type
103 * GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED. This will finish the blocking command
104 * GNUNET_TESTING_cmd_local_test_prepared which was execute right after the command
105 * GNUNET_TRANSPORT_cmd_connect_peers.
106 * FIXME: do not use ALL CAPS
107 */
108typedef void
109(*GNUNET_TESTING_PLUGIN_ALL_LOCAL_TESTS_PREPARED) ();
110
111
112/**
113 * This function returns a struct GNUNET_TESTING_BarrierList, which is a list of all barriers
114 * this test case will wait for.
115 *
116 * @return A struct GNUNET_TESTING_BarrierList.
117 * FIXME: do not use ALL CAPS
118 */
119typedef struct GNUNET_TESTING_BarrierList*
120(*GNUNET_TESTING_PLUGIN_GET_WAITING_FOR_BARRIERS) (void);
121
122
123/**
124 * The plugin API every test case plugin has to implement.
125 */
126struct GNUNET_TESTING_PluginFunctions
127{
128
129 GNUNET_TESTING_PLUGIN_StartTestCase start_testcase;
130
131 GNUNET_TESTING_PLUGIN_ALL_PEERS_STARTED all_peers_started;
132
133 GNUNET_TESTING_PLUGIN_ALL_LOCAL_TESTS_PREPARED all_local_tests_prepared;
134
135 GNUNET_TESTING_PLUGIN_GET_WAITING_FOR_BARRIERS get_waiting_for_barriers;
136};
137
138#if 0 /* keep Emacsens' auto-indent happy */
139{
140#endif
141#ifdef __cplusplus
142}
143#endif
144
145#endif
diff --git a/src/include/gnunet_testing_testbed_lib.h b/src/include/gnunet_testing_testbed_lib.h
new file mode 100644
index 000000000..872382706
--- /dev/null
+++ b/src/include/gnunet_testing_testbed_lib.h
@@ -0,0 +1,42 @@
1#ifndef GNUNET_TESTING_TESTBED_LIB_H
2#define GNUNET_TESTING_TESTBED_LIB_H
3
4#include "gnunet_testing_lib.h"
5#include "gnunet_testbed_lib.h"
6
7/**
8 * This command destroys the ressources allocated for the test system setup.
9 *
10 * @param label Name for command.
11 * @param create_label Label of the cmd which started the test system.
12 * @param write_message Callback to write messages to the master loop.
13 * @return command.
14 */
15struct GNUNET_TESTING_Command
16GNUNET_TESTBED_cmd_system_destroy (const char *label,
17 const char *create_label);
18
19/**
20 * This command is setting up a test environment for a peer to start.
21 *
22 * @param label Name for command.
23 * @param testdir Only the directory name without any path. Temporary
24 * directory used for all service homes.
25 */
26struct GNUNET_TESTING_Command
27GNUNET_TESTBED_cmd_system_create (const char *label,
28 const char *testdir);
29
30
31/**
32 * Call #op on all simple traits.
33 */
34#define GNUNET_TESTING_TESTBED_SIMPLE_TRAITS(op, prefix) \
35 op (prefix, test_system, struct GNUNET_TESTBED_System)
36
37
38GNUNET_TESTING_TESTBED_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
39 GNUNET_TESTING_TESTBED)
40
41
42#endif
diff --git a/src/include/gnunet_transport_testing_ng_lib.h b/src/include/gnunet_testing_transport_lib.h
index be904cf4c..db2749661 100644
--- a/src/include/gnunet_transport_testing_ng_lib.h
+++ b/src/include/gnunet_testing_transport_lib.h
@@ -27,18 +27,13 @@
27 27
28 28
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_testing_ng_lib.h" 30#include "gnunet_testing_lib.h"
31 31
32/** 32/**
33 * Application handle; FIXME: what exactly is this? 33 * Application handle; FIXME: what exactly is this?
34 */ 34 */
35struct GNUNET_TRANSPORT_ApplicationHandle; 35struct GNUNET_TRANSPORT_ApplicationHandle;
36 36
37/**
38 * FIXME: what is this?
39 */
40struct GNUNET_TESTING_StartPeerState;
41
42 37
43// FIXME: breaks naming conventions 38// FIXME: breaks naming conventions
44typedef void * 39typedef void *
@@ -46,7 +41,6 @@ typedef void *
46 const struct GNUNET_PeerIdentity *peer); 41 const struct GNUNET_PeerIdentity *peer);
47 42
48 43
49
50// FIXME: breaks naming conventions! Needed public? 44// FIXME: breaks naming conventions! Needed public?
51struct GNUNET_TESTING_StartPeerState 45struct GNUNET_TESTING_StartPeerState
52{ 46{
@@ -153,7 +147,6 @@ struct GNUNET_TESTING_StartPeerState
153}; 147};
154 148
155 149
156
157/** 150/**
158 * Create command. 151 * Create command.
159 * 152 *
@@ -191,21 +184,22 @@ GNUNET_TESTING_get_peer (unsigned int num,
191 const struct GNUNET_TESTING_System *tl_system); 184 const struct GNUNET_TESTING_System *tl_system);
192 185
193 186
194
195
196/** 187/**
197 * Call #op on all simple traits. 188 * Call #op on all simple traits.
198 */ 189 */
199#define GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS(op, prefix) \ 190#define GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS(op, prefix) \
200 op (prefix, connected_peers_map, const struct GNUNET_CONTAINER_MultiShortmap) \ 191 op (prefix, connected_peers_map, const struct \
201 op (prefix, peer_id, const struct GNUNET_PeerIdentity) \ 192 GNUNET_CONTAINER_MultiShortmap) \
202 op (prefix, hello_size, const size_t) \ 193 op (prefix, peer_id, const struct GNUNET_PeerIdentity) \
203 op (prefix, hello, const char) \ 194 op (prefix, hello_size, const size_t) \
204 op (prefix, application_handle, const struct GNUNET_TRANSPORT_ApplicationHandle) \ 195 op (prefix, hello, const char) \
205 op (prefix, state, const struct GNUNET_TESTING_StartPeerState) \ 196 op (prefix, application_handle, const struct \
206 op (prefix, broadcast, const enum GNUNET_GenericReturnValue) 197 GNUNET_TRANSPORT_ApplicationHandle) \
207 198 op (prefix, state, const struct GNUNET_TESTING_StartPeerState) \
208 199 op (prefix, broadcast, const enum GNUNET_GenericReturnValue)
209GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_TRANSPORT_TESTING) 200
201
202GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
203 GNUNET_TRANSPORT_TESTING)
210 204
211#endif 205#endif
diff --git a/src/include/gnunet_transport_application_service.h b/src/include/gnunet_transport_application_service.h
index 66512089a..c093ad96a 100644
--- a/src/include/gnunet_transport_application_service.h
+++ b/src/include/gnunet_transport_application_service.h
@@ -36,8 +36,6 @@
36 36
37#include "gnunet_constants.h" 37#include "gnunet_constants.h"
38#include "gnunet_util_lib.h" 38#include "gnunet_util_lib.h"
39#include "gnunet_testing_lib.h"
40#include "gnunet_testing_ng_lib.h"
41 39
42/** 40/**
43 * Handle to the TRANSPORT subsystem for making suggestions about 41 * Handle to the TRANSPORT subsystem for making suggestions about
diff --git a/src/include/gnunet_transport_communication_service.h b/src/include/gnunet_transport_communication_service.h
index 92facb0e0..ea947911f 100644
--- a/src/include/gnunet_transport_communication_service.h
+++ b/src/include/gnunet_transport_communication_service.h
@@ -74,7 +74,7 @@ extern "C" {
74 * @param address where to send the message, human-readable 74 * @param address where to send the message, human-readable
75 * communicator-specific format, 0-terminated, UTF-8 75 * communicator-specific format, 0-terminated, UTF-8
76 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the provided address is 76 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the provided address is
77 * invalid 77 * invalid, #GNUNET_NO if this address is already (beging) connected to.
78 */ 78 */
79typedef int (*GNUNET_TRANSPORT_CommunicatorMqInit) ( 79typedef int (*GNUNET_TRANSPORT_CommunicatorMqInit) (
80 void *cls, 80 void *cls,
diff --git a/src/include/meson.build b/src/include/meson.build
index 3127a6a40..51a8009af 100644
--- a/src/include/meson.build
+++ b/src/include/meson.build
@@ -104,11 +104,11 @@ install_headers(
104 'gnunet_sq_lib.h', 104 'gnunet_sq_lib.h',
105 'gnunet_statistics_service.h', 105 'gnunet_statistics_service.h',
106 'gnunet_strings_lib.h', 106 'gnunet_strings_lib.h',
107 'gnunet_testing_barrier.h',
108 'gnunet_testing_lib.h', 107 'gnunet_testing_lib.h',
109 'gnunet_testing_plugin.h', 108 'gnunet_testing_arm_lib.h',
110 'gnunet_testing_ng_lib.h', 109 'gnunet_testing_core_lib.h',
111 'gnunet_testing_netjail_lib.h', 110 'gnunet_testing_testbed_lib.h',
111 'gnunet_testing_transport_lib.h',
112 'gnunet_time_lib.h', 112 'gnunet_time_lib.h',
113 'gnunet_transport_application_service.h', 113 'gnunet_transport_application_service.h',
114 'gnunet_transport_communication_service.h', 114 'gnunet_transport_communication_service.h',
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index c9871d8c7..89a34b299 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -4,10 +4,11 @@ endif
4 4
5SUBDIRS = \ 5SUBDIRS = \
6 util \ 6 util \
7 hello \
8 block \
9 gnsrecord \
10 curl \ 7 curl \
11 json \ 8 json \
12 sq \ 9 sq \
13 $(POSTGRES_DIR) 10 $(POSTGRES_DIR) \
11 hello \
12 block \
13 gnsrecord \
14 testing
diff --git a/src/lib/gnsrecord/Makefile.am b/src/lib/gnsrecord/Makefile.am
index ab79de900..dc375133e 100644
--- a/src/lib/gnsrecord/Makefile.am
+++ b/src/lib/gnsrecord/Makefile.am
@@ -75,7 +75,6 @@ EXTRA_DIST = \
75test_gnsrecord_lsd0001testvectors_SOURCES = \ 75test_gnsrecord_lsd0001testvectors_SOURCES = \
76 test_gnsrecord_testvectors.c 76 test_gnsrecord_testvectors.c
77test_gnsrecord_lsd0001testvectors_LDADD = \ 77test_gnsrecord_lsd0001testvectors_LDADD = \
78 $(top_builddir)/src/service/testing/libgnunettesting.la \
79 libgnunetgnsrecord.la \ 78 libgnunetgnsrecord.la \
80 $(top_builddir)/src/lib/util/libgnunetutil.la 79 $(top_builddir)/src/lib/util/libgnunetutil.la
81 80
@@ -83,14 +82,12 @@ test_gnsrecord_lsd0001testvectors_LDADD = \
83test_gnsrecord_serialization_SOURCES = \ 82test_gnsrecord_serialization_SOURCES = \
84 test_gnsrecord_serialization.c 83 test_gnsrecord_serialization.c
85test_gnsrecord_serialization_LDADD = \ 84test_gnsrecord_serialization_LDADD = \
86 $(top_builddir)/src/service/testing/libgnunettesting.la \
87 libgnunetgnsrecord.la \ 85 libgnunetgnsrecord.la \
88 $(top_builddir)/src/lib/util/libgnunetutil.la 86 $(top_builddir)/src/lib/util/libgnunetutil.la
89 87
90test_gnsrecord_block_expiration_SOURCES = \ 88test_gnsrecord_block_expiration_SOURCES = \
91 test_gnsrecord_block_expiration.c 89 test_gnsrecord_block_expiration.c
92test_gnsrecord_block_expiration_LDADD = \ 90test_gnsrecord_block_expiration_LDADD = \
93 $(top_builddir)/src/service/testing/libgnunettesting.la \
94 libgnunetgnsrecord.la \ 91 libgnunetgnsrecord.la \
95 $(top_builddir)/src/lib/util/libgnunetutil.la 92 $(top_builddir)/src/lib/util/libgnunetutil.la
96 93
@@ -98,7 +95,6 @@ test_gnsrecord_block_expiration_LDADD = \
98test_gnsrecord_crypto_SOURCES = \ 95test_gnsrecord_crypto_SOURCES = \
99 test_gnsrecord_crypto.c 96 test_gnsrecord_crypto.c
100test_gnsrecord_crypto_LDADD = \ 97test_gnsrecord_crypto_LDADD = \
101 $(top_builddir)/src/service/testing/libgnunettesting.la \
102 libgnunetgnsrecord.la \ 98 libgnunetgnsrecord.la \
103 $(top_builddir)/src/lib/util/libgnunetutil.la 99 $(top_builddir)/src/lib/util/libgnunetutil.la
104 100
@@ -106,6 +102,5 @@ test_gnsrecord_crypto_LDADD = \
106perf_gnsrecord_crypto_SOURCES = \ 102perf_gnsrecord_crypto_SOURCES = \
107 perf_gnsrecord_crypto.c 103 perf_gnsrecord_crypto.c
108perf_gnsrecord_crypto_LDADD = \ 104perf_gnsrecord_crypto_LDADD = \
109 $(top_builddir)/src/service/testing/libgnunettesting.la \
110 libgnunetgnsrecord.la \ 105 libgnunetgnsrecord.la \
111 $(top_builddir)/src/lib/util/libgnunetutil.la 106 $(top_builddir)/src/lib/util/libgnunetutil.la
diff --git a/src/lib/gnsrecord/test_gnsrecord_block_expiration.c b/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
index bc580954e..14b2acd97 100644
--- a/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
+++ b/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
@@ -83,7 +83,8 @@ run (void *cls, char *const *args, const char *cfgfile,
83 rd[1].record_type = TEST_RECORD_TYPE; 83 rd[1].record_type = TEST_RECORD_TYPE;
84 rd[1].data_size = TEST_RECORD_DATALEN; 84 rd[1].data_size = TEST_RECORD_DATALEN;
85 GNUNET_free (tmp_data1); 85 GNUNET_free (tmp_data1);
86 rd[1].data = GNUNET_malloc (TEST_RECORD_DATALEN); 86 tmp_data1 = GNUNET_malloc (TEST_RECORD_DATALEN);
87 rd[1].data = tmp_data1;
87 rd[1].flags = GNUNET_GNSRECORD_RF_SHADOW; 88 rd[1].flags = GNUNET_GNSRECORD_RF_SHADOW;
88 memset ((char *) rd[1].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); 89 memset ((char *) rd[1].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
89 90
diff --git a/src/lib/gnsrecord/test_gnsrecord_testvectors.c b/src/lib/gnsrecord/test_gnsrecord_testvectors.c
index 21a7a83b0..12b9efe56 100644
--- a/src/lib/gnsrecord/test_gnsrecord_testvectors.c
+++ b/src/lib/gnsrecord/test_gnsrecord_testvectors.c
@@ -655,6 +655,7 @@ main ()
655 printf ("FAIL: query does not match:"); 655 printf ("FAIL: query does not match:");
656 printf (" expected: %s", GNUNET_h2s (&expected_query)); 656 printf (" expected: %s", GNUNET_h2s (&expected_query));
657 printf (", was: %s\n", GNUNET_h2s (&query)); 657 printf (", was: %s\n", GNUNET_h2s (&query));
658 GNUNET_free (rrblock);
658 res = 1; 659 res = 1;
659 break; 660 break;
660 } 661 }
@@ -671,6 +672,7 @@ main ()
671 { 672 {
672 printf ("FAIL: Deserialization of RDATA failed\n"); 673 printf ("FAIL: Deserialization of RDATA failed\n");
673 res = 1; 674 res = 1;
675 GNUNET_free (rrblock);
674 break; 676 break;
675 } 677 }
676 expire = GNUNET_GNSRECORD_record_get_expiration_time ( 678 expire = GNUNET_GNSRECORD_record_get_expiration_time (
@@ -681,6 +683,7 @@ main ()
681 (GNUNET_OK != check_derivations_pkey (label, expire, &pub, &tvs[i]))) 683 (GNUNET_OK != check_derivations_pkey (label, expire, &pub, &tvs[i])))
682 { 684 {
683 res = 1; 685 res = 1;
686 GNUNET_free (rrblock);
684 break; 687 break;
685 } 688 }
686 else if ((GNUNET_GNSRECORD_TYPE_EDKEY == ntohl (pub.type)) && 689 else if ((GNUNET_GNSRECORD_TYPE_EDKEY == ntohl (pub.type)) &&
@@ -688,6 +691,7 @@ main ()
688 &tvs[i]))) 691 &tvs[i])))
689 { 692 {
690 res = 1; 693 res = 1;
694 GNUNET_free (rrblock);
691 break; 695 break;
692 } 696 }
693 if (GNUNET_OK != GNUNET_GNSRECORD_block_decrypt (rrblock, 697 if (GNUNET_OK != GNUNET_GNSRECORD_block_decrypt (rrblock,
@@ -698,10 +702,14 @@ main ()
698 { 702 {
699 printf ("FAIL: Decryption of RRBLOCK failed\n"); 703 printf ("FAIL: Decryption of RRBLOCK failed\n");
700 res = 1; 704 res = 1;
705 GNUNET_free (rrblock);
701 break; 706 break;
702 } 707 }
703 if (0 != res) 708 if (0 != res)
709 {
710 GNUNET_free (rrblock);
704 break; 711 break;
712 }
705 printf ("Good.\n"); 713 printf ("Good.\n");
706 } 714 }
707 return res; 715 return res;
diff --git a/src/lib/json/json_helper.c b/src/lib/json/json_helper.c
index b6965e080..5c2f8ae05 100644
--- a/src/lib/json/json_helper.c
+++ b/src/lib/json/json_helper.c
@@ -26,6 +26,7 @@
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_json_lib.h" 28#include "gnunet_json_lib.h"
29#include "gnunet_common.h"
29 30
30 31
31struct GNUNET_JSON_Specification 32struct GNUNET_JSON_Specification
@@ -42,6 +43,29 @@ GNUNET_JSON_spec_end ()
42 43
43 44
44/** 45/**
46 * Convert string value to numeric cipher value.
47 *
48 * @param cipher_s input string
49 * @return numeric cipher value
50 */
51static enum GNUNET_CRYPTO_BlindSignatureAlgorithm
52string_to_cipher (const char *cipher_s)
53{
54 if ((0 == strcasecmp (cipher_s,
55 "RSA")) ||
56 (0 == strcasecmp (cipher_s,
57 "RSA+age_restricted")))
58 return GNUNET_CRYPTO_BSA_RSA;
59 if ((0 == strcasecmp (cipher_s,
60 "CS")) ||
61 (0 == strcasecmp (cipher_s,
62 "CS+age_restricted")))
63 return GNUNET_CRYPTO_BSA_CS;
64 return GNUNET_CRYPTO_BSA_INVALID;
65}
66
67
68/**
45 * Parse given JSON object to fixed size data 69 * Parse given JSON object to fixed size data
46 * 70 *
47 * @param cls closure, NULL 71 * @param cls closure, NULL
@@ -1180,4 +1204,408 @@ GNUNET_JSON_spec_boolean (const char *name,
1180} 1204}
1181 1205
1182 1206
1207/**
1208 * Parse given JSON object to a blinded message.
1209 *
1210 * @param cls closure, NULL
1211 * @param root the json object representing data
1212 * @param[out] spec where to write the data
1213 * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
1214 */
1215static enum GNUNET_GenericReturnValue
1216parse_blinded_message (void *cls,
1217 json_t *root,
1218 struct GNUNET_JSON_Specification *spec)
1219{
1220 struct GNUNET_CRYPTO_BlindedMessage **target = spec->ptr;
1221 struct GNUNET_CRYPTO_BlindedMessage *blinded_message;
1222 const char *cipher;
1223 struct GNUNET_JSON_Specification dspec[] = {
1224 GNUNET_JSON_spec_string ("cipher",
1225 &cipher),
1226 GNUNET_JSON_spec_end ()
1227 };
1228 const char *emsg;
1229 unsigned int eline;
1230
1231 (void) cls;
1232 if (GNUNET_OK !=
1233 GNUNET_JSON_parse (root,
1234 dspec,
1235 &emsg,
1236 &eline))
1237 {
1238 GNUNET_break_op (0);
1239 return GNUNET_SYSERR;
1240 }
1241 blinded_message = GNUNET_new (struct GNUNET_CRYPTO_BlindedMessage);
1242 blinded_message->rc = 1;
1243 blinded_message->cipher = string_to_cipher (cipher);
1244 switch (blinded_message->cipher)
1245 {
1246 case GNUNET_CRYPTO_BSA_INVALID:
1247 break;
1248 case GNUNET_CRYPTO_BSA_RSA:
1249 {
1250 struct GNUNET_JSON_Specification ispec[] = {
1251 GNUNET_JSON_spec_varsize (
1252 /* TODO: Change this field name to something
1253 more generic / pass in as argument. */
1254 "rsa_blinded_planchet",
1255 &blinded_message->details.rsa_blinded_message.blinded_msg,
1256 &blinded_message->details.rsa_blinded_message.blinded_msg_size),
1257 GNUNET_JSON_spec_end ()
1258 };
1259
1260 if (GNUNET_OK !=
1261 GNUNET_JSON_parse (root,
1262 ispec,
1263 &emsg,
1264 &eline))
1265 {
1266 GNUNET_break_op (0);
1267 GNUNET_free (blinded_message);
1268 return GNUNET_SYSERR;
1269 }
1270 *target = blinded_message;
1271 return GNUNET_OK;
1272 }
1273 case GNUNET_CRYPTO_BSA_CS:
1274 {
1275 struct GNUNET_JSON_Specification ispec[] = {
1276 GNUNET_JSON_spec_fixed_auto (
1277 "cs_nonce",
1278 &blinded_message->details.cs_blinded_message.nonce),
1279 GNUNET_JSON_spec_fixed_auto (
1280 "cs_blinded_c0",
1281 &blinded_message->details.cs_blinded_message.c[0]),
1282 GNUNET_JSON_spec_fixed_auto (
1283 "cs_blinded_c1",
1284 &blinded_message->details.cs_blinded_message.c[1]),
1285 GNUNET_JSON_spec_end ()
1286 };
1287
1288 if (GNUNET_OK !=
1289 GNUNET_JSON_parse (root,
1290 ispec,
1291 &emsg,
1292 &eline))
1293 {
1294 GNUNET_break_op (0);
1295 GNUNET_free (blinded_message);
1296 return GNUNET_SYSERR;
1297 }
1298 *target = blinded_message;
1299 return GNUNET_OK;
1300 }
1301 }
1302 GNUNET_break_op (0);
1303 GNUNET_free (blinded_message);
1304 return GNUNET_SYSERR;
1305}
1306
1307/**
1308 * Cleanup data left from parsing blinded message.
1309 *
1310 * @param cls closure, NULL
1311 * @param[out] spec where to free the data
1312 */
1313static void
1314clean_blinded_message (void *cls,
1315 struct GNUNET_JSON_Specification *spec)
1316{
1317 struct GNUNET_CRYPTO_BlindedMessage **blinded_message = spec->ptr;
1318
1319 (void) cls;
1320 if (NULL != blinded_message)
1321 {
1322 GNUNET_CRYPTO_blinded_message_decref (*blinded_message);
1323 *blinded_message = NULL;
1324 }
1325}
1326
1327
1328struct GNUNET_JSON_Specification
1329GNUNET_JSON_spec_blinded_message (const char *name,
1330 struct GNUNET_CRYPTO_BlindedMessage **msg)
1331{
1332 struct GNUNET_JSON_Specification ret = {
1333 .parser = &parse_blinded_message,
1334 .cleaner = &clean_blinded_message,
1335 .cls = NULL,
1336 .field = name,
1337 .ptr = msg,
1338 .ptr_size = 0,
1339 .size_ptr = NULL
1340 };
1341
1342 *msg = NULL;
1343 return ret;
1344}
1345
1346
1347/**
1348 * Parse given JSON object to a blinded signature.
1349 *
1350 * @param cls closure, NULL
1351 * @param root the json object representing data
1352 * @param[out] spec where to write the data
1353 * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
1354 */
1355static enum GNUNET_GenericReturnValue
1356parse_blinded_sig (void *cls,
1357 json_t *root,
1358 struct GNUNET_JSON_Specification *spec)
1359{
1360 struct GNUNET_CRYPTO_BlindedSignature **target = spec->ptr;
1361 struct GNUNET_CRYPTO_BlindedSignature *blinded_sig;
1362 const char *cipher;
1363 struct GNUNET_JSON_Specification dspec[] = {
1364 GNUNET_JSON_spec_string ("cipher",
1365 &cipher),
1366 GNUNET_JSON_spec_end ()
1367 };
1368 const char *emsg;
1369 unsigned int eline;
1370
1371 (void) cls;
1372 if (GNUNET_OK !=
1373 GNUNET_JSON_parse (root,
1374 dspec,
1375 &emsg,
1376 &eline))
1377 {
1378 GNUNET_break_op (0);
1379 return GNUNET_SYSERR;
1380 }
1381 blinded_sig = GNUNET_new (struct GNUNET_CRYPTO_BlindedSignature);
1382 blinded_sig->cipher = string_to_cipher (cipher);
1383 blinded_sig->rc = 1;
1384 switch (blinded_sig->cipher)
1385 {
1386 case GNUNET_CRYPTO_BSA_INVALID:
1387 break;
1388 case GNUNET_CRYPTO_BSA_RSA:
1389 {
1390 struct GNUNET_JSON_Specification ispec[] = {
1391 GNUNET_JSON_spec_rsa_signature (
1392 "blinded_rsa_signature",
1393 &blinded_sig->details.blinded_rsa_signature),
1394 GNUNET_JSON_spec_end ()
1395 };
1396
1397 if (GNUNET_OK !=
1398 GNUNET_JSON_parse (root,
1399 ispec,
1400 &emsg,
1401 &eline))
1402 {
1403 GNUNET_break_op (0);
1404 GNUNET_free (blinded_sig);
1405 return GNUNET_SYSERR;
1406 }
1407 *target = blinded_sig;
1408 return GNUNET_OK;
1409 }
1410 case GNUNET_CRYPTO_BSA_CS:
1411 {
1412 struct GNUNET_JSON_Specification ispec[] = {
1413 GNUNET_JSON_spec_uint32 ("b",
1414 &blinded_sig->details.blinded_cs_answer.b),
1415 GNUNET_JSON_spec_fixed_auto ("s",
1416 &blinded_sig->details.blinded_cs_answer.
1417 s_scalar),
1418 GNUNET_JSON_spec_end ()
1419 };
1420
1421 if (GNUNET_OK !=
1422 GNUNET_JSON_parse (root,
1423 ispec,
1424 &emsg,
1425 &eline))
1426 {
1427 GNUNET_break_op (0);
1428 GNUNET_free (blinded_sig);
1429 return GNUNET_SYSERR;
1430 }
1431 *target = blinded_sig;
1432 return GNUNET_OK;
1433 }
1434 }
1435 GNUNET_break_op (0);
1436 GNUNET_free (blinded_sig);
1437 return GNUNET_SYSERR;
1438}
1439
1440
1441/**
1442 * Cleanup data left from parsing blinded sig.
1443 *
1444 * @param cls closure, NULL
1445 * @param[out] spec where to free the data
1446 */
1447static void
1448clean_blinded_sig (void *cls,
1449 struct GNUNET_JSON_Specification *spec)
1450{
1451 struct GNUNET_CRYPTO_BlindedSignature **b_sig = spec->ptr;
1452
1453 (void) cls;
1454
1455 if (NULL != *b_sig)
1456 {
1457 GNUNET_CRYPTO_blinded_sig_decref (*b_sig);
1458 *b_sig = NULL;
1459 }
1460}
1461
1462
1463struct GNUNET_JSON_Specification
1464GNUNET_JSON_spec_blinded_signature (const char *field,
1465 struct GNUNET_CRYPTO_BlindedSignature **b_sig)
1466{
1467 struct GNUNET_JSON_Specification ret = {
1468 .parser = &parse_blinded_sig,
1469 .cleaner = &clean_blinded_sig,
1470 .field = field,
1471 .ptr = b_sig
1472 };
1473
1474 *b_sig = NULL;
1475 return ret;
1476}
1477
1478/**
1479 * Parse given JSON object to unblinded signature.
1480 *
1481 * @param cls closure, NULL
1482 * @param root the json object representing data
1483 * @param[out] spec where to write the data
1484 * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
1485 */
1486static enum GNUNET_GenericReturnValue
1487parse_unblinded_sig (void *cls,
1488 json_t *root,
1489 struct GNUNET_JSON_Specification *spec)
1490{
1491 struct GNUNET_CRYPTO_UnblindedSignature **target = spec->ptr;
1492 struct GNUNET_CRYPTO_UnblindedSignature *unblinded_sig;
1493 const char *cipher;
1494 struct GNUNET_JSON_Specification dspec[] = {
1495 GNUNET_JSON_spec_string ("cipher",
1496 &cipher),
1497 GNUNET_JSON_spec_end ()
1498 };
1499 const char *emsg;
1500 unsigned int eline;
1501
1502 (void) cls;
1503 if (GNUNET_OK !=
1504 GNUNET_JSON_parse (root,
1505 dspec,
1506 &emsg,
1507 &eline))
1508 {
1509 GNUNET_break_op (0);
1510 return GNUNET_SYSERR;
1511 }
1512 unblinded_sig = GNUNET_new (struct GNUNET_CRYPTO_UnblindedSignature);
1513 unblinded_sig->cipher = string_to_cipher (cipher);
1514 unblinded_sig->rc = 1;
1515 switch (unblinded_sig->cipher)
1516 {
1517 case GNUNET_CRYPTO_BSA_INVALID:
1518 break;
1519 case GNUNET_CRYPTO_BSA_RSA:
1520 {
1521 struct GNUNET_JSON_Specification ispec[] = {
1522 GNUNET_JSON_spec_rsa_signature (
1523 "rsa_signature",
1524 &unblinded_sig->details.rsa_signature),
1525 GNUNET_JSON_spec_end ()
1526 };
1527
1528 if (GNUNET_OK !=
1529 GNUNET_JSON_parse (root,
1530 ispec,
1531 &emsg,
1532 &eline))
1533 {
1534 GNUNET_break_op (0);
1535 GNUNET_free (unblinded_sig);
1536 return GNUNET_SYSERR;
1537 }
1538 *target = unblinded_sig;
1539 return GNUNET_OK;
1540 }
1541 case GNUNET_CRYPTO_BSA_CS:
1542 {
1543 struct GNUNET_JSON_Specification ispec[] = {
1544 GNUNET_JSON_spec_fixed_auto ("cs_signature_r",
1545 &unblinded_sig->details.cs_signature.
1546 r_point),
1547 GNUNET_JSON_spec_fixed_auto ("cs_signature_s",
1548 &unblinded_sig->details.cs_signature.
1549 s_scalar),
1550 GNUNET_JSON_spec_end ()
1551 };
1552
1553 if (GNUNET_OK !=
1554 GNUNET_JSON_parse (root,
1555 ispec,
1556 &emsg,
1557 &eline))
1558 {
1559 GNUNET_break_op (0);
1560 GNUNET_free (unblinded_sig);
1561 return GNUNET_SYSERR;
1562 }
1563 *target = unblinded_sig;
1564 return GNUNET_OK;
1565 }
1566 }
1567 GNUNET_break_op (0);
1568 GNUNET_free (unblinded_sig);
1569 return GNUNET_SYSERR;
1570}
1571
1572
1573/**
1574 * Cleanup data left from parsing unblinded signature.
1575 *
1576 * @param cls closure, NULL
1577 * @param[out] spec where to free the data
1578 */
1579static void
1580clean_unblinded_sig (void *cls,
1581 struct GNUNET_JSON_Specification *spec)
1582{
1583 struct GNUNET_CRYPTO_UnblindedSignature **ub_sig = spec->ptr;
1584
1585 (void) cls;
1586 if (NULL != *ub_sig)
1587 {
1588 GNUNET_CRYPTO_unblinded_sig_decref (*ub_sig);
1589 *ub_sig = NULL;
1590 }
1591}
1592
1593
1594struct GNUNET_JSON_Specification
1595GNUNET_JSON_spec_unblinded_signature (const char *field,
1596 struct GNUNET_CRYPTO_UnblindedSignature **ub_sig)
1597{
1598 struct GNUNET_JSON_Specification ret = {
1599 .parser = &parse_unblinded_sig,
1600 .cleaner = &clean_unblinded_sig,
1601 .field = field,
1602 .ptr = ub_sig
1603 };
1604
1605 *ub_sig = NULL;
1606 return ret;
1607}
1608
1609
1610
1183/* end of json_helper.c */ 1611/* end of json_helper.c */
diff --git a/src/lib/json/json_pack.c b/src/lib/json/json_pack.c
index 18487c3f4..d298e6efe 100644
--- a/src/lib/json/json_pack.c
+++ b/src/lib/json/json_pack.c
@@ -25,7 +25,6 @@
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_json_lib.h" 26#include "gnunet_json_lib.h"
27 27
28
29json_t * 28json_t *
30GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[]) 29GNUNET_JSON_pack_ (struct GNUNET_JSON_PackSpec spec[])
31{ 30{
@@ -364,4 +363,118 @@ GNUNET_JSON_pack_rsa_signature (const char *name,
364} 363}
365 364
366 365
366struct GNUNET_JSON_PackSpec
367GNUNET_JSON_pack_unblinded_signature (const char *name,
368 const struct GNUNET_CRYPTO_UnblindedSignature *sig)
369{
370 struct GNUNET_JSON_PackSpec ps = {
371 .field_name = name
372 };
373
374 if (NULL == sig)
375 return ps;
376
377 switch (sig->cipher)
378 {
379 case GNUNET_CRYPTO_BSA_INVALID:
380 break;
381 case GNUNET_CRYPTO_BSA_RSA:
382 ps.object = GNUNET_JSON_PACK (
383 GNUNET_JSON_pack_string ("cipher",
384 "RSA"),
385 GNUNET_JSON_pack_rsa_signature ("rsa_signature",
386 sig->details.rsa_signature));
387 return ps;
388 case GNUNET_CRYPTO_BSA_CS:
389 ps.object = GNUNET_JSON_PACK (
390 GNUNET_JSON_pack_string ("cipher",
391 "CS"),
392 GNUNET_JSON_pack_data_auto ("cs_signature_r",
393 &sig->details.cs_signature.r_point),
394 GNUNET_JSON_pack_data_auto ("cs_signature_s",
395 &sig->details.cs_signature.s_scalar));
396 return ps;
397 }
398 GNUNET_assert (0);
399 return ps;
400}
401
402
403struct GNUNET_JSON_PackSpec
404GNUNET_JSON_pack_blinded_message (const char *name,
405 const struct GNUNET_CRYPTO_BlindedMessage *msg)
406{
407 struct GNUNET_JSON_PackSpec ps = {
408 .field_name = name,
409 };
410
411 switch (msg->cipher)
412 {
413 case GNUNET_CRYPTO_BSA_INVALID:
414 break;
415 case GNUNET_CRYPTO_BSA_RSA:
416 ps.object = GNUNET_JSON_PACK (
417 GNUNET_JSON_pack_string ("cipher",
418 "RSA"),
419 GNUNET_JSON_pack_data_varsize (
420 "rsa_blinded_planchet",
421 msg->details.rsa_blinded_message.blinded_msg,
422 msg->details.rsa_blinded_message.blinded_msg_size));
423 return ps;
424 case GNUNET_CRYPTO_BSA_CS:
425 ps.object = GNUNET_JSON_PACK (
426 GNUNET_JSON_pack_string ("cipher",
427 "CS"),
428 GNUNET_JSON_pack_data_auto (
429 "cs_nonce",
430 &msg->details.cs_blinded_message.nonce),
431 GNUNET_JSON_pack_data_auto (
432 "cs_blinded_c0",
433 &msg->details.cs_blinded_message.c[0]),
434 GNUNET_JSON_pack_data_auto (
435 "cs_blinded_c1",
436 &msg->details.cs_blinded_message.c[1]));
437 return ps;
438 }
439 GNUNET_assert (0);
440 return ps;
441}
442
443
444struct GNUNET_JSON_PackSpec
445GNUNET_JSON_pack_blinded_sig (
446 const char *name,
447 const struct GNUNET_CRYPTO_BlindedSignature *sig)
448{
449 struct GNUNET_JSON_PackSpec ps = {
450 .field_name = name,
451 };
452
453 if (NULL == sig)
454 return ps;
455 switch (sig->cipher)
456 {
457 case GNUNET_CRYPTO_BSA_INVALID:
458 break;
459 case GNUNET_CRYPTO_BSA_RSA:
460 ps.object = GNUNET_JSON_PACK (
461 GNUNET_JSON_pack_string ("cipher",
462 "RSA"),
463 GNUNET_JSON_pack_rsa_signature ("blinded_rsa_signature",
464 sig->details.blinded_rsa_signature));
465 return ps;
466 case GNUNET_CRYPTO_BSA_CS:
467 ps.object = GNUNET_JSON_PACK (
468 GNUNET_JSON_pack_string ("cipher",
469 "CS"),
470 GNUNET_JSON_pack_uint64 ("b",
471 sig->details.blinded_cs_answer.b),
472 GNUNET_JSON_pack_data_auto ("s",
473 &sig->details.blinded_cs_answer.s_scalar));
474 return ps;
475 }
476 GNUNET_assert (0);
477 return ps;
478}
479
367/* end of json_pack.c */ 480/* end of json_pack.c */
diff --git a/src/lib/meson.build b/src/lib/meson.build
index 41c662a4f..93dbf5c4d 100644
--- a/src/lib/meson.build
+++ b/src/lib/meson.build
@@ -6,3 +6,4 @@ subdir('curl', if_found : [curl_dep])
6subdir('sq', if_found : [sqlite_dep]) 6subdir('sq', if_found : [sqlite_dep])
7subdir('pq', if_found : [pq_dep]) 7subdir('pq', if_found : [pq_dep])
8subdir('gnsrecord') 8subdir('gnsrecord')
9subdir('testing')
diff --git a/src/lib/pq/Makefile.am b/src/lib/pq/Makefile.am
index 1884fc868..299cebccc 100644
--- a/src/lib/pq/Makefile.am
+++ b/src/lib/pq/Makefile.am
@@ -32,7 +32,7 @@ libgnunetpq_la_LIBADD = -lpq \
32libgnunetpq_la_LDFLAGS = \ 32libgnunetpq_la_LDFLAGS = \
33 $(POSTGRESQL_LDFLAGS) \ 33 $(POSTGRESQL_LDFLAGS) \
34 $(GN_LIB_LDFLAGS) \ 34 $(GN_LIB_LDFLAGS) \
35 -version-info 5:0:0 35 -version-info 7:1:2
36 36
37if ENABLE_TEST_RUN 37if ENABLE_TEST_RUN
38AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 38AM_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/lib/pq/meson.build b/src/lib/pq/meson.build
index b94cd012f..ea73f45a1 100644
--- a/src/lib/pq/meson.build
+++ b/src/lib/pq/meson.build
@@ -9,8 +9,8 @@ libgnunetpq_src = ['pq.c',
9 9
10libgnunetpq = library('gnunetpq', 10libgnunetpq = library('gnunetpq',
11 libgnunetpq_src, 11 libgnunetpq_src,
12 soversion: '4', 12 soversion: '5',
13 version: '4.0.0', 13 version: '5.0.0',
14 dependencies: [libgnunetutil_dep, pq_dep], 14 dependencies: [libgnunetutil_dep, pq_dep],
15 include_directories: [incdir, configuration_inc], 15 include_directories: [incdir, configuration_inc],
16 install: true, 16 install: true,
diff --git a/src/lib/pq/pq_query_helper.c b/src/lib/pq/pq_query_helper.c
index 1e2f7a965..913ce9235 100644
--- a/src/lib/pq/pq_query_helper.c
+++ b/src/lib/pq/pq_query_helper.c
@@ -338,6 +338,63 @@ GNUNET_PQ_query_param_uint64 (const uint64_t *x)
338 * @return -1 on error, number of offsets used in @a scratch otherwise 338 * @return -1 on error, number of offsets used in @a scratch otherwise
339 */ 339 */
340static int 340static int
341qconv_int64 (void *cls,
342 const void *data,
343 size_t data_len,
344 void *param_values[],
345 int param_lengths[],
346 int param_formats[],
347 unsigned int param_length,
348 void *scratch[],
349 unsigned int scratch_length)
350{
351 const int64_t *u_hbo = data;
352 int64_t *u_nbo;
353
354 (void) scratch;
355 (void) scratch_length;
356 GNUNET_break (NULL == cls);
357 if (1 != param_length)
358 return -1;
359 u_nbo = GNUNET_new (int64_t);
360 scratch[0] = u_nbo;
361 *u_nbo = GNUNET_htonll (*u_hbo);
362 param_values[0] = (void *) u_nbo;
363 param_lengths[0] = sizeof(int64_t);
364 param_formats[0] = 1;
365 return 1;
366}
367
368
369struct GNUNET_PQ_QueryParam
370GNUNET_PQ_query_param_int64 (const int64_t *x)
371{
372 struct GNUNET_PQ_QueryParam res = {
373 .conv = &qconv_int64,
374 .data = x,
375 .size = sizeof(*x),
376 .num_params = 1
377 };
378
379 return res;
380}
381
382
383/**
384 * Function called to convert input argument into SQL parameters.
385 *
386 * @param cls closure
387 * @param data pointer to input argument
388 * @param data_len number of bytes in @a data (if applicable)
389 * @param[out] param_values SQL data to set
390 * @param[out] param_lengths SQL length data to set
391 * @param[out] param_formats SQL format data to set
392 * @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
393 * @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
394 * @param scratch_length number of entries left in @a scratch
395 * @return -1 on error, number of offsets used in @a scratch otherwise
396 */
397static int
341qconv_rsa_public_key (void *cls, 398qconv_rsa_public_key (void *cls,
342 const void *data, 399 const void *data,
343 size_t data_len, 400 size_t data_len,
@@ -1325,4 +1382,204 @@ GNUNET_PQ_query_param_array_ptrs_timestamp (
1325} 1382}
1326 1383
1327 1384
1385/**
1386 * Function called to convert input argument into SQL parameters.
1387 *
1388 * @param cls closure
1389 * @param data pointer to input argument
1390 * @param data_len number of bytes in @a data (if applicable)
1391 * @param[out] param_values SQL data to set
1392 * @param[out] param_lengths SQL length data to set
1393 * @param[out] param_formats SQL format data to set
1394 * @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
1395 * @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
1396 * @param scratch_length number of entries left in @a scratch
1397 * @return -1 on error, number of offsets used in @a scratch otherwise
1398 */
1399static int
1400qconv_blind_sign_pub (void *cls,
1401 const void *data,
1402 size_t data_len,
1403 void *param_values[],
1404 int param_lengths[],
1405 int param_formats[],
1406 unsigned int param_length,
1407 void *scratch[],
1408 unsigned int scratch_length)
1409{
1410 const struct GNUNET_CRYPTO_BlindSignPublicKey *public_key = data;
1411 size_t tlen;
1412 size_t len;
1413 uint32_t be;
1414 char *buf;
1415 void *tbuf;
1416
1417 (void) cls;
1418 (void) data_len;
1419 GNUNET_assert (1 == param_length);
1420 GNUNET_assert (scratch_length > 0);
1421 GNUNET_break (NULL == cls);
1422 be = htonl ((uint32_t) public_key->cipher);
1423 switch (public_key->cipher)
1424 {
1425 case GNUNET_CRYPTO_BSA_RSA:
1426 tlen = GNUNET_CRYPTO_rsa_public_key_encode (
1427 public_key->details.rsa_public_key,
1428 &tbuf);
1429 break;
1430 case GNUNET_CRYPTO_BSA_CS:
1431 tlen = sizeof (public_key->details.cs_public_key);
1432 break;
1433 default:
1434 GNUNET_assert (0);
1435 }
1436 len = tlen + sizeof (be);
1437 buf = GNUNET_malloc (len);
1438 GNUNET_memcpy (buf,
1439 &be,
1440 sizeof (be));
1441 switch (public_key->cipher)
1442 {
1443 case GNUNET_CRYPTO_BSA_RSA:
1444 GNUNET_memcpy (&buf[sizeof (be)],
1445 tbuf,
1446 tlen);
1447 GNUNET_free (tbuf);
1448 break;
1449 case GNUNET_CRYPTO_BSA_CS:
1450 GNUNET_memcpy (&buf[sizeof (be)],
1451 &public_key->details.cs_public_key,
1452 tlen);
1453 break;
1454 default:
1455 GNUNET_assert (0);
1456 }
1457
1458 scratch[0] = buf;
1459 param_values[0] = (void *) buf;
1460 param_lengths[0] = len;
1461 param_formats[0] = 1;
1462 return 1;
1463}
1464
1465
1466/**
1467 * Generate query parameter for a blind sign public key of variable size.
1468 *
1469 * @param pub pointer to the query parameter to pass
1470 */
1471struct GNUNET_PQ_QueryParam
1472GNUNET_PQ_query_param_blind_sign_pub (
1473 const struct GNUNET_CRYPTO_BlindSignPublicKey *pub)
1474{
1475 struct GNUNET_PQ_QueryParam res = {
1476 .conv = &qconv_blind_sign_pub,
1477 .data = pub,
1478 .num_params = 1
1479 };
1480
1481 return res;
1482}
1483
1484
1485/**
1486 * Function called to convert input argument into SQL parameters.
1487 *
1488 * @param cls closure
1489 * @param data pointer to input argument
1490 * @param data_len number of bytes in @a data (if applicable)
1491 * @param[out] param_values SQL data to set
1492 * @param[out] param_lengths SQL length data to set
1493 * @param[out] param_formats SQL format data to set
1494 * @param param_length number of entries available in the @a param_values, @a param_lengths and @a param_formats arrays
1495 * @param[out] scratch buffer for dynamic allocations (to be done via #GNUNET_malloc()
1496 * @param scratch_length number of entries left in @a scratch
1497 * @return -1 on error, number of offsets used in @a scratch otherwise
1498 */
1499static int
1500qconv_blind_sign_priv (void *cls,
1501 const void *data,
1502 size_t data_len,
1503 void *param_values[],
1504 int param_lengths[],
1505 int param_formats[],
1506 unsigned int param_length,
1507 void *scratch[],
1508 unsigned int scratch_length)
1509{
1510 const struct GNUNET_CRYPTO_BlindSignPrivateKey *private_key = data;
1511 size_t tlen;
1512 size_t len;
1513 uint32_t be;
1514 char *buf;
1515 void *tbuf;
1516
1517 (void) cls;
1518 (void) data_len;
1519 GNUNET_assert (1 == param_length);
1520 GNUNET_assert (scratch_length > 0);
1521 GNUNET_break (NULL == cls);
1522 be = htonl ((uint32_t) private_key->cipher);
1523 switch (private_key->cipher)
1524 {
1525 case GNUNET_CRYPTO_BSA_RSA:
1526 tlen = GNUNET_CRYPTO_rsa_private_key_encode (
1527 private_key->details.rsa_private_key,
1528 &tbuf);
1529 break;
1530 case GNUNET_CRYPTO_BSA_CS:
1531 tlen = sizeof (private_key->details.cs_private_key);
1532 break;
1533 default:
1534 GNUNET_assert (0);
1535 }
1536 len = tlen + sizeof (be);
1537 buf = GNUNET_malloc (len);
1538 GNUNET_memcpy (buf,
1539 &be,
1540 sizeof (be));
1541 switch (private_key->cipher)
1542 {
1543 case GNUNET_CRYPTO_BSA_RSA:
1544 GNUNET_memcpy (&buf[sizeof (be)],
1545 tbuf,
1546 tlen);
1547 GNUNET_free (tbuf);
1548 break;
1549 case GNUNET_CRYPTO_BSA_CS:
1550 GNUNET_memcpy (&buf[sizeof (be)],
1551 &private_key->details.cs_private_key,
1552 tlen);
1553 break;
1554 default:
1555 GNUNET_assert (0);
1556 }
1557
1558 scratch[0] = buf;
1559 param_values[0] = (void *) buf;
1560 param_lengths[0] = len;
1561 param_formats[0] = 1;
1562 return 1;
1563}
1564
1565
1566/**
1567 * Generate query parameter for a blind sign private key of variable size.
1568 *
1569 * @param priv pointer to the query parameter to pass
1570 */
1571struct GNUNET_PQ_QueryParam
1572GNUNET_PQ_query_param_blind_sign_priv (
1573 const struct GNUNET_CRYPTO_BlindSignPrivateKey *priv)
1574{
1575 struct GNUNET_PQ_QueryParam res = {
1576 .conv = &qconv_blind_sign_priv,
1577 .data = priv,
1578 .num_params = 1
1579 };
1580
1581 return res;
1582}
1583
1584
1328/* end of pq_query_helper.c */ 1585/* end of pq_query_helper.c */
diff --git a/src/lib/pq/pq_result_helper.c b/src/lib/pq/pq_result_helper.c
index f230826cb..c7d7f9abd 100644
--- a/src/lib/pq/pq_result_helper.c
+++ b/src/lib/pq/pq_result_helper.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2014, 2015, 2016, 2020 GNUnet e.V. 3 Copyright (C) 2014-2024 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -1122,6 +1122,90 @@ GNUNET_PQ_result_spec_uint64 (const char *name,
1122 1122
1123 1123
1124/** 1124/**
1125 * Extract data from a Postgres database @a result at row @a row.
1126 *
1127 * @param cls closure
1128 * @param result where to extract data from
1129 * @param row row to extract data from
1130 * @param fname name (or prefix) of the fields to extract from
1131 * @param[in,out] dst_size where to store size of result, may be NULL
1132 * @param[out] dst where to store the result
1133 * @return
1134 * #GNUNET_YES if all results could be extracted
1135 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
1136 */
1137static enum GNUNET_GenericReturnValue
1138extract_int64 (void *cls,
1139 PGresult *result,
1140 int row,
1141 const char *fname,
1142 size_t *dst_size,
1143 void *dst)
1144{
1145 int64_t *udst = dst;
1146 const int64_t *res;
1147 int fnum;
1148
1149 (void) cls;
1150 fnum = PQfnumber (result,
1151 fname);
1152 if (fnum < 0)
1153 {
1154 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1155 "Field %s missing in result\n",
1156 fname);
1157 GNUNET_break (0);
1158 return GNUNET_SYSERR;
1159 }
1160 if (PQgetisnull (result,
1161 row,
1162 fnum))
1163 return GNUNET_NO;
1164
1165 GNUNET_assert (NULL != dst);
1166 if (sizeof(int64_t) != *dst_size)
1167 {
1168 GNUNET_break (0);
1169 return GNUNET_SYSERR;
1170 }
1171 if (sizeof(int64_t) !=
1172 PQgetlength (result,
1173 row,
1174 fnum))
1175 {
1176 GNUNET_break (0);
1177 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1178 "Got length %u for field `%s'\n",
1179 PQgetlength (result,
1180 row,
1181 fnum),
1182 fname);
1183 return GNUNET_SYSERR;
1184 }
1185 res = (int64_t *) PQgetvalue (result,
1186 row,
1187 fnum);
1188 *udst = GNUNET_ntohll (*res);
1189 return GNUNET_OK;
1190}
1191
1192
1193struct GNUNET_PQ_ResultSpec
1194GNUNET_PQ_result_spec_int64 (const char *name,
1195 int64_t *i64)
1196{
1197 struct GNUNET_PQ_ResultSpec res = {
1198 .conv = &extract_int64,
1199 .dst = (void *) i64,
1200 .dst_size = sizeof(*i64),
1201 .fname = name
1202 };
1203
1204 return res;
1205}
1206
1207
1208/**
1125 * Closure for the array result specifications. Contains type information 1209 * Closure for the array result specifications. Contains type information
1126 * for the generic parser extract_array_generic and out-pointers for the results. 1210 * for the generic parser extract_array_generic and out-pointers for the results.
1127 */ 1211 */
@@ -1193,9 +1277,22 @@ extract_array_generic (
1193 1277
1194 data_sz = PQgetlength (result, row, col_num); 1278 data_sz = PQgetlength (result, row, col_num);
1195 FAIL_IF (0 > data_sz); 1279 FAIL_IF (0 > data_sz);
1196 FAIL_IF (sizeof(header) > (size_t) data_sz);
1197
1198 data = PQgetvalue (result, row, col_num); 1280 data = PQgetvalue (result, row, col_num);
1281 if (sizeof(header) > (size_t) data_sz)
1282 {
1283 uint32_t ndim;
1284
1285 /* data_sz is shorter than header if the
1286 array length is 0, in which case ndim is 0! */
1287 FAIL_IF (sizeof(uint32_t) > (size_t) data_sz);
1288 memcpy (&ndim,
1289 data,
1290 sizeof (ndim));
1291 FAIL_IF (0 != ndim);
1292 *info->num = 0;
1293 return GNUNET_OK;
1294 }
1295 FAIL_IF (sizeof(header) > (size_t) data_sz);
1199 FAIL_IF (NULL == data); 1296 FAIL_IF (NULL == data);
1200 1297
1201 { 1298 {
@@ -1307,7 +1404,8 @@ extract_array_generic (
1307 case array_of_rel_time: 1404 case array_of_rel_time:
1308 if (NULL != dst_size) 1405 if (NULL != dst_size)
1309 *dst_size = sizeof(struct GNUNET_TIME_Relative) * (header.dim); 1406 *dst_size = sizeof(struct GNUNET_TIME_Relative) * (header.dim);
1310 out = GNUNET_new_array (header.dim, struct GNUNET_TIME_Relative); 1407 out = GNUNET_new_array (header.dim,
1408 struct GNUNET_TIME_Relative);
1311 *((void **) dst) = out; 1409 *((void **) dst) = out;
1312 for (uint32_t i = 0; i < header.dim; i++) 1410 for (uint32_t i = 0; i < header.dim; i++)
1313 { 1411 {
@@ -1324,7 +1422,8 @@ extract_array_generic (
1324 case array_of_timestamp: 1422 case array_of_timestamp:
1325 if (NULL != dst_size) 1423 if (NULL != dst_size)
1326 *dst_size = sizeof(struct GNUNET_TIME_Timestamp) * (header.dim); 1424 *dst_size = sizeof(struct GNUNET_TIME_Timestamp) * (header.dim);
1327 out = GNUNET_new_array (header.dim, struct GNUNET_TIME_Timestamp); 1425 out = GNUNET_new_array (header.dim,
1426 struct GNUNET_TIME_Timestamp);
1328 *((void **) dst) = out; 1427 *((void **) dst) = out;
1329 for (uint32_t i = 0; i < header.dim; i++) 1428 for (uint32_t i = 0; i < header.dim; i++)
1330 { 1429 {
@@ -1711,4 +1810,276 @@ GNUNET_PQ_result_spec_array_string (
1711} 1810}
1712 1811
1713 1812
1813/**
1814 * Extract data from a Postgres database @a result at row @a row.
1815 *
1816 * @param cls closure
1817 * @param result where to extract data from
1818 * @param row the row to extract data from
1819 * @param fname name (or prefix) of the fields to extract from
1820 * @param[in,out] dst_size where to store size of result, may be NULL
1821 * @param[out] dst where to store the result
1822 * @return
1823 * #GNUNET_YES if all results could be extracted
1824 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
1825 */
1826static enum GNUNET_GenericReturnValue
1827extract_blind_sign_pub (void *cls,
1828 PGresult *result,
1829 int row,
1830 const char *fname,
1831 size_t *dst_size,
1832 void *dst)
1833{
1834 struct GNUNET_CRYPTO_BlindSignPublicKey **bpk = dst;
1835 struct GNUNET_CRYPTO_BlindSignPublicKey *tmp;
1836 size_t len;
1837 const char *res;
1838 int fnum;
1839 uint32_t be;
1840
1841 (void) cls;
1842 (void) dst_size;
1843 fnum = PQfnumber (result,
1844 fname);
1845 if (fnum < 0)
1846 {
1847 GNUNET_break (0);
1848 return GNUNET_SYSERR;
1849 }
1850 if (PQgetisnull (result,
1851 row,
1852 fnum))
1853 return GNUNET_NO;
1854
1855 /* if a field is null, continue but
1856 * remember that we now return a different result */
1857 len = PQgetlength (result,
1858 row,
1859 fnum);
1860 res = PQgetvalue (result,
1861 row,
1862 fnum);
1863 if (len < sizeof (be))
1864 {
1865 GNUNET_break (0);
1866 return GNUNET_SYSERR;
1867 }
1868 GNUNET_memcpy (&be,
1869 res,
1870 sizeof (be));
1871 res += sizeof (be);
1872 len -= sizeof (be);
1873 tmp = GNUNET_new (struct GNUNET_CRYPTO_BlindSignPublicKey);
1874 tmp->cipher = ntohl (be);
1875 tmp->rc = 1;
1876 switch (tmp->cipher)
1877 {
1878 case GNUNET_CRYPTO_BSA_INVALID:
1879 break;
1880 case GNUNET_CRYPTO_BSA_RSA:
1881 tmp->details.rsa_public_key
1882 = GNUNET_CRYPTO_rsa_public_key_decode (res,
1883 len);
1884 if (NULL == tmp->details.rsa_public_key)
1885 {
1886 GNUNET_break (0);
1887 GNUNET_free (tmp);
1888 return GNUNET_SYSERR;
1889 }
1890 GNUNET_CRYPTO_hash (res,
1891 len,
1892 &tmp->pub_key_hash);
1893 *bpk = tmp;
1894 return GNUNET_OK;
1895 case GNUNET_CRYPTO_BSA_CS:
1896 if (sizeof (tmp->details.cs_public_key) != len)
1897 {
1898 GNUNET_break (0);
1899 GNUNET_free (tmp);
1900 return GNUNET_SYSERR;
1901 }
1902 GNUNET_memcpy (&tmp->details.cs_public_key,
1903 res,
1904 len);
1905 GNUNET_CRYPTO_hash (res,
1906 len,
1907 &tmp->pub_key_hash);
1908 *bpk = tmp;
1909 return GNUNET_OK;
1910 }
1911 GNUNET_break (0);
1912 GNUNET_free (tmp);
1913 return GNUNET_SYSERR;
1914}
1915
1916
1917/**
1918 * Function called to clean up memory allocated
1919 * by a #GNUNET_PQ_ResultConverter.
1920 *
1921 * @param cls closure
1922 * @param rd result data to clean up
1923 */
1924static void
1925clean_blind_sign_pub (void *cls,
1926 void *rd)
1927{
1928 struct GNUNET_CRYPTO_BlindSignPublicKey **pub = rd;
1929
1930 (void) cls;
1931 GNUNET_CRYPTO_blind_sign_pub_decref (*pub);
1932 *pub = NULL;
1933}
1934
1935
1936struct GNUNET_PQ_ResultSpec
1937GNUNET_PQ_result_spec_blind_sign_pub (const char *name,
1938 struct GNUNET_CRYPTO_BlindSignPublicKey **
1939 pub)
1940{
1941 struct GNUNET_PQ_ResultSpec res = {
1942 .conv = &extract_blind_sign_pub,
1943 .cleaner = &clean_blind_sign_pub,
1944 .dst = (void *) pub,
1945 .fname = name
1946 };
1947
1948 return res;
1949}
1950
1951
1952/**
1953 * Extract data from a Postgres database @a result at row @a row.
1954 *
1955 * @param cls closure
1956 * @param result where to extract data from
1957 * @param row the row to extract data from
1958 * @param fname name (or prefix) of the fields to extract from
1959 * @param[in,out] dst_size where to store size of result, may be NULL
1960 * @param[out] dst where to store the result
1961 * @return
1962 * #GNUNET_YES if all results could be extracted
1963 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
1964 */
1965static enum GNUNET_GenericReturnValue
1966extract_blind_sign_priv (void *cls,
1967 PGresult *result,
1968 int row,
1969 const char *fname,
1970 size_t *dst_size,
1971 void *dst)
1972{
1973 struct GNUNET_CRYPTO_BlindSignPrivateKey **bpk = dst;
1974 struct GNUNET_CRYPTO_BlindSignPrivateKey *tmp;
1975 size_t len;
1976 const char *res;
1977 int fnum;
1978 uint32_t be;
1979
1980 (void) cls;
1981 (void) dst_size;
1982 fnum = PQfnumber (result,
1983 fname);
1984 if (fnum < 0)
1985 {
1986 GNUNET_break (0);
1987 return GNUNET_SYSERR;
1988 }
1989 if (PQgetisnull (result,
1990 row,
1991 fnum))
1992 return GNUNET_NO;
1993
1994 /* if a field is null, continue but
1995 * remember that we now return a different result */
1996 len = PQgetlength (result,
1997 row,
1998 fnum);
1999 res = PQgetvalue (result,
2000 row,
2001 fnum);
2002 if (len < sizeof (be))
2003 {
2004 GNUNET_break (0);
2005 return GNUNET_SYSERR;
2006 }
2007 GNUNET_memcpy (&be,
2008 res,
2009 sizeof (be));
2010 res += sizeof (be);
2011 len -= sizeof (be);
2012 tmp = GNUNET_new (struct GNUNET_CRYPTO_BlindSignPrivateKey);
2013 tmp->cipher = ntohl (be);
2014 tmp->rc = 1;
2015 switch (tmp->cipher)
2016 {
2017 case GNUNET_CRYPTO_BSA_INVALID:
2018 break;
2019 case GNUNET_CRYPTO_BSA_RSA:
2020 tmp->details.rsa_private_key
2021 = GNUNET_CRYPTO_rsa_private_key_decode (res,
2022 len);
2023 if (NULL == tmp->details.rsa_private_key)
2024 {
2025 GNUNET_break (0);
2026 GNUNET_free (bpk);
2027 return GNUNET_SYSERR;
2028 }
2029 *bpk = tmp;
2030 return GNUNET_OK;
2031 case GNUNET_CRYPTO_BSA_CS:
2032 if (sizeof (tmp->details.cs_private_key) != len)
2033 {
2034 GNUNET_break (0);
2035 GNUNET_free (tmp);
2036 return GNUNET_SYSERR;
2037 }
2038 GNUNET_memcpy (&tmp->details.cs_private_key,
2039 res,
2040 len);
2041 *bpk = tmp;
2042 return GNUNET_OK;
2043 }
2044 GNUNET_break (0);
2045 GNUNET_free (tmp);
2046 return GNUNET_SYSERR;
2047}
2048
2049
2050/**
2051 * Function called to clean up memory allocated
2052 * by a #GNUNET_PQ_ResultConverter.
2053 *
2054 * @param cls closure
2055 * @param rd result data to clean up
2056 */
2057static void
2058clean_blind_sign_priv (void *cls,
2059 void *rd)
2060{
2061 struct GNUNET_CRYPTO_BlindSignPrivateKey **priv = rd;
2062
2063 (void) cls;
2064 GNUNET_CRYPTO_blind_sign_priv_decref (*priv);
2065 *priv = NULL;
2066}
2067
2068
2069struct GNUNET_PQ_ResultSpec
2070GNUNET_PQ_result_spec_blind_sign_priv (const char *name,
2071 struct GNUNET_CRYPTO_BlindSignPrivateKey
2072 **priv)
2073{
2074 struct GNUNET_PQ_ResultSpec res = {
2075 .conv = &extract_blind_sign_priv,
2076 .cleaner = &clean_blind_sign_priv,
2077 .dst = (void *) priv,
2078 .fname = name
2079 };
2080
2081 return res;
2082}
2083
2084
1714/* end of pq_result_helper.c */ 2085/* end of pq_result_helper.c */
diff --git a/src/service/testing/.gitignore b/src/lib/testing/.gitignore
index a1e77a8e4..2e66a9259 100644
--- a/src/service/testing/.gitignore
+++ b/src/lib/testing/.gitignore
@@ -7,3 +7,5 @@ test_testing_portreservation
7test_testing_servicestartup 7test_testing_servicestartup
8test_testing_sharedservices 8test_testing_sharedservices
9gnunet-cmds-helper 9gnunet-cmds-helper
10test_testing_api
11gnunet-testing-netjail-launcher
diff --git a/src/lib/testing/Makefile.am b/src/lib/testing/Makefile.am
new file mode 100644
index 000000000..95fc30f86
--- /dev/null
+++ b/src/lib/testing/Makefile.am
@@ -0,0 +1,92 @@
1# This Makefile.am is in the public domain
2AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4if USE_COVERAGE
5 AM_CFLAGS = --coverage -O0
6 XLIB = -lgcov
7endif
8
9libexecdir= $(pkglibdir)/libexec/
10
11libexec_PROGRAMS = \
12 gnunet-cmds-helper
13
14plugindir = $(libdir)/gnunet
15
16lib_LTLIBRARIES = \
17 libgnunettesting.la
18
19gnunet_cmds_helper_SOURCES = \
20 gnunet-cmds-helper.c testing_cmds.h
21gnunet_cmds_helper_LDADD = $(XLIB) \
22 libgnunettesting.la \
23 $(top_builddir)/src/lib/util/libgnunetutil.la \
24 $(LTLIBINTL)
25
26libgnunettesting_la_SOURCES = \
27 testing_api_barrier.c testing_api_barrier.h \
28 testing_api_cmd_barrier_create.c \
29 testing_api_cmd_barrier_reached.c \
30 testing_api_cmd_batch.c testing_api_cmd_batch.h \
31 testing_api_cmd_exec.c \
32 testing_api_cmd_finish.c \
33 testing_api_cmd_get_topo.c \
34 testing_api_cmd_netjail_start.c \
35 testing_api_cmd_netjail_start_cmds_helper.c \
36 testing_api_cmd_signal.c \
37 testing_api_cmd_stat.c \
38 testing_api_cmds.c testing_cmds.h \
39 testing_api_loop.c testing_api_loop.h \
40 testing_api_main.c \
41 testing_api_traits.c \
42 testing_api_topology.c testing_api_topology.h
43libgnunettesting_la_LIBADD = \
44 $(top_builddir)/src/lib/util/libgnunetutil.la \
45 $(LTLIBINTL)
46libgnunettesting_la_LDFLAGS = \
47 $(GN_LIB_LDFLAGS) \
48 -version-info 3:0:0
49
50AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;
51
52
53bin_PROGRAMS = \
54 gnunet-testing-netjail-launcher
55
56gnunet_testing_netjail_launcher_SOURCES = \
57 gnunet-testing-netjail-launcher.c
58gnunet_testing_netjail_launcher_LDADD = $(XLIB) \
59 libgnunettesting.la \
60 $(top_builddir)/src/lib/util/libgnunetutil.la \
61 $(LTLIBINTL)
62
63check_PROGRAMS = \
64 test_testing_api
65
66check_SCRIPTS = \
67 test_netjail_api.sh
68
69TESTS = \
70 $(check_PROGRAMS) \
71 $(check_SCRIPTS)
72
73test_testing_api_SOURCES = \
74 test_testing_api.c
75test_testing_api_LDADD = \
76 libgnunettesting.la \
77 -lgnunetutil \
78 $(XLIB)
79
80EXTRA_DIST = \
81 $(check_SCRIPTS) \
82 test_netjail_topo.conf
83
84plugin_LTLIBRARIES = \
85 libgnunet_test_testing_plugin_ping.la
86
87libgnunet_test_testing_plugin_ping_la_SOURCES = \
88 test_testing_plugin_ping.c
89libgnunet_test_testing_plugin_ping_la_LIBADD = \
90 libgnunettesting.la \
91 $(top_builddir)/src/lib/util/libgnunetutil.la \
92 $(LTLIBINTL)
diff --git a/src/lib/testing/gnunet-cmds-helper.c b/src/lib/testing/gnunet-cmds-helper.c
new file mode 100644
index 000000000..edbbd8d13
--- /dev/null
+++ b/src/lib/testing/gnunet-cmds-helper.c
@@ -0,0 +1,530 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testbed/gnunet-cmds-helper.c
23 * @brief Helper binary that is started from a remote interpreter loop to start
24 * a local interpreter loop.
25 *
26 * This helper monitors for three termination events. They are: (1)The
27 * stdin of the helper is closed for reading; (2)the helper received
28 * SIGTERM/SIGINT; (3)the local loop crashed. In case of events 1 and 2
29 * the helper kills the interpreter loop. When the interpreter loop
30 * crashed (event 3), the helper should send a SIGTERM to its own process
31 * group; this behaviour will help terminate any child processes the loop
32 * has started and prevents them from leaking and running forever.
33 *
34 * @author t3sserakt
35 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
36 */
37#include "platform.h"
38#include "gnunet_util_lib.h"
39#include "gnunet_testing_lib.h"
40#include "testing_api_loop.h"
41#include "testing_cmds.h"
42#include "testing_api_topology.h"
43
44/**
45 * Generic logging shortcut
46 */
47#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
48
49/**
50 * Debug logging shorthand
51 */
52#define LOG_DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
53
54/**
55 * Context for a single write on a chunk of memory
56 */
57struct WriteContext
58{
59
60 struct WriteContext *next;
61
62 struct WriteContext *prev;
63
64 /**
65 * The data to write
66 */
67 void *data;
68
69 /**
70 * The length of the data
71 */
72 size_t length;
73
74 /**
75 * The current position from where the write operation should begin
76 */
77 size_t pos;
78};
79
80
81static struct WriteContext *wc_head;
82
83static struct WriteContext *wc_tail;
84
85static struct GNUNET_TESTING_Interpreter *is;
86
87static const char *my_node_id;
88
89/**
90 * Plugin to dynamically load a test case.
91 */
92static struct GNUNET_TESTING_PluginFunctions *plugin;
93
94/**
95 * Name of our plugin.
96 */
97static char *plugin_name;
98
99/**
100 * Our message stream tokenizer
101 */
102static struct GNUNET_MessageStreamTokenizer *tokenizer;
103
104/**
105 * Disk handle from stdin
106 */
107static struct GNUNET_DISK_FileHandle *stdin_fd;
108
109/**
110 * Disk handle for stdout
111 */
112static struct GNUNET_DISK_FileHandle *stdout_fd;
113
114/**
115 * Task identifier for the read task
116 */
117static struct GNUNET_SCHEDULER_Task *read_task_id;
118
119/**
120 * Task identifier for the write task
121 */
122static struct GNUNET_SCHEDULER_Task *write_task_id;
123
124/**
125 * Result to return in case we fail
126 */
127static int global_ret;
128
129/**
130 * Set to true once we are finished and should exit
131 * after sending our final message to the parent.
132 */
133static bool finished;
134
135
136/**
137 * Task to shut down cleanly
138 *
139 * @param cls NULL
140 */
141static void
142do_shutdown (void *cls)
143{
144 struct WriteContext *wc;
145
146 if (NULL != read_task_id)
147 {
148 GNUNET_SCHEDULER_cancel (read_task_id);
149 read_task_id = NULL;
150 }
151 if (NULL != write_task_id)
152 {
153 GNUNET_SCHEDULER_cancel (write_task_id);
154 write_task_id = NULL;
155 }
156 while (NULL != (wc = wc_head))
157 {
158 GNUNET_CONTAINER_DLL_remove (wc_head,
159 wc_tail,
160 wc);
161 GNUNET_free (wc->data);
162 GNUNET_free (wc);
163 }
164 if (NULL != tokenizer)
165 {
166 GNUNET_MST_destroy (tokenizer);
167 tokenizer = NULL;
168 }
169 if (NULL != plugin)
170 {
171 GNUNET_PLUGIN_unload (plugin_name,
172 plugin);
173 GNUNET_free (plugin_name);
174 }
175}
176
177
178/**
179 * Task to write to the standard out
180 *
181 * @param cls the WriteContext
182 */
183static void
184write_task (void *cls)
185{
186 struct WriteContext *wc = wc_head;
187 ssize_t bytes_wrote;
188
189 write_task_id = NULL;
190 if (NULL == wc)
191 {
192 if (finished)
193 GNUNET_SCHEDULER_shutdown ();
194 return;
195 }
196 bytes_wrote
197 = GNUNET_DISK_file_write (stdout_fd,
198 wc->data + wc->pos,
199 wc->length - wc->pos);
200 if (GNUNET_SYSERR == bytes_wrote)
201 {
202 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
203 "write");
204 GNUNET_free (wc->data);
205 GNUNET_free (wc);
206 global_ret = EXIT_FAILURE;
207 GNUNET_SCHEDULER_shutdown ();
208 return;
209 }
210 wc->pos += bytes_wrote;
211 if (wc->pos == wc->length)
212 {
213 GNUNET_CONTAINER_DLL_remove (wc_head,
214 wc_tail,
215 wc);
216 GNUNET_free (wc->data);
217 GNUNET_free (wc);
218 }
219 write_task_id
220 = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL,
221 stdout_fd,
222 &write_task,
223 NULL);
224}
225
226
227/**
228 * Callback to write a message to the parent process.
229 *
230 */
231static void
232write_message (const struct GNUNET_MessageHeader *message)
233{
234 struct WriteContext *wc;
235 size_t msg_length = ntohl (message->size);
236
237 wc = GNUNET_new (struct WriteContext);
238 wc->length = msg_length;
239 wc->data = GNUNET_memdup (message,
240 msg_length);
241 GNUNET_CONTAINER_DLL_insert_tail (wc_head,
242 wc_tail,
243 wc);
244 if (NULL == write_task_id)
245 {
246 GNUNET_assert (wc_head == wc);
247 write_task_id
248 = GNUNET_SCHEDULER_add_write_file (
249 GNUNET_TIME_UNIT_FOREVER_REL,
250 stdout_fd,
251 &write_task,
252 NULL);
253 }
254}
255
256
257static void
258finished_cb (void *cls,
259 enum GNUNET_GenericReturnValue rv)
260{
261 struct GNUNET_TESTING_CommandLocalFinished reply = {
262 .header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED),
263 .header.size = htons (sizeof (reply)),
264 .rv = htonl ((uint32_t) rv)
265 };
266
267 (void) cls;
268 finished = true;
269 write_message (&reply.header);
270}
271
272
273static enum GNUNET_GenericReturnValue
274check_helper_init (
275 void *cls,
276 const struct GNUNET_TESTING_CommandHelperInit *msg)
277{
278 uint16_t msize = htons (msg->header.size);
279 uint32_t barrier_count = htonl (msg->barrier_count);
280 size_t bs = barrier_count * sizeof (struct GNUNET_ShortHashCode);
281 size_t left = msize - bs - sizeof (*msg);
282 const struct GNUNET_ShortHashCode *bd
283 = (const struct GNUNET_ShortHashCode *) &msg[1];
284 const char *topo = (const char *) &bd[barrier_count];
285
286 if (msize < bs + sizeof (*msg))
287 {
288 GNUNET_break_op (0);
289 return GNUNET_SYSERR;
290 }
291 if ('\0' != topo[left - 1])
292 {
293 GNUNET_break_op (0);
294 return GNUNET_SYSERR;
295 }
296 return GNUNET_OK;
297}
298
299
300static void
301handle_helper_init (
302 void *cls,
303 const struct GNUNET_TESTING_CommandHelperInit *msg)
304{
305 uint16_t msize = htons (msg->header.size);
306 uint32_t barrier_count = htonl (msg->barrier_count);
307 size_t bs = barrier_count * sizeof (struct GNUNET_ShortHashCode);
308 size_t left = msize - bs - sizeof (*msg);
309 const struct GNUNET_ShortHashCode *bd
310 = (const struct GNUNET_ShortHashCode *) &msg[1];
311 const char *topo = (const char *) &bd[barrier_count];
312 struct GNUNET_TESTING_NetjailTopology *njt;
313
314 GNUNET_assert ('\0' == topo[left - 1]);
315 njt = GNUNET_TESTING_get_topo_from_string_ (topo);
316 if (NULL == njt)
317 {
318 GNUNET_break_op (0);
319 global_ret = EXIT_FAILURE;
320 GNUNET_SCHEDULER_shutdown ();
321 return;
322 }
323 plugin_name = GNUNET_TESTING_get_plugin_from_topo (njt,
324 my_node_id);
325 GNUNET_TESTING_free_topology (njt);
326 plugin = GNUNET_PLUGIN_load (plugin_name,
327 (void *) my_node_id);
328 if (NULL == plugin)
329 {
330 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
331 "Plugin `%s' not found!\n",
332 plugin_name);
333 global_ret = EXIT_FAILURE;
334 GNUNET_SCHEDULER_shutdown ();
335 return;
336 }
337 is = plugin->start_testcase (plugin->cls,
338 topo,
339 barrier_count,
340 bd,
341 &write_message,
342 &finished_cb,
343 NULL);
344}
345
346
347static void
348handle_helper_barrier_crossable (
349 void *cls,
350 const struct GNUNET_TESTING_CommandBarrierSatisfied *cbs)
351{
352 struct GNUNET_TESTING_Barrier *barrier;
353
354 if (NULL == is)
355 {
356 /* Barrier satisfied *before* helper_init?! */
357 GNUNET_break_op (0);
358 global_ret = EXIT_FAILURE;
359 GNUNET_SCHEDULER_shutdown ();
360 return;
361 }
362 barrier = GNUNET_TESTING_get_barrier2_ (is,
363 &cbs->barrier_key);
364 if (barrier->satisfied)
365 {
366 /* Barrier satisfied *twice* is strange... */
367 GNUNET_break_op (0);
368 global_ret = EXIT_FAILURE;
369 GNUNET_SCHEDULER_shutdown ();
370 return;
371 }
372 barrier->satisfied = true;
373 GNUNET_TESTING_loop_notify_children_ (is,
374 &cbs->header);
375 for (unsigned int i = 0; i<barrier->cnt_waiting; i++)
376 GNUNET_TESTING_async_finish (barrier->waiting[i]);
377 GNUNET_array_grow (barrier->waiting,
378 barrier->cnt_waiting,
379 0);
380}
381
382
383/**
384 * Functions with this signature are called whenever a
385 * complete message is received by the tokenizer.
386 *
387 * Do not call #GNUNET_mst_destroy() in this callback
388 *
389 * @param cls identification of the client
390 * @param message the actual message
391 * @return #GNUNET_OK on success,
392 * #GNUNET_NO to stop further processing (no error)
393 * #GNUNET_SYSERR to stop further processing with error
394 */
395static enum GNUNET_GenericReturnValue
396tokenizer_cb (void *cls,
397 const struct GNUNET_MessageHeader *message)
398{
399 struct GNUNET_MQ_MessageHandler handlers[] = {
400 GNUNET_MQ_hd_var_size (
401 helper_init,
402 GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT,
403 struct GNUNET_TESTING_CommandHelperInit,
404 NULL),
405 GNUNET_MQ_hd_fixed_size (
406 helper_barrier_crossable,
407 GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE,
408 struct GNUNET_TESTING_CommandBarrierSatisfied,
409 NULL),
410 GNUNET_MQ_handler_end ()
411 };
412
413 return GNUNET_MQ_handle_message (handlers,
414 message);
415}
416
417
418/**
419 * Task to read from stdin
420 *
421 * @param cls NULL
422 */
423static void
424read_task (void *cls)
425{
426 char buf[GNUNET_MAX_MESSAGE_SIZE];
427 ssize_t sread;
428
429 read_task_id = NULL;
430 sread = GNUNET_DISK_file_read (stdin_fd,
431 buf,
432 sizeof(buf));
433 if (GNUNET_SYSERR == sread)
434 {
435 GNUNET_break (0);
436 global_ret = EXIT_FAILURE;
437 GNUNET_SCHEDULER_shutdown ();
438 return;
439 }
440 if (0 == sread)
441 {
442 LOG_DEBUG ("STDIN eof\n");
443 GNUNET_SCHEDULER_shutdown ();
444 return;
445 }
446 if (GNUNET_OK !=
447 GNUNET_MST_from_buffer (tokenizer,
448 buf,
449 sread,
450 GNUNET_NO,
451 GNUNET_NO))
452 {
453 GNUNET_break (0);
454 global_ret = EXIT_FAILURE;
455 GNUNET_SCHEDULER_shutdown ();
456 return;
457 }
458 read_task_id
459 = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
460 stdin_fd,
461 &read_task,
462 NULL);
463}
464
465
466/**
467 * Main function that will be run.
468 *
469 * @param cls closure
470 * @param args remaining command-line arguments
471 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
472 * @param cfg configuration
473 */
474static void
475run (void *cls,
476 char *const *args,
477 const char *cfgfile,
478 const struct GNUNET_CONFIGURATION_Handle *cfg)
479{
480 if (NULL == args[0])
481 {
482 /* must be called with our node ID as 1st argument */
483 GNUNET_break_op (0);
484 global_ret = EXIT_INVALIDARGUMENT;
485 return;
486 }
487 my_node_id = args[0];
488 tokenizer = GNUNET_MST_create (&tokenizer_cb,
489 NULL);
490 stdin_fd = GNUNET_DISK_get_handle_from_native (stdin);
491 stdout_fd = GNUNET_DISK_get_handle_from_native (stdout);
492 read_task_id = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
493 stdin_fd,
494 &read_task,
495 NULL);
496 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
497 NULL);
498}
499
500
501/**
502 * Main function
503 *
504 * @param argc the number of command line arguments
505 * @param argv command line arg array
506 * @return return code
507 */
508int
509main (int argc,
510 char **argv)
511{
512 struct GNUNET_GETOPT_CommandLineOption options[] = {
513 GNUNET_GETOPT_OPTION_END
514 };
515 enum GNUNET_GenericReturnValue ret;
516
517 ret = GNUNET_PROGRAM_run (argc,
518 argv,
519 "gnunet-cmds-helper",
520 "Helper for starting a local interpreter loop",
521 options,
522 &run,
523 NULL);
524 if (GNUNET_OK != ret)
525 return 1;
526 return global_ret;
527}
528
529
530/* end of gnunet-cmds-helper.c */
diff --git a/src/lib/testing/gnunet-testing-netjail-launcher.c b/src/lib/testing/gnunet-testing-netjail-launcher.c
new file mode 100644
index 000000000..2d425207e
--- /dev/null
+++ b/src/lib/testing/gnunet-testing-netjail-launcher.c
@@ -0,0 +1,87 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/gnunet-testing-netjail-launcher.c
23 * @brief Generic program to start testcases in an configurable topology.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_testing_lib.h"
28#include "gnunet_util_lib.h"
29
30#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
31
32int
33main (int argc,
34 char *const *argv)
35{
36 char *filename = NULL;
37 char *topology_data = NULL;
38
39 GNUNET_log_setup ("test-netjail",
40 "INFO",
41 NULL);
42 if (NULL == argv[1])
43 {
44 GNUNET_break (0);
45 return EXIT_FAILURE;
46 }
47 if (0 == strcmp ("-s", argv[1]))
48 {
49 topology_data = argv[2];
50 if (NULL == topology_data)
51 {
52 GNUNET_break (0);
53 return EXIT_FAILURE;
54 }
55 }
56 else
57 {
58 filename = argv[1];
59 }
60 {
61 struct GNUNET_TESTING_Command commands[] = {
62 NULL == filename
63 ? GNUNET_TESTING_cmd_load_topology_from_string (
64 "load-topology",
65 topology_data)
66 : GNUNET_TESTING_cmd_load_topology_from_file (
67 "load-topology",
68 filename),
69#if FUTURE
70 GNUNET_TESTING_cmd_barrier_create ("peers-started-barrier",
71 NUM_PEERS),
72#endif
73 GNUNET_TESTING_cmd_netjail_setup (
74 "netjail-start",
75 GNUNET_TESTING_NETJAIL_START_SCRIPT,
76 "load-topology"),
77 GNUNET_TESTING_cmd_netjail_start_helpers (
78 "netjail-start-testbed",
79 "load-topology",
80 TIMEOUT),
81 GNUNET_TESTING_cmd_end ()
82 };
83
84 return GNUNET_TESTING_main (commands,
85 TIMEOUT);
86 }
87}
diff --git a/src/lib/testing/meson.build b/src/lib/testing/meson.build
new file mode 100644
index 000000000..83f69b74a
--- /dev/null
+++ b/src/lib/testing/meson.build
@@ -0,0 +1,38 @@
1libgnunettesting_src = [
2 'testing_api_barrier.c',
3 'testing_api_cmd_barrier_create.c',
4 'testing_api_cmd_barrier_reached.c',
5 'testing_api_cmd_batch.c',
6 'testing_api_cmd_exec.c',
7 'testing_api_cmd_finish.c',
8 'testing_api_cmd_get_topo.c',
9 'testing_api_cmd_netjail_start.c',
10 'testing_api_cmd_netjail_start_cmds_helper.c',
11 'testing_api_cmds.c',
12 'testing_api_loop.c',
13 'testing_api_main.c',
14 'testing_api_traits.c',
15 'testing_api_topology.c'
16 ]
17
18libgnunettesting = library('gnunettesting',
19 libgnunettesting_src,
20 soversion: '1',
21 version: '1.1.0',
22 dependencies: [libgnunetutil_dep,
23 m_dep],
24 include_directories: [incdir, configuration_inc],
25 install: true,
26 install_dir: get_option('libdir'))
27libgnunettesting_dep = declare_dependency(link_with : libgnunettesting)
28pkg.generate(libgnunettesting, url: 'https://www.gnunet.org',
29 description : 'Provides API for gnunet testing')
30
31executable ('gnunet-cmds-helper',
32 ['gnunet-cmds-helper.c'],
33 dependencies: [libgnunettesting_dep,
34 libgnunetutil_dep,
35 ],
36 include_directories: [incdir, configuration_inc],
37 install: true,
38 install_dir: get_option('libdir')/'gnunet'/'libexec')
diff --git a/src/lib/testing/test_netjail_api.sh b/src/lib/testing/test_netjail_api.sh
new file mode 100755
index 000000000..d9cb35c28
--- /dev/null
+++ b/src/lib/testing/test_netjail_api.sh
@@ -0,0 +1,2 @@
1#!/bin/bash
2exec ../../../scripts/netjail/netjail_test_master.sh gnunet-testing-netjail-launcher test_netjail_topo.conf # --num-peers=2
diff --git a/src/lib/testing/test_netjail_topo.conf b/src/lib/testing/test_netjail_topo.conf
new file mode 100644
index 000000000..4bb0e6b6c
--- /dev/null
+++ b/src/lib/testing/test_netjail_topo.conf
@@ -0,0 +1,12 @@
1[DEFAULTS]
2SUBNETS =
3CARRIER_SETUP_PROGRAMMS = iptables -A INPUT -p icmp -j DROP;tc qdisc add dev $UPLINK root netm delay 100ms 10ms;
4SUBNET_SETUP_PROGRAMMS = iptables -A INPUT -p icmp -j DROP;tc qdisc add dev $UPLINK root netm delay 100ms 10ms;
5PEER_SETUP_PROGRAMMS = iptables -A INPUT -p icmp -j DROP;tc qdisc add dev $UPLINK root netm delay 100ms 10ms;
6TESTBED_PLUGIN = ping
7CARRIER_PEERS = 1
8SUBNET_PEERS = 1
9
10[BACKBONE]
11CARRIERS = 1
12BACKBONE_PEERS = 1 \ No newline at end of file
diff --git a/src/lib/testing/test_testing_api.c b/src/lib/testing/test_testing_api.c
new file mode 100644
index 000000000..2a5b614fd
--- /dev/null
+++ b/src/lib/testing/test_testing_api.c
@@ -0,0 +1,130 @@
1/*
2 This file is part of GNUNET
3 Copyright (C) 2016-2024 GNUnet e.V.
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 3,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with GNUnet; see the file COPYING. If not,
17 see <http://www.gnu.org/licenses/>
18*/
19/**
20 * @file testing/test_testing_api.c
21 * @brief testcase to test the testing framework
22 * @author Christian Grothoff
23 */
24#include "platform.h"
25#include "gnunet_util_lib.h"
26#include "gnunet_testing_lib.h"
27
28
29int
30main (int argc,
31 char *const *argv)
32{
33 struct GNUNET_TESTING_Timer timers[] = {
34 { .prefix = "batch" },
35 { .prefix = NULL }
36 };
37 struct GNUNET_TESTING_Command batch[] = {
38 GNUNET_TESTING_cmd_exec_va ("batch-echo-once",
39 GNUNET_OS_PROCESS_EXITED,
40 0,
41 "echo",
42 "-n",
43 "LI",
44 NULL),
45 GNUNET_TESTING_cmd_exec_va ("batch-echo",
46 GNUNET_OS_PROCESS_EXITED,
47 0,
48 "echo",
49 "-n",
50 "LA",
51 NULL),
52 GNUNET_TESTING_cmd_end ()
53 };
54 struct GNUNET_TESTING_Command netjail[] = {
55 GNUNET_TESTING_cmd_load_topology_from_string (
56 "load-topology",
57 ""), // try "M"
58 GNUNET_TESTING_cmd_end ()
59 };
60 struct GNUNET_TESTING_Command commands[] = {
61 GNUNET_TESTING_cmd_batch ("batch",
62 batch),
63 GNUNET_TESTING_cmd_rewind_ip ("rewind",
64 "batch-echo-once",
65 2),
66 GNUNET_TESTING_cmd_barrier_create ("barrier",
67 1),
68 GNUNET_TESTING_cmd_barrier_reached ("barrier-reached",
69 "barrier"),
70 GNUNET_TESTING_cmd_barrier_create ("barrier3",
71 3),
72 GNUNET_TESTING_cmd_make_unblocking (
73 GNUNET_TESTING_cmd_barrier_reached ("barrier3a-reached-nonblocking",
74 "barrier3")),
75 GNUNET_TESTING_cmd_make_unblocking (
76 GNUNET_TESTING_cmd_barrier_reached ("barrier3b-reached-nonblocking",
77 "barrier3")),
78 GNUNET_TESTING_cmd_barrier_reached ("barrier3c-reached-blocking",
79 "barrier3"),
80 GNUNET_TESTING_cmd_finish ("barrier3a-reached-nonblocking-finish",
81 "barrier3a-reached-nonblocking",
82 GNUNET_TIME_UNIT_SECONDS),
83 GNUNET_TESTING_cmd_finish ("barrier3b-reached-nonblocking-finish",
84 "barrier3b-reached-nonblocking",
85 GNUNET_TIME_UNIT_SECONDS),
86 GNUNET_TESTING_cmd_stat ("stat",
87 timers),
88 GNUNET_TESTING_cmd_exec_va ("sleep",
89 GNUNET_OS_PROCESS_EXITED,
90 0,
91 "sleep",
92 "0.01",
93 NULL),
94 GNUNET_TESTING_cmd_make_unblocking (
95 GNUNET_TESTING_cmd_exec_va ("sleep",
96 GNUNET_OS_PROCESS_SIGNALED,
97 SIGKILL,
98 "sleep",
99 "5",
100 NULL)),
101 GNUNET_TESTING_cmd_signal ("kill-sleep",
102 "sleep",
103 SIGKILL),
104 GNUNET_TESTING_cmd_finish ("wait-sleep",
105 "sleep",
106 GNUNET_TIME_UNIT_SECONDS),
107 GNUNET_TESTING_cmd_exec_va ("echo",
108 GNUNET_OS_PROCESS_EXITED,
109 0,
110 "echo",
111 "-n",
112 "LA",
113 NULL),
114 GNUNET_TESTING_cmd_rewind_ip ("rewind",
115 "wait-sleep",
116 4),
117 GNUNET_TESTING_cmd_batch ("netjail",
118 netjail),
119 GNUNET_TESTING_cmd_end ()
120 };
121
122 GNUNET_log_setup ("test-testing-api",
123 "DEBUG",
124 NULL);
125 return GNUNET_TESTING_main (commands,
126 GNUNET_TIME_UNIT_MINUTES);
127}
128
129
130/* end of test_testing_api.c */
diff --git a/src/lib/testing/test_testing_plugin_ping.c b/src/lib/testing/test_testing_plugin_ping.c
new file mode 100644
index 000000000..7054c10ff
--- /dev/null
+++ b/src/lib/testing/test_testing_plugin_ping.c
@@ -0,0 +1,54 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/test_testing_plugin_ping.c
23 * @brief a plugin to provide the API for running test cases.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
29
30GNUNET_TESTING_MAKE_PLUGIN (
31 test_testing,
32 ping,
33 GNUNET_TESTING_cmd_exec_va ("ping",
34 GNUNET_OS_PROCESS_EXITED,
35 0,
36 "ping",
37 "-c1",
38 (0 == strcmp (strchr (my_node_id,
39 '-'),
40 "-0001"))
41 ? "127.0.0.1"
42 : "127.0.0.2",
43 NULL),
44 GNUNET_TESTING_cmd_barrier_create ("barrier",
45 1)
46#if LATER
47 GNUNET_TESTING_cmd_barrier_reached ("label",
48 "peers-started-barrier"
49 ),
50 // peer runs here!
51#endif
52 )
53
54/* end of test_testing_plugin_ping.c */
diff --git a/src/service/testing/testing.conf b/src/lib/testing/testing.conf
index 7e25f8c13..7e25f8c13 100644
--- a/src/service/testing/testing.conf
+++ b/src/lib/testing/testing.conf
diff --git a/src/lib/testing/testing_api_barrier.c b/src/lib/testing/testing_api_barrier.c
new file mode 100644
index 000000000..51dd85f91
--- /dev/null
+++ b/src/lib/testing/testing_api_barrier.c
@@ -0,0 +1,51 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2024 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/barrier.c
23 * @brief convenience API for writing testcases for GNUnet
24 * Many testcases need to start and stop a peer/service
25 * and this library is supposed to make that easier
26 * for TESTCASES. Normal programs should always
27 * use functions from gnunet_{util,arm}_lib.h. This API is
28 * ONLY for writing testcases (or internal use of the testbed).
29 * @author Christian Grothoff
30 *
31 */
32#include "platform.h"
33#include "gnunet_util_lib.h"
34#include "gnunet_testing_lib.h"
35#include "testing_api_barrier.h"
36
37
38void
39GNUNET_TESTING_barrier_name_hash_ (
40 const char *barrier_name,
41 struct GNUNET_ShortHashCode *bkey)
42{
43 struct GNUNET_HashCode hc;
44
45 GNUNET_CRYPTO_hash (barrier_name,
46 strlen (barrier_name),
47 &hc);
48 memcpy (bkey,
49 &hc,
50 sizeof (*bkey));
51}
diff --git a/src/lib/testing/testing_api_barrier.h b/src/lib/testing/testing_api_barrier.h
new file mode 100644
index 000000000..4ed25783c
--- /dev/null
+++ b/src/lib/testing/testing_api_barrier.h
@@ -0,0 +1,81 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file barrier.h
23 * @brief API to manage barriers.
24 * @author t3sserakt
25 */
26
27#ifndef TESTING_API_BARRIER_H
28#define TESTING_API_BARRIER_H
29
30/**
31 * An entry for a barrier list
32 */
33struct GNUNET_TESTING_Barrier
34{
35
36 struct GNUNET_ShortHashCode barrier_id;
37
38 /**
39 * Context of barrier reached commands of our local interpreter that are
40 * currently blocked on this barrier.
41 */
42 struct GNUNET_TESTING_AsyncContext **waiting;
43
44 /**
45 * Length of the @e waiting array.
46 */
47 unsigned int cnt_waiting;
48
49 /**
50 * Number of total commands expected to be reached by the barrier.
51 */
52 unsigned int expected_reaches;
53
54 /**
55 * Number of times the barrier has been reached.
56 * Only used if @e inherited is false.
57 */
58 unsigned int reached;
59
60 /**
61 * Did we inherit the barrier from our parent loop?
62 */
63 bool inherited;
64
65 /**
66 * Did we reach @e expected_reaches? Used in particular if
67 * @e inherited is true and we cannot compute locally.
68 */
69 bool satisfied;
70
71};
72
73
74void
75GNUNET_TESTING_barrier_name_hash_ (
76 const char *barrier_name,
77 struct GNUNET_ShortHashCode *bkey);
78
79
80#endif
81/* end of barrier.h */
diff --git a/src/lib/testing/testing_api_cmd_barrier_create.c b/src/lib/testing/testing_api_cmd_barrier_create.c
new file mode 100644
index 000000000..353dd37bc
--- /dev/null
+++ b/src/lib/testing/testing_api_cmd_barrier_create.c
@@ -0,0 +1,106 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_cmd_barrier.c
23 * @brief Barrier functionality.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_testing_lib.h"
28#include "testing_api_barrier.h"
29#include "testing_api_loop.h"
30
31
32/**
33 * Offer internal data from a "barrier" CMD, to other commands.
34 *
35 * @param cls closure.
36 * @param[out] ret result.
37 * @param trait name of the trait.
38 * @param index index number of the object to offer.
39 * @return #GNUNET_OK on success.
40 */
41static enum GNUNET_GenericReturnValue
42barrier_traits (void *cls,
43 const void **ret,
44 const char *trait,
45 unsigned int index)
46{
47 struct GNUNET_TESTING_Trait traits[] = {
48 GNUNET_TESTING_trait_end ()
49 };
50
51 return GNUNET_TESTING_get_trait (traits,
52 ret,
53 trait,
54 index);
55}
56
57
58/**
59 * Cleanup the state from a "barrier" CMD, and possibly
60 * cancel a pending operation thereof.
61 *
62 * @param cls closure.
63 */
64static void
65barrier_cleanup (void *cls)
66{
67 struct GNUNET_TESTING_Barrier *barrier = cls;
68
69 GNUNET_free (barrier);
70}
71
72
73/**
74 * Run the command.
75 *
76 * @param cls closure.
77 * @param is the interpreter state.
78 */
79static void
80barrier_run (void *cls,
81 struct GNUNET_TESTING_Interpreter *is)
82{
83 struct GNUNET_TESTING_Barrier *barrier = cls;
84
85 GNUNET_TESTING_add_barrier_ (is,
86 barrier);
87}
88
89
90struct GNUNET_TESTING_Command
91GNUNET_TESTING_cmd_barrier_create (
92 const char *label,
93 unsigned int number_to_be_reached)
94{
95 struct GNUNET_TESTING_Barrier *barrier;
96
97 barrier = GNUNET_new (struct GNUNET_TESTING_Barrier);
98 GNUNET_TESTING_barrier_name_hash_ (label,
99 &barrier->barrier_id);
100 barrier->expected_reaches = number_to_be_reached;
101 return GNUNET_TESTING_command_new (barrier,
102 label,
103 &barrier_run,
104 &barrier_cleanup,
105 &barrier_traits);
106}
diff --git a/src/lib/testing/testing_api_cmd_barrier_reached.c b/src/lib/testing/testing_api_cmd_barrier_reached.c
new file mode 100644
index 000000000..35d3cbcd9
--- /dev/null
+++ b/src/lib/testing/testing_api_cmd_barrier_reached.c
@@ -0,0 +1,189 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_cmd_barrier_reached.c
23 * @brief Command to signal barrier was reached.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_testing_lib.h"
28#include "testing_api_loop.h"
29#include "testing_cmds.h"
30
31/**
32 * Generic logging shortcut
33 */
34#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
35
36/**
37 * Struct with information for callbacks.
38 *
39 */
40struct BarrierReachedState
41{
42 /**
43 * Context for our asynchronous completion.
44 */
45 struct GNUNET_TESTING_AsyncContext ac;
46
47 /**
48 * The label of this command.
49 */
50 const char *label;
51
52 /**
53 * The name of the barrier this commands wait (if finishing asynchronous) for or/and reaches.
54 */
55 const char *barrier_name;
56
57};
58
59
60/**
61 * Run the command.
62 *
63 * @param cls closure.
64 * @param is the interpreter state.
65 */
66static void
67barrier_reached_run (void *cls,
68 struct GNUNET_TESTING_Interpreter *is)
69{
70 struct BarrierReachedState *brs = cls;
71 struct GNUNET_TESTING_Barrier *barrier;
72
73 barrier = GNUNET_TESTING_get_barrier_ (is,
74 brs->barrier_name);
75 if (NULL == barrier)
76 {
77 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
78 "No barrier `%s'\n",
79 brs->barrier_name);
80 GNUNET_TESTING_async_fail (&brs->ac);
81 return;
82 }
83 if (barrier->satisfied)
84 {
85 GNUNET_TESTING_async_finish (&brs->ac);
86 return;
87 }
88 if (barrier->inherited)
89 {
90 struct GNUNET_TESTING_CommandBarrierReached cbr = {
91 .header.size = htons (sizeof (cbr)),
92 .header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED)
93 };
94
95 GNUNET_TESTING_barrier_name_hash_ (brs->barrier_name,
96 &cbr.barrier_key);
97 GNUNET_TESTING_loop_notify_parent_ (is,
98 &cbr.header);
99 return;
100 }
101 barrier->reached++;
102 if (barrier->reached == barrier->expected_reaches)
103 {
104 struct GNUNET_TESTING_CommandBarrierSatisfied cbs = {
105 .header.size = htons (sizeof (cbs)),
106 .header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE)
107 };
108
109 GNUNET_TESTING_barrier_name_hash_ (brs->barrier_name,
110 &cbs.barrier_key);
111 barrier->satisfied = true;
112 GNUNET_TESTING_loop_notify_children_ (is,
113 &cbs.header);
114 }
115 if (barrier->satisfied)
116 {
117 GNUNET_TESTING_async_finish (&brs->ac);
118 for (unsigned int i = 0; i<barrier->cnt_waiting; i++)
119 GNUNET_TESTING_async_finish (barrier->waiting[i]);
120 GNUNET_array_grow (barrier->waiting,
121 barrier->cnt_waiting,
122 0);
123 return;
124 }
125 GNUNET_array_append (barrier->waiting,
126 barrier->cnt_waiting,
127 &brs->ac);
128}
129
130
131/**
132 * Cleanup the state from a "barrier reached" CMD, and possibly
133 * cancel a pending operation thereof.
134 *
135 * @param cls closure.
136 */
137static void
138barrier_reached_cleanup (void *cls)
139{
140 struct BarrierReachedState *brs = cls;
141
142 GNUNET_free (brs);
143}
144
145
146/**
147 * Offer internal data from a "batch" CMD, to other commands.
148 *
149 * @param cls closure.
150 * @param[out] ret result.
151 * @param trait name of the trait.
152 * @param index index number of the object to offer.
153 * @return #GNUNET_OK on success.
154 */
155static enum GNUNET_GenericReturnValue
156barrier_reached_traits (void *cls,
157 const void **ret,
158 const char *trait,
159 unsigned int index)
160{
161 struct GNUNET_TESTING_Trait traits[] = {
162 GNUNET_TESTING_trait_end ()
163 };
164
165 return GNUNET_TESTING_get_trait (traits,
166 ret,
167 trait,
168 index);
169}
170
171
172struct GNUNET_TESTING_Command
173GNUNET_TESTING_cmd_barrier_reached (
174 const char *label,
175 const char *barrier_label)
176{
177 struct BarrierReachedState *brs;
178
179 brs = GNUNET_new (struct BarrierReachedState);
180 brs->label = label;
181 brs->barrier_name = barrier_label;
182 return GNUNET_TESTING_command_new_ac (
183 brs,
184 label,
185 &barrier_reached_run,
186 &barrier_reached_cleanup,
187 &barrier_reached_traits,
188 &brs->ac);
189}
diff --git a/src/service/testing/testing_api_cmd_batch.c b/src/lib/testing/testing_api_cmd_batch.c
index 2f1faf288..f4e866b78 100644
--- a/src/service/testing/testing_api_cmd_batch.c
+++ b/src/lib/testing/testing_api_cmd_batch.c
@@ -25,8 +25,9 @@
25 * @author t3sserakt 25 * @author t3sserakt
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_lib.h"
29#include "testing.h" 29#include "testing_api_cmd_batch.h"
30#include "testing_api_loop.h"
30 31
31/** 32/**
32 * State for a "batch" CMD. 33 * State for a "batch" CMD.
@@ -61,26 +62,25 @@ batch_run (void *cls,
61 struct GNUNET_TESTING_Interpreter *is) 62 struct GNUNET_TESTING_Interpreter *is)
62{ 63{
63 struct BatchState *bs = cls; 64 struct BatchState *bs = cls;
65 struct GNUNET_TESTING_Command *cmd;
64 66
65 if (NULL != bs->batch[bs->batch_ip].run) 67 cmd = &bs->batch[bs->batch_ip];
68 if (NULL != cmd->run)
66 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 69 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
67 "Running batched command: %s\n", 70 "Running batched command: %s\n",
68 bs->batch[bs->batch_ip].label.value); 71 cmd->label.value);
69 72
70 /* hit end command, leap to next top-level command. */ 73 /* hit end command, leap to next top-level command. */
71 if (NULL == bs->batch[bs->batch_ip].run) 74 if (NULL == cmd->run)
72 { 75 {
73 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 76 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
74 "Exiting from batch: %s\n", 77 "Exiting from batch: %s\n",
75 bs->label.value); 78 bs->label.value);
79 GNUNET_TESTING_interpreter_next_ (is);
76 return; 80 return;
77 } 81 }
78 bs->batch[bs->batch_ip].start_time 82 GNUNET_TESTING_interpreter_run_cmd_ (is,
79 = bs->batch[bs->batch_ip].last_req_time 83 cmd);
80 = GNUNET_TIME_absolute_get ();
81 bs->batch[bs->batch_ip].num_tries = 1;
82 bs->batch[bs->batch_ip].run (bs->batch[bs->batch_ip].cls,
83 is);
84} 84}
85 85
86 86
@@ -120,14 +120,9 @@ batch_traits (void *cls,
120 unsigned int index) 120 unsigned int index)
121{ 121{
122 struct BatchState *bs = cls; 122 struct BatchState *bs = cls;
123 // FIXME: these constants should be more global!
124#define CURRENT_CMD_INDEX 0
125#define BATCH_INDEX 1
126 struct GNUNET_TESTING_Trait traits[] = { 123 struct GNUNET_TESTING_Trait traits[] = {
127 GNUNET_TESTING_make_trait_cmd (CURRENT_CMD_INDEX, 124 GNUNET_TESTING_make_trait_cmd (&bs->batch[bs->batch_ip]),
128 &bs->batch[bs->batch_ip]), 125 GNUNET_TESTING_make_trait_batch_cmds (&bs->batch),
129 GNUNET_TESTING_make_trait_cmd (BATCH_INDEX,
130 bs->batch),
131 GNUNET_TESTING_trait_end () 126 GNUNET_TESTING_trait_end ()
132 }; 127 };
133 128
@@ -175,7 +170,7 @@ GNUNET_TESTING_cmd_batch (const char *label,
175 label, 170 label,
176 &batch_run, 171 &batch_run,
177 &batch_cleanup, 172 &batch_cleanup,
178 &batch_traits, NULL); 173 &batch_traits);
179} 174}
180 175
181 176
@@ -183,13 +178,24 @@ bool
183GNUNET_TESTING_cmd_batch_next_ (void *cls) 178GNUNET_TESTING_cmd_batch_next_ (void *cls)
184{ 179{
185 struct BatchState *bs = cls; 180 struct BatchState *bs = cls;
181 struct GNUNET_TESTING_Command *bcmd = &bs->batch[bs->batch_ip];
186 182
187 if (NULL == bs->batch[bs->batch_ip].run) 183 if (NULL == bcmd->run)
188 return false; 184 return true; /* this batch is done */
189 bs->batch[bs->batch_ip].finish_time 185 if (GNUNET_TESTING_cmd_is_batch_ (bcmd))
190 = GNUNET_TIME_absolute_get (); 186 {
187 if (GNUNET_TESTING_cmd_batch_next_ (bcmd->cls))
188 {
189 /* sub-batch is done */
190 bcmd->finish_time = GNUNET_TIME_absolute_get ();
191 bs->batch_ip++;
192 return false;
193 }
194 }
195 /* Simple command is done */
196 bcmd->finish_time = GNUNET_TIME_absolute_get ();
191 bs->batch_ip++; 197 bs->batch_ip++;
192 return true; 198 return false;
193} 199}
194 200
195 201
@@ -211,13 +217,16 @@ GNUNET_TESTING_cmd_batch_get_current_ (const struct GNUNET_TESTING_Command *cmd)
211 217
212 218
213void 219void
214GNUNET_TESTING_cmd_batch_set_current_ (const struct GNUNET_TESTING_Command *cmd, 220GNUNET_TESTING_cmd_batch_set_current_ (
215 unsigned int new_ip) 221 const struct GNUNET_TESTING_Command *cmd,
222 unsigned int new_ip)
216{ 223{
217 struct BatchState *bs = cmd->cls; 224 struct BatchState *bs = cmd->cls;
218 225
219 /* sanity checks */ 226 /* sanity checks */
220 GNUNET_assert (GNUNET_TESTING_cmd_is_batch_ (cmd)); 227 GNUNET_assert (cmd->run == &batch_run);
228 for (unsigned int i = 0; i < new_ip; i++)
229 GNUNET_assert (NULL != bs->batch[i].run);
221 /* actual logic */ 230 /* actual logic */
222 bs->batch_ip = new_ip; 231 bs->batch_ip = new_ip;
223} 232}
diff --git a/src/lib/testing/testing_api_cmd_batch.h b/src/lib/testing/testing_api_cmd_batch.h
new file mode 100644
index 000000000..f9f54c6cb
--- /dev/null
+++ b/src/lib/testing/testing_api_cmd_batch.h
@@ -0,0 +1,72 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_batch.h
23 * @brief
24 * @author t3sserakt
25 */
26#ifndef TESTING_API_CMD_BATCH_H
27#define TESTING_API_CMD_BATCH_H
28
29
30/**
31 * Test if this command is a batch command.
32 *
33 * @return false if not, true if it is a batch command
34 */
35bool
36GNUNET_TESTING_cmd_is_batch_ (
37 const struct GNUNET_TESTING_Command *cmd);
38
39
40/**
41 * Advance internal pointer to next command.
42 *
43 * @param cls batch internal state
44 * @return true if we could advance, false if the batch
45 * has completed and cannot advance anymore
46 */
47bool
48GNUNET_TESTING_cmd_batch_next_ (void *cls);
49
50
51/**
52 * Obtain what command the batch is at.
53 *
54 * @return cmd current batch command
55 */
56struct GNUNET_TESTING_Command *
57GNUNET_TESTING_cmd_batch_get_current_ (
58 const struct GNUNET_TESTING_Command *cmd);
59
60
61/**
62 * Set what command the batch should be at.
63 *
64 * @param cmd current batch command
65 * @param new_ip where to move the IP
66 */
67void
68GNUNET_TESTING_cmd_batch_set_current_ (
69 const struct GNUNET_TESTING_Command *cmd,
70 unsigned int new_ip);
71
72#endif
diff --git a/src/lib/testing/testing_api_cmd_exec.c b/src/lib/testing/testing_api_cmd_exec.c
new file mode 100644
index 000000000..3a931e220
--- /dev/null
+++ b/src/lib/testing/testing_api_cmd_exec.c
@@ -0,0 +1,254 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2023 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_exec.c
23 * @brief cmd to block the interpreter loop until all peers started.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
29
30#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
31
32struct BashScriptState
33{
34 /**
35 * Context for our asynchronous completion.
36 */
37 struct GNUNET_TESTING_AsyncContext ac;
38
39 /**
40 * Callback handed over to the command, which should
41 * be called upon death or completion of the script.
42 */
43 GNUNET_ChildCompletedCallback cb;
44
45 /**
46 * Wait for death of @e start_proc.
47 */
48 struct GNUNET_ChildWaitHandle *cwh;
49
50 /**
51 * The process id of the script.
52 */
53 struct GNUNET_OS_Process *start_proc;
54
55 /**
56 * NULL-terminated array of command-line arguments.
57 */
58 char **args;
59
60 /**
61 *
62 */
63 enum GNUNET_OS_ProcessStatusType expected_type;
64
65 /**
66 *
67 */
68 unsigned long int expected_exit_code;
69
70};
71
72/**
73 * The cleanup function of this cmd frees resources the cmd allocated.
74 *
75 */
76static void
77exec_bash_script_cleanup (void *cls)
78{
79 struct BashScriptState *bss = cls;
80
81 if (NULL != bss->cwh)
82 {
83 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
84 "Cancel child\n");
85 GNUNET_wait_child_cancel (bss->cwh);
86 bss->cwh = NULL;
87 }
88 if (NULL != bss->start_proc)
89 {
90 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
91 "Kill process\n");
92 GNUNET_assert (0 ==
93 GNUNET_OS_process_kill (bss->start_proc,
94 SIGKILL));
95 GNUNET_assert (GNUNET_OK ==
96 GNUNET_OS_process_wait (bss->start_proc));
97 GNUNET_OS_process_destroy (bss->start_proc);
98 bss->start_proc = NULL;
99 }
100 for (unsigned int i = 0; NULL != bss->args[i]; i++)
101 GNUNET_free (bss->args[i]);
102 GNUNET_free (bss->args);
103 GNUNET_free (bss);
104}
105
106
107/**
108 * Callback which will be called if the setup script finished.
109 *
110 */
111static void
112child_completed_callback (void *cls,
113 enum GNUNET_OS_ProcessStatusType type,
114 long unsigned int exit_code)
115{
116 struct BashScriptState *bss = cls;
117
118 bss->cwh = NULL;
119 GNUNET_OS_process_destroy (bss->start_proc);
120 bss->start_proc = NULL;
121 if ( (bss->expected_type != type) ||
122 (bss->expected_exit_code != exit_code) )
123 {
124 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
125 "Child failed with error %lu (wanted %lu) %d/%d!\n",
126 exit_code,
127 bss->expected_exit_code,
128 type,
129 bss->expected_type);
130 GNUNET_TESTING_async_fail (&bss->ac);
131 return;
132 }
133 GNUNET_TESTING_async_finish (&bss->ac);
134}
135
136
137/**
138 * Run method of the command created by the interpreter to wait for another
139 * command to finish.
140 *
141 */
142static void
143exec_bash_script_run (void *cls,
144 struct GNUNET_TESTING_Interpreter *is)
145{
146 struct BashScriptState *bss = cls;
147
148 GNUNET_assert (NULL == bss->cwh);
149 bss->start_proc
150 = GNUNET_OS_start_process_vap (
151 GNUNET_OS_INHERIT_STD_ERR,
152 NULL,
153 NULL,
154 NULL,
155 bss->args[0],
156 bss->args);
157 bss->cwh = GNUNET_wait_child (bss->start_proc,
158 &child_completed_callback,
159 bss);
160 GNUNET_break (NULL != bss->cwh);
161}
162
163
164/**
165 * This function prepares an array with traits.
166 */
167static enum GNUNET_GenericReturnValue
168traits (void *cls,
169 const void **ret,
170 const char *trait,
171 unsigned int index)
172{
173 struct BashScriptState *bss = cls;
174 struct GNUNET_TESTING_Trait traits[] = {
175 GNUNET_TESTING_make_trait_process (&bss->start_proc),
176 GNUNET_TESTING_trait_end ()
177 };
178
179 return GNUNET_TESTING_get_trait (traits,
180 ret,
181 trait,
182 index);
183}
184
185
186const struct GNUNET_TESTING_Command
187GNUNET_TESTING_cmd_exec (
188 const char *label,
189 enum GNUNET_OS_ProcessStatusType expected_type,
190 unsigned long int expected_exit_code,
191 char *const script_argv[])
192{
193 struct BashScriptState *bss;
194 unsigned int cnt;
195
196 cnt = 0;
197 while (NULL != script_argv[cnt])
198 cnt++;
199 bss = GNUNET_new (struct BashScriptState);
200 bss->args = GNUNET_new_array (cnt + 1,
201 char *);
202 for (unsigned int i = 0; i<cnt; i++)
203 bss->args[i] = GNUNET_strdup (script_argv[i]);
204 bss->expected_type = expected_type;
205 bss->expected_exit_code = expected_exit_code;
206 return GNUNET_TESTING_command_new_ac (
207 bss,
208 label,
209 &exec_bash_script_run,
210 &exec_bash_script_cleanup,
211 &traits,
212 &bss->ac);
213}
214
215
216const struct GNUNET_TESTING_Command
217GNUNET_TESTING_cmd_exec_va (
218 const char *label,
219 enum GNUNET_OS_ProcessStatusType expected_type,
220 unsigned long int expected_exit_code,
221 ...)
222{
223 struct BashScriptState *bss;
224 va_list ap;
225 const char *arg;
226 unsigned int cnt;
227
228 bss = GNUNET_new (struct BashScriptState);
229 va_start (ap,
230 expected_exit_code);
231 cnt = 1;
232 while (NULL != (arg = va_arg (ap,
233 const char *)))
234 cnt++;
235 va_end (ap);
236 bss->args = GNUNET_new_array (cnt,
237 char *);
238 cnt = 0;
239 va_start (ap,
240 expected_exit_code);
241 while (NULL != (arg = va_arg (ap,
242 const char *)))
243 bss->args[cnt++] = GNUNET_strdup (arg);
244 va_end (ap);
245 bss->expected_type = expected_type;
246 bss->expected_exit_code = expected_exit_code;
247 return GNUNET_TESTING_command_new_ac (
248 bss,
249 label,
250 &exec_bash_script_run,
251 &exec_bash_script_cleanup,
252 &traits,
253 &bss->ac);
254}
diff --git a/src/service/testing/testing_api_cmd_finish.c b/src/lib/testing/testing_api_cmd_finish.c
index e1fc69a09..24642e0b6 100644
--- a/src/service/testing/testing_api_cmd_finish.c
+++ b/src/lib/testing/testing_api_cmd_finish.c
@@ -24,10 +24,7 @@
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_testing_ng_lib.h" 27#include "gnunet_testing_lib.h"
28#include "gnunet_testing_plugin.h"
29#include "gnunet_testing_barrier.h"
30#include "gnunet_testing_netjail_lib.h"
31 28
32 29
33/** 30/**
@@ -42,12 +39,24 @@ struct FinishState
42 void *cls; 39 void *cls;
43 40
44 /** 41 /**
45 * Label of the asynchronous command the synchronous command of this closure waits for. 42 * Label of the asynchronous command the synchronous command of this closure
43 * waits for.
46 */ 44 */
47 const char *async_label; 45 const char *async_label;
48 46
49 /** 47 /**
50 * Task for running the finish method of the asynchronous task the command is waiting for. 48 * Function to call when async operation is done.
49 */
50 GNUNET_SCHEDULER_TaskCallback old_notify;
51
52 /**
53 * Closure for @e notify_finished.
54 */
55 void *old_notify_cls;
56
57 /**
58 * Task for running the finish method of the asynchronous task the command
59 * is waiting for.
51 */ 60 */
52 struct GNUNET_SCHEDULER_Task *finish_task; 61 struct GNUNET_SCHEDULER_Task *finish_task;
53 62
@@ -77,6 +86,11 @@ done_finish (void *cls)
77 86
78 GNUNET_SCHEDULER_cancel (finish_state->finish_task); 87 GNUNET_SCHEDULER_cancel (finish_state->finish_task);
79 finish_state->finish_task = NULL; 88 finish_state->finish_task = NULL;
89 if (NULL != finish_state->old_notify)
90 {
91 finish_state->old_notify (finish_state->old_notify_cls);
92 finish_state->old_notify = NULL;
93 }
80 GNUNET_TESTING_async_finish (&finish_state->ac); 94 GNUNET_TESTING_async_finish (&finish_state->ac);
81} 95}
82 96
@@ -106,8 +120,9 @@ timeout_finish (void *cls)
106 * 120 *
107 */ 121 */
108static void 122static void
109run_finish (void *cls, 123run_finish (
110 struct GNUNET_TESTING_Interpreter *is) 124 void *cls,
125 struct GNUNET_TESTING_Interpreter *is)
111{ 126{
112 struct FinishState *finish_state = cls; 127 struct FinishState *finish_state = cls;
113 const struct GNUNET_TESTING_Command *async_cmd; 128 const struct GNUNET_TESTING_Command *async_cmd;
@@ -121,8 +136,7 @@ run_finish (void *cls,
121 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 136 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
122 "Did not find command `%s'\n", 137 "Did not find command `%s'\n",
123 finish_state->async_label); 138 finish_state->async_label);
124 GNUNET_TESTING_interpreter_fail (is); 139 GNUNET_TESTING_FAIL (is);
125 return;
126 } 140 }
127 if ( (NULL == (aac = async_cmd->ac)) || 141 if ( (NULL == (aac = async_cmd->ac)) ||
128 (! async_cmd->asynchronous_finish) ) 142 (! async_cmd->asynchronous_finish) )
@@ -130,21 +144,24 @@ run_finish (void *cls,
130 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 144 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
131 "Cannot finish `%s': not asynchronous\n", 145 "Cannot finish `%s': not asynchronous\n",
132 finish_state->async_label); 146 finish_state->async_label);
133 GNUNET_TESTING_interpreter_fail (is); 147 GNUNET_TESTING_FAIL (is);
134 return;
135 } 148 }
136 if (GNUNET_NO != aac->finished) 149 if (aac->finished)
137 { 150 {
138 /* Command is already finished, so are we! */ 151 /* Command is already finished, so are we! */
139 GNUNET_TESTING_async_finish (&finish_state->ac); 152 GNUNET_TESTING_async_finish (&finish_state->ac);
140 return; 153 return;
141 } 154 }
155 /* add timeout */
142 finish_state->finish_task 156 finish_state->finish_task
143 = GNUNET_SCHEDULER_add_delayed (finish_state->timeout, 157 = GNUNET_SCHEDULER_add_delayed (finish_state->timeout,
144 &timeout_finish, 158 &timeout_finish,
145 finish_state); 159 finish_state);
146 aac->cont = &done_finish; 160 /* back up old notification that we will override */
147 aac->cont_cls = finish_state; 161 finish_state->old_notify = aac->notify_finished;
162 finish_state->old_notify_cls = aac->notify_finished_cls;
163 aac->notify_finished = &done_finish;
164 aac->notify_finished_cls = finish_state;
148} 165}
149 166
150 167
@@ -168,24 +185,29 @@ cleanup_finish (void *cls)
168 185
169 186
170const struct GNUNET_TESTING_Command 187const struct GNUNET_TESTING_Command
171GNUNET_TESTING_cmd_finish (const char *finish_label, 188GNUNET_TESTING_cmd_finish (
172 const char *cmd_ref, 189 const char *finish_label,
173 struct GNUNET_TIME_Relative timeout) 190 const char *cmd_ref,
191 struct GNUNET_TIME_Relative timeout)
174{ 192{
175 struct FinishState *finish_state; 193 struct FinishState *finish_state;
176 194
177 finish_state = GNUNET_new (struct FinishState); 195 finish_state = GNUNET_new (struct FinishState);
178 finish_state->async_label = cmd_ref; 196 finish_state->async_label = cmd_ref;
179 finish_state->timeout = timeout; 197 finish_state->timeout = timeout;
180 return GNUNET_TESTING_command_new (finish_state, finish_label, 198 return GNUNET_TESTING_command_new_ac (
181 &run_finish, 199 finish_state,
182 &cleanup_finish, 200 finish_label,
183 NULL, &finish_state->ac); 201 &run_finish,
202 &cleanup_finish,
203 NULL,
204 &finish_state->ac);
184} 205}
185 206
186 207
187struct GNUNET_TESTING_Command 208struct GNUNET_TESTING_Command
188GNUNET_TESTING_cmd_make_unblocking (struct GNUNET_TESTING_Command cmd) 209GNUNET_TESTING_cmd_make_unblocking (
210 struct GNUNET_TESTING_Command cmd)
189{ 211{
190 /* do not permit this function to be used on 212 /* do not permit this function to be used on
191 a finish command! */ 213 a finish command! */
diff --git a/src/lib/testing/testing_api_cmd_get_topo.c b/src/lib/testing/testing_api_cmd_get_topo.c
new file mode 100644
index 000000000..486278489
--- /dev/null
+++ b/src/lib/testing/testing_api_cmd_get_topo.c
@@ -0,0 +1,214 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_cmd_get_topo.c
23 * @brief Command to start the netjail script.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "testing_api_topology.h"
29
30/**
31 * Generic logging shortcut
32 */
33#define LOG(kind, ...) GNUNET_log_from (kind, "udp-backchannel",__VA_ARGS__)
34
35struct TopologyState
36{
37 /**
38 * The label of the command.
39 */
40 const char *label;
41
42 /**
43 * The topology we parsed.
44 */
45 struct GNUNET_TESTING_NetjailTopology *topology;
46
47 /**
48 * A string with the name of the topology file, if @e read_file is true,
49 * otherwise a string containing the topology data.
50 */
51 const char *topology_string;
52
53 /**
54 * Same as @e topology_string, but set if we need
55 * to release the memory.
56 */
57 char *topology_alloc;
58
59 /**
60 * A string with the name of the topology file.
61 */
62 const char *file_name;
63};
64
65/**
66 * The cleanup function of this cmd frees resources the cmd allocated.
67 *
68 */
69static void
70cleanup (void *cls)
71{
72 struct TopologyState *ts = cls;
73
74 if (NULL != ts->topology)
75 {
76 GNUNET_TESTING_free_topology (ts->topology);
77 ts->topology = NULL;
78 }
79 GNUNET_free (ts->topology_alloc);
80 GNUNET_free (ts);
81}
82
83
84/**
85 * This function prepares an array with traits.
86 */
87static enum GNUNET_GenericReturnValue
88traits (void *cls,
89 const void **ret,
90 const char *trait,
91 unsigned int index)
92{
93 struct TopologyState *ts = cls;
94 struct GNUNET_TESTING_Trait traits[] = {
95 GNUNET_TESTING_make_trait_topology (ts->topology),
96 GNUNET_TESTING_make_trait_topology_string (ts->topology_string),
97 GNUNET_TESTING_trait_end ()
98 };
99
100 return GNUNET_TESTING_get_trait (traits,
101 ret,
102 trait,
103 index);
104}
105
106
107static char *
108get_topo_string_from_file (const char *topology_data_file)
109{
110 uint64_t fs;
111 char *data;
112
113 if (GNUNET_YES !=
114 GNUNET_DISK_file_test (topology_data_file))
115 {
116 LOG (GNUNET_ERROR_TYPE_ERROR,
117 "Topology file %s not found\n",
118 topology_data_file);
119 return NULL;
120 }
121 if (GNUNET_OK !=
122 GNUNET_DISK_file_size (topology_data_file,
123 &fs,
124 GNUNET_YES,
125 GNUNET_YES))
126 {
127 LOG (GNUNET_ERROR_TYPE_ERROR,
128 "Could not determine size of topology file %s\n",
129 topology_data_file);
130 return NULL;
131 }
132 data = GNUNET_malloc_large (fs + 1);
133 GNUNET_assert (NULL != data);
134 if (fs !=
135 GNUNET_DISK_fn_read (topology_data_file,
136 data,
137 fs))
138 {
139 LOG (GNUNET_ERROR_TYPE_ERROR,
140 "Topology file %s cannot be read\n",
141 topology_data_file);
142 GNUNET_free (data);
143 return NULL;
144 }
145 return data;
146}
147
148
149/**
150 * The run method starts the script which setup the network namespaces.
151 *
152 * @param cls closure.
153 * @param is interpreter state.
154 */
155static void
156run (void *cls,
157 struct GNUNET_TESTING_Interpreter *is)
158{
159 struct TopologyState *ts = cls;
160
161 if (NULL == ts->topology_string)
162 {
163 ts->topology_alloc
164 = get_topo_string_from_file (ts->file_name);
165 if (NULL == ts->topology_alloc)
166 GNUNET_TESTING_FAIL (is);
167 ts->topology_string = ts->topology_alloc;
168 }
169 ts->topology
170 = GNUNET_TESTING_get_topo_from_string_ (ts->topology_string);
171 if (NULL == ts->topology)
172 GNUNET_TESTING_FAIL (is);
173}
174
175
176struct GNUNET_TESTING_Command
177GNUNET_TESTING_cmd_load_topology_from_file (
178 const char *label,
179 const char *file_name)
180{
181 struct TopologyState *ts;
182
183 ts = GNUNET_new (struct TopologyState);
184 ts->label = label;
185 ts->file_name = file_name;
186 return GNUNET_TESTING_command_new_ac (
187 ts,
188 label,
189 &run,
190 &cleanup,
191 traits,
192 NULL);
193}
194
195
196struct GNUNET_TESTING_Command
197GNUNET_TESTING_cmd_load_topology_from_string (
198 const char *label,
199 const char *topology_string)
200{
201 struct TopologyState *ts;
202
203 GNUNET_assert (NULL != topology_string);
204 ts = GNUNET_new (struct TopologyState);
205 ts->label = label;
206 ts->topology_string = topology_string;
207 return GNUNET_TESTING_command_new_ac (
208 ts,
209 label,
210 &run,
211 &cleanup,
212 traits,
213 NULL);
214}
diff --git a/src/service/testing/testing_api_cmd_netjail_start.c b/src/lib/testing/testing_api_cmd_netjail_start.c
index f45ab939b..8a84b2769 100644
--- a/src/service/testing/testing_api_cmd_netjail_start.c
+++ b/src/lib/testing/testing_api_cmd_netjail_start.c
@@ -25,12 +25,8 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_lib.h"
29#include "gnunet_testing_plugin.h" 29#include "testing_api_topology.h"
30#include "gnunet_testing_barrier.h"
31#include "gnunet_testing_netjail_lib.h"
32
33#define NETJAIL_START_SCRIPT "netjail_start.sh"
34 30
35#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__) 31#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
36 32
@@ -45,7 +41,6 @@ struct NetJailState
45 */ 41 */
46 struct GNUNET_TESTING_AsyncContext ac; 42 struct GNUNET_TESTING_AsyncContext ac;
47 43
48 // Child Wait handle
49 struct GNUNET_ChildWaitHandle *cwh; 44 struct GNUNET_ChildWaitHandle *cwh;
50 45
51 /** 46 /**
@@ -56,12 +51,13 @@ struct NetJailState
56 /** 51 /**
57 * Configuration file for the test topology. 52 * Configuration file for the test topology.
58 */ 53 */
59 char *topology_config; 54 const char *topology_cmd_label;
60 55
61 /** 56 /**
62 * Shall we read the topology from file, or from a string. 57 * Start or stop?
63 */ 58 */
64 unsigned int *read_file; 59 const char *script;
60
65}; 61};
66 62
67 63
@@ -76,18 +72,13 @@ netjail_start_cleanup (void *cls)
76 72
77 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 73 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
78 "netjail_start_cleanup!\n"); 74 "netjail_start_cleanup!\n");
79
80 if (NULL != ns->cwh) 75 if (NULL != ns->cwh)
81 { 76 {
82 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
83 "Cancel child\n");
84 GNUNET_wait_child_cancel (ns->cwh); 77 GNUNET_wait_child_cancel (ns->cwh);
85 ns->cwh = NULL; 78 ns->cwh = NULL;
86 } 79 }
87 if (NULL != ns->start_proc) 80 if (NULL != ns->start_proc)
88 { 81 {
89 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
90 "Kill process\n");
91 GNUNET_assert (0 == 82 GNUNET_assert (0 ==
92 GNUNET_OS_process_kill (ns->start_proc, 83 GNUNET_OS_process_kill (ns->start_proc,
93 SIGKILL)); 84 SIGKILL));
@@ -102,29 +93,27 @@ netjail_start_cleanup (void *cls)
102 93
103/** 94/**
104 * Callback which will be called if the setup script finished. 95 * Callback which will be called if the setup script finished.
105 *
106 */ 96 */
107static void 97static void
108child_completed_callback (void *cls, 98child_completed_callback (void *cls,
109 enum GNUNET_OS_ProcessStatusType type, 99 enum GNUNET_OS_ProcessStatusType type,
110 long unsigned int exit_code) 100 unsigned long int exit_code)
111{ 101{
112 struct NetJailState *ns = cls; 102 struct NetJailState *ns = cls;
113 103
114 GNUNET_OS_process_destroy (ns->start_proc); 104 GNUNET_OS_process_destroy (ns->start_proc);
115 ns->start_proc = NULL; 105 ns->start_proc = NULL;
116 ns->cwh = NULL; 106 ns->cwh = NULL;
117 if (0 == exit_code) 107 if ( (GNUNET_OS_PROCESS_EXITED != type) ||
118 { 108 (0 != exit_code) )
119 GNUNET_TESTING_async_finish (&ns->ac);
120 }
121 else
122 { 109 {
123 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 110 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
124 "Child failed with error %lu!\n", 111 "Child failed with error %lu!\n",
125 exit_code); 112 exit_code);
126 GNUNET_TESTING_async_fail (&ns->ac); 113 GNUNET_TESTING_async_fail (&ns->ac);
114 return;
127 } 115 }
116 GNUNET_TESTING_async_finish (&ns->ac);
128} 117}
129 118
130 119
@@ -139,31 +128,37 @@ netjail_start_run (void *cls,
139 struct GNUNET_TESTING_Interpreter *is) 128 struct GNUNET_TESTING_Interpreter *is)
140{ 129{
141 struct NetJailState *ns = cls; 130 struct NetJailState *ns = cls;
131 const struct GNUNET_TESTING_Command *topo_cmd;
142 char pid[15]; 132 char pid[15];
143 enum GNUNET_GenericReturnValue helper_check; 133 enum GNUNET_GenericReturnValue helper_check;
144 char *data_dir; 134 char *data_dir;
145 char *script_name; 135 char *script_name;
146 char *read_file; 136 const char *topology_data;
147 137
138 topo_cmd = GNUNET_TESTING_interpreter_lookup_command (
139 is,
140 ns->topology_cmd_label);
141 if (NULL == topo_cmd)
142 GNUNET_TESTING_FAIL (is);
143 if (GNUNET_OK !=
144 GNUNET_TESTING_get_trait_topology_string (topo_cmd,
145 &topology_data))
146 GNUNET_TESTING_FAIL (is);
148 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); 147 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
149 GNUNET_asprintf (&script_name, "%s%s", data_dir, NETJAIL_START_SCRIPT); 148 GNUNET_asprintf (&script_name,
150 GNUNET_asprintf (&read_file, "%u", *(ns->read_file)); 149 "%s%s",
151 150 data_dir,
151 ns->script);
152 helper_check = GNUNET_OS_check_helper_binary ( 152 helper_check = GNUNET_OS_check_helper_binary (
153 script_name, 153 script_name,
154 GNUNET_YES, 154 true,
155 NULL); 155 NULL);
156
157 LOG (GNUNET_ERROR_TYPE_DEBUG,
158 "script_name %s\n",
159 script_name);
160
161 if (GNUNET_NO == helper_check) 156 if (GNUNET_NO == helper_check)
162 { 157 {
163 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 158 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
164 "No SUID for %s!\n", 159 "No SUID for %s!\n",
165 script_name); 160 script_name);
166 GNUNET_TESTING_interpreter_fail (is); 161 GNUNET_TESTING_interpreter_skip (is);
167 return; 162 return;
168 } 163 }
169 if (GNUNET_SYSERR == helper_check) 164 if (GNUNET_SYSERR == helper_check)
@@ -171,7 +166,7 @@ netjail_start_run (void *cls,
171 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 166 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
172 "%s not found!\n", 167 "%s not found!\n",
173 script_name); 168 script_name);
174 GNUNET_TESTING_interpreter_fail (is); 169 GNUNET_TESTING_interpreter_skip (is);
175 return; 170 return;
176 } 171 }
177 172
@@ -182,9 +177,8 @@ netjail_start_run (void *cls,
182 { 177 {
183 char *const script_argv[] = { 178 char *const script_argv[] = {
184 script_name, 179 script_name,
185 ns->topology_config, 180 (char *) topology_data,
186 pid, 181 "0",
187 read_file,
188 NULL 182 NULL
189 }; 183 };
190 184
@@ -201,31 +195,27 @@ netjail_start_run (void *cls,
201 &child_completed_callback, 195 &child_completed_callback,
202 ns); 196 ns);
203 GNUNET_break (NULL != ns->cwh); 197 GNUNET_break (NULL != ns->cwh);
204 GNUNET_free (read_file);
205 GNUNET_free (script_name); 198 GNUNET_free (script_name);
206 GNUNET_free (data_dir); 199 GNUNET_free (data_dir);
207} 200}
208 201
209 202
210/**
211 * Create command.
212 *
213 * @param label name for command.
214 * @param topology_config Configuration file for the test topology.
215 * @return command.
216 */
217struct GNUNET_TESTING_Command 203struct GNUNET_TESTING_Command
218GNUNET_TESTING_cmd_netjail_start (const char *label, 204GNUNET_TESTING_cmd_netjail_setup (
219 char *topology_config, 205 const char *label,
220 unsigned int *read_file) 206 const char *script,
207 const char *topology_cmd_label)
221{ 208{
222 struct NetJailState *ns; 209 struct NetJailState *ns;
223 210
224 ns = GNUNET_new (struct NetJailState); 211 ns = GNUNET_new (struct NetJailState);
225 ns->topology_config = topology_config; 212 ns->script = script;
226 ns->read_file = read_file; 213 ns->topology_cmd_label = topology_cmd_label;
227 return GNUNET_TESTING_command_new (ns, label, 214 return GNUNET_TESTING_command_new_ac (
228 &netjail_start_run, 215 ns,
229 &netjail_start_cleanup, 216 label,
230 NULL, &ns->ac); 217 &netjail_start_run,
218 &netjail_start_cleanup,
219 NULL,
220 &ns->ac);
231} 221}
diff --git a/src/lib/testing/testing_api_cmd_netjail_start_cmds_helper.c b/src/lib/testing/testing_api_cmd_netjail_start_cmds_helper.c
new file mode 100644
index 000000000..dcfa40b7c
--- /dev/null
+++ b/src/lib/testing/testing_api_cmd_netjail_start_cmds_helper.c
@@ -0,0 +1,586 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/**
21 * @file testing/testing_api_cmd_netjail_start_cmds_helper.c
22 * @brief Command to start the netjail peers.
23 * @author t3sserakt
24 */
25#include "platform.h"
26#include "gnunet_util_lib.h"
27#include "gnunet_testing_lib.h"
28#include "testing_api_barrier.h"
29#include "testing_api_loop.h"
30#include "testing_cmds.h"
31#include "testing_api_topology.h"
32
33
34/**
35 * Generic logging shortcut
36 */
37#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
38
39
40/**
41 * Struct containing the number of the netjail node and the NetJailState which
42 * will be handed to callbacks specific to a test environment.
43 */
44struct TestingSystemCount;
45
46
47/**
48 * Struct to store information handed over to callbacks.
49 */
50struct NetJailState
51{
52 /**
53 * Global state of the interpreter, used by a command
54 * to access information about other commands.
55 */
56 struct GNUNET_TESTING_Interpreter *is;
57
58 /**
59 * Context for our asynchronous completion.
60 */
61 struct GNUNET_TESTING_AsyncContext ac;
62
63 /**
64 * Command with topology data.
65 */
66 const char *topology_cmd_label;
67
68 /**
69 * Array with handles of helper processes.
70 */
71 struct GNUNET_HELPER_Handle **helpers;
72
73 /**
74 * Time after this cmd has to finish.
75 */
76 struct GNUNET_TIME_Relative timeout;
77
78 /**
79 * Timeout task.
80 */
81 struct GNUNET_SCHEDULER_Task *timeout_task;
82
83 /**
84 * Kept in a DLL.
85 */
86 struct TestingSystemCount *tbc_head;
87
88 /**
89 * Kept in a DLL.
90 */
91 struct TestingSystemCount *tbc_tail;
92
93 /**
94 * Data about our topology as a string.
95 */
96 const char *topology_data;
97
98 /**
99 * Size of the array @e helpers.
100 */
101 unsigned int n_helpers;
102
103 /**
104 * Counts number of helpers that finished.
105 */
106 unsigned int n_finished;
107
108 /**
109 * Set to true if we already failed the command.
110 */
111 bool failed;
112};
113
114/**
115 * Struct containing the number of the netjail node and the NetJailState which
116 * will be handed to callbacks specific to a test environment.
117 */
118struct TestingSystemCount
119{
120
121 /**
122 * Kept in a DLL.
123 */
124 struct TestingSystemCount *next;
125
126 /**
127 * Kept in a DLL.
128 */
129 struct TestingSystemCount *prev;
130
131 /**
132 * The send handle for the helper
133 */
134 struct GNUNET_HELPER_SendHandle *shandle;
135
136 /**
137 * Struct to store information handed over to callbacks.
138 */
139 struct NetJailState *ns;
140
141
142};
143
144
145/**
146 * Continuation function from GNUNET_HELPER_send()
147 *
148 * @param cls closure
149 * @param result #GNUNET_OK on success,
150 * #GNUNET_NO if helper process died
151 * #GNUNET_SYSERR during GNUNET_HELPER_stop
152 */
153static void
154clear_msg (void *cls,
155 enum GNUNET_GenericReturnValue result)
156{
157 struct TestingSystemCount *tbc = cls;
158 struct NetJailState *ns = tbc->ns;
159
160 GNUNET_assert (NULL != tbc->shandle);
161 tbc->shandle = NULL;
162 GNUNET_CONTAINER_DLL_remove (ns->tbc_head,
163 ns->tbc_tail,
164 tbc);
165 GNUNET_free (tbc);
166 if ( (! ns->failed) &&
167 (GNUNET_OK != result) )
168 {
169 ns->failed = true;
170 GNUNET_TESTING_FAIL (ns->is);
171 }
172}
173
174
175static void
176handle_helper_barrier_reached (
177 void *cls,
178 const struct GNUNET_TESTING_CommandBarrierReached *rm)
179{
180 struct NetJailState *ns = cls;
181 struct GNUNET_TESTING_Barrier *barrier;
182
183 barrier = GNUNET_TESTING_get_barrier2_ (ns->is,
184 &rm->barrier_key);
185 if (NULL == barrier)
186 {
187 if (! ns->failed)
188 {
189 ns->failed = true;
190 GNUNET_TESTING_async_fail (&ns->ac);
191 }
192 return;
193 }
194 if (barrier->inherited)
195 {
196 /* pass on to parent */
197 GNUNET_TESTING_loop_notify_parent_ (ns->is,
198 &rm->header);
199 }
200 else
201 {
202 barrier->reached++;
203 if (barrier->reached == barrier->expected_reaches)
204 {
205 struct GNUNET_TESTING_CommandBarrierSatisfied cbs = {
206 .header.size
207 = htons (sizeof (cbs)),
208 .header.type
209 = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE),
210 .barrier_key
211 = rm->barrier_key
212 };
213
214 GNUNET_assert (! barrier->satisfied);
215 barrier->satisfied = true;
216 /* unblock children */
217 GNUNET_TESTING_loop_notify_children_ (ns->is,
218 &cbs.header);
219 /* unblock self */
220 for (unsigned int i = 0; i<barrier->cnt_waiting; i++)
221 GNUNET_TESTING_async_finish (barrier->waiting[i]);
222 GNUNET_array_grow (barrier->waiting,
223 barrier->cnt_waiting,
224 0);
225 }
226 }
227}
228
229
230static void
231handle_helper_local_finished (
232 void *cls,
233 const struct GNUNET_TESTING_CommandLocalFinished *lf)
234{
235 struct NetJailState *ns = cls;
236
237 ns->n_finished++;
238 if ( (! ns->failed) &&
239 (GNUNET_OK != ntohl (lf->rv)) )
240 {
241 ns->failed = true;
242 GNUNET_TESTING_async_fail (&ns->ac);
243 return;
244 }
245 if (ns->n_finished == ns->n_helpers)
246 {
247 GNUNET_SCHEDULER_cancel (ns->timeout_task);
248 ns->timeout_task = NULL;
249 GNUNET_TESTING_async_finish (&ns->ac);
250 }
251}
252
253
254/**
255 * Functions with this signature are called whenever a
256 * complete message is received by the tokenizer.
257 *
258 * Do not call GNUNET_SERVER_mst_destroy in callback
259 *
260 * @param cls closure
261 * @param message the actual message
262 * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
263 */
264static enum GNUNET_GenericReturnValue
265helper_mst (void *cls,
266 const struct GNUNET_MessageHeader *message)
267{
268 struct NetJailState *ns = cls;
269 struct GNUNET_MQ_MessageHandler handlers[] = {
270 GNUNET_MQ_hd_fixed_size (
271 helper_barrier_reached,
272 GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED,
273 struct GNUNET_TESTING_CommandBarrierReached,
274 ns),
275 GNUNET_MQ_hd_fixed_size (
276 helper_local_finished,
277 GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED,
278 struct GNUNET_TESTING_CommandLocalFinished,
279 ns),
280 GNUNET_MQ_handler_end ()
281 };
282 enum GNUNET_GenericReturnValue ret;
283
284 ret = GNUNET_MQ_handle_message (handlers,
285 message);
286 if (GNUNET_OK != ret)
287 {
288 GNUNET_break (0);
289 if (! ns->failed)
290 {
291 ns->failed = true;
292 GNUNET_TESTING_async_fail (&ns->ac);
293 }
294 }
295 return ret;
296}
297
298
299/**
300 * Callback called if there was an exception during execution of the helper.
301 */
302static void
303exp_cb (void *cls)
304{
305 struct NetJailState *ns = cls;
306
307 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
308 "Called exp_cb.\n");
309 if (NULL != ns->timeout_task)
310 {
311 GNUNET_SCHEDULER_cancel (ns->timeout_task);
312 ns->timeout_task = NULL;
313 }
314 if (! ns->failed)
315 GNUNET_TESTING_async_fail (&ns->ac);
316}
317
318
319static enum GNUNET_GenericReturnValue
320add_barrier (void *cls,
321 const struct GNUNET_ShortHashCode *key,
322 void *value)
323{
324 struct GNUNET_ShortHashCode **bar_posp = cls;
325 struct GNUNET_ShortHashCode *bar_pos = *bar_posp;
326
327 *bar_pos = *key;
328 *bar_posp = bar_pos + 1;
329 return GNUNET_OK;
330}
331
332
333/**
334 * @return true on success
335 */
336static bool
337send_start_messages (struct NetJailState *ns,
338 struct GNUNET_HELPER_Handle *helper)
339{
340 struct GNUNET_TESTING_CommandHelperInit *msg;
341 struct TestingSystemCount *tbc;
342 struct GNUNET_ShortHashCode *bar;
343 struct GNUNET_ShortHashCode *bar_pos;
344 unsigned int num_barriers = GNUNET_TESTING_barrier_count_ (ns->is);
345 size_t topo_length;
346 size_t msg_len;
347
348 topo_length = strlen (ns->topology_data) + 1;
349 GNUNET_assert (topo_length < SIZE_MAX - sizeof (*msg));
350 GNUNET_assert (SIZE_MAX / sizeof (struct GNUNET_ShortHashCode) >
351 num_barriers);
352 GNUNET_assert (sizeof (*msg) + topo_length <
353 SIZE_MAX
354 - num_barriers * sizeof (struct GNUNET_ShortHashCode));
355 msg_len = sizeof (*msg) + topo_length
356 + num_barriers * sizeof (struct GNUNET_ShortHashCode);
357 if (msg_len > UINT16_MAX)
358 {
359 /* ask a wizzard to enhance the protocol;
360 start with gzip topology_data? multiple
361 init messages for barriers + topo data,
362 etc.*/
363 GNUNET_break (0);
364 return false;
365 }
366 msg = GNUNET_malloc (msg_len);
367 msg->header.size = htons ((uint16_t) msg_len);
368 msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT);
369 bar = (struct GNUNET_ShortHashCode *) &msg[1];
370 bar_pos = bar;
371 GNUNET_TESTING_barrier_iterate_ (ns->is,
372 &add_barrier,
373 &bar_pos);
374 GNUNET_assert (bar_pos == &bar[num_barriers]);
375 memcpy (&bar[num_barriers],
376 ns->topology_data,
377 topo_length);
378 tbc = GNUNET_new (struct TestingSystemCount);
379 tbc->ns = ns;
380 tbc->shandle = GNUNET_HELPER_send (
381 helper,
382 &msg->header,
383 GNUNET_NO,
384 &clear_msg,
385 tbc);
386 GNUNET_free (msg);
387 if (NULL == tbc->shandle)
388 {
389 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
390 "Send handle is NULL!\n");
391 GNUNET_free (tbc);
392 return false;
393 }
394 GNUNET_CONTAINER_DLL_insert (ns->tbc_head,
395 ns->tbc_tail,
396 tbc);
397 return true;
398}
399
400
401/**
402 * Function which start a single helper process.
403 * @return true on success
404 */
405static bool
406start_helper (struct NetJailState *ns,
407 unsigned int script_num)
408{
409 char *gnunet_cmds_helper
410 = GNUNET_OS_get_libexec_binary_path (HELPER_CMDS_BINARY);
411 char node_id[32];
412 char *const script_argv[] = {
413 "ip",
414 "netns",
415 "exec",
416 node_id,
417 gnunet_cmds_helper,
418 node_id,
419 NULL
420 };
421 struct GNUNET_HELPER_Handle *helper;
422
423 GNUNET_snprintf (node_id,
424 sizeof (node_id),
425 "if%06x-%06x\n",
426 (unsigned int) getpid (),
427 script_num);
428 helper = GNUNET_HELPER_start (
429 GNUNET_YES, /* with control pipe */
430 script_argv[0],
431 script_argv,
432 &helper_mst,
433 &exp_cb,
434 ns);
435 GNUNET_free (gnunet_cmds_helper);
436 if (NULL == helper)
437 {
438 GNUNET_break (0);
439 return false;
440 }
441 GNUNET_array_append (ns->helpers,
442 ns->n_helpers,
443 helper);
444 GNUNET_TESTING_add_netjail_helper_ (ns->is,
445 helper);
446 return send_start_messages (ns,
447 helper);
448}
449
450
451/**
452 * Function run when the cmd terminates (good or bad) with timeout.
453 *
454 * @param cls the interpreter state
455 */
456static void
457do_timeout (void *cls)
458{
459 struct NetJailState *ns = cls;
460
461 ns->timeout_task = NULL;
462 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
463 "Terminating cmd due to global timeout\n");
464 GNUNET_TESTING_async_finish (&ns->ac);
465}
466
467
468/**
469 * This function starts a helper process for each node.
470 *
471 * @param cls closure.
472 * @param cmd CMD being run.
473 * @param is interpreter state.
474 */
475static void
476netjail_exec_run (void *cls,
477 struct GNUNET_TESTING_Interpreter *is)
478{
479 struct NetJailState *ns = cls;
480 struct GNUNET_TESTING_NetjailTopology *topology;
481 bool failed = false;
482 const struct GNUNET_TESTING_Command *topo_cmd;
483
484 ns->is = is;
485 topo_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
486 ns->topology_cmd_label);
487 if (NULL == topo_cmd)
488 GNUNET_TESTING_FAIL (is);
489 if (GNUNET_OK !=
490 GNUNET_TESTING_get_trait_topology_string (topo_cmd,
491 &ns->topology_data))
492 GNUNET_TESTING_FAIL (is);
493 topology
494 = GNUNET_TESTING_get_topo_from_string_ (ns->topology_data);
495 for (unsigned int i = 1; i <= topology->total; i++)
496 {
497 if (! start_helper (ns,
498 i))
499 {
500 failed = true;
501 break;
502 }
503 }
504 GNUNET_TESTING_free_topology (topology);
505 if (failed)
506 {
507 ns->failed = true;
508 GNUNET_TESTING_FAIL (is);
509 }
510 ns->timeout_task
511 = GNUNET_SCHEDULER_add_delayed (ns->timeout,
512 &do_timeout,
513 ns);
514}
515
516
517/**
518 * Code to clean up resource this cmd used.
519 *
520 * @param cls closure
521 */
522static void
523netjail_exec_cleanup (void *cls)
524{
525 struct NetJailState *ns = cls;
526
527 if (NULL != ns->timeout_task)
528 {
529 GNUNET_SCHEDULER_cancel (ns->timeout_task);
530 ns->timeout_task = NULL;
531 }
532 for (unsigned int i = 0; i<ns->n_helpers; i++)
533 GNUNET_HELPER_stop (ns->helpers[i],
534 GNUNET_YES);
535 GNUNET_free (ns);
536}
537
538
539/**
540 * This function prepares an array with traits.
541 */
542static enum GNUNET_GenericReturnValue
543netjail_exec_traits (void *cls,
544 const void **ret,
545 const char *trait,
546 unsigned int index)
547{
548 struct NetJailState *ns = cls;
549 struct GNUNET_TESTING_Trait traits[] = {
550 GNUNET_TESTING_trait_end ()
551 };
552
553 (void) ns;
554 return GNUNET_TESTING_get_trait (traits,
555 ret,
556 trait,
557 index);
558}
559
560
561/**
562 * Create command.
563 *
564 * @param label Name for the command.
565 * @param topology_data topology data
566 * @param timeout Before this timeout is reached this cmd MUST finish.
567 * @return command.
568 */
569struct GNUNET_TESTING_Command
570GNUNET_TESTING_cmd_netjail_start_helpers (
571 const char *label,
572 const char *topology_cmd_label,
573 struct GNUNET_TIME_Relative timeout)
574{
575 struct NetJailState *ns;
576
577 ns = GNUNET_new (struct NetJailState);
578 ns->topology_cmd_label = topology_cmd_label;
579 ns->timeout = timeout;
580 return GNUNET_TESTING_command_new_ac (ns,
581 label,
582 &netjail_exec_run,
583 &netjail_exec_cleanup,
584 &netjail_exec_traits,
585 &ns->ac);
586}
diff --git a/src/lib/testing/testing_api_cmd_signal.c b/src/lib/testing/testing_api_cmd_signal.c
new file mode 100644
index 000000000..adbcda946
--- /dev/null
+++ b/src/lib/testing/testing_api_cmd_signal.c
@@ -0,0 +1,120 @@
1/*
2 This file is part of GNUNET
3 (C) 2018 GNUnet e.V.
4
5 GNUNET is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 3, or
8 (at your option) any later version.
9
10 GNUNET is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with GNUNET; see the file COPYING. If not, see
17 <http://www.gnu.org/licenses/>
18*/
19/**
20 * @file testing/testing_api_cmd_signal.c
21 * @brief command(s) to send signals to processes.
22 * @author Marcello Stanisci
23 */
24#include "platform.h"
25#include "gnunet_testing_lib.h"
26
27
28/**
29 * State for a "signal" CMD.
30 */
31struct SignalState
32{
33 /**
34 * Label of the process to send the signal to.
35 */
36 const char *process_label;
37
38 /**
39 * The signal to send to the process.
40 */
41 int signal;
42};
43
44/**
45 * Run the command.
46 *
47 * @param cls closure.
48 * @param cmd the command to execute.
49 * @param is the interpreter state.
50 */
51static void
52signal_run (void *cls,
53 struct GNUNET_TESTING_Interpreter *is)
54{
55 struct SignalState *ss = cls;
56 const struct GNUNET_TESTING_Command *pcmd;
57 struct GNUNET_OS_Process **process;
58
59 pcmd
60 = GNUNET_TESTING_interpreter_lookup_command (is,
61 ss->process_label);
62 if (NULL == pcmd)
63 {
64 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
65 "Did not find command `%s'\n",
66 ss->process_label);
67 GNUNET_TESTING_FAIL (is);
68 }
69 if (GNUNET_OK !=
70 GNUNET_TESTING_get_trait_process (pcmd,
71 &process))
72 GNUNET_TESTING_FAIL (is);
73 GNUNET_break (0 ==
74 GNUNET_OS_process_kill (*process,
75 ss->signal));
76 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
77 "Signaling '%d'..\n",
78 ss->signal);
79}
80
81
82/**
83 * Cleanup the state from a "signal" CMD.
84 *
85 * @param cls closure.
86 */
87static void
88signal_cleanup (void *cls)
89{
90 struct SignalState *ss = cls;
91
92 GNUNET_free (ss);
93}
94
95
96/**
97 * Create a "signal" CMD.
98 *
99 * @param label command label.
100 * @param process handle to the process to signal.
101 * @param signal signal to send.
102 * @return the command.
103 */
104struct GNUNET_TESTING_Command
105GNUNET_TESTING_cmd_signal (
106 const char *label,
107 const char *process_label,
108 int signal)
109{
110 struct SignalState *ss;
111
112 ss = GNUNET_new (struct SignalState);
113 ss->process_label = process_label;
114 ss->signal = signal;
115 return GNUNET_TESTING_command_new (ss,
116 label,
117 &signal_run,
118 &signal_cleanup,
119 NULL);
120}
diff --git a/src/lib/testing/testing_api_cmd_stat.c b/src/lib/testing/testing_api_cmd_stat.c
new file mode 100644
index 000000000..f751a01d0
--- /dev/null
+++ b/src/lib/testing/testing_api_cmd_stat.c
@@ -0,0 +1,161 @@
1/*
2 This file is part of GNUnet
3 (C) 2018, 2024 GNUnet e.V.
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 3, or
8 (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public
16 License along with GNUnet; see the file COPYING. If not, see
17 <http://www.gnu.org/licenses/>
18*/
19/**
20 * @file testing/testing_api_cmd_stat.c
21 * @brief command(s) to get performance statistics on other commands
22 * @author Christian Grothoff
23 */
24#include "platform.h"
25#include "gnunet_testing_lib.h"
26#include "testing_api_cmd_batch.h"
27
28/**
29 * Run a "stat" CMD.
30 *
31 * @param cls closure.
32 * @param is the interpreter state.
33 */
34static void
35stat_run (void *cls,
36 struct GNUNET_TESTING_Interpreter *is);
37
38
39/**
40 * Add the time @a cmd took to the respective duration in @a timings.
41 *
42 * @param timings where to add up times
43 * @param cmd command to evaluate
44 */
45static void
46stat_cmd (struct GNUNET_TESTING_Timer *timings,
47 const struct GNUNET_TESTING_Command *cmd)
48{
49 struct GNUNET_TIME_Relative duration;
50 struct GNUNET_TIME_Relative lat;
51
52 if (GNUNET_TIME_absolute_cmp (cmd->start_time,
53 >,
54 cmd->finish_time))
55 {
56 /* This is a problem, except of course for
57 this command itself, as we clearly did not yet
58 finish... */
59 if (cmd->run != &stat_run)
60 {
61 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
62 "Bad timings for `%s'\n",
63 cmd->label.value);
64 GNUNET_break (0);
65 }
66 return;
67 }
68 duration = GNUNET_TIME_absolute_get_difference (cmd->start_time,
69 cmd->finish_time);
70 lat = GNUNET_TIME_absolute_get_difference (cmd->last_req_time,
71 cmd->finish_time);
72 for (unsigned int i = 0;
73 NULL != timings[i].prefix;
74 i++)
75 {
76 if (0 == strncmp (timings[i].prefix,
77 cmd->label.value,
78 strlen (timings[i].prefix)))
79 {
80 timings[i].total_duration
81 = GNUNET_TIME_relative_add (duration,
82 timings[i].total_duration);
83 timings[i].success_latency
84 = GNUNET_TIME_relative_add (lat,
85 timings[i].success_latency);
86 timings[i].num_commands++;
87 timings[i].num_retries += cmd->num_tries;
88 break;
89 }
90 }
91}
92
93
94/**
95 * Obtain statistics for @a timings of @a cmd
96 *
97 * @param[in,out] cls what timings to get
98 * @param cmd command to process
99 */
100static void
101do_stat (void *cls,
102 const struct GNUNET_TESTING_Command *cmd)
103{
104 struct GNUNET_TESTING_Timer *timings = cls;
105
106 if (GNUNET_TESTING_cmd_is_batch_ (cmd))
107 {
108 struct GNUNET_TESTING_Command **bcmd;
109
110 if (GNUNET_OK !=
111 GNUNET_TESTING_get_trait_batch_cmds (cmd,
112 &bcmd))
113 {
114 GNUNET_break (0);
115 return;
116 }
117 for (unsigned int j = 0;
118 NULL != (*bcmd)[j].run;
119 j++)
120 do_stat (timings,
121 &(*bcmd)[j]);
122 return;
123 }
124 stat_cmd (timings,
125 cmd);
126}
127
128
129/**
130 * Run a "stat" CMD.
131 *
132 * @param cls closure.
133 * @param cmd the command being run.
134 * @param is the interpreter state.
135 */
136static void
137stat_run (void *cls,
138 struct GNUNET_TESTING_Interpreter *is)
139{
140 struct GNUNET_TESTING_Timer *timings = cls;
141
142 GNUNET_TESTING_interpreter_commands_iterate (is,
143 true,
144 &do_stat,
145 timings);
146}
147
148
149struct GNUNET_TESTING_Command
150GNUNET_TESTING_cmd_stat (const char *label,
151 struct GNUNET_TESTING_Timer *timers)
152{
153 return GNUNET_TESTING_command_new ((void *) timers,
154 label,
155 &stat_run,
156 NULL,
157 NULL);
158}
159
160
161/* end of testing_api_cmd_stat.c */
diff --git a/src/lib/testing/testing_api_cmds.c b/src/lib/testing/testing_api_cmds.c
new file mode 100644
index 000000000..31d35f6c4
--- /dev/null
+++ b/src/lib/testing/testing_api_cmds.c
@@ -0,0 +1,92 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021-2024 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_loop.c
23 * @brief main interpreter loop for testcases
24 * @author Christian Grothoff (GNU Taler testing)
25 * @author Marcello Stanisci (GNU Taler testing)
26 * @author t3sserakt
27 */
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_testing_lib.h"
31
32
33struct GNUNET_TESTING_Command
34GNUNET_TESTING_command_new_ac (
35 void *cls,
36 const char *label,
37 GNUNET_TESTING_CommandRunRoutine run,
38 GNUNET_TESTING_CommandCleanupRoutine cleanup,
39 GNUNET_TESTING_CommandGetTraits traits,
40 struct GNUNET_TESTING_AsyncContext *ac)
41{
42 struct GNUNET_TESTING_Command cmd = {
43 .cls = cls,
44 .run = run,
45 .ac = ac,
46 .cleanup = cleanup,
47 .traits = traits
48 };
49
50 GNUNET_assert (NULL != run);
51 if (NULL != label)
52 GNUNET_TESTING_set_label (&cmd.label,
53 label);
54 return cmd;
55}
56
57
58void
59GNUNET_TESTING_set_label (
60 struct GNUNET_TESTING_CommandLabel *label,
61 const char *value)
62{
63 size_t len;
64
65 len = strlen (value);
66 GNUNET_assert (len <=
67 GNUNET_TESTING_CMD_MAX_LABEL_LENGTH);
68 memcpy (label->value,
69 value,
70 len + 1);
71}
72
73
74struct GNUNET_TESTING_Command
75GNUNET_TESTING_cmd_set_var (
76 const char *name,
77 struct GNUNET_TESTING_Command cmd)
78{
79 cmd.name = name;
80 return cmd;
81}
82
83
84struct GNUNET_TESTING_Command
85GNUNET_TESTING_cmd_end (void)
86{
87 struct GNUNET_TESTING_Command cmd = {
88 .run = NULL
89 };
90
91 return cmd;
92}
diff --git a/src/lib/testing/testing_api_loop.c b/src/lib/testing/testing_api_loop.c
new file mode 100644
index 000000000..7bb88ddda
--- /dev/null
+++ b/src/lib/testing/testing_api_loop.c
@@ -0,0 +1,1012 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021-2024 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_loop.c
23 * @brief main interpreter loop for testcases
24 * @author Christian Grothoff (GNU Taler testing)
25 * @author Marcello Stanisci (GNU Taler testing)
26 * @author t3sserakt
27 */
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_testing_lib.h"
31#include "testing_api_loop.h"
32#include "testing_api_cmd_batch.h"
33#include "testing_api_topology.h"
34#include "testing_cmds.h"
35
36
37struct SendContext
38{
39 struct SendContext *next;
40 struct SendContext *prev;
41
42 /**
43 * Handle to a send op
44 */
45 struct GNUNET_HELPER_SendHandle *send_handle;
46
47 struct GNUNET_TESTING_Interpreter *is;
48};
49
50/**
51 * Global state of the interpreter, used by a command
52 * to access information about other commands.
53 */
54struct GNUNET_TESTING_Interpreter
55{
56 /**
57 * Array with handles of helper processes for communication with netjails.
58 */
59 struct GNUNET_HELPER_Handle **helpers;
60
61 /**
62 * Function to call with the test result.
63 */
64 GNUNET_TESTING_ResultCallback rc;
65
66 /**
67 * Closure for @e rc.
68 */
69 void *rc_cls;
70
71 /**
72 * Commands the interpreter will run.
73 */
74 struct GNUNET_TESTING_Command *commands;
75
76 /**
77 * Map with barriers for this loop.
78 */
79 struct GNUNET_CONTAINER_MultiShortmap *barriers;
80
81 /**
82 * Interpreter task (if one is scheduled).
83 */
84 struct GNUNET_SCHEDULER_Task *task;
85
86 /**
87 * Final task that returns the result.
88 */
89 struct GNUNET_SCHEDULER_Task *final_task;
90
91 /**
92 * Task run on timeout.
93 */
94 struct GNUNET_SCHEDULER_Task *timeout_task;
95
96 /**
97 * Hash map mapping variable names to commands.
98 */
99 struct GNUNET_CONTAINER_MultiHashMap *vars;
100
101 struct SendContext *sender_head;
102 struct SendContext *sender_tail;
103
104 /**
105 * Function to call to send messages to our parent.
106 */
107 GNUNET_TESTING_cmd_helper_write_cb parent_writer;
108
109 /**
110 * Number of GNUNET_TESTING_Command in @e commands.
111 */
112 unsigned int cmds_n;
113
114 /**
115 * Size of the array @e helpers.
116 */
117 unsigned int n_helpers;
118
119 /**
120 * Instruction pointer. Tells #interpreter_run() which instruction to run
121 * next. Need (signed) int because it gets -1 when rewinding the
122 * interpreter to the first CMD.
123 */
124 int ip;
125
126 /**
127 * Result of the testcases, #GNUNET_OK on success,
128 * #GNUNET_SYSERR on failure, #GNUNET_NO if undecided.
129 */
130 enum GNUNET_GenericReturnValue result;
131
132 /**
133 * Is the interpreter finishing?
134 */
135 bool finishing;
136
137 /**
138 * Is the real result to "skip" because we could not
139 * get the environment working?
140 */
141 bool skip;
142
143};
144
145
146const struct GNUNET_TESTING_Command *
147GNUNET_TESTING_interpreter_lookup_command (
148 struct GNUNET_TESTING_Interpreter *is,
149 const char *label)
150{
151 if (NULL == label)
152 {
153 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
154 "Attempt to lookup command for empty label\n");
155 return NULL;
156 }
157 for (int i = is->ip; i >= 0; i--)
158 {
159 const struct GNUNET_TESTING_Command *cmd = &is->commands[i];
160
161 /* Give precedence to top-level commands. */
162 if ( (NULL != cmd->run) &&
163 (0 == strcmp (cmd->label.value,
164 label)) )
165 return cmd;
166
167 if (GNUNET_TESTING_cmd_is_batch_ (cmd))
168 {
169 struct GNUNET_TESTING_Command **batch;
170 const struct GNUNET_TESTING_Command *current;
171 const struct GNUNET_TESTING_Command *icmd;
172 const struct GNUNET_TESTING_Command *match;
173
174 GNUNET_assert (GNUNET_OK ==
175 GNUNET_TESTING_get_trait_cmd (cmd,
176 &current));
177 GNUNET_assert (GNUNET_OK ==
178 GNUNET_TESTING_get_trait_batch_cmds (cmd,
179 &batch));
180 /* We must do the loop forward, but we can find the last match */
181 match = NULL;
182 for (unsigned int j = 0;
183 NULL != (icmd = &(*batch)[j])->run;
184 j++)
185 {
186 if (current == icmd)
187 break; /* do not go past current command */
188 if ( (NULL != icmd->run) &&
189 (0 == strcmp (icmd->label.value,
190 label)) )
191 match = icmd;
192 }
193 if (NULL != match)
194 return match;
195 }
196 }
197 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
198 "Command `%s' not found\n",
199 label);
200 return NULL;
201}
202
203
204const struct GNUNET_TESTING_Command *
205GNUNET_TESTING_interpreter_get_command (
206 struct GNUNET_TESTING_Interpreter *is,
207 const char *name)
208{
209 const struct GNUNET_TESTING_Command *cmd;
210 struct GNUNET_HashCode h_name;
211
212 GNUNET_CRYPTO_hash (name,
213 strlen (name),
214 &h_name);
215 cmd = GNUNET_CONTAINER_multihashmap_get (is->vars,
216 &h_name);
217 if (NULL == cmd)
218 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
219 "Command not found by variable name: %s\n",
220 name);
221 return cmd;
222}
223
224
225static void
226send_finished (void *cls,
227 enum GNUNET_GenericReturnValue result)
228{
229 struct SendContext *sctx = cls;
230 struct GNUNET_TESTING_Interpreter *is = sctx->is;
231
232 GNUNET_break (GNUNET_OK == result);
233 GNUNET_CONTAINER_DLL_remove (is->sender_head,
234 is->sender_tail,
235 sctx);
236 GNUNET_free (sctx);
237}
238
239
240void
241GNUNET_TESTING_loop_notify_children_ (struct GNUNET_TESTING_Interpreter *is,
242 const struct GNUNET_MessageHeader *hdr)
243{
244 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
245 "Send notification to children of type %u\n",
246 (unsigned int) ntohs (hdr->type));
247 for (unsigned int i = 0; i<is->n_helpers; i++)
248 {
249 struct SendContext *sctx;
250
251 sctx = GNUNET_new (struct SendContext);
252 sctx->is = is;
253 GNUNET_CONTAINER_DLL_insert (is->sender_head,
254 is->sender_tail,
255 sctx);
256 sctx->send_handle
257 = GNUNET_HELPER_send (is->helpers[i],
258 hdr,
259 false, /* never drop */
260 &send_finished,
261 sctx);
262 }
263}
264
265
266void
267GNUNET_TESTING_loop_notify_parent_ (struct GNUNET_TESTING_Interpreter *is,
268 const struct GNUNET_MessageHeader *hdr)
269{
270 /* We must have a parent */
271 if (NULL == is->parent_writer)
272 GNUNET_TESTING_FAIL (is);
273 is->parent_writer (hdr);
274}
275
276
277/**
278 * Finish the test run, return the final result.
279 *
280 * @param cls the `struct GNUNET_TESTING_Interpreter`
281 */
282static void
283finish_test (void *cls)
284{
285 struct GNUNET_TESTING_Interpreter *is = cls;
286 struct GNUNET_TESTING_Command *cmd;
287 const char *label;
288
289 is->finishing = true;
290 is->final_task = NULL;
291 label = is->commands[is->ip].label.value;
292 if (NULL == is->commands[is->ip].run)
293 label = "END";
294 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
295 "Interpreter finishes at `%s' with status %d\n",
296 label,
297 is->result);
298 for (unsigned int j = 0;
299 NULL != (cmd = &is->commands[j])->run;
300 j++)
301 if (NULL != cmd->cleanup)
302 cmd->cleanup (cmd->cls);
303 if (NULL != is->task)
304 {
305 GNUNET_SCHEDULER_cancel (is->task);
306 is->task = NULL;
307 }
308 if (NULL != is->timeout_task)
309 {
310 GNUNET_SCHEDULER_cancel (is->timeout_task);
311 is->timeout_task = NULL;
312 }
313 {
314 struct SendContext *sctx;
315
316 while (NULL != (sctx = is->sender_head))
317 {
318 GNUNET_CONTAINER_DLL_remove (is->sender_head,
319 is->sender_tail,
320 sctx);
321 GNUNET_HELPER_send_cancel (sctx->send_handle);
322 GNUNET_free (sctx);
323 }
324 }
325 GNUNET_free (is->commands);
326 is->rc (is->rc_cls,
327 is->skip ? GNUNET_NO : is->result);
328 if (NULL != is->barriers)
329 {
330 GNUNET_CONTAINER_multishortmap_destroy (is->barriers);
331 is->barriers = NULL;
332 }
333 if (NULL != is->vars)
334 {
335 GNUNET_CONTAINER_multihashmap_destroy (is->vars);
336 is->vars = NULL;
337 }
338 GNUNET_free (is->helpers);
339 GNUNET_free (is);
340}
341
342
343/**
344 * Run the main interpreter loop that performs exchange operations.
345 *
346 * @param cls contains the `struct InterpreterState`
347 */
348static void
349interpreter_run (void *cls);
350
351
352void
353GNUNET_TESTING_interpreter_next_ (void *cls)
354{
355 static unsigned long long ipc;
356 static struct GNUNET_TIME_Absolute last_report;
357 struct GNUNET_TESTING_Interpreter *is = cls;
358 struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip];
359
360 if (GNUNET_SYSERR == is->result)
361 return; /* ignore, we already failed! */
362
363 if (GNUNET_TESTING_cmd_is_batch_ (cmd))
364 {
365 if (GNUNET_TESTING_cmd_batch_next_ (cmd->cls))
366 {
367 /* batch is done */
368 cmd->finish_time = GNUNET_TIME_absolute_get ();
369 is->ip++;
370 }
371 }
372 else
373 {
374 cmd->finish_time = GNUNET_TIME_absolute_get ();
375 is->ip++;
376 }
377
378 if (0 == (ipc % 1000))
379 {
380 if (0 != ipc)
381 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
382 "Interpreter executed 1000 instructions in %s\n",
383 GNUNET_STRINGS_relative_time_to_string (
384 GNUNET_TIME_absolute_get_duration (last_report),
385 true));
386 last_report = GNUNET_TIME_absolute_get ();
387 }
388 ipc++;
389 is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
390 is);
391}
392
393
394void
395GNUNET_TESTING_interpreter_run_cmd_ (
396 struct GNUNET_TESTING_Interpreter *is,
397 struct GNUNET_TESTING_Command *cmd)
398{
399 cmd->last_req_time
400 = GNUNET_TIME_absolute_get ();
401 if (0 == cmd->num_tries)
402 cmd->start_time = cmd->last_req_time;
403 cmd->num_tries = 1;
404 if (NULL != cmd->name)
405 {
406 struct GNUNET_HashCode h_name;
407
408 GNUNET_CRYPTO_hash (cmd->name,
409 strlen (cmd->name),
410 &h_name);
411 (void) GNUNET_CONTAINER_multihashmap_put (
412 is->vars,
413 &h_name,
414 cmd,
415 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
416 }
417 if (NULL != cmd->ac)
418 {
419 cmd->ac->is = is;
420 cmd->ac->finished = GNUNET_NO;
421 cmd->ac->next_called = false;
422 }
423 cmd->run (cmd->cls,
424 is);
425 if ( (! GNUNET_TESTING_cmd_is_batch_ (cmd)) &&
426 ( (NULL == cmd->ac) ||
427 (cmd->asynchronous_finish) ) )
428 {
429 if (NULL != cmd->ac)
430 cmd->ac->next_called = true;
431 GNUNET_TESTING_interpreter_next_ (is);
432 }
433}
434
435
436/**
437 * Run the main interpreter loop.
438 *
439 * @param cls contains the `struct GNUNET_TESTING_Interpreter`
440 */
441static void
442interpreter_run (void *cls)
443{
444 struct GNUNET_TESTING_Interpreter *is = cls;
445 struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip];
446
447 is->task = NULL;
448 if (NULL == cmd->run)
449 {
450 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
451 "Running command END\n");
452 is->result = GNUNET_OK;
453 finish_test (is);
454 return;
455 }
456 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
457 "Running command `%s'\n",
458 cmd->label.value);
459 GNUNET_TESTING_interpreter_run_cmd_ (is,
460 cmd);
461}
462
463
464void
465GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is)
466{
467 struct GNUNET_TESTING_Command *cmd
468 = &is->commands[is->ip];
469
470 if (GNUNET_SYSERR == is->result)
471 {
472 GNUNET_break (0);
473 return; /* ignore, we already failed! */
474 }
475 if (NULL == cmd)
476 {
477 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
478 "Failed with CMD being NULL!\n");
479 }
480 else
481 {
482 const struct GNUNET_TESTING_Command *pos = cmd;
483
484 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
485 "Failed during command `%s'\n",
486 cmd->label.value);
487 while (GNUNET_TESTING_cmd_is_batch_ (pos))
488 {
489 GNUNET_assert (GNUNET_OK ==
490 GNUNET_TESTING_get_trait_cmd (pos,
491 &pos));
492 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
493 "Failed in batch during command `%s'\n",
494 pos->label.value);
495 }
496 }
497 if (NULL != is->timeout_task)
498 {
499 GNUNET_SCHEDULER_cancel (is->timeout_task);
500 is->timeout_task = NULL;
501 }
502 is->result = GNUNET_SYSERR;
503 GNUNET_assert (NULL == is->final_task);
504 is->final_task = GNUNET_SCHEDULER_add_now (&finish_test,
505 is);
506}
507
508
509void
510GNUNET_TESTING_interpreter_skip (
511 struct GNUNET_TESTING_Interpreter *is)
512{
513 is->skip = true;
514 GNUNET_TESTING_interpreter_fail (is);
515}
516
517
518void
519GNUNET_TESTING_async_fail (struct GNUNET_TESTING_AsyncContext *ac)
520{
521 GNUNET_assert (GNUNET_NO == ac->finished);
522 ac->finished = GNUNET_SYSERR;
523 GNUNET_TESTING_interpreter_fail (ac->is);
524}
525
526
527void
528GNUNET_TESTING_async_finish (struct GNUNET_TESTING_AsyncContext *ac)
529{
530 GNUNET_assert (GNUNET_NO == ac->finished);
531 ac->finished = GNUNET_OK;
532 if (NULL != ac->notify_finished)
533 {
534 ac->notify_finished (ac->notify_finished_cls);
535 ac->notify_finished = NULL;
536 }
537 if (! ac->next_called)
538 {
539 ac->next_called = true;
540 GNUNET_TESTING_interpreter_next_ (ac->is);
541 }
542}
543
544
545/**
546 * Function run when the test terminates (good or bad) with timeout.
547 *
548 * @param cls the interpreter state
549 */
550static void
551do_timeout (void *cls)
552{
553 struct GNUNET_TESTING_Interpreter *is = cls;
554
555 is->timeout_task = NULL;
556 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
557 "Terminating test due to global timeout\n");
558 is->result = GNUNET_SYSERR;
559 finish_test (is);
560}
561
562
563static void
564setup_is (struct GNUNET_TESTING_Interpreter *is,
565 const struct GNUNET_TESTING_Command *bcommand,
566 const struct GNUNET_TESTING_Command *commands)
567{
568 unsigned int i;
569
570 is->vars = GNUNET_CONTAINER_multihashmap_create (1024,
571 false);
572 /* get the number of commands */
573 for (i = 0; NULL != commands[i].run; i++)
574 ;
575 if (NULL != bcommand)
576 i++;
577 is->cmds_n = i + 1;
578 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
579 "Got %u commands\n",
580 i);
581 is->commands = GNUNET_malloc_large (
582 (i + 1)
583 * sizeof (struct GNUNET_TESTING_Command));
584 GNUNET_assert (NULL != is->commands);
585 if (NULL == bcommand)
586 {
587 memcpy (is->commands,
588 commands,
589 sizeof (struct GNUNET_TESTING_Command) * i);
590 }
591 else
592 {
593 is->commands[0] = *bcommand;
594 memcpy (&is->commands[1],
595 commands,
596 sizeof (struct GNUNET_TESTING_Command) * i);
597 }
598 is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
599 is);
600}
601
602
603struct GNUNET_TESTING_Interpreter *
604GNUNET_TESTING_run (const struct GNUNET_TESTING_Command *commands,
605 struct GNUNET_TIME_Relative timeout,
606 GNUNET_TESTING_ResultCallback rc,
607 void *rc_cls)
608{
609 struct GNUNET_TESTING_Interpreter *is;
610
611 is = GNUNET_new (struct GNUNET_TESTING_Interpreter);
612 is->timeout_task
613 = GNUNET_SCHEDULER_add_delayed (timeout,
614 &do_timeout,
615 is);
616 is->rc = rc;
617 is->rc_cls = rc_cls;
618 setup_is (is,
619 NULL,
620 commands);
621 return is;
622}
623
624
625static struct GNUNET_TESTING_Interpreter *
626start_testcase (
627 void *cls,
628 const char *topology_data,
629 uint32_t inherited_barrier_count,
630 const struct GNUNET_ShortHashCode *inherited_barriers,
631 GNUNET_TESTING_cmd_helper_write_cb parent_writer,
632 GNUNET_TESTING_ResultCallback finish_cb,
633 void *finish_cb_cls)
634{
635 const struct GNUNET_TESTING_Command *commands = cls;
636 struct GNUNET_TESTING_Interpreter *is;
637
638 is = GNUNET_new (struct GNUNET_TESTING_Interpreter);
639 if (0 != inherited_barrier_count)
640 {
641 is->barriers
642 = GNUNET_CONTAINER_multishortmap_create (inherited_barrier_count * 4 / 3,
643 true);
644 for (unsigned int j = 0; j<inherited_barrier_count; j++)
645 {
646 struct GNUNET_TESTING_Barrier *barrier;
647
648 barrier = GNUNET_new (struct GNUNET_TESTING_Barrier);
649 barrier->barrier_id = inherited_barriers[j];
650 barrier->inherited = true;
651 (void) GNUNET_CONTAINER_multishortmap_put (
652 is->barriers,
653 &barrier->barrier_id,
654 barrier,
655 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
656 }
657 }
658 is->parent_writer = parent_writer;
659 is->rc = finish_cb;
660 is->rc_cls = finish_cb_cls;
661 {
662 struct GNUNET_TESTING_Command bcmd;
663
664 bcmd = GNUNET_TESTING_cmd_set_var (
665 "topology",
666 GNUNET_TESTING_cmd_load_topology_from_string (
667 "_boot_",
668 topology_data));
669 setup_is (is,
670 &bcmd,
671 commands);
672 }
673 return is;
674
675}
676
677
678struct GNUNET_TESTING_PluginFunctions *
679GNUNET_TESTING_make_plugin (
680 const struct GNUNET_TESTING_Command *commands)
681{
682 struct GNUNET_TESTING_PluginFunctions *api;
683
684 api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions);
685 api->cls = (void *) commands;
686 api->start_testcase = &start_testcase;
687 return api;
688}
689
690
691void
692GNUNET_TESTING_add_netjail_helper_ (struct GNUNET_TESTING_Interpreter *is,
693 struct GNUNET_HELPER_Handle *helper)
694{
695 GNUNET_array_append (is->helpers,
696 is->n_helpers,
697 helper);
698}
699
700
701struct GNUNET_TESTING_Barrier *
702GNUNET_TESTING_get_barrier2_ (struct GNUNET_TESTING_Interpreter *is,
703 const struct GNUNET_ShortHashCode *create_key)
704{
705 return GNUNET_CONTAINER_multishortmap_get (is->barriers,
706 create_key);
707}
708
709
710struct GNUNET_TESTING_Barrier *
711GNUNET_TESTING_get_barrier_ (struct GNUNET_TESTING_Interpreter *is,
712 const char *barrier_name)
713{
714 struct GNUNET_ShortHashCode create_key;
715
716 if (NULL == is->barriers)
717 return NULL;
718 GNUNET_TESTING_barrier_name_hash_ (barrier_name,
719 &create_key);
720 return GNUNET_TESTING_get_barrier2_ (is,
721 &create_key);
722}
723
724
725void
726GNUNET_TESTING_add_barrier_ (struct GNUNET_TESTING_Interpreter *is,
727 struct GNUNET_TESTING_Barrier *barrier)
728{
729 if (NULL == is->barriers)
730 is->barriers
731 = GNUNET_CONTAINER_multishortmap_create (1,
732 true);
733 /* We always use the barrier we encountered
734 most recently under a given label, thus replace */
735 (void) GNUNET_CONTAINER_multishortmap_put (
736 is->barriers,
737 &barrier->barrier_id,
738 barrier,
739 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
740}
741
742
743unsigned int
744GNUNET_TESTING_barrier_count_ (
745 struct GNUNET_TESTING_Interpreter *is)
746{
747 return GNUNET_CONTAINER_multishortmap_size (is->barriers);
748}
749
750
751void
752GNUNET_TESTING_barrier_iterate_ (
753 struct GNUNET_TESTING_Interpreter *is,
754 GNUNET_CONTAINER_ShortmapIterator cb,
755 void *cb_cls)
756{
757 GNUNET_CONTAINER_multishortmap_iterate (is->barriers,
758 cb,
759 cb_cls);
760}
761
762
763void
764GNUNET_TESTING_interpreter_commands_iterate (
765 struct GNUNET_TESTING_Interpreter *is,
766 bool asc,
767 GNUNET_TESTING_CommandIterator cb,
768 void *cb_cls)
769{
770 unsigned int start;
771 unsigned int end;
772 int inc;
773
774 if (asc)
775 {
776 inc = 1;
777 start = 0;
778 end = is->ip;
779 }
780 else
781 {
782 inc = -1;
783 start = is->ip;
784 end = 0;
785 }
786 for (unsigned int off = start; off != end + inc; off += inc)
787 {
788 const struct GNUNET_TESTING_Command *cmd
789 = &is->commands[off];
790
791 cb (cb_cls,
792 cmd);
793 }
794}
795
796
797void
798GNUNET_TESTING_interpreter_current_cmd_touch (
799 struct GNUNET_TESTING_Interpreter *is)
800{
801 is->commands[is->ip].last_req_time
802 = GNUNET_TIME_absolute_get ();
803}
804
805
806void
807GNUNET_TESTING_interpreter_current_cmd_inc_tries (
808 struct GNUNET_TESTING_Interpreter *is)
809{
810 is->commands[is->ip].num_tries++;
811}
812
813
814const char *
815GNUNET_TESTING_interpreter_current_cmd_get_label (
816 struct GNUNET_TESTING_Interpreter *is)
817{
818 return is->commands[is->ip].label.value;
819}
820
821
822/**
823 * State for a "rewind" CMD.
824 */
825struct RewindIpState
826{
827 /**
828 * Instruction pointer to set into the interpreter.
829 */
830 const char *target_label;
831
832 /**
833 * How many times this set should take place. However, this value lives at
834 * the calling process, and this CMD is only in charge of checking and
835 * decremeting it.
836 */
837 unsigned int counter;
838};
839
840
841/**
842 * Seek for the @a target command in @a batch (and rewind to it
843 * if successful).
844 *
845 * @param is the interpreter state (for failures)
846 * @param cmd batch to search for @a target
847 * @param target command to search for
848 * @return #GNUNET_OK on success, #GNUNET_NO if target was not found,
849 * #GNUNET_SYSERR if target is in the future and we failed
850 */
851static enum GNUNET_GenericReturnValue
852seek_batch (struct GNUNET_TESTING_Interpreter *is,
853 const struct GNUNET_TESTING_Command *cmd,
854 const struct GNUNET_TESTING_Command *target)
855{
856 unsigned int new_ip;
857 struct GNUNET_TESTING_Command **batch;
858 const struct GNUNET_TESTING_Command *current;
859 const struct GNUNET_TESTING_Command *icmd;
860 bool found = false;
861
862 GNUNET_assert (GNUNET_OK ==
863 GNUNET_TESTING_get_trait_cmd (cmd,
864 &current));
865 GNUNET_assert (GNUNET_OK ==
866 GNUNET_TESTING_get_trait_batch_cmds (cmd,
867 &batch));
868 for (new_ip = 0;
869 NULL != (icmd = &((*batch)[new_ip]))->run;
870 new_ip++)
871 {
872 if (current == target)
873 current = NULL;
874 if (icmd == target)
875 {
876 found = true;
877 break;
878 }
879 if (GNUNET_TESTING_cmd_is_batch_ (icmd))
880 {
881 enum GNUNET_GenericReturnValue ret
882 = seek_batch (is,
883 icmd,
884 target);
885 if (GNUNET_SYSERR == ret)
886 return GNUNET_SYSERR; /* failure! */
887 if (GNUNET_OK == ret)
888 {
889 found = true;
890 break;
891 }
892 }
893 }
894 if (! found)
895 return GNUNET_NO; /* not found */
896 if (NULL == current)
897 {
898 /* refuse to jump forward */
899 GNUNET_break (0);
900 GNUNET_TESTING_interpreter_fail (is);
901 return GNUNET_SYSERR;
902 }
903 GNUNET_TESTING_cmd_batch_set_current_ (cmd,
904 new_ip);
905 return GNUNET_OK;
906}
907
908
909/**
910 * Run the "rewind" CMD.
911 *
912 * @param cls closure.
913 * @param cmd command being executed now.
914 * @param is the interpreter state.
915 */
916static void
917rewind_ip_run (void *cls,
918 struct GNUNET_TESTING_Interpreter *is)
919{
920 struct RewindIpState *ris = cls;
921 const struct GNUNET_TESTING_Command *target;
922 const struct GNUNET_TESTING_Command *icmd;
923 unsigned int new_ip;
924 bool found = false;
925
926 if (0 == ris->counter)
927 return;
928 target
929 = GNUNET_TESTING_interpreter_lookup_command (is,
930 ris->target_label);
931 if (NULL == target)
932 {
933 GNUNET_break (0);
934 GNUNET_TESTING_interpreter_fail (is);
935 return;
936 }
937 ris->counter--;
938 for (new_ip = 0;
939 NULL != (icmd = &is->commands[new_ip])->run;
940 new_ip++)
941 {
942 if (icmd == target)
943 {
944 found = true;
945 break;
946 }
947 if (GNUNET_TESTING_cmd_is_batch_ (icmd))
948 {
949 enum GNUNET_GenericReturnValue ret
950 = seek_batch (is,
951 icmd,
952 target);
953 if (GNUNET_SYSERR == ret)
954 {
955 /* failure! */
956 GNUNET_break (0);
957 GNUNET_TESTING_interpreter_fail (is);
958 return;
959 }
960 if (GNUNET_OK == ret)
961 {
962 /* counter subtraction below for batch */
963 found = true;
964 break;
965 }
966 }
967 }
968 if (! found)
969 {
970 GNUNET_break (0);
971 GNUNET_TESTING_interpreter_fail (is);
972 return;
973 }
974 if (new_ip > (unsigned int) is->ip)
975 {
976 /* refuse to jump forward */
977 GNUNET_break (0);
978 GNUNET_TESTING_interpreter_fail (is);
979 return;
980 }
981 is->ip = new_ip;
982}
983
984
985static void
986rewind_ip_free (void *cls)
987{
988 struct RewindIpState *ris = cls;
989
990 GNUNET_free (ris);
991}
992
993
994struct GNUNET_TESTING_Command
995GNUNET_TESTING_cmd_rewind_ip (const char *label,
996 const char *target_label,
997 unsigned int counter)
998{
999 struct RewindIpState *ris;
1000
1001 ris = GNUNET_new (struct RewindIpState);
1002 ris->target_label = target_label;
1003 ris->counter = counter;
1004 return GNUNET_TESTING_command_new (ris,
1005 label,
1006 &rewind_ip_run,
1007 &rewind_ip_free,
1008 NULL);
1009}
1010
1011
1012/* end of testing_api_loop.c */
diff --git a/src/lib/testing/testing_api_loop.h b/src/lib/testing/testing_api_loop.h
new file mode 100644
index 000000000..2a3047183
--- /dev/null
+++ b/src/lib/testing/testing_api_loop.h
@@ -0,0 +1,163 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_loop.h
23 * @brief
24 * @author t3sserakt
25 */
26#ifndef TESTING_API_LOOP_H
27#define TESTING_API_LOOP_H
28
29#include "testing_api_barrier.h"
30
31
32/**
33 * Callback function to write messages from the helper process running on a netjail node to the master process.
34 *
35 * @param message The message to write.
36 */
37typedef void
38(*GNUNET_TESTING_cmd_helper_write_cb) (
39 const struct GNUNET_MessageHeader *message);
40
41
42/**
43 * The plugin API every test case plugin has to implement.
44 */
45struct GNUNET_TESTING_PluginFunctions
46{
47
48 /**
49 * Closure to pass to start_testcase.
50 */
51 void *cls;
52
53 /**
54 * Function to be implemented for each test case plugin which starts the test case on a netjail node.
55 *
56 * @param topology_data A file name for the file containing the topology configuration, or a string containing
57 * the topology configuration.
58 * @param barrier_count length of the @a barriers array
59 * @param barriers inherited barriers
60 * @param write_message Callback function to write messages from the helper process running on a
61 * netjail node to the master process.
62 * @param finish_cb Callback function which writes a message from the helper process running on a netjail
63 * node to the master process * signaling that the test case running on the netjail node finished.
64 * @return Returns The struct GNUNET_TESTING_Interpreter of the command loop running on this netjail node.
65 */
66 struct GNUNET_TESTING_Interpreter *
67 (*start_testcase) (
68 void *cls,
69 const char *topology_data,
70 uint32_t barrier_count,
71 const struct GNUNET_ShortHashCode *barriers,
72 GNUNET_TESTING_cmd_helper_write_cb write_message,
73 GNUNET_TESTING_ResultCallback finish_cb,
74 void *finish_cb_cls);
75
76};
77
78
79/**
80 * Send message to our parent. Fails very hard if
81 * we do not have one.
82 *
83 * @param is The interpreter loop.
84 */
85void
86GNUNET_TESTING_loop_notify_parent_ (
87 struct GNUNET_TESTING_Interpreter *is,
88 const struct GNUNET_MessageHeader *hdr);
89
90
91/**
92 * Send message to all netjail children (if there
93 * are any).
94 *
95 * @param is The interpreter loop.
96 */
97void
98GNUNET_TESTING_loop_notify_children_ (
99 struct GNUNET_TESTING_Interpreter *is,
100 const struct GNUNET_MessageHeader *hdr);
101
102
103/**
104 * Current command is done, run the next one.
105 */
106void
107GNUNET_TESTING_interpreter_next_ (void *cls);
108
109
110void
111GNUNET_TESTING_interpreter_run_cmd_ (
112 struct GNUNET_TESTING_Interpreter *is,
113 struct GNUNET_TESTING_Command *cmd);
114
115/**
116 * Adding a helper handle to the interpreter.
117 *
118 * @param is The interpreter.
119 * @param helper The helper handle.
120 */
121void
122GNUNET_TESTING_add_netjail_helper_ (
123 struct GNUNET_TESTING_Interpreter *is,
124 struct GNUNET_HELPER_Handle *helper);
125
126
127/**
128 * Add a barrier to the interpreter to share it with
129 * all children as an inherited barrier.
130 *
131 * @param is The interpreter.
132 * @param barrier The barrier to add.
133 */
134void
135GNUNET_TESTING_add_barrier_ (
136 struct GNUNET_TESTING_Interpreter *is,
137 struct GNUNET_TESTING_Barrier *barrier);
138
139
140struct GNUNET_TESTING_Barrier *
141GNUNET_TESTING_get_barrier2_ (
142 struct GNUNET_TESTING_Interpreter *is,
143 const struct GNUNET_ShortHashCode *create_key);
144
145
146struct GNUNET_TESTING_Barrier *
147GNUNET_TESTING_get_barrier_ (
148 struct GNUNET_TESTING_Interpreter *is,
149 const char *barrier_name);
150
151
152unsigned int
153GNUNET_TESTING_barrier_count_ (
154 struct GNUNET_TESTING_Interpreter *is);
155
156
157void
158GNUNET_TESTING_barrier_iterate_ (
159 struct GNUNET_TESTING_Interpreter *is,
160 GNUNET_CONTAINER_ShortmapIterator cb,
161 void *cb_cls);
162
163#endif
diff --git a/src/lib/testing/testing_api_main.c b/src/lib/testing/testing_api_main.c
new file mode 100644
index 000000000..fc60cb2c9
--- /dev/null
+++ b/src/lib/testing/testing_api_main.c
@@ -0,0 +1,140 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021-2024 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_loop.c
23 * @brief main interpreter loop for testcases
24 * @author Christian Grothoff (GNU Taler testing)
25 * @author Marcello Stanisci (GNU Taler testing)
26 * @author t3sserakt
27 */
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_testing_lib.h"
31
32
33/**
34 * Closure for #loop_run().
35 */
36struct MainParams
37{
38
39 /**
40 * NULL-label terminated array of commands.
41 */
42 const struct GNUNET_TESTING_Command *commands;
43
44 /**
45 * The interpreter.
46 */
47 struct GNUNET_TESTING_Interpreter *is;
48
49 /**
50 * Global timeout for the test.
51 */
52 struct GNUNET_TIME_Relative timeout;
53
54 /**
55 * Set to #EXIT_FAILURE on error.
56 */
57 int rv;
58};
59
60
61/**
62 * Function called with the final result of the test.
63 *
64 * @param cls the `struct MainParams`
65 * @param rv #GNUNET_OK if the test passed
66 */
67static void
68handle_result (void *cls,
69 enum GNUNET_GenericReturnValue rv)
70{
71 struct MainParams *mp = cls;
72
73 mp->is = NULL;
74 switch (rv)
75 {
76 case GNUNET_OK:
77 mp->rv = EXIT_SUCCESS;
78 break;
79 case GNUNET_NO:
80 mp->rv = 77;
81 break;
82 case GNUNET_SYSERR:
83 mp->rv = EXIT_FAILURE;
84 break;
85 }
86 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
87 "Test exits with status %d\n",
88 mp->rv);
89 GNUNET_SCHEDULER_shutdown ();
90}
91
92
93static void
94do_shutdown (void *cls)
95{
96 struct MainParams *mp = cls;
97
98 if (NULL != mp->is)
99 {
100 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
101 "Terminating test due to shutdown\n");
102 GNUNET_TESTING_interpreter_fail (mp->is);
103 }
104}
105
106
107/**
108 * Main function to run the test cases.
109 *
110 * @param cls a `struct MainParams *`
111 */
112static void
113loop_run (void *cls)
114{
115 struct MainParams *mp = cls;
116
117 mp->is = GNUNET_TESTING_run (mp->commands,
118 mp->timeout,
119 &handle_result,
120 mp);
121 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
122 mp);
123}
124
125
126int
127GNUNET_TESTING_main (
128 const struct GNUNET_TESTING_Command *commands,
129 struct GNUNET_TIME_Relative timeout)
130{
131 struct MainParams mp = {
132 .commands = commands,
133 .timeout = timeout,
134 .rv = EXIT_SUCCESS
135 };
136
137 GNUNET_SCHEDULER_run (&loop_run,
138 &mp);
139 return mp.rv;
140}
diff --git a/src/lib/testing/testing_api_topology.c b/src/lib/testing/testing_api_topology.c
new file mode 100644
index 000000000..b83d7ba10
--- /dev/null
+++ b/src/lib/testing/testing_api_topology.c
@@ -0,0 +1,1308 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing.c
23 * @brief convenience API for writing testcases for GNUnet
24 * Many testcases need to start and stop a peer/service
25 * and this library is supposed to make that easier
26 * for TESTCASES. Normal programs should always
27 * use functions from gnunet_{util,arm}_lib.h. This API is
28 * ONLY for writing testcases (or internal use of the testbed).
29 * @author Christian Grothoff
30 *
31 */
32#include "platform.h"
33#include "gnunet_util_lib.h"
34#include "gnunet_testing_lib.h"
35#include "testing_api_topology.h"
36#include "testing_cmds.h"
37
38#define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
39
40#define CONNECT_ADDRESS_TEMPLATE "%s-192.168.15.%u"
41
42#define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-92.68.150.%u"
43
44#define KNOWN_CONNECT_ADDRESS_TEMPLATE "%s-92.68.151.%u"
45
46#define PREFIX_TCP "tcp"
47
48#define PREFIX_UDP "udp"
49
50#define PREFIX_TCP_NATTED "tcp_natted"
51
52#define PREFIX_UDP_NATTED "udp_natted"
53
54
55/**
56 * Every line in the topology configuration starts with a string indicating which
57 * kind of information will be configured with this line. Configuration values following
58 * this string are seperated by special sequences of characters. An integer value seperated
59 * by ':' is returned by this function.
60 *
61 * @param line The line of configuration. Example: "a:42[:43]"
62 * @return An integer value (42)
63 */
64static unsigned int
65get_first_value (const char *line)
66{
67 const char *colon = strchr (line, ':');
68 char dummy;
69 int ret;
70
71 GNUNET_assert (NULL != colon);
72 ret = sscanf (colon + 1,
73 "%u%c",
74 &ret,
75 &dummy);
76 if (2 == ret)
77 GNUNET_assert (':' == dummy);
78 else
79 GNUNET_assert (1 == ret);
80 return ret;
81}
82
83
84/**
85 * Every line in the topology configuration starts with a string indicating
86 * which kind of information will be configured with this line. This string is
87 * returned by this function.
88 *
89 * @param line The line of configuration, e.g. "D:452"
90 * @return The leading string of this configuration line ("D")
91 */
92static char *
93get_key (const char *line)
94{
95 const char *colon = strchr (line, ':');
96
97 GNUNET_assert (NULL != colon);
98 return GNUNET_strndup (line,
99 colon - line);
100}
101
102
103/**
104 * Every line in the topology configuration starts with a string indicating which
105 * kind of information will be configured with this line. Configuration values following
106 * this string are seperated by special sequences of characters. A string value seperated
107 * by ':' is returned by this function.
108 *
109 * @param line The line of configuration ("FOO:BAR")
110 * @return A string value ("BAR").
111 */
112// FIXME: avoid strdup, return const?
113static char *
114get_first_string_value (const char *line)
115{
116 const char *colon = strchr (line, ':');
117
118 GNUNET_assert (NULL != colon);
119 return GNUNET_strdup (colon + 1);
120}
121
122
123/**
124 * Every line in the topology configuration starts with a string indicating
125 * which kind of information will be configured with this line. Configuration
126 * values following this string are seperated by special sequences of
127 * characters. A second integer value seperated by ':' from a first value is
128 * returned by this function.
129 *
130 * @param line The line of configuration (example: "P:1:3")
131 * @return An integer value (3)
132 */
133static unsigned int
134get_second_value (const char *line)
135{
136 const char *colon;
137 char dummy;
138 int ret;
139
140 colon = strchr (line, ':');
141 GNUNET_assert (NULL != colon);
142 colon = strchr (colon + 1, ':');
143 GNUNET_assert (NULL != colon);
144 GNUNET_assert (1 ==
145 sscanf (colon + 1,
146 "%u%c",
147 &ret,
148 &dummy));
149 return ret;
150}
151
152
153/**
154 * Every line in the topology configuration starts with a string indicating which
155 * kind of information will be configured with this line. Configuration values following
156 * this string are seperated by special sequences of characters. A value might be
157 * a key value pair.
158 * This function returns the value for a specific key in a configuration line.
159 *
160 * @param key The key of the key value pair.
161 * @return The value of the key value pair.
162 */
163static char *
164get_value (const char *key, const char *line)
165{
166 char copy[strlen (line) + 1];
167 size_t slen;
168 char *token;
169 char *token2;
170 char *temp;
171 char *rest = NULL;
172
173 slen = strlen (line) + 1;
174 memcpy (copy, line, slen);
175 temp = strstr (copy, key);
176 if (NULL == temp)
177 return NULL;
178 token = strtok_r (temp, ":", &rest);
179 if (NULL == token)
180 return NULL;
181 token = strtok_r (NULL, ":", &rest);
182 if (NULL == token)
183 return NULL;
184 token2 = strtok_r (token, "}", &rest);
185 if (NULL == token2)
186 return NULL;
187 return GNUNET_strdup (token2);
188}
189
190
191/**
192 * Every line in the topology configuration starts with a string indicating which
193 * kind of information will be configured with this line. Configuration values following
194 * this string are seperated by special sequences of characters. A value might be
195 * a key value pair. A special key is the 'connect' key which can appear more than once.
196 * The value is the information about a connection via some protocol to some other node.
197 * This function returns the struct GNUNET_TESTING_NodeConnection which holds the information
198 * of the connect value.
199 *
200 * @param value The value of the connect key value pair.
201 * @return The struct GNUNET_TESTING_NodeConnection.
202 */
203static struct GNUNET_TESTING_NodeConnection *
204get_connect_value (const char *line,
205 struct GNUNET_TESTING_NetjailNode *node)
206{
207 struct GNUNET_TESTING_NodeConnection *node_connection;
208 char *copy;
209 char *token;
210 char *token2;
211 unsigned int node_n;
212 unsigned int namespace_n;
213 char *rest = NULL;
214 char *rest2 = NULL;
215 struct GNUNET_TESTING_AddressPrefix *prefix;
216 unsigned int sscanf_ret;
217
218 node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection);
219 node_connection->node = node;
220
221 copy = GNUNET_strdup (line);
222 token = strtok_r (copy, ":", &rest);
223 if (0 == strcmp ("{K", token))
224 {
225 node_connection->node_type = GNUNET_TESTING_GLOBAL_NODE;
226 token = strtok_r (NULL, ":", &rest);
227 GNUNET_assert (1 == sscanf (token, "%u", &node_n));
228 LOG (GNUNET_ERROR_TYPE_DEBUG,
229 "node_n %u\n",
230 node_n);
231 node_connection->node_n = node_n;
232 node_connection->namespace_n = 0;
233 }
234 else if (0 == strcmp ("{P", token))
235 {
236 node_connection->node_type = GNUNET_TESTING_SUBNET_NODE;
237 token = strtok_r (NULL, ":", &rest);
238 errno = 0;
239 sscanf_ret = sscanf (token, "%u", &namespace_n);
240 if (errno != 0)
241 {
242 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
243 }
244 GNUNET_assert (0 < sscanf_ret);
245 node_connection->namespace_n = namespace_n;
246 token = strtok_r (NULL, ":", &rest);
247 errno = 0;
248 sscanf_ret = sscanf (token, "%u", &node_n);
249 if (errno != 0)
250 {
251 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
252 }
253 GNUNET_assert (0 < sscanf_ret);
254 node_connection->node_n = node_n;
255 LOG (GNUNET_ERROR_TYPE_DEBUG,
256 "node_n %u namespace_n %u node->node_n %u node->namespace_n %u\n",
257 node_n,
258 namespace_n,
259 node->node_n,
260 node->namespace_n);
261 }
262 else
263 {
264 GNUNET_break (0);
265 GNUNET_free (node_connection);
266 GNUNET_free (copy);
267 return NULL;
268 }
269
270 while (NULL != (token = strtok_r (NULL, ":", &rest)))
271 {
272 prefix = GNUNET_new (struct GNUNET_TESTING_AddressPrefix);
273 token2 = strtok_r (token, "}", &rest2);
274 if (NULL != token2)
275 prefix->address_prefix = GNUNET_strdup (token2);
276 else
277 prefix->address_prefix = GNUNET_strdup (token);
278
279 LOG (GNUNET_ERROR_TYPE_DEBUG,
280 "address_prefix %s\n",
281 prefix->address_prefix);
282
283 GNUNET_CONTAINER_DLL_insert (node_connection->address_prefixes_head,
284 node_connection->address_prefixes_tail,
285 prefix);
286 LOG (GNUNET_ERROR_TYPE_DEBUG,
287 "address_prefix %s\n",
288 prefix->address_prefix);
289 }
290
291 GNUNET_free (copy);
292 return node_connection;
293}
294
295
296/**
297 * Every line in the topology configuration starts with a string indicating which
298 * kind of information will be configured with this line. Configuration values following
299 * this string are seperated by special sequences of characters. A value might be
300 * a key value pair. A special key is the 'connect' key.
301 * The value is the information about a connections via some protocol to other nodes.
302 * Each connection itself is a key value pair separated by the character '|' and
303 * surrounded by the characters '{' and '}'.
304 * The struct GNUNET_TESTING_NodeConnection holds the information of each connection value.
305 * This function extracts the values of each connection into a DLL of
306 * struct GNUNET_TESTING_NodeConnection which will be added to a node.
307 *
308 * @param line The line of configuration.
309 * @param node The struct GNUNET_TESTING_NetjailNode to which the DLL of
310 * struct GNUNET_TESTING_NodeConnection will be added.
311 */
312static void
313node_connections (const char *line,
314 struct GNUNET_TESTING_NetjailNode *node)
315{
316 char *value, *value2;
317 char *temp;
318 char *copy;
319 char *rest = NULL;
320 char *rest2 = NULL;
321 struct GNUNET_TESTING_NodeConnection *node_connection;
322
323 temp = strstr (line, "connect");
324 if (NULL != temp)
325 {
326 copy = GNUNET_strdup (temp);
327 strtok_r (copy, ":", &rest);
328 value = strtok_r (rest, "|", &rest2);
329
330 while (NULL != value)
331 {
332 LOG (GNUNET_ERROR_TYPE_DEBUG,
333 "node_connections value %s\n",
334 value);
335 node_connection = get_connect_value (value, node);
336 if (NULL == node_connection)
337 {
338 LOG (GNUNET_ERROR_TYPE_WARNING,
339 "connect key was not expected in this configuration line: %s\n",
340 line);
341 break;
342 }
343 GNUNET_CONTAINER_DLL_insert (node->node_connections_head,
344 node->node_connections_tail,
345 node_connection);
346 value2 = strstr (value, "}}");
347 if (NULL != value2)
348 break;
349 value = strtok_r (NULL, "|", &rest2);
350
351 }
352 GNUNET_free (copy);
353 }
354}
355
356
357/**
358 * A helper function to log information about individual nodes.
359 *
360 * @param cls This is not used actually.
361 * @param id The key of this value in the map.
362 * @param value A struct GNUNET_TESTING_NetjailNode which holds information about a node.
363 * return GNUNET_YES to continue with iterating, GNUNET_NO otherwise.
364 */
365static int
366log_nodes (void *cls,
367 const struct GNUNET_ShortHashCode *id,
368 void *value)
369{
370 struct GNUNET_TESTING_NetjailNode *node = value;
371 struct GNUNET_TESTING_NodeConnection *pos_connection;
372 struct GNUNET_TESTING_AddressPrefix *pos_prefix;
373
374 LOG (GNUNET_ERROR_TYPE_DEBUG,
375 "plugin: %s space: %u node: %u global: %u\n",
376 node->plugin,
377 node->namespace_n,
378 node->node_n,
379 node->is_global);
380
381 for (pos_connection = node->node_connections_head; NULL != pos_connection;
382 pos_connection = pos_connection->next)
383 {
384
385 LOG (GNUNET_ERROR_TYPE_DEBUG,
386 "namespace_n: %u node_n: %u node_type: %u\n",
387 pos_connection->namespace_n,
388 pos_connection->node_n,
389 pos_connection->node_type);
390
391 for (pos_prefix = pos_connection->address_prefixes_head; NULL != pos_prefix;
392 pos_prefix =
393 pos_prefix->next)
394 {
395 LOG (GNUNET_ERROR_TYPE_DEBUG,
396 "prefix: %s\n",
397 pos_prefix->address_prefix);
398 }
399 }
400 return GNUNET_YES;
401}
402
403
404/**
405 * Helper function to log information about namespaces.
406 *
407 * @param cls This is not used actually.
408 * @param id The key of this value in the map.
409 * @param value A struct GNUNET_TESTING_NetjailNamespace which holds information about a subnet.
410 * return GNUNET_YES to continue with iterating, GNUNET_NO otherwise.
411 */
412static int
413log_namespaces (void *cls,
414 const struct GNUNET_ShortHashCode *id,
415 void *value)
416{
417 struct GNUNET_TESTING_NetjailNamespace *namespace = value;
418
419 GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes,
420 &log_nodes,
421 NULL);
422 return GNUNET_YES;
423}
424
425
426/**
427 * Helper function to log the configuration in case of a problem with configuration.
428 *
429 * @param topology The struct GNUNET_TESTING_NetjailTopology holding the configuration information.
430 */
431static int
432log_topo (const struct GNUNET_TESTING_NetjailTopology *topology)
433{
434 LOG (GNUNET_ERROR_TYPE_DEBUG,
435 "plugin: %s spaces: %u nodes: %u known: %u\n",
436 topology->plugin,
437 topology->namespaces_n,
438 topology->nodes_m,
439 topology->nodes_x);
440
441 GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces,
442 log_namespaces, NULL);
443 GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals, &log_nodes,
444 NULL);
445 return GNUNET_YES;
446}
447
448
449/**
450 * This function extracts information about a specific node from the topology.
451 *
452 * @param num The global index number of the node.
453 * @param[out] node_ex A struct GNUNET_TESTING_NetjailNode with information about the node.
454 * @param[out] namespace_ex A struct GNUNET_TESTING_NetjailNamespace with information about the namespace
455 the node is in or NULL, if the node is a global node.
456 * @param[out] node_connections_ex A struct GNUNET_TESTING_NodeConnection with information about the connection
457 of this node to other nodes.
458*/
459static void
460get_node_info (unsigned int num,
461 const struct GNUNET_TESTING_NetjailTopology *topology,
462 struct GNUNET_TESTING_NetjailNode **node_ex,
463 struct GNUNET_TESTING_NetjailNamespace **namespace_ex,
464 struct GNUNET_TESTING_NodeConnection **node_connections_ex)
465{
466 struct GNUNET_ShortHashCode hkey;
467 struct GNUNET_HashCode hc;
468 unsigned int namespace_n;
469 unsigned int node_m;
470 struct GNUNET_TESTING_NetjailNode *node;
471 struct GNUNET_TESTING_NetjailNamespace *namespace;
472 struct GNUNET_TESTING_NodeConnection *node_connections = NULL;
473
474 log_topo (topology);
475 LOG (GNUNET_ERROR_TYPE_DEBUG,
476 "num: %u \n",
477 num);
478 if (topology->nodes_x >= num)
479 {
480
481 GNUNET_CRYPTO_hash (&num, sizeof(num), &hc);
482 memcpy (&hkey,
483 &hc,
484 sizeof (hkey));
485 node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
486 &hkey);
487 if (NULL != node)
488 {
489 *node_ex = node;
490 *node_connections_ex = node->node_connections_head;
491 }
492 }
493 else
494 {
495 namespace_n = (unsigned int) ceil ((double) (num - topology->nodes_x)
496 / topology->nodes_m);
497 LOG (GNUNET_ERROR_TYPE_DEBUG,
498 "ceil num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n",
499 num,
500 topology->nodes_x,
501 topology->nodes_m,
502 namespace_n);
503 GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc);
504 memcpy (&hkey,
505 &hc,
506 sizeof (hkey));
507 namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
508 &hkey);
509 if (NULL != namespace)
510 {
511 node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
512 GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
513 memcpy (&hkey,
514 &hc,
515 sizeof (hkey));
516 node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
517 &hkey);
518 if (NULL != node)
519 {
520 LOG (GNUNET_ERROR_TYPE_DEBUG,
521 "node additional_connects: %u %p\n",
522 node->additional_connects,
523 node);
524 node_connections = node->node_connections_head;
525 }
526 *node_ex = node;
527 *namespace_ex = namespace;
528 *node_connections_ex = node_connections;
529 }
530 }
531}
532
533
534/**
535 * Get a node from the topology.
536 *
537 * @param num The specific node we want the connections for.
538 * @param topology The topology we get the connections from.
539 * @return The connections of the node.
540 */
541struct GNUNET_TESTING_NetjailNode *
542GNUNET_TESTING_get_node (unsigned int num,
543 struct GNUNET_TESTING_NetjailTopology *topology)
544{
545 struct GNUNET_TESTING_NetjailNode *node;
546 struct GNUNET_TESTING_NetjailNamespace *namespace;
547 struct GNUNET_TESTING_NodeConnection *node_connections;
548
549 get_node_info (num, topology, &node, &namespace, &node_connections);
550
551 return node;
552
553}
554
555
556/**
557 * Get the connections to other nodes for a specific node.
558 *
559 * @param num The specific node we want the connections for.
560 * @param topology The topology we get the connections from.
561 * @return The connections of the node.
562 */
563struct GNUNET_TESTING_NodeConnection *
564GNUNET_TESTING_get_connections (unsigned int num,
565 const struct
566 GNUNET_TESTING_NetjailTopology *topology)
567{
568 struct GNUNET_TESTING_NetjailNode *node;
569 struct GNUNET_TESTING_NetjailNamespace *namespace;
570 struct GNUNET_TESTING_NodeConnection *node_connections;
571
572 LOG (GNUNET_ERROR_TYPE_DEBUG,
573 "get_connections\n");
574
575 get_node_info (num, topology, &node, &namespace, &node_connections);
576
577 return node_connections;
578}
579
580
581int
582free_nodes_cb (void *cls,
583 const struct GNUNET_ShortHashCode *key,
584 void *value)
585{
586 (void) cls;
587 struct GNUNET_TESTING_NetjailNode *node = value;
588 struct GNUNET_TESTING_NodeConnection *pos_connection;
589 struct GNUNET_TESTING_AddressPrefix *pos_prefix;
590
591 while (NULL != (pos_connection = node->node_connections_head))
592 {
593 while (NULL != (pos_prefix = pos_connection->address_prefixes_head))
594 {
595 GNUNET_CONTAINER_DLL_remove (pos_connection->address_prefixes_head,
596 pos_connection->address_prefixes_tail,
597 pos_prefix);
598 GNUNET_free (pos_prefix->address_prefix);
599 GNUNET_free (pos_prefix);
600 }
601 GNUNET_CONTAINER_DLL_remove (node->node_connections_head,
602 node->node_connections_tail,
603 pos_connection);
604 GNUNET_free (pos_connection);
605 }
606
607 GNUNET_free (node->plugin);
608 GNUNET_free (node);
609 return GNUNET_OK;
610}
611
612
613int
614free_namespaces_cb (void *cls,
615 const struct GNUNET_ShortHashCode *key,
616 void *value)
617{
618 (void) cls;
619 struct GNUNET_TESTING_NetjailNamespace *namespace = value;
620
621 GNUNET_free (namespace->router);
622 GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes, free_nodes_cb,
623 namespace->nodes);
624 return GNUNET_OK;
625
626}
627
628
629static int
630free_value_cb (void *cls,
631 const struct GNUNET_ShortHashCode *key,
632 void *value)
633{
634 (void) cls;
635
636 GNUNET_free (value);
637}
638
639/**
640 * Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
641 *
642 * @param topology The GNUNET_TESTING_NetjailTopology to be deallocated.
643 */
644void
645GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology)
646{
647 GNUNET_CONTAINER_multishortmap_iterate (topology->backbone_peers,
648 &free_value_cb,
649 NULL);
650 /*GNUNET_CONTAINER_multishortmap_iterate (topology->carriers,
651 &free_carriers_cb,
652 NULL);*/
653 GNUNET_free (topology->plugin);
654 GNUNET_free (topology);
655}
656
657
658/**
659 * Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
660 *
661 * @param topology The GNUNET_TESTING_NetjailTopology to be deallocated.
662 *
663void
664GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology)
665{
666 GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces,
667 &free_namespaces_cb,
668 NULL);
669 GNUNET_CONTAINER_multishortmap_destroy (topology->map_namespaces);
670 GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals,
671 &free_nodes_cb,
672 NULL);
673 GNUNET_CONTAINER_multishortmap_destroy (topology->map_globals);
674 GNUNET_free (topology->plugin);
675 GNUNET_free (topology);
676 }*/
677
678
679unsigned int
680GNUNET_TESTING_calculate_num (
681 struct GNUNET_TESTING_NodeConnection *node_connection,
682 struct GNUNET_TESTING_NetjailTopology *topology)
683{
684 unsigned int n, m, num;
685
686 n = node_connection->namespace_n;
687 m = node_connection->node_n;
688
689 if (0 == n)
690 num = m;
691 else
692 num = (n - 1) * topology->nodes_m + m + topology->nodes_x;
693
694 return num;
695}
696
697
698/**
699 * Get the address for a specific communicator from a connection.
700 *
701 * @param connection The connection we like to have the address from.
702 * @param prefix The communicator protocol prefix.
703 * @return The address of the communicator.
704 */
705char *
706GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection,
707 const char *prefix)
708{
709 struct GNUNET_TESTING_NetjailNode *node;
710 char *addr;
711 char *template;
712 unsigned int node_n;
713
714 LOG (GNUNET_ERROR_TYPE_DEBUG,
715 "get address prefix: %s node_n: %u\n",
716 prefix,
717 connection->node_n);
718
719 node = connection->node;
720 if (connection->namespace_n == node->namespace_n)
721 {
722 template = CONNECT_ADDRESS_TEMPLATE;
723 node_n = connection->node_n;
724 }
725 else if (0 == connection->namespace_n)
726 {
727 template = KNOWN_CONNECT_ADDRESS_TEMPLATE;
728 node_n = connection->node_n;
729 }
730 else if (1 == connection->node_n)
731 {
732 template = ROUTER_CONNECT_ADDRESS_TEMPLATE;
733 node_n = connection->namespace_n;
734 }
735 else
736 {
737 return NULL;
738 }
739
740 if (0 == strcmp (PREFIX_TCP, prefix) ||
741 0 == strcmp (PREFIX_UDP, prefix) ||
742 0 == strcmp (PREFIX_UDP_NATTED, prefix) ||
743 0 == strcmp (PREFIX_TCP_NATTED, prefix))
744 {
745 GNUNET_asprintf (&addr,
746 template,
747 prefix,
748 node_n);
749 }
750 else
751 {
752 GNUNET_assert (0);
753 }
754
755 return addr;
756}
757
758
759/**
760 * Get the number of unintentional additional connections the node waits for.
761 *
762 * @param num The specific node we want the additional connects for.
763 * @return The number of additional connects
764 */
765unsigned int
766GNUNET_TESTING_get_additional_connects (unsigned int num,
767 struct GNUNET_TESTING_NetjailTopology *
768 topology)
769{
770 struct GNUNET_TESTING_NetjailNode *node;
771 struct GNUNET_TESTING_NetjailNamespace *namespace;
772 struct GNUNET_TESTING_NodeConnection *node_connections;
773
774 LOG (GNUNET_ERROR_TYPE_DEBUG,
775 "get_additional_connects\n");
776
777 get_node_info (num, topology, &node, &namespace, &node_connections);
778
779 if (NULL == node)
780 {
781 LOG (GNUNET_ERROR_TYPE_WARNING,
782 "No info found for node %d\n", num);
783 return 0;
784 }
785 LOG (GNUNET_ERROR_TYPE_DEBUG,
786 "node additional_connects for node %p\n",
787 node);
788 LOG (GNUNET_ERROR_TYPE_DEBUG,
789 "node additional_connects: %u\n",
790 node->additional_connects);
791
792 return node->additional_connects;
793}
794
795char *
796GNUNET_TESTING_get_plugin_from_topo (
797 struct GNUNET_TESTING_NetjailTopology *njt,
798 const char *my_node_id)
799{
800 return njt->plugin;
801}
802
803
804static void
805create_subnet_peers (struct GNUNET_CONFIGURATION_Handle *cfg,
806 struct GNUNET_TESTING_NetjailTopology *topology,
807 struct GNUNET_TESTING_NetjailSubnet *subnet)
808{
809 struct GNUNET_HashCode hc;
810
811 for (int i = 1; i < subnet->number_peers; i++)
812 {
813 struct GNUNET_ShortHashCode hkey;
814 struct GNUNET_TESTING_NetjailSubnetPeer *subnet_peer = GNUNET_new (struct GNUNET_TESTING_NetjailSubnetPeer);
815
816 topology->total++;
817 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
818 memcpy (&hkey,
819 &hc,
820 sizeof (hkey));
821 GNUNET_CONTAINER_multishortmap_put (subnet->peers,
822 &hkey,
823 subnet_peer,
824 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
825 }
826}
827
828
829static void
830create_subnets (struct GNUNET_CONFIGURATION_Handle *cfg,
831 struct GNUNET_TESTING_NetjailTopology *topology,
832 struct GNUNET_TESTING_NetjailCarrier *carrier)
833{
834 struct GNUNET_HashCode hc;
835
836 for (int i = 1; i < carrier->number_subnets; i++)
837 {
838 struct GNUNET_ShortHashCode hkey;
839 struct GNUNET_TESTING_NetjailSubnet *subnet = GNUNET_new (struct GNUNET_TESTING_NetjailSubnet);
840 char *section;
841
842 topology->total++;
843 subnet->number = topology->total;
844 subnet->index = i;
845 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
846 memcpy (&hkey,
847 &hc,
848 sizeof (hkey));
849 GNUNET_CONTAINER_multishortmap_put (carrier->subnets,
850 &hkey,
851 subnet,
852 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
853 GNUNET_asprintf (&section, "CARRIER-%u-SUBNET-%u", carrier->index, i);
854 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
855 section,
856 "SUBNET_PEERS",
857 (unsigned long long *) &subnet->number_peers))
858 {
859 subnet->number_peers = topology->default_subnet_peers;
860 }
861
862 create_subnet_peers (cfg, topology, subnet);
863
864 GNUNET_free (section);
865 }
866}
867
868
869static void
870create_peers (struct GNUNET_CONFIGURATION_Handle *cfg,
871 struct GNUNET_TESTING_NetjailTopology *topology,
872 struct GNUNET_TESTING_NetjailCarrier *carrier)
873{
874 struct GNUNET_HashCode hc;
875
876 for (int i = 1; i < carrier->number_peers; i++)
877 {
878 struct GNUNET_ShortHashCode hkey;
879 struct GNUNET_TESTING_NetjailCarrierPeer *peer = GNUNET_new (struct GNUNET_TESTING_NetjailCarrierPeer);
880
881 topology->total++;
882 peer->number = topology->total;
883 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
884 memcpy (&hkey,
885 &hc,
886 sizeof (hkey));
887 GNUNET_CONTAINER_multishortmap_put (carrier->peers,
888 &hkey,
889 peer,
890 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
891 //GNUNET_asprintf (&section, "CARRIER-%u-PEER-%u", carrier->index, i);
892 }
893}
894
895
896struct GNUNET_TESTING_NetjailTopology *
897GNUNET_TESTING_get_topo_from_string_ (const char *input)
898{
899 struct GNUNET_CONFIGURATION_Handle *cfg;
900 struct GNUNET_TESTING_NetjailTopology *topology = GNUNET_new (struct GNUNET_TESTING_NetjailTopology);
901 topology->backbone_peers = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
902 topology->carriers = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
903 struct GNUNET_HashCode hc;
904
905 cfg = GNUNET_CONFIGURATION_create ();
906
907 if (GNUNET_OK !=
908 GNUNET_CONFIGURATION_deserialize (cfg,
909 input,
910 strlen (input),
911 NULL))
912 {
913 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
914 _ ("Failed to parse configuration.\n"));
915 GNUNET_CONFIGURATION_destroy (cfg);
916 return NULL;
917 }
918
919 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
920 "DEFAULTS",
921 "SUBNETS",
922 (unsigned long long *) &topology->default_subnets))
923 {
924 LOG (GNUNET_ERROR_TYPE_ERROR,
925 "Missing default SUBNETS!\n");
926 return NULL;
927 }
928 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg,
929 "DEFAULTS",
930 "TESTBED_PLUGIN",
931 &topology->plugin))
932 {
933 LOG (GNUNET_ERROR_TYPE_ERROR,
934 "Missing default TESTBED_PLUGIN!\n");
935 return NULL;
936 }
937 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
938 "DEFAULTS",
939 "CARRIER_PEERS",
940 (unsigned long long *) &topology->default_carrier_peers))
941 {
942 LOG (GNUNET_ERROR_TYPE_ERROR,
943 "Missing default CARRIER_PEERS!\n");
944 return NULL;
945 }
946 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
947 "DEFAULTS",
948 "SUBNET_PEERS",
949 (unsigned long long *) &topology->default_subnet_peers))
950 {
951 LOG (GNUNET_ERROR_TYPE_ERROR,
952 "Missing default SUBNET_PEERS!\n");
953 return NULL;
954 }
955 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
956 "BACKBONE",
957 "CARRIERS",
958 (unsigned long long *) &topology->num_carriers))
959 {
960 LOG (GNUNET_ERROR_TYPE_INFO,
961 "No carrier configured!\n");
962 return NULL;
963 }
964 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
965 "BACKBONE",
966 "CARRIERS",
967 (unsigned long long *) &topology->num_backbone_peers))
968 {
969 LOG (GNUNET_ERROR_TYPE_INFO,
970 "No backbone peers configured!\n");
971 return NULL;
972 }
973 for (int i = 0;i < topology->num_backbone_peers; i++)
974 {
975 struct GNUNET_TESTING_NetjailBackbonePeer *peer = GNUNET_new (struct GNUNET_TESTING_NetjailBackbonePeer);
976 struct GNUNET_ShortHashCode hkey;
977
978 topology->total++;
979 peer->number = topology->total;
980 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
981 memcpy (&hkey,
982 &hc,
983 sizeof (hkey));
984 GNUNET_CONTAINER_multishortmap_put (topology->backbone_peers,
985 &hkey,
986 peer,
987 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
988 }
989 for (int i = 0;i < topology->num_carriers; i++)
990 {
991 struct GNUNET_TESTING_NetjailCarrier *carrier = GNUNET_new (struct GNUNET_TESTING_NetjailCarrier);
992 struct GNUNET_ShortHashCode hkey;
993 char *section;
994
995 topology->total++;
996 carrier->number = topology->total;
997 GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc);
998 memcpy (&hkey,
999 &hc,
1000 sizeof (hkey));
1001 GNUNET_CONTAINER_multishortmap_put (topology->carriers,
1002 &hkey,
1003 carrier,
1004 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1005 GNUNET_asprintf (&section, "CARRIER-%u", i);
1006 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
1007 section,
1008 "SUBNETS",
1009 (unsigned long long *) &carrier->number_subnets))
1010 {
1011 carrier->number_subnets = topology->default_subnets;
1012 }
1013 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
1014 section,
1015 "CARRIER_PEERS",
1016 (unsigned long long *) &carrier->number_peers))
1017 {
1018 carrier->number_peers = topology->default_carrier_peers;
1019 }
1020 create_peers (cfg, topology, carrier);
1021 create_subnets (cfg, topology, carrier);
1022
1023 GNUNET_free (section);
1024 }
1025
1026 GNUNET_free (cfg);
1027
1028 return topology;
1029}
1030
1031
1032/**
1033 * Parse the topology data.
1034 *
1035 * @param data The topology data.
1036 * @return The GNUNET_TESTING_NetjailTopology
1037 *
1038struct GNUNET_TESTING_NetjailTopology *
1039GNUNET_TESTING_get_topo_from_string_ (const char *input)
1040{
1041 char *token;
1042 char *key = NULL;
1043 unsigned int out;
1044 char *rest = NULL;
1045 char *value = NULL;
1046 char *value2;
1047 char *data;
1048 int ret;
1049 struct GNUNET_TESTING_NetjailTopology *topo;
1050 struct GNUNET_TESTING_NetjailRouter *router;
1051 struct GNUNET_TESTING_NetjailNamespace *namespace;
1052 struct GNUNET_HashCode hc;
1053
1054 data = GNUNET_strdup (input);
1055 token = strtok_r (data, "\n", &rest);
1056 topo = GNUNET_new (struct GNUNET_TESTING_NetjailTopology);
1057 topo->map_namespaces =
1058 GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
1059 topo->map_globals =
1060 GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
1061
1062 while (NULL != token)
1063 {
1064 if (NULL != key)
1065 GNUNET_free (key);
1066 key = get_key (token);
1067 LOG (GNUNET_ERROR_TYPE_DEBUG,
1068 "In the loop with token: %s beginning with %s\n",
1069 token,
1070 key);
1071 if (0 == strcmp (key, "M"))
1072 {
1073 LOG (GNUNET_ERROR_TYPE_DEBUG,
1074 "Get first Value for M.\n");
1075 out = get_first_value (token);
1076 LOG (GNUNET_ERROR_TYPE_DEBUG,
1077 "M: %u\n",
1078 out);
1079 topo->nodes_m = out;
1080 }
1081 else if (0 == strcmp (key, "N"))
1082 {
1083 LOG (GNUNET_ERROR_TYPE_DEBUG,
1084 "Get first Value for N.\n");
1085 out = get_first_value (token);
1086 LOG (GNUNET_ERROR_TYPE_DEBUG,
1087 "N: %u\n",
1088 out);
1089 topo->namespaces_n = out;
1090 }
1091 else if (0 == strcmp (key, "X"))
1092 {
1093 LOG (GNUNET_ERROR_TYPE_DEBUG,
1094 "Get first Value for X.\n");
1095 out = get_first_value (token);
1096 LOG (GNUNET_ERROR_TYPE_DEBUG,
1097 "X: %u\n",
1098 out);
1099 topo->nodes_x = out;
1100 }
1101 else if (0 == strcmp (key, "AC"))
1102 {
1103 LOG (GNUNET_ERROR_TYPE_DEBUG,
1104 "Get first Value for AC.\n");
1105 out = get_first_value (token);
1106 LOG (GNUNET_ERROR_TYPE_DEBUG,
1107 "AC: %u\n",
1108 out);
1109 topo->additional_connects = out;
1110 }
1111 else if (0 == strcmp (key, "T"))
1112 {
1113 LOG (GNUNET_ERROR_TYPE_DEBUG,
1114 "Get first string value for T.\n");
1115 value = get_first_string_value (token);
1116 LOG (GNUNET_ERROR_TYPE_DEBUG,
1117 "value: %s\n",
1118 value);
1119 topo->plugin = value;
1120 }
1121 else if (0 == strcmp (key, "K"))
1122 {
1123 struct GNUNET_ShortHashCode hkey_k;
1124 struct GNUNET_TESTING_NetjailNode *k_node = GNUNET_new (struct
1125 GNUNET_TESTING_NetjailNode);
1126
1127 LOG (GNUNET_ERROR_TYPE_DEBUG,
1128 "Get first Value for K.\n");
1129 out = get_first_value (token);
1130 LOG (GNUNET_ERROR_TYPE_DEBUG,
1131 "K: %u\n",
1132 out);
1133 k_node->node_n = out;
1134 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
1135 memcpy (&hkey_k,
1136 &hc,
1137 sizeof (hkey_k));
1138 k_node->is_global = GNUNET_YES;
1139
1140 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
1141 topo->map_globals,
1142 &hkey_k))
1143 GNUNET_break (0);
1144 else
1145 GNUNET_CONTAINER_multishortmap_put (topo->map_globals,
1146 &hkey_k,
1147 k_node,
1148 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1149 LOG (GNUNET_ERROR_TYPE_DEBUG,
1150 "Get value for key value on K.\n");
1151 value = get_value ("plugin", token);
1152 LOG (GNUNET_ERROR_TYPE_DEBUG,
1153 "value: %s\n",
1154 value);
1155 k_node->plugin = value;
1156 parse_ac (k_node, token);
1157 node_connections (token, k_node);
1158 GNUNET_free (value);
1159 }
1160 else if (0 == strcmp (key, "R"))
1161 {
1162 struct GNUNET_ShortHashCode hkey_r;
1163 router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter);
1164
1165 LOG (GNUNET_ERROR_TYPE_DEBUG,
1166 "Get first Value for R.\n");
1167 out = get_first_value (token);
1168 LOG (GNUNET_ERROR_TYPE_DEBUG,
1169 "R: %u\n",
1170 out);
1171 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
1172 memcpy (&hkey_r,
1173 &hc,
1174 sizeof (hkey_r));
1175 LOG (GNUNET_ERROR_TYPE_DEBUG,
1176 "Get value for key tcp_port on R.\n");
1177 value = get_value ("tcp_port", token);
1178 LOG (GNUNET_ERROR_TYPE_DEBUG,
1179 "tcp_port: %s\n",
1180 value);
1181 ret = sscanf (value, "%u", &(router->tcp_port));
1182 GNUNET_free (value);
1183 GNUNET_break (0 != ret && 1 >= router->tcp_port);
1184
1185 LOG (GNUNET_ERROR_TYPE_DEBUG,
1186 "Get value for key udp_port on R.\n");
1187 value2 = get_value ("udp_port", token);
1188 ret = sscanf (value2, "%u", &(router->udp_port));
1189 GNUNET_free (value2);
1190 GNUNET_break (0 != ret && 1 >= router->udp_port);
1191 LOG (GNUNET_ERROR_TYPE_DEBUG,
1192 "udp_port: %s\n",
1193 value2);
1194 GNUNET_free (value2);
1195 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
1196 topo->map_namespaces,
1197 &hkey_r))
1198 {
1199 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
1200 &hkey_r);
1201 }
1202 else
1203 {
1204 namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace);
1205 namespace->namespace_n = out;
1206 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
1207 GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces,
1208 &hkey_r,
1209 namespace,
1210 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1211 }
1212 namespace->router = router;
1213
1214 }
1215 else if (0 == strcmp (key, "P"))
1216 {
1217 struct GNUNET_TESTING_NetjailNode *p_node = GNUNET_new (struct
1218 GNUNET_TESTING_NetjailNode);
1219 struct GNUNET_ShortHashCode hkey_p;
1220
1221 LOG (GNUNET_ERROR_TYPE_DEBUG,
1222 "Get first Value for P.\n");
1223 out = get_first_value (token);
1224 LOG (GNUNET_ERROR_TYPE_DEBUG,
1225 "P: %u\n",
1226 out);
1227 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
1228 memcpy (&hkey_p,
1229 &hc,
1230 sizeof (hkey_p));
1231
1232 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
1233 topo->map_namespaces,
1234 &hkey_p))
1235 {
1236 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
1237 &hkey_p);
1238 }
1239 else
1240 {
1241 namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace);
1242 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
1243 namespace->namespace_n = out;
1244 GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces,
1245 &hkey_p,
1246 namespace,
1247 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1248 }
1249 LOG (GNUNET_ERROR_TYPE_DEBUG,
1250 "Get second Value for P.\n");
1251 out = get_second_value (token);
1252 LOG (GNUNET_ERROR_TYPE_DEBUG,
1253 "P: %u\n",
1254 out);
1255 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
1256 memcpy (&hkey_p,
1257 &hc,
1258 sizeof (hkey_p));
1259 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
1260 namespace->nodes,
1261 &hkey_p))
1262 {
1263 GNUNET_break (0);
1264 }
1265 else
1266 {
1267
1268 GNUNET_CONTAINER_multishortmap_put (namespace->nodes,
1269 &hkey_p,
1270 p_node,
1271 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1272 LOG (GNUNET_ERROR_TYPE_DEBUG,
1273 "Get value for key plugin on P.\n");
1274 value = get_value ("plugin", token);
1275 if (NULL != value)
1276 {
1277 LOG (GNUNET_ERROR_TYPE_DEBUG,
1278 "plugin: %s\n",
1279 value);
1280 p_node->plugin = value;
1281 }
1282 p_node->node_n = out;
1283 p_node->namespace_n = namespace->namespace_n;
1284 }
1285 LOG (GNUNET_ERROR_TYPE_DEBUG,
1286 "Get AC Value for P.\n");
1287 parse_ac (p_node, token);
1288 node_connections (token, p_node);
1289 }
1290 token = strtok_r (NULL, "\n", &rest);
1291 if (NULL != token)
1292 LOG (GNUNET_ERROR_TYPE_DEBUG,
1293 "Next token %s\n",
1294 token);
1295 }
1296 if (NULL != key)
1297 GNUNET_free (key);
1298 GNUNET_free (data);
1299 return topo;
1300 }*/
1301
1302
1303GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (
1304 GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT,
1305 GNUNET_TESTING)
1306
1307
1308/* end of netjail.c */
diff --git a/src/include/gnunet_testing_netjail_lib.h b/src/lib/testing/testing_api_topology.h
index 843fce0d5..7040ca286 100644
--- a/src/include/gnunet_testing_netjail_lib.h
+++ b/src/lib/testing/testing_api_topology.h
@@ -24,11 +24,11 @@
24 * @author Marcello Stanisci 24 * @author Marcello Stanisci
25 * @author t3sserakt 25 * @author t3sserakt
26 */ 26 */
27#ifndef GNUNET_TESTING_NETJAIL_LIB_H 27#ifndef NETJAIL_H
28#define GNUNET_TESTING_NETJAIL_LIB_H 28#define NETJAIL_H
29 29
30#include "gnunet_testing_ng_lib.h" 30#include "gnunet_util_lib.h"
31#include "gnunet_testing_plugin.h" 31#include "gnunet_testing_lib.h"
32 32
33 33
34/** 34/**
@@ -189,7 +189,6 @@ struct GNUNET_TESTING_NetjailNode
189 unsigned int expected_reaches; 189 unsigned int expected_reaches;
190}; 190};
191 191
192
193/** 192/**
194 * Subnet in a topology. 193 * Subnet in a topology.
195 */ 194 */
@@ -212,17 +211,151 @@ struct GNUNET_TESTING_NetjailNamespace
212}; 211};
213 212
214/** 213/**
214 * Backbone peer.
215 */
216struct GNUNET_TESTING_NetjailBackbonePeer
217{
218 /**
219 * Unique identifier this part of the topology can be identified.
220 */
221 unsigned int number;
222};
223
224/**
225 * Backbone peer.
226 */
227struct GNUNET_TESTING_NetjailCarrierPeer
228{
229 /**
230 * Unique identifier this part of the topology can be identified.
231 */
232 unsigned int number;
233};
234
235/**
236 * Carrier.
237 */
238struct GNUNET_TESTING_NetjailCarrier
239{
240 /**
241 * Unique identifier this part of the topology can be identified.
242 */
243 unsigned int number;
244
245 /**
246 * Of all carriers this has index.
247 */
248 unsigned int index;
249
250 /**
251 * Number of carrier peers.
252 */
253 unsigned int number_peers;
254
255 /**
256 * Number of carrier subnets.
257 */
258 unsigned int number_subnets;
259
260 /**
261 * Hash map containing subnets.
262 */
263 struct GNUNET_CONTAINER_MultiShortmap *subnets;
264
265 /**
266 * Hash map containing peers.
267 */
268 struct GNUNET_CONTAINER_MultiShortmap *peers;
269};
270
271/**
272 * Carrier subnet.
273 */
274struct GNUNET_TESTING_NetjailSubnet
275{
276 /**
277 * Unique identifier this part of the topology can be identified.
278 */
279 unsigned int number;
280
281 /**
282 * Of all subnets this has index.
283 */
284 unsigned int index;
285
286 /**
287 * Number of subnet peers.
288 */
289 unsigned int number_peers;
290
291 /**
292 * Hash map containing peers.
293 */
294 struct GNUNET_CONTAINER_MultiShortmap *peers;
295};
296
297/**
298 * Subnet peer.
299 */
300struct GNUNET_TESTING_NetjailSubnetPeer
301{
302 /**
303 * Unique identifier this part of the topology can be identified.
304 */
305 unsigned int number;
306};
307
308/**
215 * Toplogy of our netjail setup. 309 * Toplogy of our netjail setup.
216 */ 310 */
217struct GNUNET_TESTING_NetjailTopology 311struct GNUNET_TESTING_NetjailTopology
218{ 312{
219 313
220 /** 314 /**
315 * Default number of subnets per carrier.
316 */
317 unsigned int default_subnets;
318
319 /**
320 * Default number of peers per carrier.
321 */
322 unsigned int default_carrier_peers;
323
324 /**
325 * Default number of peers per subnet.
326 */
327 unsigned int default_subnet_peers;
328 /**
221 * Default plugin for the test case to be run on nodes. 329 * Default plugin for the test case to be run on nodes.
222 */ 330 */
223 char *plugin; 331 char *plugin;
224 332
225 /** 333 /**
334 * Number of carriers.
335 */
336 unsigned int num_carriers;
337
338 /**
339 * Default number of backbone peers.
340 */
341 unsigned int num_backbone_peers;
342
343 /**
344 * Hash map containing the carriers.
345 */
346 struct GNUNET_CONTAINER_MultiShortmap *carriers;
347
348 /**
349 * Hash map containing the carriers.
350 */
351 struct GNUNET_CONTAINER_MultiShortmap *backbone_peers;
352
353 /**
354 * Total number of namespaces in the topology.
355 */
356 unsigned int total;
357
358 /**
226 * Number of subnets. 359 * Number of subnets.
227 */ 360 */
228 unsigned int namespaces_n; 361 unsigned int namespaces_n;
@@ -253,25 +386,15 @@ struct GNUNET_TESTING_NetjailTopology
253 unsigned int additional_connects; 386 unsigned int additional_connects;
254}; 387};
255 388
256/**
257 * Getting the topology from file.
258 *
259 * @param filename The name of the topology file.
260 * @return The GNUNET_TESTING_NetjailTopology
261 */
262struct GNUNET_TESTING_NetjailTopology *
263GNUNET_TESTING_get_topo_from_file (const char *filename);
264
265 389
266/** 390/**
267 * FIXME: this could use a "to_string".
268 * Parse the topology data. 391 * Parse the topology data.
269 * 392 *
270 * @param data The topology data. 393 * @param data The topology data.
271 * @return The GNUNET_TESTING_NetjailTopology 394 * @return The GNUNET_TESTING_NetjailTopology
272 */ 395 */
273struct GNUNET_TESTING_NetjailTopology * 396struct GNUNET_TESTING_NetjailTopology *
274GNUNET_TESTING_get_topo_from_string (const char *data); 397GNUNET_TESTING_get_topo_from_string_ (const char *data);
275 398
276 399
277/** 400/**
@@ -281,9 +404,10 @@ GNUNET_TESTING_get_topo_from_string (const char *data);
281 * @return The number of additional connects 404 * @return The number of additional connects
282 */ 405 */
283unsigned int 406unsigned int
284GNUNET_TESTING_get_additional_connects (unsigned int num, 407GNUNET_TESTING_get_additional_connects (
285 struct GNUNET_TESTING_NetjailTopology * 408 unsigned int num,
286 topology); 409 struct GNUNET_TESTING_NetjailTopology *topology);
410
287 411
288/** 412/**
289 * Get a node from the topology. 413 * Get a node from the topology.
@@ -305,8 +429,9 @@ GNUNET_TESTING_get_node (unsigned int num,
305 * @return The connections of the node. 429 * @return The connections of the node.
306 */ 430 */
307struct GNUNET_TESTING_NodeConnection * 431struct GNUNET_TESTING_NodeConnection *
308GNUNET_TESTING_get_connections (unsigned int num, 432GNUNET_TESTING_get_connections (
309 const struct GNUNET_TESTING_NetjailTopology *topology); 433 unsigned int num,
434 const struct GNUNET_TESTING_NetjailTopology *topology);
310 435
311 436
312/** 437/**
@@ -317,14 +442,24 @@ GNUNET_TESTING_get_connections (unsigned int num,
317 * @return The address of the communicator. 442 * @return The address of the communicator.
318 */ 443 */
319char * 444char *
320GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection, 445GNUNET_TESTING_get_address (
321 const char *prefix); 446 struct GNUNET_TESTING_NodeConnection *connection,
447 const char *prefix);
448
449
450/**
451 * Get the global plugin name form the topology file
452 */
453char *
454GNUNET_TESTING_get_plugin_from_topo (
455 struct GNUNET_TESTING_NetjailTopology *njt,
456 const char *my_node_id);
322 457
323 458
324/** 459/**
325 * Deallocate memory of the struct GNUNET_TESTING_NetjailTopology. 460 * Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
326 * 461 *
327 * @param topology The GNUNET_TESTING_NetjailTopology to be deallocated. 462 * @param[in] topology The GNUNET_TESTING_NetjailTopology to be deallocated.
328 */ 463 */
329void 464void
330GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology); 465GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology);
@@ -338,209 +473,22 @@ GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology);
338 * @return The unique id of the node from the connection. 473 * @return The unique id of the node from the connection.
339 */ 474 */
340unsigned int 475unsigned int
341GNUNET_TESTING_calculate_num (struct 476GNUNET_TESTING_calculate_num (
342 GNUNET_TESTING_NodeConnection *node_connection, 477 struct GNUNET_TESTING_NodeConnection *node_connection,
343 struct GNUNET_TESTING_NetjailTopology *topology);
344
345
346/**
347 * Struct with information for callbacks.
348 *
349 */
350struct GNUNET_TESTING_BlockState
351{
352 /**
353 * Context for our asynchronous completion.
354 */
355 struct GNUNET_TESTING_AsyncContext ac;
356
357 /**
358 * The label of this command.
359 */
360 const char *label;
361
362 /**
363 * If this command will block.
364 */
365 unsigned int asynchronous_finish;
366};
367
368/**
369 * Struct to hold information for callbacks.
370 *
371 */
372struct GNUNET_TESTING_LocalPreparedState
373{
374 /**
375 * Context for our asynchronous completion.
376 */
377 struct GNUNET_TESTING_AsyncContext ac;
378
379 /**
380 * Callback to write messages to the master loop.
381 *
382 */
383 GNUNET_TESTING_cmd_helper_write_cb write_message;
384};
385
386/**
387 * This command destroys the ressources allocated for the test system setup.
388 *
389 * @param label Name for command.
390 * @param create_label Label of the cmd which started the test system.
391 * @param write_message Callback to write messages to the master loop.
392 * @return command.
393 */
394struct GNUNET_TESTING_Command
395GNUNET_TESTING_cmd_system_destroy (const char *label,
396 const char *create_label);
397
398/**
399 * This command is setting up a test environment for a peer to start.
400 *
401 * @param label Name for command.
402 * @param testdir Only the directory name without any path. Temporary
403 * directory used for all service homes.
404 */
405struct GNUNET_TESTING_Command
406GNUNET_TESTING_cmd_system_create (const char *label,
407 const char *testdir);
408
409
410/**
411 * This command executes a shell script to setup the netjail environment.
412 *
413 * @param label name for command.
414 * @param topology_config Configuration file for the test topology.
415 * @param read_file Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data.
416 * @return command.
417 */
418struct GNUNET_TESTING_Command
419GNUNET_TESTING_cmd_netjail_start (const char *label,
420 char *topology_config,
421 unsigned int *read_file);
422
423
424/**
425 * This command executes a shell script to remove the netjail environment.
426 *
427 * @param label name for command.
428 * @param topology_config Configuration file for the test topology.
429 * @param read_file Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data.
430 * @return command.
431 */
432struct GNUNET_TESTING_Command
433GNUNET_TESTING_cmd_netjail_stop (const char *label,
434 char *topology_config,
435 unsigned int *read_file);
436
437
438/**
439 * This command executes a shell script which starts a helper process.
440 * This process is running on a netjail node, executing a defined test case.
441 *
442 * @param label Name for the command.
443 * @param topology The complete topology information.
444 * @param read_file Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data.
445 * @param topology_data If read_file is GNUNET_NO, topology_data holds the string with the topology.
446 * @param timeout Before this timeout is reached this cmd MUST finish.
447 * @return command.
448 */
449struct GNUNET_TESTING_Command
450GNUNET_TESTING_cmd_netjail_start_cmds_helper (
451 const char *label,
452 struct GNUNET_TESTING_NetjailTopology *topology,
453 unsigned int *read_file,
454 char *topology_data,
455 struct GNUNET_TIME_Relative timeout);
456
457
458/**
459 * Create command.
460 *
461 * @param label name for command.
462 * @param helper_start_label label of the cmd to start the test system.
463 * @param topology The complete topology information.
464 * @return command.
465 */
466struct GNUNET_TESTING_Command
467GNUNET_TESTING_cmd_stop_cmds_helper (
468 const char *label,
469 const char *helper_start_label,
470 struct GNUNET_TESTING_NetjailTopology *topology); 478 struct GNUNET_TESTING_NetjailTopology *topology);
471 479
472 480
473/** 481/**
474 * This command is used to block the loop, until the command is finished by other commands,
475 * using a trait to get this commands struct GNUNET_TESTING_AsyncContext.
476 *
477 * @param label name for command.
478 * @return command.
479 */
480struct GNUNET_TESTING_Command
481GNUNET_TESTING_cmd_block_until_external_trigger (
482 const char *label);
483
484/**
485 * DEPRECATED
486 * This command sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop.
487 *
488 * @param label name for command.
489 * @param write_message Callback to write messages to the master loop.
490 * @return command.
491 */
492struct GNUNET_TESTING_Command
493GNUNET_TESTING_cmd_send_peer_ready (const char *label,
494 GNUNET_TESTING_cmd_helper_write_cb write_message);
495
496
497/**
498 * This command sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED message to the master loop.
499 *
500 * @param label name for command.
501 * @param write_message Callback to write messages to the master loop.
502 * @return command.
503 */
504struct GNUNET_TESTING_Command
505GNUNET_TESTING_cmd_local_test_prepared (const char *label,
506 GNUNET_TESTING_cmd_helper_write_cb
507 write_message);
508
509
510/**
511 * Create command.
512 *
513 * @param label name for command.
514 * @param system_label Label of the cmd to setup a test environment.
515 * @param no Decimal number representing the last byte of the IP address of this peer.
516 * @param node_ip The IP address of this node.
517 * @param cfgname Configuration file name for this peer.
518 * @param broadcast Flag indicating, if broadcast should be switched on.
519 * @return command.
520 */
521struct GNUNET_TESTING_Command
522GNUNET_TESTING_cmd_start_peer (const char *label,
523 const char *system_label,
524 uint32_t no,
525 const char *node_ip,
526 const char *cfgname,
527 unsigned int broadcast);
528
529
530/* ***** Netjail trait support ***** */
531
532
533/**
534 * Call #op on all simple traits. 482 * Call #op on all simple traits.
535 */ 483 */
536#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op, prefix) \ 484#define GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS(op, prefix) \
537 op (prefix, test_system, const struct GNUNET_TESTING_System) \ 485 op (prefix, topology, const struct GNUNET_TESTING_NetjailTopology) \
538 op (prefix, async_context, struct GNUNET_TESTING_AsyncContext) \ 486 op (prefix, topology_string, const char) \
539 op (prefix, helper_handles, const struct GNUNET_HELPER_Handle *) \ 487 op (prefix, async_context, struct GNUNET_TESTING_AsyncContext) \
540 op (prefix, local_prepared_state, const struct GNUNET_TESTING_LocalPreparedState) \ 488 op (prefix, helper_handles, const struct GNUNET_HELPER_Handle *)
541 op (prefix, block_state, struct GNUNET_TESTING_BlockState)
542 489
543GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_TESTING) 490GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
491 GNUNET_TESTING)
544 492
545 493
546#endif 494#endif
diff --git a/src/service/testing/testing_api_traits.c b/src/lib/testing/testing_api_traits.c
index 18faa2d04..0726a7576 100644
--- a/src/service/testing/testing_api_traits.c
+++ b/src/lib/testing/testing_api_traits.c
@@ -26,23 +26,11 @@
26 * @author t3sserakt 26 * @author t3sserakt
27 */ 27 */
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_testing_ng_lib.h" 29#include "gnunet_testing_lib.h"
30#include "gnunet_testing_plugin.h"
31#include "gnunet_testing_barrier.h"
32#include "gnunet_testing_netjail_lib.h"
33 30
34 31
35/* FIXME: move these into respective sub-libs? */ 32GNUNET_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT,
36 33 GNUNET_TESTING)
37GNUNET_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_TESTING)
38
39GNUNET_TESTING_INDEXED_TRAITS (GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT, GNUNET_TESTING)
40
41GNUNET_TESTING_LOOP_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_TESTING)
42
43GNUNET_TESTING_LOOP_INDEXED_TRAITS (GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT, GNUNET_TESTING)
44
45GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_TESTING)
46 34
47/** 35/**
48 * End a trait array. Usually, commands offer several traits, 36 * End a trait array. Usually, commands offer several traits,
diff --git a/src/lib/testing/testing_cmds.h b/src/lib/testing/testing_cmds.h
new file mode 100644
index 000000000..3493dbbf9
--- /dev/null
+++ b/src/lib/testing/testing_cmds.h
@@ -0,0 +1,106 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_cmds.h
23 * @brief Message formats for communication between testing cmds helper and testcase plugins.
24 * @author t3sserakt
25 */
26
27#ifndef TESTING_CMDS_H
28#define TESTING_CMDS_H
29
30#define HELPER_CMDS_BINARY "gnunet-cmds-helper"
31#include "gnunet_common.h"
32
33GNUNET_NETWORK_STRUCT_BEGIN
34
35/**
36 * Initialization message for gnunet-cmds-testbed to start cmd binary.
37 */
38struct GNUNET_TESTING_CommandHelperInit
39{
40 /**
41 * Type is #GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT
42 */
43 struct GNUNET_MessageHeader header;
44
45 /**
46 * Number of barriers the helper inherits.
47 */
48 uint32_t barrier_count GNUNET_PACKED;
49
50 /* Followed by barrier_count barrier hashes */
51
52 /* Followed by topology data */
53};
54
55
56struct GNUNET_TESTING_CommandLocalFinished
57{
58 /**
59 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED
60 */
61 struct GNUNET_MessageHeader header;
62
63 /**
64 * The exit status local test return with in NBO.
65 */
66 uint32_t rv GNUNET_PACKED;
67};
68
69
70/**
71 * Child to parent: I reached the given barrier,
72 * increment the counter (or pass to grandparent).
73 */
74struct GNUNET_TESTING_CommandBarrierReached
75{
76 struct GNUNET_MessageHeader header;
77 struct GNUNET_ShortHashCode barrier_key;
78};
79
80
81/**
82 * Parent to child: you're inheriting a barrier.
83 * If the barrier was already satisfied, the parent
84 * must sent a separate barrier satisfied message.
85 */
86struct GNUNET_TESTING_CommandBarrierInherited
87{
88 struct GNUNET_MessageHeader header;
89 struct GNUNET_ShortHashCode barrier_key;
90};
91
92
93/**
94 * Parent to child: this barrier was satisfied.
95 */
96struct GNUNET_TESTING_CommandBarrierSatisfied
97{
98 struct GNUNET_MessageHeader header;
99 struct GNUNET_ShortHashCode barrier_key;
100};
101
102
103GNUNET_NETWORK_STRUCT_END
104
105#endif
106/* end of testing_cmds.h */
diff --git a/src/lib/util/.gitignore b/src/lib/util/.gitignore
index c6306639c..c31c9ec28 100644
--- a/src/lib/util/.gitignore
+++ b/src/lib/util/.gitignore
@@ -20,6 +20,7 @@ test_container_meta_data
20test_container_multihashmap 20test_container_multihashmap
21test_container_multihashmap32 21test_container_multihashmap32
22test_container_multipeermap 22test_container_multipeermap
23test_crypto_blind
23test_crypto_crc 24test_crypto_crc
24test_crypto_ecc_dlog 25test_crypto_ecc_dlog
25test_crypto_ecdh_ecdsa 26test_crypto_ecdh_ecdsa
@@ -28,6 +29,7 @@ test_crypto_ecdhe
28test_crypto_ecdsa 29test_crypto_ecdsa
29test_crypto_eddsa 30test_crypto_eddsa
30test_crypto_edx25519 31test_crypto_edx25519
32test_crypto_elligator
31test_crypto_hash 33test_crypto_hash
32test_crypto_hash_context 34test_crypto_hash_context
33test_crypto_hkdf 35test_crypto_hkdf
diff --git a/src/lib/util/Makefile.am b/src/lib/util/Makefile.am
index 00538847b..4d052c57b 100644
--- a/src/lib/util/Makefile.am
+++ b/src/lib/util/Makefile.am
@@ -147,7 +147,7 @@ libgnunetutil_la_LIBADD = \
147 147
148libgnunetutil_la_LDFLAGS = \ 148libgnunetutil_la_LDFLAGS = \
149 $(GN_LIB_LDFLAGS) \ 149 $(GN_LIB_LDFLAGS) \
150 -version-info 16:0:0 150 -version-info 16:1:0
151 151
152lib_LTLIBRARIES = libgnunetutil.la 152lib_LTLIBRARIES = libgnunetutil.la
153 153
diff --git a/src/lib/util/common_allocation.c b/src/lib/util/common_allocation.c
index 36d49eddb..afd701720 100644
--- a/src/lib/util/common_allocation.c
+++ b/src/lib/util/common_allocation.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2003, 2005, 2006 GNUnet e.V. 3 Copyright (C) 2001, 2002, 2003, 2005, 2006, 2024 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -34,60 +34,41 @@
34#endif 34#endif
35 35
36#define LOG(kind, ...) \ 36#define LOG(kind, ...) \
37 GNUNET_log_from (kind, "util-common-allocation", __VA_ARGS__) 37 GNUNET_log_from (kind, "util-common-allocation", __VA_ARGS__)
38 38
39#define LOG_STRERROR(kind, syscall) \ 39#define LOG_STRERROR(kind, syscall) \
40 GNUNET_log_from_strerror (kind, "util-common-allocation", syscall) 40 GNUNET_log_from_strerror (kind, "util-common-allocation", syscall)
41 41
42#ifndef INT_MAX 42#ifndef INT_MAX
43#define INT_MAX 0x7FFFFFFF 43#define INT_MAX 0x7FFFFFFF
44#endif 44#endif
45 45
46 46
47/**
48 * Allocate memory. Checks the return value, aborts if no more
49 * memory is available.
50 *
51 * @param size how many bytes of memory to allocate, do NOT use
52 * this function (or GNUNET_malloc()) to allocate more than several MB
53 * of memory, if you are possibly needing a very large chunk use
54 * #GNUNET_xmalloc_unchecked_() instead.
55 * @param filename where in the code was the call to GNUNET_malloc()
56 * @param linenumber where in the code was the call to GNUNET_malloc()
57 * @return pointer to size bytes of memory
58 */
59void * 47void *
60GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber) 48GNUNET_xmalloc_ (size_t size,
49 const char *filename,
50 int linenumber)
61{ 51{
62 void *ret; 52 void *ret;
63 53
64 /* As a security precaution, we generally do not allow very large 54 /* As a security precaution, we generally do not allow very large
65 * allocations using the default 'GNUNET_malloc()' macro */ 55 * allocations using the default 'GNUNET_malloc()' macro */
66 GNUNET_assert_at (size <= GNUNET_MAX_MALLOC_CHECKED, filename, linenumber); 56 GNUNET_assert_at (size <= GNUNET_MAX_MALLOC_CHECKED,
67 ret = GNUNET_xmalloc_unchecked_ (size, filename, linenumber); 57 filename,
58 linenumber);
59 ret = GNUNET_xmalloc_unchecked_ (size,
60 filename,
61 linenumber);
68 if (NULL == ret) 62 if (NULL == ret)
69 { 63 {
70 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); 64 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
65 "malloc");
71 GNUNET_assert (0); 66 GNUNET_assert (0);
72 } 67 }
73 return ret; 68 return ret;
74} 69}
75 70
76 71
77/**
78 * Allocate memory for a two dimensional array in one block
79 * and set up pointers. Aborts if no more memory is available.
80 * Don't use GNUNET_xnew_array_2d_ directly. Use the
81 * #GNUNET_new_array_2d macro.
82 * The memory of the elements will be zero'ed out.
83 *
84 * @param n size of the first dimension
85 * @param m size of the second dimension
86 * @param elementSize size of a single element in bytes
87 * @param filename where is this call being made (for debugging)
88 * @param linenumber line where this call is being made (for debugging)
89 * @return allocated memory, never NULL
90 */
91void ** 72void **
92GNUNET_xnew_array_2d_ (size_t n, 73GNUNET_xnew_array_2d_ (size_t n,
93 size_t m, 74 size_t m,
@@ -109,21 +90,6 @@ GNUNET_xnew_array_2d_ (size_t n,
109} 90}
110 91
111 92
112/**
113 * Allocate memory for a three dimensional array in one block
114 * and set up pointers. Aborts if no more memory is available.
115 * Don't use GNUNET_xnew_array_3d_ directly. Use the
116 * #GNUNET_new_array_3d macro.
117 * The memory of the elements will be zero'ed out.
118 *
119 * @param n size of the first dimension
120 * @param m size of the second dimension
121 * @param o size of the third dimension
122 * @param elementSize size of a single element in bytes
123 * @param filename where is this call being made (for debugging)
124 * @param linenumber line where this call is being made (for debugging)
125 * @return allocated memory, never NULL
126 */
127void *** 93void ***
128GNUNET_xnew_array_3d_ (size_t n, 94GNUNET_xnew_array_3d_ (size_t n,
129 size_t m, 95 size_t m,
@@ -166,58 +132,50 @@ GNUNET_xmemdup_ (const void *buf,
166 132
167 /* As a security precaution, we generally do not allow very large 133 /* As a security precaution, we generally do not allow very large
168 * allocations here */ 134 * allocations here */
169 GNUNET_assert_at (size <= GNUNET_MAX_MALLOC_CHECKED, filename, linenumber); 135 GNUNET_assert_at (size <= GNUNET_MAX_MALLOC_CHECKED,
170 GNUNET_assert_at (size < INT_MAX, filename, linenumber); 136 filename,
137 linenumber);
138 GNUNET_assert_at (size < INT_MAX,
139 filename,
140 linenumber);
171 ret = malloc (size); 141 ret = malloc (size);
172 if (ret == NULL) 142 if (NULL == ret)
173 { 143 {
174 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "malloc"); 144 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
145 "malloc");
175 GNUNET_assert (0); 146 GNUNET_assert (0);
176 } 147 }
177 GNUNET_memcpy (ret, buf, size); 148 GNUNET_memcpy (ret,
149 buf,
150 size);
178 return ret; 151 return ret;
179} 152}
180 153
181 154
182/**
183 * Wrapper around malloc(). Allocates size bytes of memory.
184 * The memory will be zero'ed out.
185 *
186 * @param size the number of bytes to allocate
187 * @param filename where in the code was the call to GNUNET_malloc_unchecked()
188 * @param linenumber where in the code was the call to GNUNET_malloc_unchecked()
189 * @return pointer to size bytes of memory, NULL if we do not have enough memory
190 */
191void * 155void *
192GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber) 156GNUNET_xmalloc_unchecked_ (size_t size,
157 const char *filename,
158 int linenumber)
193{ 159{
194 void *result; 160 void *result;
195 161
196 (void) filename; 162 (void) filename;
197 (void) linenumber; 163 (void) linenumber;
198
199 result = malloc (size); 164 result = malloc (size);
200 if (NULL == result) 165 if (NULL == result)
201 return NULL; 166 return NULL;
202 memset (result, 0, size); 167 memset (result,
203 168 0,
169 size);
204 return result; 170 return result;
205} 171}
206 172
207 173
208/**
209 * Reallocate memory. Checks the return value, aborts if no more
210 * memory is available.
211 * The content of the intersection of the new and old size will be unchanged.
212 *
213 * @param ptr the pointer to reallocate
214 * @param n how many bytes of memory to allocate
215 * @param filename where in the code was the call to GNUNET_realloc()
216 * @param linenumber where in the code was the call to GNUNET_realloc()
217 * @return pointer to size bytes of memory
218 */
219void * 174void *
220GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber) 175GNUNET_xrealloc_ (void *ptr,
176 size_t n,
177 const char *filename,
178 int linenumber)
221{ 179{
222 (void) filename; 180 (void) filename;
223 (void) linenumber; 181 (void) linenumber;
@@ -249,7 +207,8 @@ GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber)
249 ptr = realloc (ptr, n); 207 ptr = realloc (ptr, n);
250 if ((NULL == ptr) && (n > 0)) 208 if ((NULL == ptr) && (n > 0))
251 { 209 {
252 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "realloc"); 210 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
211 "realloc");
253 GNUNET_assert (0); 212 GNUNET_assert (0);
254 } 213 }
255 return ptr; 214 return ptr;
@@ -272,14 +231,6 @@ GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber)
272#define M_SIZE(p) malloc_size (p) 231#define M_SIZE(p) malloc_size (p)
273#endif 232#endif
274 233
275/**
276 * Free memory. Merely a wrapper for the case that we
277 * want to keep track of allocations.
278 *
279 * @param ptr the pointer to free
280 * @param filename where in the code was the call to GNUNET_free()
281 * @param linenumber where in the code was the call to GNUNET_free()
282 */
283void 234void
284GNUNET_xfree_ (void *ptr, 235GNUNET_xfree_ (void *ptr,
285 const char *filename, 236 const char *filename,
@@ -304,35 +255,37 @@ GNUNET_xfree_ (void *ptr,
304} 255}
305 256
306 257
307/**
308 * Dup a string (same semantics as strdup).
309 *
310 * @param str the string to dup
311 * @param filename where in the code was the call to GNUNET_strdup()
312 * @param linenumber where in the code was the call to GNUNET_strdup()
313 * @return `strdup(@a str)`
314 */
315char * 258char *
316GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber) 259GNUNET_xstrdup_ (const char *str,
260 const char *filename,
261 int linenumber)
317{ 262{
263 size_t slen = strlen (str) + 1;
318 char *res; 264 char *res;
319 size_t slen;
320 265
321 GNUNET_assert_at (str != NULL, filename, linenumber); 266 GNUNET_assert_at (str != NULL,
322 slen = strlen (str) + 1; 267 filename,
323 res = GNUNET_xmalloc_ (slen, filename, linenumber); 268 linenumber);
324 GNUNET_memcpy (res, str, slen); 269 res = GNUNET_xmalloc_ (slen,
270 filename,
271 linenumber);
272 GNUNET_memcpy (res,
273 str,
274 slen);
325 return res; 275 return res;
326} 276}
327 277
328 278
329#if ! HAVE_STRNLEN 279#if ! HAVE_STRNLEN
330static size_t 280static size_t
331strnlen (const char *s, size_t n) 281strnlen (const char *s,
282 size_t n)
332{ 283{
333 const char *e; 284 const char *e;
334 285
335 e = memchr (s, '\0', n); 286 e = memchr (s,
287 '\0',
288 n);
336 if (NULL == e) 289 if (NULL == e)
337 return n; 290 return n;
338 return e - s; 291 return e - s;
@@ -342,15 +295,6 @@ strnlen (const char *s, size_t n)
342#endif 295#endif
343 296
344 297
345/**
346 * Dup partially a string (same semantics as strndup).
347 *
348 * @param str the string to dup
349 * @param len the length of the string to dup
350 * @param filename where in the code was the call to GNUNET_strndup()
351 * @param linenumber where in the code was the call to GNUNET_strndup()
352 * @return `strndup(@a str,@a len)`
353 */
354char * 298char *
355GNUNET_xstrndup_ (const char *str, 299GNUNET_xstrndup_ (const char *str,
356 size_t len, 300 size_t len,
@@ -361,27 +305,19 @@ GNUNET_xstrndup_ (const char *str,
361 305
362 if (0 == len) 306 if (0 == len)
363 return GNUNET_strdup (""); 307 return GNUNET_strdup ("");
364 GNUNET_assert_at (NULL != str, filename, linenumber); 308 GNUNET_assert_at (NULL != str,
309 filename,
310 linenumber);
365 len = strnlen (str, len); 311 len = strnlen (str, len);
366 res = GNUNET_xmalloc_ (len + 1, filename, linenumber); 312 res = GNUNET_xmalloc_ (len + 1,
313 filename,
314 linenumber);
367 GNUNET_memcpy (res, str, len); 315 GNUNET_memcpy (res, str, len);
368 /* res[len] = '\0'; 'malloc' zeros out anyway */ 316 /* res[len] = '\0'; 'malloc' zeros out anyway */
369 return res; 317 return res;
370} 318}
371 319
372 320
373/**
374 * Grow an array. Grows old by (*oldCount-newCount)*elementSize bytes
375 * and sets *oldCount to newCount.
376 *
377 * @param old address of the pointer to the array
378 * *old may be NULL
379 * @param elementSize the size of the elements of the array
380 * @param oldCount address of the number of elements in the *old array
381 * @param newCount number of elements in the new array, may be 0
382 * @param filename where in the code was the call to GNUNET_array_grow()
383 * @param linenumber where in the code was the call to GNUNET_array_grow()
384 */
385void 321void
386GNUNET_xgrow_ (void **old, 322GNUNET_xgrow_ (void **old,
387 size_t elementSize, 323 size_t elementSize,
@@ -401,65 +337,70 @@ GNUNET_xgrow_ (void **old,
401 } 337 }
402 else 338 else
403 { 339 {
404 tmp = GNUNET_xmalloc_ (size, filename, linenumber); 340 tmp = GNUNET_xmalloc_ (size,
341 filename,
342 linenumber);
405 if (NULL != *old) 343 if (NULL != *old)
406 { 344 {
407 GNUNET_memcpy (tmp, *old, elementSize * GNUNET_MIN (*oldCount, newCount)); 345 GNUNET_memcpy (tmp,
346 *old,
347 elementSize * GNUNET_MIN (*oldCount,
348 newCount));
408 } 349 }
409 } 350 }
410 351
411 if (NULL != *old) 352 if (NULL != *old)
412 { 353 {
413 GNUNET_xfree_ (*old, filename, linenumber); 354 GNUNET_xfree_ (*old,
355 filename,
356 linenumber);
414 } 357 }
415 *old = tmp; 358 *old = tmp;
416 *oldCount = newCount; 359 *oldCount = newCount;
417} 360}
418 361
419 362
420/**
421 * Like asprintf(), just portable.
422 *
423 * @param buf set to a buffer of sufficient size (allocated, caller must free)
424 * @param format format string (see printf(), fprintf(), etc.)
425 * @param ... data for format string
426 * @return number of bytes in `*@a buf`, excluding 0-termination
427 */
428int 363int
429GNUNET_asprintf (char **buf, const char *format, ...) 364GNUNET_asprintf (char **buf,
365 const char *format,
366 ...)
430{ 367{
431 int ret; 368 int ret;
432 va_list args; 369 va_list args;
433 370
434 va_start (args, format); 371 va_start (args,
435 ret = vsnprintf (NULL, 0, format, args); 372 format);
373 ret = vsnprintf (NULL,
374 0,
375 format,
376 args);
436 va_end (args); 377 va_end (args);
437 GNUNET_assert (ret >= 0); 378 GNUNET_assert (ret >= 0);
438 *buf = GNUNET_malloc (ret + 1); 379 *buf = GNUNET_malloc (ret + 1);
439 va_start (args, format); 380 va_start (args, format);
440 ret = vsprintf (*buf, format, args); 381 ret = vsprintf (*buf,
382 format,
383 args);
441 va_end (args); 384 va_end (args);
442 return ret; 385 return ret;
443} 386}
444 387
445 388
446/**
447 * Like snprintf(), just aborts if the buffer is of insufficient size.
448 *
449 * @param buf pointer to buffer that is written to
450 * @param size number of bytes in buf
451 * @param format format strings
452 * @param ... data for format string
453 * @return number of bytes written to buf or negative value on error
454 */
455int 389int
456GNUNET_snprintf (char *buf, size_t size, const char *format, ...) 390GNUNET_snprintf (char *buf,
391 size_t size,
392 const char *format,
393 ...)
457{ 394{
458 int ret; 395 int ret;
459 va_list args; 396 va_list args;
460 397
461 va_start (args, format); 398 va_start (args,
462 ret = vsnprintf (buf, size, format, args); 399 format);
400 ret = vsnprintf (buf,
401 size,
402 format,
403 args);
463 va_end (args); 404 va_end (args);
464 GNUNET_assert ((ret >= 0) && (((size_t) ret) < size)); 405 GNUNET_assert ((ret >= 0) && (((size_t) ret) < size));
465 return ret; 406 return ret;
@@ -480,15 +421,7 @@ GNUNET_copy_message (const struct GNUNET_MessageHeader *msg)
480} 421}
481 422
482 423
483/** 424bool
484 * Check that memory in @a a is all zeros. @a a must be a pointer.
485 *
486 * @param a pointer to @a n bytes which should be tested for the
487 * entire memory being zero'ed out.
488 * @param n number of bytes in @a to be tested
489 * @return GNUNET_YES if a is zero, GNUNET_NO otherwise
490 */
491enum GNUNET_GenericReturnValue
492GNUNET_is_zero_ (const void *a, 425GNUNET_is_zero_ (const void *a,
493 size_t n) 426 size_t n)
494{ 427{
@@ -496,8 +429,8 @@ GNUNET_is_zero_ (const void *a,
496 429
497 for (size_t i = 0; i < n; i++) 430 for (size_t i = 0; i < n; i++)
498 if (b[i]) 431 if (b[i])
499 return GNUNET_NO; 432 return false;
500 return GNUNET_YES; 433 return true;
501} 434}
502 435
503 436
diff --git a/src/lib/util/crypto_ecc.c b/src/lib/util/crypto_ecc.c
index 11c3e50d4..8ea17fda0 100644
--- a/src/lib/util/crypto_ecc.c
+++ b/src/lib/util/crypto_ecc.c
@@ -411,24 +411,39 @@ GNUNET_CRYPTO_eddsa_private_key_from_string (
411} 411}
412 412
413 413
414static void
415buffer_clear (void *buf, size_t len)
416{
417#if HAVE_MEMSET_S
418 memset_s (buf, len, 0, len);
419#elif HAVE_EXPLICIT_BZERO
420 explicit_bzero (buf, len);
421#else
422 volatile unsigned char *p = buf;
423 while (len--)
424 *p++ = 0;
425#endif
426}
427
428
414void 429void
415GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk) 430GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
416{ 431{
417 memset (pk, 0, sizeof(struct GNUNET_CRYPTO_EcdhePrivateKey)); 432 buffer_clear (pk, sizeof(struct GNUNET_CRYPTO_EcdhePrivateKey));
418} 433}
419 434
420 435
421void 436void
422GNUNET_CRYPTO_ecdsa_key_clear (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk) 437GNUNET_CRYPTO_ecdsa_key_clear (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk)
423{ 438{
424 memset (pk, 0, sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey)); 439 buffer_clear (pk, sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey));
425} 440}
426 441
427 442
428void 443void
429GNUNET_CRYPTO_eddsa_key_clear (struct GNUNET_CRYPTO_EddsaPrivateKey *pk) 444GNUNET_CRYPTO_eddsa_key_clear (struct GNUNET_CRYPTO_EddsaPrivateKey *pk)
430{ 445{
431 memset (pk, 0, sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey)); 446 buffer_clear (pk, sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey));
432} 447}
433 448
434 449
diff --git a/src/lib/util/crypto_ecc_setup.c b/src/lib/util/crypto_ecc_setup.c
index 2ee9ed931..07e28f89d 100644
--- a/src/lib/util/crypto_ecc_setup.c
+++ b/src/lib/util/crypto_ecc_setup.c
@@ -297,6 +297,7 @@ GNUNET_CRYPTO_sign_by_peer_identity (const struct
297 struct GNUNET_CRYPTO_EddsaSignature *sig) 297 struct GNUNET_CRYPTO_EddsaSignature *sig)
298{ 298{
299 struct GNUNET_CRYPTO_EddsaPrivateKey *priv; 299 struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
300 enum GNUNET_GenericReturnValue result;
300 301
301 if (NULL == (priv = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg))) 302 if (NULL == (priv = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg)))
302 { 303 {
@@ -305,7 +306,9 @@ GNUNET_CRYPTO_sign_by_peer_identity (const struct
305 return GNUNET_SYSERR; 306 return GNUNET_SYSERR;
306 } 307 }
307 308
308 return GNUNET_CRYPTO_eddsa_sign_ (priv, purpose, sig); 309 result = GNUNET_CRYPTO_eddsa_sign_ (priv, purpose, sig);
310 GNUNET_CRYPTO_eddsa_key_clear (priv);
311 return result;
309} 312}
310 313
311 314
diff --git a/src/lib/util/crypto_elligator.c b/src/lib/util/crypto_elligator.c
index e512696a7..91db517b0 100644
--- a/src/lib/util/crypto_elligator.c
+++ b/src/lib/util/crypto_elligator.c
@@ -95,87 +95,87 @@ static const uint8_t lookupTable[8][crypto_scalarmult_SCALARBYTES] = {
95 95
96// main.c from Kleshnis's elligator implementation 96// main.c from Kleshnis's elligator implementation
97static const unsigned char p_bytes[P_BYTES] = { 97static const unsigned char p_bytes[P_BYTES] = {
98 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 98 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
99 0xff, 0xff, 0xff, 99 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
100 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 100 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
101 0xff, 0xff, 0x7f 101 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
102}; 102};
103 103
104static const unsigned char negative_1_bytes[P_BYTES] = { 104static const unsigned char negative_1_bytes[P_BYTES] = {
105 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 105 0xec, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
106 0xff, 0xff, 0xff, 106 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
107 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 107 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
108 0xff, 0xff, 0x7f 108 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
109}; 109};
110 110
111static const unsigned char negative_2_bytes[P_BYTES] = { 111static const unsigned char negative_2_bytes[P_BYTES] = {
112 0xeb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 112 0xeb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
113 0xff, 0xff, 0xff, 113 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
114 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 114 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
115 0xff, 0xff, 0x7f 115 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
116}; 116};
117 117
118static const unsigned char divide_negative_1_2_bytes[P_BYTES] = { 118static const unsigned char divide_negative_1_2_bytes[P_BYTES] = {
119 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 119 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
120 0xff, 0xff, 0xff, 120 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
121 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 121 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
122 0xff, 0xff, 0x3f 122 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f
123}; 123};
124 124
125static const unsigned char divide_plus_p_3_8_bytes[P_BYTES] = { 125static const unsigned char divide_plus_p_3_8_bytes[P_BYTES] = {
126 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 126 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
127 0xff, 0xff, 0xff, 127 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
128 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 128 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
129 0xff, 0xff, 0x0f 129 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f
130}; 130};
131 131
132static const unsigned char divide_minus_p_1_2_bytes[P_BYTES] = { 132static const unsigned char divide_minus_p_1_2_bytes[P_BYTES] = {
133 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 133 0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
134 0xff, 0xff, 0xff, 134 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
135 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 135 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
136 0xff, 0xff, 0x3f 136 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f
137}; 137};
138 138
139static const unsigned char square_root_negative_1_bytes[P_BYTES] = { 139static const unsigned char square_root_negative_1_bytes[P_BYTES] = {
140 0xb0, 0xa0, 0x0e, 0x4a, 0x27, 0x1b, 0xee, 0xc4, 0x78, 0xe4, 0x2f, 0xad, 0x06, 140 0xb0, 0xa0, 0x0e, 0x4a, 0x27, 0x1b, 0xee, 0xc4,
141 0x18, 0x43, 0x2f, 141 0x78, 0xe4, 0x2f, 0xad, 0x06, 0x18, 0x43, 0x2f,
142 0xa7, 0xd7, 0xfb, 0x3d, 0x99, 0x00, 0x4d, 0x2b, 0x0b, 0xdf, 0xc1, 0x4f, 0x80, 142 0xa7, 0xd7, 0xfb, 0x3d, 0x99, 0x00, 0x4d, 0x2b,
143 0x24, 0x83, 0x2b 143 0x0b, 0xdf, 0xc1, 0x4f, 0x80, 0x24, 0x83, 0x2b
144}; 144};
145 145
146static const unsigned char A_bytes[P_BYTES] = { 146static const unsigned char A_bytes[P_BYTES] = {
147 0x06, 0x6d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 147 0x06, 0x6d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
148 0x00, 0x00, 0x00, 148 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 149 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
150 0x00, 0x00, 0x00 150 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
151}; 151};
152 152
153static const unsigned char negative_A_bytes[P_BYTES] = { 153static const unsigned char negative_A_bytes[P_BYTES] = {
154 0xe7, 0x92, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 154 0xe7, 0x92, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff,
155 0xff, 0xff, 0xff, 155 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
156 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 156 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
157 0xff, 0xff, 0x7f 157 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
158}; 158};
159 159
160static const unsigned char u_bytes[P_BYTES] = { 160static const unsigned char u_bytes[P_BYTES] = {
161 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 161 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
162 0x00, 0x00, 0x00, 162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 163 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
164 0x00, 0x00, 0x00 164 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
165}; 165};
166 166
167static const unsigned char inverted_u_bytes[P_BYTES] = { 167static const unsigned char inverted_u_bytes[P_BYTES] = {
168 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 168 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
169 0xff, 0xff, 0xff, 169 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
170 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 170 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
171 0xff, 0xff, 0x3f 171 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f
172}; 172};
173 173
174static const unsigned char d_bytes[P_BYTES] = { 174static const unsigned char d_bytes[P_BYTES] = {
175 0xa3, 0x78, 0x59, 0x13, 0xca, 0x4d, 0xeb, 0x75, 0xab, 0xd8, 0x41, 0x41, 0x4d, 175 0xa3, 0x78, 0x59, 0x13, 0xca, 0x4d, 0xeb, 0x75,
176 0x0a, 0x70, 0x00, 176 0xab, 0xd8, 0x41, 0x41, 0x4d, 0x0a, 0x70, 0x00,
177 0x98, 0xe8, 0x79, 0x77, 0x79, 0x40, 0xc7, 0x8c, 0x73, 0xfe, 0x6f, 0x2b, 0xee, 177 0x98, 0xe8, 0x79, 0x77, 0x79, 0x40, 0xc7, 0x8c,
178 0x6c, 0x03, 0x52 178 0x73, 0xfe, 0x6f, 0x2b, 0xee, 0x6c, 0x03, 0x52
179}; 179};
180 180
181static mp_limb_t p[P_LIMBS]; 181static mp_limb_t p[P_LIMBS];
@@ -193,6 +193,7 @@ static mp_limb_t d[P_LIMBS];
193 193
194static mp_size_t scratch_space_length; 194static mp_size_t scratch_space_length;
195 195
196// TODO
196static void 197static void
197decode_bytes (mp_limb_t *number, const uint8_t *bytes) 198decode_bytes (mp_limb_t *number, const uint8_t *bytes)
198{ 199{
@@ -206,8 +207,7 @@ decode_bytes (mp_limb_t *number, const uint8_t *bytes)
206} 207}
207 208
208 209
209// Erases the number 210// TODO
210
211static void 211static void
212encode_bytes (uint8_t *bytes, mp_limb_t *number) 212encode_bytes (uint8_t *bytes, mp_limb_t *number)
213{ 213{
@@ -218,8 +218,11 @@ encode_bytes (uint8_t *bytes, mp_limb_t *number)
218} 218}
219 219
220 220
221void 221/**
222GNUNET_CRYPTO_ecdhe_elligator_initialize (void) 222 * Initialize elligator scratch space.
223*/
224void __attribute__ ((constructor))
225GNUNET_CRYPTO_ecdhe_elligator_initialize ()
223{ 226{
224 static bool initialized = false; 227 static bool initialized = false;
225 228
@@ -268,14 +271,12 @@ GNUNET_CRYPTO_ecdhe_elligator_initialize (void)
268 mpn_sec_powm_itch (P_LIMBS, P_BITS - 1, P_LIMBS), 271 mpn_sec_powm_itch (P_LIMBS, P_BITS - 1, P_LIMBS),
269 272
270 // For Elligator_2_Curve25519_convert_from_Ed25519 273 // For Elligator_2_Curve25519_convert_from_Ed25519
271 /*
272 mpn_sec_sqr_itch (P_LIMBS), 274 mpn_sec_sqr_itch (P_LIMBS),
273 mpn_sec_div_r_itch (P_LIMBS + P_LIMBS, P_LIMBS), 275 mpn_sec_div_r_itch (P_LIMBS + P_LIMBS, P_LIMBS),
274 mpn_sec_mul_itch (P_LIMBS, P_LIMBS), 276 mpn_sec_mul_itch (P_LIMBS, P_LIMBS),
275 mpn_sec_add_1_itch (P_LIMBS), 277 mpn_sec_add_1_itch (P_LIMBS),
276 mpn_sec_powm_itch (P_LIMBS, P_BITS - 1, P_LIMBS), 278 mpn_sec_powm_itch (P_LIMBS, P_BITS - 1, P_LIMBS),
277 mpn_sec_sub_1_itch (P_LIMBS) 279 mpn_sec_sub_1_itch (P_LIMBS)
278 */
279 }; 280 };
280 281
281 for (size_t i = 0; i < sizeof scratch_space_lengths 282 for (size_t i = 0; i < sizeof scratch_space_lengths
@@ -291,10 +292,17 @@ GNUNET_CRYPTO_ecdhe_elligator_initialize (void)
291} 292}
292 293
293 294
294// Returns trash if the number is a quadratic non-residue 295/**
295 296 * Calculates the root of a given number.
297 * Returns trash if the number is a quadratic non-residue.
298 *
299 * @param root storage for calculated root
300 * @param number value for which the root is calculated
301 * @param scratch_space buffer for calculation
302 */
296static void 303static void
297least_square_root (mp_limb_t *root, const mp_limb_t *number, 304least_square_root (mp_limb_t *root,
305 const mp_limb_t *number,
298 mp_limb_t *scratch_space) 306 mp_limb_t *scratch_space)
299{ 307{
300 mp_limb_t a[P_LIMBS + P_LIMBS]; 308 mp_limb_t a[P_LIMBS + P_LIMBS];
@@ -331,10 +339,14 @@ least_square_root (mp_limb_t *root, const mp_limb_t *number,
331 339
332 340
333bool 341bool
334GNUNET_CRYPTO_ecdhe_elligator_inverse_map (uint8_t *representative, const 342GNUNET_CRYPTO_ecdhe_elligator_encoding (
335 uint8_t *point, 343 struct GNUNET_CRYPTO_ElligatorRepresentative *r,
336 bool high_y) 344 const struct GNUNET_CRYPTO_EcdhePublicKey *pub,
345 bool high_y)
337{ 346{
347 uint8_t *representative = (uint8_t *) r->r;
348 uint8_t *point = (uint8_t *) pub->q_y;
349
338 mp_limb_t scratch_space[scratch_space_length]; 350 mp_limb_t scratch_space[scratch_space_length];
339 351
340 mp_limb_t a[P_LIMBS + P_LIMBS]; 352 mp_limb_t a[P_LIMBS + P_LIMBS];
@@ -383,9 +395,21 @@ GNUNET_CRYPTO_ecdhe_elligator_inverse_map (uint8_t *representative, const
383} 395}
384 396
385 397
386bool 398/**
387GNUNET_CRYPTO_ecdhe_elligator_direct_map (uint8_t *point, bool *high_y, 399 * Takes a number of the underlying finite field of Curve25519 and projects it into a valid point on that curve.
388 uint8_t *representative) 400 * This function works deterministically.
401 * This step is also known as elligators "decoding" step.
402 * Taken from https://github.com/Kleshni/Elligator-2/blob/master/main.c.
403 *
404 * @param point storage for calculated point on Curve25519
405 * @param high_y The 'high_y' argument of the corresponding GNUNET_CRYPTO_ecdhe_elligator_encoding call
406 * @param representative Given representative
407 * @return 'false' if extra step during direct map calculation is needed, otherwise 'true'
408 */
409static bool
410elligator_direct_map (uint8_t *point,
411 bool *high_y,
412 uint8_t *representative)
389{ 413{
390 mp_limb_t scratch_space[scratch_space_length]; 414 mp_limb_t scratch_space[scratch_space_length];
391 415
@@ -442,25 +466,43 @@ GNUNET_CRYPTO_ecdhe_elligator_direct_map (uint8_t *point, bool *high_y,
442} 466}
443 467
444 468
445// Removes most significant bit and second most significant bit before applying elligator direct map 469void
446bool 470GNUNET_CRYPTO_ecdhe_elligator_decoding (
447GNUNET_CRYPTO_ecdhe_elligator_decoding (struct 471 struct GNUNET_CRYPTO_EcdhePublicKey *point,
448 GNUNET_CRYPTO_EcdhePublicKey *point, 472 bool *high_y,
449 bool *high_y, 473 const struct GNUNET_CRYPTO_ElligatorRepresentative *representative)
450 struct
451 GNUNET_CRYPTO_ElligatorRepresentative *
452 representative)
453{ 474{
454 representative->r[31] &= 63; 475 // if sign of direct map transformation not needed throw it away
455 return GNUNET_CRYPTO_ecdhe_elligator_direct_map ((uint8_t *) point->q_y, 476 bool high_y_local;
456 high_y, 477 bool *high_y_ptr;
457 (uint8_t *) representative->r); 478 if (NULL == high_y)
479 high_y_ptr = &high_y_local;
480 else
481 high_y_ptr = high_y;
482
483 struct GNUNET_CRYPTO_ElligatorRepresentative r_tmp;
484 memcpy (&r_tmp.r, &representative->r, sizeof(r_tmp.r));
485 r_tmp.r[31] &= 63;
486 // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Print high_y\n");
487 elligator_direct_map ((uint8_t *) point->q_y,
488 high_y_ptr,
489 (uint8_t *) r_tmp.r);
458} 490}
459 491
460 492
493/**
494 * Takes a number of the underlying finite field of Curve25519 and projects it into a valid point on that curve.
495 * This function works deterministically.
496 * This step is also known as elligators "decoding" step.
497 * Taken from https://github.com/Kleshni/Elligator-2/blob/master/main.c.
498 *
499 * @param point storage for calculated point on Curve25519
500 * @param source Ed25519 curve point
501 * @return 'false' if source is not a valid Ed25519 point. In this case the 'point' array will be undefined but dependend on source.
502 */
461static bool 503static bool
462Elligator_2_Curve25519_convert_from_Ed25519 (uint8_t *point, const 504convert_from_ed_to_curve (uint8_t *point,
463 uint8_t *source) 505 const uint8_t *source)
464{ 506{
465 mp_limb_t scratch_space[scratch_space_length]; 507 mp_limb_t scratch_space[scratch_space_length];
466 508
@@ -524,22 +566,15 @@ Elligator_2_Curve25519_convert_from_Ed25519 (uint8_t *point, const
524} 566}
525 567
526 568
527// Would call GNUNET_CRYPTO_ecdhe_key_create (struct GNUNET_CRYPTO_EcdhePrivateKey *pk) for pk which is not clamped 569enum GNUNET_GenericReturnValue
528// Following Method 1 in description https://elligator.org/key-exchange section Step 2: Generate a “special†public key 570GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (
529int 571 struct GNUNET_CRYPTO_EcdhePublicKey *pub,
530GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (unsigned char 572 struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
531 pub[
532 crypto_scalarmult_SCALARBYTES
533 ],
534 struct
535 GNUNET_CRYPTO_EcdhePrivateKey
536 *pk)
537{ 573{
538 // eHigh 574 // eHigh
539 // Note crypto_scalarmult_ed25519_base clamps the scalar (here pk->d). TODO: test this 575 // crypto_scalarmult_ed25519_base clamps the scalar pk->d and return only 0 if pk->d is zero
540 // TODO: if pk-d is zero cryto_scalarmult... return -1, otherwise 0. Problem if 0? Unlikely anyway
541 unsigned char eHigh[crypto_scalarmult_SCALARBYTES] = {0}; 576 unsigned char eHigh[crypto_scalarmult_SCALARBYTES] = {0};
542 crypto_scalarmult_ed25519_base (eHigh, pk->d); 577 GNUNET_assert (0 == crypto_scalarmult_ed25519_base (eHigh, pk->d));
543 578
544 // eLow: choose a random point of low order 579 // eLow: choose a random point of low order
545 int sLow = (pk->d)[0] % 8; 580 int sLow = (pk->d)[0] % 8;
@@ -553,14 +588,7 @@ GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (unsigned char
553 return GNUNET_SYSERR; 588 return GNUNET_SYSERR;
554 } 589 }
555 590
556 // Convert point in Ed25519 to Montgomery point 591 if (convert_from_ed_to_curve (pub->q_y, edPub) == false)
557 // TODO: libsodium convert function doesn't work. Figure out why. Maybe because we work on the whole curve rather than the prime subgroup.
558 /*if (crypto_sign_ed25519_pk_to_curve25519 (pub, edPub) == -1)
559 {
560 return -1;
561 }*/
562
563 if (Elligator_2_Curve25519_convert_from_Ed25519 (pub, edPub) == false)
564 { 592 {
565 return GNUNET_SYSERR; 593 return GNUNET_SYSERR;
566 } 594 }
@@ -568,93 +596,14 @@ GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (unsigned char
568} 596}
569 597
570 598
571/** 599void
572Doesn't work because crypto_scalarmult clamps the scalar. We don't want this.
573Unfortunately a "noclamp" version of multiplication is only available for edwards25519 in libsodium.
574We therefore can't implement the second (alternative) method for generate_public_key.
575Keeping this code for discussion. Delete later.
576
577// Curve25519 point (only x-coordinate) which is needed for the alternativ method of
578//GNUNET_CRYPTO_ecdhe_elligator_generate_public_key_alternativ
579static const unsigned char kPoint[] = {
580 0xD8, 0x86, 0x1A, 0xA2, 0x78, 0x7A, 0xD9, 0x26,
581 0x8B, 0x74, 0x74, 0xB6, 0x82, 0xE3, 0xBE, 0xC3,
582 0xCE, 0x36, 0x9A, 0x1E, 0x5E, 0x31, 0x47, 0xA2,
583 0x6D, 0x37, 0x7C, 0xFD, 0x20, 0xB5, 0xDF, 0x75
584};
585
586// Curve25519 order of prime order subgroup
587static const unsigned char L[] = {
588 0xED, 0xD3, 0xF5, 0x5C, 0x1A, 0x63, 0x12, 0x58,
589 0xD6, 0x9C, 0xF7, 0xA2, 0xDE, 0xF9, 0xDE, 0x14,
590 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
591 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10
592};
593
594static void multiplyLittleEndianArray(const unsigned char *input, int multiplier, unsigned char *output, int arraySize) {
595 int carry = 0;
596
597 for (int i = 0; i < arraySize; ++i) {
598 int result = input[i] * multiplier + carry;
599 output[i] = result & 0xFF; // Store the lower 8 bits in the output array
600 carry = result >> 8; // Carry the remaining bits to the next iteration
601 }
602}
603
604static void addLittleEndianArrays(const unsigned char *array1, const unsigned char *array2, unsigned char *result, int arraySize) {
605 int carry = 0;
606
607 for (int i = 0; i < arraySize; ++i) {
608 int sum = array1[i] + array2[i] + carry;
609 result[i] = sum & 0xFF; // Store the lower 8 bits in the result array
610 carry = sum >> 8; // Carry the remaining bits to the next iteration
611 }
612}
613
614Would call GNUNET_CRYPTO_ecdhe_key_create (struct GNUNET_CRYPTO_EcdhePrivateKey *pk) for pk which is not clamped
615Following Method 1 in description https://elligator.org/key-exchange section Step 2: Generate a “special†public key
616int
617GNUNET_CRYPTO_ecdhe_elligator_generate_public_key_alternativ (unsigned char
618 pub[
619 crypto_scalarmult_SCALARBYTES
620 ],
621 struct
622 GNUNET_CRYPTO_EcdhePrivateKey
623 *pk)
624{
625 unsigned char sClamp[crypto_scalarmult_BYTES] = {0};
626 memcpy(sClamp, pk->d, sizeof(sClamp));
627 sClamp[0] &= 248;
628 sClamp[31] &= 127;
629 sClamp[31] |= 64;
630
631 unsigned char sLow[crypto_scalarmult_BYTES] = {0};
632 int multiplier = (pk->d)[0] % 8;
633 multiplyLittleEndianArray(L, multiplier, sLow, 32);
634 unsigned char sDirty[crypto_scalarmult_BYTES] = {0};
635 addLittleEndianArrays(sClamp, sLow, sDirty, 32);
636
637 int check = crypto_scalarmult(pub, sDirty,
638 kPoint);
639
640 if (check == -1)
641 {
642 printf("crypto_scalarmult didn't work\n");
643 return -1;
644 }
645
646 return 0;
647}
648**/
649
650enum GNUNET_GenericReturnValue
651GNUNET_CRYPTO_ecdhe_elligator_key_create ( 600GNUNET_CRYPTO_ecdhe_elligator_key_create (
652 struct GNUNET_CRYPTO_ElligatorRepresentative *repr, 601 struct GNUNET_CRYPTO_ElligatorRepresentative *repr,
653 struct GNUNET_CRYPTO_EcdhePrivateKey *pk) 602 struct GNUNET_CRYPTO_EcdhePrivateKey *pk)
654{ 603{
655 // inverse map can fail for some public keys generated by GNUNET_CRYPTO_ecdhe_elligator_generate_public_key 604 // inverse map can fail for some public keys generated by GNUNET_CRYPTO_ecdhe_elligator_generate_public_key
656 bool validKey = 0; 605 bool validKey = 0;
657 unsigned char pub[crypto_scalarmult_SCALARBYTES]; 606 struct GNUNET_CRYPTO_EcdhePublicKey pub = {0};
658 int8_t random_tweak; 607 int8_t random_tweak;
659 bool high_y; 608 bool high_y;
660 bool msb_set; 609 bool msb_set;
@@ -665,10 +614,12 @@ GNUNET_CRYPTO_ecdhe_elligator_key_create (
665 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, 614 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
666 pk, 615 pk,
667 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)); 616 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
668 if (GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (pub, pk) == 617
669 GNUNET_SYSERR) 618 // Continue if generate_public_key fails
619 if (GNUNET_SYSERR ==
620 GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (&pub, pk))
670 { 621 {
671 return GNUNET_SYSERR; 622 continue;
672 } 623 }
673 624
674 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, 625 GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
@@ -676,12 +627,11 @@ GNUNET_CRYPTO_ecdhe_elligator_key_create (
676 sizeof(int8_t)); 627 sizeof(int8_t));
677 high_y = random_tweak & 1; 628 high_y = random_tweak & 1;
678 629
679 validKey = GNUNET_CRYPTO_ecdhe_elligator_inverse_map ((unsigned 630 validKey = GNUNET_CRYPTO_ecdhe_elligator_encoding (repr,
680 char*) &(repr->r), 631 &pub,
681 (unsigned char*) pub, 632 high_y ?
682 high_y ? 633 GNUNET_YES :
683 GNUNET_YES : 634 GNUNET_NO);
684 GNUNET_NO);
685 } 635 }
686 636
687 // Setting most significant bit and second most significant bit randomly 637 // Setting most significant bit and second most significant bit randomly
@@ -695,5 +645,30 @@ GNUNET_CRYPTO_ecdhe_elligator_key_create (
695 { 645 {
696 repr->r[31] |= 64; 646 repr->r[31] |= 64;
697 } 647 }
698 return GNUNET_OK; 648}
649
650
651enum GNUNET_GenericReturnValue
652GNUNET_CRYPTO_eddsa_elligator_kem_encaps (
653 const struct GNUNET_CRYPTO_EddsaPublicKey *pub,
654 struct GNUNET_CRYPTO_ElligatorRepresentative *r,
655 struct GNUNET_HashCode *key_material)
656{
657 struct GNUNET_CRYPTO_EcdhePrivateKey sk;
658
659 GNUNET_CRYPTO_ecdhe_elligator_key_create (r, &sk);
660
661 return GNUNET_CRYPTO_ecdh_eddsa (&sk, pub, key_material);
662}
663
664
665enum GNUNET_GenericReturnValue
666GNUNET_CRYPTO_eddsa_elligator_kem_decaps (
667 const struct GNUNET_CRYPTO_EddsaPrivateKey *priv,
668 const struct GNUNET_CRYPTO_ElligatorRepresentative *r,
669 struct GNUNET_HashCode *key_material)
670{
671 struct GNUNET_CRYPTO_EcdhePublicKey pub;
672 GNUNET_CRYPTO_ecdhe_elligator_decoding (&pub, NULL, r);
673 return GNUNET_CRYPTO_eddsa_ecdh (priv, &pub, key_material);
699} 674}
diff --git a/src/lib/util/crypto_pkey.c b/src/lib/util/crypto_pkey.c
index a9d4831fb..92e0fba36 100644
--- a/src/lib/util/crypto_pkey.c
+++ b/src/lib/util/crypto_pkey.c
@@ -43,6 +43,23 @@ check_key_type (uint32_t type)
43} 43}
44 44
45 45
46void
47GNUNET_CRYPTO_private_key_clear (struct GNUNET_CRYPTO_PrivateKey *key)
48{
49 switch (ntohl (key->type))
50 {
51 case GNUNET_PUBLIC_KEY_TYPE_ECDSA:
52 GNUNET_CRYPTO_ecdsa_key_clear (&key->ecdsa_key);
53 break;
54 case GNUNET_PUBLIC_KEY_TYPE_EDDSA:
55 GNUNET_CRYPTO_eddsa_key_clear (&key->eddsa_key);
56 break;
57 default:
58 GNUNET_break (0);
59 }
60}
61
62
46ssize_t 63ssize_t
47GNUNET_CRYPTO_private_key_get_length (const struct 64GNUNET_CRYPTO_private_key_get_length (const struct
48 GNUNET_CRYPTO_PrivateKey *key) 65 GNUNET_CRYPTO_PrivateKey *key)
diff --git a/src/lib/util/crypto_symmetric.c b/src/lib/util/crypto_symmetric.c
index a9217febd..c08b84c17 100644
--- a/src/lib/util/crypto_symmetric.c
+++ b/src/lib/util/crypto_symmetric.c
@@ -137,7 +137,7 @@ GNUNET_CRYPTO_symmetric_encrypt (const void *block,
137 void *result) 137 void *result)
138{ 138{
139 gcry_cipher_hd_t handle; 139 gcry_cipher_hd_t handle;
140 char tmp[size]; 140 char tmp[GNUNET_NZL(size)];
141 141
142 if (GNUNET_OK != setup_cipher_aes (&handle, sessionkey, iv)) 142 if (GNUNET_OK != setup_cipher_aes (&handle, sessionkey, iv))
143 return -1; 143 return -1;
diff --git a/src/lib/util/helper.c b/src/lib/util/helper.c
index 1dd3e33e2..87ea749e9 100644
--- a/src/lib/util/helper.c
+++ b/src/lib/util/helper.c
@@ -612,7 +612,7 @@ helper_write (void *cls)
612struct GNUNET_HELPER_SendHandle * 612struct GNUNET_HELPER_SendHandle *
613GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, 613GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
614 const struct GNUNET_MessageHeader *msg, 614 const struct GNUNET_MessageHeader *msg,
615 int can_drop, 615 bool can_drop,
616 GNUNET_HELPER_Continuation cont, 616 GNUNET_HELPER_Continuation cont,
617 void *cont_cls) 617 void *cont_cls)
618{ 618{
@@ -621,7 +621,7 @@ GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h,
621 621
622 if (NULL == h->fh_to_helper) 622 if (NULL == h->fh_to_helper)
623 return NULL; 623 return NULL;
624 if ((GNUNET_YES == can_drop) && (NULL != h->sh_head)) 624 if (can_drop && (NULL != h->sh_head))
625 return NULL; 625 return NULL;
626 mlen = ntohs (msg->size); 626 mlen = ntohs (msg->size);
627 sh = GNUNET_malloc (sizeof(struct GNUNET_HELPER_SendHandle) + mlen); 627 sh = GNUNET_malloc (sizeof(struct GNUNET_HELPER_SendHandle) + mlen);
diff --git a/src/lib/util/scheduler.c b/src/lib/util/scheduler.c
index 70193a0d2..038d2f6ac 100644
--- a/src/lib/util/scheduler.c
+++ b/src/lib/util/scheduler.c
@@ -510,7 +510,9 @@ get_timeout ()
510 return timeout; 510 return timeout;
511} 511}
512 512
513static void remove_pass_end_marker () 513
514static void
515remove_pass_end_marker ()
514{ 516{
515 if (pass_end_marker.in_ready_list) 517 if (pass_end_marker.in_ready_list)
516 { 518 {
@@ -521,7 +523,9 @@ static void remove_pass_end_marker ()
521 } 523 }
522} 524}
523 525
524static void set_work_priority (enum GNUNET_SCHEDULER_Priority p) 526
527static void
528set_work_priority (enum GNUNET_SCHEDULER_Priority p)
525{ 529{
526 remove_pass_end_marker (); 530 remove_pass_end_marker ();
527 GNUNET_CONTAINER_DLL_insert_tail (ready_head[p], 531 GNUNET_CONTAINER_DLL_insert_tail (ready_head[p],
@@ -532,6 +536,7 @@ static void set_work_priority (enum GNUNET_SCHEDULER_Priority p)
532 work_priority = p; 536 work_priority = p;
533} 537}
534 538
539
535/** 540/**
536 * Put a task that is ready for execution into the ready queue. 541 * Put a task that is ready for execution into the ready queue.
537 * 542 *
@@ -711,7 +716,7 @@ shutdown_if_no_lifeness (void)
711} 716}
712 717
713 718
714static int 719static enum GNUNET_GenericReturnValue
715select_loop (struct GNUNET_SCHEDULER_Handle *sh, 720select_loop (struct GNUNET_SCHEDULER_Handle *sh,
716 struct DriverContext *context); 721 struct DriverContext *context);
717 722
@@ -735,8 +740,9 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task,
735 task_cls, 740 task_cls,
736 GNUNET_SCHEDULER_REASON_STARTUP, 741 GNUNET_SCHEDULER_REASON_STARTUP,
737 GNUNET_SCHEDULER_PRIORITY_DEFAULT); 742 GNUNET_SCHEDULER_PRIORITY_DEFAULT);
738 select_loop (sh, 743 GNUNET_break (GNUNET_OK ==
739 &context); 744 select_loop (sh,
745 &context));
740 GNUNET_SCHEDULER_driver_done (sh); 746 GNUNET_SCHEDULER_driver_done (sh);
741 GNUNET_free (driver); 747 GNUNET_free (driver);
742} 748}
@@ -2276,12 +2282,12 @@ GNUNET_SCHEDULER_driver_init (const struct GNUNET_SCHEDULER_Driver *driver)
2276void 2282void
2277GNUNET_SCHEDULER_driver_done (struct GNUNET_SCHEDULER_Handle *sh) 2283GNUNET_SCHEDULER_driver_done (struct GNUNET_SCHEDULER_Handle *sh)
2278{ 2284{
2279 GNUNET_assert (NULL == pending_head); 2285 GNUNET_break (NULL == pending_head);
2280 GNUNET_assert (NULL == pending_timeout_head); 2286 GNUNET_break (NULL == pending_timeout_head);
2281 GNUNET_assert (NULL == shutdown_head); 2287 GNUNET_break (NULL == shutdown_head);
2282 for (int i = 0; i != GNUNET_SCHEDULER_PRIORITY_COUNT; ++i) 2288 for (int i = 0; i != GNUNET_SCHEDULER_PRIORITY_COUNT; ++i)
2283 { 2289 {
2284 GNUNET_assert (NULL == ready_head[i]); 2290 GNUNET_break (NULL == ready_head[i]);
2285 } 2291 }
2286 GNUNET_NETWORK_fdset_destroy (sh->rs); 2292 GNUNET_NETWORK_fdset_destroy (sh->rs);
2287 GNUNET_NETWORK_fdset_destroy (sh->ws); 2293 GNUNET_NETWORK_fdset_destroy (sh->ws);
@@ -2302,7 +2308,7 @@ GNUNET_SCHEDULER_driver_done (struct GNUNET_SCHEDULER_Handle *sh)
2302} 2308}
2303 2309
2304 2310
2305static int 2311static enum GNUNET_GenericReturnValue
2306select_loop (struct GNUNET_SCHEDULER_Handle *sh, 2312select_loop (struct GNUNET_SCHEDULER_Handle *sh,
2307 struct DriverContext *context) 2313 struct DriverContext *context)
2308{ 2314{
@@ -2441,6 +2447,19 @@ select_loop (struct GNUNET_SCHEDULER_Handle *sh,
2441 } 2447 }
2442 GNUNET_NETWORK_fdset_destroy (rs); 2448 GNUNET_NETWORK_fdset_destroy (rs);
2443 GNUNET_NETWORK_fdset_destroy (ws); 2449 GNUNET_NETWORK_fdset_destroy (ws);
2450
2451 if ( (NULL == context->scheduled_head) &&
2452 (NULL != pending_timeout_head) &&
2453 (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us ==
2454 context->timeout.abs_value_us) )
2455 {
2456 /* Only remaining task has timeout of 'forever'.
2457 We exit here more as sanity measure, as just
2458 waiting forever isn't exactly useful. Still,
2459 this is indicative of a bug in the client code. */
2460 GNUNET_break (0);
2461 return GNUNET_NO;
2462 }
2444 return GNUNET_OK; 2463 return GNUNET_OK;
2445} 2464}
2446 2465
diff --git a/src/lib/util/service.c b/src/lib/util/service.c
index 7aeabf687..363210c61 100644
--- a/src/lib/util/service.c
+++ b/src/lib/util/service.c
@@ -24,7 +24,6 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * @author Florian Dold 25 * @author Florian Dold
26 */ 26 */
27
28#include "platform.h" 27#include "platform.h"
29#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
30#include "gnunet_protocols.h" 29#include "gnunet_protocols.h"
@@ -233,15 +232,10 @@ struct GNUNET_SERVICE_Handle
233 int ready_confirm_fd; 232 int ready_confirm_fd;
234 233
235 /** 234 /**
236 * Overall success/failure of the service start. 235 * If true, consider unknown message types an error where the
237 */
238 int ret;
239
240 /**
241 * If #GNUNET_YES, consider unknown message types an error where the
242 * client is disconnected. 236 * client is disconnected.
243 */ 237 */
244 int require_found; 238 bool require_found;
245}; 239};
246 240
247 241
@@ -330,19 +324,19 @@ struct GNUNET_SERVICE_Client
330 * force the OS to close once the process actually dies. Should only 324 * force the OS to close once the process actually dies. Should only
331 * be used in special cases! 325 * be used in special cases!
332 */ 326 */
333 int persist; 327 bool persist;
334 328
335 /** 329 /**
336 * Is this client a 'monitor' client that should not be counted 330 * Is this client a 'monitor' client that should not be counted
337 * when deciding on destroying the server during soft shutdown? 331 * when deciding on destroying the server during soft shutdown?
338 * (see also #GNUNET_SERVICE_start) 332 * (see also #GNUNET_SERVICE_start)
339 */ 333 */
340 int is_monitor; 334 bool is_monitor;
341 335
342 /** 336 /**
343 * Are we waiting for the application to call #GNUNET_SERVICE_client_continue()? 337 * Are we waiting for the application to call #GNUNET_SERVICE_client_continue()?
344 */ 338 */
345 int needs_continue; 339 bool needs_continue;
346 340
347 /** 341 /**
348 * Type of last message processed (for warn_no_receive_done). 342 * Type of last message processed (for warn_no_receive_done).
@@ -356,19 +350,22 @@ struct GNUNET_SERVICE_Client
356 * monitoring. 350 * monitoring.
357 * 351 *
358 * @param sh service to check clients for 352 * @param sh service to check clients for
359 * @return #GNUNET_YES if we have non-monitoring clients left 353 * @return true if we have non-monitoring clients left
360 */ 354 */
361static int 355static enum GNUNET_GenericReturnValue
362have_non_monitor_clients (struct GNUNET_SERVICE_Handle *sh) 356have_non_monitor_clients (struct GNUNET_SERVICE_Handle *sh)
363{ 357{
364 for (struct GNUNET_SERVICE_Client *client = sh->clients_head; NULL != client; 358 for (struct GNUNET_SERVICE_Client *client = sh->clients_head;
359 NULL != client;
365 client = client->next) 360 client = client->next)
366 { 361 {
362 if (NULL != client->drop_task)
363 continue;
367 if (client->is_monitor) 364 if (client->is_monitor)
368 continue; 365 continue;
369 return GNUNET_YES; 366 return true;
370 } 367 }
371 return GNUNET_NO; 368 return false;
372} 369}
373 370
374 371
@@ -380,13 +377,14 @@ have_non_monitor_clients (struct GNUNET_SERVICE_Handle *sh)
380 * @param sr reason for suspending accepting connections 377 * @param sr reason for suspending accepting connections
381 */ 378 */
382static void 379static void
383do_suspend (struct GNUNET_SERVICE_Handle *sh, enum SuspendReason sr) 380do_suspend (struct GNUNET_SERVICE_Handle *sh,
381 enum SuspendReason sr)
384{ 382{
385 struct ServiceListenContext *slc;
386
387 GNUNET_assert (0 == (sh->suspend_state & sr)); 383 GNUNET_assert (0 == (sh->suspend_state & sr));
388 sh->suspend_state |= sr; 384 sh->suspend_state |= sr;
389 for (slc = sh->slc_head; NULL != slc; slc = slc->next) 385 for (struct ServiceListenContext *slc = sh->slc_head;
386 NULL != slc;
387 slc = slc->next)
390 { 388 {
391 if (NULL != slc->listen_task) 389 if (NULL != slc->listen_task)
392 { 390 {
@@ -423,7 +421,7 @@ service_shutdown (void *cls)
423 case GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN: 421 case GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN:
424 if (0 == (sh->suspend_state & SUSPEND_STATE_SHUTDOWN)) 422 if (0 == (sh->suspend_state & SUSPEND_STATE_SHUTDOWN))
425 do_suspend (sh, SUSPEND_STATE_SHUTDOWN); 423 do_suspend (sh, SUSPEND_STATE_SHUTDOWN);
426 if (GNUNET_NO == have_non_monitor_clients (sh)) 424 if (! have_non_monitor_clients (sh))
427 GNUNET_SERVICE_shutdown (sh); 425 GNUNET_SERVICE_shutdown (sh);
428 break; 426 break;
429 } 427 }
@@ -435,25 +433,21 @@ service_shutdown (void *cls)
435 * 433 *
436 * @param list a list of networks 434 * @param list a list of networks
437 * @param add the IP to check (in network byte order) 435 * @param add the IP to check (in network byte order)
438 * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is 436 * @return false if the IP is not in the list, true if it it is
439 */ 437 */
440static int 438static bool
441check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list, 439check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list,
442 const struct in_addr *add) 440 const struct in_addr *add)
443{ 441{
444 unsigned int i; 442 for (unsigned int i = 0;
445 443 0 != list[i].network.s_addr;
446 if (NULL == list) 444 i++)
447 return GNUNET_NO;
448 i = 0;
449 while ((0 != list[i].network.s_addr) || (0 != list[i].netmask.s_addr))
450 { 445 {
451 if ((add->s_addr & list[i].netmask.s_addr) == 446 if ( (add->s_addr & list[i].netmask.s_addr) ==
452 (list[i].network.s_addr & list[i].netmask.s_addr)) 447 (list[i].network.s_addr & list[i].netmask.s_addr) )
453 return GNUNET_YES; 448 return true;
454 i++;
455 } 449 }
456 return GNUNET_NO; 450 return false;
457} 451}
458 452
459 453
@@ -462,30 +456,29 @@ check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list,
462 * 456 *
463 * @param list a list of networks 457 * @param list a list of networks
464 * @param ip the IP to check (in network byte order) 458 * @param ip the IP to check (in network byte order)
465 * @return #GNUNET_NO if the IP is not in the list, #GNUNET_YES if it it is 459 * @return false if the IP is not in the list, true if it it is
466 */ 460 */
467static int 461static bool
468check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list, 462check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list,
469 const struct in6_addr *ip) 463 const struct in6_addr *ip)
470{ 464{
471 unsigned int i; 465 for (unsigned int i = 0;
472 466 ! GNUNET_is_zero (&list[i].network);
473 if (NULL == list) 467 i++)
474 return GNUNET_NO;
475 i = 0;
476NEXT:
477 while (GNUNET_NO == GNUNET_is_zero (&list[i].network))
478 { 468 {
469 bool match = true;
470
479 for (unsigned int j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++) 471 for (unsigned int j = 0; j < sizeof(struct in6_addr) / sizeof(int); j++)
480 if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) != 472 if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) !=
481 (((int *) &list[i].network)[j] & ((int *) &list[i].netmask)[j])) 473 (((int *) &list[i].network)[j] & ((int *) &list[i].netmask)[j]))
482 { 474 {
483 i++; 475 match = false;
484 goto NEXT; 476 break;
485 } 477 }
486 return GNUNET_YES; 478 if (match)
479 return true;
487 } 480 }
488 return GNUNET_NO; 481 return false;
489} 482}
490 483
491 484
@@ -593,7 +586,8 @@ service_mq_send (struct GNUNET_MQ_Handle *mq,
593 * @param impl_state state specific to the implementation 586 * @param impl_state state specific to the implementation
594 */ 587 */
595static void 588static void
596service_mq_cancel (struct GNUNET_MQ_Handle *mq, void *impl_state) 589service_mq_cancel (struct GNUNET_MQ_Handle *mq,
590 void *impl_state)
597{ 591{
598 struct GNUNET_SERVICE_Client *client = impl_state; 592 struct GNUNET_SERVICE_Client *client = impl_state;
599 593
@@ -615,12 +609,14 @@ service_mq_cancel (struct GNUNET_MQ_Handle *mq, void *impl_state)
615 * @param error error code 609 * @param error error code
616 */ 610 */
617static void 611static void
618service_mq_error_handler (void *cls, enum GNUNET_MQ_Error error) 612service_mq_error_handler (void *cls,
613 enum GNUNET_MQ_Error error)
619{ 614{
620 struct GNUNET_SERVICE_Client *client = cls; 615 struct GNUNET_SERVICE_Client *client = cls;
621 struct GNUNET_SERVICE_Handle *sh = client->sh; 616 struct GNUNET_SERVICE_Handle *sh = client->sh;
622 617
623 if ((GNUNET_MQ_ERROR_NO_MATCH == error) && (GNUNET_NO == sh->require_found)) 618 if ( (GNUNET_MQ_ERROR_NO_MATCH == error) &&
619 (! sh->require_found) )
624 { 620 {
625 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 621 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
626 "No handler for message of type %u found\n", 622 "No handler for message of type %u found\n",
@@ -680,8 +676,8 @@ service_client_mst_cb (void *cls,
680 "Received message of type %u and size %u from client\n", 676 "Received message of type %u and size %u from client\n",
681 ntohs (message->type), 677 ntohs (message->type),
682 ntohs (message->size)); 678 ntohs (message->size));
683 GNUNET_assert (GNUNET_NO == client->needs_continue); 679 GNUNET_assert (! client->needs_continue);
684 client->needs_continue = GNUNET_YES; 680 client->needs_continue = true;
685 client->warn_type = ntohs (message->type); 681 client->warn_type = ntohs (message->type);
686 client->warn_start = GNUNET_TIME_absolute_get (); 682 client->warn_start = GNUNET_TIME_absolute_get ();
687 GNUNET_assert (NULL == client->warn_task); 683 GNUNET_assert (NULL == client->warn_task);
@@ -717,7 +713,7 @@ service_client_recv (void *cls)
717 /* client closed connection (or IO error) */ 713 /* client closed connection (or IO error) */
718 if (NULL == client->drop_task) 714 if (NULL == client->drop_task)
719 { 715 {
720 GNUNET_assert (GNUNET_NO == client->needs_continue); 716 GNUNET_assert (! client->needs_continue);
721 GNUNET_SERVICE_client_drop (client); 717 GNUNET_SERVICE_client_drop (client);
722 } 718 }
723 return; 719 return;
@@ -726,7 +722,7 @@ service_client_recv (void *cls)
726 return; /* more messages in buffer, wait for application 722 return; /* more messages in buffer, wait for application
727 to be done processing */ 723 to be done processing */
728 GNUNET_assert (GNUNET_OK == ret); 724 GNUNET_assert (GNUNET_OK == ret);
729 if (GNUNET_YES == client->needs_continue) 725 if (client->needs_continue)
730 return; 726 return;
731 if (NULL != client->recv_task) 727 if (NULL != client->recv_task)
732 return; 728 return;
@@ -753,7 +749,9 @@ start_client (struct GNUNET_SERVICE_Handle *sh,
753 struct GNUNET_SERVICE_Client *client; 749 struct GNUNET_SERVICE_Client *client;
754 750
755 client = GNUNET_new (struct GNUNET_SERVICE_Client); 751 client = GNUNET_new (struct GNUNET_SERVICE_Client);
756 GNUNET_CONTAINER_DLL_insert (sh->clients_head, sh->clients_tail, client); 752 GNUNET_CONTAINER_DLL_insert (sh->clients_head,
753 sh->clients_tail,
754 client);
757 client->sh = sh; 755 client->sh = sh;
758 client->sock = csock; 756 client->sock = csock;
759 client->mq = GNUNET_MQ_queue_for_callbacks (&service_mq_send, 757 client->mq = GNUNET_MQ_queue_for_callbacks (&service_mq_send,
@@ -806,7 +804,8 @@ accept_client (void *cls)
806 if (EMFILE == errno) 804 if (EMFILE == errno)
807 do_suspend (sh, SUSPEND_STATE_EMFILE); 805 do_suspend (sh, SUSPEND_STATE_EMFILE);
808 else if (EAGAIN != errno) 806 else if (EAGAIN != errno)
809 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "accept"); 807 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
808 "accept");
810 break; 809 break;
811 } 810 }
812 switch (sa.ss_family) 811 switch (sa.ss_family)
@@ -815,18 +814,22 @@ accept_client (void *cls)
815 GNUNET_assert (addrlen == sizeof(struct sockaddr_in)); 814 GNUNET_assert (addrlen == sizeof(struct sockaddr_in));
816 v4 = (const struct sockaddr_in *) &sa; 815 v4 = (const struct sockaddr_in *) &sa;
817 ok = (((NULL == sh->v4_allowed) || 816 ok = (((NULL == sh->v4_allowed) ||
818 (check_ipv4_listed (sh->v4_allowed, &v4->sin_addr))) && 817 (check_ipv4_listed (sh->v4_allowed,
818 &v4->sin_addr))) &&
819 ((NULL == sh->v4_denied) || 819 ((NULL == sh->v4_denied) ||
820 (! check_ipv4_listed (sh->v4_denied, &v4->sin_addr)))); 820 (! check_ipv4_listed (sh->v4_denied,
821 &v4->sin_addr))));
821 break; 822 break;
822 823
823 case AF_INET6: 824 case AF_INET6:
824 GNUNET_assert (addrlen == sizeof(struct sockaddr_in6)); 825 GNUNET_assert (addrlen == sizeof(struct sockaddr_in6));
825 v6 = (const struct sockaddr_in6 *) &sa; 826 v6 = (const struct sockaddr_in6 *) &sa;
826 ok = (((NULL == sh->v6_allowed) || 827 ok = (((NULL == sh->v6_allowed) ||
827 (check_ipv6_listed (sh->v6_allowed, &v6->sin6_addr))) && 828 (check_ipv6_listed (sh->v6_allowed,
829 &v6->sin6_addr))) &&
828 ((NULL == sh->v6_denied) || 830 ((NULL == sh->v6_denied) ||
829 (! check_ipv6_listed (sh->v6_denied, &v6->sin6_addr)))); 831 (! check_ipv6_listed (sh->v6_denied,
832 &v6->sin6_addr))));
830 break; 833 break;
831 834
832 case AF_UNIX: 835 case AF_UNIX:
@@ -850,7 +853,8 @@ accept_client (void *cls)
850 LOG (GNUNET_ERROR_TYPE_DEBUG, 853 LOG (GNUNET_ERROR_TYPE_DEBUG,
851 "Service accepted incoming connection from %s.\n", 854 "Service accepted incoming connection from %s.\n",
852 GNUNET_a2s ((const struct sockaddr *) &sa, addrlen)); 855 GNUNET_a2s ((const struct sockaddr *) &sa, addrlen));
853 start_client (slc->sh, sock); 856 start_client (slc->sh,
857 sock);
854 } 858 }
855 if (0 != sh->suspend_state) 859 if (0 != sh->suspend_state)
856 return; 860 return;
@@ -870,15 +874,16 @@ accept_client (void *cls)
870 * or #SUSPEND_STATE_NONE on first startup 874 * or #SUSPEND_STATE_NONE on first startup
871 */ 875 */
872static void 876static void
873do_resume (struct GNUNET_SERVICE_Handle *sh, enum SuspendReason sr) 877do_resume (struct GNUNET_SERVICE_Handle *sh,
878 enum SuspendReason sr)
874{ 879{
875 struct ServiceListenContext *slc;
876
877 GNUNET_assert ((SUSPEND_STATE_NONE == sr) || (0 != (sh->suspend_state & sr))); 880 GNUNET_assert ((SUSPEND_STATE_NONE == sr) || (0 != (sh->suspend_state & sr)));
878 sh->suspend_state -= sr; 881 sh->suspend_state -= sr;
879 if (SUSPEND_STATE_NONE != sh->suspend_state) 882 if (SUSPEND_STATE_NONE != sh->suspend_state)
880 return; 883 return;
881 for (slc = sh->slc_head; NULL != slc; slc = slc->next) 884 for (struct ServiceListenContext *slc = sh->slc_head;
885 NULL != slc;
886 slc = slc->next)
882 { 887 {
883 GNUNET_assert (NULL == slc->listen_task); 888 GNUNET_assert (NULL == slc->listen_task);
884 slc->listen_task = 889 slc->listen_task =
@@ -928,7 +933,7 @@ service_main (void *cls)
928 * @return #GNUNET_SYSERR on parse error, #GNUNET_OK on success (including 933 * @return #GNUNET_SYSERR on parse error, #GNUNET_OK on success (including
929 * no ACL configured) 934 * no ACL configured)
930 */ 935 */
931static int 936static enum GNUNET_GenericReturnValue
932process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret, 937process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret,
933 struct GNUNET_SERVICE_Handle *sh, 938 struct GNUNET_SERVICE_Handle *sh,
934 const char *option) 939 const char *option)
@@ -969,7 +974,7 @@ process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret,
969 * @return #GNUNET_SYSERR on parse error, #GNUNET_OK on success (including 974 * @return #GNUNET_SYSERR on parse error, #GNUNET_OK on success (including
970 * no ACL configured) 975 * no ACL configured)
971 */ 976 */
972static int 977static enum GNUNET_GenericReturnValue
973process_acl6 (struct GNUNET_STRINGS_IPv6NetworkPolicy **ret, 978process_acl6 (struct GNUNET_STRINGS_IPv6NetworkPolicy **ret,
974 struct GNUNET_SERVICE_Handle *sh, 979 struct GNUNET_SERVICE_Handle *sh,
975 const char *option) 980 const char *option)
@@ -1457,7 +1462,7 @@ open_listen_socket (const struct sockaddr *server_addr,
1457 * @param sh service context to initialize 1462 * @param sh service context to initialize
1458 * @return #GNUNET_OK if configuration succeeded 1463 * @return #GNUNET_OK if configuration succeeded
1459 */ 1464 */
1460static int 1465static enum GNUNET_GenericReturnValue
1461setup_service (struct GNUNET_SERVICE_Handle *sh) 1466setup_service (struct GNUNET_SERVICE_Handle *sh)
1462{ 1467{
1463 int tolerant; 1468 int tolerant;
@@ -1489,8 +1494,8 @@ setup_service (struct GNUNET_SERVICE_Handle *sh)
1489 1494
1490 lsocks = NULL; 1495 lsocks = NULL;
1491 errno = 0; 1496 errno = 0;
1492 if ((NULL != (nfds = getenv ("LISTEN_FDS"))) && 1497 if ( (NULL != (nfds = getenv ("LISTEN_FDS"))) &&
1493 (1 == sscanf (nfds, "%u%1s", &cnt, dummy)) && (cnt > 0) && 1498 (1 == sscanf (nfds, "%u%1s", &cnt, dummy)) && (cnt > 0) &&
1494 (cnt < FD_SETSIZE) && (cnt + 4 < FD_SETSIZE)) 1499 (cnt < FD_SETSIZE) && (cnt + 4 < FD_SETSIZE))
1495 { 1500 {
1496 lsocks = GNUNET_new_array (cnt + 1, struct GNUNET_NETWORK_Handle *); 1501 lsocks = GNUNET_new_array (cnt + 1, struct GNUNET_NETWORK_Handle *);
@@ -1532,7 +1537,9 @@ setup_service (struct GNUNET_SERVICE_Handle *sh)
1532 slc = GNUNET_new (struct ServiceListenContext); 1537 slc = GNUNET_new (struct ServiceListenContext);
1533 slc->sh = sh; 1538 slc->sh = sh;
1534 slc->listen_socket = *ls; 1539 slc->listen_socket = *ls;
1535 GNUNET_CONTAINER_DLL_insert (sh->slc_head, sh->slc_tail, slc); 1540 GNUNET_CONTAINER_DLL_insert (sh->slc_head,
1541 sh->slc_tail,
1542 slc);
1536 } 1543 }
1537 GNUNET_free (lsocks); 1544 GNUNET_free (lsocks);
1538 } 1545 }
@@ -1552,7 +1559,8 @@ setup_service (struct GNUNET_SERVICE_Handle *sh)
1552 1559
1553 slc = GNUNET_new (struct ServiceListenContext); 1560 slc = GNUNET_new (struct ServiceListenContext);
1554 slc->sh = sh; 1561 slc->sh = sh;
1555 slc->listen_socket = open_listen_socket (addrs[i], addrlens[i]); 1562 slc->listen_socket = open_listen_socket (addrs[i],
1563 addrlens[i]);
1556 GNUNET_free (addrs[i]); 1564 GNUNET_free (addrs[i]);
1557 if (NULL == slc->listen_socket) 1565 if (NULL == slc->listen_socket)
1558 { 1566 {
@@ -1560,7 +1568,9 @@ setup_service (struct GNUNET_SERVICE_Handle *sh)
1560 GNUNET_free (slc); 1568 GNUNET_free (slc);
1561 continue; 1569 continue;
1562 } 1570 }
1563 GNUNET_CONTAINER_DLL_insert (sh->slc_head, sh->slc_tail, slc); 1571 GNUNET_CONTAINER_DLL_insert (sh->slc_head,
1572 sh->slc_tail,
1573 slc);
1564 } 1574 }
1565 GNUNET_free (addrlens); 1575 GNUNET_free (addrlens);
1566 GNUNET_free (addrs); 1576 GNUNET_free (addrs);
@@ -1582,7 +1592,7 @@ setup_service (struct GNUNET_SERVICE_Handle *sh)
1582 GNUNET_NETWORK_socket_close (*ls); 1592 GNUNET_NETWORK_socket_close (*ls);
1583 GNUNET_free (csocks); 1593 GNUNET_free (csocks);
1584 } 1594 }
1585 sh->require_found = tolerant ? GNUNET_NO : GNUNET_YES; 1595 sh->require_found = (GNUNET_NO == tolerant);
1586 sh->match_uid = GNUNET_CONFIGURATION_get_value_yesno (sh->cfg, 1596 sh->match_uid = GNUNET_CONFIGURATION_get_value_yesno (sh->cfg,
1587 sh->service_name, 1597 sh->service_name,
1588 "UNIX_MATCH_UID"); 1598 "UNIX_MATCH_UID");
@@ -1609,10 +1619,11 @@ get_user_name (struct GNUNET_SERVICE_Handle *sh)
1609{ 1619{
1610 char *un; 1620 char *un;
1611 1621
1612 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (sh->cfg, 1622 if (GNUNET_OK !=
1613 sh->service_name, 1623 GNUNET_CONFIGURATION_get_value_filename (sh->cfg,
1614 "USERNAME", 1624 sh->service_name,
1615 &un)) 1625 "USERNAME",
1626 &un))
1616 return NULL; 1627 return NULL;
1617 return un; 1628 return un;
1618} 1629}
@@ -1624,16 +1635,14 @@ get_user_name (struct GNUNET_SERVICE_Handle *sh)
1624 * @param sh service context 1635 * @param sh service context
1625 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 1636 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
1626 */ 1637 */
1627static int 1638static enum GNUNET_GenericReturnValue
1628set_user_id (struct GNUNET_SERVICE_Handle *sh) 1639set_user_id (struct GNUNET_SERVICE_Handle *sh)
1629{ 1640{
1630 char *user; 1641 char *user;
1642 struct passwd *pws;
1631 1643
1632 if (NULL == (user = get_user_name (sh))) 1644 if (NULL == (user = get_user_name (sh)))
1633 return GNUNET_OK; /* keep */ 1645 return GNUNET_OK; /* keep */
1634
1635 struct passwd *pws;
1636
1637 errno = 0; 1646 errno = 0;
1638 pws = getpwnam (user); 1647 pws = getpwnam (user);
1639 if (NULL == pws) 1648 if (NULL == pws)
@@ -1649,7 +1658,8 @@ set_user_id (struct GNUNET_SERVICE_Handle *sh)
1649#if HAVE_INITGROUPS 1658#if HAVE_INITGROUPS
1650 (0 != initgroups (user, pws->pw_gid)) || 1659 (0 != initgroups (user, pws->pw_gid)) ||
1651#endif 1660#endif
1652 (0 != setuid (pws->pw_uid)) || (0 != seteuid (pws->pw_uid))) 1661 (0 != setuid (pws->pw_uid)) ||
1662 (0 != seteuid (pws->pw_uid)))
1653 { 1663 {
1654 if ((0 != setregid (pws->pw_gid, pws->pw_gid)) || 1664 if ((0 != setregid (pws->pw_gid, pws->pw_gid)) ||
1655 (0 != setreuid (pws->pw_uid, pws->pw_uid))) 1665 (0 != setreuid (pws->pw_uid, pws->pw_uid)))
@@ -1680,10 +1690,11 @@ get_pid_file_name (struct GNUNET_SERVICE_Handle *sh)
1680{ 1690{
1681 char *pif; 1691 char *pif;
1682 1692
1683 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (sh->cfg, 1693 if (GNUNET_OK !=
1684 sh->service_name, 1694 GNUNET_CONFIGURATION_get_value_filename (sh->cfg,
1685 "PIDFILE", 1695 sh->service_name,
1686 &pif)) 1696 "PIDFILE",
1697 &pif))
1687 return NULL; 1698 return NULL;
1688 return pif; 1699 return pif;
1689} 1700}
@@ -1702,7 +1713,9 @@ pid_file_delete (struct GNUNET_SERVICE_Handle *sh)
1702 if (NULL == pif) 1713 if (NULL == pif)
1703 return; /* no PID file */ 1714 return; /* no PID file */
1704 if (0 != unlink (pif)) 1715 if (0 != unlink (pif))
1705 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "unlink", pif); 1716 LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING,
1717 "unlink",
1718 pif);
1706 GNUNET_free (pif); 1719 GNUNET_free (pif);
1707} 1720}
1708 1721
@@ -1713,7 +1726,7 @@ pid_file_delete (struct GNUNET_SERVICE_Handle *sh)
1713 * @param sh service context 1726 * @param sh service context
1714 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 1727 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
1715 */ 1728 */
1716static int 1729static enum GNUNET_GenericReturnValue
1717detach_terminal (struct GNUNET_SERVICE_Handle *sh) 1730detach_terminal (struct GNUNET_SERVICE_Handle *sh)
1718{ 1731{
1719 pid_t pid; 1732 pid_t pid;
@@ -1722,13 +1735,15 @@ detach_terminal (struct GNUNET_SERVICE_Handle *sh)
1722 1735
1723 if (0 != pipe (filedes)) 1736 if (0 != pipe (filedes))
1724 { 1737 {
1725 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "pipe"); 1738 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
1739 "pipe");
1726 return GNUNET_SYSERR; 1740 return GNUNET_SYSERR;
1727 } 1741 }
1728 pid = fork (); 1742 pid = fork ();
1729 if (pid < 0) 1743 if (pid < 0)
1730 { 1744 {
1731 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "fork"); 1745 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
1746 "fork");
1732 return GNUNET_SYSERR; 1747 return GNUNET_SYSERR;
1733 } 1748 }
1734 if (0 != pid) 1749 if (0 != pid)
@@ -1739,7 +1754,8 @@ detach_terminal (struct GNUNET_SERVICE_Handle *sh)
1739 GNUNET_break (0 == close (filedes[1])); 1754 GNUNET_break (0 == close (filedes[1]));
1740 c = 'X'; 1755 c = 'X';
1741 if (1 != read (filedes[0], &c, sizeof(char))) 1756 if (1 != read (filedes[0], &c, sizeof(char)))
1742 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "read"); 1757 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
1758 "read");
1743 fflush (stdout); 1759 fflush (stdout);
1744 switch (c) 1760 switch (c)
1745 { 1761 {
@@ -1780,7 +1796,8 @@ detach_terminal (struct GNUNET_SERVICE_Handle *sh)
1780 /* Detach from controlling terminal */ 1796 /* Detach from controlling terminal */
1781 pid = setsid (); 1797 pid = setsid ();
1782 if (-1 == pid) 1798 if (-1 == pid)
1783 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "setsid"); 1799 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR,
1800 "setsid");
1784 sh->ready_confirm_fd = filedes[1]; 1801 sh->ready_confirm_fd = filedes[1];
1785 1802
1786 return GNUNET_OK; 1803 return GNUNET_OK;
@@ -1804,7 +1821,9 @@ teardown_service (struct GNUNET_SERVICE_Handle *sh)
1804 GNUNET_free (sh->v6_allowed); 1821 GNUNET_free (sh->v6_allowed);
1805 while (NULL != (slc = sh->slc_head)) 1822 while (NULL != (slc = sh->slc_head))
1806 { 1823 {
1807 GNUNET_CONTAINER_DLL_remove (sh->slc_head, sh->slc_tail, slc); 1824 GNUNET_CONTAINER_DLL_remove (sh->slc_head,
1825 sh->slc_tail,
1826 slc);
1808 if (NULL != slc->listen_task) 1827 if (NULL != slc->listen_task)
1809 GNUNET_SCHEDULER_cancel (slc->listen_task); 1828 GNUNET_SCHEDULER_cancel (slc->listen_task);
1810 GNUNET_break (GNUNET_OK == 1829 GNUNET_break (GNUNET_OK ==
@@ -1821,7 +1840,8 @@ teardown_service (struct GNUNET_SERVICE_Handle *sh)
1821 * @param msg AGPL request 1840 * @param msg AGPL request
1822 */ 1841 */
1823static void 1842static void
1824return_agpl (void *cls, const struct GNUNET_MessageHeader *msg) 1843return_agpl (void *cls,
1844 const struct GNUNET_MessageHeader *msg)
1825{ 1845{
1826 struct GNUNET_SERVICE_Client *client = cls; 1846 struct GNUNET_SERVICE_Client *client = cls;
1827 struct GNUNET_MQ_Handle *mq; 1847 struct GNUNET_MQ_Handle *mq;
@@ -1832,50 +1852,17 @@ return_agpl (void *cls, const struct GNUNET_MessageHeader *msg)
1832 1852
1833 (void) msg; 1853 (void) msg;
1834 slen = strlen (pd->agpl_url) + 1; 1854 slen = strlen (pd->agpl_url) + 1;
1835 env = GNUNET_MQ_msg_extra (res, GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, slen); 1855 env = GNUNET_MQ_msg_extra (res,
1836 memcpy (&res[1], GNUNET_AGPL_URL, slen); 1856 GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, slen);
1857 memcpy (&res[1],
1858 GNUNET_AGPL_URL,
1859 slen);
1837 mq = GNUNET_SERVICE_client_get_mq (client); 1860 mq = GNUNET_SERVICE_client_get_mq (client);
1838 GNUNET_MQ_send (mq, env); 1861 GNUNET_MQ_send (mq, env);
1839 GNUNET_SERVICE_client_continue (client); 1862 GNUNET_SERVICE_client_continue (client);
1840} 1863}
1841 1864
1842 1865
1843/**
1844 * Low-level function to start a service if the scheduler
1845 * is already running. Should only be used directly in
1846 * special cases.
1847 *
1848 * The function will launch the service with the name @a service_name
1849 * using the @a service_options to configure its shutdown
1850 * behavior. When clients connect or disconnect, the respective
1851 * @a connect_cb or @a disconnect_cb functions will be called. For
1852 * messages received from the clients, the respective @a handlers will
1853 * be invoked; for the closure of the handlers we use the return value
1854 * from the @a connect_cb invocation of the respective client.
1855 *
1856 * Each handler MUST call #GNUNET_SERVICE_client_continue() after each
1857 * message to receive further messages from this client. If
1858 * #GNUNET_SERVICE_client_continue() is not called within a short
1859 * time, a warning will be logged. If delays are expected, services
1860 * should call #GNUNET_SERVICE_client_disable_continue_warning() to
1861 * disable the warning.
1862 *
1863 * Clients sending invalid messages (based on @a handlers) will be
1864 * dropped. Additionally, clients can be dropped at any time using
1865 * #GNUNET_SERVICE_client_drop().
1866 *
1867 * The service must be stopped using #GNUNET_SERVICE_stop().
1868 *
1869 * @param service_name name of the service to run
1870 * @param cfg configuration to use
1871 * @param connect_cb function to call whenever a client connects
1872 * @param disconnect_cb function to call whenever a client disconnects
1873 * @param cls closure argument for @a connect_cb and @a disconnect_cb
1874 * @param handlers NULL-terminated array of message handlers for the service,
1875 * the closure will be set to the value returned by
1876 * the @a connect_cb for the respective connection
1877 * @return NULL on error
1878 */
1879struct GNUNET_SERVICE_Handle * 1866struct GNUNET_SERVICE_Handle *
1880GNUNET_SERVICE_start (const char *service_name, 1867GNUNET_SERVICE_start (const char *service_name,
1881 const struct GNUNET_CONFIGURATION_Handle *cfg, 1868 const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -1892,23 +1879,61 @@ GNUNET_SERVICE_start (const char *service_name,
1892 sh->connect_cb = connect_cb; 1879 sh->connect_cb = connect_cb;
1893 sh->disconnect_cb = disconnect_cb; 1880 sh->disconnect_cb = disconnect_cb;
1894 sh->cb_cls = cls; 1881 sh->cb_cls = cls;
1895 sh->handlers = GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL); 1882 sh->handlers = GNUNET_MQ_copy_handlers2 (handlers,
1883 &return_agpl,
1884 NULL);
1896 if (GNUNET_OK != setup_service (sh)) 1885 if (GNUNET_OK != setup_service (sh))
1897 { 1886 {
1898 GNUNET_free (sh->handlers); 1887 GNUNET_free (sh->handlers);
1899 GNUNET_free (sh); 1888 GNUNET_free (sh);
1900 return NULL; 1889 return NULL;
1901 } 1890 }
1902 do_resume (sh, SUSPEND_STATE_NONE); 1891 do_resume (sh,
1892 SUSPEND_STATE_NONE);
1903 return sh; 1893 return sh;
1904} 1894}
1905 1895
1906 1896
1907/** 1897/**
1908 * Stops a service that was started with #GNUNET_SERVICE_start(). 1898 * Asynchronously finish dropping the client.
1909 * 1899 *
1910 * @param srv service to stop 1900 * @param cls the `struct GNUNET_SERVICE_Client`.
1911 */ 1901 */
1902static void
1903finish_client_drop (void *cls)
1904{
1905 struct GNUNET_SERVICE_Client *c = cls;
1906 struct GNUNET_SERVICE_Handle *sh = c->sh;
1907
1908 c->drop_task = NULL;
1909 GNUNET_CONTAINER_DLL_remove (sh->clients_head,
1910 sh->clients_tail,
1911 c);
1912 GNUNET_assert (NULL == c->send_task);
1913 GNUNET_assert (NULL == c->recv_task);
1914 GNUNET_assert (NULL == c->warn_task);
1915 GNUNET_MST_destroy (c->mst);
1916 GNUNET_MQ_destroy (c->mq);
1917 if (! c->persist)
1918 {
1919 GNUNET_break (GNUNET_OK ==
1920 GNUNET_NETWORK_socket_close (c->sock));
1921 if ((0 != (SUSPEND_STATE_EMFILE & sh->suspend_state)) &&
1922 (0 == (SUSPEND_STATE_SHUTDOWN & sh->suspend_state)))
1923 do_resume (sh,
1924 SUSPEND_STATE_EMFILE);
1925 }
1926 else
1927 {
1928 GNUNET_NETWORK_socket_free_memory_only_ (c->sock);
1929 }
1930 GNUNET_free (c);
1931 if ((0 != (SUSPEND_STATE_SHUTDOWN & sh->suspend_state)) &&
1932 (! have_non_monitor_clients (sh)))
1933 GNUNET_SERVICE_shutdown (sh);
1934}
1935
1936
1912void 1937void
1913GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv) 1938GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv)
1914{ 1939{
@@ -1916,7 +1941,12 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv)
1916 1941
1917 GNUNET_SERVICE_suspend (srv); 1942 GNUNET_SERVICE_suspend (srv);
1918 while (NULL != (client = srv->clients_head)) 1943 while (NULL != (client = srv->clients_head))
1919 GNUNET_SERVICE_client_drop (client); 1944 {
1945 if (NULL == client->drop_task)
1946 GNUNET_SERVICE_client_drop (client);
1947 GNUNET_SCHEDULER_cancel (client->drop_task);
1948 finish_client_drop (client);
1949 }
1920 teardown_service (srv); 1950 teardown_service (srv);
1921 GNUNET_free (srv->handlers); 1951 GNUNET_free (srv->handlers);
1922 GNUNET_free (srv); 1952 GNUNET_free (srv);
@@ -1988,7 +2018,6 @@ GNUNET_SERVICE_run_ (int argc,
1988 ? GNUNET_MQ_copy_handlers (handlers) 2018 ? GNUNET_MQ_copy_handlers (handlers)
1989 : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL); 2019 : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL);
1990 sh.service_name = service_name; 2020 sh.service_name = service_name;
1991 sh.ret = 0;
1992 /* setup subsystems */ 2021 /* setup subsystems */
1993 loglev = NULL; 2022 loglev = NULL;
1994 logfile = NULL; 2023 logfile = NULL;
@@ -2040,9 +2069,12 @@ GNUNET_SERVICE_run_ (int argc,
2040 } 2069 }
2041 else 2070 else
2042 { 2071 {
2043 if (GNUNET_YES == GNUNET_DISK_file_test (cfg_filename)) 2072 if (GNUNET_YES ==
2073 GNUNET_DISK_file_test (cfg_filename))
2044 { 2074 {
2045 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cfg_filename)) 2075 if (GNUNET_SYSERR ==
2076 GNUNET_CONFIGURATION_load (cfg,
2077 cfg_filename))
2046 { 2078 {
2047 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2079 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2048 _ ("Malformed configuration file `%s', exit ...\n"), 2080 _ ("Malformed configuration file `%s', exit ...\n"),
@@ -2052,7 +2084,9 @@ GNUNET_SERVICE_run_ (int argc,
2052 } 2084 }
2053 else 2085 else
2054 { 2086 {
2055 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, NULL)) 2087 if (GNUNET_SYSERR ==
2088 GNUNET_CONFIGURATION_load (cfg,
2089 NULL))
2056 { 2090 {
2057 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2091 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2058 _ ("Malformed configuration, exit ...\n")); 2092 _ ("Malformed configuration, exit ...\n"));
@@ -2062,7 +2096,8 @@ GNUNET_SERVICE_run_ (int argc,
2062 } 2096 }
2063 if (GNUNET_OK != setup_service (&sh)) 2097 if (GNUNET_OK != setup_service (&sh))
2064 goto shutdown; 2098 goto shutdown;
2065 if ((1 == do_daemonize) && (GNUNET_OK != detach_terminal (&sh))) 2099 if ( (1 == do_daemonize) &&
2100 (GNUNET_OK != detach_terminal (&sh)) )
2066 { 2101 {
2067 GNUNET_break (0); 2102 GNUNET_break (0);
2068 goto shutdown; 2103 goto shutdown;
@@ -2073,14 +2108,16 @@ GNUNET_SERVICE_run_ (int argc,
2073 "Service `%s' runs with configuration from `%s'\n", 2108 "Service `%s' runs with configuration from `%s'\n",
2074 service_name, 2109 service_name,
2075 (NULL != opt_cfg_filename) ? opt_cfg_filename : cfg_filename); 2110 (NULL != opt_cfg_filename) ? opt_cfg_filename : cfg_filename);
2076 if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (sh.cfg, 2111 if ( (GNUNET_OK ==
2077 "TESTING", 2112 GNUNET_CONFIGURATION_get_value_number (sh.cfg,
2078 "SKEW_OFFSET", 2113 "TESTING",
2079 &skew_offset)) && 2114 "SKEW_OFFSET",
2080 (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (sh.cfg, 2115 &skew_offset)) &&
2081 "TESTING", 2116 (GNUNET_OK ==
2082 "SKEW_VARIANCE", 2117 GNUNET_CONFIGURATION_get_value_number (sh.cfg,
2083 &skew_variance))) 2118 "TESTING",
2119 "SKEW_VARIANCE",
2120 &skew_variance)) )
2084 { 2121 {
2085 clock_offset = skew_offset - skew_variance; 2122 clock_offset = skew_offset - skew_variance;
2086 GNUNET_TIME_set_offset (clock_offset); 2123 GNUNET_TIME_set_offset (clock_offset);
@@ -2108,18 +2145,23 @@ shutdown:
2108 { 2145 {
2109 char *counter; 2146 char *counter;
2110 2147
2111 if ((GNUNET_YES == GNUNET_CONFIGURATION_have_value (sh.cfg, 2148 if ( (GNUNET_YES ==
2112 service_name, 2149 GNUNET_CONFIGURATION_have_value (sh.cfg,
2113 "GAUGER_HEAP")) && 2150 service_name,
2114 (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (sh.cfg, 2151 "GAUGER_HEAP")) &&
2115 service_name, 2152 (GNUNET_OK ==
2116 "GAUGER_HEAP", 2153 GNUNET_CONFIGURATION_get_value_string (sh.cfg,
2117 &counter))) 2154 service_name,
2155 "GAUGER_HEAP",
2156 &counter)))
2118 { 2157 {
2119 struct mallinfo2 mi; 2158 struct mallinfo2 mi;
2120 2159
2121 mi = mallinfo2 (); 2160 mi = mallinfo2 ();
2122 GAUGER (service_name, counter, mi.usmblks, "blocks"); 2161 GAUGER (service_name,
2162 counter,
2163 mi.usmblks,
2164 "blocks");
2123 GNUNET_free (counter); 2165 GNUNET_free (counter);
2124 } 2166 }
2125 } 2167 }
@@ -2133,11 +2175,12 @@ shutdown:
2133 GNUNET_free (cfg_filename); 2175 GNUNET_free (cfg_filename);
2134 GNUNET_free (opt_cfg_filename); 2176 GNUNET_free (opt_cfg_filename);
2135 2177
2136 return err ? GNUNET_SYSERR : sh.ret; 2178 return err ? GNUNET_SYSERR : 0;
2137} 2179}
2138 2180
2139 2181
2140/* A list of service to be launched when GNUNET_SERVICE_main() 2182/**
2183 * A list of service to be launched when GNUNET_SERVICE_main()
2141 * is called 2184 * is called
2142 */ 2185 */
2143struct ServiceHandleList 2186struct ServiceHandleList
@@ -2153,10 +2196,11 @@ struct ServiceHandleList
2153}; 2196};
2154 2197
2155/* The service list */ 2198/* The service list */
2156static struct ServiceHandleList *hll_head = NULL; 2199static struct ServiceHandleList *hll_head;
2157 2200
2158/* The service list */ 2201/* The service list */
2159static struct ServiceHandleList *hll_tail = NULL; 2202static struct ServiceHandleList *hll_tail;
2203
2160 2204
2161int 2205int
2162GNUNET_SERVICE_register_ (const char *service_name, 2206GNUNET_SERVICE_register_ (const char *service_name,
@@ -2181,30 +2225,34 @@ GNUNET_SERVICE_register_ (const char *service_name,
2181 ? GNUNET_MQ_copy_handlers (handlers) 2225 ? GNUNET_MQ_copy_handlers (handlers)
2182 : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL); 2226 : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL);
2183 sh->service_name = service_name; 2227 sh->service_name = service_name;
2184 sh->ret = 0;
2185 hle = GNUNET_new (struct ServiceHandleList); 2228 hle = GNUNET_new (struct ServiceHandleList);
2186 hle->sh = sh; 2229 hle->sh = sh;
2187 GNUNET_CONTAINER_DLL_insert (hll_head, hll_tail, hle); 2230 GNUNET_CONTAINER_DLL_insert (hll_head,
2188 return GNUNET_OK; 2231 hll_tail,
2232 hle);
2233 return 0;
2189} 2234}
2190 2235
2191 2236
2192static void 2237static void
2193do_registered_services_shutdown (void *cls) 2238do_registered_services_shutdown (void *cls)
2194{ 2239{
2195 struct GNUNET_SERVICE_Handle *sh; 2240 while (NULL != hll_head)
2196 struct ServiceHandleList *shl;
2197
2198 for (shl = hll_head; NULL != shl;)
2199 { 2241 {
2200 sh = shl->sh; 2242 struct ServiceHandleList *shl = hll_head;
2201 GNUNET_CONTAINER_DLL_remove (hll_head, hll_tail, shl); 2243 struct GNUNET_SERVICE_Handle *sh = shl->sh;
2244
2245 GNUNET_CONTAINER_DLL_remove (hll_head,
2246 hll_tail,
2247 shl);
2202 GNUNET_free (shl); 2248 GNUNET_free (shl);
2203 if (-1 != sh->ready_confirm_fd) 2249 if (-1 != sh->ready_confirm_fd)
2204 { 2250 {
2205 if (1 != write (sh->ready_confirm_fd, "S", 1)) 2251 if (1 != write (sh->ready_confirm_fd, "S", 1))
2206 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING, "write"); 2252 LOG_STRERROR (GNUNET_ERROR_TYPE_WARNING,
2207 GNUNET_break (0 == close (sh->ready_confirm_fd)); 2253 "write");
2254 GNUNET_break (0 ==
2255 close (sh->ready_confirm_fd));
2208 } 2256 }
2209 teardown_service (sh); 2257 teardown_service (sh);
2210 GNUNET_free (sh->handlers); 2258 GNUNET_free (sh->handlers);
@@ -2216,20 +2264,22 @@ do_registered_services_shutdown (void *cls)
2216static void 2264static void
2217launch_registered_services (void *cls) 2265launch_registered_services (void *cls)
2218{ 2266{
2219 struct ServiceHandleList *shl;
2220 struct GNUNET_CONFIGURATION_Handle *cfg = cls; 2267 struct GNUNET_CONFIGURATION_Handle *cfg = cls;
2221 2268
2222 for (shl = hll_head; NULL != shl; shl = shl->next) 2269 for (struct ServiceHandleList *shl = hll_head;
2270 NULL != shl;
2271 shl = shl->next)
2223 { 2272 {
2224 shl->sh->cfg = cfg; 2273 shl->sh->cfg = cfg;
2225 if (GNUNET_OK != setup_service (shl->sh)) 2274 if (GNUNET_OK != setup_service (shl->sh))
2226 continue; 2275 continue;
2227 if (GNUNET_OK != set_user_id (shl->sh)) 2276 if (GNUNET_OK != set_user_id (shl->sh))
2228 continue; 2277 continue;
2229 2278 GNUNET_SCHEDULER_add_now (&service_main,
2230 GNUNET_SCHEDULER_add_now (&service_main, shl->sh); 2279 shl->sh);
2231 } 2280 }
2232 GNUNET_SCHEDULER_add_shutdown (&do_registered_services_shutdown, NULL); 2281 GNUNET_SCHEDULER_add_shutdown (&do_registered_services_shutdown,
2282 NULL);
2233} 2283}
2234 2284
2235 2285
@@ -2246,7 +2296,6 @@ GNUNET_SERVICE_main (int argc,
2246 int ret; 2296 int ret;
2247 struct GNUNET_CONFIGURATION_Handle *cfg; 2297 struct GNUNET_CONFIGURATION_Handle *cfg;
2248 const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get (); 2298 const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
2249
2250 struct GNUNET_GETOPT_CommandLineOption service_options[] = { 2299 struct GNUNET_GETOPT_CommandLineOption service_options[] = {
2251 GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename), 2300 GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename),
2252 GNUNET_GETOPT_option_flag ('d', 2301 GNUNET_GETOPT_option_flag ('d',
@@ -2260,6 +2309,7 @@ GNUNET_SERVICE_main (int argc,
2260 GNUNET_GETOPT_option_version (pd->version), 2309 GNUNET_GETOPT_option_version (pd->version),
2261 GNUNET_GETOPT_OPTION_END 2310 GNUNET_GETOPT_OPTION_END
2262 }; 2311 };
2312
2263 xdg = getenv ("XDG_CONFIG_HOME"); 2313 xdg = getenv ("XDG_CONFIG_HOME");
2264 if (NULL != xdg) 2314 if (NULL != xdg)
2265 GNUNET_asprintf (&cfg_filename, 2315 GNUNET_asprintf (&cfg_filename,
@@ -2282,17 +2332,22 @@ GNUNET_SERVICE_main (int argc,
2282 goto shutdown; 2332 goto shutdown;
2283 } 2333 }
2284 // FIXME we need to set this up for each service! 2334 // FIXME we need to set this up for each service!
2285 if (GNUNET_OK != GNUNET_log_setup ("libgnunet", 2335 // NOTE: that was not the idea. What are you proposing? -CG
2286 loglev, 2336 if (GNUNET_OK !=
2287 logfile)) 2337 GNUNET_log_setup ("libgnunet",
2338 loglev,
2339 logfile))
2288 { 2340 {
2289 GNUNET_break (0); 2341 GNUNET_break (0);
2290 goto shutdown; 2342 goto shutdown;
2291 } 2343 }
2292 if (NULL != opt_cfg_filename) 2344 if (NULL != opt_cfg_filename)
2293 { 2345 {
2294 if ((GNUNET_YES != GNUNET_DISK_file_test (opt_cfg_filename)) || 2346 if ( (GNUNET_YES !=
2295 (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, opt_cfg_filename))) 2347 GNUNET_DISK_file_test (opt_cfg_filename)) ||
2348 (GNUNET_SYSERR ==
2349 GNUNET_CONFIGURATION_load (cfg,
2350 opt_cfg_filename)) )
2296 { 2351 {
2297 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2352 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2298 _ ("Malformed configuration file `%s', exit ...\n"), 2353 _ ("Malformed configuration file `%s', exit ...\n"),
@@ -2302,9 +2357,12 @@ GNUNET_SERVICE_main (int argc,
2302 } 2357 }
2303 else 2358 else
2304 { 2359 {
2305 if (GNUNET_YES == GNUNET_DISK_file_test (cfg_filename)) 2360 if (GNUNET_YES ==
2361 GNUNET_DISK_file_test (cfg_filename))
2306 { 2362 {
2307 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, cfg_filename)) 2363 if (GNUNET_SYSERR ==
2364 GNUNET_CONFIGURATION_load (cfg,
2365 cfg_filename))
2308 { 2366 {
2309 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2367 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2310 _ ("Malformed configuration file `%s', exit ...\n"), 2368 _ ("Malformed configuration file `%s', exit ...\n"),
@@ -2315,7 +2373,9 @@ GNUNET_SERVICE_main (int argc,
2315 } 2373 }
2316 else 2374 else
2317 { 2375 {
2318 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, NULL)) 2376 if (GNUNET_SYSERR ==
2377 GNUNET_CONFIGURATION_load (cfg,
2378 NULL))
2319 { 2379 {
2320 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2380 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2321 _ ("Malformed configuration, exit ...\n")); 2381 _ ("Malformed configuration, exit ...\n"));
@@ -2326,7 +2386,8 @@ GNUNET_SERVICE_main (int argc,
2326 } 2386 }
2327 GNUNET_RESOLVER_connect (cfg); 2387 GNUNET_RESOLVER_connect (cfg);
2328 2388
2329 GNUNET_SCHEDULER_run (&launch_registered_services, cfg); 2389 GNUNET_SCHEDULER_run (&launch_registered_services,
2390 cfg);
2330shutdown: 2391shutdown:
2331 GNUNET_SPEEDUP_stop_ (); 2392 GNUNET_SPEEDUP_stop_ ();
2332 GNUNET_CONFIGURATION_destroy (cfg); 2393 GNUNET_CONFIGURATION_destroy (cfg);
@@ -2337,28 +2398,19 @@ shutdown:
2337} 2398}
2338 2399
2339 2400
2340/**
2341 * Suspend accepting connections from the listen socket temporarily.
2342 * Resume activity using #GNUNET_SERVICE_resume.
2343 *
2344 * @param sh service to stop accepting connections.
2345 */
2346void 2401void
2347GNUNET_SERVICE_suspend (struct GNUNET_SERVICE_Handle *sh) 2402GNUNET_SERVICE_suspend (struct GNUNET_SERVICE_Handle *sh)
2348{ 2403{
2349 do_suspend (sh, SUSPEND_STATE_APP); 2404 do_suspend (sh,
2405 SUSPEND_STATE_APP);
2350} 2406}
2351 2407
2352 2408
2353/**
2354 * Resume accepting connections from the listen socket.
2355 *
2356 * @param sh service to resume accepting connections.
2357 */
2358void 2409void
2359GNUNET_SERVICE_resume (struct GNUNET_SERVICE_Handle *sh) 2410GNUNET_SERVICE_resume (struct GNUNET_SERVICE_Handle *sh)
2360{ 2411{
2361 do_resume (sh, SUSPEND_STATE_APP); 2412 do_resume (sh,
2413 SUSPEND_STATE_APP);
2362} 2414}
2363 2415
2364 2416
@@ -2376,7 +2428,8 @@ resume_client_receive (void *cls)
2376 2428
2377 c->recv_task = NULL; 2429 c->recv_task = NULL;
2378 /* first, check if there is still something in the buffer */ 2430 /* first, check if there is still something in the buffer */
2379 ret = GNUNET_MST_next (c->mst, GNUNET_YES); 2431 ret = GNUNET_MST_next (c->mst,
2432 GNUNET_YES);
2380 if (GNUNET_SYSERR == ret) 2433 if (GNUNET_SYSERR == ret)
2381 { 2434 {
2382 if (NULL == c->drop_task) 2435 if (NULL == c->drop_task)
@@ -2386,7 +2439,7 @@ resume_client_receive (void *cls)
2386 if (GNUNET_NO == ret) 2439 if (GNUNET_NO == ret)
2387 return; /* done processing, wait for more later */ 2440 return; /* done processing, wait for more later */
2388 GNUNET_assert (GNUNET_OK == ret); 2441 GNUNET_assert (GNUNET_OK == ret);
2389 if (GNUNET_YES == c->needs_continue) 2442 if (c->needs_continue)
2390 return; /* #GNUNET_MST_next() did give a message to the client */ 2443 return; /* #GNUNET_MST_next() did give a message to the client */
2391 /* need to receive more data from the network first */ 2444 /* need to receive more data from the network first */
2392 if (NULL != c->recv_task) 2445 if (NULL != c->recv_task)
@@ -2398,36 +2451,23 @@ resume_client_receive (void *cls)
2398} 2451}
2399 2452
2400 2453
2401/**
2402 * Continue receiving further messages from the given client.
2403 * Must be called after each message received.
2404 *
2405 * @param c the client to continue receiving from
2406 */
2407void 2454void
2408GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c) 2455GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c)
2409{ 2456{
2410 GNUNET_assert (NULL == c->drop_task); 2457 GNUNET_assert (NULL == c->drop_task);
2411 GNUNET_assert (GNUNET_YES == c->needs_continue); 2458 GNUNET_assert (c->needs_continue);
2412 GNUNET_assert (NULL == c->recv_task); 2459 GNUNET_assert (NULL == c->recv_task);
2413 c->needs_continue = GNUNET_NO; 2460 c->needs_continue = false;
2414 if (NULL != c->warn_task) 2461 if (NULL != c->warn_task)
2415 { 2462 {
2416 GNUNET_SCHEDULER_cancel (c->warn_task); 2463 GNUNET_SCHEDULER_cancel (c->warn_task);
2417 c->warn_task = NULL; 2464 c->warn_task = NULL;
2418 } 2465 }
2419 c->recv_task = GNUNET_SCHEDULER_add_now (&resume_client_receive, c); 2466 c->recv_task = GNUNET_SCHEDULER_add_now (&resume_client_receive,
2467 c);
2420} 2468}
2421 2469
2422 2470
2423/**
2424 * Disable the warning the server issues if a message is not
2425 * acknowledged in a timely fashion. Use this call if a client is
2426 * intentionally delayed for a while. Only applies to the current
2427 * message.
2428 *
2429 * @param c client for which to disable the warning
2430 */
2431void 2471void
2432GNUNET_SERVICE_client_disable_continue_warning (struct GNUNET_SERVICE_Client *c) 2472GNUNET_SERVICE_client_disable_continue_warning (struct GNUNET_SERVICE_Client *c)
2433{ 2473{
@@ -2440,51 +2480,6 @@ GNUNET_SERVICE_client_disable_continue_warning (struct GNUNET_SERVICE_Client *c)
2440} 2480}
2441 2481
2442 2482
2443/**
2444 * Asynchronously finish dropping the client.
2445 *
2446 * @param cls the `struct GNUNET_SERVICE_Client`.
2447 */
2448static void
2449finish_client_drop (void *cls)
2450{
2451 struct GNUNET_SERVICE_Client *c = cls;
2452 struct GNUNET_SERVICE_Handle *sh = c->sh;
2453
2454 c->drop_task = NULL;
2455 GNUNET_assert (NULL == c->send_task);
2456 GNUNET_assert (NULL == c->recv_task);
2457 GNUNET_assert (NULL == c->warn_task);
2458 GNUNET_MST_destroy (c->mst);
2459 GNUNET_MQ_destroy (c->mq);
2460 if (GNUNET_NO == c->persist)
2461 {
2462 GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (c->sock));
2463 if ((0 != (SUSPEND_STATE_EMFILE & sh->suspend_state)) &&
2464 (0 == (SUSPEND_STATE_SHUTDOWN & sh->suspend_state)))
2465 do_resume (sh, SUSPEND_STATE_EMFILE);
2466 }
2467 else
2468 {
2469 GNUNET_NETWORK_socket_free_memory_only_ (c->sock);
2470 }
2471 GNUNET_free (c);
2472 if ((0 != (SUSPEND_STATE_SHUTDOWN & sh->suspend_state)) &&
2473 (GNUNET_NO == have_non_monitor_clients (sh)))
2474 GNUNET_SERVICE_shutdown (sh);
2475}
2476
2477
2478/**
2479 * Ask the server to disconnect from the given client. This is the
2480 * same as returning #GNUNET_SYSERR within the check procedure when
2481 * handling a message, wexcept that it allows dropping of a client even
2482 * when not handling a message from that client. The `disconnect_cb`
2483 * will be called on @a c even if the application closes the connection
2484 * using this function.
2485 *
2486 * @param c client to disconnect now
2487 */
2488void 2483void
2489GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c) 2484GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c)
2490{ 2485{
@@ -2497,9 +2492,11 @@ GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c)
2497#if EXECINFO 2492#if EXECINFO
2498 { 2493 {
2499 void *backtrace_array[MAX_TRACE_DEPTH]; 2494 void *backtrace_array[MAX_TRACE_DEPTH];
2500 int num_backtrace_strings = backtrace (backtrace_array, MAX_TRACE_DEPTH); 2495 int num_backtrace_strings = backtrace (backtrace_array,
2496 MAX_TRACE_DEPTH);
2501 char **backtrace_strings = 2497 char **backtrace_strings =
2502 backtrace_symbols (backtrace_array, t->num_backtrace_strings); 2498 backtrace_symbols (backtrace_array,
2499 t->num_backtrace_strings);
2503 for (unsigned int i = 0; i < num_backtrace_strings; i++) 2500 for (unsigned int i = 0; i < num_backtrace_strings; i++)
2504 LOG (GNUNET_ERROR_TYPE_DEBUG, 2501 LOG (GNUNET_ERROR_TYPE_DEBUG,
2505 "client drop trace %u: %s\n", 2502 "client drop trace %u: %s\n",
@@ -2507,15 +2504,7 @@ GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c)
2507 backtrace_strings[i]); 2504 backtrace_strings[i]);
2508 } 2505 }
2509#endif 2506#endif
2510 if (NULL != c->drop_task) 2507 GNUNET_assert (NULL == c->drop_task);
2511 {
2512 /* asked to drop twice! */
2513 GNUNET_assert (0);
2514 return;
2515 }
2516 GNUNET_CONTAINER_DLL_remove (sh->clients_head,
2517 sh->clients_tail,
2518 c);
2519 if (NULL != sh->disconnect_cb) 2508 if (NULL != sh->disconnect_cb)
2520 sh->disconnect_cb (sh->cb_cls, 2509 sh->disconnect_cb (sh->cb_cls,
2521 c, 2510 c,
@@ -2535,69 +2524,44 @@ GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c)
2535 GNUNET_SCHEDULER_cancel (c->send_task); 2524 GNUNET_SCHEDULER_cancel (c->send_task);
2536 c->send_task = NULL; 2525 c->send_task = NULL;
2537 } 2526 }
2538 c->drop_task = GNUNET_SCHEDULER_add_now (&finish_client_drop, c); 2527 c->drop_task = GNUNET_SCHEDULER_add_now (&finish_client_drop,
2528 c);
2539} 2529}
2540 2530
2541 2531
2542/**
2543 * Explicitly stops the service.
2544 *
2545 * @param sh server to shutdown
2546 */
2547void 2532void
2548GNUNET_SERVICE_shutdown (struct GNUNET_SERVICE_Handle *sh) 2533GNUNET_SERVICE_shutdown (struct GNUNET_SERVICE_Handle *sh)
2549{ 2534{
2550 struct GNUNET_SERVICE_Client *client;
2551
2552 if (0 == (sh->suspend_state & SUSPEND_STATE_SHUTDOWN)) 2535 if (0 == (sh->suspend_state & SUSPEND_STATE_SHUTDOWN))
2553 do_suspend (sh, SUSPEND_STATE_SHUTDOWN); 2536 do_suspend (sh,
2554 while (NULL != (client = sh->clients_head)) 2537 SUSPEND_STATE_SHUTDOWN);
2555 GNUNET_SERVICE_client_drop (client); 2538 for (struct GNUNET_SERVICE_Client *client = sh->clients_head;
2539 NULL != client;
2540 client = client->next)
2541 {
2542 if (NULL == client->drop_task)
2543 GNUNET_SERVICE_client_drop (client);
2544 }
2556} 2545}
2557 2546
2558 2547
2559/**
2560 * Set the 'monitor' flag on this client. Clients which have been
2561 * marked as 'monitors' won't prevent the server from shutting down
2562 * once #GNUNET_SERVICE_stop_listening() has been invoked. The idea is
2563 * that for "normal" clients we likely want to allow them to process
2564 * their requests; however, monitor-clients are likely to 'never'
2565 * disconnect during shutdown and thus will not be considered when
2566 * determining if the server should continue to exist after
2567 * shutdown has been triggered.
2568 *
2569 * @param c client to mark as a monitor
2570 */
2571void 2548void
2572GNUNET_SERVICE_client_mark_monitor (struct GNUNET_SERVICE_Client *c) 2549GNUNET_SERVICE_client_mark_monitor (struct GNUNET_SERVICE_Client *c)
2573{ 2550{
2574 c->is_monitor = GNUNET_YES; 2551 c->is_monitor = true;
2575 if (((0 != (SUSPEND_STATE_SHUTDOWN & c->sh->suspend_state)) && 2552 if (((0 != (SUSPEND_STATE_SHUTDOWN & c->sh->suspend_state)) &&
2576 (GNUNET_NO == have_non_monitor_clients (c->sh)))) 2553 (! have_non_monitor_clients (c->sh))))
2577 GNUNET_SERVICE_shutdown (c->sh); 2554 GNUNET_SERVICE_shutdown (c->sh);
2578} 2555}
2579 2556
2580 2557
2581/**
2582 * Set the persist option on this client. Indicates that the
2583 * underlying socket or fd should never really be closed. Used for
2584 * indicating process death.
2585 *
2586 * @param c client to persist the socket (never to be closed)
2587 */
2588void 2558void
2589GNUNET_SERVICE_client_persist (struct GNUNET_SERVICE_Client *c) 2559GNUNET_SERVICE_client_persist (struct GNUNET_SERVICE_Client *c)
2590{ 2560{
2591 c->persist = GNUNET_YES; 2561 c->persist = true;
2592} 2562}
2593 2563
2594 2564
2595/**
2596 * Obtain the message queue of @a c. Convenience function.
2597 *
2598 * @param c the client to continue receiving from
2599 * @return the message queue of @a c
2600 */
2601struct GNUNET_MQ_Handle * 2565struct GNUNET_MQ_Handle *
2602GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c) 2566GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c)
2603{ 2567{
diff --git a/src/lib/util/strings.c b/src/lib/util/strings.c
index fe7a030dd..dc9fd0daf 100644
--- a/src/lib/util/strings.c
+++ b/src/lib/util/strings.c
@@ -37,7 +37,7 @@
37#define LOG(kind, ...) GNUNET_log_from (kind, "util-strings", __VA_ARGS__) 37#define LOG(kind, ...) GNUNET_log_from (kind, "util-strings", __VA_ARGS__)
38 38
39#define LOG_STRERROR(kind, syscall) \ 39#define LOG_STRERROR(kind, syscall) \
40 GNUNET_log_from_strerror (kind, "util-strings", syscall) 40 GNUNET_log_from_strerror (kind, "util-strings", syscall)
41 41
42 42
43size_t 43size_t
@@ -1699,7 +1699,7 @@ GNUNET_STRINGS_base64url_encode (const void *in,
1699 1699
1700 1700
1701#define cvtfind(a) \ 1701#define cvtfind(a) \
1702 ((((a) >= 'A') && ((a) <= 'Z')) \ 1702 ((((a) >= 'A') && ((a) <= 'Z')) \
1703 ? (a) - 'A' \ 1703 ? (a) - 'A' \
1704 : (((a) >= 'a') && ((a) <= 'z')) \ 1704 : (((a) >= 'a') && ((a) <= 'z')) \
1705 ? (a) - 'a' + 26 \ 1705 ? (a) - 'a' + 26 \
@@ -1709,15 +1709,15 @@ GNUNET_STRINGS_base64url_encode (const void *in,
1709 1709
1710 1710
1711#define CHECK_CRLF \ 1711#define CHECK_CRLF \
1712 while ( (data[i] == '\r') || (data[i] == '\n') ) \ 1712 while ( (data[i] == '\r') || (data[i] == '\n') ) \
1713 { \ 1713 { \
1714 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, \ 1714 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, \
1715 "ignoring CR/LF\n"); \ 1715 "ignoring CR/LF\n"); \
1716 i++; \ 1716 i++; \
1717 if (i >= len) { \ 1717 if (i >= len) { \
1718 goto END; \ 1718 goto END; \
1719 } \ 1719 } \
1720 } 1720 }
1721 1721
1722 1722
1723size_t 1723size_t
@@ -1853,7 +1853,15 @@ GNUNET_STRINGS_urldecode (const char *data,
1853 if (1 != sscanf (rpos + 1, 1853 if (1 != sscanf (rpos + 1,
1854 "%2x", 1854 "%2x",
1855 &num)) 1855 &num))
1856 {
1857 /* Invalid URL encoding, try to continue anyway */
1858 GNUNET_break_op (0);
1859 *wpos = *rpos;
1860 wpos++;
1861 resl++;
1862 rpos++;
1856 break; 1863 break;
1864 }
1857 *wpos = (char) ((unsigned char) num); 1865 *wpos = (char) ((unsigned char) num);
1858 wpos++; 1866 wpos++;
1859 resl++; 1867 resl++;
diff --git a/src/lib/util/test_crypto_blind.c b/src/lib/util/test_crypto_blind.c
index d7efd79ea..1b256fca3 100644
--- a/src/lib/util/test_crypto_blind.c
+++ b/src/lib/util/test_crypto_blind.c
@@ -77,6 +77,7 @@ main (int argc,
77 sig, 77 sig,
78 "hello", 78 "hello",
79 5)); 79 5));
80 GNUNET_CRYPTO_blinding_input_values_decref (biv);
80 GNUNET_CRYPTO_blinded_sig_decref (bsig); 81 GNUNET_CRYPTO_blinded_sig_decref (bsig);
81 GNUNET_CRYPTO_unblinded_sig_decref (sig); 82 GNUNET_CRYPTO_unblinded_sig_decref (sig);
82 GNUNET_CRYPTO_blinded_message_decref (bm); 83 GNUNET_CRYPTO_blinded_message_decref (bm);
diff --git a/src/lib/util/test_crypto_elligator.c b/src/lib/util/test_crypto_elligator.c
index 488a296d6..2e178b7b1 100644
--- a/src/lib/util/test_crypto_elligator.c
+++ b/src/lib/util/test_crypto_elligator.c
@@ -7,36 +7,38 @@
7 7
8 8
9// Test vector from https://github.com/Kleshni/Elligator-2/blob/master/test-vectors.c 9// Test vector from https://github.com/Kleshni/Elligator-2/blob/master/test-vectors.c
10// Using Decoding as a wrapper around direct_map
10static int 11static int
11testDirectMap (void) 12testDirectMap (void)
12{ 13{
13 int ok = GNUNET_OK; 14 int ok = GNUNET_OK;
14 15
15 uint8_t repr1[32] = { 16 uint8_t repr1[32] = {
16 0x17, 0x9f, 0x24, 0x73, 0x0d, 0xed, 0x2c, 0xe3, 0x17, 0x39, 0x08, 0xec, 17 0x95, 0xa1, 0x60, 0x19, 0x04, 0x1d, 0xbe, 0xfe,
17 0x61, 0x96, 0x46, 0x53, 18 0xd9, 0x83, 0x20, 0x48, 0xed, 0xe1, 0x19, 0x28,
18 0xb8, 0x02, 0x7e, 0x38, 0x3f, 0x40, 0x34, 0x6c, 0x1c, 0x9b, 0x4d, 0x2b, 19 0xd9, 0x03, 0x65, 0xf2, 0x4a, 0x38, 0xaa, 0x7a,
19 0xdb, 0x1d, 0xb7, 0x6c 20 0xef, 0x1b, 0x97, 0xe2, 0x39, 0x54, 0x10, 0x1b
20 }; 21 };
21 22
22 uint8_t point1[32] = { 23 uint8_t point1[32] = {
23 0x10, 0x74, 0x54, 0x97, 0xd3, 0x5c, 0x6e, 0xde, 0x6e, 0xa6, 0xb3, 0x30, 24 0x79, 0x4f, 0x05, 0xba, 0x3e, 0x3a, 0x72, 0x95,
24 0x54, 0x6a, 0x6f, 0xcb, 25 0x80, 0x22, 0x46, 0x8c, 0x88, 0x98, 0x1e, 0x0b,
25 0xf1, 0x5c, 0x90, 0x3a, 0x7b, 0xe2, 0x8a, 0xe6, 0x9b, 0x1c, 0xa1, 0x4e, 26 0xe5, 0x78, 0x2b, 0xe1, 0xe1, 0x14, 0x5c, 0xe2,
26 0x0b, 0xf0, 0x9b, 0x60 27 0xc3, 0xc6, 0xfd, 0xe1, 0x6d, 0xed, 0x53, 0x63
27 }; 28 };
28 29
29 uint8_t pointResult[32]; 30 struct GNUNET_CRYPTO_EcdhePublicKey pointResult = {0};
31 struct GNUNET_CRYPTO_ElligatorRepresentative representative = {0};
32 memcpy (&representative.r, &repr1, sizeof(repr1));
33
30 bool highYResult; 34 bool highYResult;
31 bool isLeastSqrRoot = GNUNET_CRYPTO_ecdhe_elligator_direct_map (pointResult,
32 &highYResult,
33 repr1);
34 35
35 if (isLeastSqrRoot == false) 36 GNUNET_CRYPTO_ecdhe_elligator_decoding (
36 { 37 &pointResult,
37 ok = GNUNET_OK; 38 &highYResult,
38 } 39 &representative);
39 if (memcmp (point1,pointResult,sizeof(point1)) != 0) 40
41 if (memcmp (point1, pointResult.q_y, sizeof(point1)) != 0)
40 { 42 {
41 ok = GNUNET_SYSERR; 43 ok = GNUNET_SYSERR;
42 } 44 }
@@ -51,29 +53,33 @@ testInverseMap (void)
51{ 53{
52 int ok = GNUNET_OK; 54 int ok = GNUNET_OK;
53 uint8_t point1[32] = { 55 uint8_t point1[32] = {
54 0x33, 0x95, 0x19, 0x64, 0x00, 0x3c, 0x94, 0x08, 0x78, 0x06, 0x3c, 0xcf, 56 0x33, 0x95, 0x19, 0x64, 0x00, 0x3c, 0x94, 0x08,
55 0xd0, 0x34, 0x8a, 0xf4, 57 0x78, 0x06, 0x3c, 0xcf, 0xd0, 0x34, 0x8a, 0xf4,
56 0x21, 0x50, 0xca, 0x16, 0xd2, 0x64,0x6f, 0x2c, 0x58, 0x56, 0xe8, 0x33, 0x83, 58 0x21, 0x50, 0xca, 0x16, 0xd2, 0x64, 0x6f, 0x2c,
57 0x77, 0xd8, 0x00 59 0x58, 0x56, 0xe8, 0x33, 0x83, 0x77, 0xd8, 0x00
58 }; 60 };
59 61
60 uint8_t repr1[32] = { 62 uint8_t repr1[32] = {
61 0x99, 0x9b, 0x59, 0x1b, 0x66, 0x97, 0xd0, 0x74, 0xf2, 0x66, 0x19, 0x22,0x77, 63 0x99, 0x9b, 0x59, 0x1b, 0x66, 0x97, 0xd0, 0x74,
62 0xd5, 0x54, 0xde, 64 0xf2, 0x66, 0x19, 0x22, 0x77, 0xd5, 0x54, 0xde,
63 0xc3, 0xc2, 0x4c, 0x2e,0xf6, 0x10, 0x81, 0x01, 0xf6, 0x3d, 0x94, 0xf7, 0xff, 65 0xc3, 0xc2, 0x4c, 0x2e, 0xf6, 0x10, 0x81, 0x01,
64 0xf3, 0xa0, 0x13 66 0xf6, 0x3d, 0x94, 0xf7, 0xff, 0xf3, 0xa0, 0x13
65 }; 67 };
66 68
67 uint8_t reprResult1[32]; 69 // uint8_t reprResult1[32];
70 struct GNUNET_CRYPTO_ElligatorRepresentative r = {0};
71 struct GNUNET_CRYPTO_EcdhePublicKey pub = {0};
72 memcpy (&pub.q_y,&point1,sizeof(point1));
68 bool yHigh1 = false; 73 bool yHigh1 = false;
69 bool success = GNUNET_CRYPTO_ecdhe_elligator_inverse_map (reprResult1, 74
70 point1, 75 bool success = GNUNET_CRYPTO_ecdhe_elligator_encoding (&r,
71 yHigh1); 76 &pub,
77 yHigh1);
72 if (success == false) 78 if (success == false)
73 { 79 {
74 ok = GNUNET_SYSERR; 80 ok = GNUNET_SYSERR;
75 } 81 }
76 if (memcmp (repr1,reprResult1,sizeof(repr1)) != 0) 82 if (memcmp (&repr1,&r.r,sizeof(repr1)) != 0)
77 { 83 {
78 ok = GNUNET_SYSERR; 84 ok = GNUNET_SYSERR;
79 } 85 }
@@ -94,43 +100,21 @@ testGeneratePkScalarMult (void)
94 &pk, 100 &pk,
95 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)); 101 sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
96 102
97 unsigned char pubWholeCurve[crypto_scalarmult_SCALARBYTES]; 103 struct GNUNET_CRYPTO_EcdhePublicKey pubWholeCurve = {0};
98 unsigned char pubPrimeCurve[crypto_scalarmult_SCALARBYTES]; 104 unsigned char pubPrimeCurve[crypto_scalarmult_SCALARBYTES];
99 105
100 if (GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (pubWholeCurve, &pk) == 106 if (GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (&pubWholeCurve,
101 -1) 107 &pk) == -1)
102 { 108 {
103 return GNUNET_SYSERR; 109 return GNUNET_SYSERR;
104 } 110 }
105 crypto_scalarmult_base (pubPrimeCurve, pk.d); 111 crypto_scalarmult_base (pubPrimeCurve, pk.d);
106 112
107 // printf ("pubWholeCurve\n");
108 // printLittleEndianHex (pubWholeCurve,32);
109 // printf ("pubPrimeCurve\n");
110 // printLittleEndianHex (pubPrimeCurve,32);
111 // TODO: Currently utilizing ecdsa function for ecdhe testing, due to clamping. Clean this part later.
112 struct GNUNET_CRYPTO_EcdsaPrivateKey clampedPk; 113 struct GNUNET_CRYPTO_EcdsaPrivateKey clampedPk;
113 GNUNET_CRYPTO_ecdsa_key_create (&clampedPk); 114 GNUNET_CRYPTO_ecdsa_key_create (&clampedPk);
114 crypto_scalarmult_base (pubWholeCurve, clampedPk.d); 115 crypto_scalarmult_base (pubWholeCurve.q_y, clampedPk.d);
115 crypto_scalarmult_base (pubPrimeCurve, clampedPk.d); 116 crypto_scalarmult_base (pubPrimeCurve, clampedPk.d);
116 if (memcmp (pubWholeCurve, pubPrimeCurve, sizeof(pubWholeCurve)) != 0) 117 if (memcmp (pubWholeCurve.q_y, pubPrimeCurve, sizeof(pubWholeCurve)) != 0)
117 {
118 return GNUNET_SYSERR;
119 }
120 return GNUNET_OK;
121}
122
123
124/*
125* Test Description: Simply testing, if function goes through.
126*/
127static int
128testKeyPairEasy (void)
129{
130 struct GNUNET_CRYPTO_ElligatorRepresentative repr;
131 struct GNUNET_CRYPTO_EcdhePrivateKey pk;
132 int i = GNUNET_CRYPTO_ecdhe_elligator_key_create (&repr, &pk);
133 if (i == GNUNET_SYSERR)
134 { 118 {
135 return GNUNET_SYSERR; 119 return GNUNET_SYSERR;
136 } 120 }
@@ -148,22 +132,17 @@ testInverseDirect (void)
148 struct GNUNET_CRYPTO_ElligatorRepresentative repr; 132 struct GNUNET_CRYPTO_ElligatorRepresentative repr;
149 struct GNUNET_CRYPTO_EcdhePublicKey point; 133 struct GNUNET_CRYPTO_EcdhePublicKey point;
150 struct GNUNET_CRYPTO_EcdhePrivateKey pk; 134 struct GNUNET_CRYPTO_EcdhePrivateKey pk;
151 int i = GNUNET_CRYPTO_ecdhe_elligator_key_create (&repr, &pk); 135 GNUNET_CRYPTO_ecdhe_elligator_key_create (&repr, &pk);
152 if (i == -1)
153 {
154 return GNUNET_SYSERR;
155 }
156 136
157 unsigned char pub[crypto_scalarmult_SCALARBYTES]; 137 struct GNUNET_CRYPTO_EcdhePublicKey pub = {0};
158 bool highY; 138 if (GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (&pub, &pk) == -1)
159 if (GNUNET_CRYPTO_ecdhe_elligator_generate_public_key (pub, &pk) == -1)
160 { 139 {
161 return GNUNET_SYSERR; 140 return GNUNET_SYSERR;
162 } 141 }
163 142
164 GNUNET_CRYPTO_ecdhe_elligator_decoding (&point, &highY, &repr); 143 GNUNET_CRYPTO_ecdhe_elligator_decoding (&point, NULL, &repr);
165 144
166 if (memcmp (pub, point.q_y, sizeof(point.q_y)) != 0) 145 if (memcmp (pub.q_y, point.q_y, sizeof(point.q_y)) != 0)
167 { 146 {
168 return GNUNET_SYSERR; 147 return GNUNET_SYSERR;
169 } 148 }
@@ -194,14 +173,7 @@ testTimeKeyGenerate (void)
194 { 173 {
195 fprintf (stderr, "%s", "."); 174 fprintf (stderr, "%s", ".");
196 fflush (stderr); 175 fflush (stderr);
197 if (GNUNET_SYSERR == 176 GNUNET_CRYPTO_ecdhe_elligator_key_create (&repr, &pk);
198 GNUNET_CRYPTO_ecdhe_elligator_key_create (&repr, &pk))
199 {
200 fprintf (stderr,
201 "GNUNET_CRYPTO_ecdhe_elligator_key_create SYSERR\n");
202 ok = GNUNET_SYSERR;
203 }
204 // printLittleEndianHex(repr.r,32);
205 } 177 }
206 printf ("%d encoded public keys generated in %s\n", 178 printf ("%d encoded public keys generated in %s\n",
207 ITER, 179 ITER,
@@ -218,20 +190,12 @@ testTimeDecoding (void)
218 struct GNUNET_CRYPTO_EcdhePublicKey point; 190 struct GNUNET_CRYPTO_EcdhePublicKey point;
219 struct GNUNET_CRYPTO_ElligatorRepresentative repr[ITER]; 191 struct GNUNET_CRYPTO_ElligatorRepresentative repr[ITER];
220 struct GNUNET_CRYPTO_EcdhePrivateKey pk; 192 struct GNUNET_CRYPTO_EcdhePrivateKey pk;
221 bool high_y;
222 struct GNUNET_TIME_Absolute start; 193 struct GNUNET_TIME_Absolute start;
223 int ok = GNUNET_OK; 194 int ok = GNUNET_OK;
224 195
225 for (unsigned int i = 0; i < ITER; i++) 196 for (unsigned int i = 0; i < ITER; i++)
226 { 197 {
227 if (GNUNET_SYSERR == 198 GNUNET_CRYPTO_ecdhe_elligator_key_create (&repr[i], &pk);
228 GNUNET_CRYPTO_ecdhe_elligator_key_create (&repr[i], &pk))
229 {
230 fprintf (stderr,
231 "GNUNET_CRYPTO_ecdhe_elligator_key_create SYSERR\n");
232 ok = GNUNET_SYSERR;
233 continue;
234 }
235 } 199 }
236 200
237 fprintf (stderr, "%s", "W"); 201 fprintf (stderr, "%s", "W");
@@ -241,14 +205,8 @@ testTimeDecoding (void)
241 { 205 {
242 fprintf (stderr, "%s", "."); 206 fprintf (stderr, "%s", ".");
243 fflush (stderr); 207 fflush (stderr);
244 if (false == 208 GNUNET_CRYPTO_ecdhe_elligator_decoding (&point, NULL, &repr[i]);
245 GNUNET_CRYPTO_ecdhe_elligator_decoding (&point, &high_y, &repr[i])) 209
246 {
247 fprintf (stderr,
248 "GNUNET_CRYPTO_ecdhe_elligator_decoding SYSERR\n");
249 ok = GNUNET_SYSERR;
250 continue;
251 }
252 } 210 }
253 211
254 printf ("%d decoded public keys generated in %s\n", 212 printf ("%d decoded public keys generated in %s\n",
@@ -260,17 +218,39 @@ testTimeDecoding (void)
260} 218}
261 219
262 220
263/* 221static int
264*More tests to implement: 222elligatorKEM ()
265* Adding more test vectors from different sources for inverse and direct map 223{
266 * check if inverse map rightfully fails for points which are not "encodable" 224 struct GNUNET_CRYPTO_EddsaPrivateKey pk_receiver;
267*/ 225 struct GNUNET_CRYPTO_EddsaPublicKey pub_receiver;
226 GNUNET_CRYPTO_eddsa_key_create (&pk_receiver);
227 GNUNET_CRYPTO_eddsa_key_get_public (&pk_receiver, &pub_receiver);
228
229 struct GNUNET_CRYPTO_ElligatorRepresentative r_sender;
230
231 // Sender side
232 struct GNUNET_HashCode key_material_encaps;
233 GNUNET_CRYPTO_eddsa_elligator_kem_encaps (&pub_receiver, &r_sender,
234 &key_material_encaps);
235
236 // Receiving side
237 struct GNUNET_HashCode key_material_decaps;
238 GNUNET_CRYPTO_eddsa_elligator_kem_decaps (&pk_receiver, &r_sender,
239 &key_material_decaps);
240
241 if (memcmp (&(key_material_encaps.bits),&(key_material_decaps.bits),
242 sizeof(key_material_encaps.bits)) != 0)
243 {
244 return GNUNET_SYSERR;
245 }
246
247 return GNUNET_OK;
248}
268 249
269 250
270int 251int
271main (int argc, char *argv[]) 252main (int argc, char *argv[])
272{ 253{
273 GNUNET_CRYPTO_ecdhe_elligator_initialize ();
274 254
275 int failure_count = 0; 255 int failure_count = 0;
276 256
@@ -289,11 +269,6 @@ main (int argc, char *argv[])
289 printf ("generate PK failed!"); 269 printf ("generate PK failed!");
290 failure_count++; 270 failure_count++;
291 } 271 }
292 if (GNUNET_OK != testKeyPairEasy ())
293 {
294 printf ("key generation doesn't work!");
295 failure_count++;
296 }
297 if (GNUNET_OK != testInverseDirect ()) 272 if (GNUNET_OK != testInverseDirect ())
298 { 273 {
299 printf ("Inverse and direct map failed!"); 274 printf ("Inverse and direct map failed!");
@@ -310,6 +285,12 @@ main (int argc, char *argv[])
310 failure_count++; 285 failure_count++;
311 } 286 }
312 287
288 if (GNUNET_OK != elligatorKEM ())
289 {
290 printf ("Elligator KEM failed!");
291 failure_count++;
292 }
293
313 if (0 != failure_count) 294 if (0 != failure_count)
314 { 295 {
315 fprintf (stderr, 296 fprintf (stderr,
diff --git a/src/plugin/datastore/Makefile.am b/src/plugin/datastore/Makefile.am
index 1f4ab59c8..bde7321dd 100644
--- a/src/plugin/datastore/Makefile.am
+++ b/src/plugin/datastore/Makefile.am
@@ -103,39 +103,33 @@ endif
103perf_plugin_datastore_heap_SOURCES = \ 103perf_plugin_datastore_heap_SOURCES = \
104 perf_plugin_datastore.c 104 perf_plugin_datastore.c
105perf_plugin_datastore_heap_LDADD = \ 105perf_plugin_datastore_heap_LDADD = \
106 $(top_builddir)/src/service/testing/libgnunettesting.la \
107 $(top_builddir)/src/lib/util/libgnunetutil.la 106 $(top_builddir)/src/lib/util/libgnunetutil.la
108 107
109test_plugin_datastore_heap_SOURCES = \ 108test_plugin_datastore_heap_SOURCES = \
110 test_plugin_datastore.c 109 test_plugin_datastore.c
111test_plugin_datastore_heap_LDADD = \ 110test_plugin_datastore_heap_LDADD = \
112 $(top_builddir)/src/service/testing/libgnunettesting.la \
113 $(top_builddir)/src/lib/util/libgnunetutil.la 111 $(top_builddir)/src/lib/util/libgnunetutil.la
114 112
115 113
116perf_plugin_datastore_sqlite_SOURCES = \ 114perf_plugin_datastore_sqlite_SOURCES = \
117 perf_plugin_datastore.c 115 perf_plugin_datastore.c
118perf_plugin_datastore_sqlite_LDADD = \ 116perf_plugin_datastore_sqlite_LDADD = \
119 $(top_builddir)/src/service/testing/libgnunettesting.la \
120 $(top_builddir)/src/lib/util/libgnunetutil.la 117 $(top_builddir)/src/lib/util/libgnunetutil.la
121 118
122test_plugin_datastore_sqlite_SOURCES = \ 119test_plugin_datastore_sqlite_SOURCES = \
123 test_plugin_datastore.c 120 test_plugin_datastore.c
124test_plugin_datastore_sqlite_LDADD = \ 121test_plugin_datastore_sqlite_LDADD = \
125 $(top_builddir)/src/service/testing/libgnunettesting.la \
126 $(top_builddir)/src/lib/util/libgnunetutil.la 122 $(top_builddir)/src/lib/util/libgnunetutil.la
127 123
128 124
129test_plugin_datastore_postgres_SOURCES = \ 125test_plugin_datastore_postgres_SOURCES = \
130 test_plugin_datastore.c 126 test_plugin_datastore.c
131test_plugin_datastore_postgres_LDADD = \ 127test_plugin_datastore_postgres_LDADD = \
132 $(top_builddir)/src/service/testing/libgnunettesting.la \
133 $(top_builddir)/src/lib/util/libgnunetutil.la 128 $(top_builddir)/src/lib/util/libgnunetutil.la
134 129
135perf_plugin_datastore_postgres_SOURCES = \ 130perf_plugin_datastore_postgres_SOURCES = \
136 perf_plugin_datastore.c 131 perf_plugin_datastore.c
137perf_plugin_datastore_postgres_LDADD = \ 132perf_plugin_datastore_postgres_LDADD = \
138 $(top_builddir)/src/service/testing/libgnunettesting.la \
139 $(top_builddir)/src/lib/util/libgnunetutil.la 133 $(top_builddir)/src/lib/util/libgnunetutil.la
140 134
141 135
diff --git a/src/plugin/namecache/Makefile.am b/src/plugin/namecache/Makefile.am
index bf8fc9b8d..980aeebe6 100644
--- a/src/plugin/namecache/Makefile.am
+++ b/src/plugin/namecache/Makefile.am
@@ -86,19 +86,16 @@ libgnunet_plugin_namecache_postgres_la_LDFLAGS = \
86test_plugin_namecache_flat_SOURCES = \ 86test_plugin_namecache_flat_SOURCES = \
87 test_plugin_namecache.c 87 test_plugin_namecache.c
88test_plugin_namecache_flat_LDADD = \ 88test_plugin_namecache_flat_LDADD = \
89 $(top_builddir)/src/service/testing/libgnunettesting.la \
90 $(top_builddir)/src/lib/util/libgnunetutil.la 89 $(top_builddir)/src/lib/util/libgnunetutil.la
91 90
92test_plugin_namecache_sqlite_SOURCES = \ 91test_plugin_namecache_sqlite_SOURCES = \
93 test_plugin_namecache.c 92 test_plugin_namecache.c
94test_plugin_namecache_sqlite_LDADD = \ 93test_plugin_namecache_sqlite_LDADD = \
95 $(top_builddir)/src/service/testing/libgnunettesting.la \
96 $(top_builddir)/src/lib/util/libgnunetutil.la 94 $(top_builddir)/src/lib/util/libgnunetutil.la
97 95
98test_plugin_namecache_postgres_SOURCES = \ 96test_plugin_namecache_postgres_SOURCES = \
99 test_plugin_namecache.c 97 test_plugin_namecache.c
100test_plugin_namecache_postgres_LDADD = \ 98test_plugin_namecache_postgres_LDADD = \
101 $(top_builddir)/src/service/testing/libgnunettesting.la \
102 $(top_builddir)/src/lib/util/libgnunetutil.la 99 $(top_builddir)/src/lib/util/libgnunetutil.la
103 100
104EXTRA_DIST = \ 101EXTRA_DIST = \
diff --git a/src/plugin/peerstore/Makefile.am b/src/plugin/peerstore/Makefile.am
index 7202aef84..5e10b706f 100644
--- a/src/plugin/peerstore/Makefile.am
+++ b/src/plugin/peerstore/Makefile.am
@@ -31,7 +31,6 @@ plugin_LTLIBRARIES = \
31test_plugin_peerstore_sqlite_SOURCES = \ 31test_plugin_peerstore_sqlite_SOURCES = \
32 test_plugin_peerstore.c 32 test_plugin_peerstore.c
33test_plugin_peerstore_sqlite_LDADD = \ 33test_plugin_peerstore_sqlite_LDADD = \
34 $(top_builddir)/src/service/testing/libgnunettesting.la \
35 $(top_builddir)/src/lib/util/libgnunetutil.la 34 $(top_builddir)/src/lib/util/libgnunetutil.la
36 35
37check_PROGRAMS = \ 36check_PROGRAMS = \
diff --git a/src/plugin/reclaim/plugin_gnsrecord_reclaim.c b/src/plugin/reclaim/plugin_gnsrecord_reclaim.c
index ce6fe483d..baf2fc37a 100644
--- a/src/plugin/reclaim/plugin_gnsrecord_reclaim.c
+++ b/src/plugin/reclaim/plugin_gnsrecord_reclaim.c
@@ -44,12 +44,12 @@ value_to_string (void *cls, uint32_t type, const void *data, size_t data_size)
44{ 44{
45 switch (type) 45 switch (type)
46 { 46 {
47 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
47 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT: 48 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
48 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT: 49 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
49 return GNUNET_strndup (data, data_size); 50 return GNUNET_strndup (data, data_size);
50 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE: 51 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE:
51 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF: 52 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF:
52 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
53 case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL: 53 case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL:
54 case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION: 54 case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION:
55 return GNUNET_STRINGS_data_to_string_alloc (data, data_size); 55 return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
@@ -79,6 +79,7 @@ string_to_value (void *cls, uint32_t type, const char *s, void **data,
79 return GNUNET_SYSERR; 79 return GNUNET_SYSERR;
80 switch (type) 80 switch (type)
81 { 81 {
82 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
82 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT: 83 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
83 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT: 84 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
84 *data = GNUNET_strdup (s); 85 *data = GNUNET_strdup (s);
@@ -86,7 +87,6 @@ string_to_value (void *cls, uint32_t type, const char *s, void **data,
86 return GNUNET_OK; 87 return GNUNET_OK;
87 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE: 88 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE:
88 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF: 89 case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF:
89 case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET:
90 case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL: 90 case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL:
91 case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION: 91 case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION:
92 return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size); 92 return GNUNET_STRINGS_string_to_data (s, strlen (s), *data, *data_size);
diff --git a/src/service/Makefile.am b/src/service/Makefile.am
index 610971725..557f56b8a 100644
--- a/src/service/Makefile.am
+++ b/src/service/Makefile.am
@@ -1,9 +1,9 @@
1SUBDIRS = \ 1SUBDIRS = \
2 util \ 2 util \
3 testbed \
3 statistics \ 4 statistics \
4 arm \ 5 arm \
5 peerstore \ 6 peerstore \
6 testing \
7 nat \ 7 nat \
8 nat-auto \ 8 nat-auto \
9 transport \ 9 transport \
@@ -32,4 +32,3 @@ SUBDIRS = \
32 reclaim \ 32 reclaim \
33 messenger \ 33 messenger \
34 rest 34 rest
35
diff --git a/src/service/arm/Makefile.am b/src/service/arm/Makefile.am
index 32addeef1..26c940688 100644
--- a/src/service/arm/Makefile.am
+++ b/src/service/arm/Makefile.am
@@ -13,10 +13,14 @@ if USE_COVERAGE
13 XLIB = -lgcov 13 XLIB = -lgcov
14endif 14endif
15 15
16lib_LTLIBRARIES = libgnunetarm.la 16lib_LTLIBRARIES = \
17 libgnunetarm.la \
18 libgnunettestingarm.la
17 19
18libgnunetarm_la_SOURCES = \ 20libgnunetarm_la_SOURCES = \
19 arm_api.c arm_monitor_api.c arm.h 21 arm_api.c \
22 arm_monitor_api.c \
23 arm.h
20libgnunetarm_la_LIBADD = \ 24libgnunetarm_la_LIBADD = \
21 $(top_builddir)/src/lib/util/libgnunetutil.la \ 25 $(top_builddir)/src/lib/util/libgnunetutil.la \
22 $(GN_LIBINTL) $(XLIB) 26 $(GN_LIBINTL) $(XLIB)
@@ -24,6 +28,21 @@ libgnunetarm_la_LDFLAGS = \
24 $(GN_LIB_LDFLAGS) \ 28 $(GN_LIB_LDFLAGS) \
25 -version-info 2:0:0 29 -version-info 2:0:0
26 30
31libgnunettestingarm_la_SOURCES = \
32 testing_arm_cmd_start_peer.c \
33 testing_arm_cmd_stop_peer.c \
34 testing_arm_traits.c
35libgnunettestingarm_la_LIBADD = \
36 libgnunetarm.la \
37 $(top_builddir)/src/service/testbed/libgnunettestingtestbed.la \
38 $(top_builddir)/src/service/testbed/libgnunettestbed.la \
39 $(top_builddir)/src/lib/testing/libgnunettesting.la \
40 $(top_builddir)/src/lib/util/libgnunetutil.la \
41 $(GN_LIBINTL) $(XLIB)
42libgnunettestingarm_la_LDFLAGS = \
43 $(GN_LIB_LDFLAGS) \
44 -version-info 0:0:0
45
27 46
28noinst_PROGRAMS = \ 47noinst_PROGRAMS = \
29 mockup-service 48 mockup-service
diff --git a/src/service/arm/arm_api.c b/src/service/arm/arm_api.c
index 1360ecf14..bc5efbd3f 100644
--- a/src/service/arm/arm_api.c
+++ b/src/service/arm/arm_api.c
@@ -346,7 +346,7 @@ pool_get (const char *pool_start,
346 * @param lres the message received from the arm service 346 * @param lres the message received from the arm service
347 * @return #GNUNET_OK if message is well-formed 347 * @return #GNUNET_OK if message is well-formed
348 */ 348 */
349static int 349static enum GNUNET_GenericReturnValue
350check_arm_list_result (void *cls, 350check_arm_list_result (void *cls,
351 const struct GNUNET_ARM_ListResultMessage *lres) 351 const struct GNUNET_ARM_ListResultMessage *lres)
352{ 352{
@@ -515,7 +515,7 @@ mq_error_handler (void *cls,
515 * @param h arm handle 515 * @param h arm handle
516 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure 516 * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure
517 */ 517 */
518static int 518static enum GNUNET_GenericReturnValue
519reconnect_arm (struct GNUNET_ARM_Handle *h) 519reconnect_arm (struct GNUNET_ARM_Handle *h)
520{ 520{
521 struct GNUNET_MQ_MessageHandler handlers[] = { 521 struct GNUNET_MQ_MessageHandler handlers[] = {
@@ -574,9 +574,10 @@ reconnect_arm (struct GNUNET_ARM_Handle *h)
574 * @return context to use for further ARM operations, NULL on error. 574 * @return context to use for further ARM operations, NULL on error.
575 */ 575 */
576struct GNUNET_ARM_Handle * 576struct GNUNET_ARM_Handle *
577GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, 577GNUNET_ARM_connect (
578 GNUNET_ARM_ConnectionStatusCallback conn_status, 578 const struct GNUNET_CONFIGURATION_Handle *cfg,
579 void *conn_status_cls) 579 GNUNET_ARM_ConnectionStatusCallback conn_status,
580 void *conn_status_cls)
580{ 581{
581 struct GNUNET_ARM_Handle *h; 582 struct GNUNET_ARM_Handle *h;
582 583
@@ -673,17 +674,19 @@ start_arm_service (struct GNUNET_ARM_Handle *h,
673 ld[1] = -1; 674 ld[1] = -1;
674 lsocks = ld; 675 lsocks = ld;
675 } 676 }
676 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg, 677 if (GNUNET_OK !=
677 "arm", 678 GNUNET_CONFIGURATION_get_value_string (h->cfg,
678 "PREFIX", 679 "arm",
679 &loprefix)) 680 "PREFIX",
681 &loprefix))
680 loprefix = GNUNET_strdup (""); 682 loprefix = GNUNET_strdup ("");
681 else 683 else
682 loprefix = GNUNET_CONFIGURATION_expand_dollar (h->cfg, loprefix); 684 loprefix = GNUNET_CONFIGURATION_expand_dollar (h->cfg, loprefix);
683 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (h->cfg, 685 if (GNUNET_OK !=
684 "arm", 686 GNUNET_CONFIGURATION_get_value_string (h->cfg,
685 "OPTIONS", 687 "arm",
686 &lopostfix)) 688 "OPTIONS",
689 &lopostfix))
687 lopostfix = GNUNET_strdup (""); 690 lopostfix = GNUNET_strdup ("");
688 else 691 else
689 lopostfix = GNUNET_CONFIGURATION_expand_dollar (h->cfg, 692 lopostfix = GNUNET_CONFIGURATION_expand_dollar (h->cfg,
@@ -701,10 +704,11 @@ start_arm_service (struct GNUNET_ARM_Handle *h,
701 GNUNET_free (lopostfix); 704 GNUNET_free (lopostfix);
702 return GNUNET_ARM_RESULT_IS_NOT_KNOWN; 705 return GNUNET_ARM_RESULT_IS_NOT_KNOWN;
703 } 706 }
704 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (h->cfg, 707 if (GNUNET_OK !=
705 "arm", 708 GNUNET_CONFIGURATION_get_value_filename (h->cfg,
706 "CONFIG", 709 "arm",
707 &config)) 710 "CONFIG",
711 &config))
708 config = NULL; 712 config = NULL;
709 binary = GNUNET_OS_get_libexec_binary_path (cbinary); 713 binary = GNUNET_OS_get_libexec_binary_path (cbinary);
710 GNUNET_asprintf (&quotedbinary, 714 GNUNET_asprintf (&quotedbinary,
@@ -850,10 +854,14 @@ change_service (struct GNUNET_ARM_Handle *h,
850 GNUNET_CONTAINER_DLL_insert_tail (h->operation_pending_head, 854 GNUNET_CONTAINER_DLL_insert_tail (h->operation_pending_head,
851 h->operation_pending_tail, 855 h->operation_pending_tail,
852 op); 856 op);
853 env = GNUNET_MQ_msg_extra (msg, slen, type); 857 env = GNUNET_MQ_msg_extra (msg,
858 slen,
859 type);
854 msg->reserved = htonl (0); 860 msg->reserved = htonl (0);
855 msg->request_id = GNUNET_htonll (op->id); 861 msg->request_id = GNUNET_htonll (op->id);
856 GNUNET_memcpy (&msg[1], service_name, slen); 862 GNUNET_memcpy (&msg[1],
863 service_name,
864 slen);
857 GNUNET_MQ_send (h->mq, env); 865 GNUNET_MQ_send (h->mq, env);
858 return op; 866 return op;
859} 867}
@@ -907,7 +915,7 @@ notify_starting (void *cls)
907 op->result_cont (op->cont_cls, 915 op->result_cont (op->cont_cls,
908 GNUNET_ARM_REQUEST_SENT_OK, 916 GNUNET_ARM_REQUEST_SENT_OK,
909 op->starting_ret); 917 op->starting_ret);
910 GNUNET_DISK_file_close(op->rfd); 918 GNUNET_DISK_file_close (op->rfd);
911 GNUNET_free (op); 919 GNUNET_free (op);
912} 920}
913 921
@@ -923,12 +931,13 @@ notify_starting (void *cls)
923 * @return handle for the operation, NULL on error 931 * @return handle for the operation, NULL on error
924 */ 932 */
925struct GNUNET_ARM_Operation * 933struct GNUNET_ARM_Operation *
926GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, 934GNUNET_ARM_request_service_start (
927 const char *service_name, 935 struct GNUNET_ARM_Handle *h,
928 enum GNUNET_OS_InheritStdioFlags 936 const char *service_name,
929 std_inheritance, 937 enum GNUNET_OS_InheritStdioFlags
930 GNUNET_ARM_ResultCallback cont, 938 std_inheritance,
931 void *cont_cls) 939 GNUNET_ARM_ResultCallback cont,
940 void *cont_cls)
932{ 941{
933 struct GNUNET_ARM_Operation *op; 942 struct GNUNET_ARM_Operation *op;
934 enum GNUNET_ARM_Result ret; 943 enum GNUNET_ARM_Result ret;
@@ -1035,10 +1044,11 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
1035 * @return handle for the operation, NULL on error 1044 * @return handle for the operation, NULL on error
1036 */ 1045 */
1037struct GNUNET_ARM_Operation * 1046struct GNUNET_ARM_Operation *
1038GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, 1047GNUNET_ARM_request_service_stop (
1039 const char *service_name, 1048 struct GNUNET_ARM_Handle *h,
1040 GNUNET_ARM_ResultCallback cont, 1049 const char *service_name,
1041 void *cont_cls) 1050 GNUNET_ARM_ResultCallback cont,
1051 void *cont_cls)
1042{ 1052{
1043 struct GNUNET_ARM_Operation *op; 1053 struct GNUNET_ARM_Operation *op;
1044 1054
@@ -1070,9 +1080,10 @@ GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h,
1070 * @return handle for the operation, NULL on error 1080 * @return handle for the operation, NULL on error
1071 */ 1081 */
1072struct GNUNET_ARM_Operation * 1082struct GNUNET_ARM_Operation *
1073GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, 1083GNUNET_ARM_request_service_list (
1074 GNUNET_ARM_ServiceListCallback cont, 1084 struct GNUNET_ARM_Handle *h,
1075 void *cont_cls) 1085 GNUNET_ARM_ServiceListCallback cont,
1086 void *cont_cls)
1076{ 1087{
1077 struct GNUNET_ARM_Operation *op; 1088 struct GNUNET_ARM_Operation *op;
1078 struct GNUNET_MQ_Envelope *env; 1089 struct GNUNET_MQ_Envelope *env;
diff --git a/src/service/arm/testing_arm_cmd_start_peer.c b/src/service/arm/testing_arm_cmd_start_peer.c
new file mode 100644
index 000000000..73d7ca4e7
--- /dev/null
+++ b/src/service/arm/testing_arm_cmd_start_peer.c
@@ -0,0 +1,293 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_start_peer.c
23 * @brief cmd to start a peer.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
29#include "gnunet_testbed_lib.h"
30#include "gnunet_testing_testbed_lib.h"
31#include "gnunet_testing_arm_lib.h"
32
33
34/**
35 * Handle for a peer controlled via ARM.
36 */
37struct GNUNET_TESTING_StartPeerState
38{
39
40 const char *system_label;
41
42 const char *cfgname;
43
44 /**
45 * Our interpreter.
46 */
47 struct GNUNET_TESTING_Interpreter *is;
48
49 /**
50 * Asynchronous start context.
51 */
52 struct GNUNET_TESTING_AsyncContext ac;
53
54 /**
55 * The TESTBED system associated with this peer
56 */
57 struct GNUNET_TESTBED_System *system;
58
59 /**
60 * The handle to the peer's ARM service
61 */
62 struct GNUNET_ARM_Handle *ah;
63
64 /**
65 * Handle to the ARM process information.
66 */
67 struct GNUNET_OS_Process *arm;
68
69 /**
70 * The config of the peer
71 */
72 struct GNUNET_CONFIGURATION_Handle *cfg;
73
74};
75
76
77/**
78 * Function called whenever we connect to or disconnect from ARM.
79 *
80 * @param cls closure
81 * @param connected #GNUNET_YES if connected, #GNUNET_NO if disconnected,
82 * #GNUNET_SYSERR if there was an error.
83 */
84static void
85conn_status (
86 void *cls,
87 enum GNUNET_GenericReturnValue connected)
88{
89 struct GNUNET_TESTING_StartPeerState *sps = cls;
90
91 if (GNUNET_OK != connected)
92 {
93 GNUNET_break (0);
94 GNUNET_TESTING_async_fail (&sps->ac);
95 return;
96 }
97 GNUNET_TESTING_async_finish (&sps->ac);
98}
99
100
101/**
102 * The run method of this cmd will start all services of a peer to test the transport service.
103 *
104 */
105static void
106start_peer_run (void *cls,
107 struct GNUNET_TESTING_Interpreter *is)
108{
109 struct GNUNET_TESTING_StartPeerState *sps = cls;
110 const struct GNUNET_TESTING_Command *system_cmd;
111
112 sps->is = is;
113 if (GNUNET_NO ==
114 GNUNET_DISK_file_test (sps->cfgname))
115 {
116 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
117 "File not found: `%s'\n",
118 sps->cfgname);
119 GNUNET_TESTING_FAIL (is);
120 }
121 system_cmd
122 = GNUNET_TESTING_interpreter_lookup_command (is,
123 sps->system_label);
124 if (NULL == system_cmd)
125 GNUNET_TESTING_FAIL (is);
126 if (GNUNET_OK !=
127 GNUNET_TESTING_TESTBED_get_trait_test_system (
128 system_cmd,
129 &sps->system))
130 GNUNET_TESTING_FAIL (is);
131 sps->cfg = GNUNET_CONFIGURATION_create ();
132 if (GNUNET_OK !=
133 GNUNET_CONFIGURATION_load (sps->cfg,
134 sps->cfgname))
135 GNUNET_TESTING_FAIL (is);
136 if (GNUNET_SYSERR ==
137 GNUNET_TESTBED_configuration_create (sps->system,
138 sps->cfg,
139 NULL,
140 NULL))
141 GNUNET_TESTING_FAIL (is);
142 {
143 char *config_filename;
144 char *libexec_binary;
145 char *main_binary;
146 char *args;
147 char *prefix;
148
149 GNUNET_assert (
150 GNUNET_OK ==
151 GNUNET_CONFIGURATION_get_value_filename (
152 sps->cfg,
153 "PATHS",
154 "DEFAULTCONFIG",
155 &config_filename));
156 if (GNUNET_OK !=
157 GNUNET_CONFIGURATION_write (sps->cfg,
158 config_filename))
159 {
160 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
161 "Failed to write configuration file `%s': %s\n",
162 config_filename,
163 strerror (errno));
164 GNUNET_free (config_filename);
165 GNUNET_TESTING_FAIL (is);
166 }
167
168 libexec_binary
169 = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
170
171 if (GNUNET_SYSERR ==
172 GNUNET_CONFIGURATION_get_value_string (sps->cfg,
173 "arm",
174 "PREFIX",
175 &prefix))
176 {
177 /* No prefix */
178 main_binary = libexec_binary;
179 args = GNUNET_strdup ("");
180 }
181 else
182 {
183 main_binary = prefix;
184 args = libexec_binary;
185 }
186 sps->arm
187 = GNUNET_OS_start_process_s (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
188 NULL,
189 main_binary,
190 args,
191 "-c",
192 config_filename,
193 NULL);
194 if (NULL == sps->arm)
195 {
196 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
197 _ ("Failed to start `%s': %s\n"),
198 main_binary,
199 strerror (errno));
200 GNUNET_TESTING_FAIL (is);
201 }
202 GNUNET_free (config_filename);
203 GNUNET_free (main_binary);
204 GNUNET_free (args);
205 }
206
207 sps->ah = GNUNET_ARM_connect (sps->cfg,
208 &conn_status,
209 sps);
210 if (NULL == sps->ah)
211 GNUNET_TESTING_FAIL (is);
212}
213
214
215/**
216 * The cleanup function of this cmd frees resources the cmd allocated.
217 *
218 */
219static void
220start_peer_cleanup (void *cls)
221{
222 struct GNUNET_TESTING_StartPeerState *sps = cls;
223
224 if (NULL != sps->ah)
225 {
226 GNUNET_ARM_disconnect (sps->ah);
227 sps->ah = NULL;
228 }
229 if (NULL != sps->arm)
230 {
231 GNUNET_break (0 ==
232 GNUNET_OS_process_kill (sps->arm,
233 SIGTERM));
234 GNUNET_break (GNUNET_OK ==
235 GNUNET_OS_process_wait (sps->arm));
236 GNUNET_OS_process_destroy (sps->arm);
237 sps->ah = NULL;
238 }
239
240 if (NULL != sps->cfg)
241 {
242 GNUNET_CONFIGURATION_destroy (sps->cfg);
243 sps->cfg = NULL;
244 }
245 GNUNET_free (sps);
246}
247
248
249/**
250 * This function prepares an array with traits.
251 *
252 */
253static enum GNUNET_GenericReturnValue
254start_peer_traits (void *cls,
255 const void **ret,
256 const char *trait,
257 unsigned int index)
258{
259 struct GNUNET_TESTING_StartPeerState *sps = cls;
260 struct GNUNET_TESTING_Trait traits[] = {
261 GNUNET_TESTING_make_trait_process (
262 &sps->arm),
263 // FIXME: expose sps->cfg as trait...
264 GNUNET_TESTING_ARM_make_trait_arm_handle (
265 sps->ah),
266 GNUNET_TESTING_trait_end ()
267 };
268
269 return GNUNET_TESTING_get_trait (traits,
270 ret,
271 trait,
272 index);
273}
274
275
276struct GNUNET_TESTING_Command
277GNUNET_TESTING_ARM_cmd_start_peer (
278 const char *label,
279 const char *system_label,
280 const char *cfgname)
281{
282 struct GNUNET_TESTING_StartPeerState *sps;
283
284 sps = GNUNET_new (struct GNUNET_TESTING_StartPeerState);
285 sps->system_label = GNUNET_strdup (system_label);
286 sps->cfgname = cfgname;
287 return GNUNET_TESTING_command_new_ac (sps,
288 label,
289 &start_peer_run,
290 &start_peer_cleanup,
291 &start_peer_traits,
292 &sps->ac);
293}
diff --git a/src/service/arm/testing_arm_cmd_stop_peer.c b/src/service/arm/testing_arm_cmd_stop_peer.c
new file mode 100644
index 000000000..e83b2bf29
--- /dev/null
+++ b/src/service/arm/testing_arm_cmd_stop_peer.c
@@ -0,0 +1,174 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_stop_peer.c
23 * @brief cmd to stop a peer.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
29#include "gnunet_testbed_lib.h"
30#include "gnunet_testing_arm_lib.h"
31#include "gnunet_arm_service.h"
32
33
34/**
35 * Struct to hold information for callbacks.
36 */
37struct StopPeerState
38{
39 /**
40 * Label of the cmd to start the peer.
41 */
42 const char *start_label;
43
44 /**
45 * Label of the cmd.
46 */
47 const char *label;
48
49 struct GNUNET_ARM_Operation *op;
50
51 struct GNUNET_TESTING_Interpreter *is;
52
53 struct GNUNET_TESTING_AsyncContext ac;
54};
55
56
57/**
58 * Function called in response to a start/stop request.
59 * Will be called when request was not sent successfully,
60 * or when a reply comes. If the request was not sent successfully,
61 * @a rs will indicate that, and @a result will be undefined.
62 *
63 * @param cls closure
64 * @param rs status of the request
65 * @param result result of the operation
66 */
67static void
68stop_cb (
69 void *cls,
70 enum GNUNET_ARM_RequestStatus rs,
71 enum GNUNET_ARM_Result result)
72{
73 struct StopPeerState *stop_ps = cls;
74
75 stop_ps->op = NULL;
76 if (GNUNET_ARM_RESULT_STOPPED != result)
77 {
78 GNUNET_TESTING_async_fail (&stop_ps->ac);
79 return;
80 }
81 GNUNET_TESTING_async_finish (&stop_ps->ac);
82}
83
84
85/**
86 * The run method of this cmd will stop all services of a peer which were used to test the transport service.
87 *
88 */
89static void
90stop_peer_run (void *cls,
91 struct GNUNET_TESTING_Interpreter *is)
92{
93 struct StopPeerState *stop_ps = cls;
94 const struct GNUNET_TESTING_Command *start_cmd;
95 struct GNUNET_ARM_Handle *ah;
96
97 stop_ps->is = is;
98 start_cmd
99 = GNUNET_TESTING_interpreter_lookup_command (is,
100 stop_ps->start_label);
101 if (NULL == start_cmd)
102 GNUNET_TESTING_FAIL (is);
103 if (GNUNET_OK !=
104 GNUNET_TESTING_ARM_get_trait_arm_handle (start_cmd,
105 &ah))
106 GNUNET_TESTING_FAIL (is);
107 stop_ps->op = GNUNET_ARM_request_service_stop (ah,
108 "arm",
109 &stop_cb,
110 stop_ps);
111 if (NULL == stop_ps->op)
112 GNUNET_TESTING_FAIL (is);
113}
114
115
116/**
117 * The cleanup function of this cmd frees resources the cmd allocated.
118 *
119 */
120static void
121stop_peer_cleanup (void *cls)
122{
123 struct StopPeerState *sps = cls;
124
125 if (NULL != sps->op)
126 {
127 GNUNET_TESTING_command_incomplete (sps->is,
128 sps->label);
129 GNUNET_ARM_operation_cancel (sps->op);
130 sps->op = NULL;
131 }
132 GNUNET_free (sps);
133}
134
135
136/**
137 * Trait function of this cmd does nothing.
138 *
139 */
140static int
141stop_peer_traits (void *cls,
142 const void **ret,
143 const char *trait,
144 unsigned int index)
145{
146 struct GNUNET_TESTING_Trait traits[] = {
147 GNUNET_TESTING_trait_end ()
148 };
149
150 (void) cls;
151 return GNUNET_TESTING_get_trait (traits,
152 ret,
153 trait,
154 index);
155}
156
157
158struct GNUNET_TESTING_Command
159GNUNET_TESTING_cmd_stop_peer (const char *label,
160 const char *start_label)
161{
162 struct StopPeerState *sps;
163
164 sps = GNUNET_new (struct StopPeerState);
165 sps->start_label = start_label;
166 sps->label = label;
167 return GNUNET_TESTING_command_new_ac (
168 sps,
169 label,
170 &stop_peer_run,
171 &stop_peer_cleanup,
172 &stop_peer_traits,
173 &sps->ac);
174}
diff --git a/src/service/transport/transport_api_traits.c b/src/service/arm/testing_arm_traits.c
index ec53f6f2b..d965220a2 100644
--- a/src/service/transport/transport_api_traits.c
+++ b/src/service/arm/testing_arm_traits.c
@@ -24,9 +24,10 @@
24 * @author t3sserakt 24 * @author t3sserakt
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_testing_ng_lib.h"
28#include "gnunet_testing_netjail_lib.h"
29#include "transport-testing-cmds.h"
30#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
29#include "gnunet_testing_arm_lib.h"
31 30
32GNUNET_TRANSPORT_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_TRANSPORT_TESTING) 31
32GNUNET_TESTING_ARM_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT,
33 GNUNET_TESTING_ARM)
diff --git a/src/service/cadet/.gitignore b/src/service/cadet/.gitignore
index e72d81bd8..bed27a3d3 100644
--- a/src/service/cadet/.gitignore
+++ b/src/service/cadet/.gitignore
@@ -1,27 +1,2 @@
1gnunet-service-cadet 1gnunet-service-cadet
2gnunet-cadet
3gnunet-cadet-profiler
4test_cadet_2_forward
5test_cadet_2_keepalive
6test_cadet_2_signal
7test_cadet_2_speed
8test_cadet_2_speed_ack
9test_cadet_2_speed_backwards
10test_cadet_2_speed_reliable
11test_cadet_2_speed_reliable_backwards
12test_cadet_5_forward
13test_cadet_5_keepalive
14test_cadet_5_signal
15test_cadet_5_speed
16test_cadet_5_speed_ack
17test_cadet_5_speed_backwards
18test_cadet_5_speed_reliable
19test_cadet_5_speed_reliable_backwards
20test_cadet_local
21test_cadet_single
22gnunet-service-cadet-new
23test_cadet_local_mq 2test_cadet_local_mq
24test_cadet_*_newtest_cadet_2_reopen
25test_cadet_5_reopen
26test_cadet_2_reopen
27test_cadet_2_destroy
diff --git a/src/service/cadet/gnunet-service-cadet_dht.c b/src/service/cadet/gnunet-service-cadet_dht.c
index 28b5448fd..dcd1efaa2 100644
--- a/src/service/cadet/gnunet-service-cadet_dht.c
+++ b/src/service/cadet/gnunet-service-cadet_dht.c
@@ -217,6 +217,7 @@ announce_id (void *cls)
217 expiration, /* Data expiration */ 217 expiration, /* Data expiration */
218 NULL, /* Continuation */ 218 NULL, /* Continuation */
219 NULL); /* Continuation closure */ 219 NULL); /* Continuation closure */
220 GNUNET_free (block);
220} 221}
221 222
222 223
diff --git a/src/service/cadet/gnunet-service-cadet_hello.c b/src/service/cadet/gnunet-service-cadet_hello.c
index cc28f0fde..889f3d588 100644
--- a/src/service/cadet/gnunet-service-cadet_hello.c
+++ b/src/service/cadet/gnunet-service-cadet_hello.c
@@ -24,7 +24,6 @@
24 * @author Bartlomiej Polot 24 * @author Bartlomiej Polot
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 */ 26 */
27#include "gnunet_common.h"
28#include "platform.h" 27#include "platform.h"
29#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
30#include "gnunet_statistics_service.h" 29#include "gnunet_statistics_service.h"
diff --git a/src/service/cadet/meson.build b/src/service/cadet/meson.build
index 0f465e0e2..d49dcdd2a 100644
--- a/src/service/cadet/meson.build
+++ b/src/service/cadet/meson.build
@@ -57,6 +57,8 @@ executable ('gnunet-service-cadet',
57 install: true, 57 install: true,
58 install_dir: get_option('libdir') / 'gnunet' / 'libexec') 58 install_dir: get_option('libdir') / 'gnunet' / 'libexec')
59 59
60if false
61
60testcadetlocalmq = executable ('test_cadet_local_mq', 62testcadetlocalmq = executable ('test_cadet_local_mq',
61 ['test_cadet_local_mq.c'], 63 ['test_cadet_local_mq.c'],
62 dependencies: [libgnunetcadet_dep, 64 dependencies: [libgnunetcadet_dep,
@@ -70,3 +72,5 @@ configure_file(input : 'test_cadet.conf',
70 install: false) 72 install: false)
71test('test_cadet_local_mq', testcadetlocalmq, workdir: meson.current_build_dir(), suite: 'cadet') 73test('test_cadet_local_mq', testcadetlocalmq, workdir: meson.current_build_dir(), suite: 'cadet')
72 74
75
76endif \ No newline at end of file
diff --git a/src/service/core/Makefile.am b/src/service/core/Makefile.am
index 220da838f..6de6762b1 100644
--- a/src/service/core/Makefile.am
+++ b/src/service/core/Makefile.am
@@ -15,15 +15,12 @@ if USE_COVERAGE
15 XLIB = -lgcov 15 XLIB = -lgcov
16endif 16endif
17 17
18plugin_LTLIBRARIES = \ 18#plugin_LTLIBRARIES = \
19 libgnunet_test_core_plugin_cmd_just_run.la 19# libgnunet_test_core_plugin_cmd_just_run.la
20
21TESTING_LIBS = \
22 libgnunetcoretesting.la
23 20
24lib_LTLIBRARIES = \ 21lib_LTLIBRARIES = \
25 libgnunetcore.la \ 22 libgnunetcore.la
26 $(TESTING_LIBS) 23# libgnunettestingcore.la
27 24
28libgnunetcore_la_SOURCES = \ 25libgnunetcore_la_SOURCES = \
29 core_api.c core.h \ 26 core_api.c core.h \
@@ -38,13 +35,13 @@ libgnunetcore_la_LDFLAGS = \
38libgnunet_test_core_plugin_cmd_just_run_la_SOURCES = \ 35libgnunet_test_core_plugin_cmd_just_run_la_SOURCES = \
39 test_core_plugin_cmd_just_run.c 36 test_core_plugin_cmd_just_run.c
40libgnunet_test_core_plugin_cmd_just_run_la_LIBADD = \ 37libgnunet_test_core_plugin_cmd_just_run_la_LIBADD = \
41 libgnunetcoretesting.la \ 38 libgnunettestingcore.la \
39 $(top_builddir)/src/service/transport/libgnunettestingtransport.la \
40 $(top_builddir)/src/lib/testing/libgnunettesting.la \
42 $(top_builddir)/src/service/transport/libgnunettransportapplication.la \ 41 $(top_builddir)/src/service/transport/libgnunettransportapplication.la \
43 $(top_builddir)/src/service/transport/libgnunettransportcore.la \ 42 $(top_builddir)/src/service/transport/libgnunettransportcore.la \
44 $(top_builddir)/src/lib/hello/libgnunethello.la \ 43 $(top_builddir)/src/lib/hello/libgnunethello.la \
45 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 44 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
46 $(top_builddir)/src/service/transport/libgnunettransporttesting2.la \
47 $(top_builddir)/src/service/testing/libgnunettesting.la \
48 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ 45 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \
49 $(top_builddir)/src/service/arm/libgnunetarm.la \ 46 $(top_builddir)/src/service/arm/libgnunetarm.la \
50 $(top_builddir)/src/lib/util/libgnunetutil.la \ 47 $(top_builddir)/src/lib/util/libgnunetutil.la \
@@ -52,18 +49,18 @@ libgnunet_test_core_plugin_cmd_just_run_la_LIBADD = \
52libgnunet_test_core_plugin_cmd_just_run_la_LDFLAGS = \ 49libgnunet_test_core_plugin_cmd_just_run_la_LDFLAGS = \
53 $(GN_PLUGIN_LDFLAGS) 50 $(GN_PLUGIN_LDFLAGS)
54 51
55libgnunetcoretesting_la_SOURCES = \ 52libgnunettestingcore_la_SOURCES = \
56 core_api_cmd_connecting_peers.c 53 testing_core_cmd_connecting_peers.c
57libgnunetcoretesting_la_LIBADD = \ 54libgnunettestingcore_la_LIBADD = \
58 $(top_builddir)/src/service/testing/libgnunettesting.la \ 55 $(top_builddir)/src/lib/testing/libgnunettesting.la \
56 $(top_builddir)/src/service/transport/libgnunettestingtransport.la \
59 $(top_builddir)/src/service/arm/libgnunetarm.la \ 57 $(top_builddir)/src/service/arm/libgnunetarm.la \
60 $(top_builddir)/src/service/transport/libgnunettransportapplication.la \ 58 $(top_builddir)/src/service/transport/libgnunettransportapplication.la \
61 $(top_builddir)/src/service/transport/libgnunettransporttesting2.la \
62 $(top_builddir)/src/lib/hello/libgnunethello.la \ 59 $(top_builddir)/src/lib/hello/libgnunethello.la \
63 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 60 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
64 $(top_builddir)/src/service/transport/libgnunettransportcore.la \ 61 $(top_builddir)/src/service/transport/libgnunettransportcore.la \
65 $(top_builddir)/src/lib/util/libgnunetutil.la 62 $(top_builddir)/src/lib/util/libgnunetutil.la
66libgnunetcoretesting_la_LDFLAGS = \ 63libgnunettestingcore_la_LDFLAGS = \
67 $(GN_LIBINTL) \ 64 $(GN_LIBINTL) \
68 $(GN_LIB_LDFLAGS) \ 65 $(GN_LIB_LDFLAGS) \
69 -version-info 0:0:0 66 -version-info 0:0:0
@@ -85,8 +82,8 @@ gnunet_service_core_LDADD = \
85 $(GN_LIBINTL) $(Z_LIBS) 82 $(GN_LIBINTL) $(Z_LIBS)
86 83
87 84
88TESTING_TESTS = \ 85#TESTING_TESTS = \
89 test_core_api_send_to_self 86# test_core_api_send_to_self
90 87
91check_PROGRAMS = \ 88check_PROGRAMS = \
92 test_core_api_start_only \ 89 test_core_api_start_only \
@@ -106,13 +103,13 @@ test_core_api_send_to_self_SOURCES = \
106 test_core_api_send_to_self.c 103 test_core_api_send_to_self.c
107test_core_api_send_to_self_LDADD = \ 104test_core_api_send_to_self_LDADD = \
108 libgnunetcore.la \ 105 libgnunetcore.la \
109 $(top_builddir)/src/service/testing/libgnunettesting.la \ 106 $(top_builddir)/src/lib/testing/libgnunettesting.la \
110 $(top_builddir)/src/lib/util/libgnunetutil.la 107 $(top_builddir)/src/lib/util/libgnunetutil.la
111 108
112test_core_api_start_only_SOURCES = \ 109test_core_api_start_only_SOURCES = \
113 test_core_api_start_only.c 110 test_core_api_start_only.c
114test_core_api_start_only_LDADD = \ 111test_core_api_start_only_LDADD = \
115 $(top_builddir)/src/service/testing/libgnunettesting.la \ 112 $(top_builddir)/src/lib/testing/libgnunettesting.la \
116 libgnunetcore.la \ 113 libgnunetcore.la \
117 $(top_builddir)/src/lib/util/libgnunetutil.la 114 $(top_builddir)/src/lib/util/libgnunetutil.la
118 115
diff --git a/src/service/core/meson.build b/src/service/core/meson.build
index 09fdc8dab..57adfc687 100644
--- a/src/service/core/meson.build
+++ b/src/service/core/meson.build
@@ -31,11 +31,13 @@ libgnunetcore_dep = declare_dependency(link_with : libgnunetcore)
31pkg.generate(libgnunetcore, url: 'https://www.gnunet.org', 31pkg.generate(libgnunetcore, url: 'https://www.gnunet.org',
32 description : 'Provides API for (encrypted) P2P communication') 32 description : 'Provides API for (encrypted) P2P communication')
33 33
34if false
35
34libgnunetcoretesting = library('gnunetcoretesting', 36libgnunetcoretesting = library('gnunetcoretesting',
35 ['core_api_cmd_connecting_peers.c'], 37 ['testing_core_cmd_connecting_peers.c'],
36 dependencies: [ 38 dependencies: [
37 libgnunetutil_dep, 39 libgnunetutil_dep,
38 libgnunettransporttesting2_dep, 40 libgnunettestingtransport_dep,
39 libgnunettesting_dep, 41 libgnunettesting_dep,
40 libgnunetarm_dep, 42 libgnunetarm_dep,
41 libgnunettransportapplication_dep, 43 libgnunettransportapplication_dep,
@@ -53,7 +55,7 @@ shared_module('gnunet_test_core_plugin_cmd_just_run',
53 dependencies: [libgnunetutil_dep, 55 dependencies: [libgnunetutil_dep,
54 libgnunettesting_dep, 56 libgnunettesting_dep,
55 libgnunetcoretesting_dep, 57 libgnunetcoretesting_dep,
56 libgnunettransporttesting2_dep, 58 libgnunettestingtransport_dep,
57 libgnunettransportcore_dep, 59 libgnunettransportcore_dep,
58 libgnunettransportapplication_dep, 60 libgnunettransportapplication_dep,
59 libgnunettesting_dep, 61 libgnunettesting_dep,
@@ -65,6 +67,8 @@ shared_module('gnunet_test_core_plugin_cmd_just_run',
65 include_directories: [incdir, configuration_inc], 67 include_directories: [incdir, configuration_inc],
66 install: false) 68 install: false)
67 69
70endif
71
68executable ('gnunet-service-core', 72executable ('gnunet-service-core',
69 gnunetservicecore_src, 73 gnunetservicecore_src,
70 dependencies: [libgnunetcore_dep, libgnunetutil_dep, 74 dependencies: [libgnunetcore_dep, libgnunetutil_dep,
@@ -87,6 +91,8 @@ configure_file(input : 'test_core_api_peer1.conf',
87 output : 'test_core_api_peer1.conf', 91 output : 'test_core_api_peer1.conf',
88 copy: true) 92 copy: true)
89 93
94if false
95
90testcore_api_send_self = executable ('test_core_api_send_to_self', 96testcore_api_send_self = executable ('test_core_api_send_to_self',
91 ['test_core_api_send_to_self.c'], 97 ['test_core_api_send_to_self.c'],
92 dependencies: [ 98 dependencies: [
@@ -111,3 +117,5 @@ test('test_core_api_send_to_self', testcore_api_send_self,
111 suite: 'core', workdir: meson.current_build_dir()) 117 suite: 'core', workdir: meson.current_build_dir())
112test('test_core_api_start_only', testcore_api_start, 118test('test_core_api_start_only', testcore_api_start,
113 suite: 'core', workdir: meson.current_build_dir()) 119 suite: 'core', workdir: meson.current_build_dir())
120
121endif \ No newline at end of file
diff --git a/src/service/core/test_core_plugin_cmd_just_run.c b/src/service/core/test_core_plugin_cmd_just_run.c
index 3c77c370d..a2b331c1f 100644
--- a/src/service/core/test_core_plugin_cmd_just_run.c
+++ b/src/service/core/test_core_plugin_cmd_just_run.c
@@ -24,15 +24,13 @@
24 * @author t3sserakt 24 * @author t3sserakt
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_testing_barrier.h"
28#include "gnunet_testing_netjail_lib.h"
29#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
30#include "gnunet_transport_application_service.h" 28#include "gnunet_transport_application_service.h"
31#include "gnunet_transport_core_service.h" 29#include "gnunet_transport_core_service.h"
32#include "gnunet_testing_barrier.h"
33#include "gnunet_core_service.h" 30#include "gnunet_core_service.h"
34#include "gnunet_transport_testing_ng_lib.h" 31#include "gnunet_testing_lib.h"
35#include "gnunet_core_testing_lib.h" 32#include "gnunet_testing_transport_lib.h"
33#include "gnunet_testing_core_lib.h"
36 34
37/** 35/**
38 * Generic logging shortcut 36 * Generic logging shortcut
@@ -250,11 +248,11 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message,
250 block_script = GNUNET_TESTING_cmd_block_until_external_trigger ( 248 block_script = GNUNET_TESTING_cmd_block_until_external_trigger (
251 "block-script"); 249 "block-script");
252 connect_peers = GNUNET_CORE_cmd_connect_peers ("connect-peers", 250 connect_peers = GNUNET_CORE_cmd_connect_peers ("connect-peers",
253 "start-peer", 251 "start-peer",
254 "system-create", 252 "system-create",
255 num, 253 num,
256 topology, 254 topology,
257 0, 255 0,
258 GNUNET_NO, 256 GNUNET_NO,
259 NULL); 257 NULL);
260 local_prepared = GNUNET_TESTING_cmd_local_test_prepared ( 258 local_prepared = GNUNET_TESTING_cmd_local_test_prepared (
@@ -270,7 +268,7 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message,
270 else 268 else
271 { 269 {
272 GNUNET_asprintf (&ts->cfgname, 270 GNUNET_asprintf (&ts->cfgname,
273 "test_core_just_run.conf"); 271 "test_core_just_run.conf");
274 } 272 }
275 273
276 LOG (GNUNET_ERROR_TYPE_DEBUG, 274 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -334,7 +332,7 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message,
334 GNUNET_NO, 332 GNUNET_NO,
335 write_message), 333 write_message),
336 GNUNET_TESTING_cmd_stop_peer ("stop-peer", 334 GNUNET_TESTING_cmd_stop_peer ("stop-peer",
337 "start-peer"), 335 "start-peer"),
338 GNUNET_TESTING_cmd_system_destroy ("system-destroy", 336 GNUNET_TESTING_cmd_system_destroy ("system-destroy",
339 "system-create"), 337 "system-create"),
340 GNUNET_TESTING_cmd_end () 338 GNUNET_TESTING_cmd_end ()
diff --git a/src/service/core/core_api_cmd_connecting_peers.c b/src/service/core/testing_core_cmd_connecting_peers.c
index a6aa818fa..731b2b202 100644
--- a/src/service/core/core_api_cmd_connecting_peers.c
+++ b/src/service/core/testing_core_cmd_connecting_peers.c
@@ -25,8 +25,8 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_core_testing_lib.h" 28#include "gnunet_testing_core_lib.h"
29#include "gnunet_transport_testing_ng_lib.h" 29#include "gnunet_testing_transport_lib.h"
30#include "gnunet_transport_application_service.h" 30#include "gnunet_transport_application_service.h"
31#include "gnunet_transport_core_service.h" 31#include "gnunet_transport_core_service.h"
32 32
@@ -64,9 +64,9 @@ connect_peers_run (void *cls,
64 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is, 64 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
65 cps->start_peer_label); 65 cps->start_peer_label);
66 GNUNET_TRANSPORT_TESTING_get_trait_broadcast (peer1_cmd, 66 GNUNET_TRANSPORT_TESTING_get_trait_broadcast (peer1_cmd,
67 &broadcast); 67 &broadcast);
68 GNUNET_TRANSPORT_TESTING_get_trait_state (peer1_cmd, 68 GNUNET_TRANSPORT_TESTING_get_trait_state (peer1_cmd,
69 &sps); 69 &sps);
70 70
71 system_cmd = GNUNET_TESTING_interpreter_lookup_command (is, 71 system_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
72 cps->create_label); 72 cps->create_label);
@@ -78,7 +78,7 @@ connect_peers_run (void *cls,
78 LOG (GNUNET_ERROR_TYPE_DEBUG, 78 LOG (GNUNET_ERROR_TYPE_DEBUG,
79 "cps->num: %u \n", 79 "cps->num: %u \n",
80 cps->num); 80 cps->num);
81 81
82 82
83 cps->ah = GNUNET_TRANSPORT_application_init (sps->cfg); 83 cps->ah = GNUNET_TRANSPORT_application_init (sps->cfg);
84 if (NULL == cps->ah) 84 if (NULL == cps->ah)
@@ -224,7 +224,7 @@ GNUNET_CORE_cmd_connect_peers (
224 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map = 224 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
225 GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); 225 GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
226 unsigned int i; 226 unsigned int i;
227 227
228 node_additional_connects = GNUNET_TESTING_get_additional_connects (num, 228 node_additional_connects = GNUNET_TESTING_get_additional_connects (num,
229 topology); 229 topology);
230 230
@@ -255,24 +255,23 @@ GNUNET_CORE_cmd_connect_peers (
255 handlers, 255 handlers,
256 i * sizeof(struct GNUNET_MQ_MessageHandler)); 256 i * sizeof(struct GNUNET_MQ_MessageHandler));
257 } 257 }
258 258 // FIXME: wrap with cmd_make_unblocking!
259 if (GNUNET_YES == wait_for_connect) 259 if (GNUNET_YES == wait_for_connect)
260 return GNUNET_TESTING_command_new (cps, 260 return GNUNET_TESTING_command_new_ac (cps,
261 label, 261 label,
262 &connect_peers_run, 262 &connect_peers_run,
263 &connect_peers_cleanup, 263 &connect_peers_cleanup,
264 &connect_peers_traits, 264 &connect_peers_traits,
265 &cps->ac); 265 &cps->ac);
266 else 266 else
267 return GNUNET_TESTING_command_new (cps, 267 return GNUNET_TESTING_command_new (cps,
268 label, 268 label,
269 &connect_peers_run, 269 &connect_peers_run,
270 &connect_peers_cleanup, 270 &connect_peers_cleanup,
271 &connect_peers_traits, 271 &connect_peers_traits);
272 NULL);
273} 272}
274 273
275 274
276// FIXME: likely not ideally placed here, move to its own file 275// FIXME: likely not ideally placed here, move to its own file
277GNUNET_CORE_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_CORE_TESTING) 276GNUNET_CORE_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT,
278 277 GNUNET_CORE_TESTING)
diff --git a/src/service/datacache/Makefile.am b/src/service/datacache/Makefile.am
index 022b45253..08b6e15ac 100644
--- a/src/service/datacache/Makefile.am
+++ b/src/service/datacache/Makefile.am
@@ -59,42 +59,36 @@ endif
59test_datacache_sqlite_SOURCES = \ 59test_datacache_sqlite_SOURCES = \
60 test_datacache.c 60 test_datacache.c
61test_datacache_sqlite_LDADD = \ 61test_datacache_sqlite_LDADD = \
62 $(top_builddir)/src/service/testing/libgnunettesting.la \
63 libgnunetdatacache.la \ 62 libgnunetdatacache.la \
64 $(top_builddir)/src/lib/util/libgnunetutil.la 63 $(top_builddir)/src/lib/util/libgnunetutil.la
65 64
66test_datacache_quota_sqlite_SOURCES = \ 65test_datacache_quota_sqlite_SOURCES = \
67 test_datacache_quota.c 66 test_datacache_quota.c
68test_datacache_quota_sqlite_LDADD = \ 67test_datacache_quota_sqlite_LDADD = \
69 $(top_builddir)/src/service/testing/libgnunettesting.la \
70 libgnunetdatacache.la \ 68 libgnunetdatacache.la \
71 $(top_builddir)/src/lib/util/libgnunetutil.la 69 $(top_builddir)/src/lib/util/libgnunetutil.la
72 70
73test_datacache_heap_SOURCES = \ 71test_datacache_heap_SOURCES = \
74 test_datacache.c 72 test_datacache.c
75test_datacache_heap_LDADD = \ 73test_datacache_heap_LDADD = \
76 $(top_builddir)/src/service/testing/libgnunettesting.la \
77 libgnunetdatacache.la \ 74 libgnunetdatacache.la \
78 $(top_builddir)/src/lib/util/libgnunetutil.la 75 $(top_builddir)/src/lib/util/libgnunetutil.la
79 76
80test_datacache_quota_heap_SOURCES = \ 77test_datacache_quota_heap_SOURCES = \
81 test_datacache_quota.c 78 test_datacache_quota.c
82test_datacache_quota_heap_LDADD = \ 79test_datacache_quota_heap_LDADD = \
83 $(top_builddir)/src/service/testing/libgnunettesting.la \
84 libgnunetdatacache.la \ 80 libgnunetdatacache.la \
85 $(top_builddir)/src/lib/util/libgnunetutil.la 81 $(top_builddir)/src/lib/util/libgnunetutil.la
86 82
87test_datacache_postgres_SOURCES = \ 83test_datacache_postgres_SOURCES = \
88 test_datacache.c 84 test_datacache.c
89test_datacache_postgres_LDADD = \ 85test_datacache_postgres_LDADD = \
90 $(top_builddir)/src/service/testing/libgnunettesting.la \
91 libgnunetdatacache.la \ 86 libgnunetdatacache.la \
92 $(top_builddir)/src/lib/util/libgnunetutil.la 87 $(top_builddir)/src/lib/util/libgnunetutil.la
93 88
94test_datacache_quota_postgres_SOURCES = \ 89test_datacache_quota_postgres_SOURCES = \
95 test_datacache_quota.c 90 test_datacache_quota.c
96test_datacache_quota_postgres_LDADD = \ 91test_datacache_quota_postgres_LDADD = \
97 $(top_builddir)/src/service/testing/libgnunettesting.la \
98 libgnunetdatacache.la \ 92 libgnunetdatacache.la \
99 $(top_builddir)/src/lib/util/libgnunetutil.la 93 $(top_builddir)/src/lib/util/libgnunetutil.la
100 94
diff --git a/src/service/datastore/Makefile.am b/src/service/datastore/Makefile.am
index 22f98482a..165bd2519 100644
--- a/src/service/datastore/Makefile.am
+++ b/src/service/datastore/Makefile.am
@@ -60,16 +60,16 @@ endif
60 $(POSTGRES_BENCHMARKS) 60 $(POSTGRES_BENCHMARKS)
61endif 61endif
62 62
63check_PROGRAMS = \ 63#check_PROGRAMS = \
64 test_datastore_api_heap \ 64# test_datastore_api_heap \
65 test_datastore_api_management_heap \ 65# test_datastore_api_management_heap \
66 perf_datastore_api_heap \ 66# perf_datastore_api_heap \
67 $(SQLITE_TESTS) \ 67# $(SQLITE_TESTS) \
68 $(POSTGRES_TESTS) 68# $(POSTGRES_TESTS)
69 69
70if ENABLE_TEST_RUN 70if ENABLE_TEST_RUN
71AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 71AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
72TESTS = $(check_PROGRAMS) 72 TESTS = $(check_PROGRAMS)
73endif 73endif
74 74
75test_datastore_api_heap_SOURCES = \ 75test_datastore_api_heap_SOURCES = \
diff --git a/src/service/datastore/meson.build b/src/service/datastore/meson.build
index 802ebb0a0..61ef9d7a9 100644
--- a/src/service/datastore/meson.build
+++ b/src/service/datastore/meson.build
@@ -38,6 +38,8 @@ executable ('gnunet-service-datastore',
38 install: true, 38 install: true,
39 install_dir: get_option('libdir')/'gnunet'/'libexec') 39 install_dir: get_option('libdir')/'gnunet'/'libexec')
40 40
41if false
42
41testds_sqlite = executable ('test_store_api_sqlite', 43testds_sqlite = executable ('test_store_api_sqlite',
42 ['test_datastore_api.c'], 44 ['test_datastore_api.c'],
43 dependencies: [ 45 dependencies: [
@@ -130,3 +132,4 @@ test('test_datastore_api_management_postgres', testds_mgmt_pq,
130 is_parallel: false, 132 is_parallel: false,
131 suite: 'datastore', workdir: meson.current_build_dir()) 133 suite: 'datastore', workdir: meson.current_build_dir())
132 134
135endif
diff --git a/src/service/dht/Makefile.am b/src/service/dht/Makefile.am
index d9919a69f..e16139650 100644
--- a/src/service/dht/Makefile.am
+++ b/src/service/dht/Makefile.am
@@ -10,6 +10,9 @@ libexecdir= $(pkglibdir)/libexec/
10pkgcfg_DATA = \ 10pkgcfg_DATA = \
11 dht.conf 11 dht.conf
12 12
13dist_pkgcfg_DATA = \
14 dhtu.conf
15
13if USE_COVERAGE 16if USE_COVERAGE
14 AM_CFLAGS = --coverage -O0 17 AM_CFLAGS = --coverage -O0
15 XLIB = -lgcov 18 XLIB = -lgcov
diff --git a/src/service/dht/gnunet-service-dht.c b/src/service/dht/gnunet-service-dht.c
index ab9e179bc..4579bfc2b 100644
--- a/src/service/dht/gnunet-service-dht.c
+++ b/src/service/dht/gnunet-service-dht.c
@@ -79,11 +79,6 @@ struct GDS_Underlay
79 * Name of the underlay (i.e. "gnunet" or "ip"). 79 * Name of the underlay (i.e. "gnunet" or "ip").
80 */ 80 */
81 char *name; 81 char *name;
82
83 /**
84 * Name of the library providing the underlay.
85 */
86 char *libname;
87}; 82};
88 83
89 84
@@ -383,8 +378,6 @@ shutdown_task (void *cls)
383 378
384 while (NULL != (u = u_head)) 379 while (NULL != (u = u_head))
385 { 380 {
386 GNUNET_PLUGIN_unload (u->libname,
387 u->dhtu);
388 GNUNET_CONTAINER_DLL_remove (u_head, 381 GNUNET_CONTAINER_DLL_remove (u_head,
389 u_tail, 382 u_tail,
390 u); 383 u);
diff --git a/src/service/dht/meson.build b/src/service/dht/meson.build
index a991b34d0..a27918fbe 100644
--- a/src/service/dht/meson.build
+++ b/src/service/dht/meson.build
@@ -13,6 +13,12 @@ configure_file(input : 'dht.conf.in',
13 install: true, 13 install: true,
14 install_dir: pkgcfgdir) 14 install_dir: pkgcfgdir)
15 15
16configure_file(input : 'dhtu.conf',
17 output : 'dhtu.conf',
18 configuration : cdata,
19 install: true,
20 install_dir: pkgcfgdir)
21
16if get_option('monolith') 22if get_option('monolith')
17 foreach p : libgnunetdht_src + gnunetservicedht_src 23 foreach p : libgnunetdht_src + gnunetservicedht_src
18 gnunet_src += 'dht/' + p 24 gnunet_src += 'dht/' + p
@@ -48,11 +54,7 @@ executable ('gnunet-service-dht',
48 install: true, 54 install: true,
49 install_dir: get_option('libdir')/'gnunet'/'libexec') 55 install_dir: get_option('libdir')/'gnunet'/'libexec')
50 56
51configure_file(input : 'dhtu.conf', 57if false
52 output : 'dhtu.conf',
53 configuration : cdata,
54 install: true,
55 install_dir: pkgcfgdir)
56 58
57libgnunettestingdhtu = library('gnunettestingdhtu', 59libgnunettestingdhtu = library('gnunettestingdhtu',
58 ['testing_dhtu_cmd_send.c'], 60 ['testing_dhtu_cmd_send.c'],
@@ -95,3 +97,5 @@ test('test_dhtu_ip', testdhtu_ip, suite: 'dhtu',
95 workdir: meson.current_build_dir()) 97 workdir: meson.current_build_dir())
96 98
97 99
100
101endif \ No newline at end of file
diff --git a/src/service/fs/Makefile.am b/src/service/fs/Makefile.am
index 0a10f688a..15e73f496 100644
--- a/src/service/fs/Makefile.am
+++ b/src/service/fs/Makefile.am
@@ -100,26 +100,28 @@ gnunet_service_fs_LDADD = \
100 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 100 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
101 $(GN_LIBINTL) -lm 101 $(GN_LIBINTL) -lm
102 102
103# test_fs_download \
104# test_fs_download_cadet \
105# test_fs_download_indexed \
106# test_fs_download_persistence \
107# test_fs_publish \
108# test_fs_list_indexed \
109# test_fs_namespace \
110# test_fs_namespace_list_updateable \
111# test_fs_search \
112# test_fs_search_with_and \
113# test_fs_search_probes \
114# test_fs_search_persistence \
115# test_fs_publish_persistence \
116# test_fs_unindex \
117# test_fs_start_stop \
118# test_fs_unindex_persistence
119
120
103check_PROGRAMS = \ 121check_PROGRAMS = \
104 test_fs_directory \ 122 test_fs_directory \
105 test_fs_download \
106 test_fs_download_cadet \
107 test_fs_download_indexed \
108 test_fs_download_persistence \
109 test_fs_file_information \ 123 test_fs_file_information \
110 test_fs_getopt \ 124 test_fs_getopt \
111 test_fs_list_indexed \
112 test_fs_namespace \
113 test_fs_namespace_list_updateable \
114 test_fs_publish \
115 test_fs_publish_persistence \
116 test_fs_search \
117 test_fs_search_with_and \
118 test_fs_search_probes \
119 test_fs_search_persistence \
120 test_fs_start_stop \
121 test_fs_unindex \
122 test_fs_unindex_persistence \
123 test_fs_uri \ 125 test_fs_uri \
124 test_fs_meta_data \ 126 test_fs_meta_data \
125 $(FS_BENCHMARKS) 127 $(FS_BENCHMARKS)
@@ -127,17 +129,7 @@ check_PROGRAMS = \
127 129
128if ENABLE_TEST_RUN 130if ENABLE_TEST_RUN
129AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 131AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
130TESTS = test_fs_directory \ 132TESTS = $(check_PROGRAMS)
131 test_fs_file_information \
132 test_fs_namespace \
133 test_fs_namespace_list_updateable \
134 test_fs_search \
135 test_fs_search_with_and \
136 test_fs_search_probes \
137 test_fs_search_persistence \
138 test_fs_start_stop \
139 test_fs_uri \
140 test_fs_meta_data
141endif 133endif
142 134
143 135
diff --git a/src/service/fs/fs_uri.c b/src/service/fs/fs_uri.c
index b0be0db4f..40ec76a03 100644
--- a/src/service/fs/fs_uri.c
+++ b/src/service/fs/fs_uri.c
@@ -1375,6 +1375,23 @@ GNUNET_FS_uri_chk_get_file_size (const struct GNUNET_FS_Uri *uri)
1375 1375
1376 1376
1377/** 1377/**
1378 * What is the hash of the original file's content
1379 * that this URI refers to?
1380 *
1381 * @param uri the CHK URI to inspect
1382 * @return hash of the file as specified in the CHK URI
1383 */
1384const struct GNUNET_HashCode*
1385GNUNET_FS_uri_chk_get_file_hash (const struct GNUNET_FS_Uri *uri)
1386{
1387 if (GNUNET_FS_URI_CHK != uri->type)
1388 GNUNET_assert (0);
1389
1390 return &(uri->data.chk.chk.key);
1391}
1392
1393
1394/**
1378 * Is this a location URI? 1395 * Is this a location URI?
1379 * 1396 *
1380 * @param uri the uri to check 1397 * @param uri the uri to check
diff --git a/src/service/fs/gnunet-service-fs_cp.c b/src/service/fs/gnunet-service-fs_cp.c
index 18a25a030..df934feaf 100644
--- a/src/service/fs/gnunet-service-fs_cp.c
+++ b/src/service/fs/gnunet-service-fs_cp.c
@@ -409,9 +409,9 @@ peer_respect_cb (void *cls,
409 if (NULL != record) 409 if (NULL != record)
410 { 410 {
411 GNUNET_PEERSTORE_iteration_stop (cp->respect_iterate_req); 411 GNUNET_PEERSTORE_iteration_stop (cp->respect_iterate_req);
412 cp->respect_iterate_req = NULL;
412 return; 413 return;
413 } 414 }
414 cp->respect_iterate_req = NULL;
415 GNUNET_PEERSTORE_iteration_next (cp->respect_iterate_req, 1); 415 GNUNET_PEERSTORE_iteration_next (cp->respect_iterate_req, 1);
416} 416}
417 417
diff --git a/src/service/gns/gns_tld_api.c b/src/service/gns/gns_tld_api.c
index 1ea87fd97..7a6864010 100644
--- a/src/service/gns/gns_tld_api.c
+++ b/src/service/gns/gns_tld_api.c
@@ -24,6 +24,7 @@
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_common.h"
27#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
28#include "gnunet_constants.h" 29#include "gnunet_constants.h"
29#include "gnunet_arm_service.h" 30#include "gnunet_arm_service.h"
@@ -223,19 +224,18 @@ identity_zone_cb (void *cls,
223} 224}
224 225
225 226
226/** 227enum GNUNET_GenericReturnValue
227 * Perform an asynchronous lookup operation on the GNS, 228GNUNET_GNS_parse_ztld (const char *name,
228 * determining the zone using the TLD of the given name 229 struct GNUNET_CRYPTO_PublicKey *ztld_key)
229 * and the current configuration to resolve TLDs to zones. 230{
230 * 231 const char *tld;
231 * @param handle handle to the GNS service 232
232 * @param name the name to look up, including TLD (in UTF-8 encoding) 233 /* start with trivial case: TLD is zkey */
233 * @param type the record type to look up 234 tld = get_tld (name);
234 * @param options local options for the lookup 235 return GNUNET_CRYPTO_public_key_from_string (tld, ztld_key);
235 * @param proc processor to call on result 236}
236 * @param proc_cls closure for @a proc 237
237 * @return handle to the get request, NULL on error (e.g. bad configuration) 238
238 */
239struct GNUNET_GNS_LookupWithTldRequest * 239struct GNUNET_GNS_LookupWithTldRequest *
240GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, 240GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
241 const char *name, 241 const char *name,
@@ -258,10 +258,10 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
258 ltr->lookup_proc = proc; 258 ltr->lookup_proc = proc;
259 ltr->lookup_proc_cls = proc_cls; 259 ltr->lookup_proc_cls = proc_cls;
260 /* start with trivial case: TLD is zkey */ 260 /* start with trivial case: TLD is zkey */
261 tld = get_tld (ltr->name);
262 if (GNUNET_OK == 261 if (GNUNET_OK ==
263 GNUNET_CRYPTO_public_key_from_string (tld, &pkey)) 262 GNUNET_GNS_parse_ztld (ltr->name, &pkey))
264 { 263 {
264 tld = get_tld (ltr->name);
265 LOG (GNUNET_ERROR_TYPE_DEBUG, 265 LOG (GNUNET_ERROR_TYPE_DEBUG,
266 "`%s' seems to be a valid zone key\n", tld); 266 "`%s' seems to be a valid zone key\n", tld);
267 eat_tld (ltr->name, tld); 267 eat_tld (ltr->name, tld);
@@ -283,7 +283,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle,
283 { 283 {
284 if (GNUNET_OK != 284 if (GNUNET_OK !=
285 GNUNET_CRYPTO_public_key_from_string (zonestr, 285 GNUNET_CRYPTO_public_key_from_string (zonestr,
286 &pkey)) 286 &pkey))
287 { 287 {
288 GNUNET_log_config_invalid ( 288 GNUNET_log_config_invalid (
289 GNUNET_ERROR_TYPE_ERROR, 289 GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/service/hostlist/gnunet-daemon-hostlist_server.c b/src/service/hostlist/gnunet-daemon-hostlist_server.c
index f243deb00..7cfeaec63 100644
--- a/src/service/hostlist/gnunet-daemon-hostlist_server.c
+++ b/src/service/hostlist/gnunet-daemon-hostlist_server.c
@@ -25,8 +25,8 @@
25 * @author David Barksdale 25 * @author David Barksdale
26 * @brief application to provide an integrated hostlist HTTP server 26 * @brief application to provide an integrated hostlist HTTP server
27 */ 27 */
28#include "gnunet_common.h"
29#include "platform.h" 28#include "platform.h"
29#include "gnunet_common.h"
30#include <microhttpd.h> 30#include <microhttpd.h>
31#include "gnunet-daemon-hostlist_server.h" 31#include "gnunet-daemon-hostlist_server.h"
32#include "gnunet_hello_uri_lib.h" 32#include "gnunet_hello_uri_lib.h"
diff --git a/src/service/identity/Makefile.am b/src/service/identity/Makefile.am
index 455fcab31..df7d6dd4d 100644
--- a/src/service/identity/Makefile.am
+++ b/src/service/identity/Makefile.am
@@ -44,8 +44,8 @@ gnunet_service_identity_LDADD = \
44 $(GN_LIBINTL) 44 $(GN_LIBINTL)
45 45
46 46
47check_PROGRAMS = \ 47#check_PROGRAMS = \
48 test_identity 48# test_identity
49 49
50# if ENABLE_TEST_RUN 50# if ENABLE_TEST_RUN
51# AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 51# AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
@@ -62,5 +62,3 @@ test_identity_LDADD = \
62 62
63EXTRA_DIST = \ 63EXTRA_DIST = \
64 test_identity.conf 64 test_identity.conf
65
66
diff --git a/src/service/meson.build b/src/service/meson.build
index ff874a1ec..b40ce9422 100644
--- a/src/service/meson.build
+++ b/src/service/meson.build
@@ -6,8 +6,8 @@ endif
6 6
7subdir('util') 7subdir('util')
8subdir('statistics') 8subdir('statistics')
9# FIXME: subdir('testbed')
9subdir('arm') 10subdir('arm')
10subdir('testing')
11subdir('peerstore') 11subdir('peerstore')
12subdir('nat') 12subdir('nat')
13subdir('nat-auto') 13subdir('nat-auto')
diff --git a/src/service/messenger/Makefile.am b/src/service/messenger/Makefile.am
index 93dcf9a78..8da31dfdc 100644
--- a/src/service/messenger/Makefile.am
+++ b/src/service/messenger/Makefile.am
@@ -21,16 +21,13 @@ libexec_PROGRAMS = \
21 gnunet-service-messenger \ 21 gnunet-service-messenger \
22 $(EXP_LIBEXEC) 22 $(EXP_LIBEXEC)
23 23
24plugin_LTLIBRARIES = \ 24#plugin_LTLIBRARIES = \
25 libgnunet_test_messenger_plugin_cmd_simple_join.la 25# libgnunet_test_messenger_plugin_cmd_simple_join.la
26
27TESTING_LIBS = \
28 libgnunetmessengertesting.la
29 26
30lib_LTLIBRARIES = \ 27lib_LTLIBRARIES = \
31 libgnunetmessenger.la \ 28 libgnunetmessenger.la \
32 $(EXP_LIB) \ 29 $(EXP_LIB)
33 $(TESTING_LIBS) 30# libgnunettestingmessenger.la
34 31
35libgnunetmessenger_la_SOURCES = \ 32libgnunetmessenger_la_SOURCES = \
36 messenger_api.c \ 33 messenger_api.c \
@@ -54,17 +51,17 @@ libgnunetmessenger_la_LDFLAGS = \
54 $(GN_LIB_LDFLAGS) \ 51 $(GN_LIB_LDFLAGS) \
55 -version-info 0:0:0 52 -version-info 0:0:0
56 53
57libgnunetmessengertesting_la_SOURCES = \ 54libgnunettestingmessenger_la_SOURCES = \
58 messenger_api_cmd_join_room.c \ 55 testing_messenger_cmd_join_room.c \
59 messenger_api_cmd_start_service.c \ 56 testing_messenger_cmd_start_service.c \
60 messenger_api_cmd_stop_service.c \ 57 testing_messenger_cmd_stop_service.c \
61 messenger_api_traits.c \ 58 testing_messenger_traits.c \
62 messenger-testing.c messenger-testing.h 59 testing_messenger.c testing_messenger.h
63libgnunetmessengertesting_la_LIBADD = \ 60libgnunettestingmessenger_la_LIBADD = \
64 libgnunetmessenger.la \ 61 libgnunetmessenger.la \
65 $(top_builddir)/src/service/testing/libgnunettesting.la \ 62 $(top_builddir)/src/lib/testing/libgnunettesting.la \
66 $(top_builddir)/src/service/cadet/libgnunetcadet.la \ 63 $(top_builddir)/src/service/cadet/libgnunetcadet.la \
67 $(top_builddir)/src/service/transport/libgnunettransporttesting2.la \ 64 $(top_builddir)/src/service/transport/libgnunettestingtransporttesting.la \
68 $(top_builddir)/src/service/transport/libgnunettransportapplication.la \ 65 $(top_builddir)/src/service/transport/libgnunettransportapplication.la \
69 $(top_builddir)/src/service/transport/libgnunettransportcore.la \ 66 $(top_builddir)/src/service/transport/libgnunettransportcore.la \
70 $(top_builddir)/src/service/core/libgnunetcore.la \ 67 $(top_builddir)/src/service/core/libgnunetcore.la \
@@ -83,14 +80,14 @@ libgnunet_test_messenger_plugin_cmd_simple_join_la_SOURCES = \
83 test_messenger_plugin_cmd_simple_join.c 80 test_messenger_plugin_cmd_simple_join.c
84libgnunet_test_messenger_plugin_cmd_simple_join_la_LIBADD = \ 81libgnunet_test_messenger_plugin_cmd_simple_join_la_LIBADD = \
85 libgnunetmessenger.la \ 82 libgnunetmessenger.la \
86 libgnunetmessengertesting.la \ 83 libgnunettestingmessenger.la \
84 $(top_builddir)/src/service/core/libgnunettestingcore.la \
85 $(top_builddir)/src/service/transport/libgnunettestingtransport.la \
86 $(top_builddir)/src/lib/testing/libgnunettesting.la \
87 $(top_builddir)/src/service/cadet/libgnunetcadet.la \ 87 $(top_builddir)/src/service/cadet/libgnunetcadet.la \
88 $(top_builddir)/src/service/core/libgnunetcore.la \ 88 $(top_builddir)/src/service/core/libgnunetcore.la \
89 $(top_builddir)/src/service/core/libgnunetcoretesting.la \
90 $(top_builddir)/src/service/transport/libgnunettransporttesting2.la \
91 $(top_builddir)/src/service/transport/libgnunettransportapplication.la \ 89 $(top_builddir)/src/service/transport/libgnunettransportapplication.la \
92 $(top_builddir)/src/service/transport/libgnunettransportcore.la \ 90 $(top_builddir)/src/service/transport/libgnunettransportcore.la \
93 $(top_builddir)/src/service/testing/libgnunettesting.la \
94 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 91 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
95 $(top_builddir)/src/service/identity/libgnunetidentity.la \ 92 $(top_builddir)/src/service/identity/libgnunetidentity.la \
96 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ 93 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \
@@ -130,9 +127,9 @@ gnunet_service_messenger_LDADD = \
130 $(top_builddir)/src/service/identity/libgnunetidentity.la \ 127 $(top_builddir)/src/service/identity/libgnunetidentity.la \
131 $(GN_LIBINTL) 128 $(GN_LIBINTL)
132 129
133check_PROGRAMS = \ 130#check_PROGRAMS = \
134 test_messenger_api \ 131# test_messenger_api \
135 test_messenger_anonymous 132# test_messenger_anonymous
136 133
137#check_SCRIPTS= \ 134#check_SCRIPTS= \
138# test_messenger_start_testcase.sh 135# test_messenger_start_testcase.sh
@@ -147,14 +144,14 @@ test_messenger_api_SOURCES = \
147 test_messenger.c 144 test_messenger.c
148test_messenger_api_LDADD = \ 145test_messenger_api_LDADD = \
149 libgnunetmessenger.la \ 146 libgnunetmessenger.la \
150 $(top_builddir)/src/service/testing/libgnunettesting.la \ 147 $(top_builddir)/src/lib/testing/libgnunettesting.la \
151 $(top_builddir)/src/lib/util/libgnunetutil.la 148 $(top_builddir)/src/lib/util/libgnunetutil.la
152 149
153test_messenger_anonymous_SOURCES = \ 150test_messenger_anonymous_SOURCES = \
154 test_messenger_anonymous.c 151 test_messenger_anonymous.c
155test_messenger_anonymous_LDADD = \ 152test_messenger_anonymous_LDADD = \
156 libgnunetmessenger.la \ 153 libgnunetmessenger.la \
157 $(top_builddir)/src/service/testing/libgnunettesting.la \ 154 $(top_builddir)/src/lib/testing/libgnunettesting.la \
158 $(top_builddir)/src/lib/util/libgnunetutil.la 155 $(top_builddir)/src/lib/util/libgnunetutil.la
159 156
160EXTRA_DIST = \ 157EXTRA_DIST = \
diff --git a/src/service/messenger/gnunet-service-messenger.c b/src/service/messenger/gnunet-service-messenger.c
index e97ab0d35..06f9384aa 100644
--- a/src/service/messenger/gnunet-service-messenger.c
+++ b/src/service/messenger/gnunet-service-messenger.c
@@ -287,16 +287,31 @@ check_send_message (void *cls,
287 287
288 if (msg_length < get_message_kind_size (GNUNET_MESSENGER_KIND_UNKNOWN, 288 if (msg_length < get_message_kind_size (GNUNET_MESSENGER_KIND_UNKNOWN,
289 GNUNET_YES)) 289 GNUNET_YES))
290 {
291 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Too short message: %s\n", GNUNET_h2s (
292 &(msg->key)));
290 return GNUNET_NO; 293 return GNUNET_NO;
294 }
291 295
292 if (GNUNET_YES != decode_message (&message, msg_length, msg_buffer, 296 if (GNUNET_YES != decode_message (&message, msg_length, msg_buffer,
293 GNUNET_YES, 297 GNUNET_YES,
294 NULL)) 298 NULL))
299 {
300 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Decoding message failed: %s\n",
301 GNUNET_h2s (
302 &(msg->key)));
295 return GNUNET_NO; 303 return GNUNET_NO;
304 }
296 305
297 enum GNUNET_GenericReturnValue allowed; 306 enum GNUNET_GenericReturnValue allowed;
298 allowed = filter_message_sending (&message); 307 allowed = filter_message_sending (&message);
299 308
309 if (GNUNET_SYSERR == allowed)
310 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
311 "Sending message not allowed: %s to %s\n",
312 GNUNET_MESSENGER_name_of_kind (message.header.kind),
313 GNUNET_h2s (&(msg->key)));
314
300 cleanup_message (&message); 315 cleanup_message (&message);
301 return GNUNET_SYSERR != allowed? GNUNET_OK : GNUNET_NO; 316 return GNUNET_SYSERR != allowed? GNUNET_OK : GNUNET_NO;
302} 317}
@@ -341,6 +356,10 @@ callback_found_message (void *cls,
341 356
342 if (! message) 357 if (! message)
343 { 358 {
359 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
360 "Notifying client about missing message: %s\n",
361 GNUNET_h2s (hash));
362
344 struct GNUNET_MESSENGER_GetMessage *response; 363 struct GNUNET_MESSENGER_GetMessage *response;
345 struct GNUNET_MQ_Envelope *env; 364 struct GNUNET_MQ_Envelope *env;
346 365
diff --git a/src/service/messenger/gnunet-service-messenger_handle.c b/src/service/messenger/gnunet-service-messenger_handle.c
index c13517603..ca9dcfb15 100644
--- a/src/service/messenger/gnunet-service-messenger_handle.c
+++ b/src/service/messenger/gnunet-service-messenger_handle.c
@@ -240,6 +240,7 @@ open_srv_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle,
240 key, 240 key,
241 NULL, 241 NULL,
242 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE)) 242 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE))
243
243 return GNUNET_NO; 244 return GNUNET_NO;
244 245
245 if ((! get_srv_handle_member_id (handle, key)) && 246 if ((! get_srv_handle_member_id (handle, key)) &&
@@ -449,8 +450,8 @@ notify_srv_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle,
449 } 450 }
450 else 451 else
451 { 452 {
452 const struct GNUNET_CRYPTO_PublicKey *pubkey = get_contact_key ( 453 const struct GNUNET_CRYPTO_PublicKey *pubkey;
453 session->member->contact); 454 pubkey = get_member_session_public_key (session->member);
454 GNUNET_CRYPTO_hash (pubkey, sizeof(*pubkey), &sender); 455 GNUNET_CRYPTO_hash (pubkey, sizeof(*pubkey), &sender);
455 456
456 context = get_next_member_session_context (session->member); 457 context = get_next_member_session_context (session->member);
@@ -499,6 +500,10 @@ iterate_next_member_ids (void *cls,
499 struct GNUNET_MESSENGER_SrvHandle *handle = cls; 500 struct GNUNET_MESSENGER_SrvHandle *handle = cls;
500 struct GNUNET_MESSENGER_NextMemberId *next = value; 501 struct GNUNET_MESSENGER_NextMemberId *next = value;
501 502
503 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
504 "Notifying client about next member id: %s (%s)\n",
505 GNUNET_sh2s (&(next->id)), GNUNET_h2s (key));
506
502 struct GNUNET_MESSENGER_MemberMessage *msg; 507 struct GNUNET_MESSENGER_MemberMessage *msg;
503 struct GNUNET_MQ_Envelope *env; 508 struct GNUNET_MQ_Envelope *env;
504 509
diff --git a/src/service/messenger/gnunet-service-messenger_list_messages.c b/src/service/messenger/gnunet-service-messenger_list_messages.c
index 0cb4e5787..cd59c8aec 100644
--- a/src/service/messenger/gnunet-service-messenger_list_messages.c
+++ b/src/service/messenger/gnunet-service-messenger_list_messages.c
@@ -111,7 +111,8 @@ load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages,
111 return; 111 return;
112 112
113 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 113 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
114 | GNUNET_DISK_PERM_USER_WRITE); 114 | GNUNET_DISK_PERM_USER_WRITE
115 );
115 116
116 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open ( 117 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
117 path, GNUNET_DISK_OPEN_READ, permission 118 path, GNUNET_DISK_OPEN_READ, permission
@@ -145,7 +146,8 @@ save_list_messages (const struct GNUNET_MESSENGER_ListMessages *messages,
145 GNUNET_assert ((messages) && (path)); 146 GNUNET_assert ((messages) && (path));
146 147
147 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 148 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
148 | GNUNET_DISK_PERM_USER_WRITE); 149 | GNUNET_DISK_PERM_USER_WRITE
150 );
149 151
150 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open ( 152 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
151 path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission 153 path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission
diff --git a/src/service/messenger/gnunet-service-messenger_member_session.c b/src/service/messenger/gnunet-service-messenger_member_session.c
index dc1124360..ed1fd75b7 100644
--- a/src/service/messenger/gnunet-service-messenger_member_session.c
+++ b/src/service/messenger/gnunet-service-messenger_member_session.c
@@ -154,8 +154,6 @@ completion:
154 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Completed session history (%s)\n", 154 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Completed session history (%s)\n",
155 GNUNET_sh2s (get_member_session_id (session))); 155 GNUNET_sh2s (get_member_session_id (session)));
156 156
157 GNUNET_CONTAINER_multihashmap_clear (session->history);
158
159 struct GNUNET_MESSENGER_ContactStore *store = get_member_contact_store ( 157 struct GNUNET_MESSENGER_ContactStore *store = get_member_contact_store (
160 session->member->store); 158 session->member->store);
161 159
@@ -418,7 +416,15 @@ verify_member_session_as_sender (const struct
418 GNUNET_assert ((session) && (message) && (hash)); 416 GNUNET_assert ((session) && (message) && (hash));
419 417
420 if (GNUNET_YES == is_member_session_completed (session)) 418 if (GNUNET_YES == is_member_session_completed (session))
421 return GNUNET_SYSERR; 419 {
420 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Check message (%s) using history!\n",
421 GNUNET_h2s (hash));
422
423 if (GNUNET_YES == check_member_session_history (session, hash, GNUNET_YES))
424 return GNUNET_OK;
425 else
426 return GNUNET_SYSERR;
427 }
422 428
423 if (0 != GNUNET_memcmp (get_member_session_id (session), 429 if (0 != GNUNET_memcmp (get_member_session_id (session),
424 &(message->header.sender_id))) 430 &(message->header.sender_id)))
@@ -533,7 +539,8 @@ load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
533 return; 539 return;
534 540
535 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 541 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
536 | GNUNET_DISK_PERM_USER_WRITE); 542 | GNUNET_DISK_PERM_USER_WRITE
543 );
537 544
538 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open ( 545 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
539 path, GNUNET_DISK_OPEN_READ, permission 546 path, GNUNET_DISK_OPEN_READ, permission
@@ -757,7 +764,8 @@ save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session,
757 GNUNET_assert ((session) && (path)); 764 GNUNET_assert ((session) && (path));
758 765
759 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 766 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
760 | GNUNET_DISK_PERM_USER_WRITE); 767 | GNUNET_DISK_PERM_USER_WRITE
768 );
761 769
762 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open ( 770 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
763 path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission 771 path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission
diff --git a/src/service/messenger/gnunet-service-messenger_message_recv.c b/src/service/messenger/gnunet-service-messenger_message_recv.c
index 53e96b524..6d4d537b6 100644
--- a/src/service/messenger/gnunet-service-messenger_message_recv.c
+++ b/src/service/messenger/gnunet-service-messenger_message_recv.c
@@ -51,6 +51,7 @@ forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room,
51 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (map, &(element->hash), 51 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (map, &(element->hash),
52 NULL, 52 NULL,
53 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) 53 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
54
54 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 55 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
55 "Forwarding of session message could be duplicated!\n"); 56 "Forwarding of session message could be duplicated!\n");
56 57
diff --git a/src/service/messenger/gnunet-service-messenger_message_send.c b/src/service/messenger/gnunet-service-messenger_message_send.c
index e7b92007b..05032e455 100644
--- a/src/service/messenger/gnunet-service-messenger_message_send.c
+++ b/src/service/messenger/gnunet-service-messenger_message_send.c
@@ -76,6 +76,7 @@ notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify,
76 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (map, &(element->hash), 76 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (map, &(element->hash),
77 NULL, 77 NULL,
78 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) 78 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
79
79 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 80 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
80 "Notification of session message could be duplicated!\n"); 81 "Notification of session message could be duplicated!\n");
81 82
diff --git a/src/service/messenger/gnunet-service-messenger_message_store.c b/src/service/messenger/gnunet-service-messenger_message_store.c
index d39e3f7bb..1eb275f9b 100644
--- a/src/service/messenger/gnunet-service-messenger_message_store.c
+++ b/src/service/messenger/gnunet-service-messenger_message_store.c
@@ -217,6 +217,7 @@ load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store,
217 (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (store->links, 217 (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (store->links,
218 &(storage.hash), link, 218 &(storage.hash), link,
219 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) 219 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)))
220
220 break; 221 break;
221 } 222 }
222 while (link); 223 while (link);
@@ -235,7 +236,8 @@ load_message_store (struct GNUNET_MESSENGER_MessageStore *store,
235 GNUNET_assert ((store) && (directory)); 236 GNUNET_assert ((store) && (directory));
236 237
237 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 238 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
238 | GNUNET_DISK_PERM_USER_WRITE); 239 | GNUNET_DISK_PERM_USER_WRITE
240 );
239 241
240 if (store->storage_messages) 242 if (store->storage_messages)
241 GNUNET_DISK_file_close (store->storage_messages); 243 GNUNET_DISK_file_close (store->storage_messages);
@@ -369,7 +371,8 @@ save_message_store (struct GNUNET_MESSENGER_MessageStore *store,
369 struct GNUNET_MESSENGER_ClosureMessageSave save; 371 struct GNUNET_MESSENGER_ClosureMessageSave save;
370 372
371 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 373 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
372 | GNUNET_DISK_PERM_USER_WRITE); 374 | GNUNET_DISK_PERM_USER_WRITE
375 );
373 376
374 char *filename; 377 char *filename;
375 378
@@ -526,6 +529,7 @@ get_store_message (struct GNUNET_MESSENGER_MessageStore *store,
526 if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (store->messages, hash, 529 if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (store->messages, hash,
527 message, 530 message,
528 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) 531 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
532
529 goto free_buffer; 533 goto free_buffer;
530 534
531 free_message : destroy_message (message); 535 free_message : destroy_message (message);
@@ -609,6 +613,7 @@ add_link (struct GNUNET_MESSENGER_MessageStore *store,
609 613
610 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (store->links, hash, link, 614 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (store->links, hash, link,
611 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) 615 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
616
612 GNUNET_free (link); 617 GNUNET_free (link);
613 else 618 else
614 store->write_links = GNUNET_YES; 619 store->write_links = GNUNET_YES;
diff --git a/src/service/messenger/gnunet-service-messenger_peer_store.c b/src/service/messenger/gnunet-service-messenger_peer_store.c
index 5a2fd5f58..fdfbf599b 100644
--- a/src/service/messenger/gnunet-service-messenger_peer_store.c
+++ b/src/service/messenger/gnunet-service-messenger_peer_store.c
@@ -85,7 +85,8 @@ load_peer_store (struct GNUNET_MESSENGER_PeerStore *store,
85 path); 85 path);
86 86
87 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 87 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
88 | GNUNET_DISK_PERM_USER_WRITE); 88 | GNUNET_DISK_PERM_USER_WRITE
89 );
89 90
90 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open ( 91 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
91 path, GNUNET_DISK_OPEN_READ, permission 92 path, GNUNET_DISK_OPEN_READ, permission
@@ -158,7 +159,8 @@ save_peer_store (const struct GNUNET_MESSENGER_PeerStore *store,
158 path); 159 path);
159 160
160 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 161 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
161 | GNUNET_DISK_PERM_USER_WRITE); 162 | GNUNET_DISK_PERM_USER_WRITE
163 );
162 164
163 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open ( 165 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
164 path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission 166 path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission
diff --git a/src/service/messenger/gnunet-service-messenger_room.c b/src/service/messenger/gnunet-service-messenger_room.c
index db2a158c7..570d2f990 100644
--- a/src/service/messenger/gnunet-service-messenger_room.c
+++ b/src/service/messenger/gnunet-service-messenger_room.c
@@ -1116,6 +1116,11 @@ handle_room_messages (struct GNUNET_MESSENGER_SrvRoom *room)
1116 get_srv_room_member_store (room); 1116 get_srv_room_member_store (room);
1117 struct GNUNET_MESSENGER_PeerStore *peer_store = get_srv_room_peer_store ( 1117 struct GNUNET_MESSENGER_PeerStore *peer_store = get_srv_room_peer_store (
1118 room); 1118 room);
1119
1120 const struct GNUNET_HashCode *key = get_srv_room_key (room);
1121
1122 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1123 "Handling room messages: %s\n", GNUNET_h2s (key));
1119 1124
1120 while (room->handling.head) 1125 while (room->handling.head)
1121 { 1126 {
diff --git a/src/service/messenger/gnunet-service-messenger_service.c b/src/service/messenger/gnunet-service-messenger_service.c
index 39ec0611e..11656d6b7 100644
--- a/src/service/messenger/gnunet-service-messenger_service.c
+++ b/src/service/messenger/gnunet-service-messenger_service.c
@@ -445,6 +445,11 @@ handle_service_message (struct GNUNET_MESSENGER_Service *service,
445{ 445{
446 GNUNET_assert ((service) && (room) && (session) && (message) && (hash)); 446 GNUNET_assert ((service) && (room) && (session) && (message) && (hash));
447 447
448 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
449 "Notify active clients about message: %s (%s)\n",
450 GNUNET_h2s (hash), GNUNET_MESSENGER_name_of_kind (
451 message->header.kind));
452
448 struct GNUNET_MESSENGER_ListHandle *element = service->handles.head; 453 struct GNUNET_MESSENGER_ListHandle *element = service->handles.head;
449 454
450 while (element) 455 while (element)
diff --git a/src/service/messenger/messenger-testing-cmds.h b/src/service/messenger/messenger-testing-cmds.h
index 222633355..0b70d62f1 100644
--- a/src/service/messenger/messenger-testing-cmds.h
+++ b/src/service/messenger/messenger-testing-cmds.h
@@ -26,9 +26,7 @@
26#ifndef MESSENGER_TESTING_CMDS_H 26#ifndef MESSENGER_TESTING_CMDS_H
27#define MESSENGER_TESTING_CMDS_H 27#define MESSENGER_TESTING_CMDS_H
28 28
29#include "gnunet_testing_ng_lib.h" 29#include "gnunet_testing_lib.h"
30#include "gnunet_testing_plugin.h"
31
32#include "messenger-testing.h" 30#include "messenger-testing.h"
33 31
34struct GNUNET_TESTING_Command 32struct GNUNET_TESTING_Command
@@ -57,7 +55,7 @@ GNUNET_MESSENGER_cmd_join_room (const char *label,
57 enum GNUNET_GenericReturnValue \ 55 enum GNUNET_GenericReturnValue \
58 GNUNET_MESSENGER_get_trait_ ## name ( \ 56 GNUNET_MESSENGER_get_trait_ ## name ( \
59 const struct GNUNET_TESTING_Command *cmd, \ 57 const struct GNUNET_TESTING_Command *cmd, \
60 type **ret); \ 58 type * *ret); \
61 struct GNUNET_TESTING_Trait \ 59 struct GNUNET_TESTING_Trait \
62 GNUNET_MESSENGER_make_trait_ ## name ( \ 60 GNUNET_MESSENGER_make_trait_ ## name ( \
63 type * value); 61 type * value);
diff --git a/src/service/messenger/messenger_api.c b/src/service/messenger/messenger_api.c
index 1d782ac13..12a326202 100644
--- a/src/service/messenger/messenger_api.c
+++ b/src/service/messenger/messenger_api.c
@@ -602,6 +602,8 @@ GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
602 if ((! key) || (0 < GNUNET_CRYPTO_private_key_get_length (key))) 602 if ((! key) || (0 < GNUNET_CRYPTO_private_key_get_length (key)))
603 set_handle_key (handle, key); 603 set_handle_key (handle, key);
604 604
605 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connect handle!\n");
606
605 struct GNUNET_MESSENGER_CreateMessage *msg; 607 struct GNUNET_MESSENGER_CreateMessage *msg;
606 struct GNUNET_MQ_Envelope *env; 608 struct GNUNET_MQ_Envelope *env;
607 609
@@ -623,6 +625,8 @@ GNUNET_MESSENGER_disconnect (struct GNUNET_MESSENGER_Handle *handle)
623 if (! handle) 625 if (! handle)
624 return; 626 return;
625 627
628 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Disconnect handle!\n");
629
626 struct GNUNET_MESSENGER_DestroyMessage *msg; 630 struct GNUNET_MESSENGER_DestroyMessage *msg;
627 struct GNUNET_MQ_Envelope *env; 631 struct GNUNET_MQ_Envelope *env;
628 632
@@ -634,6 +638,18 @@ GNUNET_MESSENGER_disconnect (struct GNUNET_MESSENGER_Handle *handle)
634 638
635 639
636static void 640static void
641callback_leave_message_sent (void *cls)
642{
643 struct GNUNET_MESSENGER_Room *room = cls;
644
645 room->opened = GNUNET_NO;
646 clear_list_tunnels (&(room->entries));
647
648 send_close_room (room->handle, room);
649}
650
651
652static void
637send_message_to_room (struct GNUNET_MESSENGER_Room *room, 653send_message_to_room (struct GNUNET_MESSENGER_Room *room,
638 struct GNUNET_MESSENGER_Message *message, 654 struct GNUNET_MESSENGER_Message *message,
639 const struct GNUNET_CRYPTO_PrivateKey *key, 655 const struct GNUNET_CRYPTO_PrivateKey *key,
@@ -669,12 +685,15 @@ send_message_to_room (struct GNUNET_MESSENGER_Room *room,
669 hash_message (message, msg_length, msg_buffer, hash); 685 hash_message (message, msg_length, msg_buffer, hash);
670 sign_message (message, msg_length, msg_buffer, hash, key); 686 sign_message (message, msg_length, msg_buffer, hash, key);
671 687
672 update_room_last_message (room, hash); 688 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Send message (%s)!\n",
689 GNUNET_h2s (hash));
673 690
674 GNUNET_MQ_send (room->handle->mq, env); 691 update_room_last_message (room, hash);
675 692
676 if (GNUNET_MESSENGER_KIND_LEAVE == message->header.kind) 693 if (GNUNET_MESSENGER_KIND_LEAVE == message->header.kind)
677 send_close_room (room->handle, room); 694 GNUNET_MQ_notify_sent (env, callback_leave_message_sent, room);
695
696 GNUNET_MQ_send (room->handle->mq, env);
678} 697}
679 698
680 699
@@ -726,37 +745,43 @@ dequeue_messages_from_room (struct GNUNET_MESSENGER_Room *room)
726 if (message) 745 if (message)
727 destroy_message (message); 746 destroy_message (message);
728 747
748 memset (&key, 0, sizeof(key));
729 message = dequeue_from_messages (&(room->queue), &key, &transcript); 749 message = dequeue_from_messages (&(room->queue), &key, &transcript);
730 750
731 if (! message) 751 if (! message)
732 { 752 {
733 message = transcript; 753 message = transcript;
754 transcript = NULL;
734 continue; 755 continue;
735 } 756 }
736 757
737 send_message_to_room (room, message, &key, &hash); 758 send_message_to_room (room, message, &key, &hash);
738 759
739 if (! transcript) 760 if (! transcript)
761 {
762 GNUNET_CRYPTO_private_key_clear (&key);
740 continue; 763 continue;
764 }
741 765
742 GNUNET_memcpy (&(transcript->body.transcript.hash), &hash, sizeof(hash)); 766 GNUNET_memcpy (&(transcript->body.transcript.hash), &hash, sizeof(hash));
767
768 memset (&pubkey, 0, sizeof(pubkey));
743 GNUNET_CRYPTO_key_get_public (&key, &pubkey); 769 GNUNET_CRYPTO_key_get_public (&key, &pubkey);
744 770
745 if (GNUNET_YES == encrypt_message (transcript, &pubkey)) 771 if (GNUNET_YES == encrypt_message (transcript, &pubkey))
746 { 772 {
747 send_message_to_room (room, transcript, &key, &other); 773 send_message_to_room (room, transcript, &key, &other);
774 GNUNET_CRYPTO_private_key_clear (&key);
748 775
749 link_room_message (room, &hash, &other); 776 link_room_message (room, &hash, &other);
750 link_room_message (room, &other, &hash); 777 link_room_message (room, &other, &hash);
751 } 778 }
752 else 779 else
753 {
754 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 780 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
755 "Sending transcript aborted: Encryption failed!\n"); 781 "Sending transcript aborted: Encryption failed!\n");
756 782
757 destroy_message (transcript); 783 destroy_message (transcript);
758 } 784 transcript = NULL;
759
760 } while (message); 785 } while (message);
761 786
762 return GNUNET_YES; 787 return GNUNET_YES;
@@ -869,7 +894,9 @@ GNUNET_MESSENGER_set_key (struct GNUNET_MESSENGER_Handle *handle,
869 GNUNET_memcpy (&priv, key, sizeof (priv)); 894 GNUNET_memcpy (&priv, key, sizeof (priv));
870 895
871 GNUNET_MESSENGER_find_rooms (handle, NULL, iterate_send_key_to_room, &priv); 896 GNUNET_MESSENGER_find_rooms (handle, NULL, iterate_send_key_to_room, &priv);
872 set_handle_key (handle, &priv); 897 GNUNET_CRYPTO_private_key_clear (&priv);
898
899 set_handle_key (handle, key);
873 return GNUNET_YES; 900 return GNUNET_YES;
874} 901}
875 902
@@ -939,8 +966,10 @@ GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room)
939 966
940 struct GNUNET_MESSENGER_Message *message = create_message_leave (); 967 struct GNUNET_MESSENGER_Message *message = create_message_leave ();
941 968
942 if (message) 969 if (! message)
943 enqueue_message_to_room (room, message, NULL); 970 return;
971
972 enqueue_message_to_room (room, message, NULL);
944} 973}
945 974
946 975
@@ -963,7 +992,8 @@ iterate_find_room (void *cls,
963 if ((find->counter > 0) && ((! find->contact) || (GNUNET_YES == 992 if ((find->counter > 0) && ((! find->contact) || (GNUNET_YES ==
964 find_room_member (room, 993 find_room_member (room,
965 find-> 994 find->
966 contact)))) 995 contact)))
996 )
967 { 997 {
968 find->counter--; 998 find->counter--;
969 999
@@ -1205,6 +1235,9 @@ GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room,
1205 1235
1206 if (! message) 1236 if (! message)
1207 { 1237 {
1238 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request message (%s)!\n",
1239 GNUNET_h2s (hash));
1240
1208 struct GNUNET_MESSENGER_GetMessage *msg; 1241 struct GNUNET_MESSENGER_GetMessage *msg;
1209 struct GNUNET_MQ_Envelope *env; 1242 struct GNUNET_MQ_Envelope *env;
1210 1243
@@ -1228,78 +1261,3 @@ GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room,
1228 1261
1229 return iterate_room_members (room, callback, cls); 1262 return iterate_room_members (room, callback, cls);
1230} 1263}
1231
1232
1233struct GNUNET_MESSENGER_CheckTicket
1234{
1235 const struct GNUNET_CRYPTO_PublicKey *audience;
1236 enum GNUNET_GenericReturnValue result;
1237};
1238
1239
1240static enum GNUNET_GenericReturnValue
1241check_ticket_audience (void *cls,
1242 struct GNUNET_MESSENGER_Room *room,
1243 const struct GNUNET_MESSENGER_Contact *contact)
1244{
1245 struct GNUNET_MESSENGER_CheckTicket *check = cls;
1246
1247 const struct GNUNET_CRYPTO_PublicKey *key;
1248 key = get_non_anonymous_key (get_contact_key (contact));
1249
1250 if ((key) && (0 == GNUNET_memcmp (key, check->audience)))
1251 {
1252 check->result = GNUNET_YES;
1253 return GNUNET_NO;
1254 }
1255
1256 return GNUNET_YES;
1257}
1258
1259
1260void
1261GNUNET_MESSENGER_send_ticket (struct GNUNET_MESSENGER_Room *room,
1262 const struct GNUNET_RECLAIM_Ticket *ticket)
1263{
1264 if ((! room) || (! ticket))
1265 return;
1266
1267 const struct GNUNET_CRYPTO_PublicKey *pubkey;
1268 pubkey = get_handle_pubkey (room->handle);
1269
1270 if (0 != GNUNET_memcmp (pubkey, &(ticket->identity)))
1271 {
1272 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1273 "Sending ticket aborted: Invalid identity!\n");
1274 return;
1275 }
1276
1277 struct GNUNET_MESSENGER_CheckTicket check;
1278 check.audience = &(ticket->audience);
1279 check.result = GNUNET_NO;
1280
1281 const int members = iterate_room_members (
1282 room,
1283 check_ticket_audience,
1284 &check);
1285
1286 if ((! members) || (GNUNET_YES != check.result))
1287 {
1288 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1289 "Sending ticket aborted: Audience not found!\n");
1290 return;
1291 }
1292
1293 struct GNUNET_MESSENGER_Message *message = create_message_ticket (
1294 &(ticket->rnd)
1295 );
1296
1297 if (! message)
1298 {
1299 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1300 "Sending ticket aborted: Message creation failed!\n");
1301 return;
1302 }
1303
1304 send_message_to_room_with_key (room, message, &(ticket->audience));
1305}
diff --git a/src/service/messenger/messenger_api_contact_store.c b/src/service/messenger/messenger_api_contact_store.c
index e60a8d5ca..081a8c6e9 100644
--- a/src/service/messenger/messenger_api_contact_store.c
+++ b/src/service/messenger/messenger_api_contact_store.c
@@ -143,6 +143,7 @@ get_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
143 143
144 if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (map, &hash, contact, 144 if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (map, &hash, contact,
145 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) 145 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
146
146 return contact; 147 return contact;
147 148
148 destroy_contact (contact); 149 destroy_contact (contact);
@@ -183,6 +184,7 @@ update_store_contact (struct GNUNET_MESSENGER_ContactStore *store,
183 184
184 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (map, &hash, contact, 185 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (map, &hash, contact,
185 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) 186 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
187
186 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Updating a contact failed: %s\n", 188 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Updating a contact failed: %s\n",
187 GNUNET_h2s (&hash)); 189 GNUNET_h2s (&hash));
188 } 190 }
diff --git a/src/service/messenger/messenger_api_handle.c b/src/service/messenger/messenger_api_handle.c
index a8cdf001b..1cf2bccf0 100644
--- a/src/service/messenger/messenger_api_handle.c
+++ b/src/service/messenger/messenger_api_handle.c
@@ -77,6 +77,16 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle)
77{ 77{
78 GNUNET_assert (handle); 78 GNUNET_assert (handle);
79 79
80 clear_contact_store (get_handle_contact_store (handle));
81
82 if (handle->rooms)
83 {
84 GNUNET_CONTAINER_multihashmap_iterate (handle->rooms, iterate_destroy_room,
85 NULL);
86
87 GNUNET_CONTAINER_multihashmap_destroy (handle->rooms);
88 }
89
80 if (handle->reconnect_task) 90 if (handle->reconnect_task)
81 GNUNET_SCHEDULER_cancel (handle->reconnect_task); 91 GNUNET_SCHEDULER_cancel (handle->reconnect_task);
82 92
@@ -92,16 +102,6 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle)
92 if (handle->pubkey) 102 if (handle->pubkey)
93 GNUNET_free (handle->pubkey); 103 GNUNET_free (handle->pubkey);
94 104
95 if (handle->rooms)
96 {
97 GNUNET_CONTAINER_multihashmap_iterate (handle->rooms, iterate_destroy_room,
98 NULL);
99
100 GNUNET_CONTAINER_multihashmap_destroy (handle->rooms);
101 }
102
103 clear_contact_store (get_handle_contact_store (handle));
104
105 GNUNET_free (handle); 105 GNUNET_free (handle);
106} 106}
107 107
diff --git a/src/service/messenger/messenger_api_list_tunnels.c b/src/service/messenger/messenger_api_list_tunnels.c
index 8f5b4788d..bb500233b 100644
--- a/src/service/messenger/messenger_api_list_tunnels.c
+++ b/src/service/messenger/messenger_api_list_tunnels.c
@@ -233,7 +233,8 @@ load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
233 path); 233 path);
234 234
235 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 235 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
236 | GNUNET_DISK_PERM_USER_WRITE); 236 | GNUNET_DISK_PERM_USER_WRITE
237 );
237 238
238 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open ( 239 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
239 path, GNUNET_DISK_OPEN_READ, permission 240 path, GNUNET_DISK_OPEN_READ, permission
@@ -270,7 +271,8 @@ save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels,
270 path); 271 path);
271 272
272 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ 273 enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ
273 | GNUNET_DISK_PERM_USER_WRITE); 274 | GNUNET_DISK_PERM_USER_WRITE
275 );
274 276
275 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open ( 277 struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open (
276 path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission 278 path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission
diff --git a/src/service/messenger/messenger_api_message.c b/src/service/messenger/messenger_api_message.c
index 68b6c7d20..fa281cb37 100644
--- a/src/service/messenger/messenger_api_message.c
+++ b/src/service/messenger/messenger_api_message.c
@@ -32,7 +32,7 @@
32struct GNUNET_MESSENGER_MessageSignature 32struct GNUNET_MESSENGER_MessageSignature
33{ 33{
34 struct GNUNET_CRYPTO_EccSignaturePurpose purpose; 34 struct GNUNET_CRYPTO_EccSignaturePurpose purpose;
35 struct GNUNET_HashCode hash; 35 struct GNUNET_HashCode hash GNUNET_PACKED;
36}; 36};
37 37
38struct GNUNET_MESSENGER_ShortMessage 38struct GNUNET_MESSENGER_ShortMessage
@@ -64,6 +64,9 @@ create_message (enum GNUNET_MESSENGER_MessageKind kind)
64 message->body.privacy.length = 0; 64 message->body.privacy.length = 0;
65 message->body.privacy.data = NULL; 65 message->body.privacy.data = NULL;
66 break; 66 break;
67 case GNUNET_MESSENGER_KIND_TICKET:
68 message->body.ticket.identifier = NULL;
69 break;
67 case GNUNET_MESSENGER_KIND_TRANSCRIPT: 70 case GNUNET_MESSENGER_KIND_TRANSCRIPT:
68 message->body.transcript.length = 0; 71 message->body.transcript.length = 0;
69 message->body.transcript.data = NULL; 72 message->body.transcript.data = NULL;
@@ -112,6 +115,11 @@ copy_message (const struct GNUNET_MESSENGER_Message *message)
112 copy->body.privacy.length); 115 copy->body.privacy.length);
113 116
114 break; 117 break;
118 case GNUNET_MESSENGER_KIND_TICKET:
119 copy->body.ticket.identifier = message->body.ticket.identifier?
120 GNUNET_strdup (
121 message->body.ticket.identifier) : NULL;
122 break;
115 case GNUNET_MESSENGER_KIND_TRANSCRIPT: 123 case GNUNET_MESSENGER_KIND_TRANSCRIPT:
116 copy->body.transcript.data = copy->body.transcript.length ? GNUNET_malloc ( 124 copy->body.transcript.data = copy->body.transcript.length ? GNUNET_malloc (
117 copy->body.transcript.length) : NULL; 125 copy->body.transcript.length) : NULL;
@@ -169,6 +177,10 @@ destroy_message_body (enum GNUNET_MESSENGER_MessageKind kind,
169 case GNUNET_MESSENGER_KIND_PRIVATE: 177 case GNUNET_MESSENGER_KIND_PRIVATE:
170 GNUNET_free (body->privacy.data); 178 GNUNET_free (body->privacy.data);
171 break; 179 break;
180 case GNUNET_MESSENGER_KIND_TICKET:
181 if (body->ticket.identifier)
182 GNUNET_free (body->ticket.identifier);
183 break;
172 case GNUNET_MESSENGER_KIND_TRANSCRIPT: 184 case GNUNET_MESSENGER_KIND_TRANSCRIPT:
173 GNUNET_free (body->transcript.data); 185 GNUNET_free (body->transcript.data);
174 break; 186 break;
@@ -294,10 +306,6 @@ get_message_body_kind_size (enum GNUNET_MESSENGER_MessageKind kind)
294 length += member_size (struct GNUNET_MESSENGER_Message, 306 length += member_size (struct GNUNET_MESSENGER_Message,
295 body.connection.flags); 307 body.connection.flags);
296 break; 308 break;
297 case GNUNET_MESSENGER_KIND_TICKET:
298 length += member_size (struct GNUNET_MESSENGER_Message,
299 body.ticket.identifier);
300 break;
301 case GNUNET_MESSENGER_KIND_TRANSCRIPT: 309 case GNUNET_MESSENGER_KIND_TRANSCRIPT:
302 length += member_size (struct GNUNET_MESSENGER_Message, 310 length += member_size (struct GNUNET_MESSENGER_Message,
303 body.transcript.hash); 311 body.transcript.hash);
@@ -360,6 +368,9 @@ get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind,
360 case GNUNET_MESSENGER_KIND_PRIVATE: 368 case GNUNET_MESSENGER_KIND_PRIVATE:
361 length += body->privacy.length; 369 length += body->privacy.length;
362 break; 370 break;
371 case GNUNET_MESSENGER_KIND_TICKET:
372 length += (body->ticket.identifier ? strlen (body->ticket.identifier) : 0);
373 break;
363 case GNUNET_MESSENGER_KIND_TRANSCRIPT: 374 case GNUNET_MESSENGER_KIND_TRANSCRIPT:
364 length += GNUNET_CRYPTO_public_key_get_length (&(body->transcript.key)); 375 length += GNUNET_CRYPTO_public_key_get_length (&(body->transcript.key));
365 length += body->transcript.length; 376 length += body->transcript.length;
@@ -506,11 +517,14 @@ encode_message_body (enum GNUNET_MESSENGER_MessageKind kind,
506 case GNUNET_MESSENGER_KIND_JOIN: 517 case GNUNET_MESSENGER_KIND_JOIN:
507 encode_step_key (buffer, offset, &(body->join.key), length); 518 encode_step_key (buffer, offset, &(body->join.key), length);
508 break; 519 break;
520 case GNUNET_MESSENGER_KIND_LEAVE:
521 break;
509 case GNUNET_MESSENGER_KIND_NAME: 522 case GNUNET_MESSENGER_KIND_NAME:
510 if (body->name.name) 523 if (body->name.name)
511 encode_step_ext (buffer, offset, body->name.name, min (length - offset, 524 encode_step_ext (buffer, offset, body->name.name, min (length - offset,
512 strlen ( 525 strlen (
513 body->name.name))); 526 body->name.name))
527 );
514 break; 528 break;
515 case GNUNET_MESSENGER_KIND_KEY: 529 case GNUNET_MESSENGER_KIND_KEY:
516 encode_step_key (buffer, offset, &(body->key.key), length); 530 encode_step_key (buffer, offset, &(body->key.key), length);
@@ -538,7 +552,8 @@ encode_message_body (enum GNUNET_MESSENGER_MessageKind kind,
538 if (body->text.text) 552 if (body->text.text)
539 encode_step_ext (buffer, offset, body->text.text, min (length - offset, 553 encode_step_ext (buffer, offset, body->text.text, min (length - offset,
540 strlen ( 554 strlen (
541 body->text.text))); 555 body->text.text))
556 );
542 break; 557 break;
543 case GNUNET_MESSENGER_KIND_FILE: 558 case GNUNET_MESSENGER_KIND_FILE:
544 encode_step (buffer, offset, &(body->file.key)); 559 encode_step (buffer, offset, &(body->file.key));
@@ -567,7 +582,8 @@ encode_message_body (enum GNUNET_MESSENGER_MessageKind kind,
567 encode_step (buffer, offset, &value1); 582 encode_step (buffer, offset, &value1);
568 break; 583 break;
569 case GNUNET_MESSENGER_KIND_TICKET: 584 case GNUNET_MESSENGER_KIND_TICKET:
570 encode_step (buffer, offset, &(body->ticket.identifier)); 585 encode_step_ext (buffer, offset, body->ticket.identifier,
586 min (length - offset, strlen (body->ticket.identifier)));
571 break; 587 break;
572 case GNUNET_MESSENGER_KIND_TRANSCRIPT: 588 case GNUNET_MESSENGER_KIND_TRANSCRIPT:
573 encode_step (buffer, offset, &(body->transcript.hash)); 589 encode_step (buffer, offset, &(body->transcript.hash));
@@ -711,15 +727,17 @@ decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind,
711 uint32_t value0, value1; 727 uint32_t value0, value1;
712 switch (*kind) 728 switch (*kind)
713 { 729 {
714 case GNUNET_MESSENGER_KIND_INFO: { 730 case GNUNET_MESSENGER_KIND_INFO:
715 decode_step (buffer, offset, &value0); 731 decode_step (buffer, offset, &value0);
716 732
717 body->info.messenger_version = GNUNET_be32toh (value0); 733 body->info.messenger_version = GNUNET_be32toh (value0);
718 break; 734 break;
719 } case GNUNET_MESSENGER_KIND_JOIN: { 735 case GNUNET_MESSENGER_KIND_JOIN:
720 decode_step_key (buffer, offset, &(body->join.key), length); 736 decode_step_key (buffer, offset, &(body->join.key), length);
721 break; 737 break;
722 } case GNUNET_MESSENGER_KIND_NAME: 738 case GNUNET_MESSENGER_KIND_LEAVE:
739 break;
740 case GNUNET_MESSENGER_KIND_NAME:
723 if (length > offset) 741 if (length > offset)
724 decode_step_malloc (buffer, offset, body->name.name, length - offset, 1); 742 decode_step_malloc (buffer, offset, body->name.name, length - offset, 1);
725 else 743 else
@@ -780,7 +798,11 @@ decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind,
780 body->connection.flags = GNUNET_be32toh (value1); 798 body->connection.flags = GNUNET_be32toh (value1);
781 break; 799 break;
782 case GNUNET_MESSENGER_KIND_TICKET: 800 case GNUNET_MESSENGER_KIND_TICKET:
783 decode_step (buffer, offset, &(body->ticket.identifier)); 801 if (length > offset)
802 decode_step_malloc (buffer, offset, body->ticket.identifier, length
803 - offset, 1);
804 else
805 body->ticket.identifier = NULL;
784 break; 806 break;
785 case GNUNET_MESSENGER_KIND_TRANSCRIPT: 807 case GNUNET_MESSENGER_KIND_TRANSCRIPT:
786 decode_step (buffer, offset, &(body->transcript.hash)); 808 decode_step (buffer, offset, &(body->transcript.hash));
@@ -942,7 +964,7 @@ sign_message (struct GNUNET_MESSENGER_Message *message,
942 signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); 964 signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE);
943 signature.purpose.size = htonl (sizeof(signature)); 965 signature.purpose.size = htonl (sizeof(signature));
944 966
945 GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); 967 GNUNET_memcpy (&(signature.hash), hash, sizeof(signature.hash));
946 GNUNET_CRYPTO_sign (key, &signature, &(message->header.signature)); 968 GNUNET_CRYPTO_sign (key, &signature, &(message->header.signature));
947 969
948 message->header.signature.type = key->type; 970 message->header.signature.type = key->type;
@@ -969,8 +991,8 @@ sign_message_by_peer (struct GNUNET_MESSENGER_Message *message,
969 signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); 991 signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE);
970 signature.purpose.size = htonl (sizeof(signature)); 992 signature.purpose.size = htonl (sizeof(signature));
971 993
972 GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); 994 GNUNET_memcpy (&(signature.hash), hash, sizeof(signature.hash));
973 GNUNET_CRYPTO_sign_by_peer_identity (cfg, &signature.purpose, 995 GNUNET_CRYPTO_sign_by_peer_identity (cfg, &(signature.purpose),
974 &(message->header.signature. 996 &(message->header.signature.
975 eddsa_signature)); 997 eddsa_signature));
976 998
@@ -996,7 +1018,7 @@ verify_message (const struct GNUNET_MESSENGER_Message *message,
996 signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); 1018 signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE);
997 signature.purpose.size = htonl (sizeof(signature)); 1019 signature.purpose.size = htonl (sizeof(signature));
998 1020
999 GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); 1021 GNUNET_memcpy (&(signature.hash), hash, sizeof(signature.hash));
1000 1022
1001 return GNUNET_CRYPTO_signature_verify ( 1023 return GNUNET_CRYPTO_signature_verify (
1002 GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE, &signature, 1024 GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE, &signature,
@@ -1019,10 +1041,10 @@ verify_message_by_peer (const struct GNUNET_MESSENGER_Message *message,
1019 signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); 1041 signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE);
1020 signature.purpose.size = htonl (sizeof(signature)); 1042 signature.purpose.size = htonl (sizeof(signature));
1021 1043
1022 GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); 1044 GNUNET_memcpy (&(signature.hash), hash, sizeof(signature.hash));
1023 1045
1024 return GNUNET_CRYPTO_verify_peer_identity ( 1046 return GNUNET_CRYPTO_verify_peer_identity (
1025 GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE, &signature.purpose, 1047 GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE, &(signature.purpose),
1026 &(message->header.signature. 1048 &(message->header.signature.
1027 eddsa_signature), identity); 1049 eddsa_signature), identity);
1028} 1050}
@@ -1347,7 +1369,7 @@ filter_message_sending (const struct GNUNET_MESSENGER_Message *message)
1347 case GNUNET_MESSENGER_KIND_CONNECTION: 1369 case GNUNET_MESSENGER_KIND_CONNECTION:
1348 return GNUNET_SYSERR; // Reserved for connection handling only! 1370 return GNUNET_SYSERR; // Reserved for connection handling only!
1349 case GNUNET_MESSENGER_KIND_TICKET: 1371 case GNUNET_MESSENGER_KIND_TICKET:
1350 return GNUNET_NO; // Use #GNUNET_MESSENGER_send_ticket(...) instead! 1372 return GNUNET_YES;
1351 case GNUNET_MESSENGER_KIND_TRANSCRIPT: 1373 case GNUNET_MESSENGER_KIND_TRANSCRIPT:
1352 return GNUNET_NO; // Use #GNUNET_MESSENGER_send_message(...) with a contact instead! 1374 return GNUNET_NO; // Use #GNUNET_MESSENGER_send_message(...) with a contact instead!
1353 case GNUNET_MESSENGER_KIND_TAG: 1375 case GNUNET_MESSENGER_KIND_TAG:
diff --git a/src/service/messenger/messenger_api_message_control.c b/src/service/messenger/messenger_api_message_control.c
index 30c52587f..e8d0333dc 100644
--- a/src/service/messenger/messenger_api_message_control.c
+++ b/src/service/messenger/messenger_api_message_control.c
@@ -183,7 +183,7 @@ iterate_message_control (void *cls,
183 const struct GNUNET_ShortHashCode *key, 183 const struct GNUNET_ShortHashCode *key,
184 void *value) 184 void *value)
185{ 185{
186 GNUNET_assert ((cls) && (key) && (value)); 186 GNUNET_assert ((key) && (value));
187 187
188 struct GNUNET_MESSENGER_MessageControlQueue *queue = value; 188 struct GNUNET_MESSENGER_MessageControlQueue *queue = value;
189 189
@@ -222,6 +222,9 @@ process_message_control (struct GNUNET_MESSENGER_MessageControl *control,
222 struct GNUNET_CONTAINER_MultiShortmap *map = NULL; 222 struct GNUNET_CONTAINER_MultiShortmap *map = NULL;
223 const struct GNUNET_ShortHashCode *id = &(message->header.sender_id); 223 const struct GNUNET_ShortHashCode *id = &(message->header.sender_id);
224 224
225 if (GNUNET_YES == is_peer_message (message))
226 map = control->peer_messages;
227
225 switch (message->header.kind) 228 switch (message->header.kind)
226 { 229 {
227 case GNUNET_MESSENGER_KIND_JOIN: 230 case GNUNET_MESSENGER_KIND_JOIN:
diff --git a/src/service/messenger/messenger_api_message_kind.c b/src/service/messenger/messenger_api_message_kind.c
index 33338af9d..d423c5dda 100644
--- a/src/service/messenger/messenger_api_message_kind.c
+++ b/src/service/messenger/messenger_api_message_kind.c
@@ -98,7 +98,8 @@ create_message_id (const struct GNUNET_ShortHashCode *unique_id)
98 return NULL; 98 return NULL;
99 99
100 GNUNET_memcpy (&(message->body.id.id), unique_id, sizeof(struct 100 GNUNET_memcpy (&(message->body.id.id), unique_id, sizeof(struct
101 GNUNET_ShortHashCode)); 101 GNUNET_ShortHashCode)
102 );
102 103
103 return message; 104 return message;
104} 105}
@@ -143,7 +144,8 @@ create_message_invite (const struct GNUNET_PeerIdentity *door,
143 return NULL; 144 return NULL;
144 145
145 GNUNET_memcpy (&(message->body.invite.door), door, sizeof(struct 146 GNUNET_memcpy (&(message->body.invite.door), door, sizeof(struct
146 GNUNET_PeerIdentity)); 147 GNUNET_PeerIdentity)
148 );
147 GNUNET_memcpy (&(message->body.invite.key), key, sizeof(struct 149 GNUNET_memcpy (&(message->body.invite.key), key, sizeof(struct
148 GNUNET_HashCode)); 150 GNUNET_HashCode));
149 151
@@ -190,9 +192,9 @@ create_message_delete (const struct GNUNET_HashCode *hash,
190 192
191 193
192struct GNUNET_MESSENGER_Message* 194struct GNUNET_MESSENGER_Message*
193create_message_ticket (const struct GNUNET_RECLAIM_Identifier *identifier) 195create_message_ticket (const struct GNUNET_RECLAIM_Ticket *ticket)
194{ 196{
195 if (! identifier) 197 if (! ticket)
196 return NULL; 198 return NULL;
197 199
198 struct GNUNET_MESSENGER_Message *message = create_message ( 200 struct GNUNET_MESSENGER_Message *message = create_message (
@@ -201,8 +203,7 @@ create_message_ticket (const struct GNUNET_RECLAIM_Identifier *identifier)
201 if (! message) 203 if (! message)
202 return NULL; 204 return NULL;
203 205
204 GNUNET_memcpy (&(message->body.ticket.identifier), identifier, 206 message->body.ticket.identifier = GNUNET_strdup (ticket->gns_name);
205 sizeof(struct GNUNET_RECLAIM_Identifier));
206 207
207 return message; 208 return message;
208} 209}
diff --git a/src/service/messenger/messenger_api_message_kind.h b/src/service/messenger/messenger_api_message_kind.h
index a5bb12947..5f4107f61 100644
--- a/src/service/messenger/messenger_api_message_kind.h
+++ b/src/service/messenger/messenger_api_message_kind.h
@@ -27,9 +27,8 @@
27#define GNUNET_MESSENGER_API_MESSAGE_KIND_H 27#define GNUNET_MESSENGER_API_MESSAGE_KIND_H
28 28
29#include "gnunet_messenger_service.h" 29#include "gnunet_messenger_service.h"
30#include "gnunet_reclaim_lib.h" 30#include "gnunet_reclaim_service.h"
31#include "gnunet_util_lib.h" 31#include "gnunet_util_lib.h"
32#include "gnunet_time_lib.h"
33 32
34/** 33/**
35 * Creates and allocates a new join message containing the clients public <i>key</i>. 34 * Creates and allocates a new join message containing the clients public <i>key</i>.
@@ -134,6 +133,6 @@ create_message_delete (const struct GNUNET_HashCode *hash,
134 * @return New message 133 * @return New message
135 */ 134 */
136struct GNUNET_MESSENGER_Message* 135struct GNUNET_MESSENGER_Message*
137create_message_ticket (const struct GNUNET_RECLAIM_Identifier *identifier); 136create_message_ticket (const struct GNUNET_RECLAIM_Ticket *ticket);
138 137
139#endif //GNUNET_MESSENGER_API_MESSAGE_KIND_H 138#endif //GNUNET_MESSENGER_API_MESSAGE_KIND_H
diff --git a/src/service/messenger/messenger_api_queue_messages.c b/src/service/messenger/messenger_api_queue_messages.c
index bcf901f3c..33e591da3 100644
--- a/src/service/messenger/messenger_api_queue_messages.c
+++ b/src/service/messenger/messenger_api_queue_messages.c
@@ -85,6 +85,9 @@ enqueue_to_messages (struct GNUNET_MESSENGER_QueueMessages *messages,
85 85
86 if (! element->message) 86 if (! element->message)
87 { 87 {
88 if (element->transcript)
89 destroy_message (element->transcript);
90
88 GNUNET_free (element); 91 GNUNET_free (element);
89 return; 92 return;
90 } 93 }
@@ -117,6 +120,8 @@ dequeue_from_messages (struct GNUNET_MESSENGER_QueueMessages *messages,
117 120
118 if (transcript) 121 if (transcript)
119 *transcript = element->transcript; 122 *transcript = element->transcript;
123 else if (element->transcript)
124 destroy_message (element->transcript);
120 125
121 GNUNET_CONTAINER_DLL_remove (messages->head, messages->tail, element); 126 GNUNET_CONTAINER_DLL_remove (messages->head, messages->tail, element);
122 127
diff --git a/src/service/messenger/messenger_api_room.c b/src/service/messenger/messenger_api_room.c
index e1970b668..cddd43b22 100644
--- a/src/service/messenger/messenger_api_room.c
+++ b/src/service/messenger/messenger_api_room.c
@@ -300,6 +300,7 @@ handle_join_message (struct GNUNET_MESSENGER_Room *room,
300 .sender_id), 300 .sender_id),
301 entry->sender, 301 entry->sender,
302 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE))) 302 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)))
303
303 increase_contact_rc (entry->sender); 304 increase_contact_rc (entry->sender);
304} 305}
305 306
@@ -393,6 +394,7 @@ handle_id_message (struct GNUNET_MESSENGER_Room *room,
393 id.id), 394 id.id),
394 entry->sender, 395 entry->sender,
395 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE))) 396 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)))
397
396 return; 398 return;
397 399
398 struct GNUNET_HashCode context, next_context; 400 struct GNUNET_HashCode context, next_context;
@@ -574,7 +576,8 @@ read_transcript:
574 576
575 original->recipient = get_store_contact (store, 577 original->recipient = get_store_contact (store,
576 NULL, 578 NULL,
577 &(entry->message->body.transcript.key)); 579 &(entry->message->body.transcript.key
580 ));
578 581
579 if (original->message) 582 if (original->message)
580 { 583 {
@@ -826,12 +829,14 @@ link_room_message (struct GNUNET_MESSENGER_Room *room,
826 return; 829 return;
827 830
828 struct GNUNET_HashCode *value = GNUNET_memdup (other, sizeof(struct 831 struct GNUNET_HashCode *value = GNUNET_memdup (other, sizeof(struct
829 GNUNET_HashCode)); 832 GNUNET_HashCode))
833 ;
830 if (! value) 834 if (! value)
831 return; 835 return;
832 836
833 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (room->links, hash, value, 837 if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (room->links, hash, value,
834 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)) 838 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE))
839
835 GNUNET_free (value); 840 GNUNET_free (value);
836} 841}
837 842
diff --git a/src/service/messenger/test_messenger.c b/src/service/messenger/test_messenger.c
index 3c3dbd14d..4f7a51e34 100644
--- a/src/service/messenger/test_messenger.c
+++ b/src/service/messenger/test_messenger.c
@@ -74,6 +74,7 @@ end (void *cls)
74 messenger = NULL; 74 messenger = NULL;
75 } 75 }
76 76
77 GNUNET_CRYPTO_private_key_clear (&identity);
77 status = 0; 78 status = 0;
78} 79}
79 80
diff --git a/src/service/messenger/test_messenger_plugin_cmd_simple_join.c b/src/service/messenger/test_messenger_plugin_cmd_simple_join.c
index 4f50e4c06..c5d2be4e0 100644
--- a/src/service/messenger/test_messenger_plugin_cmd_simple_join.c
+++ b/src/service/messenger/test_messenger_plugin_cmd_simple_join.c
@@ -25,15 +25,13 @@
25 */ 25 */
26 26
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_testing_barrier.h"
29#include "gnunet_testing_netjail_lib.h"
30#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
31#include "gnunet_transport_application_service.h" 29#include "gnunet_transport_application_service.h"
32#include "gnunet_transport_core_service.h" 30#include "gnunet_transport_core_service.h"
33#include "gnunet_testing_barrier.h"
34#include "gnunet_core_service.h" 31#include "gnunet_core_service.h"
35#include "gnunet_core_testing_lib.h" 32#include "gnunet_testing_lib.h"
36#include "gnunet_transport_testing_ng_lib.h" 33#include "gnunet_testing_core_lib.h"
34#include "gnunet_testing_transport_lib.h"
37#include "messenger-testing-cmds.h" 35#include "messenger-testing-cmds.h"
38 36
39/** 37/**
diff --git a/src/service/messenger/messenger-testing.c b/src/service/messenger/testing_messenger.c
index b3f7e3137..b3f7e3137 100644
--- a/src/service/messenger/messenger-testing.c
+++ b/src/service/messenger/testing_messenger.c
diff --git a/src/service/messenger/messenger-testing.h b/src/service/messenger/testing_messenger.h
index 850c37243..850c37243 100644
--- a/src/service/messenger/messenger-testing.h
+++ b/src/service/messenger/testing_messenger.h
diff --git a/src/service/messenger/messenger_api_cmd_join_room.c b/src/service/messenger/testing_messenger_cmd_join_room.c
index 8151dc88e..85f0d30da 100644
--- a/src/service/messenger/messenger_api_cmd_join_room.c
+++ b/src/service/messenger/testing_messenger_cmd_join_room.c
@@ -23,10 +23,10 @@
23 * @brief cmd to join a room in a messenger service. 23 * @brief cmd to join a room in a messenger service.
24 * @author Tobias Frisch 24 * @author Tobias Frisch
25 */ 25 */
26 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_core_testing_lib.h" 28#include "gnunet_testing_core_lib.h"
29#include "gnunet_transport_testing_ng_lib.h" 29#include "gnunet_testing_transport_lib.h"
30#include "gnunet_messenger_service.h" 30#include "gnunet_messenger_service.h"
31#include "messenger-testing-cmds.h" 31#include "messenger-testing-cmds.h"
32 32
@@ -177,6 +177,5 @@ GNUNET_MESSENGER_cmd_join_room (const char *label,
177 label, 177 label,
178 &join_room_run, 178 &join_room_run,
179 &join_room_cleanup, 179 &join_room_cleanup,
180 NULL,
181 NULL); 180 NULL);
182} 181}
diff --git a/src/service/messenger/messenger_api_cmd_start_service.c b/src/service/messenger/testing_messenger_cmd_start_service.c
index 49e20eac4..eba3e1e4f 100644
--- a/src/service/messenger/messenger_api_cmd_start_service.c
+++ b/src/service/messenger/testing_messenger_cmd_start_service.c
@@ -23,11 +23,10 @@
23 * @brief cmd to start a messenger service. 23 * @brief cmd to start a messenger service.
24 * @author Tobias Frisch 24 * @author Tobias Frisch
25 */ 25 */
26 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_lib.h"
29#include "gnunet_testing_netjail_lib.h" 29#include "gnunet_testing_transport_lib.h"
30#include "gnunet_transport_testing_ng_lib.h"
31#include "gnunet_messenger_service.h" 30#include "gnunet_messenger_service.h"
32#include "messenger-testing-cmds.h" 31#include "messenger-testing-cmds.h"
33 32
@@ -58,7 +57,8 @@ on_message_cb (void *cls,
58 return; 57 return;
59 58
60 if (GNUNET_OK != GNUNET_CONTAINER_multipeermap_put (rs->doors, 59 if (GNUNET_OK != GNUNET_CONTAINER_multipeermap_put (rs->doors,
61 &(message->body.peer.peer), 60 &(message->body.peer.peer)
61 ,
62 NULL, 62 NULL,
63 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE)) 63 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE))
64 { 64 {
@@ -167,6 +167,5 @@ GNUNET_MESSENGER_cmd_start_service (const char *label,
167 label, 167 label,
168 &start_service_run, 168 &start_service_run,
169 &start_service_cleanup, 169 &start_service_cleanup,
170 &start_service_traits, 170 &start_service_traits);
171 NULL);
172} 171}
diff --git a/src/service/messenger/messenger_api_cmd_stop_service.c b/src/service/messenger/testing_messenger_cmd_stop_service.c
index 774237d25..e6b79d395 100644
--- a/src/service/messenger/messenger_api_cmd_stop_service.c
+++ b/src/service/messenger/testing_messenger_cmd_stop_service.c
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_lib.h"
29#include "gnunet_messenger_service.h" 29#include "gnunet_messenger_service.h"
30#include "messenger-testing-cmds.h" 30#include "messenger-testing-cmds.h"
31 31
@@ -91,6 +91,5 @@ GNUNET_MESSENGER_cmd_stop_service (const char *label,
91 label, 91 label,
92 &stop_service_run, 92 &stop_service_run,
93 &stop_service_cleanup, 93 &stop_service_cleanup,
94 NULL,
95 NULL); 94 NULL);
96} 95}
diff --git a/src/service/messenger/messenger_api_traits.c b/src/service/messenger/testing_messenger_traits.c
index b6affc90d..b6affc90d 100644
--- a/src/service/messenger/messenger_api_traits.c
+++ b/src/service/messenger/testing_messenger_traits.c
diff --git a/src/service/namecache/Makefile.am b/src/service/namecache/Makefile.am
index 78e9eb48c..7a8305491 100644
--- a/src/service/namecache/Makefile.am
+++ b/src/service/namecache/Makefile.am
@@ -20,8 +20,8 @@ TESTING_TESTS = \
20 test_namecache_api_cache_block 20 test_namecache_api_cache_block
21 21
22if HAVE_SQLITE 22if HAVE_SQLITE
23check_PROGRAMS = \ 23#check_PROGRAMS = \
24 $(TESTING_TESTS) 24# $(TESTING_TESTS)
25endif 25endif
26 26
27if ENABLE_TEST_RUN 27if ENABLE_TEST_RUN
diff --git a/src/service/namestore/Makefile.am b/src/service/namestore/Makefile.am
index 514c8bec6..68ba883ee 100644
--- a/src/service/namestore/Makefile.am
+++ b/src/service/namestore/Makefile.am
@@ -87,9 +87,9 @@ POSTGRES_TESTS += test_namestore_api_edit_records_postgres
87endif 87endif
88endif 88endif
89 89
90check_PROGRAMS = \ 90#check_PROGRAMS = \
91 $(SQLITE_TESTS) \ 91# $(SQLITE_TESTS) \
92 $(POSTGRES_TESTS) 92# $(POSTGRES_TESTS)
93 93
94if ENABLE_TEST_RUN 94if ENABLE_TEST_RUN
95AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 95AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
@@ -381,4 +381,3 @@ EXTRA_DIST = \
381 test_namestore_api_sqlite.conf \ 381 test_namestore_api_sqlite.conf \
382 perf_namestore_api_postgres.conf \ 382 perf_namestore_api_postgres.conf \
383 perf_namestore_api_sqlite.conf 383 perf_namestore_api_sqlite.conf
384
diff --git a/src/service/namestore/gnunet-service-namestore.c b/src/service/namestore/gnunet-service-namestore.c
index f29058d0e..6f3a77b84 100644
--- a/src/service/namestore/gnunet-service-namestore.c
+++ b/src/service/namestore/gnunet-service-namestore.c
@@ -1091,7 +1091,7 @@ struct RecordLookupContext
1091 /** 1091 /**
1092 * The editor hint for set 1092 * The editor hint for set
1093 */ 1093 */
1094 const char *editor_hint; 1094 char *editor_hint;
1095 1095
1096 /** 1096 /**
1097 * The record result. 1097 * The record result.
@@ -1157,7 +1157,8 @@ lookup_it (void *cls,
1157 if (0 != strcmp (label, rlc->label)) 1157 if (0 != strcmp (label, rlc->label))
1158 return; 1158 return;
1159 rlc->found = GNUNET_YES; 1159 rlc->found = GNUNET_YES;
1160 rlc->editor_hint = editor_hint; 1160 if (NULL == rlc->editor_hint)
1161 rlc->editor_hint = GNUNET_strdup (editor_hint);
1161 if (GNUNET_OK != GNUNET_GNSRECORD_normalize_record_set (rlc->label, 1162 if (GNUNET_OK != GNUNET_GNSRECORD_normalize_record_set (rlc->label,
1162 rd_nf, 1163 rd_nf,
1163 rd_count_nf, 1164 rd_count_nf,
@@ -1332,6 +1333,7 @@ handle_edit_record_set (void *cls, const struct EditRecordSetMessage *er_msg)
1332 return; 1333 return;
1333 } 1334 }
1334 name_len = strlen (conv_name) + 1; 1335 name_len = strlen (conv_name) + 1;
1336 rlc.editor_hint = NULL;
1335 rlc.label = conv_name; 1337 rlc.label = conv_name;
1336 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1338 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1337 "Looking up without filter\n"); 1339 "Looking up without filter\n");
@@ -1370,6 +1372,7 @@ handle_edit_record_set (void *cls, const struct EditRecordSetMessage *er_msg)
1370 GNUNET_memcpy ((char*) &rer_msg[1] + old_editor_hint_len, rlc.res_rd, 1372 GNUNET_memcpy ((char*) &rer_msg[1] + old_editor_hint_len, rlc.res_rd,
1371 rlc.rd_ser_len); 1373 rlc.rd_ser_len);
1372 GNUNET_MQ_send (nc->mq, env); 1374 GNUNET_MQ_send (nc->mq, env);
1375 GNUNET_free (rlc.editor_hint);
1373 GNUNET_free (rlc.res_rd); 1376 GNUNET_free (rlc.res_rd);
1374 GNUNET_free (conv_name); 1377 GNUNET_free (conv_name);
1375} 1378}
@@ -1566,6 +1569,7 @@ handle_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg)
1566 return; 1569 return;
1567 } 1570 }
1568 name_len = strlen (conv_name) + 1; 1571 name_len = strlen (conv_name) + 1;
1572 rlc.editor_hint = NULL;
1569 rlc.label = conv_name; 1573 rlc.label = conv_name;
1570 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1574 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1571 "Looking up with filter %u\n", ntohs (ll_msg->filter)); 1575 "Looking up with filter %u\n", ntohs (ll_msg->filter));
@@ -1601,6 +1605,7 @@ handle_record_lookup (void *cls, const struct LabelLookupMessage *ll_msg)
1601 GNUNET_memcpy (res_name, conv_name, name_len); 1605 GNUNET_memcpy (res_name, conv_name, name_len);
1602 GNUNET_memcpy (&res_name[name_len], rlc.res_rd, rlc.rd_ser_len); 1606 GNUNET_memcpy (&res_name[name_len], rlc.res_rd, rlc.rd_ser_len);
1603 GNUNET_MQ_send (nc->mq, env); 1607 GNUNET_MQ_send (nc->mq, env);
1608 GNUNET_free (rlc.editor_hint);
1604 GNUNET_free (rlc.res_rd); 1609 GNUNET_free (rlc.res_rd);
1605 GNUNET_free (conv_name); 1610 GNUNET_free (conv_name);
1606} 1611}
diff --git a/src/service/namestore/meson.build b/src/service/namestore/meson.build
index ba4110729..9e6678deb 100644
--- a/src/service/namestore/meson.build
+++ b/src/service/namestore/meson.build
@@ -53,6 +53,8 @@ configure_file(copy: true,
53 input: 'test_namestore_api_postgres.conf', 53 input: 'test_namestore_api_postgres.conf',
54 output: 'test_namestore_api_postgres.conf') 54 output: 'test_namestore_api_postgres.conf')
55 55
56if false
57
56namestoreapitestnames = [ 58namestoreapitestnames = [
57 'test_namestore_api_lookup_nick', 59 'test_namestore_api_lookup_nick',
58 'test_namestore_api_monitoring', 60 'test_namestore_api_monitoring',
@@ -100,4 +102,6 @@ foreach tn : namestoreapitestnames
100 endif 102 endif
101endforeach 103endforeach
102 104
105endif
106
103# FIXME perf tests missing 107# FIXME perf tests missing
diff --git a/src/service/nat/gnunet-service-nat.c b/src/service/nat/gnunet-service-nat.c
index 08c87d0be..a36e8da1c 100644
--- a/src/service/nat/gnunet-service-nat.c
+++ b/src/service/nat/gnunet-service-nat.c
@@ -1816,10 +1816,9 @@ check_request_connection_reversal (void *cls,
1816 * @param message the message received 1816 * @param message the message received
1817 */ 1817 */
1818static void 1818static void
1819handle_request_connection_reversal (void *cls, 1819handle_request_connection_reversal (
1820 const struct 1820 void *cls,
1821 GNUNET_NAT_RequestConnectionReversalMessage 1821 const struct GNUNET_NAT_RequestConnectionReversalMessage *message)
1822 *message)
1823{ 1822{
1824 struct ClientHandle *ch = cls; 1823 struct ClientHandle *ch = cls;
1825 const char *buf = (const char *) &message[1]; 1824 const char *buf = (const char *) &message[1];
@@ -1864,6 +1863,71 @@ handle_request_connection_reversal (void *cls,
1864 1863
1865 1864
1866/** 1865/**
1866 * Check validity of #GNUNET_MESSAGE_TYPE_NAT_ADD_GLOBAL_ADDRESS message from
1867 * client.
1868 *
1869 * @param cls client who sent the message
1870 * @param message the message received
1871 * @return #GNUNET_OK if message is well-formed
1872 */
1873static enum GNUNET_GenericReturnValue
1874check_add_global_address (
1875 void *cls,
1876 const struct GNUNET_NAT_AddGlobalAddressMessage *message)
1877{
1878 const char *buf = (const char *) &message[1];
1879 uint16_t blen = ntohs (message->address_length);
1880 size_t left = ntohs (message->header.size) - sizeof(*message);
1881
1882 if (left != ntohs (message->address_length))
1883 {
1884 GNUNET_break_op (0);
1885 return GNUNET_SYSERR;
1886 }
1887 if ('\0' != buf[blen - 1])
1888 {
1889 GNUNET_break_op (0);
1890 return GNUNET_SYSERR;
1891 }
1892 return GNUNET_OK;
1893}
1894
1895
1896/**
1897 * Handle #GNUNET_MESSAGE_TYPE_NAT_ADD_GLOBAL_ADDRESS message from
1898 * client.
1899 *
1900 * @param cls client who sent the message
1901 * @param message the message received
1902 */
1903static void
1904handle_add_global_address (
1905 void *cls,
1906 const struct GNUNET_NAT_AddGlobalAddressMessage *message)
1907{
1908 struct ClientHandle *ch = cls;
1909 const char *buf = (const char *) &message[1];
1910 uint16_t blen = ntohs (message->address_length);
1911 struct sockaddr_in sockaddr_ipv4 = {
1912 .sin_family = AF_INET
1913 };
1914
1915 GNUNET_assert ('\0' == buf[blen - 1]);
1916 if (1 != inet_pton (AF_INET,
1917 buf,
1918 &sockaddr_ipv4.sin_addr))
1919 {
1920 GNUNET_break (0);
1921 GNUNET_SERVICE_client_continue (ch->client);
1922 return;
1923 }
1924 notify_clients_stun_change (&sockaddr_ipv4,
1925 GNUNET_YES);
1926 GNUNET_SERVICE_client_continue (ch->client);
1927}
1928
1929
1930/**
1867 * Task run during shutdown. 1931 * Task run during shutdown.
1868 * 1932 *
1869 * @param cls unused 1933 * @param cls unused
@@ -2060,6 +2124,10 @@ GNUNET_SERVICE_MAIN
2060 GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL, 2124 GNUNET_MESSAGE_TYPE_NAT_REQUEST_CONNECTION_REVERSAL,
2061 struct GNUNET_NAT_RequestConnectionReversalMessage, 2125 struct GNUNET_NAT_RequestConnectionReversalMessage,
2062 NULL), 2126 NULL),
2127 GNUNET_MQ_hd_var_size (add_global_address,
2128 GNUNET_MESSAGE_TYPE_NAT_ADD_GLOBAL_ADDRESS,
2129 struct GNUNET_NAT_AddGlobalAddressMessage,
2130 NULL),
2063 GNUNET_MQ_handler_end ()); 2131 GNUNET_MQ_handler_end ());
2064 2132
2065 2133
diff --git a/src/service/nat/nat.h b/src/service/nat/nat.h
index 1d8648aaf..30e6f0901 100644
--- a/src/service/nat/nat.h
+++ b/src/service/nat/nat.h
@@ -218,6 +218,25 @@ struct GNUNET_NAT_AddressChangeNotificationMessage
218}; 218};
219 219
220 220
221/**
222 * Message sent by client to add a global address.
223 */
224struct GNUNET_NAT_AddGlobalAddressMessage
225{
226 /**
227 * Header with type #GNUNET_MESSAGE_TYPE_NAT_ADD_GLOBAL_ADDRESS
228 */
229 struct GNUNET_MessageHeader header;
230
231 /**
232 * Length of the address following the struct, in NBO.
233 */
234 unsigned int address_length;
235
236 /* Followed by the address to add */
237};
238
239
221GNUNET_NETWORK_STRUCT_END 240GNUNET_NETWORK_STRUCT_END
222 241
223#endif 242#endif
diff --git a/src/service/nat/nat_api.c b/src/service/nat/nat_api.c
index 31f8f388d..52c74d5db 100644
--- a/src/service/nat/nat_api.c
+++ b/src/service/nat/nat_api.c
@@ -455,6 +455,34 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg,
455 return nh; 455 return nh;
456} 456}
457 457
458void
459GNUNET_NAT_add_global_address (struct GNUNET_NAT_Handle *nh,
460 char *addr,
461 unsigned int address_length)
462{
463 struct GNUNET_NAT_AddGlobalAddressMessage *aam;
464 struct GNUNET_MQ_Envelope *env;
465 //char *address_without_port = get_address_without_port (addr);
466 //unsigned int address_len_without_port = strlen (address_without_port);
467 char *off;
468
469 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
470 "natting address %s length %u\n",
471 addr,
472 address_length);
473
474 env = GNUNET_MQ_msg_extra (aam,
475 address_length,
476 GNUNET_MESSAGE_TYPE_NAT_ADD_GLOBAL_ADDRESS);
477 aam->address_length = htons (address_length);
478 off = (char *) &aam[1];
479 GNUNET_memcpy (off, addr, address_length);
480 GNUNET_MQ_send (nh->mq,
481 env);
482 //GNUNET_free (address_without_port);
483}
484
485
458 486
459/** 487/**
460 * Check if an incoming message is a STUN message. 488 * Check if an incoming message is a STUN message.
diff --git a/src/service/nse/Makefile.am b/src/service/nse/Makefile.am
index 40690e81c..99c8c3e5a 100644
--- a/src/service/nse/Makefile.am
+++ b/src/service/nse/Makefile.am
@@ -49,9 +49,9 @@ if HAVE_BENCHMARKS
49endif 49endif
50 50
51check_PROGRAMS = \ 51check_PROGRAMS = \
52 test_nse_api \ 52 perf_kdf
53 perf_kdf \ 53# test_nse_api \
54 $(MULTIPEER_TEST) 54# $(MULTIPEER_TEST)
55 55
56if ENABLE_TEST_RUN 56if ENABLE_TEST_RUN
57AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 57AM_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/service/peerstore/Makefile.am b/src/service/peerstore/Makefile.am
index 1f6385bb7..3cdb01912 100644
--- a/src/service/peerstore/Makefile.am
+++ b/src/service/peerstore/Makefile.am
@@ -41,11 +41,11 @@ libgnunetpeerstore_la_LDFLAGS = \
41 $(GN_LIBINTL) \ 41 $(GN_LIBINTL) \
42 $(GN_LIB_LDFLAGS) 42 $(GN_LIB_LDFLAGS)
43 43
44check_PROGRAMS = \ 44#check_PROGRAMS = \
45 test_peerstore_api_store \ 45# test_peerstore_api_store \
46 test_peerstore_api_iterate \ 46# test_peerstore_api_iterate \
47 test_peerstore_api_watch \ 47# test_peerstore_api_watch \
48 perf_peerstore_store 48# perf_peerstore_store
49 49
50EXTRA_DIST = \ 50EXTRA_DIST = \
51 test_peerstore_api_data.conf 51 test_peerstore_api_data.conf
diff --git a/src/service/peerstore/gnunet-service-peerstore.c b/src/service/peerstore/gnunet-service-peerstore.c
index 37af3af56..9f3eb9bde 100644
--- a/src/service/peerstore/gnunet-service-peerstore.c
+++ b/src/service/peerstore/gnunet-service-peerstore.c
@@ -23,9 +23,9 @@
23 * @brief peerstore service implementation 23 * @brief peerstore service implementation
24 * @author Omar Tarabai 24 * @author Omar Tarabai
25 */ 25 */
26#include "platform.h"
26#include "gnunet_peerstore_service.h" 27#include "gnunet_peerstore_service.h"
27#include "gnunet_protocols.h" 28#include "gnunet_protocols.h"
28#include "platform.h"
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "peerstore.h" 30#include "peerstore.h"
31#include "gnunet_peerstore_plugin.h" 31#include "gnunet_peerstore_plugin.h"
@@ -491,6 +491,16 @@ iterate_proc (void *cls,
491 proc->limit--; 491 proc->limit--;
492} 492}
493 493
494
495static void
496destroy_iteration (struct Iteration *ic)
497{
498 GNUNET_free (ic->key);
499 GNUNET_free (ic->sub_system);
500 GNUNET_free (ic);
501}
502
503
494/** 504/**
495 * Function called once we are done with the iteration and 505 * Function called once we are done with the iteration and
496 * allow the zone iteration client to send us more messages. 506 * allow the zone iteration client to send us more messages.
@@ -512,15 +522,12 @@ iteration_done_client_continue (struct Iteration *ic)
512 endmsg->rid = htons (ic->request_id); 522 endmsg->rid = htons (ic->request_id);
513 endmsg->result = htonl (GNUNET_OK); 523 endmsg->result = htonl (GNUNET_OK);
514 GNUNET_MQ_send (ic->pc->mq, env); 524 GNUNET_MQ_send (ic->pc->mq, env);
515 GNUNET_free (ic->key);
516 GNUNET_free (ic->sub_system);
517 GNUNET_CONTAINER_DLL_remove (ic->pc->op_head, ic->pc->op_tail, ic); 525 GNUNET_CONTAINER_DLL_remove (ic->pc->op_head, ic->pc->op_tail, ic);
518 GNUNET_free (ic); 526 destroy_iteration (ic);
519 return; 527 return;
520} 528}
521 529
522 530
523
524/** 531/**
525 * Perform the next round of the zone iteration. 532 * Perform the next round of the zone iteration.
526 * 533 *
@@ -657,7 +664,7 @@ handle_iterate_stop (void *cls,
657 return; 664 return;
658 } 665 }
659 GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, ic); 666 GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, ic);
660 GNUNET_free (ic); 667 destroy_iteration (ic);
661 GNUNET_SERVICE_client_continue (pc->client); 668 GNUNET_SERVICE_client_continue (pc->client);
662} 669}
663 670
@@ -803,8 +810,8 @@ monitor_iteration_next (void *cls)
803 { 810 {
804 GNUNET_free (mc->key); 811 GNUNET_free (mc->key);
805 GNUNET_free (mc->sub_system); 812 GNUNET_free (mc->sub_system);
806 GNUNET_free (mc);
807 GNUNET_SERVICE_client_drop (mc->pc->client); 813 GNUNET_SERVICE_client_drop (mc->pc->client);
814 GNUNET_free (mc);
808 return; 815 return;
809 } 816 }
810 if (GNUNET_NO == ret) 817 if (GNUNET_NO == ret)
@@ -1090,13 +1097,15 @@ client_disconnect_cb (void *cls,
1090 GNUNET_SCHEDULER_cancel (mo->sa_wait_warning); 1097 GNUNET_SCHEDULER_cancel (mo->sa_wait_warning);
1091 mo->sa_wait_warning = NULL; 1098 mo->sa_wait_warning = NULL;
1092 } 1099 }
1100 GNUNET_free (mo->sub_system);
1101 GNUNET_free (mo->key);
1093 GNUNET_free (mo); 1102 GNUNET_free (mo);
1094 break; 1103 break;
1095 } 1104 }
1096 while (NULL != (iter = pc->op_head)) 1105 while (NULL != (iter = pc->op_head))
1097 { 1106 {
1098 GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, iter); 1107 GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, iter);
1099 GNUNET_free (iter); 1108 destroy_iteration (iter);
1100 } 1109 }
1101 GNUNET_free (pc); 1110 GNUNET_free (pc);
1102} 1111}
diff --git a/src/service/peerstore/meson.build b/src/service/peerstore/meson.build
index 8f0950b93..2c1ef4a67 100644
--- a/src/service/peerstore/meson.build
+++ b/src/service/peerstore/meson.build
@@ -38,6 +38,8 @@ executable ('gnunet-service-peerstore',
38 install: true, 38 install: true,
39 install_dir: get_option('libdir') / 'gnunet' / 'libexec') 39 install_dir: get_option('libdir') / 'gnunet' / 'libexec')
40 40
41if false
42
41testpeerstore_api_iterate = executable ('test_peerstore_api_iterate', 43testpeerstore_api_iterate = executable ('test_peerstore_api_iterate',
42 ['test_peerstore_api_iterate.c'], 44 ['test_peerstore_api_iterate.c'],
43 dependencies: [ 45 dependencies: [
@@ -90,6 +92,4 @@ test('test_peerstore_api_iterate', testpeerstore_api_iterate,
90test('perf_peerstore_api_store', testpeerstore_api_perf, 92test('perf_peerstore_api_store', testpeerstore_api_perf,
91 suite: 'peerstore', workdir: meson.current_build_dir()) 93 suite: 'peerstore', workdir: meson.current_build_dir())
92 94
93 95endif \ No newline at end of file
94
95
diff --git a/src/service/peerstore/peerstore_api.c b/src/service/peerstore/peerstore_api.c
index 19cb1213e..45f347b6a 100644
--- a/src/service/peerstore/peerstore_api.c
+++ b/src/service/peerstore/peerstore_api.c
@@ -23,11 +23,9 @@
23 * @author Omar Tarabai 23 * @author Omar Tarabai
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 */ 25 */
26#include "gnunet_time_lib.h"
27#include "platform.h" 26#include "platform.h"
28#include "gnunet_common.h"
29#include "gnunet_protocols.h"
30#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_protocols.h"
31#include "gnunet_hello_uri_lib.h" 29#include "gnunet_hello_uri_lib.h"
32#include "peerstore.h" 30#include "peerstore.h"
33#include "peerstore_common.h" 31#include "peerstore_common.h"
@@ -446,6 +444,7 @@ GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h)
446{ 444{
447 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnect initiated from client.\n"); 445 LOG (GNUNET_ERROR_TYPE_DEBUG, "Disconnect initiated from client.\n");
448 disconnect (h); 446 disconnect (h);
447 GNUNET_free (h);
449} 448}
450 449
451 450
@@ -453,6 +452,16 @@ GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h)
453/******************* STORE FUNCTIONS *********************/ 452/******************* STORE FUNCTIONS *********************/
454/******************************************************************************/ 453/******************************************************************************/
455 454
455static void
456destroy_storecontext (struct GNUNET_PEERSTORE_StoreContext *sc)
457{
458 GNUNET_CONTAINER_DLL_remove (sc->h->store_head, sc->h->store_tail, sc);
459 GNUNET_free (sc->sub_system);
460 GNUNET_free (sc->value);
461 GNUNET_free (sc->key);
462 GNUNET_free (sc);
463}
464
456 465
457/** 466/**
458 * Cancel a store request 467 * Cancel a store request
@@ -465,11 +474,7 @@ GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc)
465 LOG (GNUNET_ERROR_TYPE_DEBUG, 474 LOG (GNUNET_ERROR_TYPE_DEBUG,
466 "store cancel with sc %p \n", 475 "store cancel with sc %p \n",
467 sc); 476 sc);
468 GNUNET_CONTAINER_DLL_remove (sc->h->store_head, sc->h->store_tail, sc); 477 destroy_storecontext (sc);
469 GNUNET_free (sc->sub_system);
470 GNUNET_free (sc->value);
471 GNUNET_free (sc->key);
472 GNUNET_free (sc);
473 LOG (GNUNET_ERROR_TYPE_DEBUG, 478 LOG (GNUNET_ERROR_TYPE_DEBUG,
474 "store cancel with sc %p is null\n", 479 "store cancel with sc %p is null\n",
475 sc); 480 sc);
@@ -576,7 +581,7 @@ handle_store_result (void *cls, const struct PeerstoreResultMessage *msg)
576 } 581 }
577 if (NULL != sc->cont) 582 if (NULL != sc->cont)
578 sc->cont (sc->cont_cls, ntohl (msg->result)); 583 sc->cont (sc->cont_cls, ntohl (msg->result));
579 GNUNET_CONTAINER_DLL_remove (h->store_head, h->store_tail, sc); 584 destroy_storecontext (sc);
580} 585}
581 586
582 587
@@ -584,6 +589,15 @@ handle_store_result (void *cls, const struct PeerstoreResultMessage *msg)
584/******************* ITERATE FUNCTIONS *********************/ 589/******************* ITERATE FUNCTIONS *********************/
585/******************************************************************************/ 590/******************************************************************************/
586 591
592static void
593destroy_iteratecontext (struct GNUNET_PEERSTORE_IterateContext *ic)
594{
595 GNUNET_CONTAINER_DLL_remove (ic->h->iterate_head, ic->h->iterate_tail, ic);
596 GNUNET_free (ic->sub_system);
597 GNUNET_free (ic->key);
598 GNUNET_free (ic);
599}
600
587 601
588/** 602/**
589 * When a response for iterate request is received 603 * When a response for iterate request is received
@@ -609,7 +623,7 @@ handle_iterate_end (void *cls, const struct PeerstoreResultMessage *msg)
609 if (NULL != ic->callback) 623 if (NULL != ic->callback)
610 ic->callback (ic->callback_cls, NULL, NULL); 624 ic->callback (ic->callback_cls, NULL, NULL);
611 LOG (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up iteration with rid %u\n", ic->rid); 625 LOG (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up iteration with rid %u\n", ic->rid);
612 GNUNET_CONTAINER_DLL_remove (h->iterate_head, h->iterate_tail, ic); 626 destroy_iteratecontext (ic);
613} 627}
614 628
615 629
@@ -719,10 +733,7 @@ GNUNET_PEERSTORE_iteration_stop (struct GNUNET_PEERSTORE_IterateContext *ic)
719 if (NULL != ic->h->mq) 733 if (NULL != ic->h->mq)
720 GNUNET_MQ_send (ic->h->mq, ev); 734 GNUNET_MQ_send (ic->h->mq, ev);
721 } 735 }
722 GNUNET_CONTAINER_DLL_remove (ic->h->iterate_head, ic->h->iterate_tail, ic); 736 destroy_iteratecontext (ic);
723 GNUNET_free (ic->sub_system);
724 GNUNET_free (ic->key);
725 GNUNET_free (ic);
726} 737}
727 738
728 739
diff --git a/src/service/peerstore/peerstore_api_monitor.c b/src/service/peerstore/peerstore_api_monitor.c
index fff0b3eb0..2c527103c 100644
--- a/src/service/peerstore/peerstore_api_monitor.c
+++ b/src/service/peerstore/peerstore_api_monitor.c
@@ -22,10 +22,9 @@
22 * @brief API for peerstore 22 * @brief API for peerstore
23 * @author Martin Schanzenbach 23 * @author Martin Schanzenbach
24 */ 24 */
25#include "gnunet_common.h"
26#include "gnunet_protocols.h"
27#include "platform.h" 25#include "platform.h"
28#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_protocols.h"
29#include "peerstore.h" 28#include "peerstore.h"
30#include "peerstore_common.h" 29#include "peerstore_common.h"
31#include "gnunet_peerstore_service.h" 30#include "gnunet_peerstore_service.h"
@@ -85,7 +84,7 @@ struct GNUNET_PEERSTORE_Monitor
85 /** 84 /**
86 * The sub system requested the watch. 85 * The sub system requested the watch.
87 */ 86 */
88 const char *sub_system; 87 char *sub_system;
89 88
90 /** 89 /**
91 * Request ID 90 * Request ID
@@ -237,17 +236,18 @@ reconnect (struct GNUNET_PEERSTORE_Monitor *mc)
237 236
238 237
239struct GNUNET_PEERSTORE_Monitor * 238struct GNUNET_PEERSTORE_Monitor *
240GNUNET_PEERSTORE_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, 239GNUNET_PEERSTORE_monitor_start (
241 int iterate_first, 240 const struct GNUNET_CONFIGURATION_Handle *cfg,
242 const char *sub_system, 241 int iterate_first,
243 const struct GNUNET_PeerIdentity *peer, 242 const char *sub_system,
244 const char *key, 243 const struct GNUNET_PeerIdentity *peer,
245 GNUNET_SCHEDULER_TaskCallback error_cb, 244 const char *key,
246 void *error_cb_cls, 245 GNUNET_SCHEDULER_TaskCallback error_cb,
247 GNUNET_SCHEDULER_TaskCallback sync_cb, 246 void *error_cb_cls,
248 void *sync_cb_cls, 247 GNUNET_SCHEDULER_TaskCallback sync_cb,
249 GNUNET_PEERSTORE_Processor callback, 248 void *sync_cb_cls,
250 void *callback_cls) 249 GNUNET_PEERSTORE_Processor callback,
250 void *callback_cls)
251{ 251{
252 struct GNUNET_PEERSTORE_Monitor *mc; 252 struct GNUNET_PEERSTORE_Monitor *mc;
253 253
@@ -286,6 +286,7 @@ GNUNET_PEERSTORE_monitor_stop (struct GNUNET_PEERSTORE_Monitor *zm)
286 GNUNET_MQ_destroy (zm->mq); 286 GNUNET_MQ_destroy (zm->mq);
287 zm->mq = NULL; 287 zm->mq = NULL;
288 } 288 }
289 GNUNET_free (zm->sub_system);
289 GNUNET_free (zm); 290 GNUNET_free (zm);
290} 291}
291 292
diff --git a/src/service/peerstore/peerstore_common.c b/src/service/peerstore/peerstore_common.c
index 435444917..a326392ea 100644
--- a/src/service/peerstore/peerstore_common.c
+++ b/src/service/peerstore/peerstore_common.c
@@ -22,7 +22,6 @@
22 * @brief Helper peerstore functions 22 * @brief Helper peerstore functions
23 * @author Omar Tarabai 23 * @author Omar Tarabai
24 */ 24 */
25
26#include "platform.h" 25#include "platform.h"
27#include "peerstore_common.h" 26#include "peerstore_common.h"
28 27
diff --git a/src/service/pt/Makefile.am b/src/service/pt/Makefile.am
index 7622f2c1a..e1bab6e18 100644
--- a/src/service/pt/Makefile.am
+++ b/src/service/pt/Makefile.am
@@ -37,7 +37,7 @@ if LINUX
37 test_gns_vpn 37 test_gns_vpn
38endif 38endif
39 39
40check_PROGRAMS = $(VPN_TEST) 40# check_PROGRAMS = $(VPN_TEST)
41 41
42if ENABLE_TEST_RUN 42if ENABLE_TEST_RUN
43AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 43AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
@@ -56,7 +56,7 @@ test_gns_vpn_LDADD = $(MHD_LIBS) @LIBCURL@ \
56 $(top_builddir)/src/service/namestore/libgnunetnamestore.la \ 56 $(top_builddir)/src/service/namestore/libgnunetnamestore.la \
57 $(top_builddir)/src/service/identity/libgnunetidentity.la \ 57 $(top_builddir)/src/service/identity/libgnunetidentity.la \
58 $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \ 58 $(top_builddir)/src/lib/gnsrecord/libgnunetgnsrecord.la \
59 $(top_builddir)/src/service/testing/libgnunettesting.la \ 59 $(top_builddir)/src/lib/testing/libgnunettesting.la \
60 $(top_builddir)/src/lib/util/libgnunetutil.la 60 $(top_builddir)/src/lib/util/libgnunetutil.la
61test_gns_vpn_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) 61test_gns_vpn_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
62 62
@@ -64,7 +64,7 @@ test_gnunet_vpn_4_over_SOURCES = \
64 test_gnunet_vpn.c 64 test_gnunet_vpn.c
65test_gnunet_vpn_4_over_LDADD = $(MHD_LIBS) @LIBCURL@ \ 65test_gnunet_vpn_4_over_LDADD = $(MHD_LIBS) @LIBCURL@ \
66 $(top_builddir)/src/service/vpn/libgnunetvpn.la \ 66 $(top_builddir)/src/service/vpn/libgnunetvpn.la \
67 $(top_builddir)/src/service/testing/libgnunettesting.la \ 67 $(top_builddir)/src/lib/testing/libgnunettesting.la \
68 $(top_builddir)/src/lib/util/libgnunetutil.la 68 $(top_builddir)/src/lib/util/libgnunetutil.la
69test_gnunet_vpn_4_over_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) 69test_gnunet_vpn_4_over_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
70 70
@@ -72,7 +72,7 @@ test_gnunet_vpn_6_over_SOURCES = \
72 test_gnunet_vpn.c 72 test_gnunet_vpn.c
73test_gnunet_vpn_6_over_LDADD = $(MHD_LIBS) @LIBCURL@ \ 73test_gnunet_vpn_6_over_LDADD = $(MHD_LIBS) @LIBCURL@ \
74 $(top_builddir)/src/service/vpn/libgnunetvpn.la \ 74 $(top_builddir)/src/service/vpn/libgnunetvpn.la \
75 $(top_builddir)/src/service/testing/libgnunettesting.la \ 75 $(top_builddir)/src/lib/testing/libgnunettesting.la \
76 $(top_builddir)/src/lib/util/libgnunetutil.la 76 $(top_builddir)/src/lib/util/libgnunetutil.la
77test_gnunet_vpn_6_over_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) 77test_gnunet_vpn_6_over_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
78 78
@@ -80,7 +80,7 @@ test_gnunet_vpn_4_to_6_SOURCES = \
80 test_gnunet_vpn.c 80 test_gnunet_vpn.c
81test_gnunet_vpn_4_to_6_LDADD = $(MHD_LIBS) @LIBCURL@ \ 81test_gnunet_vpn_4_to_6_LDADD = $(MHD_LIBS) @LIBCURL@ \
82 $(top_builddir)/src/service/vpn/libgnunetvpn.la \ 82 $(top_builddir)/src/service/vpn/libgnunetvpn.la \
83 $(top_builddir)/src/service/testing/libgnunettesting.la \ 83 $(top_builddir)/src/lib/testing/libgnunettesting.la \
84 $(top_builddir)/src/lib/util/libgnunetutil.la 84 $(top_builddir)/src/lib/util/libgnunetutil.la
85test_gnunet_vpn_4_to_6_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) 85test_gnunet_vpn_4_to_6_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
86 86
@@ -88,6 +88,6 @@ test_gnunet_vpn_6_to_4_SOURCES = \
88 test_gnunet_vpn.c 88 test_gnunet_vpn.c
89test_gnunet_vpn_6_to_4_LDADD = $(MHD_LIBS) @LIBCURL@ \ 89test_gnunet_vpn_6_to_4_LDADD = $(MHD_LIBS) @LIBCURL@ \
90 $(top_builddir)/src/service/vpn/libgnunetvpn.la \ 90 $(top_builddir)/src/service/vpn/libgnunetvpn.la \
91 $(top_builddir)/src/service/testing/libgnunettesting.la \ 91 $(top_builddir)/src/lib/testing/libgnunettesting.la \
92 $(top_builddir)/src/lib/util/libgnunetutil.la 92 $(top_builddir)/src/lib/util/libgnunetutil.la
93test_gnunet_vpn_6_to_4_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) 93test_gnunet_vpn_6_to_4_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS)
diff --git a/src/service/reclaim/gnunet-service-reclaim.c b/src/service/reclaim/gnunet-service-reclaim.c
index 7743f85b4..c381a5aaf 100644
--- a/src/service/reclaim/gnunet-service-reclaim.c
+++ b/src/service/reclaim/gnunet-service-reclaim.c
@@ -655,7 +655,6 @@ send_ticket_result (const struct IdpClient *client,
655 struct GNUNET_MQ_Envelope *env; 655 struct GNUNET_MQ_Envelope *env;
656 size_t pres_len = 0; 656 size_t pres_len = 0;
657 size_t tkt_len = 0; 657 size_t tkt_len = 0;
658 ssize_t written;
659 char *buf; 658 char *buf;
660 659
661 if (NULL != presentations) 660 if (NULL != presentations)
@@ -664,20 +663,20 @@ send_ticket_result (const struct IdpClient *client,
664 GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations); 663 GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations);
665 } 664 }
666 if (NULL != ticket) 665 if (NULL != ticket)
667 tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket); 666 tkt_len = strlen (ticket->gns_name) + 1;
668 env = GNUNET_MQ_msg_extra (irm, 667 env = GNUNET_MQ_msg_extra (irm,
669 pres_len + tkt_len, 668 pres_len + tkt_len,
670 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); 669 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
671 buf = (char*) &irm[1]; 670 buf = (char*) &irm[1];
672 if (NULL != ticket) 671 if (NULL != ticket)
673 { 672 {
674 written = GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len); 673 memcpy (buf, ticket, tkt_len);
675 GNUNET_assert (0 <= written); 674 buf += tkt_len;
676 buf += written;
677 } 675 }
678 // TODO add success member 676 // TODO add success member
679 irm->id = htonl (r_id); 677 irm->id = htonl (r_id);
680 irm->tkt_len = htons (tkt_len); 678 irm->tkt_len = htons (tkt_len);
679 irm->rp_uri_len = htons (0);
681 irm->presentations_len = htons (pres_len); 680 irm->presentations_len = htons (pres_len);
682 if (NULL != presentations) 681 if (NULL != presentations)
683 { 682 {
@@ -739,14 +738,14 @@ check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
739 uint16_t size; 738 uint16_t size;
740 size_t attrs_len; 739 size_t attrs_len;
741 size_t key_len; 740 size_t key_len;
742 size_t pkey_len; 741 size_t rp_len;
743 742
744 size = ntohs (im->header.size); 743 size = ntohs (im->header.size);
745 attrs_len = ntohs (im->attr_len); 744 attrs_len = ntohs (im->attr_len);
746 key_len = ntohs (im->key_len); 745 key_len = ntohs (im->key_len);
747 pkey_len = ntohs (im->pkey_len); 746 rp_len = ntohs (im->rp_uri_len);
748 if (size != attrs_len + key_len + pkey_len + sizeof(struct 747 if (size != attrs_len + key_len + rp_len + sizeof(struct
749 IssueTicketMessage)) 748 IssueTicketMessage))
750 { 749 {
751 GNUNET_break (0); 750 GNUNET_break (0);
752 return GNUNET_SYSERR; 751 return GNUNET_SYSERR;
@@ -769,10 +768,10 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
769 struct GNUNET_RECLAIM_AttributeList *attrs; 768 struct GNUNET_RECLAIM_AttributeList *attrs;
770 struct GNUNET_RECLAIM_AttributeListEntry *le; 769 struct GNUNET_RECLAIM_AttributeListEntry *le;
771 struct GNUNET_CRYPTO_PrivateKey identity; 770 struct GNUNET_CRYPTO_PrivateKey identity;
772 struct GNUNET_CRYPTO_PublicKey rp; 771 const char *rp;
773 size_t attrs_len; 772 size_t attrs_len;
774 size_t key_len; 773 size_t key_len;
775 size_t pkey_len; 774 size_t rp_len;
776 size_t read; 775 size_t read;
777 char *buf; 776 char *buf;
778 777
@@ -790,18 +789,9 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
790 return; 789 return;
791 } 790 }
792 buf += read; 791 buf += read;
793 pkey_len = ntohs (im->pkey_len); 792 rp_len = ntohs (im->rp_uri_len);
794 if ((GNUNET_SYSERR == 793 rp = buf;
795 GNUNET_CRYPTO_read_public_key_from_buffer (buf, pkey_len, 794 buf += rp_len;
796 &rp, &read)) ||
797 (read != pkey_len))
798 {
799 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
800 "Failed to read public key\n");
801 GNUNET_SERVICE_client_drop (idp->client);
802 return;
803 }
804 buf += read;
805 tio = GNUNET_new (struct TicketIssueOperation); 795 tio = GNUNET_new (struct TicketIssueOperation);
806 attrs_len = ntohs (im->attr_len); 796 attrs_len = ntohs (im->attr_len);
807 attrs = GNUNET_RECLAIM_attribute_list_deserialize (buf, 797 attrs = GNUNET_RECLAIM_attribute_list_deserialize (buf,
@@ -815,7 +805,7 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
815 GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio); 805 GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio);
816 RECLAIM_TICKETS_issue (&identity, 806 RECLAIM_TICKETS_issue (&identity,
817 attrs, 807 attrs,
818 &rp, 808 rp,
819 &issue_ticket_result_cb, 809 &issue_ticket_result_cb,
820 tio); 810 tio);
821 GNUNET_SERVICE_client_continue (idp->client); 811 GNUNET_SERVICE_client_continue (idp->client);
@@ -858,16 +848,21 @@ revoke_result_cb (void *cls, int32_t success)
858 * Check revocation message format 848 * Check revocation message format
859 * 849 *
860 * @param cls unused 850 * @param cls unused
861 * @param im the message to check 851 * @param rm the message to check
862 * @return GNUNET_OK if message is ok 852 * @return GNUNET_OK if message is ok
863 */ 853 */
864static int 854static int
865check_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *im) 855check_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
866{ 856{
867 uint16_t size; 857 uint16_t size;
858 size_t key_len;
859 size_t tkt_len;
868 860
869 size = ntohs (im->header.size); 861 size = ntohs (rm->header.size);
870 if (size != sizeof(struct RevokeTicketMessage)) 862 key_len = ntohs (rm->key_len);
863 tkt_len = ntohs (rm->tkt_len);
864
865 if (size != sizeof(struct RevokeTicketMessage) + key_len + tkt_len)
871 { 866 {
872 GNUNET_break (0); 867 GNUNET_break (0);
873 return GNUNET_SYSERR; 868 return GNUNET_SYSERR;
@@ -888,9 +883,8 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
888 struct TicketRevocationOperation *rop; 883 struct TicketRevocationOperation *rop;
889 struct IdpClient *idp = cls; 884 struct IdpClient *idp = cls;
890 struct GNUNET_CRYPTO_PrivateKey identity; 885 struct GNUNET_CRYPTO_PrivateKey identity;
891 struct GNUNET_RECLAIM_Ticket ticket; 886 struct GNUNET_RECLAIM_Ticket *ticket;
892 size_t key_len; 887 size_t key_len;
893 size_t tkt_len;
894 size_t read; 888 size_t read;
895 char *buf; 889 char *buf;
896 890
@@ -908,23 +902,13 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
908 return; 902 return;
909 } 903 }
910 buf += read; 904 buf += read;
911 tkt_len = ntohs (rm->tkt_len); 905 ticket = (struct GNUNET_RECLAIM_Ticket *) buf;
912 if ((GNUNET_SYSERR ==
913 GNUNET_RECLAIM_read_ticket_from_buffer (buf, tkt_len,
914 &ticket, &read)) ||
915 (read != tkt_len))
916 {
917 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
918 "Failed to read ticket\n");
919 GNUNET_SERVICE_client_drop (idp->client);
920 return;
921 }
922 rop = GNUNET_new (struct TicketRevocationOperation); 906 rop = GNUNET_new (struct TicketRevocationOperation);
923 rop->r_id = ntohl (rm->id); 907 rop->r_id = ntohl (rm->id);
924 rop->client = idp; 908 rop->client = idp;
925 GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop); 909 GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop);
926 rop->rh 910 rop->rh
927 = RECLAIM_TICKETS_revoke (&ticket, &identity, &revoke_result_cb, rop); 911 = RECLAIM_TICKETS_revoke (ticket, &identity, &revoke_result_cb, rop);
928 GNUNET_SERVICE_client_continue (idp->client); 912 GNUNET_SERVICE_client_continue (idp->client);
929} 913}
930 914
@@ -1000,9 +984,13 @@ static int
1000check_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm) 984check_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
1001{ 985{
1002 uint16_t size; 986 uint16_t size;
987 uint16_t tkt_size;
988 uint16_t rp_uri_size;
1003 989
1004 size = ntohs (cm->header.size); 990 size = ntohs (cm->header.size);
1005 if (size <= sizeof(struct ConsumeTicketMessage)) 991 tkt_size = ntohs (cm->tkt_len);
992 rp_uri_size = ntohs (cm->rp_uri_len);
993 if (size < sizeof(struct ConsumeTicketMessage) + tkt_size + rp_uri_size)
1006 { 994 {
1007 GNUNET_break (0); 995 GNUNET_break (0);
1008 return GNUNET_SYSERR; 996 return GNUNET_SYSERR;
@@ -1022,43 +1010,21 @@ handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
1022{ 1010{
1023 struct ConsumeTicketOperation *cop; 1011 struct ConsumeTicketOperation *cop;
1024 struct IdpClient *idp = cls; 1012 struct IdpClient *idp = cls;
1025 struct GNUNET_CRYPTO_PrivateKey identity; 1013 struct GNUNET_RECLAIM_Ticket *ticket;
1026 struct GNUNET_RECLAIM_Ticket ticket;
1027 size_t key_len;
1028 size_t tkt_len;
1029 size_t read;
1030 char *buf; 1014 char *buf;
1015 const char *rp_uri;
1031 1016
1032 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n"); 1017 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
1033 key_len = ntohs (cm->key_len); 1018 buf = (char*) &cm[1];
1034 buf = (char *) &cm[1]; 1019 ticket = (struct GNUNET_RECLAIM_Ticket *) buf;
1035 if ((GNUNET_SYSERR == 1020 rp_uri = buf + ntohs (cm->tkt_len);
1036 GNUNET_CRYPTO_read_private_key_from_buffer (buf, key_len,
1037 &identity, &read)) ||
1038 (read != key_len))
1039 {
1040 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1041 "Failed to read private key\n");
1042 GNUNET_SERVICE_client_drop (idp->client);
1043 return;
1044 }
1045 buf += read;
1046 tkt_len = ntohs (cm->tkt_len);
1047 if ((GNUNET_SYSERR ==
1048 GNUNET_RECLAIM_read_ticket_from_buffer (buf, tkt_len,
1049 &ticket, &read)) ||
1050 (read != tkt_len))
1051 {
1052 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1053 "Failed to read ticket\n");
1054 GNUNET_SERVICE_client_drop (idp->client);
1055 return;
1056 }
1057 cop = GNUNET_new (struct ConsumeTicketOperation); 1021 cop = GNUNET_new (struct ConsumeTicketOperation);
1058 cop->r_id = ntohl (cm->id); 1022 cop->r_id = ntohl (cm->id);
1059 cop->client = idp; 1023 cop->client = idp;
1060 cop->ch 1024 cop->ch
1061 = RECLAIM_TICKETS_consume (&identity, &ticket, &consume_result_cb, 1025 = RECLAIM_TICKETS_consume (ticket,
1026 rp_uri,
1027 &consume_result_cb,
1062 cop); 1028 cop);
1063 GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop); 1029 GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop);
1064 GNUNET_SERVICE_client_continue (idp->client); 1030 GNUNET_SERVICE_client_continue (idp->client);
@@ -2480,27 +2446,27 @@ handle_credential_iteration_next (void *cls,
2480 * Ticket iteration 2446 * Ticket iteration
2481 ******************************************************/ 2447 ******************************************************/
2482 2448
2483/**
2484 * Got a ticket. Return to client
2485 *
2486 * @param cls our ticket iterator
2487 * @param ticket the ticket
2488 */
2489static void 2449static void
2490ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket) 2450ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket, const char*
2451 rp_uri)
2491{ 2452{
2492 struct TicketIteration *ti = cls; 2453 struct TicketIteration *ti = cls;
2493 struct GNUNET_MQ_Envelope *env; 2454 struct GNUNET_MQ_Envelope *env;
2494 struct TicketResultMessage *trm; 2455 struct TicketResultMessage *trm;
2495 size_t tkt_len; 2456 size_t tkt_len;
2457 size_t rp_uri_len;
2496 2458
2497 if (NULL == ticket) 2459 if (NULL == ticket)
2498 tkt_len = 0; 2460 tkt_len = 0;
2499 else 2461 else
2500 tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket); 2462 tkt_len = strlen (ticket->gns_name) + 1;
2501 2463
2464 if (NULL == rp_uri)
2465 rp_uri_len = 0;
2466 else
2467 rp_uri_len = strlen (rp_uri) + 1;
2502 env = GNUNET_MQ_msg_extra (trm, 2468 env = GNUNET_MQ_msg_extra (trm,
2503 tkt_len, 2469 tkt_len + rp_uri_len,
2504 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); 2470 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
2505 if (NULL == ticket) 2471 if (NULL == ticket)
2506 { 2472 {
@@ -2511,13 +2477,13 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
2511 } 2477 }
2512 else 2478 else
2513 { 2479 {
2514 GNUNET_RECLAIM_write_ticket_to_buffer (ticket, 2480 memcpy (&trm[1], ticket, tkt_len);
2515 &trm[1],
2516 tkt_len);
2517 } 2481 }
2482 memcpy ((char*) &trm[1] + tkt_len, rp_uri, rp_uri_len);
2518 trm->id = htonl (ti->r_id); 2483 trm->id = htonl (ti->r_id);
2519 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); 2484 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");
2520 trm->tkt_len = htons (tkt_len); 2485 trm->tkt_len = htons (tkt_len);
2486 trm->rp_uri_len = htons (rp_uri_len);
2521 trm->presentations_len = htons (0); 2487 trm->presentations_len = htons (0);
2522 GNUNET_MQ_send (ti->client->mq, env); 2488 GNUNET_MQ_send (ti->client->mq, env);
2523 if (NULL == ticket) 2489 if (NULL == ticket)
diff --git a/src/service/reclaim/gnunet-service-reclaim_tickets.c b/src/service/reclaim/gnunet-service-reclaim_tickets.c
index acd2b6859..e7e32eec3 100644
--- a/src/service/reclaim/gnunet-service-reclaim_tickets.c
+++ b/src/service/reclaim/gnunet-service-reclaim_tickets.c
@@ -25,6 +25,11 @@
25 * 25 *
26 */ 26 */
27#include "gnunet-service-reclaim_tickets.h" 27#include "gnunet-service-reclaim_tickets.h"
28#include "gnunet_common.h"
29#include "gnunet_gns_service.h"
30#include "gnunet_gnsrecord_lib.h"
31#include "gnunet_reclaim_service.h"
32#include <string.h>
28 33
29 34
30/** 35/**
@@ -80,17 +85,7 @@ struct RECLAIM_TICKETS_ConsumeHandle
80 /** 85 /**
81 * LookupRequest 86 * LookupRequest
82 */ 87 */
83 struct GNUNET_GNS_LookupRequest *lookup_request; 88 struct GNUNET_GNS_LookupWithTldRequest *lookup_request;
84
85 /**
86 * Audience Key
87 */
88 struct GNUNET_CRYPTO_PrivateKey identity;
89
90 /**
91 * Audience Key
92 */
93 struct GNUNET_CRYPTO_PublicKey identity_pub;
94 89
95 /** 90 /**
96 * Lookup DLL 91 * Lookup DLL
@@ -131,6 +126,13 @@ struct RECLAIM_TICKETS_ConsumeHandle
131 * Callback closure 126 * Callback closure
132 */ 127 */
133 void *cb_cls; 128 void *cb_cls;
129
130 /**
131 * The ticket audience (= relying party) URI.
132 * 0-terminated string.
133 * Example: "urn:gns:000G002B4RF1XPBXDPGZA0PT16BHQCS427YQK4NC84KZMK7TK8C2Z5GMK8"
134 */
135 char rp_uri[GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN];
134}; 136};
135 137
136 138
@@ -205,6 +207,18 @@ struct TicketIssueHandle
205 * Callback cls 207 * Callback cls
206 */ 208 */
207 void *cb_cls; 209 void *cb_cls;
210
211 /**
212 * The ticket audience (= relying party) URI.
213 * 0-terminated string.
214 * Example: "urn:gns:000G002B4RF1XPBXDPGZA0PT16BHQCS427YQK4NC84KZMK7TK8C2Z5GMK8"
215 */
216 char rp_uri[GNUNET_RECLAIM_TICKET_RP_URI_MAX_LEN];
217
218 /**
219 * The ticket random identifier
220 */
221 struct GNUNET_RECLAIM_Identifier rnd;
208}; 222};
209 223
210 224
@@ -913,17 +927,17 @@ RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket,
913{ 927{
914 struct RECLAIM_TICKETS_RevokeHandle *rvk; 928 struct RECLAIM_TICKETS_RevokeHandle *rvk;
915 char *label; 929 char *label;
930 char *tmp;
916 931
917 rvk = GNUNET_new (struct RECLAIM_TICKETS_RevokeHandle); 932 rvk = GNUNET_new (struct RECLAIM_TICKETS_RevokeHandle);
918 rvk->cb = cb; 933 rvk->cb = cb;
919 rvk->cb_cls = cb_cls; 934 rvk->cb_cls = cb_cls;
920 rvk->identity = *identity; 935 rvk->identity = *identity;
921 rvk->ticket = *ticket; 936 rvk->ticket = *ticket;
922 GNUNET_CRYPTO_key_get_public (&rvk->identity, &rvk->ticket.identity); 937 tmp = GNUNET_strdup (ticket->gns_name);
923 /** Get shared attributes **/ 938 label = strtok (tmp, ".");
924 label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
925 sizeof(ticket->rnd));
926 GNUNET_assert (NULL != label); 939 GNUNET_assert (NULL != label);
940 /** Get shared attributes **/
927 rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, 941 rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
928 identity, 942 identity,
929 label, 943 label,
@@ -931,7 +945,7 @@ RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket,
931 rvk, 945 rvk,
932 &revoke_attrs_cb, 946 &revoke_attrs_cb,
933 rvk); 947 rvk);
934 GNUNET_free (label); 948 GNUNET_free (tmp);
935 return rvk; 949 return rvk;
936} 950}
937 951
@@ -964,7 +978,7 @@ cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth)
964 struct ParallelLookup *lu; 978 struct ParallelLookup *lu;
965 979
966 if (NULL != cth->lookup_request) 980 if (NULL != cth->lookup_request)
967 GNUNET_GNS_lookup_cancel (cth->lookup_request); 981 GNUNET_GNS_lookup_with_tld_cancel (cth->lookup_request);
968 if (NULL != cth->kill_task) 982 if (NULL != cth->kill_task)
969 GNUNET_SCHEDULER_cancel (cth->kill_task); 983 GNUNET_SCHEDULER_cancel (cth->kill_task);
970 while (NULL != (lu = cth->parallel_lookups_head)) 984 while (NULL != (lu = cth->parallel_lookups_head))
@@ -986,13 +1000,6 @@ cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth)
986} 1000}
987 1001
988 1002
989/**
990 * We found an attribute record.
991 *
992 * @param cls handle to the operation
993 * @param rd_count size of record set
994 * @param rd record set
995 */
996static void 1003static void
997process_parallel_lookup_result (void *cls, 1004process_parallel_lookup_result (void *cls,
998 uint32_t rd_count, 1005 uint32_t rd_count,
@@ -1001,6 +1008,7 @@ process_parallel_lookup_result (void *cls,
1001 struct ParallelLookup *parallel_lookup = cls; 1008 struct ParallelLookup *parallel_lookup = cls;
1002 struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle; 1009 struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
1003 struct GNUNET_RECLAIM_AttributeListEntry *attr_le; 1010 struct GNUNET_RECLAIM_AttributeListEntry *attr_le;
1011 struct GNUNET_CRYPTO_PublicKey iss;
1004 1012
1005 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1013 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1006 "Parallel lookup finished (count=%u)\n", 1014 "Parallel lookup finished (count=%u)\n",
@@ -1038,7 +1046,9 @@ process_parallel_lookup_result (void *cls,
1038 if (NULL != cth->parallel_lookups_head) 1046 if (NULL != cth->parallel_lookups_head)
1039 return; // Wait for more 1047 return; // Wait for more
1040 /* Else we are done */ 1048 /* Else we are done */
1041 cth->cb (cth->cb_cls, &cth->ticket.identity, 1049 GNUNET_assert (GNUNET_OK == GNUNET_GNS_parse_ztld (cth->ticket.gns_name, &iss)
1050 );
1051 cth->cb (cth->cb_cls, &iss,
1042 cth->attrs, cth->presentations, GNUNET_OK, NULL); 1052 cth->attrs, cth->presentations, GNUNET_OK, NULL);
1043 cleanup_cth (cth); 1053 cleanup_cth (cth);
1044} 1054}
@@ -1072,27 +1082,22 @@ abort_parallel_lookups (void *cls)
1072} 1082}
1073 1083
1074 1084
1075/**
1076 * GNS result with attribute references.
1077 * For each result, we start a (parallel) lookup of the actual
1078 * attribute record under the referenced label.
1079 *
1080 * @param cls handle to the operation
1081 * @param rd_count size of the record set
1082 * @param rd record set
1083 */
1084static void 1085static void
1085lookup_authz_cb (void *cls, 1086lookup_authz_cb (void *cls,
1087 int is_gns,
1086 uint32_t rd_count, 1088 uint32_t rd_count,
1087 const struct GNUNET_GNSRECORD_Data *rd) 1089 const struct GNUNET_GNSRECORD_Data *rd)
1088{ 1090{
1089 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls; 1091 struct RECLAIM_TICKETS_ConsumeHandle *cth = cls;
1092 struct GNUNET_CRYPTO_PublicKey iss;
1090 struct ParallelLookup *parallel_lookup; 1093 struct ParallelLookup *parallel_lookup;
1094 const char *rp_uri = NULL;
1091 char *lbl; 1095 char *lbl;
1092 struct GNUNET_RECLAIM_PresentationListEntry *ale; 1096 struct GNUNET_RECLAIM_PresentationListEntry *ale;
1093 1097
1094 cth->lookup_request = NULL; 1098 cth->lookup_request = NULL;
1095 1099
1100 GNUNET_assert (GNUNET_YES == is_gns);
1096 GNUNET_STATISTICS_update (stats, 1101 GNUNET_STATISTICS_update (stats,
1097 "reclaim_authz_lookup_time_total", 1102 "reclaim_authz_lookup_time_total",
1098 GNUNET_TIME_absolute_get_duration ( 1103 GNUNET_TIME_absolute_get_duration (
@@ -1104,6 +1109,8 @@ lookup_authz_cb (void *cls,
1104 1, 1109 1,
1105 GNUNET_YES); 1110 GNUNET_YES);
1106 1111
1112 GNUNET_assert (GNUNET_OK
1113 == GNUNET_GNS_parse_ztld (cth->ticket.gns_name, &iss));
1107 for (int i = 0; i < rd_count; i++) 1114 for (int i = 0; i < rd_count; i++)
1108 { 1115 {
1109 /** 1116 /**
@@ -1112,6 +1119,9 @@ lookup_authz_cb (void *cls,
1112 */ 1119 */
1113 switch (rd[i].record_type) 1120 switch (rd[i].record_type)
1114 { 1121 {
1122 case GNUNET_DNSPARSER_TYPE_TXT:
1123 rp_uri = rd[i].data;
1124 break;
1115 case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION: 1125 case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION:
1116 ale = GNUNET_new (struct GNUNET_RECLAIM_PresentationListEntry); 1126 ale = GNUNET_new (struct GNUNET_RECLAIM_PresentationListEntry);
1117 ale->presentation = 1127 ale->presentation =
@@ -1131,7 +1141,7 @@ lookup_authz_cb (void *cls,
1131 parallel_lookup->lookup_request = 1141 parallel_lookup->lookup_request =
1132 GNUNET_GNS_lookup (gns, 1142 GNUNET_GNS_lookup (gns,
1133 lbl, 1143 lbl,
1134 &cth->ticket.identity, 1144 &iss,
1135 GNUNET_GNSRECORD_TYPE_ANY, 1145 GNUNET_GNSRECORD_TYPE_ANY,
1136 GNUNET_GNS_LO_DEFAULT, 1146 GNUNET_GNS_LO_DEFAULT,
1137 &process_parallel_lookup_result, 1147 &process_parallel_lookup_result,
@@ -1145,6 +1155,31 @@ lookup_authz_cb (void *cls,
1145 "Ignoring unknown record type %d", rd[i].record_type); 1155 "Ignoring unknown record type %d", rd[i].record_type);
1146 } 1156 }
1147 } 1157 }
1158 if (NULL == rp_uri)
1159 {
1160 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1161 "RP URI not found along references, ignoring...\n");
1162 /**
1163 * Return error
1164 */
1165 cth->cb (cth->cb_cls, &iss,
1166 cth->attrs, NULL, GNUNET_NO, NULL);
1167 cleanup_cth (cth);
1168 return;
1169 }
1170 if (0 != strcmp (rp_uri, cth->rp_uri))
1171 {
1172 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1173 "RP URI does not match consume request: `%s' != `%s'\n",
1174 rp_uri, cth->rp_uri);
1175 /**
1176 * Return error
1177 */
1178 cth->cb (cth->cb_cls, &iss,
1179 cth->attrs, NULL, GNUNET_NO, NULL);
1180 cleanup_cth (cth);
1181 return;
1182 }
1148 /** 1183 /**
1149 * We started lookups. Add a timeout task. 1184 * We started lookups. Add a timeout task.
1150 * FIXME: Really needed here? 1185 * FIXME: Really needed here?
@@ -1160,7 +1195,7 @@ lookup_authz_cb (void *cls,
1160 /** 1195 /**
1161 * No references found, return empty attribute list 1196 * No references found, return empty attribute list
1162 */ 1197 */
1163 cth->cb (cth->cb_cls, &cth->ticket.identity, 1198 cth->cb (cth->cb_cls, &iss,
1164 cth->attrs, NULL, GNUNET_OK, NULL); 1199 cth->attrs, NULL, GNUNET_OK, NULL);
1165 cleanup_cth (cth); 1200 cleanup_cth (cth);
1166} 1201}
@@ -1178,41 +1213,29 @@ lookup_authz_cb (void *cls,
1178 * @return handle to the operation 1213 * @return handle to the operation
1179 */ 1214 */
1180struct RECLAIM_TICKETS_ConsumeHandle * 1215struct RECLAIM_TICKETS_ConsumeHandle *
1181RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_PrivateKey *id, 1216RECLAIM_TICKETS_consume (const struct GNUNET_RECLAIM_Ticket *ticket,
1182 const struct GNUNET_RECLAIM_Ticket *ticket, 1217 const char *rp_uri,
1183 RECLAIM_TICKETS_ConsumeCallback cb, 1218 RECLAIM_TICKETS_ConsumeCallback cb,
1184 void *cb_cls) 1219 void *cb_cls)
1185{ 1220{
1186 struct RECLAIM_TICKETS_ConsumeHandle *cth; 1221 struct RECLAIM_TICKETS_ConsumeHandle *cth;
1187 char *label;
1188 1222
1189 cth = GNUNET_new (struct RECLAIM_TICKETS_ConsumeHandle); 1223 cth = GNUNET_new (struct RECLAIM_TICKETS_ConsumeHandle);
1190 1224
1191 cth->identity = *id;
1192 GNUNET_CRYPTO_key_get_public (&cth->identity, &cth->identity_pub);
1193 cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); 1225 cth->attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
1194 cth->presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList); 1226 cth->presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList);
1195 cth->ticket = *ticket; 1227 cth->ticket = *ticket;
1228 memcpy (cth->rp_uri, rp_uri, strlen (rp_uri) + 1);
1196 cth->cb = cb; 1229 cth->cb = cb;
1197 cth->cb_cls = cb_cls; 1230 cth->cb_cls = cb_cls;
1198 label =
1199 GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd,
1200 sizeof(cth->ticket.rnd));
1201 char *str = GNUNET_CRYPTO_public_key_to_string (&cth->ticket.identity);
1202 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1203 "Looking for AuthZ info under %s in %s\n",
1204 label, str);
1205 GNUNET_free (str);
1206 cth->lookup_start_time = GNUNET_TIME_absolute_get (); 1231 cth->lookup_start_time = GNUNET_TIME_absolute_get ();
1207 cth->lookup_request = 1232 cth->lookup_request =
1208 GNUNET_GNS_lookup (gns, 1233 GNUNET_GNS_lookup_with_tld (gns,
1209 label, 1234 ticket->gns_name,
1210 &cth->ticket.identity, 1235 GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF,
1211 GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF, 1236 GNUNET_GNS_LO_DEFAULT,
1212 GNUNET_GNS_LO_DEFAULT, 1237 &lookup_authz_cb,
1213 &lookup_authz_cb, 1238 cth);
1214 cth);
1215 GNUNET_free (label);
1216 return cth; 1239 return cth;
1217} 1240}
1218 1241
@@ -1300,9 +1323,11 @@ issue_ticket (struct TicketIssueHandle *ih)
1300 for (le = ih->attrs->list_head; NULL != le; le = le->next) 1323 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1301 attrs_count++; 1324 attrs_count++;
1302 1325
1303 // Worst case we have one presentation per attribute 1326 // Worst case we have one presentation per attribute plus the ticket
1327 // plus the RP URI record
1304 attrs_record = 1328 attrs_record =
1305 GNUNET_malloc (2 * attrs_count * sizeof(struct GNUNET_GNSRECORD_Data)); 1329 GNUNET_malloc ((2 * attrs_count + 2) * sizeof(struct GNUNET_GNSRECORD_Data))
1330 ;
1306 i = 0; 1331 i = 0;
1307 for (le = ih->attrs->list_head; NULL != le; le = le->next) 1332 for (le = ih->attrs->list_head; NULL != le; le = le->next)
1308 { 1333 {
@@ -1380,29 +1405,39 @@ issue_ticket (struct TicketIssueHandle *ih)
1380 } 1405 }
1381 } 1406 }
1382 } 1407 }
1383 attrs_record[i].data_size =
1384 GNUNET_RECLAIM_ticket_serialize_get_size (&ih->ticket);
1385 tkt_data = GNUNET_malloc (attrs_record[i].data_size);
1386 GNUNET_RECLAIM_write_ticket_to_buffer (&ih->ticket,
1387 tkt_data,
1388 attrs_record[i].data_size);
1389 attrs_record[i].data = tkt_data;
1390 attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
1391 attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET;
1392 attrs_record[i].flags =
1393 GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
1394 i++;
1395 1408
1396 label = 1409 label =
1397 GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, 1410 GNUNET_STRINGS_data_to_string_alloc (&ih->rnd,
1398 sizeof(ih->ticket.rnd)); 1411 sizeof(ih->rnd));
1399 struct GNUNET_CRYPTO_PublicKey pub; 1412 struct GNUNET_CRYPTO_PublicKey pub;
1400 GNUNET_CRYPTO_key_get_public (&ih->identity, 1413 GNUNET_CRYPTO_key_get_public (&ih->identity,
1401 &pub); 1414 &pub);
1402 char *str = GNUNET_CRYPTO_public_key_to_string (&pub); 1415 char *str = GNUNET_CRYPTO_public_key_to_string (&pub);
1403 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1404 "Storing AuthZ information under %s in %s\n", label, str); 1417 "Storing AuthZ information under %s in %s\n", label, str);
1418 sprintf (ih->ticket.gns_name, "%s.%s", label, str);
1405 GNUNET_free (str); 1419 GNUNET_free (str);
1420
1421 attrs_record[i].data_size =
1422 strlen (ih->ticket.gns_name) + 1;
1423 tkt_data = GNUNET_malloc (attrs_record[i].data_size);
1424 memcpy (tkt_data, &ih->ticket, attrs_record[i].data_size);
1425 // The ticket: Could be removed?
1426 attrs_record[i].data = tkt_data;
1427 attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
1428 attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET;
1429 attrs_record[i].flags =
1430 GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
1431 i++;
1432 // The RP URI
1433 attrs_record[i].data_size = strlen (ih->rp_uri);
1434 attrs_record[i].data = ih->rp_uri;
1435 attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
1436 attrs_record[i].record_type = GNUNET_DNSPARSER_TYPE_TXT;
1437 attrs_record[i].flags =
1438 GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1439 i++;
1440
1406 // Publish record 1441 // Publish record
1407 ih->ns_qe = GNUNET_NAMESTORE_record_set_store (nsh, 1442 ih->ns_qe = GNUNET_NAMESTORE_record_set_store (nsh,
1408 &ih->identity, 1443 &ih->identity,
@@ -1471,7 +1506,7 @@ filter_tickets_cb (void *cls,
1471 const struct GNUNET_GNSRECORD_Data *rd) 1506 const struct GNUNET_GNSRECORD_Data *rd)
1472{ 1507{
1473 struct TicketIssueHandle *tih = cls; 1508 struct TicketIssueHandle *tih = cls;
1474 struct GNUNET_RECLAIM_Ticket ticket; 1509 struct GNUNET_RECLAIM_Ticket *ticket;
1475 struct GNUNET_RECLAIM_Presentation *presentation; 1510 struct GNUNET_RECLAIM_Presentation *presentation;
1476 struct GNUNET_RECLAIM_PresentationList *ticket_presentations; 1511 struct GNUNET_RECLAIM_PresentationList *ticket_presentations;
1477 struct GNUNET_RECLAIM_Credential *cred; 1512 struct GNUNET_RECLAIM_Credential *cred;
@@ -1480,6 +1515,7 @@ filter_tickets_cb (void *cls,
1480 unsigned int attr_cnt = 0; 1515 unsigned int attr_cnt = 0;
1481 unsigned int pres_cnt = 0; 1516 unsigned int pres_cnt = 0;
1482 int ticket_found = GNUNET_NO; 1517 int ticket_found = GNUNET_NO;
1518 int rp_uri_matches = GNUNET_NO;
1483 1519
1484 for (le = tih->attrs->list_head; NULL != le; le = le->next) 1520 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1485 { 1521 {
@@ -1491,7 +1527,6 @@ filter_tickets_cb (void *cls,
1491 // ticket search 1527 // ticket search
1492 unsigned int found_attrs_cnt = 0; 1528 unsigned int found_attrs_cnt = 0;
1493 unsigned int found_pres_cnt = 0; 1529 unsigned int found_pres_cnt = 0;
1494 size_t read;
1495 ticket_presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList); 1530 ticket_presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList);
1496 1531
1497 for (int i = 0; i < rd_count; i++) 1532 for (int i = 0; i < rd_count; i++)
@@ -1499,30 +1534,19 @@ filter_tickets_cb (void *cls,
1499 // found ticket 1534 // found ticket
1500 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET == rd[i].record_type) 1535 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET == rd[i].record_type)
1501 { 1536 {
1502 if ((GNUNET_SYSERR == 1537 ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1503 GNUNET_RECLAIM_read_ticket_from_buffer (rd[i].data, 1538 tih->ticket = *ticket;
1504 rd[i].data_size, 1539 ticket_found = GNUNET_YES;
1505 &ticket, 1540 }
1506 &read)) || 1541 if (GNUNET_DNSPARSER_TYPE_TXT == rd[i].record_type)
1507 (read != rd[i].data_size)) 1542 {
1508 {
1509 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1510 "Failed to deserialize ticket from record\n");
1511 continue;
1512 }
1513 // cmp audience 1543 // cmp audience
1514 // FIXME this is ugly, GNUNET_CRYPTO_PublicKey cannot be compared 1544 if (0 != strncmp (tih->rp_uri,
1515 // like this 1545 rd[i].data,
1516 if (0 == memcmp (&tih->ticket.audience, 1546 rd[i].data_size))
1517 &ticket.audience,
1518 sizeof(struct GNUNET_CRYPTO_PublicKey)))
1519 {
1520 tih->ticket = ticket;
1521 ticket_found = GNUNET_YES;
1522 continue; 1547 continue;
1523 } 1548 rp_uri_matches = GNUNET_YES;
1524 } 1549 }
1525
1526 // cmp requested attributes with ticket attributes 1550 // cmp requested attributes with ticket attributes
1527 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type) 1551 if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF == rd[i].record_type)
1528 { 1552 {
@@ -1543,7 +1567,8 @@ filter_tickets_cb (void *cls,
1543 cred = GNUNET_RECLAIM_credential_deserialize (rd[i].data, 1567 cred = GNUNET_RECLAIM_credential_deserialize (rd[i].data,
1544 rd[i].data_size); 1568 rd[i].data_size);
1545 if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (&cred->id, 1569 if (GNUNET_YES != GNUNET_RECLAIM_id_is_equal (&cred->id,
1546 &le->attribute->credential)) 1570 &le->attribute->credential
1571 ))
1547 { 1572 {
1548 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1573 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1549 "No match.\n"); 1574 "No match.\n");
@@ -1576,7 +1601,8 @@ filter_tickets_cb (void *cls,
1576 for (le = tih->attrs->list_head; NULL != le; le = le->next) 1601 for (le = tih->attrs->list_head; NULL != le; le = le->next)
1577 { 1602 {
1578 presentation = GNUNET_RECLAIM_presentation_deserialize (rd[i].data, 1603 presentation = GNUNET_RECLAIM_presentation_deserialize (rd[i].data,
1579 rd[i].data_size); 1604 rd[i].data_size)
1605 ;
1580 if (NULL == presentation) 1606 if (NULL == presentation)
1581 { 1607 {
1582 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1608 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -1604,7 +1630,8 @@ filter_tickets_cb (void *cls,
1604 */ 1630 */
1605 if ((attr_cnt == found_attrs_cnt) && 1631 if ((attr_cnt == found_attrs_cnt) &&
1606 (pres_cnt == found_pres_cnt) && 1632 (pres_cnt == found_pres_cnt) &&
1607 (GNUNET_YES == ticket_found)) 1633 (GNUNET_YES == ticket_found) &&
1634 (GNUNET_YES == rp_uri_matches))
1608 { 1635 {
1609 GNUNET_NAMESTORE_zone_iteration_stop (tih->ns_it); 1636 GNUNET_NAMESTORE_zone_iteration_stop (tih->ns_it);
1610 tih->cb (tih->cb_cls, &tih->ticket, ticket_presentations, GNUNET_OK, NULL); 1637 tih->cb (tih->cb_cls, &tih->ticket, ticket_presentations, GNUNET_OK, NULL);
@@ -1630,8 +1657,7 @@ filter_tickets_finished_cb (void *cls)
1630{ 1657{
1631 struct TicketIssueHandle *tih = cls; 1658 struct TicketIssueHandle *tih = cls;
1632 1659
1633 GNUNET_CRYPTO_key_get_public (&tih->identity, &tih->ticket.identity); 1660 GNUNET_RECLAIM_id_generate (&tih->rnd);
1634 GNUNET_RECLAIM_id_generate (&tih->ticket.rnd);
1635 issue_ticket (tih); 1661 issue_ticket (tih);
1636} 1662}
1637 1663
@@ -1650,7 +1676,7 @@ filter_tickets_finished_cb (void *cls)
1650void 1676void
1651RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_PrivateKey *identity, 1677RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_PrivateKey *identity,
1652 const struct GNUNET_RECLAIM_AttributeList *attrs, 1678 const struct GNUNET_RECLAIM_AttributeList *attrs,
1653 const struct GNUNET_CRYPTO_PublicKey *audience, 1679 const char *rp,
1654 RECLAIM_TICKETS_TicketResult cb, 1680 RECLAIM_TICKETS_TicketResult cb,
1655 void *cb_cls) 1681 void *cb_cls)
1656{ 1682{
@@ -1662,7 +1688,7 @@ RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_PrivateKey *identity,
1662 tih->attrs = GNUNET_RECLAIM_attribute_list_dup (attrs); 1688 tih->attrs = GNUNET_RECLAIM_attribute_list_dup (attrs);
1663 tih->presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList); 1689 tih->presentations = GNUNET_new (struct GNUNET_RECLAIM_PresentationList);
1664 tih->identity = *identity; 1690 tih->identity = *identity;
1665 tih->ticket.audience = *audience; 1691 memcpy (tih->rp_uri, rp, strlen (rp) + 1);
1666 1692
1667 // First check whether the ticket has already been issued 1693 // First check whether the ticket has already been issued
1668 tih->ns_it = 1694 tih->ns_it =
@@ -1714,27 +1740,23 @@ collect_tickets_cb (void *cls,
1714 const struct GNUNET_GNSRECORD_Data *rd) 1740 const struct GNUNET_GNSRECORD_Data *rd)
1715{ 1741{
1716 struct RECLAIM_TICKETS_Iterator *iter = cls; 1742 struct RECLAIM_TICKETS_Iterator *iter = cls;
1717 struct GNUNET_RECLAIM_Ticket ticket; 1743 struct GNUNET_RECLAIM_Ticket *ticket;
1718 size_t read; 1744 int ticket_found = GNUNET_NO;
1745 const char *rp_uri = NULL;
1719 1746
1720 for (int i = 0; i < rd_count; i++) 1747 for (int i = 0; i < rd_count; i++)
1721 { 1748 {
1749 if (GNUNET_DNSPARSER_TYPE_TXT == rd[i].record_type)
1750 rp_uri = rd[i].data;
1722 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET != rd[i].record_type) 1751 if (GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET != rd[i].record_type)
1723 continue; 1752 continue;
1724 if ((GNUNET_SYSERR == 1753 if ((GNUNET_YES == ticket_found) && (NULL != rp_uri))
1725 GNUNET_RECLAIM_read_ticket_from_buffer (rd[i].data, 1754 break;
1726 rd[i].data_size, 1755 ticket = (struct GNUNET_RECLAIM_Ticket *) rd[i].data;
1727 &ticket, 1756 ticket_found = GNUNET_YES;
1728 &read)) ||
1729 (read != rd[i].data_size))
1730 {
1731 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1732 "Failed to deserialize ticket from record\n");
1733 continue;
1734 }
1735 iter->cb (iter->cb_cls, &ticket);
1736 return;
1737 } 1757 }
1758 if ((GNUNET_YES == ticket_found) && (NULL != rp_uri))
1759 iter->cb (iter->cb_cls, ticket, rp_uri);
1738 GNUNET_NAMESTORE_zone_iterator_next (iter->ns_it, 1); 1760 GNUNET_NAMESTORE_zone_iterator_next (iter->ns_it, 1);
1739} 1761}
1740 1762
@@ -1750,7 +1772,7 @@ collect_tickets_finished_cb (void *cls)
1750 struct RECLAIM_TICKETS_Iterator *iter = cls; 1772 struct RECLAIM_TICKETS_Iterator *iter = cls;
1751 1773
1752 iter->ns_it = NULL; 1774 iter->ns_it = NULL;
1753 iter->cb (iter->cb_cls, NULL); 1775 iter->cb (iter->cb_cls, NULL, NULL);
1754 cleanup_iter (iter); 1776 cleanup_iter (iter);
1755} 1777}
1756 1778
@@ -1766,7 +1788,7 @@ collect_tickets_error_cb (void *cls)
1766 struct RECLAIM_TICKETS_Iterator *iter = cls; 1788 struct RECLAIM_TICKETS_Iterator *iter = cls;
1767 1789
1768 iter->ns_it = NULL; 1790 iter->ns_it = NULL;
1769 iter->cb (iter->cb_cls, NULL); 1791 iter->cb (iter->cb_cls, NULL, NULL);
1770 cleanup_iter (iter); 1792 cleanup_iter (iter);
1771} 1793}
1772 1794
diff --git a/src/service/reclaim/gnunet-service-reclaim_tickets.h b/src/service/reclaim/gnunet-service-reclaim_tickets.h
index 0ec232f49..b425a3dba 100644
--- a/src/service/reclaim/gnunet-service-reclaim_tickets.h
+++ b/src/service/reclaim/gnunet-service-reclaim_tickets.h
@@ -102,10 +102,12 @@ struct TicketRecordsEntry
102 * 102 *
103 * @param cls closure 103 * @param cls closure
104 * @param ticket the ticket 104 * @param ticket the ticket
105 * @param rp_uri the RP URI associated with the ticket
105 */ 106 */
106typedef void (*RECLAIM_TICKETS_TicketIter) ( 107typedef void (*RECLAIM_TICKETS_TicketIter) (
107 void *cls, 108 void *cls,
108 struct GNUNET_RECLAIM_Ticket *ticket); 109 struct GNUNET_RECLAIM_Ticket *ticket,
110 const char* rp_uri);
109 111
110 112
111/** 113/**
@@ -186,15 +188,15 @@ RECLAIM_TICKETS_revoke_cancel (struct RECLAIM_TICKETS_RevokeHandle *rh);
186 * We first looking attribute references under the label 188 * We first looking attribute references under the label
187 * ticket.rnd in GNS. 189 * ticket.rnd in GNS.
188 * 190 *
189 * @param id the audience of the ticket
190 * @param ticket the ticket to consume 191 * @param ticket the ticket to consume
192 * @param rp_uri the expected RP URI
191 * @param cb callback to call with attributes of ticket 193 * @param cb callback to call with attributes of ticket
192 * @param cb_cls callback closure 194 * @param cb_cls callback closure
193 * @return handle to the operation 195 * @return handle to the operation
194 */ 196 */
195struct RECLAIM_TICKETS_ConsumeHandle * 197struct RECLAIM_TICKETS_ConsumeHandle *
196RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_PrivateKey *id, 198RECLAIM_TICKETS_consume (const struct GNUNET_RECLAIM_Ticket *ticket,
197 const struct GNUNET_RECLAIM_Ticket *ticket, 199 const char *rp_uri,
198 RECLAIM_TICKETS_ConsumeCallback cb, 200 RECLAIM_TICKETS_ConsumeCallback cb,
199 void *cb_cls); 201 void *cb_cls);
200 202
@@ -214,7 +216,7 @@ RECLAIM_TICKETS_consume_cancel (struct RECLAIM_TICKETS_ConsumeHandle *cth);
214 * 216 *
215 * @param identity the issuer 217 * @param identity the issuer
216 * @param attrs the attributes to share 218 * @param attrs the attributes to share
217 * @param audience the audience to share the attributes with 219 * @param rp the RP URI
218 * @param cb the callback to call with the ticket result 220 * @param cb the callback to call with the ticket result
219 * @param cb_cls the callback closure 221 * @param cb_cls the callback closure
220 * FIXME: Return handle?? 222 * FIXME: Return handle??
@@ -222,7 +224,7 @@ RECLAIM_TICKETS_consume_cancel (struct RECLAIM_TICKETS_ConsumeHandle *cth);
222void 224void
223RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_PrivateKey *identity, 225RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_PrivateKey *identity,
224 const struct GNUNET_RECLAIM_AttributeList *attrs, 226 const struct GNUNET_RECLAIM_AttributeList *attrs,
225 const struct GNUNET_CRYPTO_PublicKey *audience, 227 const char *rp,
226 RECLAIM_TICKETS_TicketResult cb, 228 RECLAIM_TICKETS_TicketResult cb,
227 void *cb_cls); 229 void *cb_cls);
228 230
diff --git a/src/service/reclaim/reclaim.h b/src/service/reclaim/reclaim.h
index 9d5118269..1fb50eafe 100644
--- a/src/service/reclaim/reclaim.h
+++ b/src/service/reclaim/reclaim.h
@@ -420,13 +420,13 @@ struct IssueTicketMessage
420 uint16_t key_len GNUNET_PACKED; 420 uint16_t key_len GNUNET_PACKED;
421 421
422 /** 422 /**
423 * The length of the relying party public key 423 * The length of the relying party URI
424 */ 424 */
425 uint16_t pkey_len GNUNET_PACKED; 425 uint16_t rp_uri_len GNUNET_PACKED;
426 426
427 /** 427 /**
428 * Followed by the private key. 428 * Followed by the private key.
429 * Followed by the public key. 429 * Followed by the RP URI.
430 * Followed by a serialized attribute list 430 * Followed by a serialized attribute list
431 */ 431 */
432}; 432};
@@ -506,12 +506,18 @@ struct TicketResultMessage
506 uint16_t tkt_len GNUNET_PACKED; 506 uint16_t tkt_len GNUNET_PACKED;
507 507
508 /** 508 /**
509 * RP URI length
510 */
511 uint16_t rp_uri_len GNUNET_PACKED;
512
513 /**
509 * Length of new presentations created 514 * Length of new presentations created
510 */ 515 */
511 uint16_t presentations_len GNUNET_PACKED; 516 uint16_t presentations_len GNUNET_PACKED;
512 517
513 /* 518 /*
514 * Followed by the serialized ticket 519 * Followed by the serialized ticket
520 * Followed by the RP URI
515 * Followed by the serialized GNUNET_RECLAIM_PresentationList 521 * Followed by the serialized GNUNET_RECLAIM_PresentationList
516 */ 522 */
517}; 523};
@@ -532,18 +538,18 @@ struct ConsumeTicketMessage
532 uint32_t id GNUNET_PACKED; 538 uint32_t id GNUNET_PACKED;
533 539
534 /** 540 /**
535 * The length of the private key 541 * The length of the ticket
536 */ 542 */
537 uint16_t key_len GNUNET_PACKED; 543 uint16_t tkt_len GNUNET_PACKED;
538 544
539 /** 545 /**
540 * The length of the ticket 546 * RP URI length
541 */ 547 */
542 uint16_t tkt_len GNUNET_PACKED; 548 uint16_t rp_uri_len GNUNET_PACKED;
543 549
544 /** 550 /**
545 * Followed by the private key.
546 * Followed by the serialized ticket. 551 * Followed by the serialized ticket.
552 * Followed by the RP URI
547 */ 553 */
548}; 554};
549 555
@@ -583,12 +589,12 @@ struct ConsumeTicketResultMessage
583 uint16_t presentations_len; 589 uint16_t presentations_len;
584 590
585 /** 591 /**
586 * The length of the private key 592 * The length of the identity public key
587 */ 593 */
588 uint16_t key_len GNUNET_PACKED; 594 uint16_t key_len GNUNET_PACKED;
589 595
590 /** 596 /**
591 * Followed by the private key. 597 * Followed by the identity public key.
592 * followed by: 598 * followed by:
593 * serialized attributes data 599 * serialized attributes data
594 */ 600 */
diff --git a/src/service/reclaim/reclaim_api.c b/src/service/reclaim/reclaim_api.c
index d865f0050..f1819614c 100644
--- a/src/service/reclaim/reclaim_api.c
+++ b/src/service/reclaim/reclaim_api.c
@@ -621,9 +621,9 @@ handle_consume_ticket_result (void *cls,
621 read_ptr = (char *) &msg[1]; 621 read_ptr = (char *) &msg[1];
622 GNUNET_assert (GNUNET_SYSERR != 622 GNUNET_assert (GNUNET_SYSERR !=
623 GNUNET_CRYPTO_read_public_key_from_buffer (read_ptr, 623 GNUNET_CRYPTO_read_public_key_from_buffer (read_ptr,
624 key_len, 624 key_len,
625 &identity, 625 &identity,
626 &read)); 626 &read));
627 read_ptr += read; 627 read_ptr += read;
628 attrs = 628 attrs =
629 GNUNET_RECLAIM_attribute_list_deserialize (read_ptr, attrs_len); 629 GNUNET_RECLAIM_attribute_list_deserialize (read_ptr, attrs_len);
@@ -646,7 +646,8 @@ handle_consume_ticket_result (void *cls,
646 { 646 {
647 if (GNUNET_YES == 647 if (GNUNET_YES ==
648 GNUNET_RECLAIM_id_is_equal (&le->attribute->credential, 648 GNUNET_RECLAIM_id_is_equal (&le->attribute->credential,
649 &ple->presentation->credential_id)) 649 &ple->presentation->credential_id)
650 )
650 { 651 {
651 op->atr_cb (op->cls, &identity, 652 op->atr_cb (op->cls, &identity,
652 le->attribute, ple->presentation); 653 le->attribute, ple->presentation);
@@ -765,9 +766,9 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg)
765 struct GNUNET_RECLAIM_Attribute *attr; 766 struct GNUNET_RECLAIM_Attribute *attr;
766 GNUNET_assert (GNUNET_SYSERR != 767 GNUNET_assert (GNUNET_SYSERR !=
767 GNUNET_CRYPTO_read_public_key_from_buffer (buf, 768 GNUNET_CRYPTO_read_public_key_from_buffer (buf,
768 key_len, 769 key_len,
769 &identity, 770 &identity,
770 &read)); 771 &read));
771 buf += read; 772 buf += read;
772 GNUNET_RECLAIM_attribute_deserialize (buf, attr_len, &attr); 773 GNUNET_RECLAIM_attribute_deserialize (buf, attr_len, &attr);
773 if (NULL != it) 774 if (NULL != it)
@@ -854,9 +855,9 @@ handle_credential_result (void *cls, const struct
854 { 855 {
855 GNUNET_assert (GNUNET_SYSERR != 856 GNUNET_assert (GNUNET_SYSERR !=
856 GNUNET_CRYPTO_read_public_key_from_buffer (buf, 857 GNUNET_CRYPTO_read_public_key_from_buffer (buf,
857 key_len, 858 key_len,
858 &identity, 859 &identity,
859 &read)); 860 &read));
860 buf += read; 861 buf += read;
861 } 862 }
862 if (0 == key_len) 863 if (0 == key_len)
@@ -918,11 +919,13 @@ check_ticket_result (void *cls, const struct TicketResultMessage *msg)
918 size_t msg_len; 919 size_t msg_len;
919 size_t pres_len; 920 size_t pres_len;
920 size_t tkt_len; 921 size_t tkt_len;
922 size_t rp_uri_len;
921 923
922 msg_len = ntohs (msg->header.size); 924 msg_len = ntohs (msg->header.size);
923 pres_len = ntohs (msg->presentations_len); 925 pres_len = ntohs (msg->presentations_len);
924 tkt_len = ntohs (msg->tkt_len); 926 tkt_len = ntohs (msg->tkt_len);
925 if (msg_len != sizeof(*msg) + pres_len + tkt_len) 927 rp_uri_len = ntohs (msg->rp_uri_len);
928 if (msg_len != sizeof(*msg) + pres_len + tkt_len + rp_uri_len)
926 { 929 {
927 GNUNET_break (0); 930 GNUNET_break (0);
928 return GNUNET_SYSERR; 931 return GNUNET_SYSERR;
@@ -946,13 +949,16 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg)
946 struct GNUNET_RECLAIM_TicketIterator *it; 949 struct GNUNET_RECLAIM_TicketIterator *it;
947 struct GNUNET_RECLAIM_PresentationList *presentation; 950 struct GNUNET_RECLAIM_PresentationList *presentation;
948 uint32_t r_id = ntohl (msg->id); 951 uint32_t r_id = ntohl (msg->id);
949 struct GNUNET_RECLAIM_Ticket ticket; 952 struct GNUNET_RECLAIM_Ticket *ticket = NULL;
950 size_t pres_len; 953 size_t pres_len;
951 size_t tkt_len; 954 size_t tkt_len;
952 size_t tb_read; 955 size_t rp_uri_len;
956 size_t tb_read = 0;
953 char *buf; 957 char *buf;
958 char *rp_uri = NULL;
954 959
955 tkt_len = ntohs (msg->tkt_len); 960 tkt_len = ntohs (msg->tkt_len);
961 rp_uri_len = ntohs (msg->rp_uri_len);
956 pres_len = ntohs (msg->presentations_len); 962 pres_len = ntohs (msg->presentations_len);
957 for (op = handle->op_head; NULL != op; op = op->next) 963 for (op = handle->op_head; NULL != op; op = op->next)
958 if (op->r_id == r_id) 964 if (op->r_id == r_id)
@@ -965,13 +971,12 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg)
965 buf = (char*) &msg[1]; 971 buf = (char*) &msg[1];
966 if (0 < tkt_len) 972 if (0 < tkt_len)
967 { 973 {
968 GNUNET_assert (GNUNET_SYSERR != 974 ticket = (struct GNUNET_RECLAIM_Ticket*) buf;
969 GNUNET_RECLAIM_read_ticket_from_buffer (buf, 975 buf += tkt_len;
970 tkt_len, 976 tb_read += tkt_len;
971 &ticket,
972 &tb_read));
973 buf += tb_read;
974 } 977 }
978 if (0 < rp_uri_len)
979 rp_uri = buf;
975 if (NULL != op) 980 if (NULL != op)
976 { 981 {
977 if (0 < pres_len) 982 if (0 < pres_len)
@@ -988,7 +993,7 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg)
988 { 993 {
989 if (NULL != op->ti_cb) 994 if (NULL != op->ti_cb)
990 op->ti_cb (op->cls, 995 op->ti_cb (op->cls,
991 &ticket, 996 ticket,
992 (0 < pres_len) ? presentation : NULL); 997 (0 < pres_len) ? presentation : NULL);
993 } 998 }
994 if (0 < pres_len) 999 if (0 < pres_len)
@@ -1009,7 +1014,7 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg)
1009 else 1014 else
1010 { 1015 {
1011 if (NULL != it->tr_cb) 1016 if (NULL != it->tr_cb)
1012 it->tr_cb (it->cls, &ticket); 1017 it->tr_cb (it->cls, ticket, rp_uri);
1013 } 1018 }
1014 return; 1019 return;
1015 } 1020 }
@@ -1440,7 +1445,8 @@ GNUNET_RECLAIM_get_credentials_start (
1440 env = 1445 env =
1441 GNUNET_MQ_msg_extra (msg, 1446 GNUNET_MQ_msg_extra (msg,
1442 key_len, 1447 key_len,
1443 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START); 1448 GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START)
1449 ;
1444 msg->id = htonl (rid); 1450 msg->id = htonl (rid);
1445 msg->key_len = htons (key_len); 1451 msg->key_len = htons (key_len);
1446 GNUNET_CRYPTO_write_private_key_to_buffer (identity, &msg[1], key_len); 1452 GNUNET_CRYPTO_write_private_key_to_buffer (identity, &msg[1], key_len);
@@ -1491,7 +1497,7 @@ struct GNUNET_RECLAIM_Operation *
1491GNUNET_RECLAIM_ticket_issue ( 1497GNUNET_RECLAIM_ticket_issue (
1492 struct GNUNET_RECLAIM_Handle *h, 1498 struct GNUNET_RECLAIM_Handle *h,
1493 const struct GNUNET_CRYPTO_PrivateKey *iss, 1499 const struct GNUNET_CRYPTO_PrivateKey *iss,
1494 const struct GNUNET_CRYPTO_PublicKey *rp, 1500 const char *rp,
1495 const struct GNUNET_RECLAIM_AttributeList *attrs, 1501 const struct GNUNET_RECLAIM_AttributeList *attrs,
1496 GNUNET_RECLAIM_IssueTicketCallback cb, 1502 GNUNET_RECLAIM_IssueTicketCallback cb,
1497 void *cb_cls) 1503 void *cb_cls)
@@ -1510,19 +1516,20 @@ GNUNET_RECLAIM_ticket_issue (
1510 op->cls = cb_cls; 1516 op->cls = cb_cls;
1511 op->r_id = h->r_id_gen++; 1517 op->r_id = h->r_id_gen++;
1512 key_len = GNUNET_CRYPTO_private_key_get_length (iss); 1518 key_len = GNUNET_CRYPTO_private_key_get_length (iss);
1513 rpk_len = GNUNET_CRYPTO_public_key_get_length (rp); 1519 rpk_len = strlen (rp) + 1;
1514 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 1520 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1515 attr_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); 1521 attr_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs);
1516 op->env = GNUNET_MQ_msg_extra (tim, 1522 op->env = GNUNET_MQ_msg_extra (tim,
1517 attr_len + key_len + rpk_len, 1523 attr_len + key_len + rpk_len,
1518 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET); 1524 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET);
1519 tim->key_len = htons (key_len); 1525 tim->key_len = htons (key_len);
1520 tim->pkey_len = htons (rpk_len); 1526 tim->rp_uri_len = htons (rpk_len);
1521 buf = (char *) &tim[1]; 1527 buf = (char *) &tim[1];
1522 written = GNUNET_CRYPTO_write_private_key_to_buffer (iss, buf, key_len); 1528 written = GNUNET_CRYPTO_write_private_key_to_buffer (iss, buf, key_len);
1523 GNUNET_assert (0 <= written); 1529 GNUNET_assert (0 <= written);
1524 buf += written; 1530 buf += written;
1525 written = GNUNET_CRYPTO_write_public_key_to_buffer (rp, buf, rpk_len); 1531 memcpy (buf, rp, rpk_len);
1532 written = rpk_len;
1526 GNUNET_assert (0 <= written); 1533 GNUNET_assert (0 <= written);
1527 buf += written; 1534 buf += written;
1528 tim->id = htonl (op->r_id); 1535 tim->id = htonl (op->r_id);
@@ -1535,30 +1542,18 @@ GNUNET_RECLAIM_ticket_issue (
1535} 1542}
1536 1543
1537 1544
1538/**
1539 * Consumes an issued ticket. The ticket is persisted
1540 * and used to retrieve identity information from the issuer
1541 *
1542 * @param h the reclaim to use
1543 * @param identity the identity that is the subject of the issued ticket (the
1544 * relying party)
1545 * @param ticket the issued ticket to consume
1546 * @param cb the callback to call
1547 * @param cb_cls the callback closure
1548 * @return handle to abort the operation
1549 */
1550struct GNUNET_RECLAIM_Operation * 1545struct GNUNET_RECLAIM_Operation *
1551GNUNET_RECLAIM_ticket_consume ( 1546GNUNET_RECLAIM_ticket_consume (
1552 struct GNUNET_RECLAIM_Handle *h, 1547 struct GNUNET_RECLAIM_Handle *h,
1553 const struct GNUNET_CRYPTO_PrivateKey *identity,
1554 const struct GNUNET_RECLAIM_Ticket *ticket, 1548 const struct GNUNET_RECLAIM_Ticket *ticket,
1549 const char *rp_uri,
1555 GNUNET_RECLAIM_AttributeTicketResult cb, 1550 GNUNET_RECLAIM_AttributeTicketResult cb,
1556 void *cb_cls) 1551 void *cb_cls)
1557{ 1552{
1558 struct GNUNET_RECLAIM_Operation *op; 1553 struct GNUNET_RECLAIM_Operation *op;
1559 struct ConsumeTicketMessage *ctm; 1554 struct ConsumeTicketMessage *ctm;
1560 size_t key_len;
1561 size_t tkt_len; 1555 size_t tkt_len;
1556 size_t rp_uri_len;
1562 char *buf; 1557 char *buf;
1563 1558
1564 op = GNUNET_new (struct GNUNET_RECLAIM_Operation); 1559 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
@@ -1566,18 +1561,18 @@ GNUNET_RECLAIM_ticket_consume (
1566 op->atr_cb = cb; 1561 op->atr_cb = cb;
1567 op->cls = cb_cls; 1562 op->cls = cb_cls;
1568 op->r_id = h->r_id_gen++; 1563 op->r_id = h->r_id_gen++;
1569 key_len = GNUNET_CRYPTO_private_key_get_length (identity); 1564 tkt_len = strlen (ticket->gns_name) + 1;
1570 tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket); 1565 rp_uri_len = strlen (rp_uri) + 1;
1571 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 1566 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1572 op->env = GNUNET_MQ_msg_extra (ctm, 1567 op->env = GNUNET_MQ_msg_extra (ctm,
1573 key_len + tkt_len, 1568 tkt_len + rp_uri_len,
1574 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET); 1569 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET);
1575 ctm->key_len = htons (key_len);
1576 buf = (char*) &ctm[1]; 1570 buf = (char*) &ctm[1];
1577 GNUNET_CRYPTO_write_private_key_to_buffer (identity, buf, key_len); 1571 ctm->rp_uri_len = htons (rp_uri_len);
1578 buf += key_len;
1579 ctm->tkt_len = htons (tkt_len); 1572 ctm->tkt_len = htons (tkt_len);
1580 GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len); 1573 memcpy (buf, ticket, tkt_len);
1574 buf += tkt_len;
1575 memcpy (buf, rp_uri, rp_uri_len);
1581 ctm->id = htonl (op->r_id); 1576 ctm->id = htonl (op->r_id);
1582 if (NULL != h->mq) 1577 if (NULL != h->mq)
1583 GNUNET_MQ_send_copy (h->mq, op->env); 1578 GNUNET_MQ_send_copy (h->mq, op->env);
@@ -1619,12 +1614,13 @@ GNUNET_RECLAIM_ticket_iteration_start (
1619 GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, h->ticket_it_tail, it); 1614 GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, h->ticket_it_tail, it);
1620 env = GNUNET_MQ_msg_extra (msg, 1615 env = GNUNET_MQ_msg_extra (msg,
1621 key_len, 1616 key_len,
1622 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START); 1617 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START)
1618 ;
1623 msg->id = htonl (rid); 1619 msg->id = htonl (rid);
1624 msg->key_len = htons (key_len); 1620 msg->key_len = htons (key_len);
1625 GNUNET_CRYPTO_write_private_key_to_buffer (identity, 1621 GNUNET_CRYPTO_write_private_key_to_buffer (identity,
1626 &msg[1], 1622 &msg[1],
1627 key_len); 1623 key_len);
1628 if (NULL == h->mq) 1624 if (NULL == h->mq)
1629 it->env = env; 1625 it->env = env;
1630 else 1626 else
@@ -1714,7 +1710,7 @@ GNUNET_RECLAIM_ticket_revoke (
1714 op->r_id = rid; 1710 op->r_id = rid;
1715 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); 1711 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op);
1716 key_len = GNUNET_CRYPTO_private_key_get_length (identity); 1712 key_len = GNUNET_CRYPTO_private_key_get_length (identity);
1717 tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket); 1713 tkt_len = strlen (ticket->gns_name) + 1;
1718 op->env = GNUNET_MQ_msg_extra (msg, 1714 op->env = GNUNET_MQ_msg_extra (msg,
1719 key_len + tkt_len, 1715 key_len + tkt_len,
1720 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET); 1716 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET);
@@ -1723,13 +1719,11 @@ GNUNET_RECLAIM_ticket_revoke (
1723 msg->tkt_len = htons (tkt_len); 1719 msg->tkt_len = htons (tkt_len);
1724 buf = (char*) &msg[1]; 1720 buf = (char*) &msg[1];
1725 written = GNUNET_CRYPTO_write_private_key_to_buffer (identity, 1721 written = GNUNET_CRYPTO_write_private_key_to_buffer (identity,
1726 buf, 1722 buf,
1727 key_len); 1723 key_len);
1728 GNUNET_assert (0 <= written); 1724 GNUNET_assert (0 <= written);
1729 buf += written; 1725 buf += written;
1730 GNUNET_RECLAIM_write_ticket_to_buffer (ticket, 1726 memcpy (buf, ticket, tkt_len);
1731 buf,
1732 tkt_len);
1733 if (NULL != h->mq) 1727 if (NULL != h->mq)
1734 { 1728 {
1735 GNUNET_MQ_send (h->mq, op->env); 1729 GNUNET_MQ_send (h->mq, op->env);
@@ -1738,78 +1732,5 @@ GNUNET_RECLAIM_ticket_revoke (
1738 return op; 1732 return op;
1739} 1733}
1740 1734
1741size_t
1742GNUNET_RECLAIM_ticket_serialize_get_size (const struct
1743 GNUNET_RECLAIM_Ticket *tkt)
1744{
1745 size_t size = sizeof (tkt->rnd);
1746 size += GNUNET_CRYPTO_public_key_get_length (&tkt->identity);
1747 size += GNUNET_CRYPTO_public_key_get_length (&tkt->audience);
1748 return size;
1749}
1750
1751enum GNUNET_GenericReturnValue
1752GNUNET_RECLAIM_read_ticket_from_buffer (const void *buffer,
1753 size_t len,
1754 struct GNUNET_RECLAIM_Ticket *tkt,
1755 size_t *tb_read)
1756{
1757 const char *tmp = buffer;
1758 size_t read = 0;
1759 size_t left = len;
1760 if (GNUNET_SYSERR ==
1761 GNUNET_CRYPTO_read_public_key_from_buffer (tmp,
1762 left,
1763 &tkt->identity,
1764 &read))
1765 return GNUNET_SYSERR;
1766 left -= read;
1767 tmp += read;
1768 if (GNUNET_SYSERR ==
1769 GNUNET_CRYPTO_read_public_key_from_buffer (tmp,
1770 left,
1771 &tkt->audience,
1772 &read))
1773 return GNUNET_SYSERR;
1774 left -= read;
1775 tmp += read;
1776 if (left < sizeof (tkt->rnd))
1777 return GNUNET_SYSERR;
1778 memcpy (&tkt->rnd, tmp, sizeof (tkt->rnd));
1779 *tb_read = tmp - (char*) buffer + sizeof (tkt->rnd);
1780 return GNUNET_OK;
1781}
1782
1783
1784ssize_t
1785GNUNET_RECLAIM_write_ticket_to_buffer (const struct
1786 GNUNET_RECLAIM_Ticket *tkt,
1787 void *buffer,
1788 size_t len)
1789{
1790 char *tmp = buffer;
1791 size_t left = len;
1792 ssize_t written = 0;
1793 written = GNUNET_CRYPTO_write_public_key_to_buffer (&tkt->identity,
1794 buffer,
1795 left);
1796 if (0 > written)
1797 return written;
1798 left -= written;
1799 tmp += written;
1800 written = GNUNET_CRYPTO_write_public_key_to_buffer (&tkt->audience,
1801 tmp,
1802 left);
1803 if (0 > written)
1804 return written;
1805 left -= written;
1806 tmp += written;
1807 if (left < sizeof (tkt->rnd))
1808 return -1;
1809 memcpy (tmp, &tkt->rnd, sizeof (tkt->rnd));
1810 return tmp - (char*) buffer + sizeof (tkt->rnd);
1811}
1812
1813
1814 1735
1815/* end of reclaim_api.c */ 1736/* end of reclaim_api.c */
diff --git a/src/service/regex/Makefile.am b/src/service/regex/Makefile.am
index 0ce42880d..63c166a23 100644
--- a/src/service/regex/Makefile.am
+++ b/src/service/regex/Makefile.am
@@ -75,13 +75,13 @@ gnunet_daemon_regexprofiler_LDADD = -lm \
75gnunet_daemon_regexprofiler_LDFLAGS = \ 75gnunet_daemon_regexprofiler_LDFLAGS = \
76 $(GN_LIBINTL) 76 $(GN_LIBINTL)
77 77
78check_PROGRAMS = \ 78#check_PROGRAMS = \
79 test_regex_integration \ 79# test_regex_integration \
80 test_regex_eval_api \ 80# test_regex_eval_api \
81 test_regex_iterate_api \ 81# test_regex_iterate_api \
82 test_regex_proofs \ 82# test_regex_proofs \
83 test_regex_graph_api \ 83# test_regex_graph_api \
84 test_regex_api 84# test_regex_api
85 85
86if ENABLE_TEST_RUN 86if ENABLE_TEST_RUN
87 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 87 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/service/rest/json_reclaim.c b/src/service/rest/json_reclaim.c
index b1ca7a4a5..3b43a37e4 100644
--- a/src/service/rest/json_reclaim.c
+++ b/src/service/rest/json_reclaim.c
@@ -170,9 +170,7 @@ static int
170parse_ticket (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) 170parse_ticket (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
171{ 171{
172 struct GNUNET_RECLAIM_Ticket *ticket; 172 struct GNUNET_RECLAIM_Ticket *ticket;
173 const char *rnd_str; 173 const char *gns_str;
174 const char *aud_str;
175 const char *id_str;
176 int unpack_state; 174 int unpack_state;
177 175
178 GNUNET_assert (NULL != root); 176 GNUNET_assert (NULL != root);
@@ -185,13 +183,9 @@ parse_ticket (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
185 } 183 }
186 // interpret single ticket 184 // interpret single ticket
187 unpack_state = json_unpack (root, 185 unpack_state = json_unpack (root,
188 "{s:s, s:s, s:s!}", 186 "{s:s}",
189 "rnd", 187 "gns_name",
190 &rnd_str, 188 &gns_str);
191 "audience",
192 &aud_str,
193 "issuer",
194 &id_str);
195 if (0 != unpack_state) 189 if (0 != unpack_state)
196 { 190 {
197 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -199,36 +193,7 @@ parse_ticket (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec)
199 return GNUNET_SYSERR; 193 return GNUNET_SYSERR;
200 } 194 }
201 ticket = GNUNET_new (struct GNUNET_RECLAIM_Ticket); 195 ticket = GNUNET_new (struct GNUNET_RECLAIM_Ticket);
202 if (GNUNET_OK != GNUNET_STRINGS_string_to_data (rnd_str, 196 strncpy (ticket->gns_name, gns_str, sizeof (ticket->gns_name));
203 strlen (rnd_str),
204 &ticket->rnd,
205 sizeof(ticket->rnd)))
206 {
207 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Rnd invalid\n");
208 GNUNET_free (ticket);
209 return GNUNET_SYSERR;
210 }
211 if (GNUNET_OK !=
212 GNUNET_STRINGS_string_to_data (id_str,
213 strlen (id_str),
214 &ticket->identity,
215 sizeof(ticket->identity)))
216 {
217 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Identity invalid\n");
218 GNUNET_free (ticket);
219 return GNUNET_SYSERR;
220 }
221
222 if (GNUNET_OK !=
223 GNUNET_STRINGS_string_to_data (aud_str,
224 strlen (aud_str),
225 &ticket->audience,
226 sizeof(ticket->audience)))
227 {
228 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Audience invalid\n");
229 GNUNET_free (ticket);
230 return GNUNET_SYSERR;
231 }
232 197
233 *(struct GNUNET_RECLAIM_Ticket **) spec->ptr = ticket; 198 *(struct GNUNET_RECLAIM_Ticket **) spec->ptr = ticket;
234 return GNUNET_OK; 199 return GNUNET_OK;
@@ -286,7 +251,8 @@ GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket)
286 * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error 251 * @return #GNUNET_OK upon successful parsing; #GNUNET_SYSERR upon error
287 */ 252 */
288static int 253static int
289parse_credential (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) 254parse_credential (void *cls, json_t *root, struct GNUNET_JSON_Specification *
255 spec)
290{ 256{
291 struct GNUNET_RECLAIM_Credential *cred; 257 struct GNUNET_RECLAIM_Credential *cred;
292 const char *name_str = NULL; 258 const char *name_str = NULL;
@@ -325,9 +291,12 @@ parse_credential (void *cls, json_t *root, struct GNUNET_JSON_Specification *spe
325 "Error json object has a wrong format!\n"); 291 "Error json object has a wrong format!\n");
326 return GNUNET_SYSERR; 292 return GNUNET_SYSERR;
327 } 293 }
328 if (json_is_string (val_json)) { 294 if (json_is_string (val_json))
295 {
329 val_str = GNUNET_strdup (json_string_value (val_json)); 296 val_str = GNUNET_strdup (json_string_value (val_json));
330 } else { 297 }
298 else
299 {
331 val_str = json_dumps (val_json, JSON_COMPACT); 300 val_str = json_dumps (val_json, JSON_COMPACT);
332 } 301 }
333 type = GNUNET_RECLAIM_credential_typename_to_number (type_str); 302 type = GNUNET_RECLAIM_credential_typename_to_number (type_str);
diff --git a/src/service/rest/oidc_helper.c b/src/service/rest/oidc_helper.c
index a2da7312b..08c99dc8b 100644
--- a/src/service/rest/oidc_helper.c
+++ b/src/service/rest/oidc_helper.c
@@ -24,10 +24,11 @@
24 * @author Martin Schanzenbach 24 * @author Martin Schanzenbach
25 * @author Tristan Schwieren 25 * @author Tristan Schwieren
26 */ 26 */
27#include "platform.h"
28#include <inttypes.h> 27#include <inttypes.h>
29#include <jansson.h> 28#include <jansson.h>
30#include <jose/jose.h> 29#include <jose/jose.h>
30#include "gnunet_gns_service.h"
31#include "gnunet_gnsrecord_lib.h"
31#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
32#include "gnunet_reclaim_lib.h" 33#include "gnunet_reclaim_lib.h"
33#include "gnunet_reclaim_service.h" 34#include "gnunet_reclaim_service.h"
@@ -211,7 +212,8 @@ generate_userinfo_json (const struct GNUNET_CRYPTO_PublicKey *sub_key,
211 pres_val_str = 212 pres_val_str =
212 GNUNET_RECLAIM_presentation_value_to_string (ple->presentation->type, 213 GNUNET_RECLAIM_presentation_value_to_string (ple->presentation->type,
213 ple->presentation->data, 214 ple->presentation->data,
214 ple->presentation->data_size); 215 ple->presentation->data_size)
216 ;
215 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 217 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
216 "Presentation is: %s\n", pres_val_str); 218 "Presentation is: %s\n", pres_val_str);
217 json_object_set_new (aggr_sources_jwt, 219 json_object_set_new (aggr_sources_jwt,
@@ -359,7 +361,7 @@ OIDC_generate_userinfo (const struct GNUNET_CRYPTO_PublicKey *sub_key,
359 361
360 362
361char * 363char *
362generate_id_token_body (const struct GNUNET_CRYPTO_PublicKey *aud_key, 364generate_id_token_body (const char *rp_uri,
363 const struct GNUNET_CRYPTO_PublicKey *sub_key, 365 const struct GNUNET_CRYPTO_PublicKey *sub_key,
364 const struct GNUNET_RECLAIM_AttributeList *attrs, 366 const struct GNUNET_RECLAIM_AttributeList *attrs,
365 const struct 367 const struct
@@ -370,7 +372,6 @@ generate_id_token_body (const struct GNUNET_CRYPTO_PublicKey *aud_key,
370 struct GNUNET_TIME_Absolute exp_time; 372 struct GNUNET_TIME_Absolute exp_time;
371 struct GNUNET_TIME_Absolute time_now; 373 struct GNUNET_TIME_Absolute time_now;
372 json_t *body; 374 json_t *body;
373 char *audience;
374 char *subject; 375 char *subject;
375 char *body_str; 376 char *body_str;
376 377
@@ -388,13 +389,9 @@ generate_id_token_body (const struct GNUNET_CRYPTO_PublicKey *aud_key,
388 GNUNET_STRINGS_data_to_string_alloc (sub_key, 389 GNUNET_STRINGS_data_to_string_alloc (sub_key,
389 sizeof(struct 390 sizeof(struct
390 GNUNET_CRYPTO_PublicKey)); 391 GNUNET_CRYPTO_PublicKey));
391 audience =
392 GNUNET_STRINGS_data_to_string_alloc (aud_key,
393 sizeof(struct
394 GNUNET_CRYPTO_PublicKey));
395 392
396 // aud REQUIRED public key client_id must be there 393 // aud REQUIRED public key client_id must be there
397 json_object_set_new (body, "aud", json_string (audience)); 394 json_object_set_new (body, "aud", json_string (rp_uri));
398 // iat 395 // iat
399 json_object_set_new (body, 396 json_object_set_new (body,
400 "iat", 397 "iat",
@@ -417,14 +414,13 @@ generate_id_token_body (const struct GNUNET_CRYPTO_PublicKey *aud_key,
417 414
418 json_decref (body); 415 json_decref (body);
419 GNUNET_free (subject); 416 GNUNET_free (subject);
420 GNUNET_free (audience);
421 417
422 return body_str; 418 return body_str;
423} 419}
424 420
425 421
426char * 422char *
427OIDC_generate_id_token_rsa (const struct GNUNET_CRYPTO_PublicKey *aud_key, 423OIDC_generate_id_token_rsa (const char *rp_uri,
428 const struct GNUNET_CRYPTO_PublicKey *sub_key, 424 const struct GNUNET_CRYPTO_PublicKey *sub_key,
429 const struct GNUNET_RECLAIM_AttributeList *attrs, 425 const struct GNUNET_RECLAIM_AttributeList *attrs,
430 const struct 426 const struct
@@ -438,7 +434,7 @@ OIDC_generate_id_token_rsa (const struct GNUNET_CRYPTO_PublicKey *aud_key,
438 char *result; 434 char *result;
439 435
440 // Generate the body of the JSON Web Signature 436 // Generate the body of the JSON Web Signature
441 body_str = generate_id_token_body (aud_key, 437 body_str = generate_id_token_body (rp_uri,
442 sub_key, 438 sub_key,
443 attrs, 439 attrs,
444 presentations, 440 presentations,
@@ -474,19 +470,9 @@ OIDC_generate_id_token_rsa (const struct GNUNET_CRYPTO_PublicKey *aud_key,
474 return result; 470 return result;
475} 471}
476 472
477/** 473
478 * Create a JWT using HMAC (HS256) from attributes
479 *
480 * @param aud_key the public of the audience
481 * @param sub_key the public key of the subject
482 * @param attrs the attribute list
483 * @param presentations credential presentation list (may be empty)
484 * @param expiration_time the validity of the token
485 * @param secret_key the key used to sign the JWT
486 * @return a new base64-encoded JWT string.
487 */
488char * 474char *
489OIDC_generate_id_token_hmac (const struct GNUNET_CRYPTO_PublicKey *aud_key, 475OIDC_generate_id_token_hmac (const char *rp_uri,
490 const struct GNUNET_CRYPTO_PublicKey *sub_key, 476 const struct GNUNET_CRYPTO_PublicKey *sub_key,
491 const struct GNUNET_RECLAIM_AttributeList *attrs, 477 const struct GNUNET_RECLAIM_AttributeList *attrs,
492 const struct 478 const struct
@@ -517,7 +503,7 @@ OIDC_generate_id_token_hmac (const struct GNUNET_CRYPTO_PublicKey *aud_key,
517 fix_base64 (header_base64); 503 fix_base64 (header_base64);
518 504
519 // Generate and encode the body of the JSON Web Signature 505 // Generate and encode the body of the JSON Web Signature
520 body_str = generate_id_token_body (aud_key, 506 body_str = generate_id_token_body (rp_uri,
521 sub_key, 507 sub_key,
522 attrs, 508 attrs,
523 presentations, 509 presentations,
@@ -603,7 +589,8 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_PrivateKey *issuer,
603 /** PLAINTEXT **/ 589 /** PLAINTEXT **/
604 // Assign ticket 590 // Assign ticket
605 memset (&params, 0, sizeof(params)); 591 memset (&params, 0, sizeof(params));
606 params.ticket = *ticket; 592 memcpy (params.ticket.gns_name, ticket->gns_name, strlen (ticket->gns_name)
593 + 1);
607 // Assign nonce 594 // Assign nonce
608 payload_len = sizeof(struct OIDC_Parameters); 595 payload_len = sizeof(struct OIDC_Parameters);
609 if ((NULL != nonce_str) && (strcmp ("", nonce_str) != 0)) 596 if ((NULL != nonce_str) && (strcmp ("", nonce_str) != 0))
@@ -691,9 +678,9 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_PrivateKey *issuer,
691 // Sign and store signature 678 // Sign and store signature
692 if (GNUNET_SYSERR == 679 if (GNUNET_SYSERR ==
693 GNUNET_CRYPTO_sign_ (issuer, 680 GNUNET_CRYPTO_sign_ (issuer,
694 purpose, 681 purpose,
695 (struct GNUNET_CRYPTO_Signature *) 682 (struct GNUNET_CRYPTO_Signature *)
696 buf_ptr)) 683 buf_ptr))
697 { 684 {
698 GNUNET_break (0); 685 GNUNET_break (0);
699 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to sign code\n"); 686 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to sign code\n");
@@ -764,14 +751,15 @@ check_code_challenge (const char *code_challenge,
764 * @return GNUNET_OK if successful, else GNUNET_SYSERR 751 * @return GNUNET_OK if successful, else GNUNET_SYSERR
765 */ 752 */
766int 753int
767OIDC_parse_authz_code (const struct GNUNET_CRYPTO_PublicKey *audience, 754OIDC_parse_authz_code (const char *rp_uri,
755 const struct GNUNET_CRYPTO_PublicKey *cid,
768 const char *code, 756 const char *code,
769 const char *code_verifier, 757 const char *code_verifier,
770 struct GNUNET_RECLAIM_Ticket *ticket, 758 struct GNUNET_RECLAIM_Ticket *ticket,
771 struct GNUNET_RECLAIM_AttributeList **attrs, 759 struct GNUNET_RECLAIM_AttributeList **attrs,
772 struct GNUNET_RECLAIM_PresentationList **presentations, 760 struct GNUNET_RECLAIM_PresentationList **presentations,
773 char **nonce_str, 761 char **nonce_str,
774 enum OIDC_VerificationOptions opts) 762 enum OIDC_VerificationOptions opts, char **emsg)
775{ 763{
776 char *code_payload; 764 char *code_payload;
777 char *ptr; 765 char *ptr;
@@ -781,6 +769,7 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_PublicKey *audience,
781 char *code_challenge; 769 char *code_challenge;
782 struct GNUNET_CRYPTO_EccSignaturePurpose *purpose; 770 struct GNUNET_CRYPTO_EccSignaturePurpose *purpose;
783 struct GNUNET_CRYPTO_Signature *signature; 771 struct GNUNET_CRYPTO_Signature *signature;
772 struct GNUNET_CRYPTO_PublicKey iss;
784 uint32_t code_challenge_len; 773 uint32_t code_challenge_len;
785 uint32_t attrs_ser_len; 774 uint32_t attrs_ser_len;
786 uint32_t pres_ser_len; 775 uint32_t pres_ser_len;
@@ -789,6 +778,8 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_PublicKey *audience,
789 uint32_t nonce_len = 0; 778 uint32_t nonce_len = 0;
790 struct OIDC_Parameters *params; 779 struct OIDC_Parameters *params;
791 780
781
782 GNUNET_GNS_parse_ztld (ticket->gns_name, &iss);
792 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to decode `%s'\n", code); 783 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to decode `%s'\n", code);
793 code_payload = NULL; 784 code_payload = NULL;
794 code_payload_len = 785 code_payload_len =
@@ -822,6 +813,8 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_PublicKey *audience,
822 code_challenge_len, 813 code_challenge_len,
823 code_verifier)) 814 code_verifier))
824 { 815 {
816 GNUNET_asprintf (emsg, "Code verifier `%s' invalid for challenge `%s'",
817 code_verifier, code_challenge);
825 GNUNET_free (code_payload); 818 GNUNET_free (code_payload);
826 return GNUNET_SYSERR; 819 return GNUNET_SYSERR;
827 } 820 }
@@ -838,26 +831,18 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_PublicKey *audience,
838 memcpy (ticket, &params->ticket, sizeof(params->ticket)); 831 memcpy (ticket, &params->ticket, sizeof(params->ticket));
839 // Signature 832 // Signature
840 // GNUNET_CRYPTO_ecdsa_key_get_public (ecdsa_priv, &ecdsa_pub); 833 // GNUNET_CRYPTO_ecdsa_key_get_public (ecdsa_priv, &ecdsa_pub);
841 if (0 != GNUNET_memcmp (audience, &ticket->audience))
842 {
843 GNUNET_free (code_payload);
844 if (NULL != *nonce_str)
845 GNUNET_free (*nonce_str);
846 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
847 "Audience in ticket does not match client!\n");
848 return GNUNET_SYSERR;
849 }
850 if (GNUNET_OK != 834 if (GNUNET_OK !=
851 GNUNET_CRYPTO_signature_verify_ ( 835 GNUNET_CRYPTO_signature_verify_ (
852 GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN, 836 GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN,
853 purpose, 837 purpose,
854 signature, 838 signature,
855 &(ticket->identity))) 839 &iss))
856 { 840 {
857 GNUNET_free (code_payload); 841 GNUNET_free (code_payload);
858 if (NULL != *nonce_str) 842 if (NULL != *nonce_str)
859 GNUNET_free (*nonce_str); 843 GNUNET_free (*nonce_str);
860 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Signature of AuthZ code invalid!\n"); 844 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Signature of AuthZ code invalid!\n");
845 *emsg = GNUNET_strdup ("Signature verification failed");
861 return GNUNET_SYSERR; 846 return GNUNET_SYSERR;
862 } 847 }
863 // Attributes 848 // Attributes
@@ -913,13 +898,17 @@ OIDC_build_token_response (const char *access_token,
913 * Generate a new access token 898 * Generate a new access token
914 */ 899 */
915char * 900char *
916OIDC_access_token_new (const struct GNUNET_RECLAIM_Ticket *ticket) 901OIDC_access_token_new (const struct GNUNET_RECLAIM_Ticket *ticket,
902 const char *rp_uri)
917{ 903{
918 char *access_token; 904 char *access_token;
905 char *tkt_b64;
919 906
920 GNUNET_STRINGS_base64_encode (ticket, 907 GNUNET_STRINGS_base64_encode (ticket,
921 sizeof(*ticket), 908 sizeof(*ticket),
922 &access_token); 909 &tkt_b64);
910 GNUNET_asprintf (&access_token, "%s-%s", tkt_b64, rp_uri);
911 GNUNET_free (tkt_b64);
923 return access_token; 912 return access_token;
924} 913}
925 914
@@ -929,19 +918,31 @@ OIDC_access_token_new (const struct GNUNET_RECLAIM_Ticket *ticket)
929 */ 918 */
930int 919int
931OIDC_access_token_parse (const char *token, 920OIDC_access_token_parse (const char *token,
932 struct GNUNET_RECLAIM_Ticket **ticket) 921 struct GNUNET_RECLAIM_Ticket **ticket,
922 char **rp_uri)
933{ 923{
934 size_t sret; 924 size_t sret;
935 char *decoded; 925 char *decoded;
936 sret = GNUNET_STRINGS_base64_decode (token, 926 char *tmp;
937 strlen (token), 927 char *tkt_str;
928 char *rp_uri_str;
929 tmp = GNUNET_strdup (token);
930 tkt_str = strtok (tmp, "-");
931 GNUNET_assert (NULL != tkt_str); // FIXME handle
932 rp_uri_str = strtok (NULL, "-");
933 GNUNET_assert (NULL != rp_uri_str); // FIXME handle
934 sret = GNUNET_STRINGS_base64_decode (tkt_str,
935 strlen (tkt_str),
938 (void**) &decoded); 936 (void**) &decoded);
939 if (sizeof (struct GNUNET_RECLAIM_Ticket) != sret) 937 if (sizeof (struct GNUNET_RECLAIM_Ticket) != sret)
940 { 938 {
941 GNUNET_free (decoded); 939 GNUNET_free (decoded);
940 GNUNET_free (tmp);
942 return GNUNET_SYSERR; 941 return GNUNET_SYSERR;
943 } 942 }
944 *ticket = (struct GNUNET_RECLAIM_Ticket *) decoded; 943 *ticket = (struct GNUNET_RECLAIM_Ticket *) decoded;
944 *rp_uri = GNUNET_strdup (rp_uri_str);
945 GNUNET_free (tmp);
945 return GNUNET_OK; 946 return GNUNET_OK;
946} 947}
947 948
diff --git a/src/service/rest/oidc_helper.h b/src/service/rest/oidc_helper.h
index de788fbdb..d706daa6b 100644
--- a/src/service/rest/oidc_helper.h
+++ b/src/service/rest/oidc_helper.h
@@ -27,6 +27,8 @@
27#ifndef JWT_H 27#ifndef JWT_H
28#define JWT_H 28#define JWT_H
29 29
30#include "gnunet_util_lib.h"
31#include "gnunet_reclaim_service.h"
30#define JWT_ALG "alg" 32#define JWT_ALG "alg"
31#define JWT_TYP "typ" 33#define JWT_TYP "typ"
32#define JWT_TYP_VALUE "jwt" 34#define JWT_TYP_VALUE "jwt"
@@ -52,7 +54,7 @@ enum OIDC_VerificationOptions
52/** 54/**
53 * Create a JWT using RSA256 algorithm from attributes 55 * Create a JWT using RSA256 algorithm from attributes
54 * 56 *
55 * @param aud_key the public of the audience 57 * @param rp_uri the RP URI
56 * @param sub_key the public key of the subject 58 * @param sub_key the public key of the subject
57 * @param attrs the attribute list 59 * @param attrs the attribute list
58 * @param presentations credential presentation list (may be empty) 60 * @param presentations credential presentation list (may be empty)
@@ -61,7 +63,7 @@ enum OIDC_VerificationOptions
61 * @return a new base64-encoded JWT string. 63 * @return a new base64-encoded JWT string.
62 */ 64 */
63char * 65char *
64OIDC_generate_id_token_rsa (const struct GNUNET_CRYPTO_PublicKey *aud_key, 66OIDC_generate_id_token_rsa (const char *rp_uri,
65 const struct GNUNET_CRYPTO_PublicKey *sub_key, 67 const struct GNUNET_CRYPTO_PublicKey *sub_key,
66 const struct GNUNET_RECLAIM_AttributeList *attrs, 68 const struct GNUNET_RECLAIM_AttributeList *attrs,
67 const struct 69 const struct
@@ -73,7 +75,7 @@ OIDC_generate_id_token_rsa (const struct GNUNET_CRYPTO_PublicKey *aud_key,
73/** 75/**
74 * Create a JWT using HMAC (HS256) from attributes 76 * Create a JWT using HMAC (HS256) from attributes
75 * 77 *
76 * @param aud_key the public of the audience 78 * @param rp_uri the RP URI
77 * @param sub_key the public key of the subject 79 * @param sub_key the public key of the subject
78 * @param attrs the attribute list 80 * @param attrs the attribute list
79 * @param presentations credential presentation list (may be empty) 81 * @param presentations credential presentation list (may be empty)
@@ -82,7 +84,7 @@ OIDC_generate_id_token_rsa (const struct GNUNET_CRYPTO_PublicKey *aud_key,
82 * @return a new base64-encoded JWT string. 84 * @return a new base64-encoded JWT string.
83 */ 85 */
84char* 86char*
85OIDC_generate_id_token_hmac (const struct GNUNET_CRYPTO_PublicKey *aud_key, 87OIDC_generate_id_token_hmac (const char *rp_uri,
86 const struct GNUNET_CRYPTO_PublicKey *sub_key, 88 const struct GNUNET_CRYPTO_PublicKey *sub_key,
87 const struct GNUNET_RECLAIM_AttributeList *attrs, 89 const struct GNUNET_RECLAIM_AttributeList *attrs,
88 const struct 90 const struct
@@ -95,7 +97,7 @@ OIDC_generate_id_token_hmac (const struct GNUNET_CRYPTO_PublicKey *aud_key,
95 * Builds an OIDC authorization code including 97 * Builds an OIDC authorization code including
96 * a reclaim ticket and nonce 98 * a reclaim ticket and nonce
97 * 99 *
98 * @param issuer the issuer of the ticket, used to sign the ticket and nonce 100 * @param issuer the issuer
99 * @param ticket the ticket to include in the code 101 * @param ticket the ticket to include in the code
100 * @param attrs list of attributes to share 102 * @param attrs list of attributes to share
101 * @param presentations credential presentation list 103 * @param presentations credential presentation list
@@ -118,7 +120,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_PrivateKey *issuer,
118 * authorization code. 120 * authorization code.
119 * This also verifies the signature in the code. 121 * This also verifies the signature in the code.
120 * 122 *
121 * @param ecdsa_priv the audience of the ticket 123 * @param rp_uri the RP URI
122 * @param code the string representation of the code 124 * @param code the string representation of the code
123 * @param code_verfier PKCE code verifier 125 * @param code_verfier PKCE code verifier
124 * @param ticket where to store the ticket 126 * @param ticket where to store the ticket
@@ -128,14 +130,15 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_PrivateKey *issuer,
128 * @return GNUNET_OK if successful, else GNUNET_SYSERR 130 * @return GNUNET_OK if successful, else GNUNET_SYSERR
129 */ 131 */
130int 132int
131OIDC_parse_authz_code (const struct GNUNET_CRYPTO_PublicKey *ecdsa_pub, 133OIDC_parse_authz_code (const char *rp_uri,
134 const struct GNUNET_CRYPTO_PublicKey *cid,
132 const char *code, 135 const char *code,
133 const char *code_verifier, 136 const char *code_verifier,
134 struct GNUNET_RECLAIM_Ticket *ticket, 137 struct GNUNET_RECLAIM_Ticket *ticket,
135 struct GNUNET_RECLAIM_AttributeList **attrs, 138 struct GNUNET_RECLAIM_AttributeList **attrs,
136 struct GNUNET_RECLAIM_PresentationList **presentations, 139 struct GNUNET_RECLAIM_PresentationList **presentations,
137 char **nonce, 140 char **nonce,
138 enum OIDC_VerificationOptions opts); 141 enum OIDC_VerificationOptions opts, char **emsg);
139 142
140/** 143/**
141 * Build a token response for a token request 144 * Build a token response for a token request
@@ -156,14 +159,16 @@ OIDC_build_token_response (const char *access_token,
156 * Generate a new access token 159 * Generate a new access token
157 */ 160 */
158char* 161char*
159OIDC_access_token_new (const struct GNUNET_RECLAIM_Ticket *ticket); 162OIDC_access_token_new (const struct GNUNET_RECLAIM_Ticket *ticket,
163 const char *rp_uri);
160 164
161/** 165/**
162 * Parse an access token 166 * Parse an access token
163 */ 167 */
164int 168int
165OIDC_access_token_parse (const char *token, 169OIDC_access_token_parse (const char *token,
166 struct GNUNET_RECLAIM_Ticket **ticket); 170 struct GNUNET_RECLAIM_Ticket **ticket,
171 char **rp_uri);
167 172
168 173
169/** 174/**
diff --git a/src/service/rest/openid_plugin.c b/src/service/rest/openid_plugin.c
index 61904494b..fc1125690 100644
--- a/src/service/rest/openid_plugin.c
+++ b/src/service/rest/openid_plugin.c
@@ -34,12 +34,10 @@
34#include "gnunet_gns_service.h" 34#include "gnunet_gns_service.h"
35#include "gnunet_gnsrecord_lib.h" 35#include "gnunet_gnsrecord_lib.h"
36#include "gnunet_identity_service.h" 36#include "gnunet_identity_service.h"
37#include "gnunet_namestore_service.h"
38#include "gnunet_reclaim_lib.h" 37#include "gnunet_reclaim_lib.h"
39#include "gnunet_reclaim_service.h" 38#include "gnunet_reclaim_service.h"
40#include "gnunet_rest_lib.h" 39#include "gnunet_rest_lib.h"
41#include "gnunet_rest_plugin.h" 40#include "gnunet_rest_plugin.h"
42#include "gnunet_signatures.h"
43#include "microhttpd.h" 41#include "microhttpd.h"
44#include "oidc_helper.h" 42#include "oidc_helper.h"
45 43
@@ -242,7 +240,7 @@
242 * How long to wait for a consume in userinfo endpoint 240 * How long to wait for a consume in userinfo endpoint
243 */ 241 */
244#define CONSUME_TIMEOUT GNUNET_TIME_relative_multiply ( \ 242#define CONSUME_TIMEOUT GNUNET_TIME_relative_multiply ( \
245 GNUNET_TIME_UNIT_SECONDS,2) 243 GNUNET_TIME_UNIT_SECONDS,2)
246 244
247/** 245/**
248 * OIDC ignored parameter array 246 * OIDC ignored parameter array
@@ -1248,7 +1246,7 @@ oidc_cred_collect_finished_cb (void *cls)
1248 le_m->attribute->name); 1246 le_m->attribute->name);
1249 handle->idp_op = GNUNET_RECLAIM_ticket_issue (idp, 1247 handle->idp_op = GNUNET_RECLAIM_ticket_issue (idp,
1250 &handle->priv_key, 1248 &handle->priv_key,
1251 &handle->oidc->client_pkey, 1249 handle->oidc->client_id,
1252 merged_list, 1250 merged_list,
1253 &oidc_ticket_issue_cb, 1251 &oidc_ticket_issue_cb,
1254 handle); 1252 handle);
@@ -2193,6 +2191,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2193 char *oidc_jwk_path = NULL; 2191 char *oidc_jwk_path = NULL;
2194 char *oidc_directory = NULL; 2192 char *oidc_directory = NULL;
2195 char *tmp_at = NULL; 2193 char *tmp_at = NULL;
2194 char *received_cid = NULL;
2196 2195
2197 /* 2196 /*
2198 * Check Authorization 2197 * Check Authorization
@@ -2204,6 +2203,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2204 GNUNET_SCHEDULER_add_now (&do_error, handle); 2203 GNUNET_SCHEDULER_add_now (&do_error, handle);
2205 return; 2204 return;
2206 } 2205 }
2206 received_cid = get_url_parameter_copy (handle, OIDC_CLIENT_ID_KEY);
2207 2207
2208 /* 2208 /*
2209 * Check parameter 2209 * Check parameter
@@ -2265,12 +2265,16 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2265 } 2265 }
2266 2266
2267 // decode code 2267 // decode code
2268 if (GNUNET_OK != OIDC_parse_authz_code (&cid, code, code_verifier, &ticket, 2268 char *emsg = NULL;
2269 if (GNUNET_OK != OIDC_parse_authz_code (received_cid, &cid, code,
2270 code_verifier,
2271 &ticket,
2269 &cl, &pl, &nonce, 2272 &cl, &pl, &nonce,
2270 OIDC_VERIFICATION_DEFAULT)) 2273 OIDC_VERIFICATION_DEFAULT,
2274 &emsg))
2271 { 2275 {
2272 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST); 2276 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST);
2273 handle->edesc = GNUNET_strdup ("invalid code"); 2277 handle->edesc = emsg;
2274 handle->response_code = MHD_HTTP_BAD_REQUEST; 2278 handle->response_code = MHD_HTTP_BAD_REQUEST;
2275 GNUNET_free (code); 2279 GNUNET_free (code);
2276 if (NULL != code_verifier) 2280 if (NULL != code_verifier)
@@ -2311,6 +2315,9 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2311 jwa = JWT_ALG_VALUE_RSA; 2315 jwa = JWT_ALG_VALUE_RSA;
2312 } 2316 }
2313 2317
2318 struct GNUNET_CRYPTO_PublicKey issuer;
2319 GNUNET_GNS_parse_ztld (ticket.gns_name, &issuer);
2320
2314 if (! strcmp (jwa, JWT_ALG_VALUE_RSA)) 2321 if (! strcmp (jwa, JWT_ALG_VALUE_RSA))
2315 { 2322 {
2316 // Replace for now 2323 // Replace for now
@@ -2338,8 +2345,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2338 } 2345 }
2339 2346
2340 // Generate oidc token 2347 // Generate oidc token
2341 id_token = OIDC_generate_id_token_rsa (&ticket.audience, 2348 id_token = OIDC_generate_id_token_rsa (received_cid,
2342 &ticket.identity, 2349 &issuer,
2343 cl, 2350 cl,
2344 pl, 2351 pl,
2345 &expiration_time, 2352 &expiration_time,
@@ -2366,8 +2373,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2366 return; 2373 return;
2367 } 2374 }
2368 2375
2369 id_token = OIDC_generate_id_token_hmac (&ticket.audience, 2376 id_token = OIDC_generate_id_token_hmac (received_cid,
2370 &ticket.identity, 2377 &issuer,
2371 cl, 2378 cl,
2372 pl, 2379 pl,
2373 &expiration_time, 2380 &expiration_time,
@@ -2383,7 +2390,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2383 2390
2384 if (NULL != nonce) 2391 if (NULL != nonce)
2385 GNUNET_free (nonce); 2392 GNUNET_free (nonce);
2386 access_token = OIDC_access_token_new (&ticket); 2393 access_token = OIDC_access_token_new (&ticket, handle->oidc->redirect_uri);
2387 /** 2394 /**
2388 * Store mapping from access token to code so we can later 2395 * Store mapping from access token to code so we can later
2389 * fall back on the provided attributes in userinfo one time. 2396 * fall back on the provided attributes in userinfo one time.
@@ -2481,7 +2488,15 @@ consume_ticket (void *cls,
2481 2488
2482 if (NULL == identity) 2489 if (NULL == identity)
2483 { 2490 {
2484 result_str = OIDC_generate_userinfo (&handle->ticket.identity, 2491 char *tmp = GNUNET_strdup (handle->ticket.gns_name);
2492 GNUNET_assert (NULL != strtok (tmp, "."));
2493 char *key = strtok (NULL, ".");
2494 struct GNUNET_CRYPTO_PublicKey issuer;
2495 GNUNET_assert (NULL != key);
2496 GNUNET_assert (GNUNET_OK ==
2497 GNUNET_CRYPTO_public_key_from_string (key, &issuer));
2498 GNUNET_free (tmp);
2499 result_str = OIDC_generate_userinfo (&issuer,
2485 handle->attr_userinfo_list, 2500 handle->attr_userinfo_list,
2486 handle->presentations); 2501 handle->presentations);
2487 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Userinfo: %s\n", result_str); 2502 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Userinfo: %s\n", result_str);
@@ -2538,11 +2553,12 @@ consume_fail (void *cls)
2538 struct GNUNET_RECLAIM_AttributeList *cl = NULL; 2553 struct GNUNET_RECLAIM_AttributeList *cl = NULL;
2539 struct GNUNET_RECLAIM_PresentationList *pl = NULL; 2554 struct GNUNET_RECLAIM_PresentationList *pl = NULL;
2540 struct GNUNET_RECLAIM_Ticket ticket; 2555 struct GNUNET_RECLAIM_Ticket ticket;
2556 struct GNUNET_CRYPTO_PublicKey cid;
2541 struct MHD_Response *resp; 2557 struct MHD_Response *resp;
2542 char *nonce; 2558 char *nonce;
2543 char *cached_code; 2559 char *cached_code;
2544 char *result_str; 2560 char *result_str;
2545 2561 char *received_cid;
2546 2562
2547 handle->consume_timeout_op = NULL; 2563 handle->consume_timeout_op = NULL;
2548 if (NULL != handle->idp_op) 2564 if (NULL != handle->idp_op)
@@ -2571,15 +2587,21 @@ consume_fail (void *cls)
2571 GNUNET_CONTAINER_multihashmap_remove (oidc_code_cache, 2587 GNUNET_CONTAINER_multihashmap_remove (oidc_code_cache,
2572 &cache_key, 2588 &cache_key,
2573 cached_code)); 2589 cached_code));
2590 received_cid = get_url_parameter_copy (handle, OIDC_CLIENT_ID_KEY);
2591 GNUNET_STRINGS_string_to_data (received_cid,
2592 strlen (received_cid),
2593 &cid,
2594 sizeof(struct GNUNET_CRYPTO_PublicKey));
2574 2595
2575 // decode code 2596 // decode code
2576 if (GNUNET_OK != OIDC_parse_authz_code (&handle->ticket.audience, 2597 char *emsg;
2598 if (GNUNET_OK != OIDC_parse_authz_code (received_cid, &cid,
2577 cached_code, NULL, &ticket, 2599 cached_code, NULL, &ticket,
2578 &cl, &pl, &nonce, 2600 &cl, &pl, &nonce,
2579 OIDC_VERIFICATION_NO_CODE_VERIFIER)) 2601 OIDC_VERIFICATION_NO_CODE_VERIFIER, &emsg))
2580 { 2602 {
2581 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST); 2603 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST);
2582 handle->edesc = GNUNET_strdup ("invalid code"); 2604 handle->edesc = emsg;
2583 handle->response_code = MHD_HTTP_BAD_REQUEST; 2605 handle->response_code = MHD_HTTP_BAD_REQUEST;
2584 GNUNET_free (cached_code); 2606 GNUNET_free (cached_code);
2585 if (NULL != nonce) 2607 if (NULL != nonce)
@@ -2590,7 +2612,15 @@ consume_fail (void *cls)
2590 2612
2591 GNUNET_free (cached_code); 2613 GNUNET_free (cached_code);
2592 2614
2593 result_str = OIDC_generate_userinfo (&handle->ticket.identity, 2615 char *tmp = GNUNET_strdup (handle->ticket.gns_name);
2616 GNUNET_assert (NULL != strtok (tmp, "."));
2617 char *key = strtok (NULL, ".");
2618 struct GNUNET_CRYPTO_PublicKey issuer;
2619 GNUNET_assert (NULL != key);
2620 GNUNET_assert (GNUNET_OK ==
2621 GNUNET_CRYPTO_public_key_from_string (key, &issuer));
2622 GNUNET_free (tmp);
2623 result_str = OIDC_generate_userinfo (&issuer,
2594 cl, 2624 cl,
2595 pl); 2625 pl);
2596 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Userinfo: %s\n", result_str); 2626 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Userinfo: %s\n", result_str);
@@ -2624,8 +2654,6 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2624 char *authorization; 2654 char *authorization;
2625 char *authorization_type; 2655 char *authorization_type;
2626 char *authorization_access_token; 2656 char *authorization_access_token;
2627 const struct EgoEntry *aud_ego;
2628 const struct GNUNET_CRYPTO_PrivateKey *privkey;
2629 2657
2630 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Getting userinfo\n"); 2658 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Getting userinfo\n");
2631 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY, 2659 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY,
@@ -2669,8 +2697,9 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2669 return; 2697 return;
2670 } 2698 }
2671 2699
2700 char *rp_uri;
2672 if (GNUNET_OK != OIDC_access_token_parse (authorization_access_token, 2701 if (GNUNET_OK != OIDC_access_token_parse (authorization_access_token,
2673 &ticket)) 2702 &ticket, &rp_uri))
2674 { 2703 {
2675 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN); 2704 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN);
2676 handle->edesc = GNUNET_strdup ("The access token is invalid"); 2705 handle->edesc = GNUNET_strdup ("The access token is invalid");
@@ -2683,18 +2712,7 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2683 GNUNET_assert (NULL != ticket); 2712 GNUNET_assert (NULL != ticket);
2684 handle->ticket = *ticket; 2713 handle->ticket = *ticket;
2685 GNUNET_free (ticket); 2714 GNUNET_free (ticket);
2686 aud_ego = find_ego (handle, &handle->ticket.audience);
2687 if (NULL == aud_ego)
2688 {
2689 handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN);
2690 handle->edesc = GNUNET_strdup ("The access token expired");
2691 handle->response_code = MHD_HTTP_UNAUTHORIZED;
2692 GNUNET_SCHEDULER_add_now (&do_userinfo_error, handle);
2693 GNUNET_free (authorization);
2694 return;
2695 }
2696 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Consuming ticket\n"); 2715 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Consuming ticket\n");
2697 privkey = GNUNET_IDENTITY_ego_get_private_key (aud_ego->ego);
2698 handle->attr_userinfo_list = 2716 handle->attr_userinfo_list =
2699 GNUNET_new (struct GNUNET_RECLAIM_AttributeList); 2717 GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
2700 handle->presentations = 2718 handle->presentations =
@@ -2706,11 +2724,12 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
2706 &consume_fail, 2724 &consume_fail,
2707 handle); 2725 handle);
2708 handle->idp_op = GNUNET_RECLAIM_ticket_consume (idp, 2726 handle->idp_op = GNUNET_RECLAIM_ticket_consume (idp,
2709 privkey,
2710 &handle->ticket, 2727 &handle->ticket,
2728 rp_uri,
2711 &consume_ticket, 2729 &consume_ticket,
2712 handle); 2730 handle);
2713 GNUNET_free (authorization); 2731 GNUNET_free (authorization);
2732 GNUNET_free (rp_uri);
2714} 2733}
2715 2734
2716 2735
diff --git a/src/service/rest/reclaim_plugin.c b/src/service/rest/reclaim_plugin.c
index e1afce00b..10b6b7bdc 100644
--- a/src/service/rest/reclaim_plugin.c
+++ b/src/service/rest/reclaim_plugin.c
@@ -25,6 +25,7 @@
25 * 25 *
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#include "gnunet_json_lib.h"
28#include "microhttpd.h" 29#include "microhttpd.h"
29#include <inttypes.h> 30#include <inttypes.h>
30#include <jansson.h> 31#include <jansson.h>
@@ -434,37 +435,19 @@ collect_finished_cb (void *cls)
434 * 435 *
435 */ 436 */
436static void 437static void
437ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) 438ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket,
439 const char *rp_uri)
438{ 440{
439 json_t *json_resource; 441 json_t *json_resource;
440 struct RequestHandle *handle = cls; 442 struct RequestHandle *handle = cls;
441 json_t *value;
442 char *tmp;
443 443
444 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n"); 444 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n");
445 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
446 json_resource = json_object (); 445 json_resource = json_object ();
447 GNUNET_free (tmp);
448 json_array_append (handle->resp_object, json_resource); 446 json_array_append (handle->resp_object, json_resource);
449 447
450 tmp = 448 json_object_set_new (json_resource, "gns_name", json_string (ticket->gns_name)
451 GNUNET_STRINGS_data_to_string_alloc (&ticket->identity, 449 );
452 sizeof(struct 450 json_object_set_new (json_resource, "rp_uri", json_string (rp_uri));
453 GNUNET_CRYPTO_PublicKey));
454 value = json_string (tmp);
455 json_object_set_new (json_resource, "issuer", value);
456 GNUNET_free (tmp);
457 tmp =
458 GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
459 sizeof(struct
460 GNUNET_CRYPTO_PublicKey));
461 value = json_string (tmp);
462 json_object_set_new (json_resource, "audience", value);
463 GNUNET_free (tmp);
464 tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
465 value = json_string (tmp);
466 json_object_set_new (json_resource, "rnd", value);
467 GNUNET_free (tmp);
468 GNUNET_RECLAIM_ticket_iteration_next (handle->ticket_it); 451 GNUNET_RECLAIM_ticket_iteration_next (handle->ticket_it);
469} 452}
470 453
@@ -937,7 +920,8 @@ parse_jwt (const struct GNUNET_RECLAIM_Credential *cred,
937 type_str = "String"; 920 type_str = "String";
938 type = GNUNET_RECLAIM_attribute_typename_to_number (type_str); 921 type = GNUNET_RECLAIM_attribute_typename_to_number (type_str);
939 if (GNUNET_SYSERR == GNUNET_RECLAIM_attribute_string_to_value (type,val_str, 922 if (GNUNET_SYSERR == GNUNET_RECLAIM_attribute_string_to_value (type,val_str,
940 (void **) &data, 923 (void **) &data
924 ,
941 &data_size)) 925 &data_size))
942 { 926 {
943 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 927 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1133,6 +1117,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1133 struct RequestHandle *handle = cls; 1117 struct RequestHandle *handle = cls;
1134 struct EgoEntry *ego_entry; 1118 struct EgoEntry *ego_entry;
1135 struct GNUNET_RECLAIM_Ticket *ticket = NULL; 1119 struct GNUNET_RECLAIM_Ticket *ticket = NULL;
1120 struct GNUNET_CRYPTO_PublicKey iss;
1136 struct GNUNET_CRYPTO_PublicKey tmp_pk; 1121 struct GNUNET_CRYPTO_PublicKey tmp_pk;
1137 char term_data[handle->rest_handle->data_size + 1]; 1122 char term_data[handle->rest_handle->data_size + 1];
1138 json_t *data_json; 1123 json_t *data_json;
@@ -1171,11 +1156,13 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1171 return; 1156 return;
1172 } 1157 }
1173 1158
1159 GNUNET_assert (GNUNET_OK == GNUNET_GNS_parse_ztld (ticket->gns_name, &iss));
1160
1174 for (ego_entry = ego_head; NULL != ego_entry; 1161 for (ego_entry = ego_head; NULL != ego_entry;
1175 ego_entry = ego_entry->next) 1162 ego_entry = ego_entry->next)
1176 { 1163 {
1177 GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk); 1164 GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk);
1178 if (0 == memcmp (&ticket->identity, 1165 if (0 == memcmp (&iss,
1179 &tmp_pk, 1166 &tmp_pk,
1180 sizeof(struct GNUNET_CRYPTO_PublicKey))) 1167 sizeof(struct GNUNET_CRYPTO_PublicKey)))
1181 break; 1168 break;
@@ -1236,16 +1223,16 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1236 const char *url, 1223 const char *url,
1237 void *cls) 1224 void *cls)
1238{ 1225{
1239 const struct GNUNET_CRYPTO_PrivateKey *identity_priv;
1240 struct RequestHandle *handle = cls; 1226 struct RequestHandle *handle = cls;
1241 struct EgoEntry *ego_entry;
1242 struct GNUNET_RECLAIM_Ticket *ticket; 1227 struct GNUNET_RECLAIM_Ticket *ticket;
1243 struct GNUNET_CRYPTO_PublicKey tmp_pk;
1244 char term_data[handle->rest_handle->data_size + 1]; 1228 char term_data[handle->rest_handle->data_size + 1];
1229 const char *rp_uri;
1245 json_t *data_json; 1230 json_t *data_json;
1246 json_error_t err; 1231 json_error_t err;
1247 struct GNUNET_JSON_Specification tktspec[] = 1232 struct GNUNET_JSON_Specification tktspec[] =
1248 { GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end () }; 1233 { GNUNET_RECLAIM_JSON_spec_ticket (&ticket),
1234 GNUNET_JSON_spec_string ("rp_uri", &rp_uri),
1235 GNUNET_JSON_spec_end () };
1249 1236
1250 if (0 >= handle->rest_handle->data_size) 1237 if (0 >= handle->rest_handle->data_size)
1251 { 1238 {
@@ -1274,26 +1261,10 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1274 json_decref (data_json); 1261 json_decref (data_json);
1275 return; 1262 return;
1276 } 1263 }
1277 for (ego_entry = ego_head; NULL != ego_entry;
1278 ego_entry = ego_entry->next)
1279 {
1280 GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &tmp_pk);
1281 if (0 == memcmp (&ticket->audience,
1282 &tmp_pk,
1283 sizeof(struct GNUNET_CRYPTO_PublicKey)))
1284 break;
1285 }
1286 if (NULL == ego_entry)
1287 {
1288 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Identity unknown\n");
1289 GNUNET_JSON_parse_free (tktspec);
1290 return;
1291 }
1292 identity_priv = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
1293 handle->resp_object = json_object (); 1264 handle->resp_object = json_object ();
1294 handle->idp_op = GNUNET_RECLAIM_ticket_consume (idp, 1265 handle->idp_op = GNUNET_RECLAIM_ticket_consume (idp,
1295 identity_priv,
1296 ticket, 1266 ticket,
1267 rp_uri,
1297 &consume_cont, 1268 &consume_cont,
1298 handle); 1269 handle);
1299 GNUNET_JSON_parse_free (tktspec); 1270 GNUNET_JSON_parse_free (tktspec);
diff --git a/src/service/setu/gnunet-service-setu_strata_estimator.c b/src/service/setu/gnunet-service-setu_strata_estimator.c
index 43ccf3afd..e5af92980 100644
--- a/src/service/setu/gnunet-service-setu_strata_estimator.c
+++ b/src/service/setu/gnunet-service-setu_strata_estimator.c
@@ -331,6 +331,12 @@ strata_estimator_create (unsigned int strata_count,
331 "Failed to allocate memory for strata estimator\n"); 331 "Failed to allocate memory for strata estimator\n");
332 for (j = 0; j < i; j++) 332 for (j = 0; j < i; j++)
333 ibf_destroy (se->stratas[strata_ctr]->strata[i]); 333 ibf_destroy (se->stratas[strata_ctr]->strata[i]);
334 for (j = 0; j <= strata_ctr; j++)
335 {
336 GNUNET_free (se->stratas[j]->strata);
337 GNUNET_free (se->stratas[j]);
338 }
339 GNUNET_free (se->stratas);
334 GNUNET_free (se); 340 GNUNET_free (se);
335 return NULL; 341 return NULL;
336 } 342 }
@@ -463,6 +469,8 @@ strata_estimator_destroy (struct MultiStrataEstimator *se)
463 for (i = 0; i < se->stratas[strata_ctr]->strata_count; i++) 469 for (i = 0; i < se->stratas[strata_ctr]->strata_count; i++)
464 ibf_destroy (se->stratas[strata_ctr]->strata[i]); 470 ibf_destroy (se->stratas[strata_ctr]->strata[i]);
465 GNUNET_free (se->stratas[strata_ctr]->strata); 471 GNUNET_free (se->stratas[strata_ctr]->strata);
472 GNUNET_free (se->stratas[strata_ctr]);
466 } 473 }
474 GNUNET_free (se->stratas);
467 GNUNET_free (se); 475 GNUNET_free (se);
468} 476}
diff --git a/src/service/statistics/Makefile.am b/src/service/statistics/Makefile.am
index c59b561ce..42c010c54 100644
--- a/src/service/statistics/Makefile.am
+++ b/src/service/statistics/Makefile.am
@@ -84,6 +84,5 @@ test_statistics_api_watch_zero_value_LDADD = \
84# $(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/scripts/dosubst.awk < $(srcdir)/test_gnunet_statistics.py.in > test_gnunet_statistics.py 84# $(AWK) -v bdir="$(bindir)" -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" -v pfx="$(prefix)" -v prl="$(PERL)" -v sysconfdirectory="$(sysconfdir)" -v pkgdatadirectory="$(pkgdatadir)" -f $(top_srcdir)/scripts/dosubst.awk < $(srcdir)/test_gnunet_statistics.py.in > test_gnunet_statistics.py
85# chmod +x test_gnunet_statistics.py 85# chmod +x test_gnunet_statistics.py
86# 86#
87#EXTRA_DIST = \ 87EXTRA_DIST = \
88# test_statistics_api_data.conf \ 88 test_statistics_api_data.conf
89# test_gnunet_statistics.py.in
diff --git a/src/service/testbed/.gitignore b/src/service/testbed/.gitignore
new file mode 100644
index 000000000..a5fa57a36
--- /dev/null
+++ b/src/service/testbed/.gitignore
@@ -0,0 +1 @@
gnunet-testbed
diff --git a/src/service/testbed/Makefile.am b/src/service/testbed/Makefile.am
new file mode 100644
index 000000000..6ba64ffbc
--- /dev/null
+++ b/src/service/testbed/Makefile.am
@@ -0,0 +1,53 @@
1# This Makefile.am is in the public domain
2AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4if USE_COVERAGE
5 AM_CFLAGS = --coverage -O0
6 XLIB = -lgcov
7endif
8
9libexecdir= $(pkglibdir)/libexec/
10
11pkgcfgdir= $(pkgdatadir)/config.d/
12
13lib_LTLIBRARIES = \
14 libgnunettestbed.la \
15 libgnunettestingtestbed.la
16
17libgnunettestbed_la_SOURCES = \
18 testbed.c
19libgnunettestbed_la_LIBADD = \
20 $(top_builddir)/src/lib/util/libgnunetutil.la
21
22libgnunettestingtestbed_la_SOURCES = \
23 testbed_api_cmd_system_create.c \
24 testing_testbed_traits.c
25libgnunettestingtestbed_la_LIBADD = \
26 libgnunettestbed.la \
27 $(top_builddir)/src/lib/testing/libgnunettesting.la \
28 $(top_builddir)/src/lib/util/libgnunetutil.la
29
30
31bin_PROGRAMS = \
32 gnunet-testbed
33
34gnunet_testbed_SOURCES = \
35 gnunet-testbed.c
36gnunet_testbed_LDADD = \
37 libgnunettestbed.la \
38 $(top_builddir)/src/lib/util/libgnunetutil.la \
39 $(top_builddir)/src/lib/testing/libgnunettesting.la \
40 $(GN_LIBINTL)
41
42check_PROGRAMS = \
43 test_testbed_portreservation
44
45AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
46# TESTS = \
47# test_testbed_portreservation
48
49test_testbed_portreservation_SOURCES = \
50 test_testbed_portreservation.c
51test_testbed_portreservation_LDADD = \
52 libgnunettestbed.la \
53 $(top_builddir)/src/lib/util/libgnunetutil.la
diff --git a/src/service/testbed/gnunet-testbed.c b/src/service/testbed/gnunet-testbed.c
new file mode 100644
index 000000000..59864085d
--- /dev/null
+++ b/src/service/testbed/gnunet-testbed.c
@@ -0,0 +1,230 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FORp A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testbed/gnunet-testbed.c
23 * @brief tool to use testing functionality from cmd line
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testbed_lib.h"
29
30
31#define LOG(kind, ...) GNUNET_log_from (kind, "gnunet-testbed", __VA_ARGS__)
32
33
34/**
35 * Final status code.
36 */
37static int ret;
38
39/**
40 * Number of config files to create.
41 */
42static unsigned int create_no;
43
44/**
45 * Filename of the config template to be written.
46 */
47static char *create_cfg_template;
48
49
50static int
51create_unique_cfgs (const char *template,
52 const unsigned int no)
53{
54 struct GNUNET_TESTBED_System *system;
55 int fail;
56 char *cur_file;
57 struct GNUNET_CONFIGURATION_Handle *cfg_new;
58 struct GNUNET_CONFIGURATION_Handle *cfg_tmpl;
59
60 if (GNUNET_NO == GNUNET_DISK_file_test (template))
61 {
62 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
63 "Configuration template `%s': file not found\n",
64 create_cfg_template);
65 return 1;
66 }
67 cfg_tmpl = GNUNET_CONFIGURATION_create ();
68
69 /* load template */
70 if ((create_cfg_template != NULL) &&
71 (GNUNET_OK !=
72 GNUNET_CONFIGURATION_load (cfg_tmpl,
73 create_cfg_template)))
74 {
75 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
76 "Could not load template `%s'\n",
77 create_cfg_template);
78 GNUNET_CONFIGURATION_destroy (cfg_tmpl);
79
80 return 1;
81 }
82 /* load defaults */
83 if (GNUNET_OK !=
84 GNUNET_CONFIGURATION_load (cfg_tmpl,
85 NULL))
86 {
87 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
88 "Could not load template `%s'\n",
89 create_cfg_template);
90 GNUNET_CONFIGURATION_destroy (cfg_tmpl);
91 return 1;
92 }
93
94 fail = GNUNET_NO;
95 system =
96 GNUNET_TESTBED_system_create ("testing",
97 NULL /* controller */,
98 NULL);
99 for (unsigned int cur = 0; cur < no; cur++)
100 {
101 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
102 "Creating configuration no. %u \n",
103 cur);
104 if (create_cfg_template != NULL)
105 GNUNET_asprintf (&cur_file, "%04u-%s", cur, create_cfg_template);
106 else
107 GNUNET_asprintf (&cur_file, "%04u%s", cur, ".conf");
108
109 cfg_new = GNUNET_CONFIGURATION_dup (cfg_tmpl);
110 if (GNUNET_OK !=
111 GNUNET_TESTBED_configuration_create (system,
112 cfg_new,
113 NULL,
114 NULL))
115 {
116 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
117 "Could not create another configuration\n");
118 GNUNET_CONFIGURATION_destroy (cfg_new);
119 fail = GNUNET_YES;
120 break;
121 }
122 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
123 "Writing configuration no. %u to file `%s' \n",
124 cur,
125 cur_file);
126 if (GNUNET_OK !=
127 GNUNET_CONFIGURATION_write (cfg_new,
128 cur_file))
129 {
130 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
131 "Failed to write configuration no. %u \n",
132 cur);
133 fail = GNUNET_YES;
134 }
135 GNUNET_CONFIGURATION_destroy (cfg_new);
136 GNUNET_free (cur_file);
137 if (GNUNET_YES == fail)
138 break;
139 }
140 GNUNET_CONFIGURATION_destroy (cfg_tmpl);
141 GNUNET_TESTBED_system_destroy (system,
142 false);
143 if (GNUNET_YES == fail)
144 return 1;
145 return 0;
146}
147
148
149/**
150 * Main function that will be running without scheduler.
151 *
152 * @param cls closure
153 * @param args remaining command-line arguments
154 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
155 * @param cfg configuration
156 */
157static void
158run_no_scheduler (void *cls,
159 char *const *args,
160 const char *cfgfile,
161 const struct GNUNET_CONFIGURATION_Handle *cfg)
162{
163 if (create_no > 0)
164 {
165 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
166 "Creating %u configuration files based on template `%s'\n",
167 create_no,
168 create_cfg_template);
169 ret = create_unique_cfgs (create_cfg_template,
170 create_no);
171 }
172 else
173 {
174 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
175 "Missing arguments!\n");
176 ret = 1;
177 }
178}
179
180
181/**
182 * The main function.
183 *
184 * @param argc number of arguments from the command line
185 * @param argv command line arguments
186 * @return 0 ok, 1 on error
187 */
188int
189main (int argc, char *const *argv)
190{
191 struct GNUNET_GETOPT_CommandLineOption options[] = {
192 GNUNET_GETOPT_option_uint (
193 'n',
194 "number",
195 "NUMBER",
196 gettext_noop ("number of unique configuration files to create"),
197 &create_no),
198 GNUNET_GETOPT_option_string (
199 't',
200 "template",
201 "FILENAME",
202 gettext_noop ("configuration template"),
203 &create_cfg_template),
204 GNUNET_GETOPT_OPTION_END
205 };
206
207 if (GNUNET_OK !=
208 GNUNET_STRINGS_get_utf8_args (argc, argv,
209 &argc, &argv))
210 return 2;
211
212 ret =
213 (GNUNET_OK ==
214 GNUNET_PROGRAM_run2 (argc,
215 argv,
216 "gnunet-testing",
217 gettext_noop (
218 "Command line tool to access the testing library"),
219 options,
220 &run_no_scheduler,
221 NULL,
222 GNUNET_YES))
223 ? ret
224 : 1;
225 GNUNET_free_nz ((void *) argv);
226 return ret;
227}
228
229
230/* end of gnunet-testbed.c */
diff --git a/src/service/testing/test_testing_portreservation.c b/src/service/testbed/test_testbed_portreservation.c
index df3d8d523..90e0f9f57 100644
--- a/src/service/testing/test_testing_portreservation.c
+++ b/src/service/testbed/test_testbed_portreservation.c
@@ -19,7 +19,7 @@
19 */ 19 */
20 20
21/** 21/**
22 * @file testing/test_testing_new_portreservation.c 22 * @file testing/test_testbed_portreservation.c
23 * @brief test case for testing port reservation routines from the new testing 23 * @brief test case for testing port reservation routines from the new testing
24 * library API 24 * library API
25 * @author Sree Harsha Totakura 25 * @author Sree Harsha Totakura
@@ -27,10 +27,10 @@
27 27
28#include "platform.h" 28#include "platform.h"
29#include "gnunet_util_lib.h" 29#include "gnunet_util_lib.h"
30#include "gnunet_testing_lib.h" 30#include "gnunet_testbed_lib.h"
31 31
32#define LOG(kind, ...) \ 32#define LOG(kind, ...) \
33 GNUNET_log (kind, __VA_ARGS__) 33 GNUNET_log (kind, __VA_ARGS__)
34 34
35/** 35/**
36 * The status of the test 36 * The status of the test
@@ -44,39 +44,39 @@ static void
44run (void *cls, char *const *args, const char *cfgfile, 44run (void *cls, char *const *args, const char *cfgfile,
45 const struct GNUNET_CONFIGURATION_Handle *cfg) 45 const struct GNUNET_CONFIGURATION_Handle *cfg)
46{ 46{
47 struct GNUNET_TESTING_System *system; 47 struct GNUNET_TESTBED_System *system;
48 uint16_t new_port1; 48 uint16_t new_port1;
49 uint16_t new_port2; 49 uint16_t new_port2;
50 uint16_t old_port1; 50 uint16_t old_port1;
51 51
52 system = GNUNET_TESTING_system_create ("/tmp/gnunet-testing-new", 52 system = GNUNET_TESTBED_system_create ("/tmp/gnunet-testing-new",
53 "localhost", NULL, NULL); 53 "localhost", NULL);
54 GNUNET_assert (NULL != system); 54 GNUNET_assert (NULL != system);
55 new_port1 = GNUNET_TESTING_reserve_port (system); 55 new_port1 = GNUNET_TESTBED_reserve_port (system);
56 LOG (GNUNET_ERROR_TYPE_DEBUG, 56 LOG (GNUNET_ERROR_TYPE_DEBUG,
57 "Reserved TCP port %u\n", new_port1); 57 "Reserved TCP port %u\n", new_port1);
58 if (0 == new_port1) 58 if (0 == new_port1)
59 goto end; 59 goto end;
60 new_port2 = GNUNET_TESTING_reserve_port (system); 60 new_port2 = GNUNET_TESTBED_reserve_port (system);
61 LOG (GNUNET_ERROR_TYPE_DEBUG, 61 LOG (GNUNET_ERROR_TYPE_DEBUG,
62 "Reserved TCP port %u\n", new_port2); 62 "Reserved TCP port %u\n", new_port2);
63 if (0 == new_port2) 63 if (0 == new_port2)
64 goto end; 64 goto end;
65 GNUNET_assert (new_port1 != new_port2); 65 GNUNET_assert (new_port1 != new_port2);
66 GNUNET_TESTING_release_port (system, new_port1); 66 GNUNET_TESTBED_release_port (system, new_port1);
67 old_port1 = new_port1; 67 old_port1 = new_port1;
68 new_port1 = 0; 68 new_port1 = 0;
69 new_port1 = GNUNET_TESTING_reserve_port (system); 69 new_port1 = GNUNET_TESTBED_reserve_port (system);
70 LOG (GNUNET_ERROR_TYPE_DEBUG, 70 LOG (GNUNET_ERROR_TYPE_DEBUG,
71 "Reserved TCP port %u\n", new_port1); 71 "Reserved TCP port %u\n", new_port1);
72 GNUNET_assert (0 != new_port1); 72 GNUNET_assert (0 != new_port1);
73 GNUNET_assert (old_port1 == new_port1); 73 GNUNET_assert (old_port1 == new_port1);
74 GNUNET_TESTING_release_port (system, new_port1); 74 GNUNET_TESTBED_release_port (system, new_port1);
75 GNUNET_TESTING_release_port (system, new_port2); 75 GNUNET_TESTBED_release_port (system, new_port2);
76 status = GNUNET_OK; 76 status = GNUNET_OK;
77 77
78end: 78end:
79 GNUNET_TESTING_system_destroy (system, GNUNET_YES); 79 GNUNET_TESTBED_system_destroy (system, GNUNET_YES);
80} 80}
81 81
82 82
@@ -91,9 +91,9 @@ main (int argc, char *argv[])
91 if (GNUNET_OK != 91 if (GNUNET_OK !=
92 GNUNET_PROGRAM_run (argc, 92 GNUNET_PROGRAM_run (argc,
93 argv, 93 argv,
94 "test_testing_new_portreservation", 94 "test_testbed_new_portreservation",
95 "test case for testing port reservation routines" 95 "test case for testing port reservation routines"
96 " from the new testing library API", 96 " from the new testeb library API",
97 options, 97 options,
98 &run, 98 &run,
99 NULL)) 99 NULL))
@@ -102,4 +102,4 @@ main (int argc, char *argv[])
102} 102}
103 103
104 104
105/* end of test_testing_portreservation.c */ 105/* end of test_testbed_portreservation.c */
diff --git a/src/service/testbed/testbed.c b/src/service/testbed/testbed.c
new file mode 100644
index 000000000..395907cae
--- /dev/null
+++ b/src/service/testbed/testbed.c
@@ -0,0 +1,579 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testbed.c
23 * @brief
24 * @author Christian Grothoff
25 *
26 */
27#include "platform.h"
28#include "gnunet_util_lib.h"
29#include "gnunet_testbed_lib.h"
30
31#define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
32
33/**
34 * Lowest port used for GNUnet testing. Should be high enough to not
35 * conflict with other applications running on the hosts but be low
36 * enough to not conflict with client-ports (typically starting around
37 * 32k).
38 */
39#define LOW_PORT 12000
40
41/**
42 * Highest port used for GNUnet testing. Should be low enough to not
43 * conflict with the port range for "local" ports (client apps; see
44 * /proc/sys/net/ipv4/ip_local_port_range on Linux for example).
45 */
46#define HIGH_PORT 56000
47
48
49/**
50 * Handle for a system on which GNUnet peers are executed;
51 * a system is used for reserving unique paths and ports.
52 */
53struct GNUNET_TESTBED_System
54{
55 /**
56 * Prefix (e.g. "/tmp/gnunet-testing/") we prepend to each
57 * GNUNET_HOME.
58 */
59 char *tmppath;
60
61 /**
62 * The trusted ip. Can either be a single ip address or a network address in
63 * CIDR notation.
64 */
65 char *trusted_ip;
66
67 /**
68 * our hostname
69 */
70 char *hostname;
71
72 /**
73 * Bitmap where each port that has already been reserved for some GNUnet peer
74 * is recorded. Note that we make no distinction between TCP and UDP ports
75 * and test if a port is already in use before assigning it to a peer/service.
76 * If we detect that a port is already in use, we also mark it in this bitmap.
77 * So all the bits that are zero merely indicate ports that MIGHT be available
78 * for peers.
79 */
80 uint32_t reserved_ports[65536 / 32];
81
82 /**
83 * Counter we use to make service home paths unique on this system;
84 * the full path consists of the tmppath and this number. Each
85 * UNIXPATH for a peer is also modified to include the respective
86 * path counter to ensure uniqueness. This field is incremented
87 * by one for each configured peer. Even if peers are destroyed,
88 * we never re-use path counters.
89 */
90 uint32_t path_counter;
91
92 /**
93 * Lowest port we are allowed to use.
94 */
95 uint16_t lowport;
96
97 /**
98 * Highest port we are allowed to use.
99 */
100 uint16_t highport;
101};
102
103
104struct GNUNET_TESTBED_System *
105GNUNET_TESTBED_system_create_with_portrange (
106 const char *testdir,
107 const char *trusted_ip,
108 const char *hostname,
109 uint16_t lowport,
110 uint16_t highport)
111{
112 struct GNUNET_TESTBED_System *system;
113
114 GNUNET_assert (NULL != testdir);
115 system = GNUNET_new (struct GNUNET_TESTBED_System);
116 if (NULL == (system->tmppath = getenv (GNUNET_TESTBED_PREFIX)))
117 system->tmppath = GNUNET_DISK_mkdtemp (testdir);
118 else
119 system->tmppath = GNUNET_strdup (system->tmppath);
120 system->lowport = lowport;
121 system->highport = highport;
122 if (NULL == system->tmppath)
123 {
124 GNUNET_free (system);
125 return NULL;
126 }
127 if (NULL != trusted_ip)
128 system->trusted_ip = GNUNET_strdup (trusted_ip);
129 if (NULL != hostname)
130 system->hostname = GNUNET_strdup (hostname);
131 return system;
132}
133
134
135struct GNUNET_TESTBED_System *
136GNUNET_TESTBED_system_create (
137 const char *testdir,
138 const char *trusted_ip,
139 const char *hostname)
140{
141 return GNUNET_TESTBED_system_create_with_portrange (testdir,
142 trusted_ip,
143 hostname,
144 LOW_PORT,
145 HIGH_PORT);
146}
147
148
149void
150GNUNET_TESTBED_system_destroy (struct GNUNET_TESTBED_System *system,
151 bool remove_paths)
152{
153 if (remove_paths)
154 GNUNET_DISK_directory_remove (system->tmppath);
155 GNUNET_free (system->tmppath);
156 GNUNET_free (system->trusted_ip);
157 GNUNET_free (system->hostname);
158 GNUNET_free (system);
159}
160
161
162uint16_t
163GNUNET_TESTBED_reserve_port (struct GNUNET_TESTBED_System *system)
164{
165 struct GNUNET_NETWORK_Handle *socket;
166 struct addrinfo hint;
167 struct addrinfo *ret;
168 struct addrinfo *ai;
169 uint32_t *port_buckets;
170 char *open_port_str;
171 int bind_status;
172 uint32_t xor_image;
173 uint16_t index;
174 uint16_t open_port;
175 uint16_t pos;
176
177 /*
178 FIXME: Instead of using getaddrinfo we should try to determine the port
179 status by the following heurestics.
180
181 On systems which support both IPv4 and IPv6, only ports open on both
182 address families are considered open.
183 On system with either IPv4 or IPv6. A port is considered open if it's
184 open in the respective address family
185 */hint.ai_family = AF_UNSPEC; /* IPv4 and IPv6 */
186 hint.ai_socktype = 0;
187 hint.ai_protocol = 0;
188 hint.ai_addrlen = 0;
189 hint.ai_addr = NULL;
190 hint.ai_canonname = NULL;
191 hint.ai_next = NULL;
192 hint.ai_flags = AI_PASSIVE | AI_NUMERICSERV; /* Wild card address */
193 port_buckets = system->reserved_ports;
194 for (index = (system->lowport / 32) + 1; index < (system->highport / 32);
195 index++)
196 {
197 xor_image = (UINT32_MAX ^ port_buckets[index]);
198 if (0 == xor_image) /* Ports in the bucket are full */
199 continue;
200 pos = system->lowport % 32;
201 while (pos < 32)
202 {
203 if (0 == ((xor_image >> pos) & 1U))
204 {
205 pos++;
206 continue;
207 }
208 open_port = (index * 32) + pos;
209 if (open_port >= system->highport)
210 return 0;
211 GNUNET_asprintf (&open_port_str, "%u", (unsigned int) open_port);
212 ret = NULL;
213 GNUNET_assert (0 == getaddrinfo (NULL, open_port_str, &hint, &ret));
214 GNUNET_free (open_port_str);
215 bind_status = GNUNET_NO;
216 for (ai = ret; NULL != ai; ai = ai->ai_next)
217 {
218 socket = GNUNET_NETWORK_socket_create (ai->ai_family, SOCK_STREAM, 0);
219 if (NULL == socket)
220 continue;
221 bind_status =
222 GNUNET_NETWORK_socket_bind (socket, ai->ai_addr, ai->ai_addrlen);
223 GNUNET_NETWORK_socket_close (socket);
224 if (GNUNET_OK != bind_status)
225 break;
226 socket = GNUNET_NETWORK_socket_create (ai->ai_family, SOCK_DGRAM, 0);
227 if (NULL == socket)
228 continue;
229 bind_status =
230 GNUNET_NETWORK_socket_bind (socket, ai->ai_addr, ai->ai_addrlen);
231 GNUNET_NETWORK_socket_close (socket);
232 if (GNUNET_OK != bind_status)
233 break;
234 }
235 port_buckets[index] |= (1U << pos); /* Set the port bit */
236 freeaddrinfo (ret);
237 if (GNUNET_OK == bind_status)
238 {
239 LOG (GNUNET_ERROR_TYPE_DEBUG,
240 "Found a free port %u\n",
241 (unsigned int) open_port);
242 return open_port;
243 }
244 pos++;
245 }
246 }
247 return 0;
248}
249
250
251void
252GNUNET_TESTBED_release_port (struct GNUNET_TESTBED_System *system,
253 uint16_t port)
254{
255 uint32_t *port_buckets;
256 uint16_t bucket;
257 uint16_t pos;
258
259 port_buckets = system->reserved_ports;
260 bucket = port / 32;
261 pos = port % 32;
262 LOG (GNUNET_ERROR_TYPE_DEBUG, "Releasing port %u\n", port);
263 if (0 == (port_buckets[bucket] & (1U << pos)))
264 {
265 GNUNET_break (0); /* Port was not reserved by us using reserve_port() */
266 return;
267 }
268 port_buckets[bucket] &= ~(1U << pos);
269}
270
271
272/**
273 * Structure for holding data to build new configurations from a configuration
274 * template
275 */
276struct UpdateContext
277{
278 /**
279 * The system for which we are building configurations
280 */
281 struct GNUNET_TESTBED_System *system;
282
283 /**
284 * The configuration we are building
285 */
286 struct GNUNET_CONFIGURATION_Handle *cfg;
287
288 /**
289 * The customized service home path for this peer
290 */
291 char *gnunet_home;
292
293 /**
294 * Array of ports currently allocated to this peer. These ports will be
295 * released upon peer destroy and can be used by other peers which are
296 * configured after.
297 */
298 uint16_t *ports;
299
300 /**
301 * The number of ports in the above array
302 */
303 unsigned int nports;
304
305 /**
306 * build status - to signal error while building a configuration
307 */
308 int status;
309};
310
311
312/**
313 * Function to iterate over options. Copies
314 * the options to the target configuration,
315 * updating PORT values as needed.
316 *
317 * @param cls the UpdateContext
318 * @param section name of the section
319 * @param option name of the option
320 * @param value value of the option
321 */
322static void
323update_config (void *cls,
324 const char *section,
325 const char *option,
326 const char *value)
327{
328 struct UpdateContext *uc = cls;
329 unsigned int ival;
330 char cval[12];
331 char uval[PATH_MAX];
332 char *single_variable;
333 char *per_host_variable;
334 unsigned long long num_per_host;
335 uint16_t new_port;
336
337 if (GNUNET_OK != uc->status)
338 return;
339 if (! ((0 == strcmp (option, "PORT")) || (0 == strcmp (option, "UNIXPATH")) ||
340 (0 == strcmp (option, "HOSTNAME"))))
341 return;
342 GNUNET_asprintf (&single_variable, "single_%s_per_host", section);
343 GNUNET_asprintf (&per_host_variable, "num_%s_per_host", section);
344 if ((0 == strcmp (option, "PORT")) && (1 == sscanf (value, "%u", &ival)))
345 {
346 if ((ival != 0) &&
347 (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno (uc->cfg,
348 "testing",
349 single_variable)))
350 {
351 new_port = GNUNET_TESTBED_reserve_port (uc->system);
352 if (0 == new_port)
353 {
354 uc->status = GNUNET_SYSERR;
355 GNUNET_free (single_variable);
356 GNUNET_free (per_host_variable);
357 return;
358 }
359 GNUNET_snprintf (cval, sizeof(cval), "%u", new_port);
360 value = cval;
361 GNUNET_array_append (uc->ports, uc->nports, new_port);
362 }
363 else if ((ival != 0) &&
364 (GNUNET_YES ==
365 GNUNET_CONFIGURATION_get_value_yesno (uc->cfg,
366 "testing",
367 single_variable)) &&
368 GNUNET_CONFIGURATION_get_value_number (uc->cfg,
369 "testing",
370 per_host_variable,
371 &num_per_host))
372 {
373 /* GNUNET_snprintf (cval, sizeof (cval), "%u", */
374 /* ival + ctx->fdnum % num_per_host); */
375 /* value = cval; */
376 GNUNET_break (0); /* FIXME */
377 }
378 }
379 if (0 == strcmp (option, "UNIXPATH"))
380 {
381 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno (uc->cfg,
382 "testing",
383 single_variable))
384 {
385 GNUNET_snprintf (uval,
386 sizeof(uval),
387 "%s/%s.sock",
388 uc->gnunet_home,
389 section);
390 value = uval;
391 }
392 else if ((GNUNET_YES ==
393 GNUNET_CONFIGURATION_get_value_number (uc->cfg,
394 "testing",
395 per_host_variable,
396 &num_per_host)) &&
397 (num_per_host > 0))
398 {
399 GNUNET_break (0); /* FIXME */
400 }
401 }
402 if (0 == strcmp (option, "HOSTNAME"))
403 {
404 value = (NULL == uc->system->hostname) ? "localhost" : uc->system->hostname;
405 }
406 GNUNET_free (single_variable);
407 GNUNET_free (per_host_variable);
408 GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, option, value);
409}
410
411
412/**
413 * Section iterator to set ACCEPT_FROM/ACCEPT_FROM6 to include the address of
414 * 'trusted_hosts' in all sections
415 *
416 * @param cls the UpdateContext
417 * @param section name of the section
418 */
419static void
420update_config_sections (void *cls,
421 const char *section)
422{
423 struct UpdateContext *uc = cls;
424 char **ikeys;
425 char *val;
426 char *ptr;
427 char *orig_allowed_hosts;
428 char *allowed_hosts;
429 char *ACCEPT_FROM_key;
430 uint16_t ikeys_cnt;
431 uint16_t key;
432
433 ikeys_cnt = 0;
434 val = NULL;
435 /* Ignore certain options from sections. See
436 https://gnunet.org/bugs/view.php?id=2476 */
437 if (GNUNET_YES ==
438 GNUNET_CONFIGURATION_have_value (uc->cfg,
439 section,
440 "TESTBED_IGNORE_KEYS"))
441 {
442 GNUNET_assert (GNUNET_YES ==
443 GNUNET_CONFIGURATION_get_value_string (uc->cfg,
444 section,
445 "TESTBED_IGNORE_KEYS",
446 &val));
447 ptr = val;
448 for (ikeys_cnt = 0; NULL != (ptr = strstr (ptr, ";")); ikeys_cnt++)
449 ptr++;
450 if (0 == ikeys_cnt)
451 GNUNET_break (0);
452 else
453 {
454 ikeys = GNUNET_malloc ((sizeof(char *)) * ikeys_cnt);
455 ptr = val;
456 for (key = 0; key < ikeys_cnt; key++)
457 {
458 ikeys[key] = ptr;
459 ptr = strstr (ptr, ";");
460 GNUNET_assert (NULL != ptr); /* worked just before... */
461 *ptr = '\0';
462 ptr++;
463 }
464 }
465 }
466 if (0 != ikeys_cnt)
467 {
468 for (key = 0; key < ikeys_cnt; key++)
469 {
470 if (NULL != strstr (ikeys[key], "ADVERTISED_PORT"))
471 break;
472 }
473 if ((key == ikeys_cnt) &&
474 (GNUNET_YES ==
475 GNUNET_CONFIGURATION_have_value (uc->cfg,
476 section,
477 "ADVERTISED_PORT")))
478 {
479 if (GNUNET_OK ==
480 GNUNET_CONFIGURATION_get_value_string (uc->cfg,
481 section,
482 "PORT",
483 &ptr))
484 {
485 GNUNET_CONFIGURATION_set_value_string (uc->cfg,
486 section,
487 "ADVERTISED_PORT",
488 ptr);
489 GNUNET_free (ptr);
490 }
491 }
492 for (key = 0; key < ikeys_cnt; key++)
493 {
494 if (NULL != strstr (ikeys[key], "ACCEPT_FROM"))
495 {
496 GNUNET_free (ikeys);
497 GNUNET_free (val);
498 return;
499 }
500 }
501 GNUNET_free (ikeys);
502 }
503 GNUNET_free (val);
504 ACCEPT_FROM_key = "ACCEPT_FROM";
505 if ((NULL != uc->system->trusted_ip) &&
506 (NULL != strstr (uc->system->trusted_ip, ":"))) /* IPv6 in use */
507 ACCEPT_FROM_key = "ACCEPT_FROM6";
508 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (uc->cfg,
509 section,
510 ACCEPT_FROM_key,
511 &orig_allowed_hosts))
512 {
513 orig_allowed_hosts = GNUNET_strdup ("127.0.0.1;");
514 }
515 if (NULL == uc->system->trusted_ip)
516 allowed_hosts = GNUNET_strdup (orig_allowed_hosts);
517 else
518 GNUNET_asprintf (&allowed_hosts,
519 "%s%s;",
520 orig_allowed_hosts,
521 uc->system->trusted_ip);
522 GNUNET_free (orig_allowed_hosts);
523 GNUNET_CONFIGURATION_set_value_string (uc->cfg,
524 section,
525 ACCEPT_FROM_key,
526 allowed_hosts);
527 GNUNET_free (allowed_hosts);
528}
529
530
531enum GNUNET_GenericReturnValue
532GNUNET_TESTBED_configuration_create (
533 struct GNUNET_TESTBED_System *system,
534 struct GNUNET_CONFIGURATION_Handle *cfg,
535 uint16_t **ports,
536 unsigned int *nports)
537{
538 struct UpdateContext uc;
539 char *default_config;
540
541 uc.system = system;
542 uc.cfg = cfg;
543 uc.status = GNUNET_OK;
544 uc.ports = NULL;
545 uc.nports = 0;
546 GNUNET_asprintf (&uc.gnunet_home,
547 "%s/%u",
548 system->tmppath,
549 system->path_counter++);
550 GNUNET_asprintf (&default_config, "%s/config", uc.gnunet_home);
551 GNUNET_CONFIGURATION_set_value_string (cfg,
552 "PATHS",
553 "DEFAULTCONFIG",
554 default_config);
555 GNUNET_CONFIGURATION_set_value_string (cfg, "arm", "CONFIG", default_config);
556 GNUNET_free (default_config);
557 GNUNET_CONFIGURATION_set_value_string (cfg,
558 "PATHS",
559 "GNUNET_HOME",
560 uc.gnunet_home);
561 /* make PORTs and UNIXPATHs unique */
562 GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc);
563 /* allow connections to services from system trusted_ip host */
564 GNUNET_CONFIGURATION_iterate_sections (cfg, &update_config_sections, &uc);
565 /* enable loopback-based connections between peers */
566 GNUNET_CONFIGURATION_set_value_string (cfg, "nat", "USE_LOCALADDR", "YES");
567 GNUNET_free (uc.gnunet_home);
568 if ((NULL != ports) && (NULL != nports))
569 {
570 *ports = uc.ports;
571 *nports = uc.nports;
572 }
573 else
574 GNUNET_free (uc.ports);
575 return uc.status;
576}
577
578
579/* end of testbed.c */
diff --git a/src/service/testing/testing_api_cmd_system_create.c b/src/service/testbed/testbed_api_cmd_system_create.c
index 46fbd706e..2f780ec73 100644
--- a/src/service/testing/testing_api_cmd_system_create.c
+++ b/src/service/testbed/testbed_api_cmd_system_create.c
@@ -25,10 +25,9 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_netjail_lib.h"
31#include "gnunet_testing_lib.h" 28#include "gnunet_testing_lib.h"
29#include "gnunet_testbed_lib.h"
30#include "gnunet_testing_testbed_lib.h"
32 31
33/** 32/**
34 * Struct to hold information for callbacks. 33 * Struct to hold information for callbacks.
@@ -36,7 +35,7 @@
36 */ 35 */
37struct TestSystemState 36struct TestSystemState
38{ 37{
39 struct GNUNET_TESTING_System *test_system; 38 struct GNUNET_TESTBED_System *test_system;
40 39
41 const char *testdir; 40 const char *testdir;
42}; 41};
@@ -52,15 +51,9 @@ system_create_run (void *cls,
52{ 51{
53 struct TestSystemState *tss = cls; 52 struct TestSystemState *tss = cls;
54 53
55 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 54 tss->test_system = GNUNET_TESTBED_system_create (tss->testdir,
56 "system create\n");
57
58 tss->test_system = GNUNET_TESTING_system_create (tss->testdir,
59 NULL,
60 NULL, 55 NULL,
61 NULL); 56 NULL);
62 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
63 "system created\n");
64} 57}
65 58
66 59
@@ -75,10 +68,9 @@ system_create_traits (void *cls,
75 unsigned int index) 68 unsigned int index)
76{ 69{
77 struct TestSystemState *tss = cls; 70 struct TestSystemState *tss = cls;
78 struct GNUNET_TESTING_System *test_system = tss->test_system;
79
80 struct GNUNET_TESTING_Trait traits[] = { 71 struct GNUNET_TESTING_Trait traits[] = {
81 GNUNET_TESTING_make_trait_test_system ((const void *) test_system), 72 GNUNET_TESTING_TESTBED_make_trait_test_system (
73 tss->test_system),
82 GNUNET_TESTING_trait_end () 74 GNUNET_TESTING_trait_end ()
83 }; 75 };
84 76
@@ -98,6 +90,9 @@ system_create_cleanup (void *cls)
98{ 90{
99 struct TestSystemState *tss = cls; 91 struct TestSystemState *tss = cls;
100 92
93 GNUNET_TESTBED_system_destroy (tss->test_system,
94 GNUNET_YES);
95
101 GNUNET_free (tss); 96 GNUNET_free (tss);
102} 97}
103 98
@@ -110,7 +105,7 @@ system_create_cleanup (void *cls)
110 * @return command. 105 * @return command.
111 */ 106 */
112struct GNUNET_TESTING_Command 107struct GNUNET_TESTING_Command
113GNUNET_TESTING_cmd_system_create (const char *label, 108GNUNET_TESTBED_cmd_system_create (const char *label,
114 const char *testdir) 109 const char *testdir)
115{ 110{
116 struct TestSystemState *tss; 111 struct TestSystemState *tss;
@@ -118,7 +113,9 @@ GNUNET_TESTING_cmd_system_create (const char *label,
118 tss = GNUNET_new (struct TestSystemState); 113 tss = GNUNET_new (struct TestSystemState);
119 tss->testdir = testdir; 114 tss->testdir = testdir;
120 115
121 return GNUNET_TESTING_command_new (tss, label, &system_create_run, 116 return GNUNET_TESTING_command_new (tss,
117 label,
118 &system_create_run,
122 &system_create_cleanup, 119 &system_create_cleanup,
123 &system_create_traits, NULL); 120 &system_create_traits);
124} 121}
diff --git a/src/service/testbed/testing_testbed_traits.c b/src/service/testbed/testing_testbed_traits.c
new file mode 100644
index 000000000..b7fd605e5
--- /dev/null
+++ b/src/service/testbed/testing_testbed_traits.c
@@ -0,0 +1,34 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file transport/test_transport_start_with_config.c
23 * @brief Generic program to start testcases in an configurable topology.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
29#include "gnunet_testing_testbed_lib.h"
30
31
32GNUNET_TESTING_TESTBED_SIMPLE_TRAITS (
33 GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT,
34 GNUNET_TESTING_TESTBED)
diff --git a/src/service/testing/Makefile.am b/src/service/testing/Makefile.am
deleted file mode 100644
index 5cd4aae9b..000000000
--- a/src/service/testing/Makefile.am
+++ /dev/null
@@ -1,134 +0,0 @@
1# This Makefile.am is in the public domain
2AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4if USE_COVERAGE
5 AM_CFLAGS = --coverage -O0
6 XLIB = -lgcov
7endif
8
9libexecdir= $(pkglibdir)/libexec/
10
11pkgcfgdir= $(pkgdatadir)/config.d/
12
13dist_pkgcfg_DATA = \
14 testing.conf
15
16libexec_PROGRAMS = \
17 test_testing_start_with_config \
18 gnunet-cmds-helper
19
20plugindir = $(libdir)/gnunet
21
22lib_LTLIBRARIES = \
23 libgnunettesting.la
24
25gnunet_cmds_helper_SOURCES = \
26 gnunet-cmds-helper.c
27gnunet_cmds_helper_LDADD = $(XLIB) \
28 $(top_builddir)/src/lib/util/libgnunetutil.la \
29 libgnunettesting.la \
30 $(LTLIBINTL) $(Z_LIBS)
31
32libgnunettesting_la_SOURCES = \
33 testing_api_cmd_exec_bash_script.c \
34 testing_api_cmd_barrier.c \
35 testing_api_cmd_barrier_reached.c \
36 testing_api_cmd_finish.c \
37 testing_api_cmd_local_test_prepared.c \
38 testing_api_cmd_send_peer_ready.c \
39 testing_api_cmd_block_until_external_trigger.c \
40 testing_api_cmd_netjail_start.c \
41 testing_api_cmd_netjail_start_cmds_helper.c \
42 testing_api_cmd_netjail_stop_cmds_helper.c \
43 testing_api_cmd_netjail_stop.c \
44 testing.c testing.h \
45 testing_api_cmd_system_create.c \
46 testing_api_cmd_system_destroy.c \
47 testing_api_cmd_batch.c \
48 testing_api_loop.c \
49 testing_api_traits.c
50libgnunettesting_la_LIBADD = \
51 $(top_builddir)/src/service/arm/libgnunetarm.la \
52 $(top_builddir)/src/lib/util/libgnunetutil.la \
53 $(LTLIBINTL)
54libgnunettesting_la_LDFLAGS = \
55 $(GN_LIB_LDFLAGS) \
56 -version-info 2:0:1
57
58bin_PROGRAMS = \
59 gnunet-testing
60
61noinst_PROGRAMS = \
62 list-keys
63
64gnunet_testing_SOURCES = \
65 gnunet-testing.c
66gnunet_testing_LDADD = \
67 libgnunettesting.la \
68 $(top_builddir)/src/lib/util/libgnunetutil.la \
69 $(GN_LIBINTL)
70
71list_keys_SOURCES = \
72 list-keys.c
73list_keys_LDADD = \
74 $(top_builddir)/src/lib/util/libgnunetutil.la \
75 $(GN_LIBINTL)
76
77
78check_PROGRAMS = \
79 test_testing_portreservation \
80 test_testing_servicestartup \
81 test_testing_peerstartup \
82 test_testing_peerstartup2 \
83 test_testing_sharedservices
84
85# if ENABLE_TEST_RUN_TESTING
86# AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
87# TESTS = \
88# test_testing_portreservation \
89# test_testing_peerstartup \
90# test_testing_peerstartup2 \
91# test_testing_servicestartup
92# endif
93
94test_testing_start_with_config_SOURCES = \
95 test_testing_start_with_config.c
96test_testing_start_with_config_LDADD = \
97 libgnunettesting.la \
98 $(top_builddir)/src/lib/util/libgnunetutil.la \
99 $(top_builddir)/src/lib/hello/libgnunethello.la
100
101test_testing_portreservation_SOURCES = \
102 test_testing_portreservation.c
103test_testing_portreservation_LDADD = \
104 libgnunettesting.la \
105 $(top_builddir)/src/lib/util/libgnunetutil.la
106
107test_testing_peerstartup_SOURCES = \
108 test_testing_peerstartup.c
109test_testing_peerstartup_LDADD = \
110 libgnunettesting.la \
111 $(top_builddir)/src/lib/util/libgnunetutil.la
112
113test_testing_peerstartup2_SOURCES = \
114 test_testing_peerstartup2.c
115test_testing_peerstartup2_LDADD = \
116 libgnunettesting.la \
117 $(top_builddir)/src/lib/util/libgnunetutil.la
118
119test_testing_servicestartup_SOURCES = \
120 test_testing_servicestartup.c
121test_testing_servicestartup_LDADD = \
122 libgnunettesting.la \
123 $(top_builddir)/src/lib/util/libgnunetutil.la
124
125test_testing_sharedservices_SOURCES = \
126 test_testing_sharedservices.c
127test_testing_sharedservices_LDADD = \
128 libgnunettesting.la \
129 $(top_builddir)/src/lib/util/libgnunetutil.la
130
131EXTRA_DIST = \
132 test_testing_defaults.conf \
133 test_testing_sharedservices.conf \
134 testing_cmds.h
diff --git a/src/service/testing/gnunet-cmds-helper.c b/src/service/testing/gnunet-cmds-helper.c
deleted file mode 100644
index a54191abf..000000000
--- a/src/service/testing/gnunet-cmds-helper.c
+++ /dev/null
@@ -1,713 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testbed/gnunet-cmds-helper.c
23 * @brief Helper binary that is started from a remote interpreter loop to start
24 * a local interpreter loop.
25 *
26 * This helper monitors for three termination events. They are: (1)The
27 * stdin of the helper is closed for reading; (2)the helper received
28 * SIGTERM/SIGINT; (3)the local loop crashed. In case of events 1 and 2
29 * the helper kills the interpreter loop. When the interpreter loop
30 * crashed (event 3), the helper should send a SIGTERM to its own process
31 * group; this behaviour will help terminate any child processes the loop
32 * has started and prevents them from leaking and running forever.
33 *
34 * @author t3sserakt
35 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
36 */
37
38
39#include "platform.h"
40#include "gnunet_util_lib.h"
41#include "gnunet_testing_lib.h"
42#include "gnunet_testing_ng_lib.h"
43#include "gnunet_testing_plugin.h"
44#include "gnunet_testing_netjail_lib.h"
45#include "testing.h"
46#include "testing_cmds.h"
47#include "gnunet_testing_plugin.h"
48#include "gnunet_testing_barrier.h"
49#include <zlib.h>
50
51
52/**
53 * Generic logging shortcut
54 */
55#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
56
57/**
58 * Debug logging shorthand
59 */
60#define LOG_DEBUG(...) LOG (GNUNET_ERROR_TYPE_DEBUG, __VA_ARGS__)
61
62#define NODE_BASE_IP "192.168.15."
63
64#define KNOWN_BASE_IP "92.68.151."
65
66#define ROUTER_BASE_IP "92.68.150."
67
68/* Use the IP addresses below instead of the public ones,
69 * if the start script was not started from within a new namespace
70 * created by unshare. The UPNP test case needs public IP
71 * addresse for miniupnpd to function.
72 * FIXME We should introduce a switch indicating if public
73 * addresses should be used or not. This info has to be
74 * propagated from the start script to the c code.
75#define KNOWN_BASE_IP "172.16.151."
76
77#define ROUTER_BASE_IP "172.16.150."
78*/
79
80struct GNUNET_SCHEDULER_Task *finished_task;
81
82struct GNUNET_TESTING_Interpreter *is;
83
84/**
85 * Struct with information about a specific node and the whole network namespace setup.
86 *
87 */
88struct NodeIdentifier
89{
90 /**
91 * The number of the namespace this node is in.
92 *
93 */
94 char *n;
95
96 /**
97 * The number of the node in the namespace.
98 *
99 */
100 char *m;
101
102 /**
103 * The number of namespaces
104 *
105 */
106 char *global_n;
107
108 /**
109 * The number of local nodes per namespace.
110 *
111 */
112 char *local_m;
113
114 /**
115 * Shall we read the topology from file, or from a string.
116 */
117 unsigned int *read_file;
118
119 /**
120 * String with topology data or name of topology file.
121 */
122 char *topology_data;
123};
124
125/**
126 * Context for a single write on a chunk of memory
127 */
128struct WriteContext
129{
130 /**
131 * The data to write
132 */
133 void *data;
134
135 /**
136 * The length of the data
137 */
138 size_t length;
139
140 /**
141 * The current position from where the write operation should begin
142 */
143 size_t pos;
144};
145
146/**
147 * The process handle to the testbed service
148
149static struct GNUNET_OS_Process *cmd_binary_process;*/
150
151/**
152 * Plugin to dynamically load a test case.
153 */
154struct TestcasePlugin *plugin;
155
156/**
157 * Our message stream tokenizer
158 */
159struct GNUNET_MessageStreamTokenizer *tokenizer;
160
161/**
162 * Disk handle from stdin
163 */
164static struct GNUNET_DISK_FileHandle *stdin_fd;
165
166/**
167 * Disk handle for stdout
168 */
169static struct GNUNET_DISK_FileHandle *stdout_fd;
170
171/**
172 * Pipe used to communicate shutdown via signal.
173 */
174static struct GNUNET_DISK_PipeHandle *sigpipe;
175
176/**
177 * Task identifier for the read task
178 */
179static struct GNUNET_SCHEDULER_Task *read_task_id;
180
181/**
182 * Task identifier for the write task
183 */
184static struct GNUNET_SCHEDULER_Task *write_task_id;
185
186/**
187 * Are we done reading messages from stdin?
188 */
189static int done_reading;
190
191/**
192 * Result to return in case we fail
193 */
194static int status;
195
196
197/**
198 * Task to shut down cleanly
199 *
200 * @param cls NULL
201 */
202static void
203do_shutdown (void *cls)
204{
205
206 LOG_DEBUG ("Shutting down.\n");
207
208 if (NULL != read_task_id)
209 {
210 GNUNET_SCHEDULER_cancel (read_task_id);
211 read_task_id = NULL;
212 }
213 if (NULL != write_task_id)
214 {
215 struct WriteContext *wc;
216
217 wc = GNUNET_SCHEDULER_cancel (write_task_id);
218 write_task_id = NULL;
219 GNUNET_free (wc->data);
220 GNUNET_free (wc);
221 }
222 if (NULL != stdin_fd)
223 (void) GNUNET_DISK_file_close (stdin_fd);
224 if (NULL != stdout_fd)
225 (void) GNUNET_DISK_file_close (stdout_fd);
226 GNUNET_MST_destroy (tokenizer);
227 tokenizer = NULL;
228 GNUNET_PLUGIN_unload (plugin->library_name,
229 NULL);
230 GNUNET_free (plugin);
231}
232
233
234/**
235 * Task to write to the standard out
236 *
237 * @param cls the WriteContext
238 */
239static void
240write_task (void *cls)
241{
242 struct WriteContext *wc = cls;
243 ssize_t bytes_wrote;
244
245 GNUNET_assert (NULL != wc);
246 write_task_id = NULL;
247 bytes_wrote = GNUNET_DISK_file_write (stdout_fd,
248 wc->data + wc->pos,
249 wc->length - wc->pos);
250 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
251 "message send to master loop\n");
252 if (GNUNET_SYSERR == bytes_wrote)
253 {
254 LOG (GNUNET_ERROR_TYPE_WARNING,
255 "Cannot reply back successful initialization\n");
256 GNUNET_free (wc->data);
257 GNUNET_free (wc);
258 return;
259 }
260 wc->pos += bytes_wrote;
261 if (wc->pos == wc->length)
262 {
263 GNUNET_free (wc->data);
264 GNUNET_free (wc);
265 return;
266 }
267 write_task_id = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL,
268 stdout_fd,
269 &write_task,
270 wc);
271}
272
273
274/**
275 * Callback to write a message to the master loop.
276 *
277 */
278static void
279write_message (struct GNUNET_MessageHeader *message,
280 size_t msg_length)
281{
282 struct WriteContext *wc;
283
284 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
285 "write message to master loop\n");
286 wc = GNUNET_new (struct WriteContext);
287 wc->length = msg_length;
288 wc->data = message;
289 write_task_id = GNUNET_SCHEDULER_add_write_file (
290 GNUNET_TIME_UNIT_FOREVER_REL,
291 stdout_fd,
292 &write_task,
293 wc);
294}
295
296
297static void
298delay_shutdown_cb ()
299{
300 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
301 "doing shutdown after delay\n");
302 GNUNET_SCHEDULER_shutdown ();
303}
304
305
306struct GNUNET_MessageHeader *
307GNUNET_TESTING_send_local_test_finished_msg ()
308{
309 struct GNUNET_TESTING_CommandLocalFinished *reply;
310 size_t msg_length;
311
312 msg_length = sizeof(struct GNUNET_TESTING_CommandLocalFinished);
313 reply = GNUNET_new (struct GNUNET_TESTING_CommandLocalFinished);
314 reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED);
315 reply->header.size = htons ((uint16_t) msg_length);
316
317 return (struct GNUNET_MessageHeader *) reply;
318}
319
320
321static void
322finished_cb (enum GNUNET_GenericReturnValue rv)
323{
324 struct GNUNET_TESTING_CommandLocalFinished *reply;
325 size_t msg_length;
326
327 msg_length = sizeof(struct GNUNET_TESTING_CommandLocalFinished);
328 reply = GNUNET_new (struct GNUNET_TESTING_CommandLocalFinished);
329 reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED);
330 reply->header.size = htons ((uint16_t) msg_length);
331 reply->rv = rv;
332
333 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
334 "message prepared\n");
335 write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
336 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
337 "message send\n");
338 // FIXME: bad hack, do not write 1s, have continuation after write_message() is done!
339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
340 "delaying shutdown\n");
341 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
342 &delay_shutdown_cb,
343 NULL);
344}
345
346
347/**
348 * Functions with this signature are called whenever a
349 * complete message is received by the tokenizer.
350 *
351 * Do not call #GNUNET_mst_destroy() in this callback
352 *
353 * @param cls identification of the client
354 * @param message the actual message
355 * @return #GNUNET_OK on success,
356 * #GNUNET_NO to stop further processing (no error)
357 * #GNUNET_SYSERR to stop further processing with error
358 */
359static enum GNUNET_GenericReturnValue
360tokenizer_cb (void *cls,
361 const struct GNUNET_MessageHeader *message)
362{
363 struct NodeIdentifier *ni = cls;
364 const struct GNUNET_TESTING_CommandHelperInit *msg;
365 struct GNUNET_TESTING_CommandHelperReply *reply;
366 char *binary;
367 char *plugin_name;
368 size_t plugin_name_size;
369 uint16_t msize;
370 uint16_t type;
371 size_t msg_length;
372 char *router_ip;
373 char *node_ip;
374 unsigned int namespace_n;
375
376 type = ntohs (message->type);
377 msize = ntohs (message->size);
378 LOG (GNUNET_ERROR_TYPE_ERROR,
379 "Received message type %u and size %u\n",
380 type,
381 msize);
382 switch (type)
383 {
384 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT:
385 {
386 msg = (const struct GNUNET_TESTING_CommandHelperInit *) message;
387 plugin_name_size = ntohs (msg->plugin_name_size);
388 if ((sizeof(struct GNUNET_TESTING_CommandHelperInit) + plugin_name_size) >
389 msize)
390 {
391 GNUNET_break (0);
392 LOG (GNUNET_ERROR_TYPE_WARNING,
393 "Received unexpected message -- exiting\n");
394 goto error;
395 }
396 plugin_name = GNUNET_malloc (plugin_name_size + 1);
397 GNUNET_strlcpy (plugin_name,
398 ((char *) &msg[1]),
399 plugin_name_size + 1);
400
401 binary = GNUNET_OS_get_libexec_binary_path ("gnunet-cmd");
402
403 plugin = GNUNET_new (struct TestcasePlugin);
404 plugin->api = GNUNET_PLUGIN_load (plugin_name,
405 NULL);
406 plugin->library_name = GNUNET_strdup (basename (plugin_name));
407
408 plugin->global_n = ni->global_n;
409 plugin->local_m = ni->local_m;
410 plugin->n = ni->n;
411 plugin->m = ni->m;
412
413 GNUNET_asprintf (&router_ip,
414 ROUTER_BASE_IP "%s",
415 plugin->n);
416 {
417 char dummy;
418
419 if (1 !=
420 sscanf (plugin->n,
421 "%u%c",
422 &namespace_n,
423 &dummy))
424 {
425 // FIXME: how to handle error nicely?
426 GNUNET_break (0);
427 namespace_n = 0;
428 }
429 }
430
431 if (0 == namespace_n)
432 {
433 LOG (GNUNET_ERROR_TYPE_DEBUG,
434 "known node n: %s\n",
435 plugin->n);
436 GNUNET_asprintf (&node_ip,
437 KNOWN_BASE_IP "%s",
438 plugin->m);
439 }
440 else
441 {
442 LOG (GNUNET_ERROR_TYPE_DEBUG,
443 "subnet node n: %s\n",
444 plugin->n);
445 GNUNET_asprintf (&node_ip,
446 NODE_BASE_IP "%s",
447 plugin->m);
448 }
449
450 is = plugin->api->start_testcase (&write_message,
451 router_ip,
452 node_ip,
453 plugin->m,
454 plugin->n,
455 plugin->local_m,
456 ni->topology_data,
457 ni->read_file,
458 &finished_cb);
459 GNUNET_free (node_ip);
460 GNUNET_free (binary);
461 GNUNET_free (router_ip);
462 GNUNET_free (plugin_name);
463
464 msg_length = sizeof(struct GNUNET_TESTING_CommandHelperReply);
465 reply = GNUNET_new (struct GNUNET_TESTING_CommandHelperReply);
466 reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY);
467 reply->header.size = htons ((uint16_t) msg_length);
468 write_message (&reply->header,
469 msg_length);
470 return GNUNET_OK;
471 }
472 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE:
473 {
474 const char *barrier_name;
475 struct CommandBarrierCrossable *adm = (struct
476 CommandBarrierCrossable *) message;
477
478 barrier_name = (const char *) &adm[1];
479 LOG (GNUNET_ERROR_TYPE_DEBUG,
480 "cross barrier %s\n",
481 barrier_name);
482 GNUNET_TESTING_finish_barrier_ (is,
483 barrier_name);
484 return GNUNET_OK;
485 }
486 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED:
487 {
488 LOG (GNUNET_ERROR_TYPE_DEBUG,
489 "all peers started\n");
490 plugin->api->all_peers_started ();
491 return GNUNET_OK;
492 }
493 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED:
494 {
495 LOG (GNUNET_ERROR_TYPE_DEBUG,
496 "all local tests prepared\n");
497 plugin->api->all_local_tests_prepared ();
498 return GNUNET_OK;
499 }
500 default:
501 LOG (GNUNET_ERROR_TYPE_WARNING, "Received unexpected message -- exiting\n");
502 goto error;
503 }
504
505error:
506 status = GNUNET_SYSERR;
507 LOG (GNUNET_ERROR_TYPE_ERROR,
508 "tokenizer shutting down!\n");
509 GNUNET_SCHEDULER_shutdown ();
510 return GNUNET_SYSERR;
511}
512
513
514/**
515 * Task to read from stdin
516 *
517 * @param cls NULL
518 */
519static void
520read_task (void *cls)
521{
522 char buf[GNUNET_MAX_MESSAGE_SIZE];
523 ssize_t sread;
524
525 read_task_id = NULL;
526 sread = GNUNET_DISK_file_read (stdin_fd, buf, sizeof(buf));
527 if ((GNUNET_SYSERR == sread) || (0 == sread))
528 {
529 LOG_DEBUG ("STDIN closed\n");
530 GNUNET_SCHEDULER_shutdown ();
531 return;
532 }
533 if (GNUNET_YES == done_reading)
534 {
535 /* didn't expect any more data! */
536 GNUNET_break_op (0);
537 LOG (GNUNET_ERROR_TYPE_ERROR,
538 "tokenizer shutting down during reading, didn't expect any more data!\n");
539 GNUNET_SCHEDULER_shutdown ();
540 return;
541 }
542 LOG_DEBUG ("Read %u bytes\n", (unsigned int) sread);
543 /* FIXME: could introduce a GNUNET_MST_read2 to read
544 directly from 'stdin_fd' and save a memcpy() here */
545 if (GNUNET_OK !=
546 GNUNET_MST_from_buffer (tokenizer, buf, sread, GNUNET_NO, GNUNET_NO))
547 {
548 GNUNET_break (0);
549 LOG (GNUNET_ERROR_TYPE_ERROR,
550 "tokenizer shutting down during reading, writing to buffer failed!\n");
551 GNUNET_SCHEDULER_shutdown ();
552 return;
553 }
554 read_task_id /* No timeout while reading */
555 = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
556 stdin_fd,
557 &read_task,
558 NULL);
559}
560
561
562/**
563 * Main function that will be run.
564 *
565 * @param cls closure
566 * @param args remaining command-line arguments
567 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
568 * @param cfg configuration
569 */
570static void
571run (void *cls,
572 char *const *args,
573 const char *cfgfile,
574 const struct GNUNET_CONFIGURATION_Handle *cfg)
575{
576 struct NodeIdentifier *ni = cls;
577
578 LOG (GNUNET_ERROR_TYPE_DEBUG,
579 "Starting interpreter loop helper...\n");
580
581 tokenizer = GNUNET_MST_create (&tokenizer_cb,
582 ni);
583 stdin_fd = GNUNET_DISK_get_handle_from_native (stdin);
584 stdout_fd = GNUNET_DISK_get_handle_from_native (stdout);
585 read_task_id = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
586 stdin_fd,
587 &read_task,
588 NULL);
589 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
590 NULL);
591 LOG (GNUNET_ERROR_TYPE_DEBUG,
592 "Interpreter loop helper started.\n");
593}
594
595
596/**
597 * Signal handler called for SIGCHLD.
598 */
599static void
600sighandler_child_death ()
601{
602 static char c;
603 int old_errno; /* back-up errno */
604
605 old_errno = errno;
606 GNUNET_break (
607 1 ==
608 GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle (sigpipe,
609 GNUNET_DISK_PIPE_END_WRITE),
610 &c,
611 sizeof(c)));
612 errno = old_errno;
613}
614
615
616/**
617 * Main function
618 *
619 * @param argc the number of command line arguments
620 * @param argv command line arg array
621 * @return return code
622 */
623int
624main (int argc, char **argv)
625{
626 struct NodeIdentifier *ni;
627 struct GNUNET_SIGNAL_Context *shc_chld;
628 struct GNUNET_GETOPT_CommandLineOption options[] = {
629 GNUNET_GETOPT_OPTION_END
630 };
631 int ret;
632 unsigned int sscanf_ret;
633 int i;
634 size_t topology_data_length = 0;
635 unsigned int read_file;
636 char cr[2] = "\n\0";
637
638 GNUNET_log_setup ("gnunet-cmds-helper",
639 "DEBUG",
640 NULL);
641 ni = GNUNET_new (struct NodeIdentifier);
642 ni->global_n = argv[1];
643 ni->local_m = argv[2];
644 ni->m = argv[3];
645 ni->n = argv[4];
646
647 errno = 0;
648 sscanf_ret = sscanf (argv[5], "%u", &read_file);
649
650 if (errno != 0)
651 {
652 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
653 }
654 else if (1 == read_file)
655 ni->topology_data = argv[6];
656 else if (0 == read_file)
657 {
658 for (i = 6; i<argc; i++)
659 topology_data_length += strlen (argv[i]) + 1;
660 LOG (GNUNET_ERROR_TYPE_DEBUG,
661 "topo data length %llu\n",
662 (unsigned long long) topology_data_length);
663 ni->topology_data = GNUNET_malloc (topology_data_length);
664 memset (ni->topology_data, '\0', topology_data_length);
665 for (i = 6; i<argc; i++)
666 {
667 strcat (ni->topology_data, argv[i]);
668 strcat (ni->topology_data, cr);
669 }
670 }
671 else
672 {
673 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
674 "Wrong input for the fourth argument\n");
675 }
676 GNUNET_assert (0 < sscanf_ret);
677 ni->read_file = &read_file;
678 ni->topology_data[topology_data_length - 1] = '\0';
679 LOG (GNUNET_ERROR_TYPE_DEBUG,
680 "topo data %s\n",
681 ni->topology_data);
682
683 status = GNUNET_OK;
684 if (NULL ==
685 (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE)))
686 {
687 GNUNET_break (0);
688 return 1;
689 }
690 shc_chld =
691 GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD,
692 &sighandler_child_death);
693 ret = GNUNET_PROGRAM_run (argc,
694 argv,
695 "gnunet-cmds-helper",
696 "Helper for starting a local interpreter loop",
697 options,
698 &run,
699 ni);
700
701 LOG (GNUNET_ERROR_TYPE_DEBUG,
702 "Finishing helper\n");
703 GNUNET_SIGNAL_handler_uninstall (shc_chld);
704 shc_chld = NULL;
705 GNUNET_DISK_pipe_close (sigpipe);
706 GNUNET_free (ni);
707 if (GNUNET_OK != ret)
708 return 1;
709 return (GNUNET_OK == status) ? 0 : 1;
710}
711
712
713/* end of gnunet-cmds-helper.c */
diff --git a/src/service/testing/gnunet-testing.c b/src/service/testing/gnunet-testing.c
deleted file mode 100644
index 88906e5fa..000000000
--- a/src/service/testing/gnunet-testing.c
+++ /dev/null
@@ -1,444 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/gnunet-testing.c
23 * @brief tool to use testing functionality from cmd line
24 * @author Christian Grothoff
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
29
30
31#define LOG(kind, ...) GNUNET_log_from (kind, "gnunet-testing", __VA_ARGS__)
32
33
34/**
35 * Final status code.
36 */
37static int ret;
38
39/**
40 * Filename of the hostkey file we should write,
41 * null if we should not write a hostkey file.
42 */
43static char *create_hostkey;
44
45/**
46 * Non-zero if we should create config files.
47 */
48static int create_cfg;
49
50/**
51 * Number of config files to create.
52 */
53static unsigned int create_no;
54
55/**
56 * Filename of the config template to be written.
57 */
58static char *create_cfg_template;
59
60/**
61 * Service we are supposed to run.
62 */
63static char *run_service_name;
64
65/**
66 * File handle to STDIN, for reading restart/quit commands.
67 */
68static struct GNUNET_DISK_FileHandle *fh;
69
70/**
71 * Temporary filename, used with '-r' to write the configuration to.
72 */
73static char *tmpfilename;
74
75/**
76 * Task identifier of the task that waits for stdin.
77 */
78static struct GNUNET_SCHEDULER_Task *tid;
79
80/**
81 * Peer started for '-r'.
82 */
83static struct GNUNET_TESTING_Peer *my_peer;
84
85
86static int
87create_unique_cfgs (const char *template, const unsigned int no)
88{
89 struct GNUNET_TESTING_System *system;
90 int fail;
91 unsigned int cur;
92 char *cur_file;
93 struct GNUNET_CONFIGURATION_Handle *cfg_new;
94 struct GNUNET_CONFIGURATION_Handle *cfg_tmpl;
95
96 if (GNUNET_NO == GNUNET_DISK_file_test (template))
97 {
98 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
99 "Configuration template `%s': file not found\n",
100 create_cfg_template);
101 return 1;
102 }
103 cfg_tmpl = GNUNET_CONFIGURATION_create ();
104
105 /* load template */
106 if ((create_cfg_template != NULL) &&
107 (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg_tmpl, create_cfg_template)))
108 {
109 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
110 "Could not load template `%s'\n",
111 create_cfg_template);
112 GNUNET_CONFIGURATION_destroy (cfg_tmpl);
113
114 return 1;
115 }
116 /* load defaults */
117 if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg_tmpl, NULL))
118 {
119 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
120 "Could not load template `%s'\n",
121 create_cfg_template);
122 GNUNET_CONFIGURATION_destroy (cfg_tmpl);
123 return 1;
124 }
125
126 fail = GNUNET_NO;
127 system =
128 GNUNET_TESTING_system_create ("testing", NULL /* controller */, NULL, NULL);
129 for (cur = 0; cur < no; cur++)
130 {
131 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
132 "Creating configuration no. %u \n",
133 cur);
134 if (create_cfg_template != NULL)
135 GNUNET_asprintf (&cur_file, "%04u-%s", cur, create_cfg_template);
136 else
137 GNUNET_asprintf (&cur_file, "%04u%s", cur, ".conf");
138
139 cfg_new = GNUNET_CONFIGURATION_dup (cfg_tmpl);
140 if (GNUNET_OK != GNUNET_TESTING_configuration_create (system, cfg_new))
141 {
142 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
143 "Could not create another configuration\n");
144 GNUNET_CONFIGURATION_destroy (cfg_new);
145 fail = GNUNET_YES;
146 break;
147 }
148 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
149 "Writing configuration no. %u to file `%s' \n",
150 cur,
151 cur_file);
152 if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg_new, cur_file))
153 {
154 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
155 "Failed to write configuration no. %u \n",
156 cur);
157 fail = GNUNET_YES;
158 }
159 GNUNET_CONFIGURATION_destroy (cfg_new);
160 GNUNET_free (cur_file);
161 if (GNUNET_YES == fail)
162 break;
163 }
164 GNUNET_CONFIGURATION_destroy (cfg_tmpl);
165 GNUNET_TESTING_system_destroy (system, GNUNET_NO);
166 if (GNUNET_YES == fail)
167 return 1;
168 return 0;
169}
170
171
172static int
173create_hostkeys (const unsigned int no)
174{
175 struct GNUNET_TESTING_System *system;
176 struct GNUNET_PeerIdentity id;
177 struct GNUNET_DISK_FileHandle *fd;
178 struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
179
180 system = GNUNET_TESTING_system_create ("testing", NULL, NULL, NULL);
181 pk = GNUNET_TESTING_hostkey_get (system, create_no, &id);
182 if (NULL == pk)
183 {
184 fprintf (stderr,
185 _ ("Could not extract hostkey %u (offset too large?)\n"),
186 create_no);
187 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
188 return 1;
189 }
190 (void) GNUNET_DISK_directory_create_for_file (create_hostkey);
191 fd =
192 GNUNET_DISK_file_open (create_hostkey,
193 GNUNET_DISK_OPEN_READWRITE | GNUNET_DISK_OPEN_CREATE,
194 GNUNET_DISK_PERM_USER_READ
195 | GNUNET_DISK_PERM_USER_WRITE);
196 GNUNET_assert (fd != NULL);
197 ret = GNUNET_DISK_file_write (fd,
198 pk,
199 sizeof(struct GNUNET_CRYPTO_EddsaPrivateKey));
200 GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd));
201 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG,
202 "transport-testing",
203 "Wrote hostkey to file: `%s'\n",
204 create_hostkey);
205 GNUNET_free (pk);
206 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
207 return 0;
208}
209
210
211/**
212 * Cleanup called by signal handlers and when stdin is closed.
213 * Removes the temporary file.
214 *
215 * @param cls unused
216 */
217static void
218cleanup (void *cls)
219{
220 if (NULL != tmpfilename)
221 {
222 if (0 != unlink (tmpfilename))
223 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
224 "unlink",
225 tmpfilename);
226 }
227 if (NULL != tid)
228 {
229 GNUNET_SCHEDULER_cancel (tid);
230 tid = NULL;
231 }
232 if (NULL != fh)
233 {
234 GNUNET_DISK_file_close (fh);
235 fh = NULL;
236 }
237}
238
239
240/**
241 * Called whenever we can read stdin non-blocking
242 *
243 * @param cls unused
244 */
245static void
246stdin_cb (void *cls)
247{
248 int c;
249
250 tid = NULL;
251 c = getchar ();
252 switch (c)
253 {
254 case EOF:
255 case 'q':
256 GNUNET_SCHEDULER_shutdown ();
257 return;
258
259 case 'r':
260 if (GNUNET_OK != GNUNET_TESTING_peer_stop (my_peer))
261 LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to stop the peer\n");
262 if (GNUNET_OK != GNUNET_TESTING_peer_start (my_peer))
263 LOG (GNUNET_ERROR_TYPE_ERROR, "Failed to start the peer\n");
264 printf ("restarted\n");
265 fflush (stdout);
266 break;
267
268 case '\n':
269 case '\r':
270 /* ignore whitespace */
271 break;
272
273 default:
274 fprintf (stderr,
275 _ ("Unknown command, use 'q' to quit or 'r' to restart peer\n"));
276 break;
277 }
278 tid = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
279 fh,
280 &stdin_cb,
281 NULL);
282}
283
284
285/**
286 * Main function called by the testing library.
287 * Executed inside a running scheduler.
288 *
289 * @param cls unused
290 * @param cfg configuration of the peer that was started
291 * @param peer handle to the peer
292 */
293static void
294testing_main (void *cls,
295 const struct GNUNET_CONFIGURATION_Handle *cfg,
296 struct GNUNET_TESTING_Peer *peer)
297{
298 my_peer = peer;
299 if (NULL == (tmpfilename = GNUNET_DISK_mktemp ("gnunet-testing")))
300 {
301 GNUNET_break (0);
302 GNUNET_SCHEDULER_shutdown ();
303 return;
304 }
305 if (GNUNET_SYSERR ==
306 GNUNET_CONFIGURATION_write ((struct GNUNET_CONFIGURATION_Handle *) cfg,
307 tmpfilename))
308 {
309 GNUNET_break (0);
310 return;
311 }
312 printf ("ok\n%s\n", tmpfilename);
313 fflush (stdout);
314 GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL);
315 fh = GNUNET_DISK_get_handle_from_native (stdin);
316 tid = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
317 fh,
318 &stdin_cb,
319 NULL);
320}
321
322
323/**
324 * Main function that will be running without scheduler.
325 *
326 * @param cls closure
327 * @param args remaining command-line arguments
328 * @param cfgfile name of the configuration file used (for saving, can be NULL!)
329 * @param cfg configuration
330 */
331static void
332run_no_scheduler (void *cls,
333 char *const *args,
334 const char *cfgfile,
335 const struct GNUNET_CONFIGURATION_Handle *cfg)
336{
337 if (NULL != run_service_name)
338 {
339 ret = GNUNET_TESTING_service_run ("gnunet_service_test",
340 run_service_name,
341 cfgfile,
342 &testing_main,
343 NULL);
344 return;
345 }
346
347 if (GNUNET_YES == create_cfg)
348 {
349 if (create_no > 0)
350 {
351 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
352 "Creating %u configuration files based on template `%s'\n",
353 create_no,
354 create_cfg_template);
355 ret = create_unique_cfgs (create_cfg_template, create_no);
356 }
357 else
358 {
359 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Missing arguments! \n");
360 ret = 1;
361 }
362 }
363 if (NULL != create_hostkey)
364 {
365 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Extracting hostkey %u\n", create_no);
366 ret = create_hostkeys (create_no);
367 }
368 GNUNET_free (create_cfg_template);
369}
370
371
372/**
373 * The main function.
374 *
375 * @param argc number of arguments from the command line
376 * @param argv command line arguments
377 * @return 0 ok, 1 on error
378 */
379int
380main (int argc, char *const *argv)
381{
382 struct GNUNET_GETOPT_CommandLineOption options[] =
383 { GNUNET_GETOPT_option_flag ('C',
384 "cfg",
385 gettext_noop (
386 "create unique configuration files"),
387 &create_cfg),
388 GNUNET_GETOPT_option_string (
389 'k',
390 "key",
391 "FILENAME",
392 gettext_noop ("extract hostkey file from pre-computed hostkey list"),
393 &create_hostkey),
394
395 GNUNET_GETOPT_option_uint (
396 'n',
397 "number",
398 "NUMBER",
399 gettext_noop (
400 "number of unique configuration files to create, or number of the hostkey to extract"),
401 &create_no),
402
403
404 GNUNET_GETOPT_option_string ('t',
405 "template",
406 "FILENAME",
407 gettext_noop ("configuration template"),
408 &create_cfg_template),
409
410 GNUNET_GETOPT_option_string (
411 'r',
412 "run",
413 "SERVICE",
414 gettext_noop (
415 "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"),
416 &run_service_name),
417 GNUNET_GETOPT_OPTION_END };
418
419 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
420 return 2;
421
422 /* Run without scheduler, because we may want to call
423 * GNUNET_TESTING_service_run, which starts the scheduler on its own.
424 * Furthermore, the other functionality currently does not require the scheduler, too,
425 * but beware when extending gnunet-testing. */
426 ret =
427 (GNUNET_OK ==
428 GNUNET_PROGRAM_run2 (argc,
429 argv,
430 "gnunet-testing",
431 gettext_noop (
432 "Command line tool to access the testing library"),
433 options,
434 &run_no_scheduler,
435 NULL,
436 GNUNET_YES))
437 ? ret
438 : 1;
439 GNUNET_free_nz ((void *) argv);
440 return ret;
441}
442
443
444/* end of gnunet-testing.c */
diff --git a/src/service/testing/list-keys.c b/src/service/testing/list-keys.c
deleted file mode 100644
index f65b45a77..000000000
--- a/src/service/testing/list-keys.c
+++ /dev/null
@@ -1,112 +0,0 @@
1#include "platform.h"
2#include "gnunet_util_lib.h"
3#include "gnunet_testing_lib.h"
4
5static unsigned int nkeys;
6static unsigned int nskip;
7static int result;
8
9/**
10 * Main run function.
11 *
12 * @param cls NULL
13 * @param args arguments passed to GNUNET_PROGRAM_run
14 * @param cfgfile the path to configuration file
15 * @param cfg the configuration file handle
16 */
17static void
18run (void *cls,
19 char *const *args,
20 const char *cfgfile,
21 const struct GNUNET_CONFIGURATION_Handle *config)
22{
23 char *idfile;
24 struct GNUNET_DISK_FileHandle *f;
25 void *data;
26 struct GNUNET_DISK_MapHandle *map;
27 struct GNUNET_CRYPTO_EddsaPrivateKey pkey;
28 struct GNUNET_PeerIdentity id;
29 unsigned int cnt;
30 uint64_t fsize;
31 unsigned int nmax;
32
33 if ((NULL == args) || (NULL == args[0]))
34 {
35 fprintf (stderr, "Need the hostkey file\n");
36 return;
37 }
38 idfile = args[0];
39 if (GNUNET_OK !=
40 GNUNET_DISK_file_size (idfile, &fsize, GNUNET_YES, GNUNET_YES))
41 {
42 GNUNET_break (0);
43 return;
44 }
45 if (0 != (fsize % GNUNET_TESTING_HOSTKEYFILESIZE))
46 {
47 fprintf (stderr, _ ("Incorrect hostkey file format: %s\n"), idfile);
48 return;
49 }
50 f = GNUNET_DISK_file_open (idfile,
51 GNUNET_DISK_OPEN_READ,
52 GNUNET_DISK_PERM_NONE);
53 if (NULL == f)
54 {
55 GNUNET_break (0);
56 return;
57 }
58 data = GNUNET_DISK_file_map (f, &map, GNUNET_DISK_MAP_TYPE_READ, fsize);
59 if (NULL == data)
60 {
61 GNUNET_break (0);
62 GNUNET_DISK_file_close (f);
63 return;
64 }
65 nmax = fsize / GNUNET_TESTING_HOSTKEYFILESIZE;
66 for (cnt = nskip; cnt < (nskip + nkeys); cnt++)
67 {
68 if (nskip + cnt >= nmax)
69 {
70 printf ("Max keys %u reached\n", nmax);
71 break;
72 }
73 GNUNET_memcpy (&pkey,
74 data + (cnt * GNUNET_TESTING_HOSTKEYFILESIZE),
75 GNUNET_TESTING_HOSTKEYFILESIZE);
76 GNUNET_CRYPTO_eddsa_key_get_public (&pkey, &id.public_key);
77 printf ("Key %u: %s\n", cnt, GNUNET_i2s_full (&id));
78 }
79 result = GNUNET_OK;
80 GNUNET_DISK_file_unmap (map);
81 GNUNET_DISK_file_close (f);
82}
83
84
85int
86main (int argc, char *argv[])
87{
88 struct GNUNET_GETOPT_CommandLineOption option[] =
89 { GNUNET_GETOPT_option_uint ('n',
90 "num-keys",
91 "COUNT",
92 gettext_noop ("list COUNT number of keys"),
93 &nkeys),
94 GNUNET_GETOPT_OPTION_END };
95 int ret;
96
97 result = GNUNET_SYSERR;
98 nkeys = 10;
99 ret =
100 GNUNET_PROGRAM_run (argc,
101 argv,
102 "list-keys",
103 "Lists the peer IDs corresponding to the given keys file\n",
104 option,
105 &run,
106 NULL);
107 if (GNUNET_OK != ret)
108 return 1;
109 if (GNUNET_SYSERR == result)
110 return 1;
111 return 0;
112}
diff --git a/src/service/testing/meson.build b/src/service/testing/meson.build
deleted file mode 100644
index ea8956c1b..000000000
--- a/src/service/testing/meson.build
+++ /dev/null
@@ -1,62 +0,0 @@
1libgnunettesting_src = [
2 'testing_api_cmd_exec_bash_script.c',
3 'testing_api_cmd_barrier.c',
4 'testing_api_cmd_barrier_reached.c',
5 'testing_api_cmd_finish.c',
6 'testing_api_cmd_local_test_prepared.c',
7 'testing_api_cmd_send_peer_ready.c',
8 'testing_api_cmd_block_until_external_trigger.c',
9 'testing_api_cmd_netjail_start.c',
10 'testing_api_cmd_netjail_start_cmds_helper.c',
11 'testing_api_cmd_netjail_stop_cmds_helper.c',
12 'testing_api_cmd_netjail_stop.c',
13 'testing.c',
14 'testing_api_cmd_system_create.c',
15 'testing_api_cmd_system_destroy.c',
16 'testing_api_cmd_batch.c',
17 'testing_api_loop.c',
18 'testing_api_traits.c'
19 ]
20
21gnunettesting_src = ['gnunet-testing.c']
22gnunetservicetesting_src = ['gnunet-service-testing.c']
23
24configure_file(input : 'testing.conf',
25 output : 'testing.conf',
26 configuration : cdata,
27 install: true,
28 install_dir: pkgcfgdir)
29
30
31libgnunettesting = library('gnunettesting',
32 libgnunettesting_src,
33 soversion: '1',
34 version: '1.1.0',
35 dependencies: [libgnunetutil_dep,
36 m_dep,
37 libgnunetarm_dep],
38 include_directories: [incdir, configuration_inc],
39 install: true,
40 install_dir: get_option('libdir'))
41libgnunettesting_dep = declare_dependency(link_with : libgnunettesting)
42pkg.generate(libgnunettesting, url: 'https://www.gnunet.org',
43 description : 'Provides API for gnunet testing')
44
45executable ('gnunet-testing',
46 gnunettesting_src,
47 dependencies: [libgnunettesting_dep,
48 libgnunetutil_dep,
49 ],
50 include_directories: [incdir, configuration_inc],
51 install: true,
52 install_dir: get_option('bindir'))
53
54executable ('gnunet-cmds-helper',
55 ['gnunet-cmds-helper.c'],
56 dependencies: [libgnunettesting_dep,
57 libgnunetutil_dep,
58 ],
59 include_directories: [incdir, configuration_inc],
60 install: true,
61 install_dir: get_option('libdir')/'gnunet'/'libexec')
62
diff --git a/src/service/testing/test_testing_defaults.conf b/src/service/testing/test_testing_defaults.conf
deleted file mode 100644
index 2e7c39113..000000000
--- a/src/service/testing/test_testing_defaults.conf
+++ /dev/null
@@ -1,25 +0,0 @@
1[PATHS]
2GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-testing/
3
4[transport]
5PLUGINS = tcp
6
7[transport-tcp]
8TESTING_IGNORE_KEYS = SOMETHING;KEY1;ACCEPT_FROM;
9
10[transport-tcp]
11BINDTO = 127.0.0.1
12
13[nat]
14DISABLEV6 = YES
15ENABLE_UPNP = NO
16BEHIND_NAT = NO
17ALLOW_NAT = NO
18INTERNAL_ADDRESS = 127.0.0.1
19EXTERNAL_ADDRESS = 127.0.0.1
20USE_LOCALADDR = NO
21
22
23[rps]
24START_ON_DEMAND = NO
25IMMEDIATE_START = NO
diff --git a/src/service/testing/test_testing_peerstartup.c b/src/service/testing/test_testing_peerstartup.c
deleted file mode 100644
index 25cbb2a9f..000000000
--- a/src/service/testing/test_testing_peerstartup.c
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/test_testing_new_peerstartup.c
23 * @brief test case for testing peer startup and shutdown using new testing
24 * library
25 * @author Sree Harsha Totakura
26 */
27
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_testing_lib.h"
31
32#define LOG(kind, ...) \
33 GNUNET_log (kind, __VA_ARGS__)
34
35/**
36 * The status of the test
37 */
38int status;
39
40/**
41 * The testing context
42 */
43struct TestingContext
44{
45 /**
46 * The testing system
47 */
48 struct GNUNET_TESTING_System *system;
49
50 /**
51 * The peer which has been started by the testing system
52 */
53 struct GNUNET_TESTING_Peer *peer;
54
55 /**
56 * The running configuration of the peer
57 */
58 struct GNUNET_CONFIGURATION_Handle *cfg;
59};
60
61
62/**
63 * Task for shutdown
64 *
65 * @param cls the testing context
66 */
67static void
68do_shutdown (void *cls)
69{
70 struct TestingContext *test_ctx = cls;
71
72 GNUNET_assert (NULL != test_ctx);
73 if (NULL != test_ctx->peer)
74 {
75 (void) GNUNET_TESTING_peer_stop (test_ctx->peer);
76 GNUNET_TESTING_peer_destroy (test_ctx->peer);
77 }
78 if (NULL != test_ctx->cfg)
79 GNUNET_CONFIGURATION_destroy (test_ctx->cfg);
80 if (NULL != test_ctx->system)
81 GNUNET_TESTING_system_destroy (test_ctx->system, GNUNET_YES);
82 GNUNET_free (test_ctx);
83}
84
85
86/**
87 * Main point of test execution
88 */
89static void
90run (void *cls, char *const *args, const char *cfgfile,
91 const struct GNUNET_CONFIGURATION_Handle *cfg)
92{
93 struct TestingContext *test_ctx;
94 char *emsg;
95 struct GNUNET_PeerIdentity id;
96
97 test_ctx = GNUNET_new (struct TestingContext);
98 test_ctx->system =
99 GNUNET_TESTING_system_create ("test-gnunet-testing",
100 "127.0.0.1", NULL, NULL);
101 emsg = NULL;
102 if (NULL == test_ctx->system)
103 goto end;
104 test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg);
105 test_ctx->peer =
106 GNUNET_TESTING_peer_configure (test_ctx->system,
107 test_ctx->cfg,
108 0, &id, &emsg);
109 if (NULL == test_ctx->peer)
110 {
111 if (NULL != emsg)
112 printf ("Test failed upon error: %s", emsg);
113 goto end;
114 }
115 if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer))
116 goto end;
117 status = GNUNET_OK;
118
119end:
120 GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx);
121 GNUNET_free (emsg);
122}
123
124
125int
126main (int argc, char *argv[])
127{
128 struct GNUNET_GETOPT_CommandLineOption options[] = {
129 GNUNET_GETOPT_OPTION_END
130 };
131
132 status = GNUNET_SYSERR;
133 if (GNUNET_OK !=
134 GNUNET_PROGRAM_run (argc, argv,
135 "test_testing_peerstartup",
136 "test case for peerstartup using new testing library",
137 options, &run, NULL))
138 return 1;
139 return (GNUNET_OK == status) ? 0 : 1;
140}
141
142
143/* end of test_testing_peerstartup.c */
diff --git a/src/service/testing/test_testing_peerstartup2.c b/src/service/testing/test_testing_peerstartup2.c
deleted file mode 100644
index 8d357cb08..000000000
--- a/src/service/testing/test_testing_peerstartup2.c
+++ /dev/null
@@ -1,222 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/test_testing_new_peerstartup.c
23 * @brief test case for testing peer startup and shutdown using new testing
24 * library
25 * @author Sree Harsha Totakura
26 */
27
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_testing_lib.h"
31
32#define LOG(kind, ...) \
33 GNUNET_log (kind, __VA_ARGS__)
34
35
36#define FAIL_TEST(cond) \
37 do { \
38 if (! (cond)) { \
39 GNUNET_break (0); \
40 if (GNUNET_OK == status) { \
41 status = GNUNET_SYSERR; \
42 } \
43 } \
44 } while (0) \
45
46
47/**
48 * The status of the test
49 */
50int status;
51
52/**
53 * The testing context
54 */
55struct TestingContext
56{
57 /**
58 * The testing system
59 */
60 struct GNUNET_TESTING_System *system;
61
62 /**
63 * The peer which has been started by the testing system
64 */
65 struct GNUNET_TESTING_Peer *peer;
66
67 /**
68 * The running configuration of the peer
69 */
70 struct GNUNET_CONFIGURATION_Handle *cfg;
71
72 /**
73 * State
74 */
75 enum
76 {
77 PEER_INIT,
78
79 PEER_STARTED,
80
81 PEER_STOPPED
82 } state;
83};
84
85
86static void
87do_shutdown2 (void *cls)
88{
89 struct TestingContext *test_ctx = cls;
90
91 if (NULL != test_ctx->peer)
92 GNUNET_TESTING_peer_destroy (test_ctx->peer);
93 if (NULL != test_ctx->cfg)
94 GNUNET_CONFIGURATION_destroy (test_ctx->cfg);
95 if (NULL != test_ctx->system)
96 GNUNET_TESTING_system_destroy (test_ctx->system, GNUNET_YES);
97 GNUNET_free (test_ctx);
98}
99
100
101/**
102 * Task for shutdown
103 *
104 * @param cls the testing context
105 */
106static void
107do_shutdown (void *cls);
108
109
110static void
111peer_status_cb (void *cls, struct GNUNET_TESTING_Peer *peer, int success)
112{
113 struct TestingContext *test_ctx = cls;
114
115 switch (test_ctx->state)
116 {
117 case PEER_INIT:
118 FAIL_TEST (0);
119 break;
120
121 case PEER_STARTED:
122 FAIL_TEST (GNUNET_YES == success);
123 test_ctx->state = PEER_STOPPED;
124 GNUNET_SCHEDULER_add_now (&do_shutdown2, cls);
125 break;
126
127 case PEER_STOPPED:
128 FAIL_TEST (0);
129 }
130}
131
132
133/**
134 * Task for shutdown
135 *
136 * @param cls the testing context
137 */
138static void
139do_shutdown (void *cls)
140{
141 struct TestingContext *test_ctx = cls;
142
143 GNUNET_assert (NULL != test_ctx);
144 if (NULL != test_ctx->peer)
145 {
146 FAIL_TEST (GNUNET_OK ==
147 GNUNET_TESTING_peer_stop_async (test_ctx->peer,
148 &peer_status_cb,
149 test_ctx));
150 }
151 else
152 do_shutdown2 (test_ctx);
153}
154
155
156/**
157 * Main point of test execution
158 */
159static void
160run (void *cls, char *const *args, const char *cfgfile,
161 const struct GNUNET_CONFIGURATION_Handle *cfg)
162{
163 struct TestingContext *test_ctx;
164 char *emsg;
165 struct GNUNET_PeerIdentity id;
166
167 test_ctx = GNUNET_new (struct TestingContext);
168 test_ctx->system =
169 GNUNET_TESTING_system_create ("test-gnunet-testing",
170 "127.0.0.1", NULL, NULL);
171 emsg = NULL;
172 if (NULL == test_ctx->system)
173 goto end;
174 test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg);
175 test_ctx->peer =
176 GNUNET_TESTING_peer_configure (test_ctx->system,
177 test_ctx->cfg,
178 0, &id, &emsg);
179 if (NULL == test_ctx->peer)
180 {
181 if (NULL != emsg)
182 printf ("Test failed upon error: %s", emsg);
183 goto end;
184 }
185 if (GNUNET_OK != GNUNET_TESTING_peer_start (test_ctx->peer))
186 goto end;
187 test_ctx->state = PEER_STARTED;
188 FAIL_TEST (GNUNET_OK ==
189 GNUNET_TESTING_peer_stop_async (test_ctx->peer,
190 &peer_status_cb,
191 test_ctx));
192 GNUNET_TESTING_peer_stop_async_cancel (test_ctx->peer);
193 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
194 &do_shutdown, test_ctx);
195 return;
196
197end:
198 FAIL_TEST (0);
199 GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx);
200 GNUNET_free (emsg);
201}
202
203
204int
205main (int argc, char *argv[])
206{
207 struct GNUNET_GETOPT_CommandLineOption options[] = {
208 GNUNET_GETOPT_OPTION_END
209 };
210
211 status = GNUNET_OK;
212 if (GNUNET_OK !=
213 GNUNET_PROGRAM_run (argc, argv,
214 "test_testing_new_peerstartup",
215 "test case for peerstartup using new testing library",
216 options, &run, NULL))
217 return 1;
218 return (GNUNET_OK == status) ? 0 : 1;
219}
220
221
222/* end of test_testing_peerstartup.c */
diff --git a/src/service/testing/test_testing_servicestartup.c b/src/service/testing/test_testing_servicestartup.c
deleted file mode 100644
index 83458898b..000000000
--- a/src/service/testing/test_testing_servicestartup.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/test_testing_new_servicestartup.c
23 * @brief test case for testing service startup using new testing API
24 * @author Sree Harsha Totakura
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
29
30
31#define LOG(kind, ...) \
32 GNUNET_log (kind, __VA_ARGS__)
33
34
35/**
36 * Global test status
37 */
38static int test_success;
39
40
41/**
42 * The testing callback function
43 *
44 * @param cls NULL
45 * @param cfg the configuration with which the current testing service is run
46 */
47static void
48test_run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
49 struct GNUNET_TESTING_Peer *peer)
50{
51 GNUNET_assert (NULL == cls);
52 GNUNET_assert (NULL != cfg);
53 LOG (GNUNET_ERROR_TYPE_DEBUG, "Service arm started successfully\n");
54 test_success = GNUNET_YES;
55 GNUNET_SCHEDULER_shutdown ();
56}
57
58
59/**
60 * The main point of execution
61 */
62int
63main (int argc, char *argv[])
64{
65 test_success = GNUNET_NO;
66 GNUNET_assert (0 == GNUNET_TESTING_service_run ("test-testing-servicestartup",
67 "arm",
68 "test_testing_defaults.conf",
69 &test_run,
70 NULL));
71 return (GNUNET_YES == test_success) ? 0 : 1;
72}
73
74
75/* end of test_testing_servicestartup.c */
diff --git a/src/service/testing/test_testing_sharedservices.c b/src/service/testing/test_testing_sharedservices.c
deleted file mode 100644
index d2f760d7a..000000000
--- a/src/service/testing/test_testing_sharedservices.c
+++ /dev/null
@@ -1,167 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/test_testing_sharedservices.c
23 * @brief test case for testing service sharing among peers started by testing
24 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 */
26
27#include "platform.h"
28#include "gnunet_util_lib.h"
29#include "gnunet_testing_lib.h"
30
31#define LOG(kind, ...) \
32 GNUNET_log (kind, __VA_ARGS__)
33
34#define NUM_PEERS 4
35
36/**
37 * The status of the test
38 */
39int status;
40
41/**
42 * The testing context
43 */
44struct TestingContext
45{
46 /**
47 * The testing system
48 */
49 struct GNUNET_TESTING_System *system;
50
51 /**
52 * The peer which has been started by the testing system
53 */
54 struct GNUNET_TESTING_Peer *peers[NUM_PEERS];
55
56 /**
57 * The running configuration of the peer
58 */
59 struct GNUNET_CONFIGURATION_Handle *cfg;
60};
61
62
63/**
64 * Task for shutdown
65 *
66 * @param cls the testing context
67 */
68static void
69do_shutdown (void *cls)
70{
71 struct TestingContext *test_ctx = cls;
72 struct GNUNET_TESTING_Peer *peer;
73 unsigned int cnt;
74
75 GNUNET_assert (NULL != test_ctx);
76 for (cnt = 0; cnt < NUM_PEERS; cnt++)
77 {
78 peer = test_ctx->peers[cnt];
79 if (NULL == peer)
80 continue;
81 (void) GNUNET_TESTING_peer_stop (peer);
82 GNUNET_TESTING_peer_destroy (peer);
83 }
84 if (NULL != test_ctx->cfg)
85 GNUNET_CONFIGURATION_destroy (test_ctx->cfg);
86 if (NULL != test_ctx->system)
87 GNUNET_TESTING_system_destroy (test_ctx->system, GNUNET_YES);
88 GNUNET_free (test_ctx);
89}
90
91
92/**
93 * Main point of test execution
94 */
95static void
96run (void *cls, char *const *args, const char *cfgfile,
97 const struct GNUNET_CONFIGURATION_Handle *cfg)
98{
99 struct TestingContext *test_ctx;
100 char *emsg;
101 struct GNUNET_PeerIdentity id;
102 struct GNUNET_TESTING_SharedService ss[] = {
103 { "peerinfo", cfg, 2 },
104 { NULL, NULL, 0 }
105 };
106 struct GNUNET_TESTING_Peer *peer;
107 unsigned int cnt;
108
109 test_ctx = GNUNET_new (struct TestingContext);
110 test_ctx->system =
111 GNUNET_TESTING_system_create ("test-gnunet-testing",
112 "127.0.0.1", NULL, ss);
113 emsg = NULL;
114 if (NULL == test_ctx->system)
115 goto end;
116 test_ctx->cfg = GNUNET_CONFIGURATION_dup (cfg);
117 for (cnt = 0; cnt < NUM_PEERS; cnt++)
118 {
119 peer = GNUNET_TESTING_peer_configure (test_ctx->system,
120 test_ctx->cfg,
121 0, &id, &emsg);
122 if (NULL == peer)
123 {
124 if (NULL != emsg)
125 printf ("Test failed upon error: %s", emsg);
126 goto end;
127 }
128 if (GNUNET_OK != GNUNET_TESTING_peer_start (peer))
129 {
130 GNUNET_TESTING_peer_destroy (peer);
131 goto end;
132 }
133 test_ctx->peers[cnt] = peer;
134 }
135 status = GNUNET_OK;
136 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
137 &do_shutdown, test_ctx);
138 return;
139
140end:
141 GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx);
142 GNUNET_free (emsg);
143}
144
145
146int
147main (int argc, char *argv[])
148{
149 struct GNUNET_GETOPT_CommandLineOption options[] = {
150 GNUNET_GETOPT_OPTION_END
151 };
152 char *const argv2[] = { "test_testing_sharedservices",
153 "-c", "test_testing_sharedservices.conf",
154 NULL };
155
156 status = GNUNET_SYSERR;
157 if (GNUNET_OK !=
158 GNUNET_PROGRAM_run ((sizeof(argv2) / sizeof(char *)) - 1, argv2,
159 "test_testing_sharedservices",
160 "test case for testing service sharing among peers started by testing",
161 options, &run, NULL))
162 return 1;
163 return (GNUNET_OK == status) ? 0 : 3;
164}
165
166
167/* end of test_testing_sharedservices.c */
diff --git a/src/service/testing/test_testing_sharedservices.conf b/src/service/testing/test_testing_sharedservices.conf
deleted file mode 100644
index 92eac7e71..000000000
--- a/src/service/testing/test_testing_sharedservices.conf
+++ /dev/null
@@ -1,30 +0,0 @@
1[PATHS]
2GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-testing/
3
4[testbed-logger]
5PORT = 59132
6UNIXPATH = $GNUNET_RUNTIME_DIR/testbed-logger.sock
7DIR = $GNUNET_TMP/testbed-logger
8
9[transport]
10PLUGINS = tcp
11
12[transport-tcp]
13TESTING_IGNORE_KEYS = SOMETHING;KEY1;ACCEPT_FROM;
14
15[transport-tcp]
16BINDTO = 127.0.0.1
17
18[nat]
19DISABLEV6 = YES
20ENABLE_UPNP = NO
21BEHIND_NAT = NO
22ALLOW_NAT = NO
23INTERNAL_ADDRESS = 127.0.0.1
24EXTERNAL_ADDRESS = 127.0.0.1
25USE_LOCALADDR = NO
26
27
28[rps]
29START_ON_DEMAND = NO
30IMMEDIATE_START = NO
diff --git a/src/service/testing/test_testing_start_with_config.c b/src/service/testing/test_testing_start_with_config.c
deleted file mode 100644
index a2c692dbc..000000000
--- a/src/service/testing/test_testing_start_with_config.c
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file transport/test_transport_start_with_config.c
23 * @brief Generic program to start testcases in an configurable topology.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_testing_ng_lib.h"
28#include "gnunet_testing_netjail_lib.h"
29#include "gnunet_util_lib.h"
30
31#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
32
33
34int
35main (int argc,
36 char *const *argv)
37{
38 char *topology_data;
39 char *topology_data_script;
40 struct GNUNET_TESTING_NetjailTopology *topology;
41 unsigned int read_file = GNUNET_YES;
42 int ret;
43 char *rest = NULL;
44 char *token;
45 size_t single_line_len;
46 size_t data_len;
47
48 GNUNET_log_setup ("test-netjail",
49 "INFO",
50 NULL);
51
52 if (0 == strcmp ("-s", argv[1]))
53 {
54 data_len = strlen (argv[2]);
55 topology_data = GNUNET_malloc (data_len);
56 topology_data_script = GNUNET_malloc (data_len);
57 token = strtok_r (argv[2], "\n", &rest);
58 while (NULL != token)
59 {
60 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
61 "token1 %s\n",
62 token);
63 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
64 "token2 %s\n",
65 token);
66 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
67 "topology_data %s\n",
68 topology_data);
69 strcat (topology_data_script, token);
70 strcat (topology_data_script, " ");
71 strcat (topology_data, token);
72 strcat (topology_data, "\n");
73 token = strtok_r (NULL, "\n", &rest);
74 }
75 single_line_len = strlen (topology_data);
76 topology_data_script [single_line_len - 1] = '\0';
77 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
78 "read from string\n");
79 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
80 "topology_data %s\n",
81 topology_data);
82 read_file = GNUNET_NO;
83 topology = GNUNET_TESTING_get_topo_from_string (topology_data);
84 }
85 else
86 {
87 topology_data = argv[1];
88 topology_data_script = argv[1];
89 topology = GNUNET_TESTING_get_topo_from_file (topology_data);
90 }
91
92 struct GNUNET_TESTING_Command commands[] = {
93 GNUNET_TESTING_cmd_netjail_start ("netjail-start",
94 topology_data_script,
95 &read_file),
96 GNUNET_TESTING_cmd_netjail_start_cmds_helper ("netjail-start-testbed",
97 topology,
98 &read_file,
99 topology_data_script,
100 TIMEOUT),
101 GNUNET_TESTING_cmd_stop_cmds_helper ("stop-testbed",
102 "netjail-start-testbed",
103 topology),
104 GNUNET_TESTING_cmd_netjail_stop ("netjail-stop",
105 topology_data_script,
106 &read_file),
107 GNUNET_TESTING_cmd_end ()
108 };
109
110 ret = GNUNET_TESTING_main (commands,
111 TIMEOUT);
112
113 if (0 == strcmp ("-s", argv[1]))
114 {
115 GNUNET_free (topology_data_script);
116 GNUNET_free (topology_data);
117 }
118 GNUNET_TESTING_free_topology (topology);
119
120 return ret;
121}
diff --git a/src/service/testing/testing.c b/src/service/testing/testing.c
deleted file mode 100644
index fdfa80d87..000000000
--- a/src/service/testing/testing.c
+++ /dev/null
@@ -1,2830 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2008, 2009, 2012 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing.c
23 * @brief convenience API for writing testcases for GNUnet
24 * Many testcases need to start and stop a peer/service
25 * and this library is supposed to make that easier
26 * for TESTCASES. Normal programs should always
27 * use functions from gnunet_{util,arm}_lib.h. This API is
28 * ONLY for writing testcases (or internal use of the testbed).
29 * @author Christian Grothoff
30 *
31 */
32#include "platform.h"
33#include "gnunet_util_lib.h"
34#include "gnunet_arm_service.h"
35#include "gnunet_testing_lib.h"
36#include "gnunet_testing_ng_lib.h"
37#include "gnunet_testing_plugin.h"
38#include "gnunet_testing_barrier.h"
39#include "gnunet_testing_netjail_lib.h"
40#include "testing_cmds.h"
41
42#define LOG(kind, ...) GNUNET_log_from (kind, "testing-api", __VA_ARGS__)
43
44#define CONNECT_ADDRESS_TEMPLATE "%s-192.168.15.%u"
45
46#define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-92.68.150.%u"
47
48#define KNOWN_CONNECT_ADDRESS_TEMPLATE "%s-92.68.151.%u"
49
50/* Use the IP addresses below instead of the public ones,
51 * if the start script was not started from within a new namespace
52 * created by unshare. The UPNP test case needs public IP
53 * addresse for miniupnpd to function.
54 * FIXME We should introduce a switch indicating if public
55 * addresses should be used or not. This info has to be
56 * propagated from the start script to the c code.
57#define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-172.16.150.%u"
58
59#define KNOWN_CONNECT_ADDRESS_TEMPLATE "%s-172.16.151.%u"
60*/
61
62#define PREFIX_TCP "tcp"
63
64#define PREFIX_UDP "udp"
65
66#define PREFIX_TCP_NATTED "tcp_natted"
67
68#define PREFIX_UDP_NATTED "udp_natted"
69
70/**
71 * Lowest port used for GNUnet testing. Should be high enough to not
72 * conflict with other applications running on the hosts but be low
73 * enough to not conflict with client-ports (typically starting around
74 * 32k).
75 */
76#define LOW_PORT 12000
77
78/**
79 * Highest port used for GNUnet testing. Should be low enough to not
80 * conflict with the port range for "local" ports (client apps; see
81 * /proc/sys/net/ipv4/ip_local_port_range on Linux for example).
82 */
83#define HIGH_PORT 56000
84
85
86struct SharedServiceInstance
87{
88 struct SharedService *ss;
89
90 char *cfg_fn;
91
92 struct GNUNET_OS_Process *proc;
93
94 char *unix_sock;
95
96 char *port_str;
97
98 unsigned int n_refs;
99};
100
101struct SharedService
102{
103 char *sname;
104
105 struct SharedServiceInstance **instances;
106
107 struct GNUNET_CONFIGURATION_Handle *cfg;
108
109 unsigned int n_peers;
110
111 unsigned int share;
112
113 unsigned int n_instances;
114};
115
116
117/**
118 * Handle for a system on which GNUnet peers are executed;
119 * a system is used for reserving unique paths and ports.
120 */
121struct GNUNET_TESTING_System
122{
123 /**
124 * Prefix (e.g. "/tmp/gnunet-testing/") we prepend to each
125 * GNUNET_HOME.
126 */
127 char *tmppath;
128
129 /**
130 * The trusted ip. Can either be a single ip address or a network address in
131 * CIDR notation.
132 */
133 char *trusted_ip;
134
135 /**
136 * our hostname
137 */
138 char *hostname;
139
140 /**
141 * Hostkeys data, contains "GNUNET_TESTING_HOSTKEYFILESIZE * total_hostkeys" bytes.
142 */
143 char *hostkeys_data;
144
145 /**
146 * memory map for @e hostkeys_data.
147 */
148 struct GNUNET_DISK_MapHandle *map;
149
150 struct SharedService *shared_services;
151
152 unsigned int n_shared_services;
153
154 /**
155 * Bitmap where each port that has already been reserved for some GNUnet peer
156 * is recorded. Note that we make no distinction between TCP and UDP ports
157 * and test if a port is already in use before assigning it to a peer/service.
158 * If we detect that a port is already in use, we also mark it in this bitmap.
159 * So all the bits that are zero merely indicate ports that MIGHT be available
160 * for peers.
161 */
162 uint32_t reserved_ports[65536 / 32];
163
164 /**
165 * Counter we use to make service home paths unique on this system;
166 * the full path consists of the tmppath and this number. Each
167 * UNIXPATH for a peer is also modified to include the respective
168 * path counter to ensure uniqueness. This field is incremented
169 * by one for each configured peer. Even if peers are destroyed,
170 * we never re-use path counters.
171 */
172 uint32_t path_counter;
173
174 /**
175 * The number of hostkeys
176 */
177 uint32_t total_hostkeys;
178
179 /**
180 * Lowest port we are allowed to use.
181 */
182 uint16_t lowport;
183
184 /**
185 * Highest port we are allowed to use.
186 */
187 uint16_t highport;
188};
189
190
191/**
192 * Handle for a GNUnet peer controlled by testing.
193 */
194struct GNUNET_TESTING_Peer
195{
196 /**
197 * The TESTING system associated with this peer
198 */
199 struct GNUNET_TESTING_System *system;
200
201 /**
202 * Path to the configuration file for this peer.
203 */
204 char *cfgfile;
205
206 /**
207 * Binary to be executed during 'GNUNET_TESTING_peer_start'.
208 * Typically 'gnunet-service-arm' (but can be set to a
209 * specific service by 'GNUNET_TESTING_service_run' if
210 * necessary).
211 */
212 char *main_binary;
213 char *args;
214
215 /**
216 * Handle to the running binary of the service, NULL if the
217 * peer/service is currently not running.
218 */
219 struct GNUNET_OS_Process *main_process;
220
221 /**
222 * The handle to the peer's ARM service
223 */
224 struct GNUNET_ARM_Handle *ah;
225
226 /**
227 * The config of the peer
228 */
229 struct GNUNET_CONFIGURATION_Handle *cfg;
230
231 /**
232 * The callback to call asynchronously when a peer is stopped
233 */
234 GNUNET_TESTING_PeerStopCallback cb;
235
236 /**
237 * The closure for the above callback
238 */
239 void *cb_cls;
240
241 /**
242 * The cached identity of this peer. Will be populated on call to
243 * GNUNET_TESTING_peer_get_identity()
244 */
245 struct GNUNET_PeerIdentity *id;
246
247 struct SharedServiceInstance **ss_instances;
248
249 /**
250 * Array of ports currently allocated to this peer. These ports will be
251 * released upon peer destroy and can be used by other peers which are
252 * configured after.
253 */
254 uint16_t *ports;
255
256 /**
257 * The number of ports in the above array
258 */
259 unsigned int nports;
260
261 /**
262 * The keynumber of this peer's hostkey
263 */
264 uint32_t key_number;
265};
266
267
268/**
269 * Testing includes a number of pre-created hostkeys for faster peer
270 * startup. This function loads such keys into memory from a file.
271 *
272 * @param system the testing system handle
273 * @return #GNUNET_OK on success; #GNUNET_SYSERR on error
274 */
275static enum GNUNET_GenericReturnValue
276hostkeys_load (struct GNUNET_TESTING_System *system)
277{
278 uint64_t fs;
279 char *data_dir;
280 char *filename;
281 struct GNUNET_DISK_FileHandle *fd;
282
283 GNUNET_assert (NULL == system->hostkeys_data);
284 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
285 GNUNET_asprintf (&filename, "%s/testing_hostkeys.ecc", data_dir);
286 GNUNET_free (data_dir);
287
288 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
289 {
290 LOG (GNUNET_ERROR_TYPE_ERROR,
291 _ ("Hostkeys file not found: %s\n"),
292 filename);
293 GNUNET_free (filename);
294 return GNUNET_SYSERR;
295 }
296 /* Check hostkey file size, read entire thing into memory */
297 if (GNUNET_OK !=
298 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
299 fs = 0;
300 if (0 == fs)
301 {
302 GNUNET_free (filename);
303 return GNUNET_SYSERR; /* File is empty */
304 }
305 if (0 != (fs % GNUNET_TESTING_HOSTKEYFILESIZE))
306 {
307 LOG (GNUNET_ERROR_TYPE_ERROR,
308 _ ("Incorrect hostkey file format: %s\n"),
309 filename);
310 GNUNET_free (filename);
311 return GNUNET_SYSERR;
312 }
313 fd = GNUNET_DISK_file_open (filename,
314 GNUNET_DISK_OPEN_READ,
315 GNUNET_DISK_PERM_NONE);
316 if (NULL == fd)
317 {
318 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename);
319 GNUNET_free (filename);
320 return GNUNET_SYSERR;
321 }
322 GNUNET_free (filename);
323 system->hostkeys_data =
324 GNUNET_DISK_file_map (fd, &system->map, GNUNET_DISK_MAP_TYPE_READ, fs);
325 GNUNET_DISK_file_close (fd);
326 if (NULL == system->hostkeys_data)
327 return GNUNET_SYSERR;
328 system->total_hostkeys = fs / GNUNET_TESTING_HOSTKEYFILESIZE;
329 return GNUNET_OK;
330}
331
332
333/**
334 * Function to remove the loaded hostkeys
335 *
336 * @param system the testing system handle
337 */
338static void
339hostkeys_unload (struct GNUNET_TESTING_System *system)
340{
341 GNUNET_break (NULL != system->hostkeys_data);
342 system->hostkeys_data = NULL;
343 GNUNET_DISK_file_unmap (system->map);
344 system->map = NULL;
345 system->hostkeys_data = NULL;
346 system->total_hostkeys = 0;
347}
348
349
350/**
351 * Function to iterate over options.
352 *
353 * @param cls closure
354 * @param section name of the section
355 * @param option name of the option
356 * @param value value of the option
357 */
358static void
359cfg_copy_iterator (void *cls,
360 const char *section,
361 const char *option,
362 const char *value)
363{
364 struct GNUNET_CONFIGURATION_Handle *cfg2 = cls;
365
366 GNUNET_CONFIGURATION_set_value_string (cfg2, section, option, value);
367}
368
369
370/**
371 * Create a system handle. There must only be one system
372 * handle per operating system.
373 *
374 * @param testdir only the directory name without any path. This is used for
375 * all service homes; the directory will be created in a temporary
376 * location depending on the underlying OS. This variable will be
377 * overridden with the value of the environmental variable
378 * GNUNET_TESTING_PREFIX, if it exists.
379 * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
380 * service configurations generated to allow control connections from
381 * this ip. This can either be a single ip address or a network address
382 * in CIDR notation.
383 * @param hostname the hostname of the system we are using for testing; NULL for
384 * localhost
385 * @param shared_services NULL terminated array describing services that are to
386 * be shared among peers
387 * @param lowport lowest port number this system is allowed to allocate (inclusive)
388 * @param highport highest port number this system is allowed to allocate (exclusive)
389 * @return handle to this system, NULL on error
390 */
391struct GNUNET_TESTING_System *
392GNUNET_TESTING_system_create_with_portrange (
393 const char *testdir,
394 const char *trusted_ip,
395 const char *hostname,
396 const struct GNUNET_TESTING_SharedService *shared_services,
397 uint16_t lowport,
398 uint16_t highport)
399{
400 struct GNUNET_TESTING_System *system;
401 struct GNUNET_TESTING_SharedService tss;
402 struct SharedService ss;
403 unsigned int cnt;
404
405 GNUNET_assert (NULL != testdir);
406 system = GNUNET_new (struct GNUNET_TESTING_System);
407 if (NULL == (system->tmppath = getenv (GNUNET_TESTING_PREFIX)))
408 system->tmppath = GNUNET_DISK_mkdtemp (testdir);
409 else
410 system->tmppath = GNUNET_strdup (system->tmppath);
411 system->lowport = lowport;
412 system->highport = highport;
413 if (NULL == system->tmppath)
414 {
415 GNUNET_free (system);
416 return NULL;
417 }
418 if (NULL != trusted_ip)
419 system->trusted_ip = GNUNET_strdup (trusted_ip);
420 if (NULL != hostname)
421 system->hostname = GNUNET_strdup (hostname);
422 if (GNUNET_OK != hostkeys_load (system))
423 {
424 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
425 return NULL;
426 }
427 if (NULL == shared_services)
428 return system;
429 for (cnt = 0; NULL != shared_services[cnt].service; cnt++)
430 {
431 tss = shared_services[cnt];
432 memset (&ss, 0, sizeof (ss));
433 ss.sname = GNUNET_strdup (tss.service);
434 ss.cfg = GNUNET_CONFIGURATION_create ();
435 GNUNET_CONFIGURATION_iterate_section_values (tss.cfg,
436 ss.sname,
437 &cfg_copy_iterator,
438 ss.cfg);
439 GNUNET_CONFIGURATION_iterate_section_values (tss.cfg,
440 "TESTING",
441 &cfg_copy_iterator,
442 ss.cfg);
443 GNUNET_CONFIGURATION_iterate_section_values (tss.cfg,
444 "PATHS",
445 &cfg_copy_iterator,
446 ss.cfg);
447 ss.share = tss.share;
448 GNUNET_array_append (system->shared_services,
449 system->n_shared_services,
450 ss);
451 }
452 return system;
453}
454
455
456/**
457 * Create a system handle. There must only be one system handle per operating
458 * system. Uses a default range for allowed ports. Ports are still tested for
459 * availability.
460 *
461 * @param testdir only the directory name without any path. This is used for all
462 * service homes; the directory will be created in a temporary location
463 * depending on the underlying OS. This variable will be
464 * overridden with the value of the environmental variable
465 * GNUNET_TESTING_PREFIX, if it exists.
466 * @param trusted_ip the ip address which will be set as TRUSTED HOST in all
467 * service configurations generated to allow control connections from
468 * this ip. This can either be a single ip address or a network address
469 * in CIDR notation.
470 * @param hostname the hostname of the system we are using for testing; NULL for
471 * localhost
472 * @param shared_services NULL terminated array describing services that are to
473 * be shared among peers
474 * @return handle to this system, NULL on error
475 */
476struct GNUNET_TESTING_System *
477GNUNET_TESTING_system_create (
478 const char *testdir,
479 const char *trusted_ip,
480 const char *hostname,
481 const struct GNUNET_TESTING_SharedService *shared_services)
482{
483 return GNUNET_TESTING_system_create_with_portrange (testdir,
484 trusted_ip,
485 hostname,
486 shared_services,
487 LOW_PORT,
488 HIGH_PORT);
489}
490
491
492static void
493cleanup_shared_service_instance (struct SharedServiceInstance *i)
494{
495 if (NULL != i->cfg_fn)
496 {
497 (void) unlink (i->cfg_fn);
498 GNUNET_free (i->cfg_fn);
499 }
500 GNUNET_free (i->unix_sock);
501 GNUNET_free (i->port_str);
502 GNUNET_break (NULL == i->proc);
503 GNUNET_break (0 == i->n_refs);
504 GNUNET_free (i);
505}
506
507
508static enum GNUNET_GenericReturnValue
509start_shared_service_instance (struct SharedServiceInstance *i)
510{
511 char *binary;
512 char *libexec_binary;
513
514 GNUNET_assert (NULL == i->proc);
515 GNUNET_assert (NULL != i->cfg_fn);
516 (void) GNUNET_asprintf (&binary, "gnunet-service-%s", i->ss->sname);
517 libexec_binary = GNUNET_OS_get_libexec_binary_path (binary);
518 GNUNET_free (binary);
519 i->proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
520 NULL,
521 NULL,
522 NULL,
523 libexec_binary,
524 libexec_binary,
525 "-c",
526 i->cfg_fn,
527 NULL);
528 GNUNET_free (libexec_binary);
529 if (NULL == i->proc)
530 return GNUNET_SYSERR;
531 return GNUNET_OK;
532}
533
534
535static void
536stop_shared_service_instance (struct SharedServiceInstance *i)
537{
538 GNUNET_break (0 == i->n_refs);
539 if (0 != GNUNET_OS_process_kill (i->proc, GNUNET_TERM_SIG))
540 LOG (GNUNET_ERROR_TYPE_WARNING,
541 "Killing shared service instance (%s) failed\n",
542 i->ss->sname);
543 (void) GNUNET_OS_process_wait (i->proc);
544 GNUNET_OS_process_destroy (i->proc);
545 i->proc = NULL;
546}
547
548
549/**
550 * Free system resources.
551 *
552 * @param system system to be freed
553 * @param remove_paths should the 'testdir' and all subdirectories
554 * be removed (clean up on shutdown)?
555 */
556void
557GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system,
558 int remove_paths)
559{
560 struct SharedService *ss;
561 struct SharedServiceInstance *i;
562 unsigned int ss_cnt;
563 unsigned int i_cnt;
564
565 if (NULL != system->hostkeys_data)
566 hostkeys_unload (system);
567 for (ss_cnt = 0; ss_cnt < system->n_shared_services; ss_cnt++)
568 {
569 ss = &system->shared_services[ss_cnt];
570 for (i_cnt = 0; i_cnt < ss->n_instances; i_cnt++)
571 {
572 i = ss->instances[i_cnt];
573 if (NULL != i->proc)
574 stop_shared_service_instance (i);
575 cleanup_shared_service_instance (i);
576 }
577 GNUNET_free (ss->instances);
578 GNUNET_CONFIGURATION_destroy (ss->cfg);
579 GNUNET_free (ss->sname);
580 }
581 GNUNET_free (system->shared_services);
582 if (GNUNET_YES == remove_paths)
583 GNUNET_DISK_directory_remove (system->tmppath);
584 GNUNET_free (system->tmppath);
585 GNUNET_free (system->trusted_ip);
586 GNUNET_free (system->hostname);
587 GNUNET_free (system);
588}
589
590
591/**
592 * Reserve a TCP or UDP port for a peer.
593 *
594 * @param system system to use for reservation tracking
595 * @return 0 if no free port was available
596 */
597uint16_t
598GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system)
599{
600 struct GNUNET_NETWORK_Handle *socket;
601 struct addrinfo hint;
602 struct addrinfo *ret;
603 struct addrinfo *ai;
604 uint32_t *port_buckets;
605 char *open_port_str;
606 int bind_status;
607 uint32_t xor_image;
608 uint16_t index;
609 uint16_t open_port;
610 uint16_t pos;
611
612 /*
613 FIXME: Instead of using getaddrinfo we should try to determine the port
614 status by the following heurestics.
615
616 On systems which support both IPv4 and IPv6, only ports open on both
617 address families are considered open.
618 On system with either IPv4 or IPv6. A port is considered open if it's
619 open in the respective address family
620 */hint.ai_family = AF_UNSPEC; /* IPv4 and IPv6 */
621 hint.ai_socktype = 0;
622 hint.ai_protocol = 0;
623 hint.ai_addrlen = 0;
624 hint.ai_addr = NULL;
625 hint.ai_canonname = NULL;
626 hint.ai_next = NULL;
627 hint.ai_flags = AI_PASSIVE | AI_NUMERICSERV; /* Wild card address */
628 port_buckets = system->reserved_ports;
629 for (index = (system->lowport / 32) + 1; index < (system->highport / 32);
630 index++)
631 {
632 xor_image = (UINT32_MAX ^ port_buckets[index]);
633 if (0 == xor_image) /* Ports in the bucket are full */
634 continue;
635 pos = system->lowport % 32;
636 while (pos < 32)
637 {
638 if (0 == ((xor_image >> pos) & 1U))
639 {
640 pos++;
641 continue;
642 }
643 open_port = (index * 32) + pos;
644 if (open_port >= system->highport)
645 return 0;
646 GNUNET_asprintf (&open_port_str, "%u", (unsigned int) open_port);
647 ret = NULL;
648 GNUNET_assert (0 == getaddrinfo (NULL, open_port_str, &hint, &ret));
649 GNUNET_free (open_port_str);
650 bind_status = GNUNET_NO;
651 for (ai = ret; NULL != ai; ai = ai->ai_next)
652 {
653 socket = GNUNET_NETWORK_socket_create (ai->ai_family, SOCK_STREAM, 0);
654 if (NULL == socket)
655 continue;
656 bind_status =
657 GNUNET_NETWORK_socket_bind (socket, ai->ai_addr, ai->ai_addrlen);
658 GNUNET_NETWORK_socket_close (socket);
659 if (GNUNET_OK != bind_status)
660 break;
661 socket = GNUNET_NETWORK_socket_create (ai->ai_family, SOCK_DGRAM, 0);
662 if (NULL == socket)
663 continue;
664 bind_status =
665 GNUNET_NETWORK_socket_bind (socket, ai->ai_addr, ai->ai_addrlen);
666 GNUNET_NETWORK_socket_close (socket);
667 if (GNUNET_OK != bind_status)
668 break;
669 }
670 port_buckets[index] |= (1U << pos); /* Set the port bit */
671 freeaddrinfo (ret);
672 if (GNUNET_OK == bind_status)
673 {
674 LOG (GNUNET_ERROR_TYPE_DEBUG,
675 "Found a free port %u\n",
676 (unsigned int) open_port);
677 return open_port;
678 }
679 pos++;
680 }
681 }
682 return 0;
683}
684
685
686/**
687 * Release reservation of a TCP or UDP port for a peer
688 * (used during #GNUNET_TESTING_peer_destroy()).
689 *
690 * @param system system to use for reservation tracking
691 * @param port reserved port to release
692 */
693void
694GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system,
695 uint16_t port)
696{
697 uint32_t *port_buckets;
698 uint16_t bucket;
699 uint16_t pos;
700
701 port_buckets = system->reserved_ports;
702 bucket = port / 32;
703 pos = port % 32;
704 LOG (GNUNET_ERROR_TYPE_DEBUG, "Releasing port %u\n", port);
705 if (0 == (port_buckets[bucket] & (1U << pos)))
706 {
707 GNUNET_break (0); /* Port was not reserved by us using reserve_port() */
708 return;
709 }
710 port_buckets[bucket] &= ~(1U << pos);
711}
712
713
714/**
715 * Testing includes a number of pre-created hostkeys for
716 * faster peer startup. This function can be used to
717 * access the n-th key of those pre-created hostkeys; note
718 * that these keys are ONLY useful for testing and not
719 * secure as the private keys are part of the public
720 * GNUnet source code.
721 *
722 * This is primarily a helper function used internally
723 * by #GNUNET_TESTING_peer_configure.
724 *
725 * @param system the testing system handle
726 * @param key_number desired pre-created hostkey to obtain
727 * @param id set to the peer's identity (hash of the public
728 * key; if NULL, NULL is returned immediately
729 * @return NULL on error (not enough keys)
730 */
731struct GNUNET_CRYPTO_EddsaPrivateKey *
732GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system,
733 uint32_t key_number,
734 struct GNUNET_PeerIdentity *id)
735{
736 struct GNUNET_CRYPTO_EddsaPrivateKey *private_key;
737
738 if ((NULL == id) || (NULL == system->hostkeys_data))
739 return NULL;
740 if (key_number >= system->total_hostkeys)
741 {
742 LOG (GNUNET_ERROR_TYPE_ERROR,
743 _ ("Key number %u does not exist\n"),
744 key_number);
745 return NULL;
746 }
747 private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey);
748 GNUNET_memcpy (private_key,
749 system->hostkeys_data
750 + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
751 GNUNET_TESTING_HOSTKEYFILESIZE);
752 GNUNET_CRYPTO_eddsa_key_get_public (private_key, &id->public_key);
753 return private_key;
754}
755
756
757/**
758 * Structure for holding data to build new configurations from a configuration
759 * template
760 */
761struct UpdateContext
762{
763 /**
764 * The system for which we are building configurations
765 */
766 struct GNUNET_TESTING_System *system;
767
768 /**
769 * The configuration we are building
770 */
771 struct GNUNET_CONFIGURATION_Handle *cfg;
772
773 /**
774 * The customized service home path for this peer
775 */
776 char *gnunet_home;
777
778 /**
779 * Array of ports currently allocated to this peer. These ports will be
780 * released upon peer destroy and can be used by other peers which are
781 * configured after.
782 */
783 uint16_t *ports;
784
785 /**
786 * The number of ports in the above array
787 */
788 unsigned int nports;
789
790 /**
791 * build status - to signal error while building a configuration
792 */
793 int status;
794};
795
796
797/**
798 * Function to iterate over options. Copies
799 * the options to the target configuration,
800 * updating PORT values as needed.
801 *
802 * @param cls the UpdateContext
803 * @param section name of the section
804 * @param option name of the option
805 * @param value value of the option
806 */
807static void
808update_config (void *cls,
809 const char *section,
810 const char *option,
811 const char *value)
812{
813 struct UpdateContext *uc = cls;
814 unsigned int ival;
815 char cval[12];
816 char uval[PATH_MAX];
817 char *single_variable;
818 char *per_host_variable;
819 unsigned long long num_per_host;
820 uint16_t new_port;
821
822 if (GNUNET_OK != uc->status)
823 return;
824 if (! ((0 == strcmp (option, "PORT")) || (0 == strcmp (option, "UNIXPATH")) ||
825 (0 == strcmp (option, "HOSTNAME"))))
826 return;
827 GNUNET_asprintf (&single_variable, "single_%s_per_host", section);
828 GNUNET_asprintf (&per_host_variable, "num_%s_per_host", section);
829 if ((0 == strcmp (option, "PORT")) && (1 == sscanf (value, "%u", &ival)))
830 {
831 if ((ival != 0) &&
832 (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno (uc->cfg,
833 "testing",
834 single_variable)))
835 {
836 new_port = GNUNET_TESTING_reserve_port (uc->system);
837 if (0 == new_port)
838 {
839 uc->status = GNUNET_SYSERR;
840 GNUNET_free (single_variable);
841 GNUNET_free (per_host_variable);
842 return;
843 }
844 GNUNET_snprintf (cval, sizeof(cval), "%u", new_port);
845 value = cval;
846 GNUNET_array_append (uc->ports, uc->nports, new_port);
847 }
848 else if ((ival != 0) &&
849 (GNUNET_YES ==
850 GNUNET_CONFIGURATION_get_value_yesno (uc->cfg,
851 "testing",
852 single_variable)) &&
853 GNUNET_CONFIGURATION_get_value_number (uc->cfg,
854 "testing",
855 per_host_variable,
856 &num_per_host))
857 {
858 /* GNUNET_snprintf (cval, sizeof (cval), "%u", */
859 /* ival + ctx->fdnum % num_per_host); */
860 /* value = cval; */
861 GNUNET_break (0); /* FIXME */
862 }
863 }
864 if (0 == strcmp (option, "UNIXPATH"))
865 {
866 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_yesno (uc->cfg,
867 "testing",
868 single_variable))
869 {
870 GNUNET_snprintf (uval,
871 sizeof(uval),
872 "%s/%s.sock",
873 uc->gnunet_home,
874 section);
875 value = uval;
876 }
877 else if ((GNUNET_YES ==
878 GNUNET_CONFIGURATION_get_value_number (uc->cfg,
879 "testing",
880 per_host_variable,
881 &num_per_host)) &&
882 (num_per_host > 0))
883 {
884 GNUNET_break (0); /* FIXME */
885 }
886 }
887 if (0 == strcmp (option, "HOSTNAME"))
888 {
889 value = (NULL == uc->system->hostname) ? "localhost" : uc->system->hostname;
890 }
891 GNUNET_free (single_variable);
892 GNUNET_free (per_host_variable);
893 GNUNET_CONFIGURATION_set_value_string (uc->cfg, section, option, value);
894}
895
896
897/**
898 * Section iterator to set ACCEPT_FROM/ACCEPT_FROM6 to include the address of
899 * 'trusted_hosts' in all sections
900 *
901 * @param cls the UpdateContext
902 * @param section name of the section
903 */
904static void
905update_config_sections (void *cls, const char *section)
906{
907 struct UpdateContext *uc = cls;
908 char **ikeys;
909 char *val;
910 char *ptr;
911 char *orig_allowed_hosts;
912 char *allowed_hosts;
913 char *ACCEPT_FROM_key;
914 uint16_t ikeys_cnt;
915 uint16_t key;
916
917 ikeys_cnt = 0;
918 val = NULL;
919 /* Ignore certain options from sections. See
920 https://gnunet.org/bugs/view.php?id=2476 */
921 if (GNUNET_YES ==
922 GNUNET_CONFIGURATION_have_value (uc->cfg, section, "TESTING_IGNORE_KEYS"))
923 {
924 GNUNET_assert (GNUNET_YES ==
925 GNUNET_CONFIGURATION_get_value_string (uc->cfg,
926 section,
927 "TESTING_IGNORE_KEYS",
928 &val));
929 ptr = val;
930 for (ikeys_cnt = 0; NULL != (ptr = strstr (ptr, ";")); ikeys_cnt++)
931 ptr++;
932 if (0 == ikeys_cnt)
933 GNUNET_break (0);
934 else
935 {
936 ikeys = GNUNET_malloc ((sizeof(char *)) * ikeys_cnt);
937 ptr = val;
938 for (key = 0; key < ikeys_cnt; key++)
939 {
940 ikeys[key] = ptr;
941 ptr = strstr (ptr, ";");
942 GNUNET_assert (NULL != ptr); /* worked just before... */
943 *ptr = '\0';
944 ptr++;
945 }
946 }
947 }
948 if (0 != ikeys_cnt)
949 {
950 for (key = 0; key < ikeys_cnt; key++)
951 {
952 if (NULL != strstr (ikeys[key], "ADVERTISED_PORT"))
953 break;
954 }
955 if ((key == ikeys_cnt) &&
956 (GNUNET_YES ==
957 GNUNET_CONFIGURATION_have_value (uc->cfg, section, "ADVERTISED_PORT")))
958 {
959 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (uc->cfg,
960 section,
961 "PORT",
962 &ptr))
963 {
964 GNUNET_CONFIGURATION_set_value_string (uc->cfg,
965 section,
966 "ADVERTISED_PORT",
967 ptr);
968 GNUNET_free (ptr);
969 }
970 }
971 for (key = 0; key < ikeys_cnt; key++)
972 {
973 if (NULL != strstr (ikeys[key], "ACCEPT_FROM"))
974 {
975 GNUNET_free (ikeys);
976 GNUNET_free (val);
977 return;
978 }
979 }
980 GNUNET_free (ikeys);
981 }
982 GNUNET_free (val);
983 ACCEPT_FROM_key = "ACCEPT_FROM";
984 if ((NULL != uc->system->trusted_ip) &&
985 (NULL != strstr (uc->system->trusted_ip, ":"))) /* IPv6 in use */
986 ACCEPT_FROM_key = "ACCEPT_FROM6";
987 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (uc->cfg,
988 section,
989 ACCEPT_FROM_key,
990 &orig_allowed_hosts))
991 {
992 orig_allowed_hosts = GNUNET_strdup ("127.0.0.1;");
993 }
994 if (NULL == uc->system->trusted_ip)
995 allowed_hosts = GNUNET_strdup (orig_allowed_hosts);
996 else
997 GNUNET_asprintf (&allowed_hosts,
998 "%s%s;",
999 orig_allowed_hosts,
1000 uc->system->trusted_ip);
1001 GNUNET_free (orig_allowed_hosts);
1002 GNUNET_CONFIGURATION_set_value_string (uc->cfg,
1003 section,
1004 ACCEPT_FROM_key,
1005 allowed_hosts);
1006 GNUNET_free (allowed_hosts);
1007}
1008
1009
1010static struct SharedServiceInstance *
1011associate_shared_service (struct GNUNET_TESTING_System *system,
1012 struct SharedService *ss,
1013 struct GNUNET_CONFIGURATION_Handle *cfg)
1014{
1015 struct SharedServiceInstance *i;
1016 struct GNUNET_CONFIGURATION_Handle *temp;
1017 char *gnunet_home;
1018 uint32_t port;
1019
1020 ss->n_peers++;
1021 if (((0 == ss->share) && (NULL == ss->instances)) ||
1022 ((0 != ss->share) &&
1023 (ss->n_instances < ((ss->n_peers + ss->share - 1) / ss->share))))
1024 {
1025 i = GNUNET_new (struct SharedServiceInstance);
1026 i->ss = ss;
1027 (void) GNUNET_asprintf (&gnunet_home,
1028 "%s/shared/%s/%u",
1029 system->tmppath,
1030 ss->sname,
1031 ss->n_instances);
1032 (void) GNUNET_asprintf (&i->unix_sock, "%s/sock", gnunet_home);
1033 port = GNUNET_TESTING_reserve_port (system);
1034 if (0 == port)
1035 {
1036 GNUNET_free (gnunet_home);
1037 cleanup_shared_service_instance (i);
1038 return NULL;
1039 }
1040 GNUNET_array_append (ss->instances, ss->n_instances, i);
1041 temp = GNUNET_CONFIGURATION_dup (ss->cfg);
1042 (void) GNUNET_asprintf (&i->port_str, "%u", port);
1043 (void) GNUNET_asprintf (&i->cfg_fn, "%s/config", gnunet_home);
1044 GNUNET_CONFIGURATION_set_value_string (temp,
1045 "PATHS",
1046 "GNUNET_HOME",
1047 gnunet_home);
1048 GNUNET_free (gnunet_home);
1049 GNUNET_CONFIGURATION_set_value_string (temp,
1050 ss->sname,
1051 "UNIXPATH",
1052 i->unix_sock);
1053 GNUNET_CONFIGURATION_set_value_string (temp,
1054 ss->sname,
1055 "PORT",
1056 i->port_str);
1057 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_write (temp, i->cfg_fn))
1058 {
1059 GNUNET_CONFIGURATION_destroy (temp);
1060 cleanup_shared_service_instance (i);
1061 return NULL;
1062 }
1063 GNUNET_CONFIGURATION_destroy (temp);
1064 }
1065 else
1066 {
1067 GNUNET_assert (NULL != ss->instances);
1068 GNUNET_assert (0 < ss->n_instances);
1069 i = ss->instances[ss->n_instances - 1];
1070 }
1071 GNUNET_CONFIGURATION_iterate_section_values (ss->cfg,
1072 ss->sname,
1073 &cfg_copy_iterator,
1074 cfg);
1075 GNUNET_CONFIGURATION_set_value_string (cfg,
1076 ss->sname,
1077 "UNIXPATH",
1078 i->unix_sock);
1079 GNUNET_CONFIGURATION_set_value_string (cfg, ss->sname, "PORT", i->port_str);
1080 return i;
1081}
1082
1083
1084/**
1085 * Create a new configuration using the given configuration as a template;
1086 * ports and paths will be modified to select available ports on the local
1087 * system. The default configuration will be available in PATHS section under
1088 * the option DEFAULTCONFIG after the call. GNUNET_HOME is also set in PATHS
1089 * section to the temporary directory specific to this configuration. If we run
1090 * out of "*port" numbers, return #GNUNET_SYSERR.
1091 *
1092 * This is primarily a helper function used internally
1093 * by 'GNUNET_TESTING_peer_configure'.
1094 *
1095 * @param system system to use to coordinate resource usage
1096 * @param cfg template configuration to update
1097 * @param ports array with port numbers used in the created configuration.
1098 * Will be updated upon successful return. Can be NULL
1099 * @param nports the size of the `ports' array. Will be updated.
1100 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error - the configuration will
1101 * be incomplete and should not be used there upon
1102 */
1103static int
1104GNUNET_TESTING_configuration_create_ (struct GNUNET_TESTING_System *system,
1105 struct GNUNET_CONFIGURATION_Handle *cfg,
1106 uint16_t **ports,
1107 unsigned int *nports)
1108{
1109 struct UpdateContext uc;
1110 char *default_config;
1111
1112 uc.system = system;
1113 uc.cfg = cfg;
1114 uc.status = GNUNET_OK;
1115 uc.ports = NULL;
1116 uc.nports = 0;
1117 GNUNET_asprintf (&uc.gnunet_home,
1118 "%s/%u",
1119 system->tmppath,
1120 system->path_counter++);
1121 GNUNET_asprintf (&default_config, "%s/config", uc.gnunet_home);
1122 GNUNET_CONFIGURATION_set_value_string (cfg,
1123 "PATHS",
1124 "DEFAULTCONFIG",
1125 default_config);
1126 GNUNET_CONFIGURATION_set_value_string (cfg, "arm", "CONFIG", default_config);
1127 GNUNET_free (default_config);
1128 GNUNET_CONFIGURATION_set_value_string (cfg,
1129 "PATHS",
1130 "GNUNET_HOME",
1131 uc.gnunet_home);
1132 /* make PORTs and UNIXPATHs unique */
1133 GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc);
1134 /* allow connections to services from system trusted_ip host */
1135 GNUNET_CONFIGURATION_iterate_sections (cfg, &update_config_sections, &uc);
1136 /* enable loopback-based connections between peers */
1137 GNUNET_CONFIGURATION_set_value_string (cfg, "nat", "USE_LOCALADDR", "YES");
1138 GNUNET_free (uc.gnunet_home);
1139 if ((NULL != ports) && (NULL != nports))
1140 {
1141 *ports = uc.ports;
1142 *nports = uc.nports;
1143 }
1144 else
1145 GNUNET_free (uc.ports);
1146 return uc.status;
1147}
1148
1149
1150/**
1151 * Create a new configuration using the given configuration as a template;
1152 * ports and paths will be modified to select available ports on the local
1153 * system. The default configuration will be available in PATHS section under
1154 * the option DEFAULTCONFIG after the call. GNUNET_HOME is also set in PATHS
1155 * section to the temporary directory specific to this configuration. If we run
1156 * out of "*port" numbers, return #GNUNET_SYSERR.
1157 *
1158 * This is primarily a helper function used internally
1159 * by #GNUNET_TESTING_peer_configure().
1160 *
1161 * @param system system to use to coordinate resource usage
1162 * @param cfg template configuration to update
1163 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error - the configuration will
1164 * be incomplete and should not be used there upon
1165 */
1166int
1167GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system,
1168 struct GNUNET_CONFIGURATION_Handle *cfg)
1169{
1170 return GNUNET_TESTING_configuration_create_ (system, cfg, NULL, NULL);
1171}
1172
1173
1174/**
1175 * Configure a GNUnet peer. GNUnet must be installed on the local
1176 * system and available in the PATH.
1177 *
1178 * @param system system to use to coordinate resource usage
1179 * @param cfg configuration to use; will be UPDATED (to reflect needed
1180 * changes in port numbers and paths)
1181 * @param key_number number of the hostkey to use for the peer
1182 * @param id identifier for the daemon, will be set, can be NULL
1183 * @param emsg set to freshly allocated error message (set to NULL on success),
1184 * can be NULL
1185 * @return handle to the peer, NULL on error
1186 */
1187struct GNUNET_TESTING_Peer *
1188GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system,
1189 struct GNUNET_CONFIGURATION_Handle *cfg,
1190 uint32_t key_number,
1191 struct GNUNET_PeerIdentity *id,
1192 char **emsg)
1193{
1194 struct GNUNET_TESTING_Peer *peer;
1195 struct GNUNET_DISK_FileHandle *fd;
1196 char *hostkey_filename;
1197 char *config_filename;
1198 char *libexec_binary;
1199 char *emsg_;
1200 struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
1201 uint16_t *ports;
1202 struct SharedService *ss;
1203 struct SharedServiceInstance **ss_instances;
1204 unsigned int cnt;
1205 unsigned int nports;
1206
1207 ports = NULL;
1208 nports = 0;
1209 ss_instances = NULL;
1210 if (NULL != emsg)
1211 *emsg = NULL;
1212 if (key_number >= system->total_hostkeys)
1213 {
1214 GNUNET_asprintf (
1215 &emsg_,
1216 _ (
1217 "You attempted to create a testbed with more than %u hosts. Please precompute more hostkeys first.\n"),
1218 (unsigned int) system->total_hostkeys);
1219 goto err_ret;
1220 }
1221 pk = NULL;
1222 if ((NULL != id) &&
1223 (NULL == (pk = GNUNET_TESTING_hostkey_get (system, key_number, id))))
1224 {
1225 GNUNET_asprintf (&emsg_,
1226 _ ("Failed to initialize hostkey for peer %u\n"),
1227 (unsigned int) key_number);
1228 goto err_ret;
1229 }
1230 if (NULL != pk)
1231 GNUNET_free (pk);
1232 if (GNUNET_NO == GNUNET_CONFIGURATION_have_value (cfg, "PEER", "PRIVATE_KEY"))
1233 {
1234 GNUNET_asprintf (
1235 &emsg_,
1236 _ ("PRIVATE_KEY option in PEER section missing in configuration\n"));
1237 goto err_ret;
1238 }
1239 /* Remove sections for shared services */
1240 for (cnt = 0; cnt < system->n_shared_services; cnt++)
1241 {
1242 ss = &system->shared_services[cnt];
1243 GNUNET_CONFIGURATION_remove_section (cfg, ss->sname);
1244 }
1245 if (GNUNET_OK !=
1246 GNUNET_TESTING_configuration_create_ (system, cfg, &ports, &nports))
1247 {
1248 GNUNET_asprintf (&emsg_,
1249 _ ("Failed to create configuration for peer "
1250 "(not enough free ports?)\n"));
1251 goto err_ret;
1252 }
1253 GNUNET_assert (GNUNET_OK ==
1254 GNUNET_CONFIGURATION_get_value_filename (cfg,
1255 "PEER",
1256 "PRIVATE_KEY",
1257 &hostkey_filename));
1258 fd = GNUNET_DISK_file_open (hostkey_filename,
1259 GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE,
1260 GNUNET_DISK_PERM_USER_READ
1261 | GNUNET_DISK_PERM_USER_WRITE);
1262 if (NULL == fd)
1263 {
1264 GNUNET_asprintf (&emsg_,
1265 _ ("Cannot open hostkey file `%s': %s\n"),
1266 hostkey_filename,
1267 strerror (errno));
1268 GNUNET_free (hostkey_filename);
1269 goto err_ret;
1270 }
1271 GNUNET_free (hostkey_filename);
1272 if (GNUNET_TESTING_HOSTKEYFILESIZE !=
1273 GNUNET_DISK_file_write (fd,
1274 system->hostkeys_data
1275 + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE),
1276 GNUNET_TESTING_HOSTKEYFILESIZE))
1277 {
1278 GNUNET_asprintf (&emsg_,
1279 _ ("Failed to write hostkey file for peer %u: %s\n"),
1280 (unsigned int) key_number,
1281 strerror (errno));
1282 GNUNET_DISK_file_close (fd);
1283 goto err_ret;
1284 }
1285 GNUNET_DISK_file_close (fd);
1286 ss_instances = GNUNET_new_array (system->n_shared_services,
1287 struct SharedServiceInstance*);
1288 for (cnt = 0; cnt < system->n_shared_services; cnt++)
1289 {
1290 ss = &system->shared_services[cnt];
1291 ss_instances[cnt] = associate_shared_service (system, ss, cfg);
1292 if (NULL == ss_instances[cnt])
1293 {
1294 emsg_ = GNUNET_strdup ("FIXME");
1295 goto err_ret;
1296 }
1297 }
1298 GNUNET_assert (GNUNET_OK ==
1299 GNUNET_CONFIGURATION_get_value_filename (cfg,
1300 "PATHS",
1301 "DEFAULTCONFIG",
1302 &config_filename));
1303 if (GNUNET_OK != GNUNET_CONFIGURATION_write (cfg, config_filename))
1304 {
1305 GNUNET_asprintf (&emsg_,
1306 _ (
1307 "Failed to write configuration file `%s' for peer %u: %s\n"),
1308 config_filename,
1309 (unsigned int) key_number,
1310 strerror (errno));
1311 GNUNET_free (config_filename);
1312 goto err_ret;
1313 }
1314 peer = GNUNET_new (struct GNUNET_TESTING_Peer);
1315 peer->ss_instances = ss_instances;
1316 peer->cfgfile = config_filename; /* Free in peer_destroy */
1317 peer->cfg = GNUNET_CONFIGURATION_dup (cfg);
1318 libexec_binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
1319 if (GNUNET_SYSERR ==
1320 GNUNET_CONFIGURATION_get_value_string (cfg,
1321 "arm",
1322 "PREFIX",
1323 &peer->main_binary))
1324 {
1325 /* No prefix */
1326 GNUNET_asprintf (&peer->main_binary, "%s", libexec_binary);
1327 peer->args = GNUNET_strdup ("");
1328 }
1329 else
1330 {
1331 peer->args = GNUNET_strdup (libexec_binary);
1332 }
1333 peer->system = system;
1334 peer->key_number = key_number;
1335 GNUNET_free (libexec_binary);
1336 peer->ports = ports; /* Free in peer_destroy */
1337 peer->nports = nports;
1338 return peer;
1339
1340err_ret:
1341 GNUNET_free (ss_instances);
1342 GNUNET_free (ports);
1343 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s", emsg_);
1344 if (NULL != emsg)
1345 *emsg = emsg_;
1346 else
1347 GNUNET_free (emsg_);
1348 return NULL;
1349}
1350
1351
1352/**
1353 * Obtain the peer identity from a peer handle.
1354 *
1355 * @param peer peer handle for which we want the peer's identity
1356 * @param id identifier for the daemon, will be set
1357 */
1358void
1359GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer,
1360 struct GNUNET_PeerIdentity *id)
1361{
1362 if (NULL != peer->id)
1363 {
1364 GNUNET_memcpy (id, peer->id, sizeof(struct GNUNET_PeerIdentity));
1365 return;
1366 }
1367 peer->id = GNUNET_new (struct GNUNET_PeerIdentity);
1368 GNUNET_free_nz (
1369 GNUNET_TESTING_hostkey_get (peer->system, peer->key_number, peer->id));
1370 GNUNET_memcpy (id, peer->id, sizeof(struct GNUNET_PeerIdentity));
1371}
1372
1373
1374/**
1375 * Start the peer.
1376 *
1377 * @param peer peer to start
1378 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (i.e. peer already running)
1379 */
1380int
1381GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer)
1382{
1383 struct SharedServiceInstance *i;
1384 unsigned int cnt;
1385
1386 if (NULL != peer->main_process)
1387 {
1388 GNUNET_break (0);
1389 return GNUNET_SYSERR;
1390 }
1391 GNUNET_assert (NULL != peer->cfgfile);
1392 for (cnt = 0; cnt < peer->system->n_shared_services; cnt++)
1393 {
1394 i = peer->ss_instances[cnt];
1395 if ((0 == i->n_refs) &&
1396 (GNUNET_SYSERR == start_shared_service_instance (i)))
1397 return GNUNET_SYSERR;
1398 i->n_refs++;
1399 }
1400 peer->main_binary =
1401 GNUNET_CONFIGURATION_expand_dollar (peer->cfg, peer->main_binary);
1402 peer->main_process =
1403 GNUNET_OS_start_process_s (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
1404 NULL,
1405 peer->main_binary,
1406 peer->args,
1407 "-c",
1408 peer->cfgfile,
1409 NULL);
1410 if (NULL == peer->main_process)
1411 {
1412 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1413 _ ("Failed to start `%s': %s\n"),
1414 peer->main_binary,
1415 strerror (errno));
1416 return GNUNET_SYSERR;
1417 }
1418 return GNUNET_OK;
1419}
1420
1421
1422/**
1423 * Sends SIGTERM to the peer's main process
1424 *
1425 * @param peer the handle to the peer
1426 * @return #GNUNET_OK if successful; #GNUNET_SYSERR if the main process is NULL
1427 * or upon any error while sending SIGTERM
1428 */
1429int
1430GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer *peer)
1431{
1432 struct SharedServiceInstance *i;
1433 unsigned int cnt;
1434
1435 if (NULL == peer->main_process)
1436 {
1437 GNUNET_break (0);
1438 return GNUNET_SYSERR;
1439 }
1440 if (0 != GNUNET_OS_process_kill (peer->main_process, GNUNET_TERM_SIG))
1441 return GNUNET_SYSERR;
1442 for (cnt = 0; cnt < peer->system->n_shared_services; cnt++)
1443 {
1444 i = peer->ss_instances[cnt];
1445 GNUNET_assert (0 != i->n_refs);
1446 i->n_refs--;
1447 if (0 == i->n_refs)
1448 stop_shared_service_instance (i);
1449 }
1450 return GNUNET_OK;
1451}
1452
1453
1454/**
1455 * Waits for a peer to terminate. The peer's main process will also be destroyed.
1456 *
1457 * @param peer the handle to the peer
1458 * @return #GNUNET_OK if successful; #GNUNET_SYSERR if the main process is NULL
1459 * or upon any error while waiting
1460 */
1461int
1462GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer)
1463{
1464 int ret;
1465
1466 if (NULL == peer->main_process)
1467 {
1468 GNUNET_break (0);
1469 return GNUNET_SYSERR;
1470 }
1471 ret = GNUNET_OS_process_wait (peer->main_process);
1472 GNUNET_OS_process_destroy (peer->main_process);
1473 peer->main_process = NULL;
1474 return ret;
1475}
1476
1477
1478/**
1479 * Stop the peer.
1480 *
1481 * @param peer peer to stop
1482 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
1483 */
1484int
1485GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer)
1486{
1487 if (GNUNET_SYSERR == GNUNET_TESTING_peer_kill (peer))
1488 return GNUNET_SYSERR;
1489 if (GNUNET_SYSERR == GNUNET_TESTING_peer_wait (peer))
1490 return GNUNET_SYSERR;
1491 return GNUNET_OK;
1492}
1493
1494
1495/**
1496 * Function called whenever we connect to or disconnect from ARM.
1497 *
1498 * @param cls closure
1499 * @param connected #GNUNET_YES if connected, #GNUNET_NO if disconnected,
1500 * #GNUNET_SYSERR on error.
1501 */
1502static void
1503disconn_status (void *cls, int connected)
1504{
1505 struct GNUNET_TESTING_Peer *peer = cls;
1506
1507 if (GNUNET_SYSERR == connected)
1508 {
1509 peer->cb (peer->cb_cls, peer, connected);
1510 return;
1511 }
1512 if (GNUNET_YES == connected)
1513 {
1514 GNUNET_break (GNUNET_OK == GNUNET_TESTING_peer_kill (peer));
1515 return;
1516 }
1517 GNUNET_break (GNUNET_OK == GNUNET_TESTING_peer_wait (peer));
1518 GNUNET_ARM_disconnect (peer->ah);
1519 peer->ah = NULL;
1520 peer->cb (peer->cb_cls, peer, GNUNET_YES);
1521}
1522
1523
1524int
1525GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer,
1526 GNUNET_TESTING_PeerStopCallback cb,
1527 void *cb_cls)
1528{
1529 if (NULL == peer->main_process)
1530 return GNUNET_SYSERR;
1531 peer->ah = GNUNET_ARM_connect (peer->cfg, &disconn_status, peer);
1532 if (NULL == peer->ah)
1533 return GNUNET_SYSERR;
1534 peer->cb = cb;
1535 peer->cb_cls = cb_cls;
1536 return GNUNET_OK;
1537}
1538
1539
1540/**
1541 * Cancel a previous asynchronous peer stop request.
1542 * GNUNET_TESTING_peer_stop_async() should have been called before on the given
1543 * peer. It is an error to call this function if the peer stop callback was
1544 * already called
1545 *
1546 * @param peer the peer on which GNUNET_TESTING_peer_stop_async() was called
1547 * before.
1548 */
1549void
1550GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer)
1551{
1552 GNUNET_assert (NULL != peer->ah);
1553 GNUNET_ARM_disconnect (peer->ah);
1554 peer->ah = NULL;
1555}
1556
1557
1558/**
1559 * Destroy the peer. Releases resources locked during peer configuration.
1560 * If the peer is still running, it will be stopped AND a warning will be
1561 * printed (users of the API should stop the peer explicitly first).
1562 *
1563 * @param peer peer to destroy
1564 */
1565void
1566GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer)
1567{
1568 unsigned int cnt;
1569
1570 if (NULL != peer->main_process)
1571 GNUNET_TESTING_peer_stop (peer);
1572 if (NULL != peer->ah)
1573 GNUNET_ARM_disconnect (peer->ah);
1574 GNUNET_free (peer->cfgfile);
1575 if (NULL != peer->cfg)
1576 GNUNET_CONFIGURATION_destroy (peer->cfg);
1577 GNUNET_free (peer->main_binary);
1578 GNUNET_free (peer->args);
1579 GNUNET_free (peer->id);
1580 GNUNET_free (peer->ss_instances);
1581 if (NULL != peer->ports)
1582 {
1583 for (cnt = 0; cnt < peer->nports; cnt++)
1584 GNUNET_TESTING_release_port (peer->system, peer->ports[cnt]);
1585 GNUNET_free (peer->ports);
1586 }
1587 GNUNET_free (peer);
1588}
1589
1590
1591int
1592GNUNET_TESTING_peer_run (const char *testdir,
1593 const char *cfgfilename,
1594 GNUNET_TESTING_TestMain tm,
1595 void *tm_cls)
1596{
1597 return GNUNET_TESTING_service_run (testdir, "arm", cfgfilename, tm, tm_cls);
1598}
1599
1600
1601/**
1602 * Structure for holding service data
1603 */
1604struct ServiceContext
1605{
1606 /**
1607 * The configuration of the peer in which the service is run
1608 */
1609 const struct GNUNET_CONFIGURATION_Handle *cfg;
1610
1611 /**
1612 * Callback to signal service startup
1613 */
1614 GNUNET_TESTING_TestMain tm;
1615
1616 /**
1617 * The peer in which the service is run.
1618 */
1619 struct GNUNET_TESTING_Peer *peer;
1620
1621 /**
1622 * Closure for the above callback
1623 */
1624 void *tm_cls;
1625};
1626
1627
1628/**
1629 * Callback to be called when SCHEDULER has been started
1630 *
1631 * @param cls the ServiceContext
1632 */
1633static void
1634service_run_main (void *cls)
1635{
1636 struct ServiceContext *sc = cls;
1637
1638 sc->tm (sc->tm_cls, sc->cfg, sc->peer);
1639}
1640
1641
1642int
1643GNUNET_TESTING_service_run (const char *testdir,
1644 const char *service_name,
1645 const char *cfgfilename,
1646 GNUNET_TESTING_TestMain tm,
1647 void *tm_cls)
1648{
1649 struct ServiceContext sc;
1650 struct GNUNET_TESTING_System *system;
1651 struct GNUNET_TESTING_Peer *peer;
1652 struct GNUNET_CONFIGURATION_Handle *cfg;
1653 char *binary;
1654 char *libexec_binary;
1655
1656 GNUNET_log_setup (testdir, "WARNING", NULL);
1657 system = GNUNET_TESTING_system_create (testdir, "127.0.0.1", NULL, NULL);
1658 if (NULL == system)
1659 return 1;
1660 cfg = GNUNET_CONFIGURATION_create ();
1661 if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfgfilename))
1662 {
1663 LOG (GNUNET_ERROR_TYPE_ERROR,
1664 _ ("Failed to load configuration from %s\n"),
1665 cfgfilename);
1666 GNUNET_CONFIGURATION_destroy (cfg);
1667 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
1668 return 1;
1669 }
1670 peer = GNUNET_TESTING_peer_configure (system, cfg, 0, NULL, NULL);
1671 if (NULL == peer)
1672 {
1673 GNUNET_CONFIGURATION_destroy (cfg);
1674 hostkeys_unload (system);
1675 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
1676 return 1;
1677 }
1678 GNUNET_free (peer->main_binary);
1679 GNUNET_free (peer->args);
1680 GNUNET_asprintf (&binary, "gnunet-service-%s", service_name);
1681 libexec_binary = GNUNET_OS_get_libexec_binary_path (binary);
1682 if (GNUNET_SYSERR ==
1683 GNUNET_CONFIGURATION_get_value_string (cfg,
1684 service_name,
1685 "PREFIX",
1686 &peer->main_binary))
1687 {
1688 /* No prefix */
1689 GNUNET_asprintf (&peer->main_binary, "%s", libexec_binary);
1690 peer->args = GNUNET_strdup ("");
1691 }
1692 else
1693 peer->args = GNUNET_strdup (libexec_binary);
1694
1695 GNUNET_free (libexec_binary);
1696 GNUNET_free (binary);
1697 if (GNUNET_OK != GNUNET_TESTING_peer_start (peer))
1698 {
1699 GNUNET_TESTING_peer_destroy (peer);
1700 GNUNET_CONFIGURATION_destroy (cfg);
1701 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
1702 return 1;
1703 }
1704 sc.cfg = cfg;
1705 sc.tm = tm;
1706 sc.tm_cls = tm_cls;
1707 sc.peer = peer;
1708 GNUNET_SCHEDULER_run (&service_run_main, &sc); /* Scheduler loop */
1709 if ((NULL != peer->main_process) &&
1710 (GNUNET_OK != GNUNET_TESTING_peer_stop (peer)))
1711 {
1712 GNUNET_TESTING_peer_destroy (peer);
1713 GNUNET_CONFIGURATION_destroy (cfg);
1714 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
1715 return 1;
1716 }
1717 GNUNET_TESTING_peer_destroy (peer);
1718 GNUNET_CONFIGURATION_destroy (cfg);
1719 GNUNET_TESTING_system_destroy (system, GNUNET_YES);
1720 return 0;
1721}
1722
1723
1724/**
1725 * Every line in the topology configuration starts with a string indicating which
1726 * kind of information will be configured with this line. Configuration values following
1727 * this string are seperated by special sequences of characters. An integer value seperated
1728 * by ':' is returned by this function.
1729 *
1730 * @param line The line of configuration.
1731 * @return An integer value.
1732 */
1733static unsigned int
1734get_first_value (const char *line)
1735{
1736 char *copy;
1737 size_t slen;
1738 char *token;
1739 unsigned int ret;
1740 char *rest = NULL;
1741
1742 slen = strlen (line) + 1;
1743 copy = GNUNET_malloc (slen);
1744 memcpy (copy, line, slen);
1745 token = strtok_r (copy, ":", &rest);
1746 token = strtok_r (NULL, ":", &rest);
1747 GNUNET_assert (1 == sscanf (token, "%u", &ret));
1748 GNUNET_free (copy);
1749 return ret;
1750}
1751
1752
1753/**
1754 * Every line in the topology configuration starts with a string indicating which
1755 * kind of information will be configured with this line. This string is returned by this function.
1756 *
1757 * @param line The line of configuration.
1758 * @return The leading string of this configuration line.
1759 */
1760static char *
1761get_key (const char *line)
1762{
1763 char *copy;
1764 size_t slen;
1765 size_t tlen;
1766 char *token;
1767 char *ret;
1768 char *rest = NULL;
1769
1770 slen = strlen (line) + 1;
1771 copy = GNUNET_malloc (slen);
1772 memcpy (copy, line, slen);
1773 token = strtok_r (copy, ":", &rest);
1774 tlen = strlen (token) + 1;
1775 ret = GNUNET_malloc (tlen);
1776 memcpy (ret, token, tlen);
1777 GNUNET_free (copy);
1778 return ret;
1779}
1780
1781
1782/**
1783 * Every line in the topology configuration starts with a string indicating which
1784 * kind of information will be configured with this line. Configuration values following
1785 * this string are seperated by special sequences of characters. A string value seperated
1786 * by ':' is returned by this function.
1787 *
1788 * @param line The line of configuration.
1789 * @return A string value.
1790 */
1791static char *
1792get_first_string_value (const char *line)
1793{
1794 char *copy;
1795 size_t slen, slen_token;
1796 char *token;
1797 char *ret;
1798 char *rest = NULL;
1799
1800 slen = strlen (line) + 1;
1801 copy = GNUNET_malloc (slen);
1802 memcpy (copy, line, slen);
1803 token = strtok_r (copy, ":", &rest);
1804 token = strtok_r (NULL, ":", &rest);
1805 LOG (GNUNET_ERROR_TYPE_DEBUG,
1806 "first token %s\n",
1807 token);
1808 slen_token = strlen (token);
1809 ret = GNUNET_malloc (slen_token + 1);
1810 memcpy (ret, token, slen_token + 1);
1811 GNUNET_free (copy);
1812 return ret;
1813}
1814
1815
1816/**
1817 * Every line in the topology configuration starts with a string indicating which
1818 * kind of information will be configured with this line. Configuration values following
1819 * this string are seperated by special sequences of characters. A second integer value
1820 * seperated by ':' from a first value is returned by this function.
1821 *
1822 * @param line The line of configuration.
1823 * @return An integer value.
1824 */
1825static unsigned int
1826get_second_value (const char *line)
1827{
1828 char *copy;
1829 char *token;
1830 unsigned int ret;
1831 char *rest = NULL;
1832
1833 copy = GNUNET_strdup (line);
1834 token = strtok_r (copy, ":", &rest);
1835 token = strtok_r (NULL, ":", &rest);
1836 token = strtok_r (NULL, ":", &rest);
1837 LOG (GNUNET_ERROR_TYPE_ERROR,
1838 "Format error in configuration line: %s\n",
1839 line);
1840 GNUNET_assert (1 == sscanf (token, "%u", &ret));
1841 GNUNET_free (copy);
1842 return ret;
1843}
1844
1845
1846/**
1847 * Every line in the topology configuration starts with a string indicating which
1848 * kind of information will be configured with this line. Configuration values following
1849 * this string are seperated by special sequences of characters. A value might be
1850 * a key value pair.
1851 * This function returns the value for a specific key in a configuration line.
1852 *
1853 * @param key The key of the key value pair.
1854 * @return The value of the key value pair.
1855 */
1856static char *
1857get_value (const char *key, const char *line)
1858{
1859 char copy[strlen (line) + 1];
1860 size_t slen;
1861 char *token;
1862 char *token2;
1863 char *temp;
1864 char *rest = NULL;
1865
1866 slen = strlen (line) + 1;
1867 memcpy (copy, line, slen);
1868 temp = strstr (copy, key);
1869 if (NULL == temp)
1870 return NULL;
1871 token = strtok_r (temp, ":", &rest);
1872 if (NULL == token)
1873 return NULL;
1874 token = strtok_r (NULL, ":", &rest);
1875 if (NULL == token)
1876 return NULL;
1877 token2 = strtok_r (token, "}", &rest);
1878 if (NULL == token2)
1879 return NULL;
1880 return GNUNET_strdup (token2);
1881}
1882
1883
1884/**
1885 * Every line in the topology configuration starts with a string indicating which
1886 * kind of information will be configured with this line. Configuration values following
1887 * this string are seperated by special sequences of characters. A value might be
1888 * a key value pair. A special key is the 'connect' key which can appear more than once.
1889 * The value is the information about a connection via some protocol to some other node.
1890 * This function returns the struct GNUNET_TESTING_NodeConnection which holds the information
1891 * of the connect value.
1892 *
1893 * @param value The value of the connect key value pair.
1894 * @return The struct GNUNET_TESTING_NodeConnection.
1895 */
1896static struct GNUNET_TESTING_NodeConnection *
1897get_connect_value (const char *line,
1898 struct GNUNET_TESTING_NetjailNode *node)
1899{
1900 struct GNUNET_TESTING_NodeConnection *node_connection;
1901 char *copy;
1902 char *token;
1903 char *token2;
1904 unsigned int node_n;
1905 unsigned int namespace_n;
1906 char *rest = NULL;
1907 char *rest2 = NULL;
1908 struct GNUNET_TESTING_AddressPrefix *prefix;
1909 unsigned int sscanf_ret;
1910
1911 node_connection = GNUNET_new (struct GNUNET_TESTING_NodeConnection);
1912 node_connection->node = node;
1913
1914 copy = GNUNET_strdup (line);
1915 token = strtok_r (copy, ":", &rest);
1916 if (0 == strcmp ("{K", token))
1917 {
1918 node_connection->node_type = GNUNET_TESTING_GLOBAL_NODE;
1919 token = strtok_r (NULL, ":", &rest);
1920 GNUNET_assert (1 == sscanf (token, "%u", &node_n));
1921 LOG (GNUNET_ERROR_TYPE_DEBUG,
1922 "node_n %u\n",
1923 node_n);
1924 node_connection->node_n = node_n;
1925 node_connection->namespace_n = 0;
1926 }
1927 else if (0 == strcmp ("{P", token))
1928 {
1929 node_connection->node_type = GNUNET_TESTING_SUBNET_NODE;
1930 token = strtok_r (NULL, ":", &rest);
1931 errno = 0;
1932 sscanf_ret = sscanf (token, "%u", &namespace_n);
1933 if (errno != 0)
1934 {
1935 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
1936 }
1937 GNUNET_assert (0 < sscanf_ret);
1938 node_connection->namespace_n = namespace_n;
1939 token = strtok_r (NULL, ":", &rest);
1940 errno = 0;
1941 sscanf_ret = sscanf (token, "%u", &node_n);
1942 if (errno != 0)
1943 {
1944 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
1945 }
1946 GNUNET_assert (0 < sscanf_ret);
1947 node_connection->node_n = node_n;
1948 LOG (GNUNET_ERROR_TYPE_DEBUG,
1949 "node_n %u namespace_n %u node->node_n %u node->namespace_n %u\n",
1950 node_n,
1951 namespace_n,
1952 node->node_n,
1953 node->namespace_n);
1954 }
1955 else
1956 {
1957 GNUNET_break (0);
1958 GNUNET_free (node_connection);
1959 GNUNET_free (copy);
1960 return NULL;
1961 }
1962
1963 while (NULL != (token = strtok_r (NULL, ":", &rest)))
1964 {
1965 prefix = GNUNET_new (struct GNUNET_TESTING_AddressPrefix);
1966 token2 = strtok_r (token, "}", &rest2);
1967 if (NULL != token2)
1968 prefix->address_prefix = GNUNET_strdup (token2);
1969 else
1970 prefix->address_prefix = GNUNET_strdup (token);
1971
1972 LOG (GNUNET_ERROR_TYPE_DEBUG,
1973 "address_prefix %s\n",
1974 prefix->address_prefix);
1975
1976 GNUNET_CONTAINER_DLL_insert (node_connection->address_prefixes_head,
1977 node_connection->address_prefixes_tail,
1978 prefix);
1979 LOG (GNUNET_ERROR_TYPE_DEBUG,
1980 "address_prefix %s\n",
1981 prefix->address_prefix);
1982 }
1983
1984 GNUNET_free (copy);
1985 return node_connection;
1986}
1987
1988
1989/**
1990 * Every line in the topology configuration starts with a string indicating which
1991 * kind of information will be configured with this line. Configuration values following
1992 * this string are seperated by special sequences of characters. A value might be
1993 * a key value pair. A special key is the 'connect' key.
1994 * The value is the information about a connections via some protocol to other nodes.
1995 * Each connection itself is a key value pair separated by the character '|' and
1996 * surrounded by the characters '{' and '}'.
1997 * The struct GNUNET_TESTING_NodeConnection holds the information of each connection value.
1998 * This function extracts the values of each connection into a DLL of
1999 * struct GNUNET_TESTING_NodeConnection which will be added to a node.
2000 *
2001 * @param line The line of configuration.
2002 * @param node The struct GNUNET_TESTING_NetjailNode to which the DLL of
2003 * struct GNUNET_TESTING_NodeConnection will be added.
2004 */
2005static void
2006node_connections (const char *line, struct GNUNET_TESTING_NetjailNode *node)
2007{
2008 char *value, *value2;
2009 char *temp;
2010 char *copy;
2011 char *rest = NULL;
2012 char *rest2 = NULL;
2013 struct GNUNET_TESTING_NodeConnection *node_connection;
2014
2015
2016 temp = strstr (line, "connect");
2017 if (NULL != temp)
2018 {
2019 copy = GNUNET_strdup (temp);
2020 strtok_r (copy, ":", &rest);
2021 value = strtok_r (rest, "|", &rest2);
2022
2023 while (NULL != value)
2024 {
2025 LOG (GNUNET_ERROR_TYPE_DEBUG,
2026 "node_connections value %s\n",
2027 value);
2028 node_connection = get_connect_value (value, node);
2029 if (NULL == node_connection)
2030 {
2031 LOG (GNUNET_ERROR_TYPE_WARNING,
2032 "connect key was not expected in this configuration line: %s\n",
2033 line);
2034 break;
2035 }
2036 GNUNET_CONTAINER_DLL_insert (node->node_connections_head,
2037 node->node_connections_tail,
2038 node_connection);
2039 value2 = strstr (value, "}}");
2040 if (NULL != value2)
2041 break;
2042 value = strtok_r (NULL, "|", &rest2);
2043
2044 }
2045 GNUNET_free (copy);
2046 }
2047}
2048
2049
2050/**
2051 * A helper function to log information about individual nodes.
2052 *
2053 * @param cls This is not used actually.
2054 * @param id The key of this value in the map.
2055 * @param value A struct GNUNET_TESTING_NetjailNode which holds information about a node.
2056 * return GNUNET_YES to continue with iterating, GNUNET_NO otherwise.
2057 */
2058static int
2059log_nodes (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
2060{
2061 struct GNUNET_TESTING_NetjailNode *node = value;
2062 struct GNUNET_TESTING_NodeConnection *pos_connection;
2063 struct GNUNET_TESTING_AddressPrefix *pos_prefix;
2064
2065 LOG (GNUNET_ERROR_TYPE_DEBUG,
2066 "plugin: %s space: %u node: %u global: %u\n",
2067 node->plugin,
2068 node->namespace_n,
2069 node->node_n,
2070 node->is_global);
2071
2072 for (pos_connection = node->node_connections_head; NULL != pos_connection;
2073 pos_connection = pos_connection->next)
2074 {
2075
2076 LOG (GNUNET_ERROR_TYPE_DEBUG,
2077 "namespace_n: %u node_n: %u node_type: %u\n",
2078 pos_connection->namespace_n,
2079 pos_connection->node_n,
2080 pos_connection->node_type);
2081
2082 for (pos_prefix = pos_connection->address_prefixes_head; NULL != pos_prefix;
2083 pos_prefix =
2084 pos_prefix->next)
2085 {
2086 LOG (GNUNET_ERROR_TYPE_DEBUG,
2087 "prefix: %s\n",
2088 pos_prefix->address_prefix);
2089 }
2090 }
2091 return GNUNET_YES;
2092}
2093
2094
2095/**
2096 * Helper function to log information about namespaces.
2097 *
2098 * @param cls This is not used actually.
2099 * @param id The key of this value in the map.
2100 * @param value A struct GNUNET_TESTING_NetjailNamespace which holds information about a subnet.
2101 * return GNUNET_YES to continue with iterating, GNUNET_NO otherwise.
2102 */
2103static int
2104log_namespaces (void *cls, const struct GNUNET_ShortHashCode *id, void *value)
2105{
2106 struct GNUNET_TESTING_NetjailNamespace *namespace = value;
2107
2108 GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes, &log_nodes, NULL);
2109 return GNUNET_YES;
2110}
2111
2112
2113/**
2114 * Helper function to log the configuration in case of a problem with configuration.
2115 *
2116 * @param topology The struct GNUNET_TESTING_NetjailTopology holding the configuration information.
2117 */
2118static int
2119log_topo (const struct GNUNET_TESTING_NetjailTopology *topology)
2120{
2121 LOG (GNUNET_ERROR_TYPE_DEBUG,
2122 "plugin: %s spaces: %u nodes: %u known: %u\n",
2123 topology->plugin,
2124 topology->namespaces_n,
2125 topology->nodes_m,
2126 topology->nodes_x);
2127
2128 GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces,
2129 log_namespaces, NULL);
2130 GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals, &log_nodes,
2131 NULL);
2132 return GNUNET_YES;
2133}
2134
2135
2136/**
2137 * This function extracts information about a specific node from the topology.
2138 *
2139 * @param num The global index number of the node.
2140 * @param[out] node_ex A struct GNUNET_TESTING_NetjailNode with information about the node.
2141 * @param[out] namespace_ex A struct GNUNET_TESTING_NetjailNamespace with information about the namespace
2142 the node is in or NULL, if the node is a global node.
2143 * @param[out] node_connections_ex A struct GNUNET_TESTING_NodeConnection with information about the connection
2144 of this node to other nodes.
2145*/
2146static void
2147get_node_info (unsigned int num,
2148 const struct GNUNET_TESTING_NetjailTopology *topology,
2149 struct GNUNET_TESTING_NetjailNode **node_ex,
2150 struct GNUNET_TESTING_NetjailNamespace **namespace_ex,
2151 struct GNUNET_TESTING_NodeConnection **node_connections_ex)
2152{
2153 struct GNUNET_ShortHashCode hkey;
2154 struct GNUNET_HashCode hc;
2155 unsigned int namespace_n;
2156 unsigned int node_m;
2157 struct GNUNET_TESTING_NetjailNode *node;
2158 struct GNUNET_TESTING_NetjailNamespace *namespace;
2159 struct GNUNET_TESTING_NodeConnection *node_connections = NULL;
2160
2161 log_topo (topology);
2162 LOG (GNUNET_ERROR_TYPE_DEBUG,
2163 "num: %u \n",
2164 num);
2165 if (topology->nodes_x >= num)
2166 {
2167
2168 GNUNET_CRYPTO_hash (&num, sizeof(num), &hc);
2169 memcpy (&hkey,
2170 &hc,
2171 sizeof (hkey));
2172 node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
2173 &hkey);
2174 if (NULL != node)
2175 {
2176 *node_ex = node;
2177 *node_connections_ex = node->node_connections_head;
2178 }
2179 }
2180 else
2181 {
2182 namespace_n = (unsigned int) ceil ((double) (num - topology->nodes_x)
2183 / topology->nodes_m);
2184 LOG (GNUNET_ERROR_TYPE_DEBUG,
2185 "ceil num: %u nodes_x: %u nodes_m: %u namespace_n: %u\n",
2186 num,
2187 topology->nodes_x,
2188 topology->nodes_m,
2189 namespace_n);
2190 GNUNET_CRYPTO_hash (&namespace_n, sizeof(namespace_n), &hc);
2191 memcpy (&hkey,
2192 &hc,
2193 sizeof (hkey));
2194 namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
2195 &hkey);
2196 if (NULL != namespace)
2197 {
2198 node_m = num - topology->nodes_x - topology->nodes_m * (namespace_n - 1);
2199 GNUNET_CRYPTO_hash (&node_m, sizeof(node_m), &hc);
2200 memcpy (&hkey,
2201 &hc,
2202 sizeof (hkey));
2203 node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
2204 &hkey);
2205 if (NULL != node)
2206 {
2207 LOG (GNUNET_ERROR_TYPE_DEBUG,
2208 "node additional_connects: %u %p\n",
2209 node->additional_connects,
2210 node);
2211 node_connections = node->node_connections_head;
2212 }
2213 *node_ex = node;
2214 *namespace_ex = namespace;
2215 *node_connections_ex = node_connections;
2216 }
2217 }
2218}
2219
2220
2221/**
2222 * Get a node from the topology.
2223 *
2224 * @param num The specific node we want the connections for.
2225 * @param topology The topology we get the connections from.
2226 * @return The connections of the node.
2227 */
2228struct GNUNET_TESTING_NetjailNode *
2229GNUNET_TESTING_get_node (unsigned int num,
2230 struct GNUNET_TESTING_NetjailTopology *topology)
2231{
2232 struct GNUNET_TESTING_NetjailNode *node;
2233 struct GNUNET_TESTING_NetjailNamespace *namespace;
2234 struct GNUNET_TESTING_NodeConnection *node_connections;
2235
2236 get_node_info (num, topology, &node, &namespace, &node_connections);
2237
2238 return node;
2239
2240}
2241
2242
2243/**
2244 * Get the connections to other nodes for a specific node.
2245 *
2246 * @param num The specific node we want the connections for.
2247 * @param topology The topology we get the connections from.
2248 * @return The connections of the node.
2249 */
2250struct GNUNET_TESTING_NodeConnection *
2251GNUNET_TESTING_get_connections (unsigned int num,
2252 const struct
2253 GNUNET_TESTING_NetjailTopology *topology)
2254{
2255 struct GNUNET_TESTING_NetjailNode *node;
2256 struct GNUNET_TESTING_NetjailNamespace *namespace;
2257 struct GNUNET_TESTING_NodeConnection *node_connections;
2258
2259 LOG (GNUNET_ERROR_TYPE_DEBUG,
2260 "get_connections\n");
2261
2262 get_node_info (num, topology, &node, &namespace, &node_connections);
2263
2264 return node_connections;
2265}
2266
2267
2268/**
2269 * Retrieve the peer identity from the test system with the unique node id.
2270 *
2271 * @param num The unique node id.
2272 * @param tl_system The test system.
2273 * @return The peer identity wrapping the public key.
2274 */
2275struct GNUNET_PeerIdentity *
2276GNUNET_TESTING_get_peer (unsigned int num,
2277 const struct GNUNET_TESTING_System *tl_system)
2278{
2279 struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity);
2280 struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key;
2281
2282 priv_key = GNUNET_TESTING_hostkey_get (tl_system,
2283 num,
2284 peer);
2285
2286 GNUNET_CRYPTO_eddsa_key_get_public (priv_key,
2287 &peer->public_key);
2288 GNUNET_free (priv_key);
2289 return peer;
2290}
2291
2292
2293int
2294free_nodes_cb (void *cls,
2295 const struct GNUNET_ShortHashCode *key,
2296 void *value)
2297{
2298 (void) cls;
2299 struct GNUNET_TESTING_NetjailNode *node = value;
2300 struct GNUNET_TESTING_NodeConnection *pos_connection;
2301 struct GNUNET_TESTING_AddressPrefix *pos_prefix;
2302
2303 while (NULL != (pos_connection = node->node_connections_head))
2304 {
2305 while (NULL != (pos_prefix = pos_connection->address_prefixes_head))
2306 {
2307 GNUNET_CONTAINER_DLL_remove (pos_connection->address_prefixes_head,
2308 pos_connection->address_prefixes_tail,
2309 pos_prefix);
2310 GNUNET_free (pos_prefix->address_prefix);
2311 GNUNET_free (pos_prefix);
2312 }
2313 GNUNET_CONTAINER_DLL_remove (node->node_connections_head,
2314 node->node_connections_tail,
2315 pos_connection);
2316 GNUNET_free (pos_connection);
2317 }
2318
2319 GNUNET_free (node->plugin);
2320 GNUNET_free (node);
2321 return GNUNET_OK;
2322}
2323
2324
2325int
2326free_namespaces_cb (void *cls,
2327 const struct GNUNET_ShortHashCode *key,
2328 void *value)
2329{
2330 (void) cls;
2331 struct GNUNET_TESTING_NetjailNamespace *namespace = value;
2332
2333 GNUNET_free (namespace->router);
2334 GNUNET_CONTAINER_multishortmap_iterate (namespace->nodes, free_nodes_cb,
2335 namespace->nodes);
2336 return GNUNET_OK;
2337
2338}
2339
2340
2341/**
2342 * Deallocate memory of the struct GNUNET_TESTING_NetjailTopology.
2343 *
2344 * @param topology The GNUNET_TESTING_NetjailTopology to be deallocated.
2345 */
2346void
2347GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology)
2348{
2349 GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces,
2350 free_namespaces_cb, NULL);
2351 GNUNET_CONTAINER_multishortmap_destroy (topology->map_namespaces);
2352 GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals, free_nodes_cb,
2353 NULL);
2354 GNUNET_CONTAINER_multishortmap_destroy (topology->map_globals);
2355 GNUNET_free (topology->plugin);
2356 GNUNET_free (topology);
2357}
2358
2359
2360unsigned int
2361GNUNET_TESTING_calculate_num (
2362 struct GNUNET_TESTING_NodeConnection *node_connection,
2363 struct GNUNET_TESTING_NetjailTopology *topology)
2364{
2365 unsigned int n, m, num;
2366
2367 n = node_connection->namespace_n;
2368 m = node_connection->node_n;
2369
2370 if (0 == n)
2371 num = m;
2372 else
2373 num = (n - 1) * topology->nodes_m + m + topology->nodes_x;
2374
2375 return num;
2376}
2377
2378
2379/**
2380 * Get the address for a specific communicator from a connection.
2381 *
2382 * @param connection The connection we like to have the address from.
2383 * @param prefix The communicator protocol prefix.
2384 * @return The address of the communicator.
2385 */
2386char *
2387GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection,
2388 const char *prefix)
2389{
2390 struct GNUNET_TESTING_NetjailNode *node;
2391 char *addr;
2392 char *template;
2393 unsigned int node_n;
2394
2395 LOG (GNUNET_ERROR_TYPE_DEBUG,
2396 "get address prefix: %s node_n: %u\n",
2397 prefix,
2398 connection->node_n);
2399
2400 node = connection->node;
2401 if (connection->namespace_n == node->namespace_n)
2402 {
2403 template = CONNECT_ADDRESS_TEMPLATE;
2404 node_n = connection->node_n;
2405 }
2406 else if (0 == connection->namespace_n)
2407 {
2408 template = KNOWN_CONNECT_ADDRESS_TEMPLATE;
2409 node_n = connection->node_n;
2410 }
2411 else if (1 == connection->node_n)
2412 {
2413 template = ROUTER_CONNECT_ADDRESS_TEMPLATE;
2414 node_n = connection->namespace_n;
2415 }
2416 else
2417 {
2418 return NULL;
2419 }
2420
2421 if (0 == strcmp (PREFIX_TCP, prefix) ||
2422 0 == strcmp (PREFIX_UDP, prefix) ||
2423 0 == strcmp (PREFIX_UDP_NATTED, prefix) ||
2424 0 == strcmp (PREFIX_TCP_NATTED, prefix))
2425 {
2426 GNUNET_asprintf (&addr,
2427 template,
2428 prefix,
2429 node_n);
2430 }
2431 else
2432 {
2433 GNUNET_assert (0);
2434 }
2435
2436 return addr;
2437}
2438
2439
2440/**
2441 * Get the number of unintentional additional connections the node waits for.
2442 *
2443 * @param num The specific node we want the additional connects for.
2444 * @return The number of additional connects
2445 */
2446unsigned int
2447GNUNET_TESTING_get_additional_connects (unsigned int num,
2448 struct GNUNET_TESTING_NetjailTopology *
2449 topology)
2450{
2451 struct GNUNET_TESTING_NetjailNode *node;
2452 struct GNUNET_TESTING_NetjailNamespace *namespace;
2453 struct GNUNET_TESTING_NodeConnection *node_connections;
2454
2455 LOG (GNUNET_ERROR_TYPE_DEBUG,
2456 "get_additional_connects\n");
2457
2458 get_node_info (num, topology, &node, &namespace, &node_connections);
2459
2460 if (NULL == node)
2461 {
2462 LOG (GNUNET_ERROR_TYPE_WARNING,
2463 "No info found for node %d\n", num);
2464 return 0;
2465 }
2466 LOG (GNUNET_ERROR_TYPE_DEBUG,
2467 "node additional_connects for node %p\n",
2468 node);
2469 LOG (GNUNET_ERROR_TYPE_DEBUG,
2470 "node additional_connects: %u\n",
2471 node->additional_connects);
2472
2473 return node->additional_connects;
2474}
2475
2476
2477static void
2478parse_ac (struct GNUNET_TESTING_NetjailNode *p_node, const char *token)
2479{
2480 char *ac_value;
2481 int ret;
2482
2483 ac_value = get_value ("AC", token);
2484 if (NULL != ac_value)
2485 {
2486 LOG (GNUNET_ERROR_TYPE_DEBUG,
2487 "ac value: %s\n",
2488 ac_value);
2489 errno = 0;
2490 ret = sscanf (ac_value, "%u", &p_node->additional_connects);
2491 if (errno != 0)
2492 {
2493 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "sscanf");
2494 }
2495 GNUNET_assert (0 < ret);
2496 LOG (GNUNET_ERROR_TYPE_DEBUG,
2497 "AC %u\n",
2498 p_node->additional_connects);
2499 }
2500 else
2501 {
2502 p_node->additional_connects = 0;
2503 }
2504 GNUNET_free (ac_value);
2505}
2506
2507
2508/**
2509 * Parse the topology data.
2510 *
2511 * @param data The topology data.
2512 * @return The GNUNET_TESTING_NetjailTopology
2513 */
2514struct GNUNET_TESTING_NetjailTopology *
2515GNUNET_TESTING_get_topo_from_string (const char *input)
2516{
2517 char *token;
2518 char *key = NULL;
2519 unsigned int out;
2520 char *rest = NULL;
2521 char *value = NULL;
2522 char *value2;
2523 char *data;
2524 int ret;
2525 struct GNUNET_TESTING_NetjailTopology *topo;
2526 struct GNUNET_TESTING_NetjailRouter *router;
2527 struct GNUNET_TESTING_NetjailNamespace *namespace;
2528 struct GNUNET_HashCode hc;
2529
2530 data = GNUNET_strdup (input);
2531 token = strtok_r (data, "\n", &rest);
2532 topo = GNUNET_new (struct GNUNET_TESTING_NetjailTopology);
2533 topo->map_namespaces =
2534 GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
2535 topo->map_globals =
2536 GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
2537
2538 while (NULL != token)
2539 {
2540 if (NULL != key)
2541 GNUNET_free (key);
2542 key = get_key (token);
2543 LOG (GNUNET_ERROR_TYPE_DEBUG,
2544 "In the loop with token: %s beginning with %s\n",
2545 token,
2546 key);
2547 if (0 == strcmp (key, "M"))
2548 {
2549 LOG (GNUNET_ERROR_TYPE_DEBUG,
2550 "Get first Value for M.\n");
2551 out = get_first_value (token);
2552 LOG (GNUNET_ERROR_TYPE_DEBUG,
2553 "M: %u\n",
2554 out);
2555 topo->nodes_m = out;
2556 }
2557 else if (0 == strcmp (key, "N"))
2558 {
2559 LOG (GNUNET_ERROR_TYPE_DEBUG,
2560 "Get first Value for N.\n");
2561 out = get_first_value (token);
2562 LOG (GNUNET_ERROR_TYPE_DEBUG,
2563 "N: %u\n",
2564 out);
2565 topo->namespaces_n = out;
2566 }
2567 else if (0 == strcmp (key, "X"))
2568 {
2569 LOG (GNUNET_ERROR_TYPE_DEBUG,
2570 "Get first Value for X.\n");
2571 out = get_first_value (token);
2572 LOG (GNUNET_ERROR_TYPE_DEBUG,
2573 "X: %u\n",
2574 out);
2575 topo->nodes_x = out;
2576 }
2577 else if (0 == strcmp (key, "AC"))
2578 {
2579 LOG (GNUNET_ERROR_TYPE_DEBUG,
2580 "Get first Value for AC.\n");
2581 out = get_first_value (token);
2582 LOG (GNUNET_ERROR_TYPE_DEBUG,
2583 "AC: %u\n",
2584 out);
2585 topo->additional_connects = out;
2586 }
2587 else if (0 == strcmp (key, "T"))
2588 {
2589 LOG (GNUNET_ERROR_TYPE_DEBUG,
2590 "Get first string value for T.\n");
2591 value = get_first_string_value (token);
2592 LOG (GNUNET_ERROR_TYPE_DEBUG,
2593 "value: %s\n",
2594 value);
2595 topo->plugin = value;
2596 }
2597 else if (0 == strcmp (key, "K"))
2598 {
2599 struct GNUNET_ShortHashCode hkey_k;
2600 struct GNUNET_TESTING_NetjailNode *k_node = GNUNET_new (struct
2601 GNUNET_TESTING_NetjailNode);
2602
2603 LOG (GNUNET_ERROR_TYPE_DEBUG,
2604 "Get first Value for K.\n");
2605 out = get_first_value (token);
2606 LOG (GNUNET_ERROR_TYPE_DEBUG,
2607 "K: %u\n",
2608 out);
2609 k_node->node_n = out;
2610 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2611 memcpy (&hkey_k,
2612 &hc,
2613 sizeof (hkey_k));
2614 k_node->is_global = GNUNET_YES;
2615
2616 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2617 topo->map_globals,
2618 &hkey_k))
2619 GNUNET_break (0);
2620 else
2621 GNUNET_CONTAINER_multishortmap_put (topo->map_globals,
2622 &hkey_k,
2623 k_node,
2624 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2625 LOG (GNUNET_ERROR_TYPE_DEBUG,
2626 "Get value for key value on K.\n");
2627 value = get_value ("plugin", token);
2628 LOG (GNUNET_ERROR_TYPE_DEBUG,
2629 "value: %s\n",
2630 value);
2631 k_node->plugin = value;
2632 parse_ac (k_node, token);
2633 node_connections (token, k_node);
2634 GNUNET_free (value);
2635 }
2636 else if (0 == strcmp (key, "R"))
2637 {
2638 struct GNUNET_ShortHashCode hkey_r;
2639 router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter);
2640
2641 LOG (GNUNET_ERROR_TYPE_DEBUG,
2642 "Get first Value for R.\n");
2643 out = get_first_value (token);
2644 LOG (GNUNET_ERROR_TYPE_DEBUG,
2645 "R: %u\n",
2646 out);
2647 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2648 memcpy (&hkey_r,
2649 &hc,
2650 sizeof (hkey_r));
2651 LOG (GNUNET_ERROR_TYPE_DEBUG,
2652 "Get value for key tcp_port on R.\n");
2653 value = get_value ("tcp_port", token);
2654 LOG (GNUNET_ERROR_TYPE_DEBUG,
2655 "tcp_port: %s\n",
2656 value);
2657 ret = sscanf (value, "%u", &(router->tcp_port));
2658 GNUNET_free (value);
2659 GNUNET_break (0 != ret && 1 >= router->tcp_port);
2660
2661 LOG (GNUNET_ERROR_TYPE_DEBUG,
2662 "Get value for key udp_port on R.\n");
2663 value2 = get_value ("udp_port", token);
2664 ret = sscanf (value2, "%u", &(router->udp_port));
2665 GNUNET_free (value2);
2666 GNUNET_break (0 != ret && 1 >= router->udp_port);
2667 LOG (GNUNET_ERROR_TYPE_DEBUG,
2668 "udp_port: %s\n",
2669 value2);
2670 GNUNET_free (value2);
2671 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2672 topo->map_namespaces,
2673 &hkey_r))
2674 {
2675 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
2676 &hkey_r);
2677 }
2678 else
2679 {
2680 namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace);
2681 namespace->namespace_n = out;
2682 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
2683 GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces,
2684 &hkey_r,
2685 namespace,
2686 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2687 }
2688 namespace->router = router;
2689
2690 }
2691 else if (0 == strcmp (key, "P"))
2692 {
2693 struct GNUNET_TESTING_NetjailNode *p_node = GNUNET_new (struct
2694 GNUNET_TESTING_NetjailNode);
2695 struct GNUNET_ShortHashCode hkey_p;
2696
2697 LOG (GNUNET_ERROR_TYPE_DEBUG,
2698 "Get first Value for P.\n");
2699 out = get_first_value (token);
2700 LOG (GNUNET_ERROR_TYPE_DEBUG,
2701 "P: %u\n",
2702 out);
2703 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2704 memcpy (&hkey_p,
2705 &hc,
2706 sizeof (hkey_p));
2707
2708 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2709 topo->map_namespaces,
2710 &hkey_p))
2711 {
2712 namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces,
2713 &hkey_p);
2714 }
2715 else
2716 {
2717 namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace);
2718 namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
2719 namespace->namespace_n = out;
2720 GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces,
2721 &hkey_p,
2722 namespace,
2723 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2724 }
2725 LOG (GNUNET_ERROR_TYPE_DEBUG,
2726 "Get second Value for P.\n");
2727 out = get_second_value (token);
2728 LOG (GNUNET_ERROR_TYPE_DEBUG,
2729 "P: %u\n",
2730 out);
2731 GNUNET_CRYPTO_hash (&out, sizeof(out), &hc);
2732 memcpy (&hkey_p,
2733 &hc,
2734 sizeof (hkey_p));
2735 if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains (
2736 namespace->nodes,
2737 &hkey_p))
2738 {
2739 GNUNET_break (0);
2740 }
2741 else
2742 {
2743
2744 GNUNET_CONTAINER_multishortmap_put (namespace->nodes,
2745 &hkey_p,
2746 p_node,
2747 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2748 LOG (GNUNET_ERROR_TYPE_DEBUG,
2749 "Get value for key plugin on P.\n");
2750 value = get_value ("plugin", token);
2751 if (NULL != value)
2752 {
2753 LOG (GNUNET_ERROR_TYPE_DEBUG,
2754 "plugin: %s\n",
2755 value);
2756 p_node->plugin = value;
2757 }
2758 p_node->node_n = out;
2759 p_node->namespace_n = namespace->namespace_n;
2760 }
2761 LOG (GNUNET_ERROR_TYPE_DEBUG,
2762 "Get AC Value for P.\n");
2763 parse_ac (p_node, token);
2764 node_connections (token, p_node);
2765 }
2766 token = strtok_r (NULL, "\n", &rest);
2767 if (NULL != token)
2768 LOG (GNUNET_ERROR_TYPE_DEBUG,
2769 "Next token %s\n",
2770 token);
2771 }
2772 if (NULL != key)
2773 GNUNET_free (key);
2774 GNUNET_free (data);
2775 return topo;
2776}
2777
2778
2779/**
2780 * Getting the topology from file.
2781 *
2782 * @param filename The name of the topology file.
2783 * @return The GNUNET_TESTING_NetjailTopology
2784 */
2785struct GNUNET_TESTING_NetjailTopology *
2786GNUNET_TESTING_get_topo_from_file (const char *filename)
2787{
2788 uint64_t fs;
2789 char *data;
2790 struct GNUNET_TESTING_NetjailTopology *topo;
2791
2792 if (GNUNET_YES != GNUNET_DISK_file_test (filename))
2793 {
2794 LOG (GNUNET_ERROR_TYPE_ERROR,
2795 _ ("Topology file %s not found\n"),
2796 filename);
2797 return NULL;
2798 }
2799 if (GNUNET_OK !=
2800 GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES))
2801 {
2802 LOG (GNUNET_ERROR_TYPE_ERROR,
2803 _ ("Topology file %s has no data\n"),
2804 filename);
2805 return NULL;
2806 }
2807 data = GNUNET_malloc (fs + 1);
2808 if (fs != GNUNET_DISK_fn_read (filename, data, fs))
2809 {
2810 LOG (GNUNET_ERROR_TYPE_ERROR,
2811 _ ("Topology file %s cannot be read\n"),
2812 filename);
2813 GNUNET_free (data);
2814 return NULL;
2815 }
2816
2817 LOG (GNUNET_ERROR_TYPE_DEBUG,
2818 "file length %" PRIu64 "\n",
2819 fs);
2820 data[fs] = '\0';
2821
2822 topo = GNUNET_TESTING_get_topo_from_string (data);
2823
2824 GNUNET_free (data);
2825
2826 return topo;
2827}
2828
2829
2830/* end of testing.c */
diff --git a/src/service/testing/testing.h b/src/service/testing/testing.h
deleted file mode 100644
index 43c8ad45a..000000000
--- a/src/service/testing/testing.h
+++ /dev/null
@@ -1,339 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @author t3sserakt
23 */
24#ifndef TESTING_H
25#define TESTING_H
26#include "gnunet_util_lib.h"
27#include "gnunet_testing_plugin.h"
28
29GNUNET_NETWORK_STRUCT_BEGIN
30
31/**
32 * Message send to a child loop to inform the child loop about a barrier being advanced.
33 */
34struct CommandBarrierCrossable
35{
36 /**
37 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE
38 */
39 struct GNUNET_MessageHeader header;
40
41 /* followed by 0-terminated barrier name */
42};
43
44/**
45 * Message send by a child loop to inform the master loop how much
46 * GNUNET_CMDS_BARRIER_REACHED messages the child will send.
47 */
48struct CommandBarrierAttached
49{
50 /**
51 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED
52 */
53 struct GNUNET_MessageHeader header;
54
55 /**
56 * How often the child loop will reach the barrier.
57 */
58 uint32_t expected_reaches GNUNET_PACKED;
59
60 /**
61 * The number of the node the barrier is running on.
62 */
63 uint32_t node_number GNUNET_PACKED;
64
65 /* followed by 0-terminated barrier name */
66};
67
68struct GNUNET_TESTING_CommandBarrierReached
69{
70 /**
71 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED
72 */
73 struct GNUNET_MessageHeader header;
74
75 /**
76 * The number of the node the barrier is reached.
77 */
78 uint32_t node_number GNUNET_PACKED;
79
80 /**
81 * The number of reach messages which most likely will send.
82 */
83 uint32_t expected_number_of_reached_messages GNUNET_PACKED;
84
85 /* followed by 0-terminated barrier name */
86};
87
88GNUNET_NETWORK_STRUCT_END
89
90/**
91 * Handle for a plugin.
92 */
93struct TestcasePlugin
94{
95 /**
96 * Name of the shared library.
97 */
98 char *library_name;
99
100 /**
101 * Plugin API.
102 */
103 struct GNUNET_TESTING_PluginFunctions *api;
104
105 /**
106 * IP address of the specific node the helper is running for.
107 *
108 */
109 char *node_ip;
110
111 /**
112 * Name of the test case plugin.
113 *
114 */
115 char *plugin_name;
116
117 /**
118 * The number of namespaces
119 *
120 */
121 char *global_n;
122
123 /**
124 * The number of local nodes per namespace.
125 *
126 */
127 char *local_m;
128
129 /**
130 * The number of the namespace this node is in.
131 *
132 */
133 char *n;
134
135 /**
136 * The number of the node in the namespace.
137 *
138 */
139 char *m;
140};
141
142struct CommandListEntry
143{
144 struct CommandListEntry *next;
145
146 struct CommandListEntry *prev;
147
148 struct GNUNET_TESTING_Command *command;
149};
150
151
152struct GNUNET_TESTING_Barrier
153{
154 /**
155 * Pointer to the previous prefix in the DLL.
156 */
157 struct GNUNET_TESTING_Barrier *prev;
158
159 /**
160 * Pointer to the next prefix in the DLL.
161 */
162 struct GNUNET_TESTING_Barrier *next;
163
164 /**
165 * Head of the DLL with local commands the barrier is attached too.
166 */
167 struct CommandListEntry *cmds_head;
168
169 /**
170 * Tail of the DLL with local commands the barrier is attached too.
171 */
172 struct CommandListEntry *cmds_tail;
173
174 /**
175 * Hash map containing the global known nodes which are not natted.
176 */
177 struct GNUNET_CONTAINER_MultiShortmap *nodes;
178
179 /**
180 * Name of the barrier.
181 */
182 const char *name;
183
184 /**
185 * Is this barrier running on the master.
186 */
187 unsigned int running_on_master;
188
189 /**
190 * Number of commands attached to this barrier.
191 */
192 unsigned int expected_reaches;
193
194 /**
195 * Number of commands which reached this barrier.
196 */
197 unsigned int reached;
198
199 /**
200 * Percentage of of commands which need to reach the barrier to change state.
201 * Can not be used together with to_be_reached;
202 */
203 double percentage_to_be_reached;
204
205 /**
206 * Number of commands which need to reach the barrier to change state.
207 * Can not be used together with percentage_to_be_reached;
208 */
209 unsigned int number_to_be_reached;
210
211 /*
212 * No barrier locally. Shadow created. Real barrier created elsewhere.
213 */
214 unsigned int shadow;
215};
216
217
218/**
219 * Advance internal pointer to next command.
220 *
221 * @param cls batch internal state
222 * @return true if we could advance, false if the batch
223 * has completed and cannot advance anymore
224 */
225bool
226GNUNET_TESTING_cmd_batch_next_ (void *cls);
227
228
229/**
230 * Test if this command is a batch command.
231 *
232 * @return false if not, true if it is a batch command
233 */
234bool
235GNUNET_TESTING_cmd_is_batch_ (const struct GNUNET_TESTING_Command *cmd);
236
237
238/**
239 * Obtain what command the batch is at.
240 *
241 * @return cmd current batch command
242 */
243struct GNUNET_TESTING_Command *
244GNUNET_TESTING_cmd_batch_get_current_ (const struct GNUNET_TESTING_Command *cmd);
245
246
247/**
248 * Set what command the batch should be at. Needed for
249 * loops. We may want to change this to take a label
250 * and/or expose it in the public API in the future.
251 * Not used for now.
252 *
253 * @param cmd current batch command
254 * @param new_ip where to move the IP
255 */
256void
257GNUNET_TESTING_cmd_batch_set_current_ (const struct GNUNET_TESTING_Command *cmd,
258 unsigned int new_ip);
259
260
261/**
262 * This function checks, if a barrier can be crossed, which actually means that
263 * the cmd representing the barrier is finished.
264 *
265 * @param barrier The barrier in question.
266 * @return true if we can cross the barrier, false if not.
267 */
268bool
269GNUNET_TESTING_barrier_crossable_ (struct GNUNET_TESTING_Barrier *barrier);
270
271
272/**
273 * Finish all "barrier reached" commands attached to this barrier.
274 *
275 * @param barrier The barrier in question.
276 */
277void
278GNUNET_TESTING_finish_barrier_ (struct GNUNET_TESTING_Interpreter *is,
279 const char *barrier_name);
280
281
282/**
283 * Send message to master loop that cmds being attached to a barrier.
284 * FIXME: Unused function
285 *
286 * @param is The interpreter loop.
287 * @param barrier_name The name of the barrier to attach to.
288 * @param subnet_number The number of the subnet.
289 * @param node_number The node to inform.
290 * @param write_message Callback to write messages to the master loop.
291 */
292void
293GNUNET_TESTING_send_barrier_attach_ (struct GNUNET_TESTING_Interpreter *is,
294 const char *barrier_name,
295 unsigned int global_node_number,
296 unsigned int expected_reaches,
297 GNUNET_TESTING_cmd_helper_write_cb write_message);
298
299
300/**
301 * Getting a node from a map by global node number.
302 * FIXME: This is a barrier helper function not related to a command but it is
303 * implemented in the *_cmd_barrier.c file.
304 * Maybe move into a separate file like testing_barrier.c; see also can
305 * barrier advance above
306 *
307 * @param nodes The map.
308 * @param node_number The global node number.
309 * @return The node.
310 */
311struct GNUNET_TESTING_NetjailNode *
312GNUNET_TESTING_barrier_get_node (struct GNUNET_TESTING_Barrier *barrier,
313 unsigned int node_number);
314
315
316/**
317 * Getting a barrier from the interpreter.
318 *
319 * @param is The interpreter.
320 * @param barrier_name The name of the barrier.
321 * @return The barrier.
322 */
323struct GNUNET_TESTING_Barrier *
324GNUNET_TESTING_get_barrier_ (struct GNUNET_TESTING_Interpreter *is,
325 const char *barrier_name);
326
327
328/**
329 * Add a barrier to the loop.
330 *
331 * @param is The interpreter.
332 * @param barrier The barrier to add.
333 */
334void
335GNUNET_TESTING_add_barrier_ (struct GNUNET_TESTING_Interpreter *is,
336 struct GNUNET_TESTING_Barrier *barrier);
337
338
339#endif
diff --git a/src/service/testing/testing_api_cmd_barrier.c b/src/service/testing/testing_api_cmd_barrier.c
deleted file mode 100644
index ee074f35b..000000000
--- a/src/service/testing/testing_api_cmd_barrier.c
+++ /dev/null
@@ -1,206 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_cmd_barrier.c
23 * @brief Barrier functionality.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "testing.h"
28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_netjail_lib.h"
31#include "gnunet_testing_barrier.h"
32
33/**
34 * Generic logging shortcut
35 */
36#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
37
38
39struct BarrierState
40{
41 /**
42 * Our barrier, set to NULL once the barrier is active.
43 */
44 struct GNUNET_TESTING_Barrier *barrier;
45
46 /**
47 * Our label.
48 */
49 const char *label;
50};
51
52
53// FIXME Unused function
54void
55GNUNET_TESTING_send_barrier_attach_ (
56 struct GNUNET_TESTING_Interpreter *is,
57 const char *barrier_name,
58 unsigned int global_node_number,
59 unsigned int expected_reaches,
60 GNUNET_TESTING_cmd_helper_write_cb write_message)
61{
62 // FIXME: avoid useless malloc!
63 struct CommandBarrierAttached *atm = GNUNET_new (struct
64 CommandBarrierAttached);
65 size_t msg_length = sizeof(struct CommandBarrierAttached);
66 size_t name_len;
67
68 name_len = strlen (barrier_name) + 1;
69 atm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED);
70 atm->header.size = htons ((uint16_t) msg_length);
71 atm->expected_reaches = expected_reaches;
72 atm->node_number = global_node_number;
73 memcpy (&atm[1], barrier_name, name_len);
74 write_message ((struct GNUNET_MessageHeader *) atm, msg_length);
75
76 GNUNET_free (atm);
77}
78
79
80bool
81GNUNET_TESTING_barrier_crossable_ (struct GNUNET_TESTING_Barrier *barrier)
82{
83 unsigned int expected_reaches = barrier->expected_reaches;
84 unsigned int reached = barrier->reached;
85 double percentage_to_be_reached = barrier->percentage_to_be_reached;
86 unsigned int number_to_be_reached = barrier->number_to_be_reached;
87 double percentage_reached = (double) reached / expected_reaches * 100;
88
89 LOG (GNUNET_ERROR_TYPE_DEBUG,
90 "%u %f %f %u %u\n",
91 expected_reaches,
92 percentage_to_be_reached,
93 percentage_reached,
94 number_to_be_reached,
95 reached);
96
97 return ( ( (0 < percentage_to_be_reached) &&
98 (percentage_reached >= percentage_to_be_reached) ) ||
99 ( (0 < number_to_be_reached) &&
100 (reached >= number_to_be_reached) ) );
101}
102
103
104/**
105 * Offer internal data from a "barrier" CMD, to other commands.
106 *
107 * @param cls closure.
108 * @param[out] ret result.
109 * @param trait name of the trait.
110 * @param index index number of the object to offer.
111 * @return #GNUNET_OK on success.
112 */
113static enum GNUNET_GenericReturnValue
114barrier_traits (void *cls,
115 const void **ret,
116 const char *trait,
117 unsigned int index)
118{
119 struct GNUNET_TESTING_Trait traits[] = {
120 GNUNET_TESTING_trait_end ()
121 };
122
123 return GNUNET_TESTING_get_trait (traits,
124 ret,
125 trait,
126 index);
127}
128
129
130/**
131 * Cleanup the state from a "barrier" CMD, and possibly
132 * cancel a pending operation thereof.
133 *
134 * @param cls closure.
135 */
136static void
137barrier_cleanup (void *cls)
138{
139 struct BarrierState *brs = cls;
140
141 GNUNET_free (brs->barrier);
142 GNUNET_free (brs);
143}
144
145
146/**
147 * Run the command.
148 *
149 * @param cls closure.
150 * @param is the interpreter state.
151 */
152static void
153barrier_run (void *cls,
154 struct GNUNET_TESTING_Interpreter *is)
155{
156 struct BarrierState *brs = cls;
157
158 GNUNET_TESTING_add_barrier_ (is,
159 brs->barrier);
160 brs->barrier = NULL;
161}
162
163
164struct GNUNET_TESTING_NetjailNode *
165GNUNET_TESTING_barrier_get_node (struct GNUNET_TESTING_Barrier *barrier,
166 unsigned int node_number)
167{
168 struct GNUNET_HashCode hc;
169 struct GNUNET_ShortHashCode key;
170
171 GNUNET_CRYPTO_hash (&node_number,
172 sizeof(node_number),
173 &hc);
174 memcpy (&key,
175 &hc,
176 sizeof (key));
177 return GNUNET_CONTAINER_multishortmap_get (barrier->nodes,
178 &key);
179}
180
181
182struct GNUNET_TESTING_Command
183GNUNET_TESTING_cmd_barrier_create (const char *label,
184 double percentage_to_be_reached,
185 unsigned int number_to_be_reached)
186{
187 struct GNUNET_TESTING_Barrier *barrier;
188 struct BarrierState *bs;
189
190 bs = GNUNET_new (struct BarrierState);
191 bs->label = label;
192 barrier = GNUNET_new (struct GNUNET_TESTING_Barrier);
193 barrier->name = label;
194 barrier->percentage_to_be_reached = percentage_to_be_reached;
195 barrier->number_to_be_reached = number_to_be_reached;
196 GNUNET_assert ((0 < percentage_to_be_reached &&
197 0 == number_to_be_reached) ||
198 (0 == percentage_to_be_reached &&
199 0 < number_to_be_reached));
200 bs->barrier = barrier;
201 return GNUNET_TESTING_command_new (bs, label,
202 &barrier_run,
203 &barrier_cleanup,
204 &barrier_traits,
205 NULL);
206}
diff --git a/src/service/testing/testing_api_cmd_barrier_reached.c b/src/service/testing/testing_api_cmd_barrier_reached.c
deleted file mode 100644
index 54a36b91c..000000000
--- a/src/service/testing/testing_api_cmd_barrier_reached.c
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2022 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_cmd_barrier_reached.c
23 * @brief Command to signal barrier was reached.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_testing_lib.h"
28#include "testing_cmds.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
31#include "gnunet_testing_netjail_lib.h"
32#include "testing.h"
33
34/**
35 * Generic logging shortcut
36 */
37#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
38
39/**
40 * Struct with information for callbacks.
41 *
42 */
43struct BarrierReachedState
44{
45 /**
46 * Callback to write messages to the master loop.
47 *
48 */
49 GNUNET_TESTING_cmd_helper_write_cb write_message;
50
51 /**
52 * Context for our asynchronous completion.
53 */
54 struct GNUNET_TESTING_AsyncContext ac;
55
56 /**
57 * The label of this command.
58 */
59 const char *label;
60
61 /**
62 * The name of the barrier this commands wait (if finishing asynchronous) for or/and reaches.
63 */
64 const char *barrier_name;
65
66 /*
67 * The global numer of the node the cmd runs on.
68 */
69 unsigned int node_number;
70
71 /**
72 * If this command will block.
73 */
74 unsigned int asynchronous_finish;
75
76 /**
77 * Is this cmd running on the master loop.
78 */
79 unsigned int running_on_master;
80};
81
82
83/**
84 * Run the command.
85 *
86 * @param cls closure.
87 * @param is the interpreter state.
88 */
89static void
90barrier_reached_run (void *cls,
91 struct GNUNET_TESTING_Interpreter *is)
92{
93 struct BarrierReachedState *brs = cls;
94 struct GNUNET_TESTING_Barrier *barrier;
95 struct GNUNET_TESTING_Command *cmd =
96 GNUNET_TESTING_interpreter_get_current_command (is);
97 struct CommandListEntry *cle;
98 size_t msg_length;
99 struct GNUNET_TESTING_CommandBarrierReached *msg;
100 size_t name_len;
101
102 barrier = GNUNET_TESTING_get_barrier_ (is,
103 brs->barrier_name);
104 if (NULL == barrier)
105 {
106 barrier = GNUNET_new (struct GNUNET_TESTING_Barrier);
107 barrier->name = brs->barrier_name;
108 GNUNET_TESTING_add_barrier_ (is,
109 barrier);
110 }
111 barrier->reached++;
112 if (GNUNET_TESTING_barrier_crossable_ (barrier))
113 {
114 GNUNET_assert (NULL != cmd);
115 cmd->asynchronous_finish = GNUNET_YES;
116 GNUNET_TESTING_finish_barrier_ (is,
117 barrier->name);
118 }
119 else if (GNUNET_NO == brs->asynchronous_finish)
120 {
121 cle = GNUNET_new (struct CommandListEntry);
122 cle->command = cmd;
123 GNUNET_CONTAINER_DLL_insert (barrier->cmds_head,
124 barrier->cmds_tail,
125 cle);
126 LOG (GNUNET_ERROR_TYPE_DEBUG,
127 "added cle for %p %s\n",
128 barrier,
129 barrier->name);
130 }
131
132 if (GNUNET_NO == brs->running_on_master)
133 {
134 char *terminator = "\0";
135
136 name_len = strlen (barrier->name);
137 msg_length = sizeof(struct GNUNET_TESTING_CommandBarrierReached)
138 + name_len + 1;
139 msg = GNUNET_malloc (msg_length);
140 msg->header.size = htons ((uint16_t) msg_length);
141 msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED);
142 msg->node_number = brs->node_number;
143 memcpy (&msg[1], barrier->name, name_len + 1);
144 memcpy (&msg[name_len + 1],terminator,1);
145 brs->write_message ((struct GNUNET_MessageHeader *) msg, msg_length);
146 }
147}
148
149
150/**
151 * Cleanup the state from a "barrier reached" CMD, and possibly
152 * cancel a pending operation thereof.
153 *
154 * @param cls closure.
155 */
156static void
157barrier_reached_cleanup (void *cls)
158{
159 struct BarrierReachedState *brs = cls;
160
161 GNUNET_free (brs);
162}
163
164
165/**
166 * Offer internal data from a "batch" CMD, to other commands.
167 *
168 * @param cls closure.
169 * @param[out] ret result.
170 * @param trait name of the trait.
171 * @param index index number of the object to offer.
172 * @return #GNUNET_OK on success.
173 */
174static enum GNUNET_GenericReturnValue
175barrier_reached_traits (void *cls,
176 const void **ret,
177 const char *trait,
178 unsigned int index)
179{
180 struct BarrierReachedState *brs = cls;
181 struct GNUNET_TESTING_AsyncContext *ac = &brs->ac;
182
183 struct GNUNET_TESTING_Trait traits[] = {
184 GNUNET_TESTING_make_trait_async_context (ac),
185 GNUNET_TESTING_trait_end ()
186 };
187
188 return GNUNET_TESTING_get_trait (traits,
189 ret,
190 trait,
191 index);
192}
193
194
195/**
196 * Create command.
197 *
198 * @param label name for command.
199 * @param barrier_label The name of the barrier we wait for (if finishing asynchronous) and which will be reached.
200 * @param asynchronous_finish If GNUNET_YES this command will not block.
201 * @param node_number The global numer of the node the cmd runs on.
202 * @param running_on_master Is this cmd running on the master loop.
203 * @param write_message Callback to write messages to the master loop.
204 * @return command.
205 */
206struct GNUNET_TESTING_Command
207GNUNET_TESTING_cmd_barrier_reached (
208 const char *label,
209 const char *barrier_label,
210 unsigned int asynchronous_finish,
211 unsigned int node_number,
212 unsigned int running_on_master,
213 GNUNET_TESTING_cmd_helper_write_cb write_message)
214{
215 struct BarrierReachedState *brs;
216
217 brs = GNUNET_new (struct BarrierReachedState);
218 brs->label = label;
219 brs->barrier_name = barrier_label;
220 brs->asynchronous_finish = asynchronous_finish;
221 brs->node_number = node_number;
222 brs->running_on_master = running_on_master;
223 brs->write_message = write_message;
224 return GNUNET_TESTING_command_new (brs, label,
225 &barrier_reached_run,
226 &barrier_reached_cleanup,
227 &barrier_reached_traits,
228 &brs->ac);
229}
diff --git a/src/service/testing/testing_api_cmd_block_until_external_trigger.c b/src/service/testing/testing_api_cmd_block_until_external_trigger.c
deleted file mode 100644
index fc312cdc9..000000000
--- a/src/service/testing/testing_api_cmd_block_until_external_trigger.c
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_block_until_all_peers_started.c
23 * @brief cmd to block the interpreter loop until all peers started.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "testing_cmds.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
31#include "gnunet_testing_netjail_lib.h"
32
33/**
34 * Generic logging shortcut
35 */
36#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
37
38
39/**
40 * The cleanup function of this cmd frees resources the cmd allocated.
41 *
42 */
43static void
44block_until_all_peers_started_cleanup (void *cls)
45{
46 struct BlockState *bs = cls;
47
48 GNUNET_free (bs);
49}
50
51
52static int
53block_until_external_trigger_traits (void *cls,
54 const void **ret,
55 const char *trait,
56 unsigned int index)
57{
58 struct GNUNET_TESTING_BlockState *bs = cls;
59 struct GNUNET_TESTING_AsyncContext *ac = &bs->ac;
60 struct GNUNET_TESTING_Trait traits[] = {
61 GNUNET_TESTING_make_trait_async_context (ac),
62 GNUNET_TESTING_make_trait_block_state (bs),
63 GNUNET_TESTING_trait_end ()
64 };
65
66 return GNUNET_TESTING_get_trait (traits,
67 ret,
68 trait,
69 index);
70}
71
72
73/**
74 * This function does nothing but to start the cmd.
75 *
76 */
77static void
78block_until_all_peers_started_run (void *cls,
79 struct GNUNET_TESTING_Interpreter *is)
80{
81 struct GNUNET_TESTING_BlockState *bs = cls;
82 struct GNUNET_TESTING_Command *cmd =
83 GNUNET_TESTING_interpreter_get_current_command (is);
84
85 LOG (GNUNET_ERROR_TYPE_DEBUG,
86 "block %s running %u!\n",
87 bs->label,
88 bs->asynchronous_finish);
89 if (GNUNET_YES == bs->asynchronous_finish)
90 {
91 LOG (GNUNET_ERROR_TYPE_DEBUG,
92 "block %s running asynchronous!\n",
93 bs->label);
94 cmd->asynchronous_finish = bs->asynchronous_finish;
95 }
96}
97
98
99/**
100 * Create command.
101 *
102 * @param label name for command.
103 * @return command.
104 */
105struct GNUNET_TESTING_Command
106GNUNET_TESTING_cmd_block_until_external_trigger (
107 const char *label)
108{
109 struct GNUNET_TESTING_BlockState *bs;
110
111 bs = GNUNET_new (struct GNUNET_TESTING_BlockState);
112 bs->label = label;
113 return GNUNET_TESTING_command_new (bs,
114 label,
115 &block_until_all_peers_started_run,
116 &block_until_all_peers_started_cleanup,
117 &block_until_external_trigger_traits,
118 &bs->ac);
119}
diff --git a/src/service/testing/testing_api_cmd_exec_bash_script.c b/src/service/testing/testing_api_cmd_exec_bash_script.c
deleted file mode 100644
index 171a2baac..000000000
--- a/src/service/testing/testing_api_cmd_exec_bash_script.c
+++ /dev/null
@@ -1,216 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2023 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_local_test_prepared.c
23 * @brief cmd to block the interpreter loop until all peers started.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h"
29
30#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
31
32struct BashScriptState
33{
34 /**
35 * Context for our asynchronous completion.
36 */
37 struct GNUNET_TESTING_AsyncContext ac;
38
39 /**
40 * Callback handed over to the command, which should
41 * be called upon death or completion of the script.
42 */
43 GNUNET_ChildCompletedCallback cb;
44
45 // Child Wait handle
46 struct GNUNET_ChildWaitHandle *cwh;
47
48 /**
49 * The process id of the script.
50 */
51 struct GNUNET_OS_Process *start_proc;
52
53 /**
54 * Script this cmd will execute.
55 */
56 const char *script;
57
58
59 /**
60 * Arguments for the script
61 */
62 char *const*script_argv;
63
64 /**
65 * Size of script_argv.
66 */
67 int argc;
68};
69
70/**
71 * The cleanup function of this cmd frees resources the cmd allocated.
72 *
73 */
74static void
75exec_bash_script_cleanup (void *cls)
76{
77 struct BashScriptState *bss = cls;
78
79 if (NULL != bss->cwh)
80 {
81 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
82 "Cancel child\n");
83 GNUNET_wait_child_cancel (bss->cwh);
84 bss->cwh = NULL;
85 }
86 if (NULL != bss->start_proc)
87 {
88 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
89 "Kill process\n");
90 GNUNET_assert (0 ==
91 GNUNET_OS_process_kill (bss->start_proc,
92 SIGKILL));
93 GNUNET_assert (GNUNET_OK ==
94 GNUNET_OS_process_wait (bss->start_proc));
95 GNUNET_OS_process_destroy (bss->start_proc);
96 bss->start_proc = NULL;
97 }
98 GNUNET_free (bss);
99}
100
101/**
102 * Callback which will be called if the setup script finished.
103 *
104 */
105static void
106child_completed_callback (void *cls,
107 enum GNUNET_OS_ProcessStatusType type,
108 long unsigned int exit_code)
109{
110 struct BashScriptState *bss = cls;
111
112 GNUNET_OS_process_destroy (bss->start_proc);
113 bss->start_proc = NULL;
114 bss->cwh = NULL;
115 if (0 == exit_code)
116 {
117 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
118 "Child succeeded!\n");
119 GNUNET_TESTING_async_finish (&bss->ac);
120 }
121 else
122 {
123 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
124 "Child failed with error %lu!\n",
125 exit_code);
126 GNUNET_TESTING_async_fail (&bss->ac);
127 }
128 bss->cb (cls, type, exit_code);
129}
130
131/**
132 * Run method of the command created by the interpreter to wait for another
133 * command to finish.
134 *
135 */
136static void
137exec_bash_script_run (void *cls,
138 struct GNUNET_TESTING_Interpreter *is)
139{
140 struct BashScriptState *bss = cls;
141 enum GNUNET_GenericReturnValue helper_check;
142 char *argv[bss->argc + 2];
143
144 char *data_dir;
145 char *script_name;
146
147 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
148 GNUNET_asprintf (&script_name, "%s%s", data_dir, bss->script);
149
150 helper_check = GNUNET_OS_check_helper_binary (
151 script_name,
152 GNUNET_YES,
153 NULL);
154
155 LOG (GNUNET_ERROR_TYPE_DEBUG,
156 "script_name %s\n",
157 script_name);
158
159 if (GNUNET_NO == helper_check)
160 {
161 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
162 "No SUID for %s!\n",
163 script_name);
164 GNUNET_TESTING_interpreter_fail (is);
165 return;
166 }
167 if (GNUNET_SYSERR == helper_check)
168 {
169 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
170 "%s not found!\n",
171 script_name);
172 GNUNET_TESTING_interpreter_fail (is);
173 return;
174 }
175 argv[0] = script_name;
176 if (NULL != bss->script_argv)
177 {
178 for (int i = 0; i < bss->argc;i++)
179 argv[i + 1] = bss->script_argv[i];
180 }
181 argv[bss->argc] = NULL;
182
183 bss->start_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
184 NULL,
185 NULL,
186 NULL,
187 script_name,
188 argv);
189 bss->cwh = GNUNET_wait_child (bss->start_proc,
190 &child_completed_callback,
191 bss);
192 GNUNET_break (NULL != bss->cwh);
193}
194
195const struct GNUNET_TESTING_Command
196GNUNET_TESTING_cmd_exec_bash_script (const char *label,
197 const char *script,
198 char *const script_argv[],
199 int argc,
200 GNUNET_ChildCompletedCallback cb)
201{
202 struct BashScriptState *bss;
203
204 bss = GNUNET_new (struct BashScriptState);
205 bss->script = script;
206 bss->script_argv = script_argv; // FIXME this is not just a cast to fix
207 bss->argc = argc;
208 bss->cb = cb;
209
210 return GNUNET_TESTING_command_new (bss,
211 label,
212 &exec_bash_script_run,
213 &exec_bash_script_cleanup,
214 NULL,
215 &bss->ac);
216}
diff --git a/src/service/testing/testing_api_cmd_local_test_prepared.c b/src/service/testing/testing_api_cmd_local_test_prepared.c
deleted file mode 100644
index 2b1525077..000000000
--- a/src/service/testing/testing_api_cmd_local_test_prepared.c
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_local_test_prepared.c
23 * @brief cmd to block the interpreter loop until all peers started.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
31#include "gnunet_testing_netjail_lib.h"
32#include "testing_cmds.h"
33
34/**
35 * Generic logging shortcut
36 */
37#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
38
39
40/**
41 * This function prepares an array with traits.
42 *
43 */
44enum GNUNET_GenericReturnValue
45local_test_prepared_traits (void *cls,
46 const void **ret,
47 const char *trait,
48 unsigned int index)
49{
50 struct LocalPreparedState *lfs = cls;
51 struct GNUNET_TESTING_Trait traits[] = {
52 GNUNET_TESTING_make_trait_local_prepared_state ((const void *) lfs),
53 GNUNET_TESTING_trait_end ()
54 };
55 return GNUNET_TESTING_get_trait (traits,
56 ret,
57 trait,
58 index);
59}
60
61
62/**
63 * The cleanup function of this cmd frees resources the cmd allocated.
64 *
65 */
66static void
67local_test_prepared_cleanup (void *cls)
68{
69 struct LocalPreparedState *lfs = cls;
70
71 GNUNET_free (lfs);
72}
73
74
75/**
76 * This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TESTS_PREPARED message to the master loop.
77 *
78 */
79static void
80local_test_prepared_run (void *cls,
81 struct GNUNET_TESTING_Interpreter *is)
82{
83 struct GNUNET_TESTING_LocalPreparedState *lfs = cls;
84
85 struct GNUNET_TESTING_CommandLocalTestPrepared *reply;
86 size_t msg_length;
87
88 msg_length = sizeof(struct GNUNET_TESTING_CommandLocalTestPrepared);
89 reply = GNUNET_new (struct GNUNET_TESTING_CommandLocalTestPrepared);
90 reply->header.type = htons (
91 GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED);
92 reply->header.size = htons ((uint16_t) msg_length);
93 lfs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
94}
95
96
97struct GNUNET_TESTING_Command
98GNUNET_TESTING_cmd_local_test_prepared (const char *label,
99 GNUNET_TESTING_cmd_helper_write_cb
100 write_message)
101{
102 struct GNUNET_TESTING_LocalPreparedState *lfs;
103
104 lfs = GNUNET_new (struct GNUNET_TESTING_LocalPreparedState);
105 lfs->write_message = write_message;
106
107 return GNUNET_TESTING_command_new (lfs, label,
108 &local_test_prepared_run,
109 &local_test_prepared_cleanup,
110 &local_test_prepared_traits,
111 &lfs->ac);
112}
diff --git a/src/service/testing/testing_api_cmd_netjail_start_cmds_helper.c b/src/service/testing/testing_api_cmd_netjail_start_cmds_helper.c
deleted file mode 100644
index 792d7a8cf..000000000
--- a/src/service/testing/testing_api_cmd_netjail_start_cmds_helper.c
+++ /dev/null
@@ -1,917 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_cmd_hello_world.c
23 * @brief Command to start the netjail peers.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_testing_ng_lib.h"
28#include "gnunet_testing_plugin.h"
29#include "gnunet_testing_barrier.h"
30#include "gnunet_testing_netjail_lib.h"
31#include "testing.h"
32#include "testing_cmds.h"
33
34#define NETJAIL_EXEC_SCRIPT "netjail_exec.sh"
35
36#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
37
38/**
39 * Generic logging shortcut
40 */
41#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
42
43/**
44 * Struct to store messages send/received by the helper into a DLL
45 *
46 */
47struct HelperMessage
48{
49
50 /**
51 * Kept in a DLL.
52 */
53 struct HelperMessage *next;
54
55 /**
56 * Kept in a DLL.
57 */
58 struct HelperMessage *prev;
59
60 /**
61 * Size of the original message.
62 */
63 uint16_t bytes_msg;
64
65 /* Followed by @e bytes_msg of msg.*/
66};
67
68
69/**
70 * Struct to store information handed over to callbacks.
71 *
72 */
73struct NetJailState
74{
75 /**
76 * Global state of the interpreter, used by a command
77 * to access information about other commands.
78 */
79 struct GNUNET_TESTING_Interpreter *is;
80
81 /**
82 * Context for our asynchronous completion.
83 */
84 struct GNUNET_TESTING_AsyncContext ac;
85
86 /**
87 * The complete topology information.
88 */
89 struct GNUNET_TESTING_NetjailTopology *topology;
90
91 /**
92 * Array with handles of helper processes.
93 */
94 const struct GNUNET_HELPER_Handle **helper;
95
96 /**
97 * Size of the array NetJailState#helper.
98 *
99 */
100 unsigned int n_helper;
101
102 /**
103 * Number of nodes in a natted subnet.
104 *
105 */
106 unsigned int local_m;
107
108 /**
109 * Number of natted subnets.
110 *
111 */
112 unsigned int global_n;
113
114 /**
115 * Number of global known nodes.
116 *
117 */
118 unsigned int known;
119
120
121 /**
122 * Number of test environments started.
123 *
124 */
125 unsigned int number_of_testsystems_started;
126
127 /**
128 * Number of peers started.
129 *
130 */
131 unsigned int number_of_peers_started;
132
133 /**
134 * Number of local tests finished.
135 *
136 */
137 unsigned int number_of_local_tests_finished;
138
139 /**
140 * Number of local tests prepared to finish.
141 *
142 */
143 unsigned int number_of_local_tests_prepared;
144
145 /**
146 * Name of the test case plugin the helper will load.
147 *
148 */
149 char *plugin_name;
150
151 /**
152 * Shall we read the topology from file, or from a string.
153 */
154 unsigned int *read_file;
155
156 /**
157 * String with topology data or name of topology file.
158 */
159 char *topology_data;
160
161 /**
162 * Time after this cmd has to finish.
163 */
164 struct GNUNET_TIME_Relative timeout;
165
166 /**
167 * Timeout task.
168 */
169 struct GNUNET_SCHEDULER_Task *timeout_task;
170};
171
172/**
173 * Struct containing the number of the netjail node and the NetJailState which
174 * will be handed to callbacks specific to a test environment.
175 */
176struct TestingSystemCount
177{
178 /**
179 * The plugin correlated to this netjail node.
180 */
181 struct TestcasePlugin *plugin;
182
183 /**
184 * Kept in a DLL.
185 */
186 struct TestingSystemCount *next;
187
188 /**
189 * Kept in a DLL.
190 */
191 struct TestingSystemCount *prev;
192
193 /**
194 * The send handle for the helper
195 */
196 struct GNUNET_HELPER_SendHandle *shandle;
197
198 /**
199 * Struct to store information handed over to callbacks.
200 *
201 */
202 struct NetJailState *ns;
203
204 /**
205 * The messages send to the helper.
206 */
207 struct GNUNET_MessageHeader *msg;
208};
209
210
211/**
212* Code to clean up resource this cmd used.
213*
214* @param cls closure
215*/
216static void
217netjail_exec_cleanup (void *cls)
218{
219 struct NetJailState *ns = cls;
220 GNUNET_free (ns);
221}
222
223
224/**
225 * This function prepares an array with traits.
226 *
227 */
228static enum GNUNET_GenericReturnValue
229netjail_exec_traits (void *cls,
230 const void **ret,
231 const char *trait,
232 unsigned int index)
233{
234 struct NetJailState *ns = cls;
235 const struct GNUNET_HELPER_Handle **helper = ns->helper;
236
237
238 struct GNUNET_TESTING_Trait traits[] = {
239 GNUNET_TESTING_make_trait_helper_handles (helper),
240 GNUNET_TESTING_trait_end ()
241 };
242
243 return GNUNET_TESTING_get_trait (traits,
244 ret,
245 trait,
246 index);
247}
248
249
250/**
251 * Continuation function from GNUNET_HELPER_send()
252 *
253 * @param cls closure
254 * @param result GNUNET_OK on success,
255 * GNUNET_NO if helper process died
256 * GNUNET_SYSERR during GNUNET_HELPER_stop
257 */
258static void
259clear_msg (void *cls, int result)
260{
261 struct TestingSystemCount *tbc = cls;
262
263 GNUNET_assert (NULL != tbc->shandle);
264 // GNUNET_free (tbc->shandle);
265 GNUNET_free (tbc->plugin);
266 tbc->shandle = NULL;
267 GNUNET_free (tbc);
268}
269
270
271static void
272send_message_to_locals (
273 unsigned int i,
274 unsigned int j,
275 struct NetJailState *ns,
276 struct GNUNET_MessageHeader *header
277 )
278{
279 const struct GNUNET_HELPER_Handle *helper;
280 struct TestingSystemCount *tbc;
281 unsigned int count;
282
283 LOG (GNUNET_ERROR_TYPE_DEBUG,
284 "send message of type %u to locals\n",
285 header->type);
286 tbc = GNUNET_new (struct TestingSystemCount);
287 tbc->ns = ns;
288 if (0 == i)
289 count = j;
290 else
291 count = (i - 1) * ns->local_m + j + ns->known;
292
293 helper = ns->helper[count - 1];
294
295
296 struct GNUNET_HELPER_SendHandle *sh = GNUNET_HELPER_send (
297 (struct GNUNET_HELPER_Handle *) helper,
298 header,
299 GNUNET_NO,
300 &clear_msg,
301 tbc);
302
303 tbc->shandle = sh;
304}
305
306
307static void
308send_all_local_tests_prepared (unsigned int i, unsigned int j, struct
309 NetJailState *ns)
310{
311 struct GNUNET_TESTING_CommandAllLocalTestsPrepared *reply;
312 size_t msg_length;
313
314
315 msg_length = sizeof(struct GNUNET_TESTING_CommandAllLocalTestsPrepared);
316 reply = GNUNET_new (struct GNUNET_TESTING_CommandAllLocalTestsPrepared);
317 reply->header.type = htons (
318 GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED);
319 reply->header.size = htons ((uint16_t) msg_length);
320
321 send_message_to_locals (i, j, ns, &reply->header);
322 GNUNET_free (reply);
323}
324
325
326static void
327send_all_peers_started (unsigned int i, unsigned int j, struct NetJailState *ns)
328{
329 struct GNUNET_TESTING_CommandAllPeersStarted *reply;
330 size_t msg_length;
331
332 msg_length = sizeof(struct GNUNET_TESTING_CommandAllPeersStarted);
333 reply = GNUNET_new (struct GNUNET_TESTING_CommandAllPeersStarted);
334 reply->header.type = htons (
335 GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED);
336 reply->header.size = htons ((uint16_t) msg_length);
337
338 send_message_to_locals (i, j, ns, &reply->header);
339 GNUNET_free (reply);
340}
341
342
343void
344barrier_attached (struct NetJailState *ns, const struct
345 GNUNET_MessageHeader *message)
346{
347 struct CommandBarrierAttached *am;
348 struct GNUNET_TESTING_NetjailNode *node;
349 struct GNUNET_TESTING_Barrier *barrier;
350 struct GNUNET_ShortHashCode key;
351 struct GNUNET_HashCode hc;
352 const char *barrier_name;
353
354 am = (struct CommandBarrierAttached *) message;
355 barrier_name = (const char *) &am[1];
356 barrier = GNUNET_TESTING_get_barrier_ (ns->is,
357 barrier_name);
358 GNUNET_assert (NULL != barrier);
359 node = GNUNET_TESTING_barrier_get_node (barrier,
360 am->node_number);
361 if (NULL == node)
362 {
363 node = GNUNET_new (struct GNUNET_TESTING_NetjailNode);
364 node->node_number = am->node_number;
365
366 GNUNET_CRYPTO_hash (&(node->node_number), sizeof(node->node_number), &hc);
367 memcpy (&key, &hc, sizeof (key));
368 GNUNET_CONTAINER_multishortmap_put (barrier->nodes,
369 &key,
370 node,
371 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
372 }
373 node->expected_reaches = node->expected_reaches + am->expected_reaches;
374 barrier->expected_reaches = barrier->expected_reaches + am->expected_reaches;
375}
376
377
378void
379barrier_reached (struct NetJailState *ns,
380 const struct GNUNET_MessageHeader *message)
381{
382 struct GNUNET_TESTING_Barrier *barrier;
383 const char *barrier_name;
384 const struct GNUNET_TESTING_CommandBarrierReached *rm;
385
386 rm = (const struct GNUNET_TESTING_CommandBarrierReached *) message;
387 barrier_name = (const char *) &rm[1];
388 barrier = GNUNET_TESTING_get_barrier_ (ns->is,
389 barrier_name);
390 GNUNET_assert (NULL != barrier);
391 LOG (GNUNET_ERROR_TYPE_DEBUG,
392 "barrier %s reached %p %u\n",
393 barrier_name,
394 barrier,
395 barrier->reached);
396 barrier->reached++;
397 LOG (GNUNET_ERROR_TYPE_DEBUG,
398 "%u %p\n",
399 barrier->reached,
400 barrier);
401 if (GNUNET_TESTING_barrier_crossable_ (barrier))
402 {
403 LOG (GNUNET_ERROR_TYPE_DEBUG,
404 "%s can be crossed\n",
405 barrier_name);
406 GNUNET_TESTING_finish_barrier_ (ns->is,
407 barrier->name);
408 }
409 LOG (GNUNET_ERROR_TYPE_DEBUG,
410 "barrier %s reached finished\n",
411 barrier_name);
412}
413
414
415/**
416 * Functions with this signature are called whenever a
417 * complete message is received by the tokenizer.
418 *
419 * Do not call GNUNET_SERVER_mst_destroy in callback
420 *
421 * @param cls closure
422 * @param client identification of the client
423 * @param message the actual message
424 *
425 * @return #GNUNET_OK on success, #GNUNET_SYSERR to stop further processing
426 */
427static int
428helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
429{
430 struct NetJailState *ns = cls;
431 unsigned int total_number = ns->local_m * ns->global_n + ns->known;
432 uint16_t message_type = ntohs (message->type);
433 struct GNUNET_TESTING_CommandLocalFinished *lf;
434
435 switch (message_type)
436 {
437 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_ATTACHED:
438 barrier_attached (ns, message);
439 break;
440 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_REACHED:
441 barrier_reached (ns, message);
442 break;
443 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY:
444 ns->number_of_testsystems_started++;
445 break;
446 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED:
447 ns->number_of_peers_started++;
448 if (ns->number_of_peers_started == total_number)
449 {
450 for (int i = 1; i <= ns->known; i++)
451 {
452 send_all_peers_started (0,i, ns);
453 }
454 for (int i = 1; i <= ns->global_n; i++)
455 {
456 for (int j = 1; j <= ns->local_m; j++)
457 {
458 send_all_peers_started (i,j, ns);
459 }
460 }
461 ns->number_of_peers_started = 0;
462 }
463 break;
464 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED:
465 ns->number_of_local_tests_prepared++;
466 if (ns->number_of_local_tests_prepared == total_number)
467 {
468 for (int i = 1; i <= ns->known; i++)
469 {
470 send_all_local_tests_prepared (0,i, ns);
471 }
472
473 for (int i = 1; i <= ns->global_n; i++)
474 {
475 for (int j = 1; j <= ns->local_m; j++)
476 {
477 send_all_local_tests_prepared (i,j, ns);
478 }
479 }
480 }
481 break;
482 case GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED:
483 lf = (struct GNUNET_TESTING_CommandLocalFinished *) message;
484
485 ns->number_of_local_tests_finished++;
486 if (GNUNET_OK != lf->rv)
487 {
488 GNUNET_TESTING_async_fail (&(ns->ac));
489 }
490 else if (ns->number_of_local_tests_finished == total_number)
491 {
492 GNUNET_SCHEDULER_cancel (ns->timeout_task);
493 ns->timeout_task = NULL;
494 GNUNET_TESTING_async_finish (&ns->ac);
495 }
496 break;
497 default:
498 // We received a message we can not handle.
499 GNUNET_assert (0);
500 }
501
502 LOG (GNUNET_ERROR_TYPE_DEBUG,
503 "total %u sysstarted %u peersstarted %u prep %u finished %u %u %u %u\n",
504 total_number,
505 ns->number_of_testsystems_started,
506 ns->number_of_peers_started,
507 ns->number_of_local_tests_prepared,
508 ns->number_of_local_tests_finished,
509 ns->local_m,
510 ns->global_n,
511 ns->known);
512
513
514 return GNUNET_OK;
515}
516
517
518/**
519 * Callback called if there was an exception during execution of the helper.
520 *
521 */
522static void
523exp_cb (void *cls)
524{
525 struct NetJailState *ns = cls;
526
527 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called exp_cb.\n");
528 if (NULL != ns->timeout_task)
529 GNUNET_SCHEDULER_cancel (ns->timeout_task);
530 GNUNET_TESTING_async_fail (&(ns->ac));
531}
532
533
534/**
535 * Function to initialize a init message for the helper.
536 *
537 * @param plugin_name Name of the test case plugin the helper will load.
538 *
539 */
540static struct GNUNET_TESTING_CommandHelperInit *
541create_helper_init_msg_ (const char *plugin_name)
542{
543 struct GNUNET_TESTING_CommandHelperInit *msg;
544 uint16_t plugin_name_len;
545 uint16_t msg_size;
546
547 GNUNET_assert (NULL != plugin_name);
548 plugin_name_len = strlen (plugin_name);
549 msg_size = sizeof(struct GNUNET_TESTING_CommandHelperInit) + plugin_name_len;
550 msg = GNUNET_malloc (msg_size);
551 msg->header.size = htons (msg_size);
552 msg->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT);
553 msg->plugin_name_size = htons (plugin_name_len);
554 GNUNET_memcpy ((char *) &msg[1],
555 plugin_name,
556 plugin_name_len);
557 return msg;
558}
559
560
561/**
562 * Function which start a single helper process.
563 *
564 */
565static void
566start_helper (struct NetJailState *ns,
567 unsigned int m,
568 unsigned int n)
569{
570 struct TestcasePlugin *plugin;
571 struct GNUNET_HELPER_Handle *helper;
572 struct GNUNET_TESTING_CommandHelperInit *msg;
573 struct TestingSystemCount *tbc;
574 char *m_char;
575 char *n_char;
576 char *global_n_char;
577 char *local_m_char;
578 char *known_char;
579 char *node_id;
580 char *plugin_name;
581 char *read_file;
582 pid_t pid;
583 unsigned int script_num;
584 struct GNUNET_ShortHashCode *hkey;
585 struct GNUNET_ShortHashCode key;
586 struct GNUNET_HashCode hc;
587 struct GNUNET_TESTING_NetjailTopology *topology = ns->topology;
588 struct GNUNET_TESTING_NetjailNode *node;
589 struct GNUNET_TESTING_NetjailNode *barrier_node;
590 struct GNUNET_TESTING_NetjailNamespace *namespace;
591 char *data_dir;
592 char *script_name;
593 struct GNUNET_TESTING_BarrierListEntry *pos;
594 struct GNUNET_TESTING_Barrier *barrier;
595 struct GNUNET_TESTING_BarrierList *barriers;
596 unsigned int node_num;
597 char *binary_path;
598
599 if (0 == n)
600 {
601 node_num = m;
602 script_num = m - 1;
603 }
604 else
605 {
606 node_num = (n - 1) * ns->local_m + m + ns->known;
607 script_num = n - 1 + (n - 1) * ns->local_m + m + ns->known;
608 }
609 pid = getpid ();
610
611 GNUNET_asprintf (&m_char, "%u", m);
612 GNUNET_asprintf (&n_char, "%u", n);
613 GNUNET_asprintf (&local_m_char, "%u", ns->local_m);
614 GNUNET_asprintf (&global_n_char, "%u",ns->global_n);
615 GNUNET_asprintf (&known_char, "%u",ns->known);
616 GNUNET_asprintf (&node_id, "%s%06x-%06x\n",
617 "if",
618 pid,
619 script_num);
620 // GNUNET_asprintf (&topology_data, "'%s'", ns->topology_data);
621 GNUNET_asprintf (&read_file,
622 "%u",
623 *(ns->read_file));
624
625 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
626 GNUNET_asprintf (&script_name,
627 "%s%s",
628 data_dir,
629 NETJAIL_EXEC_SCRIPT);
630 unsigned int helper_check = GNUNET_OS_check_helper_binary (
631 script_name,
632 GNUNET_YES,
633 NULL);
634
635 tbc = GNUNET_new (struct TestingSystemCount);
636 tbc->ns = ns;
637
638 if (GNUNET_NO == helper_check)
639 {
640 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
641 "No SUID for %s!\n",
642 script_name);
643 GNUNET_TESTING_interpreter_fail (ns->is);
644 // FIXME: why continue here, instead of returning?
645 }
646 else if (GNUNET_NO == helper_check)
647 {
648 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
649 "%s not found!\n",
650 script_name);
651 GNUNET_TESTING_interpreter_fail (ns->is);
652 }
653
654 binary_path = GNUNET_OS_get_libexec_binary_path (HELPER_CMDS_BINARY);
655
656 LOG (GNUNET_ERROR_TYPE_DEBUG,
657 "sysstarted %u peersstarted %u prep %u finished %u %u %u %u\n",
658 ns->number_of_testsystems_started,
659 ns->number_of_peers_started,
660 ns->number_of_local_tests_prepared,
661 ns->number_of_local_tests_finished,
662 ns->local_m,
663 ns->global_n,
664 ns->known);
665 {
666 char *const script_argv[] = {script_name,
667 m_char,
668 n_char,
669 binary_path,
670 global_n_char,
671 local_m_char,
672 node_id,
673 read_file,
674 ns->topology_data,
675 NULL};
676 helper = GNUNET_HELPER_start (
677 GNUNET_YES,
678 script_name,
679 script_argv,
680 &helper_mst,
681 &exp_cb,
682 ns);
683 GNUNET_array_append (ns->helper,
684 ns->n_helper,
685 helper);
686 }
687 GNUNET_TESTING_add_netjail_helper_ (ns->is,
688 helper);
689 plugin_name = topology->plugin;
690
691 hkey = GNUNET_new (struct GNUNET_ShortHashCode);
692 node = NULL;
693 if (0 == n)
694 {
695 GNUNET_CRYPTO_hash (&m,
696 sizeof(m),
697 &hc);
698 memcpy (hkey,
699 &hc,
700 sizeof (*hkey));
701 if (1 == GNUNET_CONTAINER_multishortmap_contains (topology->map_globals,
702 hkey))
703 {
704 node = GNUNET_CONTAINER_multishortmap_get (topology->map_globals,
705 hkey);
706 if (NULL != node->plugin)
707 plugin_name = node->plugin;
708 }
709 }
710 else
711 {
712 GNUNET_CRYPTO_hash (&n, sizeof(n), &hc);
713 memcpy (hkey,
714 &hc,
715 sizeof (*hkey));
716 if (1 == GNUNET_CONTAINER_multishortmap_contains (topology->map_namespaces,
717 hkey))
718 {
719 namespace = GNUNET_CONTAINER_multishortmap_get (topology->map_namespaces,
720 hkey);
721 GNUNET_CRYPTO_hash (&m, sizeof(m), &hc);
722 memcpy (hkey,
723 &hc,
724 sizeof (*hkey));
725 if (1 == GNUNET_CONTAINER_multishortmap_contains (namespace->nodes,
726 hkey))
727 {
728 node = GNUNET_CONTAINER_multishortmap_get (namespace->nodes,
729 hkey);
730 if (NULL != node->plugin)
731 plugin_name = node->plugin;
732 }
733 }
734
735
736 }
737 GNUNET_assert (NULL != node);
738 node->node_number = node_num;
739 plugin = GNUNET_new (struct TestcasePlugin);
740 plugin->api = GNUNET_PLUGIN_load (plugin_name,
741 NULL);
742 barriers = plugin->api->get_waiting_for_barriers ();
743
744
745 for (pos = barriers->head; NULL != pos; pos = pos->next)
746 {
747 barrier = GNUNET_TESTING_get_barrier_ (ns->is,
748 pos->barrier_name);
749 if (NULL == barrier)
750 {
751 barrier = GNUNET_new (struct GNUNET_TESTING_Barrier);
752 barrier->name = pos->barrier_name;
753 barrier->shadow = GNUNET_YES;
754 GNUNET_TESTING_add_barrier_ (ns->is,
755 barrier);
756 }
757 barrier_node = GNUNET_new (struct GNUNET_TESTING_NetjailNode);
758 barrier_node->node_number = node->node_number;
759 barrier_node->expected_reaches = pos->expected_reaches;
760 barrier->expected_reaches = barrier->expected_reaches
761 + pos->expected_reaches;
762 if (GNUNET_YES == barrier->shadow)
763 barrier->number_to_be_reached++;
764 LOG (GNUNET_ERROR_TYPE_DEBUG,
765 "Adding barrier %p %s node %u with reach target %u\n",
766 barrier,
767 pos->barrier_name,
768 node->node_number,
769 barrier->number_to_be_reached);
770 GNUNET_CRYPTO_hash (&node->node_number,
771 sizeof(node->node_number),
772 &hc);
773 memcpy (&key, &hc, sizeof (key));
774 if (NULL == barrier->nodes)
775 barrier->nodes
776 = GNUNET_CONTAINER_multishortmap_create (16,
777 GNUNET_NO);
778 GNUNET_CONTAINER_multishortmap_put (barrier->nodes,
779 &key,
780 barrier_node,
781 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
782 }
783
784 tbc->plugin = plugin;
785 msg = create_helper_init_msg_ (plugin_name);
786 tbc->shandle = GNUNET_HELPER_send (
787 helper,
788 &msg->header,
789 GNUNET_NO,
790 &clear_msg,
791 tbc);
792
793 if (NULL == tbc->shandle)
794 {
795 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
796 "Send handle is NULL!\n");
797 GNUNET_TESTING_interpreter_fail (ns->is);
798 }
799 GNUNET_free (pos);
800 GNUNET_free (binary_path);
801 GNUNET_free (hkey);
802 GNUNET_free (msg);
803 GNUNET_free (m_char);
804 GNUNET_free (n_char);
805 GNUNET_free (local_m_char);
806 GNUNET_free (global_n_char);
807 GNUNET_free (known_char);
808 GNUNET_free (node_id);
809 GNUNET_free (read_file);
810 GNUNET_free (data_dir);
811 GNUNET_free (script_name);
812 GNUNET_free (barriers);
813}
814
815
816/**
817 * Function run when the cmd terminates (good or bad) with timeout.
818 *
819 * @param cls the interpreter state
820 */
821static void
822do_timeout (void *cls)
823{
824 struct NetJailState *ns = cls;
825 struct GNUNET_TESTING_Command *cmd;
826
827 ns->timeout_task = NULL;
828 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
829 "Terminating cmd due to global timeout\n");
830 cmd = GNUNET_TESTING_interpreter_get_current_command (ns->is);
831 GNUNET_TESTING_async_finish (cmd->ac);
832}
833
834
835/**
836* This function starts a helper process for each node.
837*
838* @param cls closure.
839* @param cmd CMD being run.
840* @param is interpreter state.
841*/
842static void
843netjail_exec_run (void *cls,
844 struct GNUNET_TESTING_Interpreter *is)
845{
846 struct NetJailState *ns = cls;
847
848 ns->is = is;
849 for (int i = 1; i <= ns->known; i++)
850 {
851 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
852 "i %u\n",
853 i);
854 start_helper (ns,
855 i,
856 0);
857 }
858
859 for (int i = 1; i <= ns->global_n; i++)
860 {
861 for (int j = 1; j <= ns->local_m; j++)
862 {
863 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
864 "i %u j %u\n",
865 i,
866 j);
867 start_helper (ns,
868 j,
869 i);
870 }
871 }
872 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
873 "Adding timeout %s\n",
874 GNUNET_STRINGS_relative_time_to_string (ns->timeout, GNUNET_NO));
875 ns->timeout_task
876 = GNUNET_SCHEDULER_add_delayed (ns->timeout,
877 &do_timeout,
878 ns);
879}
880
881
882/**
883 * Create command.
884 *
885 * @param label Name for the command.
886 * @param topology The complete topology information.
887 * @param read_file Flag indicating if the the name of the topology file is send to the helper, or a string with the topology data.
888 * @param topology_data If read_file is GNUNET_NO, topology_data holds the string with the topology.
889 * @param timeout Before this timeout is reached this cmd MUST finish.
890 * @return command.
891 */
892struct GNUNET_TESTING_Command
893GNUNET_TESTING_cmd_netjail_start_cmds_helper (
894 const char *label,
895 struct GNUNET_TESTING_NetjailTopology *topology,
896 unsigned int *read_file,
897 char *topology_data,
898 struct GNUNET_TIME_Relative timeout)
899{
900 struct NetJailState *ns;
901
902 ns = GNUNET_new (struct NetJailState);
903 ns->local_m = topology->nodes_m;
904 ns->global_n = topology->namespaces_n;
905 ns->known = topology->nodes_x;
906 ns->plugin_name = topology->plugin;
907 ns->topology = topology;
908 ns->read_file = read_file;
909 ns->topology_data = topology_data;
910 ns->timeout = GNUNET_TIME_relative_subtract (timeout, TIMEOUT);
911
912 return GNUNET_TESTING_command_new (ns, label,
913 &netjail_exec_run,
914 &netjail_exec_cleanup,
915 &netjail_exec_traits,
916 &ns->ac);
917}
diff --git a/src/service/testing/testing_api_cmd_netjail_stop.c b/src/service/testing/testing_api_cmd_netjail_stop.c
deleted file mode 100644
index cc05617f7..000000000
--- a/src/service/testing/testing_api_cmd_netjail_stop.c
+++ /dev/null
@@ -1,200 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_cmd_netjail_stop.c
23 * @brief Command to stop the netjail script.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
31#include "gnunet_testing_netjail_lib.h"
32
33
34#define NETJAIL_STOP_SCRIPT "netjail_stop.sh"
35
36/**
37 * Struct to hold information for callbacks.
38 *
39 */
40struct NetJailState
41{
42 /**
43 * Context for our asynchronous completion.
44 */
45 struct GNUNET_TESTING_AsyncContext ac;
46
47 // Child Wait handle
48 struct GNUNET_ChildWaitHandle *cwh;
49
50 /**
51 * Configuration file for the test topology.
52 */
53 char *topology_config;
54
55 /**
56 * The process id of the start script.
57 */
58 struct GNUNET_OS_Process *stop_proc;
59
60 /**
61 * Shall we read the topology from file, or from a string.
62 */
63 unsigned int *read_file;
64
65};
66
67
68/**
69 * The cleanup function of this cmd frees resources the cmd allocated.
70 *
71 */
72static void
73netjail_stop_cleanup (void *cls)
74{
75 struct NetJailState *ns = cls;
76
77 if (NULL != ns->cwh)
78 {
79 GNUNET_wait_child_cancel (ns->cwh);
80 ns->cwh = NULL;
81 }
82 if (NULL != ns->stop_proc)
83 {
84 GNUNET_assert (0 ==
85 GNUNET_OS_process_kill (ns->stop_proc,
86 SIGKILL));
87 GNUNET_assert (GNUNET_OK ==
88 GNUNET_OS_process_wait (ns->stop_proc));
89 GNUNET_OS_process_destroy (ns->stop_proc);
90 ns->stop_proc = NULL;
91 }
92 GNUNET_free (ns);
93}
94
95
96/**
97 * Callback which will be called if the setup script finished.
98 *
99 */
100static void
101child_completed_callback (void *cls,
102 enum GNUNET_OS_ProcessStatusType type,
103 long unsigned int exit_code)
104{
105 struct NetJailState *ns = cls;
106
107 ns->cwh = NULL;
108 GNUNET_OS_process_destroy (ns->stop_proc);
109 ns->stop_proc = NULL;
110 if (0 == exit_code)
111 {
112 GNUNET_TESTING_async_finish (&ns->ac);
113 }
114 else
115 {
116 GNUNET_TESTING_async_fail (&ns->ac);
117 }
118}
119
120
121/**
122* The run method starts the script which deletes the network namespaces.
123*
124* @param cls closure.
125* @param is interpreter state.
126*/
127static void
128netjail_stop_run (void *cls,
129 struct GNUNET_TESTING_Interpreter *is)
130{
131 struct NetJailState *ns = cls;
132 char *pid;
133 char *data_dir;
134 char *script_name;
135 char *read_file;
136
137
138 data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
139 GNUNET_asprintf (&script_name, "%s%s", data_dir, NETJAIL_STOP_SCRIPT);
140 GNUNET_asprintf (&read_file, "%u", *(ns->read_file));
141 unsigned int helper_check = GNUNET_OS_check_helper_binary (
142 script_name,
143 GNUNET_YES,
144 NULL);
145
146 if (GNUNET_NO == helper_check)
147 {
148 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
149 "No SUID for %s!\n",
150 script_name);
151 GNUNET_TESTING_interpreter_fail (is);
152 }
153 else if (GNUNET_NO == helper_check)
154 {
155 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
156 "%s not found!\n",
157 script_name);
158 GNUNET_TESTING_interpreter_fail (is);
159 }
160
161 GNUNET_asprintf (&pid,
162 "%u",
163 getpid ());
164 {
165 char *const script_argv[] = {script_name,
166 ns->topology_config,
167 pid,
168 read_file,
169 NULL};
170 ns->stop_proc = GNUNET_OS_start_process_vap (GNUNET_OS_INHERIT_STD_ERR,
171 NULL,
172 NULL,
173 NULL,
174 script_name,
175 script_argv);
176 }
177 ns->cwh = GNUNET_wait_child (ns->stop_proc,
178 &child_completed_callback,
179 ns);
180 GNUNET_break (NULL != ns->cwh);
181 GNUNET_free (read_file);
182 GNUNET_free (pid);
183}
184
185
186struct GNUNET_TESTING_Command
187GNUNET_TESTING_cmd_netjail_stop (const char *label,
188 char *topology_config,
189 unsigned int *read_file)
190{
191 struct NetJailState *ns;
192
193 ns = GNUNET_new (struct NetJailState);
194 ns->topology_config = topology_config;
195 ns->read_file = read_file;
196 return GNUNET_TESTING_command_new (ns, label,
197 &netjail_stop_run,
198 &netjail_stop_cleanup,
199 NULL, &ns->ac);
200}
diff --git a/src/service/testing/testing_api_cmd_netjail_stop_cmds_helper.c b/src/service/testing/testing_api_cmd_netjail_stop_cmds_helper.c
deleted file mode 100644
index c6bb0ab52..000000000
--- a/src/service/testing/testing_api_cmd_netjail_stop_cmds_helper.c
+++ /dev/null
@@ -1,157 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_cmd_hello_world.c
23 * @brief Command to start the netjail peers.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_testing_ng_lib.h"
28#include "gnunet_testing_plugin.h"
29#include "gnunet_testing_barrier.h"
30#include "gnunet_testing_netjail_lib.h"
31#include "testing_cmds.h"
32
33
34/**
35 * Struct to store information handed over to callbacks.
36 *
37 */
38struct StopHelperState
39{
40
41 /**
42 * The complete topology information.
43 */
44 struct GNUNET_TESTING_NetjailTopology *topology;
45
46 const char *helper_start_label;
47
48 /**
49 * The process handle
50 */
51 struct GNUNET_HELPER_Handle **helper;
52
53 unsigned int local_m;
54
55 unsigned int global_n;
56
57 /**
58 * Number of global known nodes.
59 *
60 */
61 unsigned int known;
62};
63
64
65/**
66* Code to clean up resource this cmd used.
67*
68* @param cls closure
69* @param cmd current CMD being cleaned up.
70*/
71static void
72stop_testing_system_cleanup (void *cls)
73{
74 struct StopHelperState *shs = cls;
75
76 GNUNET_free (shs);
77}
78
79
80/**
81* This function stops the helper process for each node.
82*
83* @param cls closure.
84* @param is interpreter state.
85*/
86static void
87stop_testing_system_run (void *cls,
88 struct GNUNET_TESTING_Interpreter *is)
89{
90 struct StopHelperState *shs = cls;
91 const struct GNUNET_HELPER_Handle **helper;
92 const struct GNUNET_TESTING_Command *start_helper_cmd;
93
94 start_helper_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
95 shs->
96 helper_start_label);
97 GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd,
98 &helper);
99
100 for (int i = 1; i <= shs->known; i++)
101 {
102 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
103 "i: %u\n",
104 i);
105 GNUNET_HELPER_stop (
106 (struct GNUNET_HELPER_Handle *) helper[i - 1],
107 GNUNET_YES);
108 }
109
110 for (int i = 1; i <= shs->global_n; i++)
111 {
112 for (int j = 1; j <= shs->local_m; j++)
113 {
114 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
115 "i: %u j: %u\n",
116 i,
117 j);
118 GNUNET_HELPER_stop ((struct GNUNET_HELPER_Handle *) helper[(i - 1)
119 * shs->local_m
120 + j
121 + shs->known
122 - 1],
123 GNUNET_YES);
124 }
125 }
126 GNUNET_free (helper);
127}
128
129
130/**
131 * Create command.
132 *
133 * @param label name for command.
134 * @param helper_start_label label of the cmd to start the test system.
135 * @param topology The complete topology information.
136 * @return command.
137 */
138struct GNUNET_TESTING_Command
139GNUNET_TESTING_cmd_stop_cmds_helper (
140 const char *label,
141 const char *helper_start_label,
142 struct GNUNET_TESTING_NetjailTopology *topology)
143{
144 struct StopHelperState *shs;
145
146 shs = GNUNET_new (struct StopHelperState);
147 shs->helper_start_label = helper_start_label;
148 shs->local_m = topology->nodes_m;
149 shs->global_n = topology->namespaces_n;
150 shs->known = topology->nodes_x;
151 shs->topology = topology;
152
153 return GNUNET_TESTING_command_new (shs, label,
154 &stop_testing_system_run,
155 &stop_testing_system_cleanup,
156 NULL, NULL);
157}
diff --git a/src/service/testing/testing_api_cmd_send_peer_ready.c b/src/service/testing/testing_api_cmd_send_peer_ready.c
deleted file mode 100644
index f615a1cee..000000000
--- a/src/service/testing/testing_api_cmd_send_peer_ready.c
+++ /dev/null
@@ -1,123 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_send_peer_ready.c
23 * @brief cmd to send a helper message if peer is ready.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_barrier.h"
31#include "gnunet_testing_netjail_lib.h"
32#include "testing_cmds.h"
33
34
35/**
36 * Struct to hold information for callbacks.
37 *
38 */
39struct SendPeerReadyState
40{
41 /**
42 * Callback to write messages to the master loop.
43 *
44 */
45 GNUNET_TESTING_cmd_helper_write_cb write_message;
46
47 /**
48 * The message send back to the master loop.
49 *
50 */
51 struct GNUNET_TESTING_CommandPeerStarted *reply;
52};
53
54
55/**
56 * Trait function of this cmd does nothing.
57 *
58 */
59static enum GNUNET_GenericReturnValue
60send_peer_ready_traits (void *cls,
61 const void **ret,
62 const char *trait,
63 unsigned int index)
64{
65 return GNUNET_NO;
66}
67
68
69/**
70 * The cleanup function of this cmd frees resources the cmd allocated.
71 *
72 */
73static void
74send_peer_ready_cleanup (void *cls)
75{
76 struct SendPeerReadyState *sprs = cls;
77
78 GNUNET_free (sprs);
79}
80
81
82/**
83 * This function sends a GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED message to the master loop.
84 *
85 */
86static void
87send_peer_ready_run (void *cls,
88 struct GNUNET_TESTING_Interpreter *is)
89{
90 struct SendPeerReadyState *sprs = cls;
91 struct GNUNET_TESTING_CommandPeerStarted *reply;
92 size_t msg_length;
93
94 msg_length = sizeof(struct GNUNET_TESTING_CommandPeerStarted);
95 reply = GNUNET_new (struct GNUNET_TESTING_CommandPeerStarted);
96 reply->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED);
97 reply->header.size = htons ((uint16_t) msg_length);
98 sprs->reply = reply;
99 sprs->write_message ((struct GNUNET_MessageHeader *) reply, msg_length);
100}
101
102
103/**
104 * Create command.
105 *
106 * @param label name for command.
107 * @param write_message Callback to write messages to the master loop.
108 * @return command.
109 */
110struct GNUNET_TESTING_Command
111GNUNET_TESTING_cmd_send_peer_ready (const char *label,
112 GNUNET_TESTING_cmd_helper_write_cb
113 write_message)
114{
115 struct SendPeerReadyState *sprs;
116
117 sprs = GNUNET_new (struct SendPeerReadyState);
118 sprs->write_message = write_message;
119 return GNUNET_TESTING_command_new (sprs, label,
120 &send_peer_ready_run,
121 &send_peer_ready_cleanup,
122 &send_peer_ready_traits, NULL);
123}
diff --git a/src/service/testing/testing_api_cmd_system_destroy.c b/src/service/testing/testing_api_cmd_system_destroy.c
deleted file mode 100644
index 45adfd0da..000000000
--- a/src/service/testing/testing_api_cmd_system_destroy.c
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_system_destroy.c
23 * @brief cmd to destroy a testing system handle.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_testing_plugin.h"
30#include "gnunet_testing_netjail_lib.h"
31#include "gnunet_testing_lib.h"
32
33
34/**
35 * Struct to hold information for callbacks.
36 *
37 */
38struct TestSystemState
39{
40 // Label of the cmd which started the test system.
41 const char *create_label;
42};
43
44
45/**
46 * The run method of this cmd will remove the test environment for a node.
47 *
48 */
49static void
50system_destroy_run (void *cls,
51 struct GNUNET_TESTING_Interpreter *is)
52{
53 struct TestSystemState *tss = cls;
54 const struct GNUNET_TESTING_Command *system_cmd;
55 const struct GNUNET_TESTING_System *tl_system;
56
57 system_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
58 tss->create_label);
59 GNUNET_TESTING_get_trait_test_system (system_cmd,
60 &tl_system);
61 GNUNET_TESTING_system_destroy ((struct GNUNET_TESTING_System *) tl_system,
62 GNUNET_YES);
63}
64
65
66/**
67 * The cleanup function of this cmd frees resources the cmd allocated.
68 *
69 */
70static void
71system_destroy_cleanup (void *cls)
72{
73 struct TestSystemState *tss = cls;
74
75 GNUNET_free (tss);
76}
77
78
79/**
80 * Trait function of this cmd does nothing.
81 *
82 */
83static enum GNUNET_GenericReturnValue
84system_destroy_traits (void *cls,
85 const void **ret,
86 const char *trait,
87 unsigned int index)
88{
89 return GNUNET_OK;
90}
91
92
93/**
94 * Create command.
95 *
96 * @param label name for command.
97 * @param create_label Label of the cmd which started the test system.
98 * @return command.
99 */
100struct GNUNET_TESTING_Command
101GNUNET_TESTING_cmd_system_destroy (const char *label,
102 const char *create_label)
103{
104 struct TestSystemState *tss;
105
106 tss = GNUNET_new (struct TestSystemState);
107 tss->create_label = create_label;
108 return GNUNET_TESTING_command_new (tss, label, &system_destroy_run,
109 &system_destroy_cleanup,
110 &system_destroy_traits, NULL);
111}
diff --git a/src/service/testing/testing_api_loop.c b/src/service/testing/testing_api_loop.c
deleted file mode 100644
index beb9b9060..000000000
--- a/src/service/testing/testing_api_loop.c
+++ /dev/null
@@ -1,893 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021-2023 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_api_loop.c
23 * @brief main interpreter loop for testcases
24 * @author Christian Grothoff (GNU Taler testing)
25 * @author Marcello Stanisci (GNU Taler testing)
26 * @author t3sserakt
27 */
28#include "platform.h"
29#include "gnunet_util_lib.h"
30#include "gnunet_testing_ng_lib.h"
31#include "gnunet_testing_plugin.h"
32#include "gnunet_testing_barrier.h"
33#include "gnunet_testing_netjail_lib.h"
34#include "testing.h"
35
36/**
37 * Global state of the interpreter, used by a command
38 * to access information about other commands.
39 */
40struct GNUNET_TESTING_Interpreter
41{
42 /**
43 * Array with handles of helper processes for communication with netjails.
44 */
45 const struct GNUNET_HELPER_Handle **helper;
46
47 /**
48 * Handle to a send op
49 */
50 struct GNUNET_HELPER_SendHandle *send_handle;
51
52 /**
53 * Function to call with the test result.
54 */
55 GNUNET_TESTING_ResultCallback rc;
56
57 /**
58 * Closure for @e rc.
59 */
60 void *rc_cls;
61
62 /**
63 * Commands the interpreter will run.
64 */
65 struct GNUNET_TESTING_Command *commands;
66
67 /**
68 * Map with barriers for this loop.
69 */
70 struct GNUNET_CONTAINER_MultiShortmap *barriers;
71
72 /**
73 * Interpreter task (if one is scheduled).
74 */
75 struct GNUNET_SCHEDULER_Task *task;
76
77 /**
78 * Final task that returns the result.
79 */
80 struct GNUNET_SCHEDULER_Task *final_task;
81
82 /**
83 * Task run on timeout.
84 */
85 struct GNUNET_SCHEDULER_Task *timeout_task;
86
87 /**
88 * Number of GNUNET_TESTING_Command in @e commands.
89 */
90 unsigned int cmds_n;
91
92 /**
93 * Size of the array @e helper.
94 */
95 unsigned int n_helper;
96
97 /**
98 * Instruction pointer. Tells #interpreter_run() which instruction to run
99 * next. Need (signed) int because it gets -1 when rewinding the
100 * interpreter to the first CMD.
101 */
102 int ip;
103
104 /**
105 * Result of the testcases, #GNUNET_OK on success
106 */
107 enum GNUNET_GenericReturnValue result;
108
109 /**
110 * Is the interpreter finishing?
111 */
112 bool finishing;
113
114};
115
116
117/**
118 * Lookup command by label.
119 *
120 * @param is interpreter to lookup command in
121 * @param label label of the command to lookup.
122 * @param future true to look into the future, false to look into the past
123 * @return the command, if it is found, or NULL.
124 */
125static const struct GNUNET_TESTING_Command *
126get_command (struct GNUNET_TESTING_Interpreter *is,
127 const char *label,
128 bool future)
129{
130 int start_i = future ? is->cmds_n - 1 : is->ip;
131 int end_i = future ? is->ip + 1 : 0;
132
133 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
134 "start_i: %u end_i: %u\n",
135 start_i,
136 end_i);
137 if (NULL == label)
138 {
139 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
140 "Attempt to lookup command for empty label\n");
141 return NULL;
142 }
143 for (int i = start_i; i >= end_i; i--)
144 {
145 const struct GNUNET_TESTING_Command *cmd = &is->commands[i];
146
147 if (NULL != cmd->run)
148 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
149 "label to compare %s\n",
150 cmd->label.value);
151 /* Give precedence to top-level commands. */
152 if ( (NULL != cmd->run) &&
153 (0 == strcmp (cmd->label.value,
154 label)) )
155 return cmd;
156
157 if (GNUNET_TESTING_cmd_is_batch_ (cmd))
158 {
159 struct GNUNET_TESTING_Command **batch;
160 struct GNUNET_TESTING_Command *current;
161 const struct GNUNET_TESTING_Command *icmd;
162 const struct GNUNET_TESTING_Command *match;
163
164 current = GNUNET_TESTING_cmd_batch_get_current_ (cmd);
165 GNUNET_assert (GNUNET_OK ==
166 GNUNET_TESTING_get_trait_batch_cmds (cmd,
167 &batch));
168 /* We must do the loop forward, but we can find the last match */
169 match = NULL;
170 for (unsigned int j = 0;
171 NULL != (icmd = &(*batch)[j])->run;
172 j++)
173 {
174 if (current == icmd)
175 break; /* do not go past current command */
176 if ( (NULL != icmd->run) &&
177 (0 == strcmp (icmd->label.value,
178 label)) )
179 match = icmd;
180 }
181 if (NULL != match)
182 return match;
183 }
184 }
185 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
186 "Command `%s' not found\n",
187 label);
188 return NULL;
189}
190
191
192const struct GNUNET_TESTING_Command *
193GNUNET_TESTING_interpreter_lookup_future_command (
194 struct GNUNET_TESTING_Interpreter *is,
195 const char *label)
196{
197 return get_command (is,
198 label,
199 true);
200}
201
202
203const struct GNUNET_TESTING_Command *
204GNUNET_TESTING_interpreter_lookup_command (
205 struct GNUNET_TESTING_Interpreter *is,
206 const char *label)
207{
208 return get_command (is,
209 label,
210 false);
211}
212
213
214const struct GNUNET_TESTING_Command *
215GNUNET_TESTING_interpreter_lookup_command_all (
216 struct GNUNET_TESTING_Interpreter *is,
217 const char *label)
218{
219 const struct GNUNET_TESTING_Command *cmd;
220
221 cmd = get_command (is,
222 label,
223 false);
224 if (NULL == cmd)
225 cmd = get_command (is,
226 label,
227 true);
228 return cmd;
229}
230
231
232/**
233 * Continuation function from GNUNET_HELPER_send()
234 *
235 * @param cls closure
236 * @param result #GNUNET_OK on success,
237 * #GNUNET_NO if helper process died
238 * #GNUNET_SYSERR during GNUNET_HELPER_stop()
239 */
240static void
241clear_msg (void *cls,
242 enum GNUNET_GenericReturnValue result)
243{
244 GNUNET_assert (GNUNET_YES == result);
245}
246
247
248/**
249 * Send message to a netjail node that a barrier can be crossed.
250 *
251 * @param is The interpreter loop.
252 * @param barrier_name The name of the barrier to cross.
253 * @param global_node_number The global number of the node to inform.
254 */
255static void
256send_barrier_crossable (struct GNUNET_TESTING_Interpreter *is,
257 const char *barrier_name,
258 unsigned int global_node_number)
259{
260 struct CommandBarrierCrossable *adm;
261 size_t msg_length;
262 size_t name_len;
263
264 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
265 "send barrier crossable for barrier `%s'\n",
266 barrier_name);
267 name_len = strlen (barrier_name);
268 msg_length = sizeof(struct CommandBarrierCrossable) + name_len + 1;
269 adm = GNUNET_malloc (msg_length);
270 adm->header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE);
271 adm->header.size = htons ((uint16_t) msg_length);
272 memcpy (&adm[1], barrier_name, name_len);
273 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
274 "send message of type %u to locals\n",
275 ntohs (adm->header.type));
276 /**
277 FIXME: This should probably be put into a linked list
278 inside is and cleaned up at some point.
279 */
280 is->send_handle = GNUNET_HELPER_send (
281 (struct GNUNET_HELPER_Handle *) is->helper[global_node_number - 1],
282 &adm->header,
283 GNUNET_NO,
284 &clear_msg,
285 NULL);
286 GNUNET_free (adm);
287}
288
289
290/**
291 * Closure for #free_barrier_node_cb().
292 */
293struct FreeBarrierNodeCbCls
294{
295 /**
296 * The interpreter.
297 */
298 struct GNUNET_TESTING_Interpreter *is;
299
300 /**
301 * The barrier from which the nodes are freed..
302 */
303 struct GNUNET_TESTING_Barrier *barrier;
304};
305
306
307static enum GNUNET_GenericReturnValue
308free_barrier_node_cb (void *cls,
309 const struct GNUNET_ShortHashCode *key,
310 void *value)
311{
312 struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls = cls;
313 struct GNUNET_TESTING_NetjailNode *node = value;
314 struct GNUNET_TESTING_Barrier *barrier = free_barrier_node_cb_cls->barrier;
315 struct GNUNET_TESTING_Interpreter *is = free_barrier_node_cb_cls->is;
316
317 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
318 "free_barrier_node_cb\n");
319 if (! is->finishing)
320 {
321 send_barrier_crossable (is,
322 barrier->name,
323 node->node_number);
324 }
325 GNUNET_assert (GNUNET_YES ==
326 GNUNET_CONTAINER_multishortmap_remove (
327 barrier->nodes,
328 key,
329 node));
330 return GNUNET_YES;
331}
332
333
334static void
335free_barrier_nodes (struct GNUNET_TESTING_Interpreter *is,
336 struct GNUNET_TESTING_Barrier *barrier)
337{
338 struct FreeBarrierNodeCbCls free_barrier_node_cb_cls = {
339 .barrier = barrier,
340 .is = is
341 };
342
343 if (NULL == barrier->nodes)
344 return;
345 GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes,
346 free_barrier_node_cb,
347 &free_barrier_node_cb_cls);
348 GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes);
349 barrier->nodes = NULL;
350}
351
352
353static enum GNUNET_GenericReturnValue
354free_barriers_cb (void *cls,
355 const struct GNUNET_ShortHashCode *key,
356 void *value)
357{
358 struct GNUNET_TESTING_Interpreter *is = cls;
359 struct GNUNET_TESTING_Barrier *barrier = value;
360 struct CommandListEntry *pos;
361
362 free_barrier_nodes (is,
363 barrier);
364 while (NULL != (pos = barrier->cmds_head))
365 {
366 GNUNET_CONTAINER_DLL_remove (barrier->cmds_head,
367 barrier->cmds_tail,
368 pos);
369 GNUNET_free (pos);
370 }
371 GNUNET_free (barrier);
372 return GNUNET_YES;
373}
374
375
376/**
377 * Finish the test run, return the final result.
378 *
379 * @param cls the `struct GNUNET_TESTING_Interpreter`
380 */
381static void
382finish_test (void *cls)
383{
384 struct GNUNET_TESTING_Interpreter *is = cls;
385 struct GNUNET_TESTING_Command *cmd;
386 const char *label;
387
388 is->finishing = true;
389 is->final_task = NULL;
390 label = is->commands[is->ip].label.value;
391 if (NULL == is->commands[is->ip].run)
392 label = "END";
393 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
394 "Interpreter finishes at `%s' with status %d\n",
395 label,
396 is->result);
397 for (unsigned int j = 0;
398 NULL != (cmd = &is->commands[j])->run;
399 j++)
400 {
401 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
402 "Cleaning up cmd %s\n",
403 cmd->label.value);
404 cmd->cleanup (cmd->cls);
405 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
406 "Cleaned up cmd %s\n",
407 cmd->label.value);
408 }
409 if (NULL != is->task)
410 {
411 GNUNET_SCHEDULER_cancel (is->task);
412 is->task = NULL;
413 }
414 if (NULL != is->timeout_task)
415 {
416 GNUNET_SCHEDULER_cancel (is->timeout_task);
417 is->timeout_task = NULL;
418 }
419 if (NULL != is->send_handle)
420 {
421 GNUNET_HELPER_send_cancel (is->send_handle);
422 is->send_handle = NULL;
423 }
424 GNUNET_free (is->commands);
425 is->rc (is->rc_cls,
426 is->result);
427 GNUNET_CONTAINER_multishortmap_iterate (is->barriers,
428 free_barriers_cb,
429 is);
430 GNUNET_CONTAINER_multishortmap_destroy (is->barriers);
431 GNUNET_free (is->helper);
432 GNUNET_free (is);
433}
434
435
436/**
437 * Run the main interpreter loop that performs exchange operations.
438 *
439 * @param cls contains the `struct InterpreterState`
440 */
441static void
442interpreter_run (void *cls);
443
444
445/**
446 * Current command is done, run the next one.
447 */
448static void
449interpreter_next (void *cls)
450{
451 struct GNUNET_TESTING_Interpreter *is = cls;
452 static unsigned long long ipc;
453 static struct GNUNET_TIME_Absolute last_report;
454 struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip];
455
456 if (GNUNET_SYSERR == is->result)
457 return; /* ignore, we already failed! */
458 cmd->finish_time = GNUNET_TIME_absolute_get ();
459 if ( (! GNUNET_TESTING_cmd_is_batch_ (cmd)) ||
460 (! GNUNET_TESTING_cmd_batch_next_ (cmd->cls)) )
461 is->ip++;
462 if (0 == (ipc % 1000))
463 {
464 if (0 != ipc)
465 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
466 "Interpreter executed 1000 instructions in %s\n",
467 GNUNET_STRINGS_relative_time_to_string (
468 GNUNET_TIME_absolute_get_duration (last_report),
469 GNUNET_YES));
470 last_report = GNUNET_TIME_absolute_get ();
471 }
472 ipc++;
473 is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
474 is);
475}
476
477
478void
479GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is)
480{
481 struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip];
482
483 if (GNUNET_SYSERR == is->result)
484 {
485 GNUNET_break (0);
486 return; /* ignore, we already failed! */
487 }
488 if (NULL != cmd)
489 {
490 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
491 "Failed at command `%s'\n",
492 cmd->label.value);
493 while (GNUNET_TESTING_cmd_is_batch_ (cmd))
494 {
495 cmd = GNUNET_TESTING_cmd_batch_get_current_ (cmd);
496 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
497 "Failed in batch at command `%s'\n",
498 cmd->label.value);
499 }
500 }
501 else
502 {
503 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
504 "Failed with CMD being NULL!\n");
505 }
506 is->result = GNUNET_SYSERR;
507 GNUNET_assert (NULL == is->final_task);
508 is->final_task = GNUNET_SCHEDULER_add_now (&finish_test,
509 is);
510}
511
512
513void
514GNUNET_TESTING_async_fail (struct GNUNET_TESTING_AsyncContext *ac)
515{
516 GNUNET_assert (GNUNET_NO == ac->finished);
517 ac->finished = GNUNET_SYSERR;
518 GNUNET_TESTING_interpreter_fail (ac->is);
519 if (NULL != ac->cont)
520 {
521 ac->cont (ac->cont_cls);
522 ac->cont = NULL;
523 }
524}
525
526
527void
528GNUNET_TESTING_async_finish (struct GNUNET_TESTING_AsyncContext *ac)
529{
530 GNUNET_assert (GNUNET_NO == ac->finished);
531 ac->finished = GNUNET_OK;
532 if (NULL != ac->cont)
533 {
534 ac->cont (ac->cont_cls);
535 ac->cont = NULL;
536 }
537}
538
539
540/**
541 * Returns the actual running command.
542 *
543 * @param is Global state of the interpreter, used by a command
544 * to access information about other commands.
545 * @return The actual running command.
546 */
547struct GNUNET_TESTING_Command *
548GNUNET_TESTING_interpreter_get_current_command (
549 struct GNUNET_TESTING_Interpreter *is)
550{
551 return &is->commands[is->ip];
552}
553
554
555/**
556 * Run the main interpreter loop.
557 *
558 * @param cls contains the `struct GNUNET_TESTING_Interpreter`
559 */
560static void
561interpreter_run (void *cls)
562{
563 struct GNUNET_TESTING_Interpreter *is = cls;
564 struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip];
565
566 is->task = NULL;
567 if (NULL == cmd->run)
568 {
569 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
570 "Running command END\n");
571 is->result = GNUNET_OK;
572 finish_test (is);
573 return;
574 }
575 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
576 "Running command `%s'\n",
577 cmd->label.value);
578 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
579 "start time of %p expected 0 is `%" PRIu64 "'\n",
580 cmd,
581 cmd->start_time.abs_value_us);
582 cmd->start_time
583 = cmd->last_req_time
584 = GNUNET_TIME_absolute_get ();
585 cmd->num_tries = 1;
586 if (NULL != cmd->ac)
587 {
588 cmd->ac->is = is;
589 cmd->ac->cont = &interpreter_next;
590 cmd->ac->cont_cls = is;
591 cmd->ac->finished = false;
592 }
593 cmd->run (cmd->cls,
594 is);
595 if (NULL == cmd->ac)
596 {
597 interpreter_next (is);
598 }
599 else if ( (cmd->asynchronous_finish) &&
600 (NULL != cmd->ac->cont) )
601 {
602 cmd->ac->cont = NULL;
603 interpreter_next (is);
604 }
605}
606
607
608/**
609 * Function run when the test terminates (good or bad) with timeout.
610 *
611 * @param cls the interpreter state
612 */
613static void
614do_timeout (void *cls)
615{
616 struct GNUNET_TESTING_Interpreter *is = cls;
617
618 is->timeout_task = NULL;
619 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
620 "Terminating test due to global timeout\n");
621 is->result = GNUNET_SYSERR;
622 finish_test (is);
623}
624
625
626struct GNUNET_TESTING_Interpreter *
627GNUNET_TESTING_run (const struct GNUNET_TESTING_Command *commands,
628 struct GNUNET_TIME_Relative timeout,
629 GNUNET_TESTING_ResultCallback rc,
630 void *rc_cls)
631{
632 struct GNUNET_TESTING_Interpreter *is;
633 unsigned int i;
634
635 is = GNUNET_new (struct GNUNET_TESTING_Interpreter);
636 is->rc = rc;
637 is->rc_cls = rc_cls;
638 is->barriers = GNUNET_CONTAINER_multishortmap_create (1,
639 false);
640 /* get the number of commands */
641 for (i = 0; NULL != commands[i].run; i++)
642 ;
643 is->cmds_n = i + 1;
644 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
645 "Got %u commands\n",
646 i);
647 is->commands = GNUNET_malloc_large ( (i + 1)
648 * sizeof (struct
649 GNUNET_TESTING_Command));
650 GNUNET_assert (NULL != is->commands);
651 memcpy (is->commands,
652 commands,
653 sizeof (struct GNUNET_TESTING_Command) * i);
654 is->timeout_task
655 = GNUNET_SCHEDULER_add_delayed (timeout,
656 &do_timeout,
657 is);
658 is->task = GNUNET_SCHEDULER_add_now (&interpreter_run,
659 is);
660
661 return is;
662}
663
664
665struct GNUNET_TESTING_Command
666GNUNET_TESTING_command_new (void *cls,
667 const char *label,
668 GNUNET_TESTING_CommandRunRoutine run,
669 GNUNET_TESTING_CommandCleanupRoutine cleanup,
670 GNUNET_TESTING_CommandGetTraits traits,
671 struct GNUNET_TESTING_AsyncContext *ac)
672{
673 struct GNUNET_TESTING_Command cmd = {
674 .cls = cls,
675 .run = run,
676 .ac = ac,
677 .cleanup = cleanup,
678 .traits = traits
679 };
680
681 GNUNET_assert (NULL != run);
682 if (NULL != label)
683 GNUNET_TESTING_set_label (&cmd.label,
684 label);
685 return cmd;
686}
687
688
689void
690GNUNET_TESTING_set_label (struct GNUNET_TESTING_CommandLabel *label,
691 const char *value)
692{
693 size_t len;
694
695 len = strlen (value);
696 GNUNET_assert (len <=
697 GNUNET_TESTING_CMD_MAX_LABEL_LENGTH);
698 memcpy (label->value,
699 value,
700 len + 1);
701}
702
703
704
705struct GNUNET_TESTING_Command
706GNUNET_TESTING_cmd_end (void)
707{
708 struct GNUNET_TESTING_Command cmd = {
709 .run = NULL
710 };
711
712 return cmd;
713}
714
715
716/**
717 * Closure for #loop_run().
718 */
719struct MainParams
720{
721
722 /**
723 * NULL-label terminated array of commands.
724 */
725 struct GNUNET_TESTING_Command *commands;
726
727 /**
728 * Global timeout for the test.
729 */
730 struct GNUNET_TIME_Relative timeout;
731
732 /**
733 * Set to #EXIT_FAILURE on error.
734 */
735 int rv;
736};
737
738
739/**
740 * Function called with the final result of the test.
741 *
742 * @param cls the `struct MainParams`
743 * @param rv #GNUNET_OK if the test passed
744 */
745static void
746handle_result (void *cls,
747 enum GNUNET_GenericReturnValue rv)
748{
749 struct MainParams *mp = cls;
750
751 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
752 "Test exits with status %d\n",
753 rv);
754 if (GNUNET_OK != rv)
755 mp->rv = EXIT_FAILURE;
756 GNUNET_SCHEDULER_shutdown ();
757}
758
759
760/**
761 * Main function to run the test cases.
762 *
763 * @param cls a `struct MainParams *`
764 */
765static void
766loop_run (void *cls)
767{
768 struct MainParams *mp = cls;
769
770 GNUNET_TESTING_run (mp->commands,
771 mp->timeout,
772 &handle_result,
773 mp);
774}
775
776
777int
778GNUNET_TESTING_main (struct GNUNET_TESTING_Command *commands,
779 struct GNUNET_TIME_Relative timeout)
780{
781 struct MainParams mp = {
782 .commands = commands,
783 .timeout = timeout,
784 .rv = EXIT_SUCCESS
785 };
786
787 GNUNET_SCHEDULER_run (&loop_run,
788 &mp);
789 return mp.rv;
790}
791
792
793void
794GNUNET_TESTING_add_netjail_helper_ (struct GNUNET_TESTING_Interpreter *is,
795 const struct GNUNET_HELPER_Handle *helper)
796{
797 GNUNET_array_append (is->helper,
798 is->n_helper,
799 helper);
800}
801
802
803struct GNUNET_TESTING_Barrier *
804GNUNET_TESTING_get_barrier_ (struct GNUNET_TESTING_Interpreter *is,
805 const char *barrier_name)
806{
807 struct GNUNET_HashCode hc;
808 struct GNUNET_ShortHashCode create_key;
809
810 GNUNET_CRYPTO_hash (barrier_name,
811 strlen (barrier_name),
812 &hc);
813 memcpy (&create_key,
814 &hc,
815 sizeof (create_key));
816 return GNUNET_CONTAINER_multishortmap_get (is->barriers,
817 &create_key);
818}
819
820
821/**
822 * Add a barrier to the interpreter.
823 *
824 * @param is The interpreter.
825 * @param barrier The barrier to add.
826 */
827void
828GNUNET_TESTING_add_barrier_ (struct GNUNET_TESTING_Interpreter *is,
829 struct GNUNET_TESTING_Barrier *barrier)
830{
831 struct GNUNET_HashCode hc;
832 struct GNUNET_ShortHashCode create_key;
833
834 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
835 "Adding barrier %s locally\n",
836 barrier->name);
837 GNUNET_CRYPTO_hash (barrier->name,
838 strlen (barrier->name),
839 &hc);
840 memcpy (&create_key,
841 &hc,
842 sizeof (create_key));
843 GNUNET_CONTAINER_multishortmap_put (is->barriers,
844 &create_key,
845 barrier,
846 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
847}
848
849
850void
851GNUNET_TESTING_finish_barrier_ (struct GNUNET_TESTING_Interpreter *is,
852 const char *barrier_name)
853{
854 struct CommandListEntry *pos;
855 struct GNUNET_TESTING_Barrier *barrier;
856
857 barrier = GNUNET_TESTING_get_barrier_ (is,
858 barrier_name);
859 if (NULL == barrier)
860 return;
861 while (NULL != (pos = barrier->cmds_head))
862 {
863 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
864 "command label %s\n",
865 pos->command->label.value);
866 if ( (GNUNET_NO == pos->command->ac->finished) &&
867 (GNUNET_NO == pos->command->asynchronous_finish) )
868 {
869 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
870 "command label %s finish\n",
871 pos->command->label.value);
872 GNUNET_TESTING_async_finish (pos->command->ac);
873 }
874 else if (GNUNET_NO == pos->command->ac->finished)
875 {
876 pos->command->asynchronous_finish = GNUNET_YES;
877 }
878 GNUNET_CONTAINER_DLL_remove (barrier->cmds_head,
879 barrier->cmds_tail,
880 pos);
881 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
882 "command entry label %s removed\n",
883 pos->command->label.value);
884 GNUNET_free (pos);
885 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
886 "command entry freed\n");
887 }
888 free_barrier_nodes (is,
889 barrier);
890}
891
892
893/* end of testing_api_loop.c */
diff --git a/src/service/testing/testing_cmds.h b/src/service/testing/testing_cmds.h
deleted file mode 100644
index f4549477e..000000000
--- a/src/service/testing/testing_cmds.h
+++ /dev/null
@@ -1,143 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing/testing_cmds.h
23 * @brief Message formats for communication between testing cmds helper and testcase plugins.
24 * @author t3sserakt
25 */
26
27#ifndef TESTING_CMDS_H
28#define TESTING_CMDS_H
29
30#define HELPER_CMDS_BINARY "gnunet-cmds-helper"
31#include "gnunet_common.h"
32
33GNUNET_NETWORK_STRUCT_BEGIN
34
35/**
36 * Initialization message for gnunet-cmds-testbed to start cmd binary.
37 */
38struct GNUNET_TESTING_CommandHelperInit
39{
40 /**
41 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT
42 */
43 struct GNUNET_MessageHeader header;
44
45 /**
46 *
47 */
48 uint16_t plugin_name_size GNUNET_PACKED;
49
50 /* Followed by plugin name of the plugin running the test case. This is not NULL
51 * terminated */
52};
53
54/**
55 * Reply message from cmds helper process
56 */
57struct GNUNET_TESTING_CommandHelperReply
58{
59 /**
60 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY
61 */
62 struct GNUNET_MessageHeader header;
63};
64
65struct GNUNET_TESTING_CommandPeerStarted
66{
67 /**
68 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED
69 */
70 struct GNUNET_MessageHeader header;
71};
72
73struct GNUNET_TESTING_CommandAllPeersStarted
74{
75 /**
76 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED
77 */
78 struct GNUNET_MessageHeader header;
79};
80
81struct GNUNET_TESTING_CommandLocalFinished
82{
83 /**
84 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED
85 */
86 struct GNUNET_MessageHeader header;
87
88 /**
89 * The exit status local test return with.
90 */
91 enum GNUNET_GenericReturnValue rv;
92};
93
94
95struct GNUNET_TESTING_CommandLocalTestPrepared
96{
97 /**
98 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED
99 */
100 struct GNUNET_MessageHeader header;
101};
102
103struct GNUNET_TESTING_CommandAllLocalTestsPrepared
104{
105 /**
106 * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_LOCAL_TESTS_PREPARED
107 */
108 struct GNUNET_MessageHeader header;
109};
110
111GNUNET_NETWORK_STRUCT_END
112
113/**
114 * Global state of the interpreter, used by a command
115 * to access information about other commands.
116 */
117struct GNUNET_TESTING_Interpreter;
118
119
120/**
121 * Returns the actual running command.
122 *
123 * @param is Global state of the interpreter, used by a command
124 * to access information about other commands.
125 * @return The actual running command.
126 */
127struct GNUNET_TESTING_Command *
128GNUNET_TESTING_interpreter_get_current_command (
129 struct GNUNET_TESTING_Interpreter *is);
130
131
132/**
133 * Adding a helper handle to the interpreter.
134 *
135 * @param is The interpreter.
136 * @param helper The helper handle.
137 */
138void
139GNUNET_TESTING_add_netjail_helper_ (struct GNUNET_TESTING_Interpreter *is,
140 const struct GNUNET_HELPER_Handle *helper);
141
142#endif
143/* end of testing_cmds.h */
diff --git a/src/service/testing/topo.sh b/src/service/testing/topo.sh
deleted file mode 100755
index 0046622b6..000000000
--- a/src/service/testing/topo.sh
+++ /dev/null
@@ -1,99 +0,0 @@
1#!/bin/bash
2
3declare -A K_PLUGIN
4declare -A R_TCP
5declare -A R_UDP
6declare -A P_PLUGIN
7
8extract_attributes()
9{
10 line_key=$1
11 line=$2
12
13 if [ "$line_key" = "P" ]
14 then
15 n=$(echo $line|cut -d \| -f 1|awk -F: '{print $2}')
16 echo $n
17 m=$(echo $line|cut -d \| -f 1|awk -F: '{print $3}')
18 echo $m
19 else
20 number=$(echo $line|cut -d \| -f 1| cut -c 2-|cut -d : -f 2 )
21 echo $number
22 fi
23
24 nf=$(echo $line|awk -F: '{print NF}')
25 for ((i=2;i<=$nf;i++))
26 do
27 entry=$(echo $line |awk -v i=$i -F\| '{print $i}')
28 key=$(echo $entry|cut -d { -f 2|cut -d } -f 1|cut -d : -f 1)
29 value=$(echo $entry|cut -d { -f 2|cut -d } -f 1|cut -d : -f 2)
30 if [ "$key" = "tcp_port" ]
31 then
32 echo tcp port: $value
33 R_TCP[$number]=$value
34 elif [ "$key" = "udp_port" ]
35 then
36 echo udp port: $value
37 R_UDP[$number]=$value
38 elif [ "$key" = "plugin" ]
39 then
40 echo plugin: $value
41 echo $line_key
42 if [ "$line_key" = "P" ]
43 then
44 P_PLUGIN[$n,$m]=$value
45 echo $n $m ${P_PLUGIN[$n,$m]}
46 elif [ "$line_key" = "K" ]
47 then
48 K_PLUGIN[$number]=$value
49 fi
50 fi
51 done
52}
53
54read_topology(){
55
56local filename=$1
57while read line; do
58# reading each line
59 echo $line
60 key=$(cut -c -1 <<< $line)
61 if [ "$key" = "M" ]
62 then
63 LOCAL_M=$(cut -d : -f 2 <<< $line)
64 echo $LOCAL_M
65 elif [ "$key" = "N" ]
66 then
67 GLOBAL_N=$(cut -d : -f 2 <<< $line)
68 echo $GLOBAL_N
69 for ((i=1;i<=$GLOBAL_N;i++))
70 do
71 R_TCP[$i]=0
72 R_UDP[$i]=0
73 done
74 elif [ "$key" = "X" ]
75 then
76 KNOWN=$(cut -d : -f 2 <<< $line)
77 echo $KNOWN
78 elif [ "$key" = "T" ]
79 then
80 PLUGIN=$(cut -d : -f 2 <<< $line)
81 echo $PLUGIN
82 elif [ "$key" = "K" ]
83 then
84 echo know node
85 extract_attributes $key $line
86 elif [ "$key" = "R" ]
87 then
88 echo router
89 extract_attributes $key $line
90 elif [ "$key" = "P" ]
91 then
92 echo node
93 extract_attributes $key $line
94 fi
95done < $filename
96}
97
98
99
diff --git a/src/service/topology/gnunet-daemon-topology.c b/src/service/topology/gnunet-daemon-topology.c
index c706e826d..a95b67908 100644
--- a/src/service/topology/gnunet-daemon-topology.c
+++ b/src/service/topology/gnunet-daemon-topology.c
@@ -452,18 +452,13 @@ schedule_next_hello (void *cls)
452 fah.max_size = GNUNET_MAX_MESSAGE_SIZE - 1; 452 fah.max_size = GNUNET_MAX_MESSAGE_SIZE - 1;
453 fah.next_adv = GNUNET_TIME_UNIT_FOREVER_REL; 453 fah.next_adv = GNUNET_TIME_UNIT_FOREVER_REL;
454 GNUNET_CONTAINER_multipeermap_iterate (peers, &find_advertisable_hello, &fah); 454 GNUNET_CONTAINER_multipeermap_iterate (peers, &find_advertisable_hello, &fah);
455 pl->hello_delay_task =
456 GNUNET_SCHEDULER_add_delayed (fah.next_adv, &schedule_next_hello, pl);
457 if (NULL == fah.result) 455 if (NULL == fah.result)
458 return; 456 {
459 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 457 pl->hello_delay_task =
460 "schedule_next_hello 2\n"); 458 GNUNET_SCHEDULER_add_delayed (fah.next_adv, &schedule_next_hello, pl);
461 delay = GNUNET_TIME_absolute_get_remaining (pl->next_hello_allowed);
462 if (0 != delay.rel_value_us)
463 return;
464 459
465 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 460 return;
466 "schedule_next_hello 3\n"); 461 }
467 want = ntohs (fah.result->hello->size); 462 want = ntohs (fah.result->hello->size);
468 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 463 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
469 "Sending HELLO with %u bytes for peer %s\n", 464 "Sending HELLO with %u bytes for peer %s\n",
@@ -483,9 +478,8 @@ schedule_next_hello (void *cls)
483 /* prepare to send the next one */ 478 /* prepare to send the next one */
484 pl->next_hello_allowed = 479 pl->next_hello_allowed =
485 GNUNET_TIME_relative_to_absolute (HELLO_ADVERTISEMENT_MIN_FREQUENCY); 480 GNUNET_TIME_relative_to_absolute (HELLO_ADVERTISEMENT_MIN_FREQUENCY);
486 if (NULL != pl->hello_delay_task) 481 delay = GNUNET_TIME_absolute_get_remaining (pl->next_hello_allowed);
487 GNUNET_SCHEDULER_cancel (pl->hello_delay_task); 482 pl->hello_delay_task = GNUNET_SCHEDULER_add_delayed (delay, &schedule_next_hello, pl);
488 pl->hello_delay_task = GNUNET_SCHEDULER_add_now (&schedule_next_hello, pl);
489} 483}
490 484
491 485
@@ -705,6 +699,7 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello)
705 GNUNET_HELLO_builder_iterate (builder_old, 699 GNUNET_HELLO_builder_iterate (builder_old,
706 &address_iterator, 700 &address_iterator,
707 &num_addresses_old); 701 &num_addresses_old);
702 GNUNET_HELLO_builder_free (builder_old);
708 if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) && 703 if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) &&
709 (GNUNET_TIME_absolute_cmp (new_hello_exp, >, old_hello_exp) || 704 (GNUNET_TIME_absolute_cmp (new_hello_exp, >, old_hello_exp) ||
710 num_addresses_old < num_addresses_new)) 705 num_addresses_old < num_addresses_new))
@@ -937,7 +932,7 @@ handle_hello (void *cls, const struct GNUNET_MessageHeader *message)
937 message); 932 message);
938 933
939 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 934 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
940 "Received encrypted HELLO from peer `%s'", 935 "Received encrypted HELLO from peer `%s'\n",
941 GNUNET_i2s (other)); 936 GNUNET_i2s (other));
942 GNUNET_STATISTICS_update (stats, 937 GNUNET_STATISTICS_update (stats,
943 gettext_noop ("# HELLO messages received"), 938 gettext_noop ("# HELLO messages received"),
@@ -1012,6 +1007,7 @@ cleaning_task (void *cls)
1012 GNUNET_STATISTICS_destroy (stats, GNUNET_NO); 1007 GNUNET_STATISTICS_destroy (stats, GNUNET_NO);
1013 stats = NULL; 1008 stats = NULL;
1014 } 1009 }
1010 GNUNET_free (my_private_key);
1015} 1011}
1016 1012
1017 1013
diff --git a/src/service/transport/Makefile.am b/src/service/transport/Makefile.am
index 03c726dc5..eac451882 100644
--- a/src/service/transport/Makefile.am
+++ b/src/service/transport/Makefile.am
@@ -15,11 +15,10 @@ if USE_COVERAGE
15endif 15endif
16 16
17noinst_PROGRAMS = \ 17noinst_PROGRAMS = \
18 test_transport_start_with_config \
19 gnunet-communicator-udp 18 gnunet-communicator-udp
20 19
21TESTING_LIBS = \ 20TESTING_LIBS = \
22 libgnunettransporttesting2.la 21 libgnunettestingtransport.la
23 22
24lib_LTLIBRARIES = \ 23lib_LTLIBRARIES = \
25 libgnunettransportapplication.la \ 24 libgnunettransportapplication.la \
@@ -28,32 +27,29 @@ lib_LTLIBRARIES = \
28 libgnunettransportmonitor.la \ 27 libgnunettransportmonitor.la \
29 $(TESTING_LIBS) 28 $(TESTING_LIBS)
30 29
31libgnunettransporttesting2_la_SOURCES = \ 30libgnunettestingtransport_la_SOURCES = \
32 transport_api_traits.c \ 31 testing_transport_traits.c transport-testing-cmds.h \
33 testing_api_cmd_stop_peer.c \ 32 transport-testing-communicator.c transport-testing-communicator.h
34 testing_api_cmd_start_peer.c \ 33# transport_api_cmd_connecting_peers.c \
35 transport_api_cmd_connecting_peers.c \ 34# transport_api_cmd_backchannel_check.c \
36 transport_api_cmd_backchannel_check.c \ 35# transport_api_cmd_send_simple.c \
37 transport_api_cmd_start_peer.c \ 36# transport_api_cmd_send_simple_performance.c \
38 transport_api_cmd_stop_peer.c \ 37# transport-testing2.c transport-testing2.h \
39 transport_api_cmd_send_simple.c \ 38# transport-testing-cmds.h \
40 transport_api_cmd_send_simple_performance.c \ 39# transport-testing-filenames2.c \
41 transport-testing2.c transport-testing2.h \ 40# transport-testing-loggers2.c \
42 transport-testing-cmds.h \ 41# transport-testing-main2.c \
43 transport-testing-filenames2.c \ 42# transport-testing-send2.c
44 transport-testing-loggers2.c \ 43libgnunettestingtransport_la_LIBADD = \
45 transport-testing-main2.c \
46 transport-testing-send2.c \
47 transport-testing-communicator.c transport-testing-communicator.h
48libgnunettransporttesting2_la_LIBADD = \
49 libgnunettransportapplication.la \ 44 libgnunettransportapplication.la \
50 libgnunettransportcore.la \ 45 libgnunettransportcore.la \
46 $(top_builddir)/src/service/testbed/libgnunettestbed.la \
51 $(top_builddir)/src/service/arm/libgnunetarm.la \ 47 $(top_builddir)/src/service/arm/libgnunetarm.la \
52 $(top_builddir)/src/service/testing/libgnunettesting.la \ 48 $(top_builddir)/src/lib/testing/libgnunettesting.la \
53 $(top_builddir)/src/lib/hello/libgnunethello.la \ 49 $(top_builddir)/src/lib/hello/libgnunethello.la \
54 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 50 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
55 $(top_builddir)/src/lib/util/libgnunetutil.la 51 $(top_builddir)/src/lib/util/libgnunetutil.la
56libgnunettransporttesting2_la_LDFLAGS = \ 52libgnunettestingtransport_la_LDFLAGS = \
57 $(GN_LIBINTL) \ 53 $(GN_LIBINTL) \
58 $(GN_LIB_LDFLAGS) \ 54 $(GN_LIB_LDFLAGS) \
59 -version-info 0:0:0 55 -version-info 0:0:0
@@ -184,25 +180,26 @@ gnunet_service_transport_LDADD = \
184 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 180 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
185 $(top_builddir)/src/lib/hello/libgnunethello.la \ 181 $(top_builddir)/src/lib/hello/libgnunethello.la \
186 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ 182 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \
183 $(top_builddir)/src/service/nat/libgnunetnatnew.la \
187 $(top_builddir)/src/lib/util/libgnunetutil.la \ 184 $(top_builddir)/src/lib/util/libgnunetutil.la \
188 $(LIBGCRYPT_LIBS) \ 185 $(LIBGCRYPT_LIBS) \
189 $(GN_LIBINTL) 186 $(GN_LIBINTL)
190 187
191plugin_LTLIBRARIES = \ 188#plugin_LTLIBRARIES = \
192 libgnunet_test_transport_plugin_cmd_simple_send_performance.la \ 189# libgnunet_test_transport_plugin_cmd_simple_send_performance.la \
193 libgnunet_test_transport_plugin_cmd_nat_upnp.la \ 190# libgnunet_test_transport_plugin_cmd_nat_upnp.la \
194 libgnunet_test_transport_plugin_cmd_simple_send.la \ 191# libgnunet_test_transport_plugin_cmd_simple_send.la \
195 libgnunet_test_transport_plugin_cmd_simple_send_broadcast.la \ 192# libgnunet_test_transport_plugin_cmd_simple_send_broadcast.la \
196 libgnunet_test_transport_plugin_cmd_simple_send_dv.la \ 193# libgnunet_test_transport_plugin_cmd_simple_send_dv.la \
197 libgnunet_test_transport_plugin_cmd_udp_backchannel.la 194# libgnunet_test_transport_plugin_cmd_udp_backchannel.la
198 195
199libgnunet_test_transport_plugin_cmd_nat_upnp_la_SOURCES = \ 196libgnunet_test_transport_plugin_cmd_nat_upnp_la_SOURCES = \
200 test_transport_plugin_cmd_nat_upnp.c 197 test_transport_plugin_cmd_nat_upnp.c
201libgnunet_test_transport_plugin_cmd_nat_upnp_la_LIBADD = \ 198libgnunet_test_transport_plugin_cmd_nat_upnp_la_LIBADD = \
202 libgnunettransporttesting2.la \ 199 libgnunettestingtransport.la \
203 libgnunettransportapplication.la \ 200 libgnunettransportapplication.la \
204 libgnunettransportcore.la \ 201 libgnunettransportcore.la \
205 $(top_builddir)/src/service/testing/libgnunettesting.la \ 202 $(top_builddir)/src/lib/testing/libgnunettesting.la \
206 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 203 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
207 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ 204 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \
208 $(top_builddir)/src/lib/hello/libgnunethello.la \ 205 $(top_builddir)/src/lib/hello/libgnunethello.la \
@@ -215,10 +212,10 @@ libgnunet_test_transport_plugin_cmd_nat_upnp_la_LDFLAGS = \
215libgnunet_test_transport_plugin_cmd_udp_backchannel_la_SOURCES = \ 212libgnunet_test_transport_plugin_cmd_udp_backchannel_la_SOURCES = \
216 test_transport_plugin_cmd_udp_backchannel.c 213 test_transport_plugin_cmd_udp_backchannel.c
217libgnunet_test_transport_plugin_cmd_udp_backchannel_la_LIBADD = \ 214libgnunet_test_transport_plugin_cmd_udp_backchannel_la_LIBADD = \
218 libgnunettransporttesting2.la \ 215 libgnunettestingtransport.la \
219 libgnunettransportapplication.la \ 216 libgnunettransportapplication.la \
220 libgnunettransportcore.la \ 217 libgnunettransportcore.la \
221 $(top_builddir)/src/service/testing/libgnunettesting.la \ 218 $(top_builddir)/src/lib/testing/libgnunettesting.la \
222 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 219 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
223 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ 220 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \
224 $(top_builddir)/src/lib/hello/libgnunethello.la \ 221 $(top_builddir)/src/lib/hello/libgnunethello.la \
@@ -231,10 +228,10 @@ libgnunet_test_transport_plugin_cmd_udp_backchannel_la_LDFLAGS = \
231libgnunet_test_transport_plugin_cmd_simple_send_la_SOURCES = \ 228libgnunet_test_transport_plugin_cmd_simple_send_la_SOURCES = \
232 test_transport_plugin_cmd_simple_send.c 229 test_transport_plugin_cmd_simple_send.c
233libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = \ 230libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = \
234 libgnunettransporttesting2.la \ 231 libgnunettestingtransport.la \
235 libgnunettransportapplication.la \ 232 libgnunettransportapplication.la \
236 libgnunettransportcore.la \ 233 libgnunettransportcore.la \
237 $(top_builddir)/src/service/testing/libgnunettesting.la \ 234 $(top_builddir)/src/lib/testing/libgnunettesting.la \
238 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 235 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
239 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ 236 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \
240 $(top_builddir)/src/lib/hello/libgnunethello.la \ 237 $(top_builddir)/src/lib/hello/libgnunethello.la \
@@ -247,10 +244,10 @@ libgnunet_test_transport_plugin_cmd_simple_send_la_LDFLAGS = \
247libgnunet_test_transport_plugin_cmd_simple_send_performance_la_SOURCES = \ 244libgnunet_test_transport_plugin_cmd_simple_send_performance_la_SOURCES = \
248 test_transport_plugin_cmd_simple_send_performance.c 245 test_transport_plugin_cmd_simple_send_performance.c
249libgnunet_test_transport_plugin_cmd_simple_send_performance_la_LIBADD = \ 246libgnunet_test_transport_plugin_cmd_simple_send_performance_la_LIBADD = \
250 libgnunettransporttesting2.la \ 247 libgnunettestingtransport.la \
251 libgnunettransportapplication.la \ 248 libgnunettransportapplication.la \
252 libgnunettransportcore.la \ 249 libgnunettransportcore.la \
253 $(top_builddir)/src/service/testing/libgnunettesting.la \ 250 $(top_builddir)/src/lib/testing/libgnunettesting.la \
254 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 251 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
255 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ 252 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \
256 $(top_builddir)/src/lib/hello/libgnunethello.la \ 253 $(top_builddir)/src/lib/hello/libgnunethello.la \
@@ -263,10 +260,10 @@ libgnunet_test_transport_plugin_cmd_simple_send_performance_la_LDFLAGS = \
263libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_SOURCES = \ 260libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_SOURCES = \
264 test_transport_plugin_cmd_simple_send_broadcast.c 261 test_transport_plugin_cmd_simple_send_broadcast.c
265libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_LIBADD = \ 262libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_LIBADD = \
266 libgnunettransporttesting2.la \ 263 libgnunettestingtransport.la \
267 libgnunettransportapplication.la \ 264 libgnunettransportapplication.la \
268 libgnunettransportcore.la \ 265 libgnunettransportcore.la \
269 $(top_builddir)/src/service/testing/libgnunettesting.la \ 266 $(top_builddir)/src/lib/testing/libgnunettesting.la \
270 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 267 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
271 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ 268 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \
272 $(top_builddir)/src/lib/hello/libgnunethello.la \ 269 $(top_builddir)/src/lib/hello/libgnunethello.la \
@@ -279,10 +276,10 @@ libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_LDFLAGS = \
279libgnunet_test_transport_plugin_cmd_simple_send_dv_la_SOURCES = \ 276libgnunet_test_transport_plugin_cmd_simple_send_dv_la_SOURCES = \
280 test_transport_plugin_cmd_simple_send_dv.c 277 test_transport_plugin_cmd_simple_send_dv.c
281libgnunet_test_transport_plugin_cmd_simple_send_dv_la_LIBADD = \ 278libgnunet_test_transport_plugin_cmd_simple_send_dv_la_LIBADD = \
282 libgnunettransporttesting2.la \ 279 libgnunettestingtransport.la \
283 libgnunettransportapplication.la \ 280 libgnunettransportapplication.la \
284 libgnunettransportcore.la \ 281 libgnunettransportcore.la \
285 $(top_builddir)/src/service/testing/libgnunettesting.la \ 282 $(top_builddir)/src/lib/testing/libgnunettesting.la \
286 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ 283 $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \
287 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ 284 $(top_builddir)/src/service/statistics/libgnunetstatistics.la \
288 $(top_builddir)/src/lib/hello/libgnunethello.la \ 285 $(top_builddir)/src/lib/hello/libgnunethello.la \
@@ -296,24 +293,24 @@ check_PROGRAMS = \
296 test_communicator_basic-tcp \ 293 test_communicator_basic-tcp \
297 test_communicator_basic-udp \ 294 test_communicator_basic-udp \
298 test_communicator_rekey-tcp \ 295 test_communicator_rekey-tcp \
296 test_communicator_bidirect-tcp \
299 test_communicator_rekey-udp \ 297 test_communicator_rekey-udp \
300 test_communicator_backchannel-udp \ 298 test_communicator_backchannel-udp
301 test_communicator_bidirect-tcp
302 299
303if HAVE_EXPERIMENTAL 300if HAVE_EXPERIMENTAL
304check_PROGRAMS += test_communicator_basic-quic \ 301check_PROGRAMS += test_communicator_basic-quic \
305 test_communicator_basic-unix 302 test_communicator_basic-unix
306check_SCRIPTS= \ 303# check_SCRIPTS= \
307 test_transport_start_testcase.sh \ 304 # test_transport_start_testcase.sh \
308 test_transport_simple_send_performance.sh \ 305 # test_transport_simple_send_performance.sh \
309 test_transport_nat_icmp_tcp.sh \ 306 # test_transport_nat_icmp_tcp.sh \
310 test_transport_nat_upnp.sh \ 307 # test_transport_nat_upnp.sh \
311 test_transport_simple_send_string.sh \ 308 # test_transport_simple_send_string.sh \
312 test_transport_simple_send.sh \ 309 # test_transport_simple_send.sh \
313 test_transport_simple_send_broadcast.sh \ 310 # test_transport_simple_send_broadcast.sh \
314 test_transport_udp_backchannel.sh \ 311 # test_transport_udp_backchannel.sh \
315 test_transport_simple_send_dv_circle.sh \ 312 # test_transport_simple_send_dv_circle.sh \
316 test_transport_simple_send_dv_inverse.sh 313 # test_transport_simple_send_dv_inverse.sh
317endif 314endif
318 315
319if ENABLE_TEST_RUN 316if ENABLE_TEST_RUN
@@ -324,76 +321,68 @@ TESTS = \
324endif 321endif
325 322
326 323
327test_transport_start_with_config_SOURCES = \
328 test_transport_start_with_config.c
329test_transport_start_with_config_LDADD = \
330 $(top_builddir)/src/service/testing/libgnunettesting.la \
331 $(top_builddir)/src/lib/util/libgnunetutil.la \
332 $(top_builddir)/src/lib/hello/libgnunethello.la \
333 libgnunettransportcore.la \
334 libgnunettransporttesting2.la
335 324
336test_communicator_basic_unix_SOURCES = \ 325test_communicator_basic_unix_SOURCES = \
337 test_communicator_basic.c 326 test_communicator_basic.c
338test_communicator_basic_unix_LDADD = \ 327test_communicator_basic_unix_LDADD = \
339 libgnunettransporttesting2.la \ 328 libgnunettestingtransport.la \
340 $(top_builddir)/src/service/testing/libgnunettesting.la \ 329 $(top_builddir)/src/lib/testing/libgnunettesting.la \
341 $(top_builddir)/src/lib/util/libgnunetutil.la \ 330 $(top_builddir)/src/lib/util/libgnunetutil.la \
342 $(top_builddir)/src/service/statistics/libgnunetstatistics.la 331 $(top_builddir)/src/service/statistics/libgnunetstatistics.la
343 332
344test_communicator_basic_tcp_SOURCES = \ 333test_communicator_basic_tcp_SOURCES = \
345 test_communicator_basic.c 334 test_communicator_basic.c
346test_communicator_basic_tcp_LDADD = \ 335test_communicator_basic_tcp_LDADD = \
347 libgnunettransporttesting2.la \ 336 libgnunettestingtransport.la \
348 $(top_builddir)/src/service/testing/libgnunettesting.la \ 337 $(top_builddir)/src/lib/testing/libgnunettesting.la \
349 $(top_builddir)/src/lib/util/libgnunetutil.la \ 338 $(top_builddir)/src/lib/util/libgnunetutil.la \
350 $(top_builddir)/src/service/statistics/libgnunetstatistics.la 339 $(top_builddir)/src/service/statistics/libgnunetstatistics.la
351 340
352test_communicator_basic_udp_SOURCES = \ 341test_communicator_basic_udp_SOURCES = \
353 test_communicator_basic.c 342 test_communicator_basic.c
354test_communicator_basic_udp_LDADD = \ 343test_communicator_basic_udp_LDADD = \
355 libgnunettransporttesting2.la \ 344 libgnunettestingtransport.la \
356 $(top_builddir)/src/service/testing/libgnunettesting.la \ 345 $(top_builddir)/src/lib/testing/libgnunettesting.la \
357 $(top_builddir)/src/lib/util/libgnunetutil.la \ 346 $(top_builddir)/src/lib/util/libgnunetutil.la \
358 $(top_builddir)/src/service/statistics/libgnunetstatistics.la 347 $(top_builddir)/src/service/statistics/libgnunetstatistics.la
359 348
360test_communicator_basic_quic_SOURCES = \ 349test_communicator_basic_quic_SOURCES = \
361 test_communicator_basic.c 350 test_communicator_basic.c
362test_communicator_basic_quic_LDADD = \ 351test_communicator_basic_quic_LDADD = \
363 libgnunettransporttesting2.la \ 352 libgnunettestingtransport.la \
364 $(top_builddir)/src/service/testing/libgnunettesting.la \ 353 $(top_builddir)/src/lib/testing/libgnunettesting.la \
365 $(top_builddir)/src/lib/util/libgnunetutil.la \ 354 $(top_builddir)/src/lib/util/libgnunetutil.la \
366 $(top_builddir)/src/service/statistics/libgnunetstatistics.la 355 $(top_builddir)/src/service/statistics/libgnunetstatistics.la
367 356
368test_communicator_rekey_tcp_SOURCES = \ 357test_communicator_rekey_tcp_SOURCES = \
369 test_communicator_basic.c 358 test_communicator_basic.c
370test_communicator_rekey_tcp_LDADD = \ 359test_communicator_rekey_tcp_LDADD = \
371 libgnunettransporttesting2.la \ 360 libgnunettestingtransport.la \
372 $(top_builddir)/src/service/testing/libgnunettesting.la \ 361 $(top_builddir)/src/lib/testing/libgnunettesting.la \
373 $(top_builddir)/src/lib/util/libgnunetutil.la \ 362 $(top_builddir)/src/lib/util/libgnunetutil.la \
374 $(top_builddir)/src/service/statistics/libgnunetstatistics.la 363 $(top_builddir)/src/service/statistics/libgnunetstatistics.la
375 364
376test_communicator_rekey_udp_SOURCES = \ 365test_communicator_rekey_udp_SOURCES = \
377 test_communicator_basic.c 366 test_communicator_basic.c
378test_communicator_rekey_udp_LDADD = \ 367test_communicator_rekey_udp_LDADD = \
379 libgnunettransporttesting2.la \ 368 libgnunettestingtransport.la \
380 $(top_builddir)/src/service/testing/libgnunettesting.la \ 369 $(top_builddir)/src/lib/testing/libgnunettesting.la \
381 $(top_builddir)/src/lib/util/libgnunetutil.la \ 370 $(top_builddir)/src/lib/util/libgnunetutil.la \
382 $(top_builddir)/src/service/statistics/libgnunetstatistics.la 371 $(top_builddir)/src/service/statistics/libgnunetstatistics.la
383 372
384test_communicator_backchannel_udp_SOURCES = \ 373test_communicator_backchannel_udp_SOURCES = \
385 test_communicator_basic.c 374 test_communicator_basic.c
386test_communicator_backchannel_udp_LDADD = \ 375test_communicator_backchannel_udp_LDADD = \
387 libgnunettransporttesting2.la \ 376 libgnunettestingtransport.la \
388 $(top_builddir)/src/service/testing/libgnunettesting.la \ 377 $(top_builddir)/src/lib/testing/libgnunettesting.la \
389 $(top_builddir)/src/lib/util/libgnunetutil.la \ 378 $(top_builddir)/src/lib/util/libgnunetutil.la \
390 $(top_builddir)/src/service/statistics/libgnunetstatistics.la 379 $(top_builddir)/src/service/statistics/libgnunetstatistics.la
391 380
392test_communicator_bidirect_tcp_SOURCES = \ 381test_communicator_bidirect_tcp_SOURCES = \
393 test_communicator_basic.c 382 test_communicator_basic.c
394test_communicator_bidirect_tcp_LDADD = \ 383test_communicator_bidirect_tcp_LDADD = \
395 libgnunettransporttesting2.la \ 384 libgnunettestingtransport.la \
396 $(top_builddir)/src/service/testing/libgnunettesting.la \ 385 $(top_builddir)/src/lib/testing/libgnunettesting.la \
397 $(top_builddir)/src/lib/util/libgnunetutil.la \ 386 $(top_builddir)/src/lib/util/libgnunetutil.la \
398 $(top_builddir)/src/service/statistics/libgnunetstatistics.la 387 $(top_builddir)/src/service/statistics/libgnunetstatistics.la
399 388
@@ -402,7 +391,7 @@ test_transport_api2_tcp_SOURCES = \
402test_transport_api2_tcp_LDADD = \ 391test_transport_api2_tcp_LDADD = \
403 $(top_builddir)/src/lib/hello/libgnunethello.la \ 392 $(top_builddir)/src/lib/hello/libgnunethello.la \
404 $(top_builddir)/src/lib/util/libgnunetutil.la \ 393 $(top_builddir)/src/lib/util/libgnunetutil.la \
405 libgnunettransporttesting2.la 394 libgnunettestingtransport.la
406 395
407EXTRA_DIST = \ 396EXTRA_DIST = \
408test_transport_start_testcase.sh \ 397test_transport_start_testcase.sh \
diff --git a/src/service/transport/gnunet-communicator-tcp.c b/src/service/transport/gnunet-communicator-tcp.c
index b08b571d1..5d9b9055f 100644
--- a/src/service/transport/gnunet-communicator-tcp.c
+++ b/src/service/transport/gnunet-communicator-tcp.c
@@ -28,6 +28,7 @@
28 * - support other TCP-specific NAT traversal methods (#5531) 28 * - support other TCP-specific NAT traversal methods (#5531)
29 */ 29 */
30#include "platform.h" 30#include "platform.h"
31#include "gnunet_common.h"
31#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
32#include "gnunet_core_service.h" 33#include "gnunet_core_service.h"
33#include "gnunet_peerstore_service.h" 34#include "gnunet_peerstore_service.h"
@@ -457,6 +458,11 @@ struct Queue
457 gcry_cipher_hd_t out_cipher; 458 gcry_cipher_hd_t out_cipher;
458 459
459 /** 460 /**
461 * Key in hash map
462 */
463 struct GNUNET_HashCode key;
464
465 /**
460 * Shared secret for HMAC verification on incoming data. 466 * Shared secret for HMAC verification on incoming data.
461 */ 467 */
462 struct GNUNET_HashCode in_hmac; 468 struct GNUNET_HashCode in_hmac;
@@ -820,7 +826,7 @@ static struct GNUNET_TRANSPORT_CommunicatorHandle *ch;
820/** 826/**
821 * Queues (map from peer identity to `struct Queue`) 827 * Queues (map from peer identity to `struct Queue`)
822 */ 828 */
823static struct GNUNET_CONTAINER_MultiPeerMap *queue_map; 829static struct GNUNET_CONTAINER_MultiHashMap *queue_map;
824 830
825/** 831/**
826 * ListenTasks (map from socket to `struct ListenTask`) 832 * ListenTasks (map from socket to `struct ListenTask`)
@@ -833,6 +839,11 @@ static struct GNUNET_CONTAINER_MultiHashMap *lt_map;
833static struct GNUNET_PeerIdentity my_identity; 839static struct GNUNET_PeerIdentity my_identity;
834 840
835/** 841/**
842 * The rekey byte maximum
843 */
844static unsigned long long rekey_max_bytes;
845
846/**
836 * The rekey interval 847 * The rekey interval
837 */ 848 */
838static struct GNUNET_TIME_Relative rekey_interval; 849static struct GNUNET_TIME_Relative rekey_interval;
@@ -875,28 +886,17 @@ struct GNUNET_RESOLVER_RequestHandle *resolve_request_handle;
875/** 886/**
876 * Head of DLL with addresses we like to register at NAT servcie. 887 * Head of DLL with addresses we like to register at NAT servcie.
877 */ 888 */
878struct Addresses *addrs_head; 889static struct Addresses *addrs_head;
879 890
880/** 891/**
881 * Head of DLL with addresses we like to register at NAT servcie. 892 * Head of DLL with addresses we like to register at NAT servcie.
882 */ 893 */
883struct Addresses *addrs_tail; 894static struct Addresses *addrs_tail;
884
885/**
886 * Head of DLL with ListenTasks.
887 */
888struct ListenTask *lts_head;
889
890/**
891 * Head of DLL with ListenTask.
892 */
893struct ListenTask *lts_tail;
894 895
895/** 896/**
896 * Number of addresses in the DLL for register at NAT service. 897 * Number of addresses in the DLL for register at NAT service.
897 */ 898 */
898int addrs_lens; 899static int addrs_lens;
899
900 900
901/** 901/**
902 * Database for peer's HELLOs. 902 * Database for peer's HELLOs.
@@ -904,19 +904,24 @@ int addrs_lens;
904static struct GNUNET_PEERSTORE_Handle *peerstore; 904static struct GNUNET_PEERSTORE_Handle *peerstore;
905 905
906/** 906/**
907 * A flag indicating we are already doing a shutdown. 907* A flag indicating we are already doing a shutdown.
908*/
909static int shutdown_running = GNUNET_NO;
910
911/**
912 * IPv6 disabled.
908 */ 913 */
909int shutdown_running = GNUNET_NO; 914static int disable_v6;
910 915
911/** 916/**
912 * The port the communicator should be assigned to. 917 * The port the communicator should be assigned to.
913 */ 918 */
914unsigned int bind_port; 919static unsigned int bind_port;
915 920
916/** 921/**
917 * Map of pending reversals. 922 * Map of pending reversals.
918 */ 923 */
919struct GNUNET_CONTAINER_MultiHashMap *pending_reversals; 924static struct GNUNET_CONTAINER_MultiHashMap *pending_reversals;
920 925
921/** 926/**
922 * We have been notified that our listen socket has something to 927 * We have been notified that our listen socket has something to
@@ -992,10 +997,10 @@ queue_destroy (struct Queue *queue)
992 } 997 }
993 GNUNET_assert ( 998 GNUNET_assert (
994 GNUNET_YES == 999 GNUNET_YES ==
995 GNUNET_CONTAINER_multipeermap_remove (queue_map, &queue->target, queue)); 1000 GNUNET_CONTAINER_multihashmap_remove (queue_map, &queue->key, queue));
996 GNUNET_STATISTICS_set (stats, 1001 GNUNET_STATISTICS_set (stats,
997 "# queues active", 1002 "# queues active",
998 GNUNET_CONTAINER_multipeermap_size (queue_map), 1003 GNUNET_CONTAINER_multihashmap_size (queue_map),
999 GNUNET_NO); 1004 GNUNET_NO);
1000 if (NULL != queue->read_task) 1005 if (NULL != queue->read_task)
1001 { 1006 {
@@ -1321,6 +1326,7 @@ rekey_monotime_cb (void *cls,
1321 GNUNET_break (0); 1326 GNUNET_break (0);
1322 GNUNET_PEERSTORE_iteration_stop (queue->rekey_monotime_get); 1327 GNUNET_PEERSTORE_iteration_stop (queue->rekey_monotime_get);
1323 queue->rekey_monotime_get = NULL; 1328 queue->rekey_monotime_get = NULL;
1329 // FIXME: Why should we try to gracefully finish here??
1324 queue_finish (queue); 1330 queue_finish (queue);
1325 return; 1331 return;
1326 } 1332 }
@@ -1402,6 +1408,7 @@ do_rekey (struct Queue *queue, const struct TCPRekey *rekey)
1402 &queue->target.public_key)) 1408 &queue->target.public_key))
1403 { 1409 {
1404 GNUNET_break (0); 1410 GNUNET_break (0);
1411 // FIXME Why should we try to gracefully finish here?
1405 queue_finish (queue); 1412 queue_finish (queue);
1406 return; 1413 return;
1407 } 1414 }
@@ -1483,6 +1490,7 @@ handshake_ack_monotime_cb (void *cls,
1483 GNUNET_break (0); 1490 GNUNET_break (0);
1484 GNUNET_PEERSTORE_iteration_stop (queue->handshake_ack_monotime_get); 1491 GNUNET_PEERSTORE_iteration_stop (queue->handshake_ack_monotime_get);
1485 queue->handshake_ack_monotime_get = NULL; 1492 queue->handshake_ack_monotime_get = NULL;
1493 // FIXME: Why should we try to gracefully finish here?
1486 queue_finish (queue); 1494 queue_finish (queue);
1487 return; 1495 return;
1488 } 1496 }
@@ -1557,7 +1565,7 @@ setup_out_cipher (struct Queue *queue, struct GNUNET_HashCode *dh)
1557 setup_cipher (dh, &queue->target, &queue->out_cipher, &queue->out_hmac); 1565 setup_cipher (dh, &queue->target, &queue->out_cipher, &queue->out_hmac);
1558 queue->rekey_time = GNUNET_TIME_relative_to_absolute (rekey_interval); 1566 queue->rekey_time = GNUNET_TIME_relative_to_absolute (rekey_interval);
1559 queue->rekey_left_bytes = 1567 queue->rekey_left_bytes =
1560 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, REKEY_MAX_BYTES); 1568 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, rekey_max_bytes);
1561} 1569}
1562 1570
1563 1571
@@ -2034,6 +2042,14 @@ try_handle_plaintext (struct Queue *queue)
2034 size = ntohs (hdr->size) + sizeof(*box); 2042 size = ntohs (hdr->size) + sizeof(*box);
2035 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2043 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2036 "Handling plaintext, box processed!\n"); 2044 "Handling plaintext, box processed!\n");
2045 GNUNET_STATISTICS_update (stats,
2046 "# bytes decrypted with BOX",
2047 size,
2048 GNUNET_NO);
2049 GNUNET_STATISTICS_update (stats,
2050 "# messages decrypted with BOX",
2051 1,
2052 GNUNET_NO);
2037 break; 2053 break;
2038 2054
2039 case GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_REKEY: 2055 case GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_REKEY:
@@ -2059,6 +2075,10 @@ try_handle_plaintext (struct Queue *queue)
2059 size = ntohs (hdr->size); 2075 size = ntohs (hdr->size);
2060 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2076 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2061 "Handling plaintext, rekey processed!\n"); 2077 "Handling plaintext, rekey processed!\n");
2078 GNUNET_STATISTICS_update (stats,
2079 "# rekeying successful",
2080 1,
2081 GNUNET_NO);
2062 break; 2082 break;
2063 2083
2064 case GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_FINISH: 2084 case GNUNET_MESSAGE_TYPE_COMMUNICATOR_TCP_FINISH:
@@ -2073,7 +2093,7 @@ try_handle_plaintext (struct Queue *queue)
2073 } 2093 }
2074 finz = *fin; 2094 finz = *fin;
2075 memset (&finz.hmac, 0, sizeof(finz.hmac)); 2095 memset (&finz.hmac, 0, sizeof(finz.hmac));
2076 calculate_hmac (&queue->in_hmac, &rekeyz, sizeof(rekeyz), &tmac); 2096 calculate_hmac (&queue->in_hmac, &finz, sizeof(finz), &tmac);
2077 if (0 != memcmp (&tmac, &fin->hmac, sizeof(tmac))) 2097 if (0 != memcmp (&tmac, &fin->hmac, sizeof(tmac)))
2078 { 2098 {
2079 GNUNET_break_op (0); 2099 GNUNET_break_op (0);
@@ -2123,7 +2143,7 @@ queue_read (void *cls)
2123 if ((EAGAIN != errno) && (EINTR != errno)) 2143 if ((EAGAIN != errno) && (EINTR != errno))
2124 { 2144 {
2125 GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "recv"); 2145 GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, "recv");
2126 queue_finish (queue); 2146 queue_destroy (queue);
2127 return; 2147 return;
2128 } 2148 }
2129 /* try again */ 2149 /* try again */
@@ -2140,7 +2160,7 @@ queue_read (void *cls)
2140 GNUNET_STRINGS_relative_time_to_string ( 2160 GNUNET_STRINGS_relative_time_to_string (
2141 GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2161 GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
2142 GNUNET_YES)); 2162 GNUNET_YES));
2143 queue_finish (queue); 2163 queue_destroy (queue);
2144 return; 2164 return;
2145 } 2165 }
2146 if (0 == rcvd) 2166 if (0 == rcvd)
@@ -2222,7 +2242,7 @@ queue_read (void *cls)
2222 GNUNET_STRINGS_relative_time_to_string ( 2242 GNUNET_STRINGS_relative_time_to_string (
2223 GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2243 GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT,
2224 GNUNET_YES)); 2244 GNUNET_YES));
2225 queue_finish (queue); 2245 queue_destroy (queue);
2226} 2246}
2227 2247
2228 2248
@@ -2305,11 +2325,7 @@ tcp_address_to_sockaddr_port_only (const char *bindto, unsigned int *port)
2305 2325
2306 po = GNUNET_new (struct PortOnlyIpv4Ipv6); 2326 po = GNUNET_new (struct PortOnlyIpv4Ipv6);
2307 2327
2308 if ((GNUNET_NO == GNUNET_NETWORK_test_pf (PF_INET6)) || 2328 if (GNUNET_YES == disable_v6)
2309 (GNUNET_YES ==
2310 GNUNET_CONFIGURATION_get_value_yesno (cfg,
2311 COMMUNICATOR_CONFIG_SECTION,
2312 "DISABLE_V6")))
2313 { 2329 {
2314 i4 = GNUNET_malloc (sizeof(struct sockaddr_in)); 2330 i4 = GNUNET_malloc (sizeof(struct sockaddr_in));
2315 po->addr_ipv4 = tcp_address_to_sockaddr_numeric_v4 (&sock_len_ipv4, *i4, 2331 po->addr_ipv4 = tcp_address_to_sockaddr_numeric_v4 (&sock_len_ipv4, *i4,
@@ -2353,7 +2369,6 @@ extract_address (const char *bindto)
2353 char *token; 2369 char *token;
2354 char *cp; 2370 char *cp;
2355 char *rest = NULL; 2371 char *rest = NULL;
2356 char *res;
2357 2372
2358 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2373 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2359 "extract address with bindto %s\n", 2374 "extract address with bindto %s\n",
@@ -2386,8 +2401,7 @@ extract_address (const char *bindto)
2386 else 2401 else
2387 { 2402 {
2388 token++; 2403 token++;
2389 res = GNUNET_strdup (token); 2404 addr = GNUNET_strdup (token);
2390 addr = GNUNET_strdup (res);
2391 } 2405 }
2392 } 2406 }
2393 2407
@@ -2510,7 +2524,6 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
2510 2524
2511 if (1 == inet_pton (AF_INET, start, &v4.sin_addr)) 2525 if (1 == inet_pton (AF_INET, start, &v4.sin_addr))
2512 { 2526 {
2513 // colon = strrchr (cp, ':');
2514 port = extract_port (bindto); 2527 port = extract_port (bindto);
2515 2528
2516 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2529 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2521,7 +2534,6 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
2521 } 2534 }
2522 else if (1 == inet_pton (AF_INET6, start, &v6.sin6_addr)) 2535 else if (1 == inet_pton (AF_INET6, start, &v6.sin6_addr))
2523 { 2536 {
2524 // colon = strrchr (cp, ':');
2525 port = extract_port (bindto); 2537 port = extract_port (bindto);
2526 in = tcp_address_to_sockaddr_numeric_v6 (sock_len, v6, port); 2538 in = tcp_address_to_sockaddr_numeric_v6 (sock_len, v6, port);
2527 } 2539 }
@@ -2650,14 +2662,14 @@ boot_queue (struct Queue *queue)
2650{ 2662{
2651 queue->nt = 2663 queue->nt =
2652 GNUNET_NT_scanner_get_type (is, queue->address, queue->address_len); 2664 GNUNET_NT_scanner_get_type (is, queue->address, queue->address_len);
2653 (void) GNUNET_CONTAINER_multipeermap_put ( 2665 (void) GNUNET_CONTAINER_multihashmap_put (
2654 queue_map, 2666 queue_map,
2655 &queue->target, 2667 &queue->key,
2656 queue, 2668 queue,
2657 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2669 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2658 GNUNET_STATISTICS_set (stats, 2670 GNUNET_STATISTICS_set (stats,
2659 "# queues active", 2671 "# queues active",
2660 GNUNET_CONTAINER_multipeermap_size (queue_map), 2672 GNUNET_CONTAINER_multihashmap_size (queue_map),
2661 GNUNET_NO); 2673 GNUNET_NO);
2662 queue->timeout = 2674 queue->timeout =
2663 GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 2675 GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
@@ -2735,6 +2747,7 @@ start_initial_kx_out (struct Queue *queue)
2735 struct GNUNET_CRYPTO_EcdhePublicKey epub; 2747 struct GNUNET_CRYPTO_EcdhePublicKey epub;
2736 struct GNUNET_HashCode k; 2748 struct GNUNET_HashCode k;
2737 2749
2750 // TODO: We could use the Elligator KEM here! https://bugs.gnunet.org/view.php?id=8065
2738 GNUNET_CRYPTO_eddsa_kem_encaps (&queue->target.public_key, &epub, &k); 2751 GNUNET_CRYPTO_eddsa_kem_encaps (&queue->target.public_key, &epub, &k);
2739 setup_out_cipher (queue, &k); 2752 setup_out_cipher (queue, &k);
2740 transmit_kx (queue, &epub); 2753 transmit_kx (queue, &epub);
@@ -3295,6 +3308,9 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
3295 struct sockaddr_in6 *v6; 3308 struct sockaddr_in6 *v6;
3296 unsigned int is_natd = GNUNET_NO; 3309 unsigned int is_natd = GNUNET_NO;
3297 struct GNUNET_HashCode key; 3310 struct GNUNET_HashCode key;
3311 struct GNUNET_HashCode queue_map_key;
3312 struct GNUNET_HashContext *hsh;
3313 struct Queue *queue;
3298 3314
3299 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3315 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3300 "Connecting to %s at %s\n", 3316 "Connecting to %s at %s\n",
@@ -3321,6 +3337,19 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
3321 "in %s\n", 3337 "in %s\n",
3322 GNUNET_a2s (in, in_len)); 3338 GNUNET_a2s (in, in_len));
3323 3339
3340 hsh = GNUNET_CRYPTO_hash_context_start ();
3341 GNUNET_CRYPTO_hash_context_read (hsh, address, strlen (address));
3342 GNUNET_CRYPTO_hash_context_read (hsh, peer, sizeof (*peer));
3343 GNUNET_CRYPTO_hash_context_finish (hsh, &queue_map_key);
3344 queue = GNUNET_CONTAINER_multihashmap_get (queue_map, &queue_map_key);
3345
3346 if (NULL != queue)
3347 {
3348 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3349 "Queue for %s already exists or is in construction\n", address);
3350 GNUNET_free (in);
3351 return GNUNET_NO;
3352 }
3324 switch (in->sa_family) 3353 switch (in->sa_family)
3325 { 3354 {
3326 case AF_INET: 3355 case AF_INET:
@@ -3346,6 +3375,13 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
3346 break; 3375 break;
3347 3376
3348 case AF_INET6: 3377 case AF_INET6:
3378 if (GNUNET_YES == disable_v6)
3379 {
3380 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3381 "IPv6 disabled, skipping %s\n", address);
3382 GNUNET_free (in);
3383 return GNUNET_SYSERR;
3384 }
3349 v6 = (struct sockaddr_in6 *) in; 3385 v6 = (struct sockaddr_in6 *) in;
3350 if (0 == v6->sin6_port) 3386 if (0 == v6->sin6_port)
3351 { 3387 {
@@ -3402,7 +3438,6 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
3402 else 3438 else
3403 { 3439 {
3404 struct GNUNET_NETWORK_Handle *sock; 3440 struct GNUNET_NETWORK_Handle *sock;
3405 struct Queue *queue;
3406 3441
3407 sock = GNUNET_NETWORK_socket_create (in->sa_family, SOCK_STREAM, 3442 sock = GNUNET_NETWORK_socket_create (in->sa_family, SOCK_STREAM,
3408 IPPROTO_TCP); 3443 IPPROTO_TCP);
@@ -3429,6 +3464,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
3429 3464
3430 queue = GNUNET_new (struct Queue); 3465 queue = GNUNET_new (struct Queue);
3431 queue->target = *peer; 3466 queue->target = *peer;
3467 queue->key = queue_map_key;
3432 queue->address = in; 3468 queue->address = in;
3433 queue->address_len = in_len; 3469 queue->address_len = in_len;
3434 queue->sock = sock; 3470 queue->sock = sock;
@@ -3502,7 +3538,7 @@ get_lt_delete_it (void *cls,
3502 */ 3538 */
3503static int 3539static int
3504get_queue_delete_it (void *cls, 3540get_queue_delete_it (void *cls,
3505 const struct GNUNET_PeerIdentity *target, 3541 const struct GNUNET_HashCode *target,
3506 void *value) 3542 void *value)
3507{ 3543{
3508 struct Queue *queue = value; 3544 struct Queue *queue = value;
@@ -3543,8 +3579,8 @@ do_shutdown (void *cls)
3543 GNUNET_CONTAINER_multihashmap_destroy (pending_reversals); 3579 GNUNET_CONTAINER_multihashmap_destroy (pending_reversals);
3544 GNUNET_CONTAINER_multihashmap_iterate (lt_map, &get_lt_delete_it, NULL); 3580 GNUNET_CONTAINER_multihashmap_iterate (lt_map, &get_lt_delete_it, NULL);
3545 GNUNET_CONTAINER_multihashmap_destroy (lt_map); 3581 GNUNET_CONTAINER_multihashmap_destroy (lt_map);
3546 GNUNET_CONTAINER_multipeermap_iterate (queue_map, &get_queue_delete_it, NULL); 3582 GNUNET_CONTAINER_multihashmap_iterate (queue_map, &get_queue_delete_it, NULL);
3547 GNUNET_CONTAINER_multipeermap_destroy (queue_map); 3583 GNUNET_CONTAINER_multihashmap_destroy (queue_map);
3548 if (NULL != ch) 3584 if (NULL != ch)
3549 { 3585 {
3550 GNUNET_TRANSPORT_communicator_address_remove_all (ch); 3586 GNUNET_TRANSPORT_communicator_address_remove_all (ch);
@@ -3553,7 +3589,7 @@ do_shutdown (void *cls)
3553 } 3589 }
3554 if (NULL != stats) 3590 if (NULL != stats)
3555 { 3591 {
3556 GNUNET_STATISTICS_destroy (stats, GNUNET_NO); 3592 GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
3557 stats = NULL; 3593 stats = NULL;
3558 } 3594 }
3559 if (NULL != my_private_key) 3595 if (NULL != my_private_key)
@@ -3762,7 +3798,8 @@ init_socket (struct sockaddr *addr,
3762 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3798 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3763 "Bound to `%s'\n", 3799 "Bound to `%s'\n",
3764 GNUNET_a2s ((const struct sockaddr *) &in_sto, sto_len)); 3800 GNUNET_a2s ((const struct sockaddr *) &in_sto, sto_len));
3765 stats = GNUNET_STATISTICS_create ("C-TCP", cfg); 3801 if (NULL == stats)
3802 stats = GNUNET_STATISTICS_create ("communicator-tcp", cfg);
3766 3803
3767 if (NULL == is) 3804 if (NULL == is)
3768 is = GNUNET_NT_scanner_init (); 3805 is = GNUNET_NT_scanner_init ();
@@ -3815,7 +3852,7 @@ init_socket (struct sockaddr *addr,
3815 "map entry created\n"); 3852 "map entry created\n");
3816 3853
3817 if (NULL == queue_map) 3854 if (NULL == queue_map)
3818 queue_map = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); 3855 queue_map = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
3819 3856
3820 if (NULL == ch) 3857 if (NULL == ch)
3821 ch = GNUNET_TRANSPORT_communicator_connect (cfg, 3858 ch = GNUNET_TRANSPORT_communicator_connect (cfg,
@@ -4005,14 +4042,34 @@ run (void *cls,
4005 COMMUNICATOR_CONFIG_SECTION, 4042 COMMUNICATOR_CONFIG_SECTION,
4006 "MAX_QUEUE_LENGTH", 4043 "MAX_QUEUE_LENGTH",
4007 &max_queue_length)) 4044 &max_queue_length))
4045 {
4008 max_queue_length = DEFAULT_MAX_QUEUE_LENGTH; 4046 max_queue_length = DEFAULT_MAX_QUEUE_LENGTH;
4047 }
4009 if (GNUNET_OK != 4048 if (GNUNET_OK !=
4010 GNUNET_CONFIGURATION_get_value_time (cfg, 4049 GNUNET_CONFIGURATION_get_value_time (cfg,
4011 COMMUNICATOR_CONFIG_SECTION, 4050 COMMUNICATOR_CONFIG_SECTION,
4012 "REKEY_INTERVAL", 4051 "REKEY_INTERVAL",
4013 &rekey_interval)) 4052 &rekey_interval))
4053 {
4014 rekey_interval = DEFAULT_REKEY_INTERVAL; 4054 rekey_interval = DEFAULT_REKEY_INTERVAL;
4015 4055 }
4056 if (GNUNET_OK !=
4057 GNUNET_CONFIGURATION_get_value_number (cfg,
4058 COMMUNICATOR_CONFIG_SECTION,
4059 "REKEY_MAX_BYTES",
4060 &rekey_max_bytes))
4061 {
4062 rekey_max_bytes = REKEY_MAX_BYTES;
4063 }
4064 disable_v6 = GNUNET_NO;
4065 if ((GNUNET_NO == GNUNET_NETWORK_test_pf (PF_INET6)) ||
4066 (GNUNET_YES ==
4067 GNUNET_CONFIGURATION_get_value_yesno (cfg,
4068 COMMUNICATOR_CONFIG_SECTION,
4069 "DISABLE_V6")))
4070 {
4071 disable_v6 = GNUNET_YES;
4072 }
4016 peerstore = GNUNET_PEERSTORE_connect (cfg); 4073 peerstore = GNUNET_PEERSTORE_connect (cfg);
4017 if (NULL == peerstore) 4074 if (NULL == peerstore)
4018 { 4075 {
diff --git a/src/service/transport/gnunet-communicator-udp.c b/src/service/transport/gnunet-communicator-udp.c
index 29beb4e37..fa5294218 100644
--- a/src/service/transport/gnunet-communicator-udp.c
+++ b/src/service/transport/gnunet-communicator-udp.c
@@ -67,7 +67,7 @@
67 * How often do we scan for changes to our network interfaces? 67 * How often do we scan for changes to our network interfaces?
68 */ 68 */
69#define INTERFACE_SCAN_FREQUENCY \ 69#define INTERFACE_SCAN_FREQUENCY \
70 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5) 70 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
71 71
72/** 72/**
73 * How long do we believe our addresses to remain up (before 73 * How long do we believe our addresses to remain up (before
@@ -76,7 +76,7 @@
76#define ADDRESS_VALIDITY_PERIOD GNUNET_TIME_UNIT_HOURS 76#define ADDRESS_VALIDITY_PERIOD GNUNET_TIME_UNIT_HOURS
77 77
78#define WORKING_QUEUE_INTERVALL \ 78#define WORKING_QUEUE_INTERVALL \
79 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,1) 79 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,1)
80 80
81/** 81/**
82 * AES key size. 82 * AES key size.
@@ -93,7 +93,7 @@
93 */ 93 */
94#define GCM_TAG_SIZE (128 / 8) 94#define GCM_TAG_SIZE (128 / 8)
95 95
96#define GENERATE_AT_ONCE 16 96#define GENERATE_AT_ONCE 64
97 97
98/** 98/**
99 * If we fall below this number of available KCNs, 99 * If we fall below this number of available KCNs,
@@ -198,9 +198,9 @@ struct UdpHandshakeSignature
198struct InitialKX 198struct InitialKX
199{ 199{
200 /** 200 /**
201 * Ephemeral key for KX. 201 * Representative of ephemeral key for KX.
202 */ 202 */
203 struct GNUNET_CRYPTO_EcdhePublicKey ephemeral; 203 struct GNUNET_CRYPTO_ElligatorRepresentative representative;
204 204
205 /** 205 /**
206 * HMAC for the following encrypted message, using GCM. HMAC uses 206 * HMAC for the following encrypted message, using GCM. HMAC uses
@@ -527,6 +527,11 @@ struct SenderAddress
527 socklen_t address_len; 527 socklen_t address_len;
528 528
529 /** 529 /**
530 * The address key for this entry.
531 */
532 struct GNUNET_HashCode key;
533
534 /**
530 * Timeout for this sender. 535 * Timeout for this sender.
531 */ 536 */
532 struct GNUNET_TIME_Absolute timeout; 537 struct GNUNET_TIME_Absolute timeout;
@@ -586,6 +591,11 @@ struct ReceiverAddress
586 struct GNUNET_PeerIdentity target; 591 struct GNUNET_PeerIdentity target;
587 592
588 /** 593 /**
594 * The address key for this entry.
595 */
596 struct GNUNET_HashCode key;
597
598 /**
589 * Shared secrets we received from @e target, first used is head. 599 * Shared secrets we received from @e target, first used is head.
590 */ 600 */
591 struct SharedSecret *ss_head; 601 struct SharedSecret *ss_head;
@@ -768,12 +778,12 @@ static struct GNUNET_TRANSPORT_CommunicatorHandle *ch;
768/** 778/**
769 * Receivers (map from peer identity to `struct ReceiverAddress`) 779 * Receivers (map from peer identity to `struct ReceiverAddress`)
770 */ 780 */
771static struct GNUNET_CONTAINER_MultiPeerMap *receivers; 781static struct GNUNET_CONTAINER_MultiHashMap *receivers;
772 782
773/** 783/**
774 * Senders (map from peer identity to `struct SenderAddress`) 784 * Senders (map from peer identity to `struct SenderAddress`)
775 */ 785 */
776static struct GNUNET_CONTAINER_MultiPeerMap *senders; 786static struct GNUNET_CONTAINER_MultiHashMap *senders;
777 787
778/** 788/**
779 * Expiration heap for senders (contains `struct SenderAddress`) 789 * Expiration heap for senders (contains `struct SenderAddress`)
@@ -840,6 +850,11 @@ static struct GNUNET_NAT_Handle *nat;
840 */ 850 */
841static uint16_t my_port; 851static uint16_t my_port;
842 852
853/**
854 * IPv6 disabled or not.
855 */
856static int disable_v6;
857
843 858
844/** 859/**
845 * An interface went away, stop broadcasting on it. 860 * An interface went away, stop broadcasting on it.
@@ -868,6 +883,8 @@ bi_destroy (struct BroadcastInterface *bi)
868 GNUNET_free (bi); 883 GNUNET_free (bi);
869} 884}
870 885
886static int
887secret_destroy (struct SharedSecret *ss);
871 888
872/** 889/**
873 * Destroys a receiving state due to timeout or shutdown. 890 * Destroys a receiving state due to timeout or shutdown.
@@ -877,7 +894,7 @@ bi_destroy (struct BroadcastInterface *bi)
877static void 894static void
878receiver_destroy (struct ReceiverAddress *receiver) 895receiver_destroy (struct ReceiverAddress *receiver)
879{ 896{
880 897 struct SharedSecret *ss;
881 receiver->receiver_destroy_called = GNUNET_YES; 898 receiver->receiver_destroy_called = GNUNET_YES;
882 899
883 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 900 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -894,15 +911,24 @@ receiver_destroy (struct ReceiverAddress *receiver)
894 GNUNET_TRANSPORT_communicator_mq_del (receiver->d_qh); 911 GNUNET_TRANSPORT_communicator_mq_del (receiver->d_qh);
895 receiver->d_qh = NULL; 912 receiver->d_qh = NULL;
896 } 913 }
914 else if (NULL != receiver->d_mq)
915 {
916 GNUNET_MQ_destroy (receiver->d_mq);
917 receiver->d_mq = NULL;
918 }
897 GNUNET_assert (GNUNET_YES == 919 GNUNET_assert (GNUNET_YES ==
898 GNUNET_CONTAINER_multipeermap_remove (receivers, 920 GNUNET_CONTAINER_multihashmap_remove (receivers,
899 &receiver->target, 921 &receiver->key,
900 receiver)); 922 receiver));
901 GNUNET_assert (receiver == GNUNET_CONTAINER_heap_remove_node (receiver->hn)); 923 GNUNET_assert (receiver == GNUNET_CONTAINER_heap_remove_node (receiver->hn));
902 GNUNET_STATISTICS_set (stats, 924 GNUNET_STATISTICS_set (stats,
903 "# receivers active", 925 "# receivers active",
904 GNUNET_CONTAINER_multipeermap_size (receivers), 926 GNUNET_CONTAINER_multihashmap_size (receivers),
905 GNUNET_NO); 927 GNUNET_NO);
928 while (NULL != (ss = receiver->ss_head))
929 {
930 secret_destroy (ss);
931 }
906 GNUNET_free (receiver->address); 932 GNUNET_free (receiver->address);
907 GNUNET_free (receiver->foreign_addr); 933 GNUNET_free (receiver->foreign_addr);
908 GNUNET_free (receiver); 934 GNUNET_free (receiver);
@@ -920,7 +946,6 @@ kce_destroy (struct KeyCacheEntry *kce)
920 struct SharedSecret *ss = kce->ss; 946 struct SharedSecret *ss = kce->ss;
921 947
922 ss->active_kce_count--; 948 ss->active_kce_count--;
923 ss->sender->acks_available--;
924 GNUNET_CONTAINER_DLL_remove (ss->kce_head, ss->kce_tail, kce); 949 GNUNET_CONTAINER_DLL_remove (ss->kce_head, ss->kce_tail, kce);
925 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multishortmap_remove (key_cache, 950 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multishortmap_remove (key_cache,
926 &kce->kid, 951 &kce->kid,
@@ -1011,8 +1036,10 @@ secret_destroy (struct SharedSecret *ss)
1011 GNUNET_CONTAINER_DLL_remove (sender->ss_head, sender->ss_tail, ss); 1036 GNUNET_CONTAINER_DLL_remove (sender->ss_head, sender->ss_tail, ss);
1012 sender->num_secrets--; 1037 sender->num_secrets--;
1013 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1038 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1014 "%u sender->num_secrets\n", 1039 "%u sender->num_secrets %u allowed %u used, %u available\n",
1015 sender->num_secrets); 1040 sender->num_secrets, ss->sequence_allowed, ss->sequence_used,
1041 sender->acks_available);
1042 sender->acks_available -= (ss->sequence_allowed - ss->sequence_used);
1016 if (NULL != ss->sender->kce_task) 1043 if (NULL != ss->sender->kce_task)
1017 { 1044 {
1018 GNUNET_SCHEDULER_cancel (ss->sender->kce_task); 1045 GNUNET_SCHEDULER_cancel (ss->sender->kce_task);
@@ -1049,15 +1076,20 @@ secret_destroy (struct SharedSecret *ss)
1049static void 1076static void
1050sender_destroy (struct SenderAddress *sender) 1077sender_destroy (struct SenderAddress *sender)
1051{ 1078{
1079 struct SharedSecret *ss;
1052 sender->sender_destroy_called = GNUNET_YES; 1080 sender->sender_destroy_called = GNUNET_YES;
1053 GNUNET_assert ( 1081 GNUNET_assert (
1054 GNUNET_YES == 1082 GNUNET_YES ==
1055 GNUNET_CONTAINER_multipeermap_remove (senders, &sender->target, sender)); 1083 GNUNET_CONTAINER_multihashmap_remove (senders, &sender->key, sender));
1056 GNUNET_assert (sender == GNUNET_CONTAINER_heap_remove_node (sender->hn)); 1084 GNUNET_assert (sender == GNUNET_CONTAINER_heap_remove_node (sender->hn));
1057 GNUNET_STATISTICS_set (stats, 1085 GNUNET_STATISTICS_set (stats,
1058 "# senders active", 1086 "# senders active",
1059 GNUNET_CONTAINER_multipeermap_size (senders), 1087 GNUNET_CONTAINER_multihashmap_size (senders),
1060 GNUNET_NO); 1088 GNUNET_NO);
1089 while (NULL != (ss = sender->ss_head))
1090 {
1091 secret_destroy (ss);
1092 }
1061 GNUNET_free (sender->address); 1093 GNUNET_free (sender->address);
1062 GNUNET_free (sender); 1094 GNUNET_free (sender);
1063} 1095}
@@ -1260,7 +1292,8 @@ setup_cipher (const struct GNUNET_HashCode *msec,
1260 1292
1261 GNUNET_assert (0 == 1293 GNUNET_assert (0 ==
1262 gcry_cipher_open (cipher, 1294 gcry_cipher_open (cipher,
1263 GCRY_CIPHER_AES256 /* low level: go for speed */, 1295 GCRY_CIPHER_AES256 /* low level: go for speed */
1296 ,
1264 GCRY_CIPHER_MODE_GCM, 1297 GCRY_CIPHER_MODE_GCM,
1265 0 /* flags */)); 1298 0 /* flags */));
1266 get_iv_key (msec, serial, key, iv); 1299 get_iv_key (msec, serial, key, iv);
@@ -1330,6 +1363,27 @@ setup_shared_secret_dec (const struct GNUNET_CRYPTO_EcdhePublicKey *ephemeral)
1330 1363
1331 1364
1332/** 1365/**
1366 * Setup shared secret for decryption for initial handshake.
1367 *
1368 * @param representative of ephemeral key we received from the other peer
1369 * @return new shared secret
1370 */
1371static struct SharedSecret *
1372setup_initial_shared_secret_dec (const struct
1373 GNUNET_CRYPTO_ElligatorRepresentative *
1374 representative)
1375{
1376 struct SharedSecret *ss;
1377
1378 ss = GNUNET_new (struct SharedSecret);
1379 GNUNET_CRYPTO_eddsa_elligator_kem_decaps (my_private_key, representative,
1380 &ss->master);
1381 calculate_cmac (ss);
1382 return ss;
1383}
1384
1385
1386/**
1333 * Setup new shared secret for encryption using KEM. 1387 * Setup new shared secret for encryption using KEM.
1334 * 1388 *
1335 * @param[out] ephemeral ephemeral key to be sent to other peer (encapsulated key from KEM) 1389 * @param[out] ephemeral ephemeral key to be sent to other peer (encapsulated key from KEM)
@@ -1356,6 +1410,35 @@ setup_shared_secret_ephemeral (struct GNUNET_CRYPTO_EcdhePublicKey *ephemeral,
1356 1410
1357 1411
1358/** 1412/**
1413 * Setup new shared secret for encryption using KEM for initial handshake.
1414 *
1415 * @param[out] representative of ephemeral key to be sent to other peer (encapsulated key from KEM)
1416 * @param[in,out] receiver queue to initialize encryption key for
1417 * @return new shared secret
1418 */
1419static struct SharedSecret *
1420setup_initial_shared_secret_ephemeral (struct
1421 GNUNET_CRYPTO_ElligatorRepresentative *
1422 representative,
1423 struct ReceiverAddress *receiver)
1424{
1425 struct SharedSecret *ss;
1426 struct GNUNET_HashCode k;
1427
1428 GNUNET_CRYPTO_eddsa_elligator_kem_encaps (&receiver->target.public_key,
1429 representative, &k);
1430 ss = GNUNET_new (struct SharedSecret);
1431 memcpy (&ss->master, &k, sizeof (k));
1432 calculate_cmac (ss);
1433 ss->receiver = receiver;
1434 GNUNET_CONTAINER_DLL_insert (receiver->ss_head, receiver->ss_tail, ss);
1435 receiver->num_secrets++;
1436 GNUNET_STATISTICS_update (stats, "# Secrets active", 1, GNUNET_NO);
1437 return ss;
1438}
1439
1440
1441/**
1359 * Setup the MQ for the @a receiver. If a queue exists, 1442 * Setup the MQ for the @a receiver. If a queue exists,
1360 * the existing one is destroyed. Then the MTU is 1443 * the existing one is destroyed. Then the MTU is
1361 * recalculated and a fresh queue is initialized. 1444 * recalculated and a fresh queue is initialized.
@@ -1439,8 +1522,8 @@ add_acks (struct SharedSecret *ss, int acks_to_add)
1439 1522
1440 /* move ss to head to avoid discarding it anytime soon! */ 1523 /* move ss to head to avoid discarding it anytime soon! */
1441 1524
1442 GNUNET_CONTAINER_DLL_remove (receiver->ss_head, receiver->ss_tail, ss); 1525 // GNUNET_CONTAINER_DLL_remove (receiver->ss_head, receiver->ss_tail, ss);
1443 GNUNET_CONTAINER_DLL_insert (receiver->ss_head, receiver->ss_tail, ss); 1526 // GNUNET_CONTAINER_DLL_insert (receiver->ss_head, receiver->ss_tail, ss);
1444} 1527}
1445 1528
1446 1529
@@ -1455,7 +1538,7 @@ add_acks (struct SharedSecret *ss, int acks_to_add)
1455 * @return #GNUNET_YES to continue to iterate 1538 * @return #GNUNET_YES to continue to iterate
1456 */ 1539 */
1457static int 1540static int
1458handle_ack (void *cls, const struct GNUNET_PeerIdentity *pid, void *value) 1541handle_ack (void *cls, const struct GNUNET_HashCode *key, void *value)
1459{ 1542{
1460 const struct UDPAck *ack = cls; 1543 const struct UDPAck *ack = cls;
1461 struct ReceiverAddress *receiver = value; 1544 struct ReceiverAddress *receiver = value;
@@ -1466,7 +1549,7 @@ handle_ack (void *cls, const struct GNUNET_PeerIdentity *pid, void *value)
1466 "in handle ack with cmac %s\n", 1549 "in handle ack with cmac %s\n",
1467 GNUNET_h2s (&ack->cmac)); 1550 GNUNET_h2s (&ack->cmac));
1468 1551
1469 (void) pid; 1552 (void) key;
1470 for (struct SharedSecret *ss = receiver->ss_head; NULL != ss; ss = ss->next) 1553 for (struct SharedSecret *ss = receiver->ss_head; NULL != ss; ss = ss->next)
1471 { 1554 {
1472 if (0 == memcmp (&ack->cmac, &ss->cmac, sizeof(struct GNUNET_HashCode))) 1555 if (0 == memcmp (&ack->cmac, &ss->cmac, sizeof(struct GNUNET_HashCode)))
@@ -1627,7 +1710,7 @@ try_handle_plaintext (struct SenderAddress *sender,
1627 ss_rekey->sender = sender; 1710 ss_rekey->sender = sender;
1628 GNUNET_CONTAINER_DLL_insert (sender->ss_head, sender->ss_tail, ss_rekey); 1711 GNUNET_CONTAINER_DLL_insert (sender->ss_head, sender->ss_tail, ss_rekey);
1629 sender->num_secrets++; 1712 sender->num_secrets++;
1630 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1713 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1631 "Received rekey secret with cmac %s\n", 1714 "Received rekey secret with cmac %s\n",
1632 GNUNET_h2s (&(ss_rekey->cmac))); 1715 GNUNET_h2s (&(ss_rekey->cmac)));
1633 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1716 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1642,22 +1725,27 @@ try_handle_plaintext (struct SenderAddress *sender,
1642 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1725 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1643 "We have %u acks available.\n", 1726 "We have %u acks available.\n",
1644 ss_rekey->sender->acks_available); 1727 ss_rekey->sender->acks_available);
1728 GNUNET_STATISTICS_update (stats,
1729 "# rekeying successful",
1730 1,
1731 GNUNET_NO);
1645 ss_rekey->sender->kce_send_ack_on_finish = GNUNET_YES; 1732 ss_rekey->sender->kce_send_ack_on_finish = GNUNET_YES;
1646 ss_rekey->override_available_acks = GNUNET_YES; 1733 ss_rekey->override_available_acks = GNUNET_YES;
1647 // FIXME 1734 // FIXME
1648 ss_rekey->sender->kce_task = GNUNET_SCHEDULER_add_delayed ( 1735 kce_generate_cb (ss_rekey);
1736 /* ss_rekey->sender->kce_task = GNUNET_SCHEDULER_add_delayed (
1649 WORKING_QUEUE_INTERVALL, 1737 WORKING_QUEUE_INTERVALL,
1650 kce_generate_cb, 1738 kce_generate_cb,
1651 ss_rekey); 1739 ss_rekey);*/
1652 // FIXME: Theoretically, this could be an Ack 1740 // FIXME: Theoretically, this could be an Ack
1653 buf_pos += ntohs (hdr->size); 1741 buf_pos += ntohs (hdr->size);
1654 bytes_remaining -= ntohs (hdr->size); 1742 bytes_remaining -= ntohs (hdr->size);
1655 pass_plaintext_to_core (sender, buf_pos, bytes_remaining); 1743 pass_plaintext_to_core (sender, buf_pos, bytes_remaining);
1656 if (sender->num_secrets > MAX_SECRETS) 1744 if (0 == purge_secrets (sender->ss_tail))
1657 { 1745 {
1658 if (0 == purge_secrets (sender->ss_tail)) 1746 // No secret purged. Delete oldest.
1747 if (sender->num_secrets > MAX_SECRETS)
1659 { 1748 {
1660 // No secret purged. Delete oldest.
1661 secret_destroy (sender->ss_tail); 1749 secret_destroy (sender->ss_tail);
1662 } 1750 }
1663 } 1751 }
@@ -1665,8 +1753,8 @@ try_handle_plaintext (struct SenderAddress *sender,
1665 case GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK: 1753 case GNUNET_MESSAGE_TYPE_COMMUNICATOR_UDP_ACK:
1666 /* lookup master secret by 'cmac', then update sequence_max */ 1754 /* lookup master secret by 'cmac', then update sequence_max */
1667 ack = (struct UDPAck*) buf_pos; 1755 ack = (struct UDPAck*) buf_pos;
1668 GNUNET_CONTAINER_multipeermap_get_multiple (receivers, 1756 GNUNET_CONTAINER_multihashmap_get_multiple (receivers,
1669 &sender->target, 1757 &sender->key,
1670 &handle_ack, 1758 &handle_ack,
1671 (void *) ack); 1759 (void *) ack);
1672 /* There could be more messages after the ACK, handle those as well */ 1760 /* There could be more messages after the ACK, handle those as well */
@@ -1699,6 +1787,9 @@ decrypt_box (const struct UDPBox *box,
1699 struct KeyCacheEntry *kce) 1787 struct KeyCacheEntry *kce)
1700{ 1788{
1701 struct SharedSecret *ss = kce->ss; 1789 struct SharedSecret *ss = kce->ss;
1790 struct SharedSecret *ss_c = ss->sender->ss_tail;
1791 struct SharedSecret *ss_tmp;
1792 int ss_destroyed = 0;
1702 char out_buf[box_len - sizeof(*box)]; 1793 char out_buf[box_len - sizeof(*box)];
1703 1794
1704 GNUNET_assert (NULL != ss->sender); 1795 GNUNET_assert (NULL != ss->sender);
@@ -1715,10 +1806,14 @@ decrypt_box (const struct UDPBox *box,
1715 1, 1806 1,
1716 GNUNET_NO); 1807 GNUNET_NO);
1717 kce_destroy (kce); 1808 kce_destroy (kce);
1809 ss->sender->acks_available--;
1718 return; 1810 return;
1719 } 1811 }
1720 kce_destroy (kce); 1812 kce_destroy (kce);
1721 kce = NULL; 1813 kce = NULL;
1814 ss->bytes_sent += box_len;
1815 ss->sender->acks_available--;
1816 ss->sequence_used++;
1722 GNUNET_STATISTICS_update (stats, 1817 GNUNET_STATISTICS_update (stats,
1723 "# bytes decrypted with BOX", 1818 "# bytes decrypted with BOX",
1724 sizeof(out_buf), 1819 sizeof(out_buf),
@@ -1731,6 +1826,27 @@ decrypt_box (const struct UDPBox *box,
1731 "decrypted UDPBox with kid %s\n", 1826 "decrypted UDPBox with kid %s\n",
1732 GNUNET_sh2s (&box->kid)); 1827 GNUNET_sh2s (&box->kid));
1733 try_handle_plaintext (ss->sender, out_buf, sizeof(out_buf)); 1828 try_handle_plaintext (ss->sender, out_buf, sizeof(out_buf));
1829
1830 while (NULL != ss_c)
1831 {
1832 if (ss_c->bytes_sent >= rekey_max_bytes)
1833 {
1834 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1835 "Removing SS because rekey bytes reached.\n");
1836 ss_tmp = ss_c->prev;
1837 if (ss == ss_c)
1838 ss_destroyed = 1;
1839 secret_destroy (ss_c);
1840 ss_c = ss_tmp;
1841 continue;
1842 }
1843 ss_c = ss_c->prev;
1844 }
1845 if (1 == ss_destroyed)
1846 return;
1847 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1848 "Sender has %u ack left.\n",
1849 ss->sender->acks_available);
1734 if ((KCN_THRESHOLD > ss->sender->acks_available) && 1850 if ((KCN_THRESHOLD > ss->sender->acks_available) &&
1735 (NULL == ss->sender->kce_task) && 1851 (NULL == ss->sender->kce_task) &&
1736 (GNUNET_YES == ss->sender->kce_task_finished)) 1852 (GNUNET_YES == ss->sender->kce_task_finished))
@@ -1769,32 +1885,6 @@ struct SearchContext
1769 1885
1770 1886
1771/** 1887/**
1772 * Find existing `struct SenderAddress` by matching addresses.
1773 *
1774 * @param cls a `struct SearchContext`
1775 * @param key ignored, must match already
1776 * @param value a `struct SenderAddress`
1777 * @return #GNUNET_YES if not found (continue to search), #GNUNET_NO if found
1778 */
1779static int
1780find_sender_by_address (void *cls,
1781 const struct GNUNET_PeerIdentity *key,
1782 void *value)
1783{
1784 struct SearchContext *sc = cls;
1785 struct SenderAddress *sender = value;
1786
1787 if ((sender->address_len == sc->address_len) &&
1788 (0 == memcmp (sender->address, sc->address, sender->address_len)))
1789 {
1790 sc->sender = sender;
1791 return GNUNET_NO; /* stop iterating! */
1792 }
1793 return GNUNET_YES;
1794}
1795
1796
1797/**
1798 * Create sender address for @a target. Note that we 1888 * Create sender address for @a target. Note that we
1799 * might already have one, so a fresh one is only allocated 1889 * might already have one, so a fresh one is only allocated
1800 * if one does not yet exist for @a address. 1890 * if one does not yet exist for @a address.
@@ -1811,31 +1901,33 @@ setup_sender (const struct GNUNET_PeerIdentity *target,
1811 socklen_t address_len) 1901 socklen_t address_len)
1812{ 1902{
1813 struct SenderAddress *sender; 1903 struct SenderAddress *sender;
1814 struct SearchContext sc = { .address = address, 1904 struct GNUNET_HashContext *hsh;
1815 .address_len = address_len, 1905 struct GNUNET_HashCode sender_key;
1816 .sender = NULL }; 1906
1907 hsh = GNUNET_CRYPTO_hash_context_start ();
1908 GNUNET_CRYPTO_hash_context_read (hsh, address, address_len);
1909 GNUNET_CRYPTO_hash_context_read (hsh, target, sizeof(*target));
1910 GNUNET_CRYPTO_hash_context_finish (hsh, &sender_key);
1817 1911
1818 GNUNET_CONTAINER_multipeermap_get_multiple (senders, 1912 sender = GNUNET_CONTAINER_multihashmap_get (senders, &sender_key);
1819 target, 1913 if (NULL != sender)
1820 &find_sender_by_address,
1821 &sc);
1822 if (NULL != sc.sender)
1823 { 1914 {
1824 reschedule_sender_timeout (sc.sender); 1915 reschedule_sender_timeout (sender);
1825 return sc.sender; 1916 return sender;
1826 } 1917 }
1827 sender = GNUNET_new (struct SenderAddress); 1918 sender = GNUNET_new (struct SenderAddress);
1919 sender->key = sender_key;
1828 sender->target = *target; 1920 sender->target = *target;
1829 sender->address = GNUNET_memdup (address, address_len); 1921 sender->address = GNUNET_memdup (address, address_len);
1830 sender->address_len = address_len; 1922 sender->address_len = address_len;
1831 (void) GNUNET_CONTAINER_multipeermap_put ( 1923 (void) GNUNET_CONTAINER_multihashmap_put (
1832 senders, 1924 senders,
1833 &sender->target, 1925 &sender->key,
1834 sender, 1926 sender,
1835 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1927 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1836 GNUNET_STATISTICS_set (stats, 1928 GNUNET_STATISTICS_set (stats,
1837 "# senders active", 1929 "# senders active",
1838 GNUNET_CONTAINER_multipeermap_size (receivers), 1930 GNUNET_CONTAINER_multihashmap_size (receivers),
1839 GNUNET_NO); 1931 GNUNET_NO);
1840 sender->timeout = 1932 sender->timeout =
1841 GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT); 1933 GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT);
@@ -1949,7 +2041,7 @@ sock_read (void *cls)
1949 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2041 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1950 "Failed to recv from %s family %d failed sock %p\n", 2042 "Failed to recv from %s family %d failed sock %p\n",
1951 GNUNET_a2s ((struct sockaddr*) &sa, 2043 GNUNET_a2s ((struct sockaddr*) &sa,
1952 sizeof (addr)), 2044 sizeof (*addr)),
1953 addr->sa_family, 2045 addr->sa_family,
1954 udp_sock); 2046 udp_sock);
1955 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "recv"); 2047 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "recv");
@@ -2072,7 +2164,7 @@ sock_read (void *cls)
2072 struct SenderAddress *sender; 2164 struct SenderAddress *sender;
2073 2165
2074 kx = (const struct InitialKX *) buf; 2166 kx = (const struct InitialKX *) buf;
2075 ss = setup_shared_secret_dec (&kx->ephemeral); 2167 ss = setup_initial_shared_secret_dec (&kx->representative);
2076 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2168 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2077 "Before DEC\n"); 2169 "Before DEC\n");
2078 2170
@@ -2097,7 +2189,11 @@ sock_read (void *cls)
2097 "Before VERIFY\n"); 2189 "Before VERIFY\n");
2098 2190
2099 uc = (const struct UDPConfirmation *) pbuf; 2191 uc = (const struct UDPConfirmation *) pbuf;
2100 if (GNUNET_OK != verify_confirmation (&kx->ephemeral, uc)) 2192
2193 struct GNUNET_CRYPTO_EcdhePublicKey pub_ephemeral;
2194 GNUNET_CRYPTO_ecdhe_elligator_decoding (&pub_ephemeral, NULL,
2195 &kx->representative);
2196 if (GNUNET_OK != verify_confirmation (&pub_ephemeral, uc)) // TODO: need ephemeral instead of representative
2101 { 2197 {
2102 GNUNET_break_op (0); 2198 GNUNET_break_op (0);
2103 GNUNET_free (ss); 2199 GNUNET_free (ss);
@@ -2131,11 +2227,11 @@ sock_read (void *cls)
2131 1, 2227 1,
2132 GNUNET_NO); 2228 GNUNET_NO);
2133 try_handle_plaintext (sender, &uc[1], sizeof(pbuf) - sizeof(*uc)); 2229 try_handle_plaintext (sender, &uc[1], sizeof(pbuf) - sizeof(*uc));
2134 if (sender->num_secrets > MAX_SECRETS) 2230 if (0 == purge_secrets (sender->ss_tail))
2135 { 2231 {
2136 if (0 == purge_secrets (sender->ss_tail)) 2232 // No secret purged. Delete oldest.
2233 if (sender->num_secrets > MAX_SECRETS)
2137 { 2234 {
2138 // No secret purged. Delete oldest.
2139 secret_destroy (sender->ss_tail); 2235 secret_destroy (sender->ss_tail);
2140 } 2236 }
2141 } 2237 }
@@ -2170,11 +2266,7 @@ udp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
2170 bindto); 2266 bindto);
2171 return NULL; 2267 return NULL;
2172 } 2268 }
2173 if ((GNUNET_NO == GNUNET_NETWORK_test_pf (PF_INET6)) || 2269 if (GNUNET_YES == disable_v6)
2174 (GNUNET_YES ==
2175 GNUNET_CONFIGURATION_get_value_yesno (cfg,
2176 COMMUNICATOR_CONFIG_SECTION,
2177 "DISABLE_V6")))
2178 { 2270 {
2179 struct sockaddr_in *i4; 2271 struct sockaddr_in *i4;
2180 2272
@@ -2265,7 +2357,7 @@ udp_address_to_sockaddr (const char *bindto, socklen_t *sock_len)
2265 v6.sin6_family = AF_INET6; 2357 v6.sin6_family = AF_INET6;
2266 v6.sin6_port = htons ((uint16_t) port); 2358 v6.sin6_port = htons ((uint16_t) port);
2267#if HAVE_SOCKADDR_IN_SIN_LEN 2359#if HAVE_SOCKADDR_IN_SIN_LEN
2268 v6.sin6_len = sizeof(sizeof(struct sockaddr_in6)); 2360 v6.sin6_len = sizeof(struct sockaddr_in6);
2269#endif 2361#endif
2270 in = GNUNET_memdup (&v6, sizeof(v6)); 2362 in = GNUNET_memdup (&v6, sizeof(v6));
2271 *sock_len = sizeof(v6); 2363 *sock_len = sizeof(v6);
@@ -2330,14 +2422,16 @@ send_msg_with_kx (const struct GNUNET_MessageHeader *msg, struct
2330 reschedule_receiver_timeout (receiver); 2422 reschedule_receiver_timeout (receiver);
2331 2423
2332 /* setup key material */ 2424 /* setup key material */
2425 struct GNUNET_CRYPTO_ElligatorRepresentative repr;
2426 ss = setup_initial_shared_secret_ephemeral (&repr, receiver);
2427 GNUNET_CRYPTO_ecdhe_elligator_decoding (&uhs.ephemeral, NULL,
2428 &repr);
2333 2429
2334 ss = setup_shared_secret_ephemeral (&uhs.ephemeral, receiver); 2430 if (0 == purge_secrets (receiver->ss_tail))
2335
2336 if (receiver->num_secrets > MAX_SECRETS)
2337 { 2431 {
2338 if (0 == purge_secrets (receiver->ss_tail)) 2432 // No secret purged. Delete oldest.
2433 if (receiver->num_secrets > MAX_SECRETS)
2339 { 2434 {
2340 // No secret purged. Delete oldest.
2341 secret_destroy (receiver->ss_tail); 2435 secret_destroy (receiver->ss_tail);
2342 } 2436 }
2343 } 2437 }
@@ -2371,7 +2465,7 @@ send_msg_with_kx (const struct GNUNET_MessageHeader *msg, struct
2371 dpos += msize; 2465 dpos += msize;
2372 do_pad (out_cipher, &dgram[dpos], sizeof(dgram) - dpos); 2466 do_pad (out_cipher, &dgram[dpos], sizeof(dgram) - dpos);
2373 /* Datagram starts with kx */ 2467 /* Datagram starts with kx */
2374 kx.ephemeral = uhs.ephemeral; 2468 kx.representative = repr;
2375 GNUNET_assert ( 2469 GNUNET_assert (
2376 0 == gcry_cipher_gettag (out_cipher, kx.gcm_tag, sizeof(kx.gcm_tag))); 2470 0 == gcry_cipher_gettag (out_cipher, kx.gcm_tag, sizeof(kx.gcm_tag)));
2377 gcry_cipher_close (out_cipher); 2471 gcry_cipher_close (out_cipher);
@@ -2485,20 +2579,28 @@ mq_send_d (struct GNUNET_MQ_Handle *mq,
2485 2579
2486 if (receiver->num_secrets > MAX_SECRETS) 2580 if (receiver->num_secrets > MAX_SECRETS)
2487 { 2581 {
2488 if (0 == purge_secrets (receiver->ss_tail)) 2582 if ((0 == purge_secrets (receiver->ss_tail)) &&
2583 (NULL != receiver->ss_tail))
2489 { 2584 {
2490 // No secret purged. Delete oldest. 2585 // No secret purged. Delete oldest.
2491 secret_destroy (receiver->ss_tail); 2586 secret_destroy (receiver->ss_tail);
2492 } 2587 }
2493 } 2588 }
2494 /* begin "BOX" encryption method, scan for ACKs from tail! */ 2589 /* begin "BOX" encryption method, scan for ACKs from tail! */
2495 for (ss = receiver->ss_tail; NULL != ss; ss = ss->prev) 2590 ss = receiver->ss_tail;
2591 struct SharedSecret *ss_tmp;
2592 while (NULL != ss)
2496 { 2593 {
2497 size_t payload_len = sizeof(struct UDPBox) + receiver->d_mtu; 2594 size_t payload_len = sizeof(struct UDPBox) + receiver->d_mtu;
2595 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2596 "Considering SS %s sequence used: %u sequence allowed: %u bytes sent: %lu.\n",
2597 GNUNET_h2s (&ss->master), ss->sequence_used,
2598 ss->sequence_allowed, ss->bytes_sent);
2498 if (ss->sequence_used >= ss->sequence_allowed) 2599 if (ss->sequence_used >= ss->sequence_allowed)
2499 { 2600 {
2500 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2601 // GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2501 "Skipping ss because no acks to use.\n"); 2602 // "Skipping ss because no acks to use.\n");
2603 ss = ss->prev;
2502 continue; 2604 continue;
2503 } 2605 }
2504 if (ss->bytes_sent >= rekey_max_bytes) 2606 if (ss->bytes_sent >= rekey_max_bytes)
@@ -2506,13 +2608,16 @@ mq_send_d (struct GNUNET_MQ_Handle *mq,
2506 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2608 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2507 "Skipping ss because rekey bytes reached.\n"); 2609 "Skipping ss because rekey bytes reached.\n");
2508 // FIXME cleanup ss with too many bytes sent! 2610 // FIXME cleanup ss with too many bytes sent!
2611 ss_tmp = ss->prev;
2612 secret_destroy (ss);
2613 ss = ss_tmp;
2509 continue; 2614 continue;
2510 } 2615 }
2511 if (ss->bytes_sent > rekey_max_bytes * 0.7) 2616 if (ss->bytes_sent > rekey_max_bytes * 0.7)
2512 { 2617 {
2513 if (ss->rekey_initiated == GNUNET_NO) 2618 if (ss->rekey_initiated == GNUNET_NO)
2514 { 2619 {
2515 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2516 "Injecting rekey for ss with byte sent %lu\n", 2621 "Injecting rekey for ss with byte sent %lu\n",
2517 (unsigned long) ss->bytes_sent); 2622 (unsigned long) ss->bytes_sent);
2518 create_rekey (receiver, ss, &rekey); 2623 create_rekey (receiver, ss, &rekey);
@@ -2761,6 +2866,8 @@ static int
2761mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address) 2866mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
2762{ 2867{
2763 struct ReceiverAddress *receiver; 2868 struct ReceiverAddress *receiver;
2869 struct GNUNET_HashContext *hsh;
2870 struct GNUNET_HashCode receiver_key;
2764 const char *path; 2871 const char *path;
2765 struct sockaddr *in; 2872 struct sockaddr *in;
2766 socklen_t in_len; 2873 socklen_t in_len;
@@ -2775,14 +2882,45 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
2775 path = &address[strlen (COMMUNICATOR_ADDRESS_PREFIX "-")]; 2882 path = &address[strlen (COMMUNICATOR_ADDRESS_PREFIX "-")];
2776 in = udp_address_to_sockaddr (path, &in_len); 2883 in = udp_address_to_sockaddr (path, &in_len);
2777 2884
2885 if (NULL == in)
2886 {
2887 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2888 "Failed to setup UDP socket address\n");
2889 return GNUNET_SYSERR;
2890 }
2891 if ((AF_INET6 == in->sa_family) &&
2892 (GNUNET_YES == disable_v6))
2893 {
2894 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2895 "IPv6 disabled, skipping %s\n", address);
2896 GNUNET_free (in);
2897 return GNUNET_SYSERR;
2898 }
2899
2900 hsh = GNUNET_CRYPTO_hash_context_start ();
2901 GNUNET_CRYPTO_hash_context_read (hsh, in, in_len);
2902 GNUNET_CRYPTO_hash_context_read (hsh, peer, sizeof(*peer));
2903 GNUNET_CRYPTO_hash_context_finish (hsh, &receiver_key);
2904
2905 receiver = GNUNET_CONTAINER_multihashmap_get (receivers, &receiver_key);
2906 if (NULL != receiver)
2907 {
2908 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2909 "receiver %s already exist or is being connected to\n",
2910 address);
2911 GNUNET_free (in);
2912 return GNUNET_NO;
2913 }
2914
2778 receiver = GNUNET_new (struct ReceiverAddress); 2915 receiver = GNUNET_new (struct ReceiverAddress);
2916 receiver->key = receiver_key;
2779 receiver->address = in; 2917 receiver->address = in;
2780 receiver->address_len = in_len; 2918 receiver->address_len = in_len;
2781 receiver->target = *peer; 2919 receiver->target = *peer;
2782 receiver->nt = GNUNET_NT_scanner_get_type (is, in, in_len); 2920 receiver->nt = GNUNET_NT_scanner_get_type (is, in, in_len);
2783 (void) GNUNET_CONTAINER_multipeermap_put ( 2921 (void) GNUNET_CONTAINER_multihashmap_put (
2784 receivers, 2922 receivers,
2785 &receiver->target, 2923 &receiver->key,
2786 receiver, 2924 receiver,
2787 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 2925 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
2788 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2926 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2795,7 +2933,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
2795 receiver->timeout.abs_value_us); 2933 receiver->timeout.abs_value_us);
2796 GNUNET_STATISTICS_set (stats, 2934 GNUNET_STATISTICS_set (stats,
2797 "# receivers active", 2935 "# receivers active",
2798 GNUNET_CONTAINER_multipeermap_size (receivers), 2936 GNUNET_CONTAINER_multihashmap_size (receivers),
2799 GNUNET_NO); 2937 GNUNET_NO);
2800 receiver->foreign_addr = 2938 receiver->foreign_addr =
2801 sockaddr_to_udpaddr_string (receiver->address, receiver->address_len); 2939 sockaddr_to_udpaddr_string (receiver->address, receiver->address_len);
@@ -2816,7 +2954,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address)
2816 */ 2954 */
2817static int 2955static int
2818get_receiver_delete_it (void *cls, 2956get_receiver_delete_it (void *cls,
2819 const struct GNUNET_PeerIdentity *target, 2957 const struct GNUNET_HashCode *target,
2820 void *value) 2958 void *value)
2821{ 2959{
2822 struct ReceiverAddress *receiver = value; 2960 struct ReceiverAddress *receiver = value;
@@ -2838,7 +2976,7 @@ get_receiver_delete_it (void *cls,
2838 */ 2976 */
2839static int 2977static int
2840get_sender_delete_it (void *cls, 2978get_sender_delete_it (void *cls,
2841 const struct GNUNET_PeerIdentity *target, 2979 const struct GNUNET_HashCode *target,
2842 void *value) 2980 void *value)
2843{ 2981{
2844 struct SenderAddress *sender = value; 2982 struct SenderAddress *sender = value;
@@ -2890,14 +3028,14 @@ do_shutdown (void *cls)
2890 GNUNET_NETWORK_socket_close (udp_sock)); 3028 GNUNET_NETWORK_socket_close (udp_sock));
2891 udp_sock = NULL; 3029 udp_sock = NULL;
2892 } 3030 }
2893 GNUNET_CONTAINER_multipeermap_iterate (receivers, 3031 GNUNET_CONTAINER_multihashmap_iterate (receivers,
2894 &get_receiver_delete_it, 3032 &get_receiver_delete_it,
2895 NULL); 3033 NULL);
2896 GNUNET_CONTAINER_multipeermap_destroy (receivers); 3034 GNUNET_CONTAINER_multihashmap_destroy (receivers);
2897 GNUNET_CONTAINER_multipeermap_iterate (senders, 3035 GNUNET_CONTAINER_multihashmap_iterate (senders,
2898 &get_sender_delete_it, 3036 &get_sender_delete_it,
2899 NULL); 3037 NULL);
2900 GNUNET_CONTAINER_multipeermap_destroy (senders); 3038 GNUNET_CONTAINER_multihashmap_destroy (senders);
2901 GNUNET_CONTAINER_multishortmap_destroy (key_cache); 3039 GNUNET_CONTAINER_multishortmap_destroy (key_cache);
2902 GNUNET_CONTAINER_heap_destroy (senders_heap); 3040 GNUNET_CONTAINER_heap_destroy (senders_heap);
2903 GNUNET_CONTAINER_heap_destroy (receivers_heap); 3041 GNUNET_CONTAINER_heap_destroy (receivers_heap);
@@ -2918,7 +3056,7 @@ do_shutdown (void *cls)
2918 } 3056 }
2919 if (NULL != stats) 3057 if (NULL != stats)
2920 { 3058 {
2921 GNUNET_STATISTICS_destroy (stats, GNUNET_NO); 3059 GNUNET_STATISTICS_destroy (stats, GNUNET_YES);
2922 stats = NULL; 3060 stats = NULL;
2923 } 3061 }
2924 if (NULL != my_private_key) 3062 if (NULL != my_private_key)
@@ -2936,6 +3074,28 @@ do_shutdown (void *cls)
2936} 3074}
2937 3075
2938 3076
3077struct AckInfo
3078{
3079 const struct UDPAck *ack;
3080
3081 const struct GNUNET_PeerIdentity *sender;
3082};
3083
3084static int
3085handle_ack_by_sender (void *cls, const struct GNUNET_HashCode *key, void *value)
3086{
3087 struct ReceiverAddress *receiver = value;
3088 struct AckInfo *ai = cls;
3089
3090 if (0 != GNUNET_memcmp (ai->sender, &receiver->target))
3091 {
3092 return GNUNET_YES;
3093 }
3094 handle_ack ((void*) ai->ack, key, receiver);
3095 return GNUNET_YES;
3096}
3097
3098
2939/** 3099/**
2940 * Function called when the transport service has received a 3100 * Function called when the transport service has received a
2941 * backchannel message for this communicator (!) via a different return 3101 * backchannel message for this communicator (!) via a different return
@@ -2950,7 +3110,7 @@ enc_notify_cb (void *cls,
2950 const struct GNUNET_PeerIdentity *sender, 3110 const struct GNUNET_PeerIdentity *sender,
2951 const struct GNUNET_MessageHeader *msg) 3111 const struct GNUNET_MessageHeader *msg)
2952{ 3112{
2953 const struct UDPAck *ack; 3113 struct AckInfo ai;
2954 3114
2955 (void) cls; 3115 (void) cls;
2956 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3116 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2962,11 +3122,11 @@ enc_notify_cb (void *cls,
2962 GNUNET_break_op (0); 3122 GNUNET_break_op (0);
2963 return; 3123 return;
2964 } 3124 }
2965 ack = (const struct UDPAck *) msg; 3125 ai.ack = (const struct UDPAck *) msg;
2966 GNUNET_CONTAINER_multipeermap_get_multiple (receivers, 3126 ai.sender = sender;
2967 sender, 3127 GNUNET_CONTAINER_multihashmap_iterate (receivers,
2968 &handle_ack, 3128 &handle_ack_by_sender,
2969 (void *) ack); 3129 &ai);
2970} 3130}
2971 3131
2972 3132
@@ -3306,7 +3466,18 @@ run (void *cls,
3306 COMMUNICATOR_CONFIG_SECTION, 3466 COMMUNICATOR_CONFIG_SECTION,
3307 "REKEY_MAX_BYTES", 3467 "REKEY_MAX_BYTES",
3308 &rekey_max_bytes)) 3468 &rekey_max_bytes))
3469 {
3309 rekey_max_bytes = DEFAULT_REKEY_MAX_BYTES; 3470 rekey_max_bytes = DEFAULT_REKEY_MAX_BYTES;
3471 }
3472 disable_v6 = GNUNET_NO;
3473 if ((GNUNET_NO == GNUNET_NETWORK_test_pf (PF_INET6)) ||
3474 (GNUNET_YES ==
3475 GNUNET_CONFIGURATION_get_value_yesno (cfg,
3476 COMMUNICATOR_CONFIG_SECTION,
3477 "DISABLE_V6")))
3478 {
3479 disable_v6 = GNUNET_YES;
3480 }
3310 3481
3311 in = udp_address_to_sockaddr (bindto, &in_len); 3482 in = udp_address_to_sockaddr (bindto, &in_len);
3312 if (NULL == in) 3483 if (NULL == in)
@@ -3390,9 +3561,9 @@ run (void *cls,
3390 GNUNET_break (0); 3561 GNUNET_break (0);
3391 my_port = 0; 3562 my_port = 0;
3392 } 3563 }
3393 stats = GNUNET_STATISTICS_create ("C-UDP", cfg); 3564 stats = GNUNET_STATISTICS_create ("communicator-udp", cfg);
3394 senders = GNUNET_CONTAINER_multipeermap_create (32, GNUNET_YES); 3565 senders = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES);
3395 receivers = GNUNET_CONTAINER_multipeermap_create (32, GNUNET_YES); 3566 receivers = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_YES);
3396 senders_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 3567 senders_heap = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
3397 receivers_heap = 3568 receivers_heap =
3398 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 3569 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
diff --git a/src/service/transport/gnunet-service-transport.c b/src/service/transport/gnunet-service-transport.c
index 344f46f1e..91ce801db 100644
--- a/src/service/transport/gnunet-service-transport.c
+++ b/src/service/transport/gnunet-service-transport.c
@@ -77,6 +77,7 @@
77#include "gnunet_statistics_service.h" 77#include "gnunet_statistics_service.h"
78#include "gnunet_transport_monitor_service.h" 78#include "gnunet_transport_monitor_service.h"
79#include "gnunet_peerstore_service.h" 79#include "gnunet_peerstore_service.h"
80#include "gnunet_nat_service.h"
80#include "gnunet_hello_uri_lib.h" 81#include "gnunet_hello_uri_lib.h"
81#include "gnunet_signatures.h" 82#include "gnunet_signatures.h"
82#include "transport.h" 83#include "transport.h"
@@ -916,6 +917,15 @@ struct TransportValidationResponseMessage
916 struct GNUNET_TIME_RelativeNBO validity_duration; 917 struct GNUNET_TIME_RelativeNBO validity_duration;
917}; 918};
918 919
920struct TransportGlobalNattedAddress
921{
922 /**
923 * Length of the address following the struct in NBO.
924 */
925 unsigned int address_length;
926
927 /* Followed by @e address_length bytes of the address. */
928};
919 929
920/** 930/**
921 * Message for Transport-to-Transport Flow control. Specifies the size 931 * Message for Transport-to-Transport Flow control. Specifies the size
@@ -973,9 +983,21 @@ struct TransportFlowControlMessage
973 * reset the counters for the number of bytes sent! 983 * reset the counters for the number of bytes sent!
974 */ 984 */
975 struct GNUNET_TIME_AbsoluteNBO sender_time; 985 struct GNUNET_TIME_AbsoluteNBO sender_time;
976};
977 986
978 987
988 /**
989 * Number of TransportGlobalNattedAddress following the struct.
990 */
991 unsigned int number_of_addresses;
992
993 /**
994 * Size of all the addresses attached to all TransportGlobalNattedAddress.
995 */
996 size_t size_of_addresses;
997
998 /* Followed by @e number_of_addresses struct TransportGlobalNattedAddress. */
999};
1000
979GNUNET_NETWORK_STRUCT_END 1001GNUNET_NETWORK_STRUCT_END
980 1002
981 1003
@@ -1921,6 +1943,12 @@ struct Queue
1921 struct PerformanceData pd; 1943 struct PerformanceData pd;
1922 1944
1923 /** 1945 /**
1946 * Handle for an operation to iterate through all hellos to compare the hello
1947 * addresses with @e address which might be a natted one.
1948 */
1949 struct GNUNET_PEERSTORE_Monitor *mo;
1950
1951 /**
1924 * Message ID generator for transmissions on this queue to the 1952 * Message ID generator for transmissions on this queue to the
1925 * communicator. 1953 * communicator.
1926 */ 1954 */
@@ -1976,6 +2004,11 @@ struct Queue
1976 * virtual link to give it a pending message. 2004 * virtual link to give it a pending message.
1977 */ 2005 */
1978 int idle; 2006 int idle;
2007
2008 /**
2009 * Set to GNUNET_yes, if this queues address is not a global natted one.
2010 */
2011 enum GNUNET_GenericReturnValue is_global_natted;
1979}; 2012};
1980 2013
1981 2014
@@ -2040,6 +2073,26 @@ struct Neighbour
2040 * PEERSTORE yet, or are we still waiting for a reply of PEERSTORE? 2073 * PEERSTORE yet, or are we still waiting for a reply of PEERSTORE?
2041 */ 2074 */
2042 int dv_monotime_available; 2075 int dv_monotime_available;
2076
2077 /**
2078 * Map of struct TransportGlobalNattedAddress for this neighbour.
2079 */
2080 struct GNUNET_CONTAINER_MultiPeerMap *natted_addresses;
2081
2082 /**
2083 * Number of global natted addresses for this neighbour.
2084 */
2085 unsigned int number_of_addresses;
2086
2087 /**
2088 * Size of all global natted addresses for this neighbour.
2089 */
2090 size_t size_of_global_addresses;
2091
2092 /**
2093 * A queue of this neighbour has a global natted address.
2094 */
2095 enum GNUNET_GenericReturnValue is_global_natted;
2043}; 2096};
2044 2097
2045 2098
@@ -2760,7 +2813,6 @@ struct Backtalker
2760 size_t body_size; 2813 size_t body_size;
2761}; 2814};
2762 2815
2763
2764/** 2816/**
2765 * Ring buffer for a CORE message we did not deliver to CORE, because of missing virtual link to sender. 2817 * Ring buffer for a CORE message we did not deliver to CORE, because of missing virtual link to sender.
2766 */ 2818 */
@@ -2897,6 +2949,11 @@ static struct LearnLaunchEntry *lle_tail = NULL;
2897static struct GNUNET_CONTAINER_Heap *validation_heap; 2949static struct GNUNET_CONTAINER_Heap *validation_heap;
2898 2950
2899/** 2951/**
2952 * Handle for connect to the NAT service.
2953 */
2954struct GNUNET_NAT_Handle *nh;
2955
2956/**
2900 * Database for peer's HELLOs. 2957 * Database for peer's HELLOs.
2901 */ 2958 */
2902static struct GNUNET_PEERSTORE_Handle *peerstore; 2959static struct GNUNET_PEERSTORE_Handle *peerstore;
@@ -3591,6 +3648,20 @@ client_connect_cb (void *cls,
3591} 3648}
3592 3649
3593 3650
3651static enum GNUNET_GenericReturnValue
3652remove_global_addresses (void *cls,
3653 const struct GNUNET_PeerIdentity *pid,
3654 void *value)
3655{
3656 (void) cls;
3657 struct TransportGlobalNattedAddress *tgna = value;
3658
3659 GNUNET_free (tgna);
3660
3661 return GNUNET_OK;
3662}
3663
3664
3594/** 3665/**
3595 * Release memory used by @a neighbour. 3666 * Release memory used by @a neighbour.
3596 * 3667 *
@@ -3609,6 +3680,10 @@ free_neighbour (struct Neighbour *neighbour)
3609 neighbour)); 3680 neighbour));
3610 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3681 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3611 "Freeing neighbour\n"); 3682 "Freeing neighbour\n");
3683 GNUNET_CONTAINER_multipeermap_iterate (neighbour->natted_addresses,
3684 &remove_global_addresses,
3685 NULL);
3686 GNUNET_CONTAINER_multipeermap_destroy (neighbour->natted_addresses);
3612 while (NULL != (dvh = neighbour->dv_head)) 3687 while (NULL != (dvh = neighbour->dv_head))
3613 { 3688 {
3614 struct DistanceVector *dv = dvh->dv; 3689 struct DistanceVector *dv = dvh->dv;
@@ -3878,6 +3953,11 @@ free_queue (struct Queue *queue)
3878 3953
3879 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3954 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3880 "Cleaning up queue %u\n", queue->qid); 3955 "Cleaning up queue %u\n", queue->qid);
3956 if (NULL != queue->mo)
3957 {
3958 GNUNET_PEERSTORE_monitor_stop (queue->mo);
3959 queue->mo = NULL;
3960 }
3881 if (NULL != queue->transmit_task) 3961 if (NULL != queue->transmit_task)
3882 { 3962 {
3883 GNUNET_SCHEDULER_cancel (queue->transmit_task); 3963 GNUNET_SCHEDULER_cancel (queue->transmit_task);
@@ -3898,8 +3978,7 @@ free_queue (struct Queue *queue)
3898 tc->details.communicator.queue_tail, 3978 tc->details.communicator.queue_tail,
3899 queue); 3979 queue);
3900 maxxed = (COMMUNICATOR_TOTAL_QUEUE_LIMIT <= 3980 maxxed = (COMMUNICATOR_TOTAL_QUEUE_LIMIT <=
3901 tc->details.communicator. 3981 tc->details.communicator.total_queue_length);
3902 total_queue_length);
3903 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3982 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3904 "Cleaning up queue with length %u\n", 3983 "Cleaning up queue with length %u\n",
3905 queue->queue_length); 3984 queue->queue_length);
@@ -3915,9 +3994,6 @@ free_queue (struct Queue *queue)
3915 } 3994 }
3916 GNUNET_free (qe); 3995 GNUNET_free (qe);
3917 } 3996 }
3918 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3919 "Cleaning up queue with length %u\n",
3920 queue->queue_length);
3921 GNUNET_assert (0 == queue->queue_length); 3997 GNUNET_assert (0 == queue->queue_length);
3922 if ((maxxed) && (COMMUNICATOR_TOTAL_QUEUE_LIMIT > 3998 if ((maxxed) && (COMMUNICATOR_TOTAL_QUEUE_LIMIT >
3923 tc->details.communicator.total_queue_length)) 3999 tc->details.communicator.total_queue_length))
@@ -5267,6 +5343,42 @@ task_consider_sending_fc (void *cls)
5267} 5343}
5268 5344
5269 5345
5346static char *
5347get_address_without_port (const char *address);
5348
5349
5350struct AddGlobalAddressesContext
5351{
5352 size_t off;
5353 char *tgnas;
5354};
5355
5356
5357static enum GNUNET_GenericReturnValue
5358add_global_addresses (void *cls,
5359 const struct GNUNET_PeerIdentity *pid,
5360 void *value)
5361{
5362 struct AddGlobalAddressesContext *ctx = cls;
5363 struct TransportGlobalNattedAddress *tgna = value;
5364 char *addr = (char *) &tgna[1];
5365 size_t address_len = strlen (addr);
5366
5367 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
5368 "sending address %s length %lu\n",
5369 addr,
5370 address_len);
5371 tgna = GNUNET_malloc (sizeof (struct TransportGlobalNattedAddress) + address_len);
5372 tgna->address_length = htonl (address_len);
5373 GNUNET_memcpy (&tgna[1], addr, address_len);
5374 GNUNET_memcpy (&(ctx->tgnas[ctx->off]), tgna, sizeof (struct TransportGlobalNattedAddress) + address_len);
5375 GNUNET_free (tgna);
5376 ctx->off += sizeof(struct TransportGlobalNattedAddress) + address_len;
5377
5378 return GNUNET_OK;
5379}
5380
5381
5270/** 5382/**
5271 * Something changed on the virtual link with respect to flow 5383 * Something changed on the virtual link with respect to flow
5272 * control. Consider retransmitting the FC window size. 5384 * control. Consider retransmitting the FC window size.
@@ -5278,9 +5390,35 @@ consider_sending_fc (void *cls)
5278{ 5390{
5279 struct VirtualLink *vl = cls; 5391 struct VirtualLink *vl = cls;
5280 struct GNUNET_TIME_Absolute monotime; 5392 struct GNUNET_TIME_Absolute monotime;
5281 struct TransportFlowControlMessage fc; 5393 struct TransportFlowControlMessage *fc;
5282 struct GNUNET_TIME_Relative duration; 5394 struct GNUNET_TIME_Relative duration;
5283 struct GNUNET_TIME_Relative rtt; 5395 struct GNUNET_TIME_Relative rtt;
5396 struct Neighbour *n = vl->n;
5397
5398 if (0 < n->number_of_addresses)
5399 {
5400 size_t addresses_size =
5401 n->number_of_addresses * sizeof (struct TransportGlobalNattedAddress) + n->size_of_global_addresses;
5402 char *tgnas = GNUNET_malloc (addresses_size);
5403 struct AddGlobalAddressesContext ctx;
5404 ctx.off = 0;
5405 ctx.tgnas = tgnas;
5406
5407 fc = GNUNET_malloc (sizeof (struct TransportFlowControlMessage) + addresses_size);
5408 fc->header.size = htons (sizeof(struct TransportFlowControlMessage) + addresses_size);
5409 fc->size_of_addresses = htonl (n->size_of_global_addresses);
5410 fc->number_of_addresses = htonl (n->number_of_addresses);
5411 GNUNET_CONTAINER_multipeermap_iterate (n->natted_addresses,
5412 &add_global_addresses,
5413 &ctx);
5414 GNUNET_memcpy (&fc[1], tgnas, addresses_size);
5415 GNUNET_free (tgnas);
5416 }
5417 else
5418 {
5419 fc = GNUNET_malloc (sizeof (struct TransportFlowControlMessage));
5420 fc->header.size = htons (sizeof(struct TransportFlowControlMessage));
5421 }
5284 5422
5285 duration = GNUNET_TIME_absolute_get_duration (vl->last_fc_transmission); 5423 duration = GNUNET_TIME_absolute_get_duration (vl->last_fc_transmission);
5286 /* OPTIMIZE-FC-BDP: decide sane criteria on when to do this, instead of doing 5424 /* OPTIMIZE-FC-BDP: decide sane criteria on when to do this, instead of doing
@@ -5299,16 +5437,15 @@ consider_sending_fc (void *cls)
5299 (unsigned long long) vl->incoming_fc_window_size); 5437 (unsigned long long) vl->incoming_fc_window_size);
5300 monotime = GNUNET_TIME_absolute_get_monotonic (GST_cfg); 5438 monotime = GNUNET_TIME_absolute_get_monotonic (GST_cfg);
5301 vl->last_fc_transmission = monotime; 5439 vl->last_fc_transmission = monotime;
5302 fc.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_FLOW_CONTROL); 5440 fc->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_FLOW_CONTROL);
5303 fc.header.size = htons (sizeof(fc)); 5441 fc->seq = htonl (vl->fc_seq_gen++);
5304 fc.seq = htonl (vl->fc_seq_gen++); 5442 fc->inbound_window_size = GNUNET_htonll (vl->incoming_fc_window_size
5305 fc.inbound_window_size = GNUNET_htonll (vl->incoming_fc_window_size
5306 + vl->incoming_fc_window_size_used 5443 + vl->incoming_fc_window_size_used
5307 + vl->incoming_fc_window_size_loss); 5444 + vl->incoming_fc_window_size_loss);
5308 fc.outbound_sent = GNUNET_htonll (vl->outbound_fc_window_size_used); 5445 fc->outbound_sent = GNUNET_htonll (vl->outbound_fc_window_size_used);
5309 fc.outbound_window_size = GNUNET_htonll (vl->outbound_fc_window_size); 5446 fc->outbound_window_size = GNUNET_htonll (vl->outbound_fc_window_size);
5310 fc.sender_time = GNUNET_TIME_absolute_hton (monotime); 5447 fc->sender_time = GNUNET_TIME_absolute_hton (monotime);
5311 rtt = route_control_message_without_fc (vl, &fc.header, RMO_DV_ALLOWED); 5448 rtt = route_control_message_without_fc (vl, &fc->header, RMO_DV_ALLOWED);
5312 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == rtt.rel_value_us) 5449 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == rtt.rel_value_us)
5313 { 5450 {
5314 rtt = GNUNET_TIME_UNIT_SECONDS; 5451 rtt = GNUNET_TIME_UNIT_SECONDS;
@@ -5333,6 +5470,7 @@ consider_sending_fc (void *cls)
5333 vl->fc_retransmit_task = 5470 vl->fc_retransmit_task =
5334 GNUNET_SCHEDULER_add_delayed (rtt, &task_consider_sending_fc, vl); 5471 GNUNET_SCHEDULER_add_delayed (rtt, &task_consider_sending_fc, vl);
5335 vl->fc_retransmit_count++; 5472 vl->fc_retransmit_count++;
5473 GNUNET_free (fc);
5336} 5474}
5337 5475
5338 5476
@@ -5779,6 +5917,29 @@ store_pi (void *cls)
5779} 5917}
5780 5918
5781 5919
5920static struct AddressListEntry *
5921create_address_entry (struct TransportClient *tc,
5922 struct GNUNET_TIME_Relative expiration,
5923 enum GNUNET_NetworkType nt,
5924 const char *address,
5925 uint32_t aid,
5926 size_t slen)
5927{
5928 struct AddressListEntry *ale;
5929
5930 ale = GNUNET_malloc (sizeof(struct AddressListEntry) + slen);
5931 ale->tc = tc;
5932 ale->address = (const char *) &ale[1];
5933 ale->expiration = expiration;
5934 ale->aid = aid;
5935 ale->nt = nt;
5936 memcpy (&ale[1], address, slen);
5937 ale->st = GNUNET_SCHEDULER_add_now (&store_pi, ale);
5938
5939 return ale;
5940}
5941
5942
5782/** 5943/**
5783 * Address of our peer added. Process the request. 5944 * Address of our peer added. Process the request.
5784 * 5945 *
@@ -5798,17 +5959,15 @@ handle_add_address (void *cls,
5798 "Communicator added address `%s'!\n", 5959 "Communicator added address `%s'!\n",
5799 (const char *) &aam[1]); 5960 (const char *) &aam[1]);
5800 slen = ntohs (aam->header.size) - sizeof(*aam); 5961 slen = ntohs (aam->header.size) - sizeof(*aam);
5801 ale = GNUNET_malloc (sizeof(struct AddressListEntry) + slen); 5962 ale = create_address_entry (tc,
5802 ale->tc = tc; 5963 GNUNET_TIME_relative_ntoh (aam->expiration),
5803 ale->address = (const char *) &ale[1]; 5964 (enum GNUNET_NetworkType) ntohl (aam->nt),
5804 ale->expiration = GNUNET_TIME_relative_ntoh (aam->expiration); 5965 (const char *) &aam[1],
5805 ale->aid = aam->aid; 5966 aam->aid,
5806 ale->nt = (enum GNUNET_NetworkType) ntohl (aam->nt); 5967 slen);
5807 memcpy (&ale[1], &aam[1], slen);
5808 GNUNET_CONTAINER_DLL_insert (tc->details.communicator.addr_head, 5968 GNUNET_CONTAINER_DLL_insert (tc->details.communicator.addr_head,
5809 tc->details.communicator.addr_tail, 5969 tc->details.communicator.addr_tail,
5810 ale); 5970 ale);
5811 ale->st = GNUNET_SCHEDULER_add_now (&store_pi, ale);
5812 GNUNET_SERVICE_client_continue (tc->client); 5971 GNUNET_SERVICE_client_continue (tc->client);
5813} 5972}
5814 5973
@@ -9450,6 +9609,36 @@ handle_incoming_msg (void *cls,
9450 demultiplex_with_cmc (cmc); 9609 demultiplex_with_cmc (cmc);
9451} 9610}
9452 9611
9612/**
9613 * Communicator gave us a transport address validation response. Check the
9614 * request.
9615 *
9616 * @param cls a `struct CommunicatorMessageContext`
9617 * @param fc the message that was received
9618 * @return #GNUNET_YES if message is well-formed
9619 */
9620static int
9621check_flow_control (void *cls, const struct TransportFlowControlMessage *fc)
9622{
9623 (void) cls;
9624 unsigned int number_of_addresses = ntohl (fc->number_of_addresses);
9625
9626 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9627 "Flow control header size %u size of addresses %u number of addresses %u size of message struct %lu second struct %lu\n",
9628 ntohs (fc->header.size),
9629 ntohl (fc->size_of_addresses),
9630 ntohl (fc->number_of_addresses),
9631 sizeof(struct TransportFlowControlMessage),
9632 sizeof (struct TransportGlobalNattedAddress));
9633
9634 if (0 == number_of_addresses || ntohs (fc->header.size) == sizeof(struct TransportFlowControlMessage) + ntohl (fc->number_of_addresses) * sizeof (struct TransportGlobalNattedAddress) + ntohl (fc->size_of_addresses))
9635 return GNUNET_OK;
9636 else
9637 {
9638 GNUNET_break_op (0);
9639 return GNUNET_SYSERR;
9640 }
9641}
9453 9642
9454/** 9643/**
9455 * Communicator gave us a transport address validation response. Process the 9644 * Communicator gave us a transport address validation response. Process the
@@ -9494,6 +9683,31 @@ handle_flow_control (void *cls, const struct TransportFlowControlMessage *fc)
9494 vl, 9683 vl,
9495 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); 9684 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
9496 } 9685 }
9686 if (0 != ntohl (fc->number_of_addresses))
9687 {
9688 unsigned int number_of_addresses = ntohl (fc->number_of_addresses);
9689 const char *tgnas;
9690 unsigned int off = 0;
9691
9692 tgnas = (const char *) &fc[1];
9693
9694 for (int i = 1; i <= number_of_addresses; i++)
9695 {
9696 struct TransportGlobalNattedAddress *tgna = (struct TransportGlobalNattedAddress *) &tgnas[off];
9697 char *addr = (char *) &tgna[1];
9698 unsigned int address_length;
9699
9700 address_length = ntohl (tgna->address_length);
9701 off += sizeof(struct TransportGlobalNattedAddress) + address_length;
9702
9703 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
9704 "received address %s length %u\n",
9705 addr,
9706 ntohl (tgna->address_length));
9707
9708 GNUNET_NAT_add_global_address (nh, addr, ntohl (tgna->address_length));
9709 }
9710 }
9497 st = GNUNET_TIME_absolute_ntoh (fc->sender_time); 9711 st = GNUNET_TIME_absolute_ntoh (fc->sender_time);
9498 if (st.abs_value_us < vl->last_fc_timestamp.abs_value_us) 9712 if (st.abs_value_us < vl->last_fc_timestamp.abs_value_us)
9499 { 9713 {
@@ -9600,15 +9814,15 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc)
9600 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX, 9814 GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX,
9601 struct TransportDVBoxMessage, 9815 struct TransportDVBoxMessage,
9602 cmc), 9816 cmc),
9817 GNUNET_MQ_hd_var_size (flow_control,
9818 GNUNET_MESSAGE_TYPE_TRANSPORT_FLOW_CONTROL,
9819 struct TransportFlowControlMessage,
9820 cmc),
9603 GNUNET_MQ_hd_fixed_size ( 9821 GNUNET_MQ_hd_fixed_size (
9604 validation_challenge, 9822 validation_challenge,
9605 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE, 9823 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE,
9606 struct TransportValidationChallengeMessage, 9824 struct TransportValidationChallengeMessage,
9607 cmc), 9825 cmc),
9608 GNUNET_MQ_hd_fixed_size (flow_control,
9609 GNUNET_MESSAGE_TYPE_TRANSPORT_FLOW_CONTROL,
9610 struct TransportFlowControlMessage,
9611 cmc),
9612 GNUNET_MQ_hd_fixed_size ( 9826 GNUNET_MQ_hd_fixed_size (
9613 validation_response, 9827 validation_response,
9614 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE, 9828 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE,
@@ -11321,6 +11535,7 @@ check_validation_request_pending (void *cls,
11321 char *address_without_port_q; 11535 char *address_without_port_q;
11322 int success = GNUNET_YES; 11536 int success = GNUNET_YES;
11323 11537
11538 //TODO Check if this is really necessary.
11324 address_without_port_vs = get_address_without_port (vs->address); 11539 address_without_port_vs = get_address_without_port (vs->address);
11325 address_without_port_q = get_address_without_port (q->address); 11540 address_without_port_q = get_address_without_port (q->address);
11326 11541
@@ -11384,6 +11599,193 @@ neighbour_dv_monotime_cb (void *cls,
11384} 11599}
11385 11600
11386 11601
11602static void
11603iterate_address_and_compare_cb (void *cls,
11604 const struct GNUNET_PeerIdentity *pid,
11605 const char *uri)
11606{
11607 struct Queue *queue = cls;
11608 const char *slash;
11609 char *address_uri;
11610 char *prefix;
11611 char *uri_without_port;
11612 char *address_uri_without_port;
11613
11614 slash = strrchr (uri, '/');
11615 prefix = GNUNET_strndup (uri, (slash - uri) - 2);
11616 GNUNET_assert (NULL != slash);
11617 slash++;
11618 GNUNET_asprintf (&address_uri,
11619 "%s-%s",
11620 prefix,
11621 slash);
11622
11623 address_uri_without_port = get_address_without_port (queue->address);
11624 uri_without_port = get_address_without_port (address_uri);
11625 if (0 == strcmp (uri_without_port, address_uri_without_port))
11626 {
11627 queue->is_global_natted = GNUNET_NO;
11628 }
11629
11630 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
11631 "not global natted %u %s %s %s %s %s %u\n",
11632 queue->is_global_natted,
11633 uri,
11634 queue->address,
11635 uri_without_port,
11636 address_uri_without_port,
11637 prefix,
11638 GNUNET_NO);
11639 GNUNET_free (prefix);
11640 GNUNET_free (address_uri);
11641 GNUNET_free (address_uri_without_port);
11642 GNUNET_free (uri_without_port);
11643}
11644
11645
11646static void
11647check_for_global_natted_error_cb (void *cls)
11648{
11649 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
11650 "Error in PEERSTORE monitoring for checking global natted\n");
11651}
11652
11653
11654static void
11655check_for_global_natted_sync_cb (void *cls)
11656{
11657 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
11658 "Done with initial PEERSTORE iteration during monitoring for checking global natted\n");
11659}
11660
11661
11662struct TransportGlobalNattedAddressClosure
11663{
11664 /**
11665 * The address to search for.
11666 */
11667 char *addr;
11668
11669 /**
11670 * The struct TransportGlobalNattedAddress to set.
11671 */
11672 struct TransportGlobalNattedAddress *tgna;
11673};
11674
11675
11676static enum GNUNET_GenericReturnValue
11677contains_address (void *cls,
11678 const struct GNUNET_PeerIdentity *pid,
11679 void *value)
11680{
11681 struct TransportGlobalNattedAddressClosure *tgna_cls = cls;
11682 struct TransportGlobalNattedAddress *tgna = value;
11683 char *addr = (char *) &tgna[1];
11684
11685 if (strlen(tgna_cls->addr) == ntohl (tgna->address_length)
11686 && 0 == strncmp (addr, tgna_cls->addr, ntohl (tgna->address_length)))
11687 {
11688 tgna_cls->tgna = tgna;
11689 return GNUNET_NO;
11690 }
11691 return GNUNET_YES;
11692}
11693
11694
11695static void
11696check_for_global_natted (void *cls,
11697 const struct GNUNET_PEERSTORE_Record *record,
11698 const char *emsg)
11699{
11700 struct Queue *queue = cls;
11701 struct Neighbour *neighbour = queue->neighbour;
11702 struct GNUNET_HELLO_Builder *builder;
11703 struct GNUNET_MessageHeader *hello;
11704 struct TransportGlobalNattedAddressClosure tgna_cls;
11705 size_t address_len_without_port;
11706
11707 if (NULL != emsg)
11708 {
11709 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
11710 "Got failure from PEERSTORE: %s\n",
11711 emsg);
11712 return;
11713 }
11714 if (NULL == record)
11715 {
11716 queue->mo = NULL;
11717 return;
11718 }
11719 if (0 == record->value_size)
11720 {
11721 GNUNET_PEERSTORE_monitor_next (queue->mo, 1);
11722 GNUNET_break (0);
11723 return;
11724 }
11725 queue->is_global_natted = GNUNET_YES;
11726 hello = record->value;
11727 builder = GNUNET_HELLO_builder_from_msg (hello);
11728 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
11729 "before not global natted %u\n",
11730 queue->is_global_natted);
11731 GNUNET_HELLO_builder_iterate (builder,
11732 &iterate_address_and_compare_cb,
11733 queue);
11734 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
11735 "after not global natted %u\n",
11736 queue->is_global_natted);
11737 GNUNET_HELLO_builder_free (builder);
11738
11739 tgna_cls.addr = get_address_without_port (queue->address);
11740 tgna_cls.tgna = NULL;
11741 address_len_without_port = strlen (tgna_cls.addr);
11742 GNUNET_CONTAINER_multipeermap_get_multiple (neighbour->natted_addresses,
11743 &neighbour->pid,
11744 &contains_address,
11745 &tgna_cls);
11746 if (NULL != tgna_cls.tgna)
11747 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
11748 " tgna_cls.tgna tgna %p %lu %u %u\n",
11749 tgna_cls.tgna,
11750 neighbour->size_of_global_addresses,
11751 ntohl (tgna_cls.tgna->address_length),
11752 neighbour->number_of_addresses);
11753 if (NULL == tgna_cls.tgna && GNUNET_YES == queue->is_global_natted)
11754 {
11755 struct TransportGlobalNattedAddress *tgna;
11756
11757 tgna = GNUNET_malloc (sizeof (struct TransportGlobalNattedAddress) + address_len_without_port);
11758 tgna->address_length = htonl (address_len_without_port);
11759 GNUNET_memcpy (&tgna[1], tgna_cls.addr, address_len_without_port);
11760 GNUNET_CONTAINER_multipeermap_put (neighbour->natted_addresses,
11761 &neighbour->pid,
11762 tgna,
11763 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
11764 neighbour->number_of_addresses++;
11765 neighbour->size_of_global_addresses += address_len_without_port;
11766 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
11767 "Created tgna %p\n",
11768 tgna);
11769 }
11770 else if (NULL != tgna_cls.tgna && GNUNET_NO == queue->is_global_natted)
11771 {
11772 GNUNET_CONTAINER_multipeermap_remove (neighbour->natted_addresses,
11773 &neighbour->pid,
11774 tgna_cls.tgna);
11775 GNUNET_assert (neighbour->size_of_global_addresses >= ntohl (tgna_cls.tgna->address_length));
11776 neighbour->size_of_global_addresses -= ntohl (tgna_cls.tgna->address_length);
11777 GNUNET_assert (0 < neighbour->number_of_addresses);
11778 neighbour->number_of_addresses--;
11779 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
11780 "removed tgna %p\n",
11781 tgna_cls.tgna);
11782 GNUNET_free (tgna_cls.tgna);
11783 }
11784 GNUNET_free (tgna_cls.addr);
11785 GNUNET_PEERSTORE_monitor_next (queue->mo, 1);
11786}
11787
11788
11387/** 11789/**
11388 * New queue became available. Process the request. 11790 * New queue became available. Process the request.
11389 * 11791 *
@@ -11430,6 +11832,7 @@ handle_add_queue_message (void *cls,
11430 if (NULL == neighbour) 11832 if (NULL == neighbour)
11431 { 11833 {
11432 neighbour = GNUNET_new (struct Neighbour); 11834 neighbour = GNUNET_new (struct Neighbour);
11835 neighbour->natted_addresses = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES);
11433 neighbour->pid = aqm->receiver; 11836 neighbour->pid = aqm->receiver;
11434 GNUNET_assert (GNUNET_OK == 11837 GNUNET_assert (GNUNET_OK ==
11435 GNUNET_CONTAINER_multipeermap_put ( 11838 GNUNET_CONTAINER_multipeermap_put (
@@ -11492,6 +11895,17 @@ handle_add_queue_message (void *cls,
11492 queue->nt = (enum GNUNET_NetworkType) ntohl (aqm->nt); 11895 queue->nt = (enum GNUNET_NetworkType) ntohl (aqm->nt);
11493 queue->cs = (enum GNUNET_TRANSPORT_ConnectionStatus) ntohl (aqm->cs); 11896 queue->cs = (enum GNUNET_TRANSPORT_ConnectionStatus) ntohl (aqm->cs);
11494 queue->idle = GNUNET_YES; 11897 queue->idle = GNUNET_YES;
11898 queue->mo = GNUNET_PEERSTORE_monitor_start (GST_cfg,
11899 GNUNET_YES,
11900 "peerstore",
11901 &neighbour->pid,
11902 GNUNET_PEERSTORE_HELLO_KEY,
11903 &check_for_global_natted_error_cb,
11904 NULL,
11905 &check_for_global_natted_sync_cb,
11906 NULL,
11907 &check_for_global_natted,
11908 queue);
11495 /* check if valdiations are waiting for the queue */ 11909 /* check if valdiations are waiting for the queue */
11496 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (validation_map, 11910 if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains (validation_map,
11497 &aqm->receiver)) 11911 &aqm->receiver))
@@ -11981,10 +12395,11 @@ static void
11981do_shutdown (void *cls) 12395do_shutdown (void *cls)
11982{ 12396{
11983 struct LearnLaunchEntry *lle; 12397 struct LearnLaunchEntry *lle;
12398 (void) cls;
11984 12399
11985 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 12400 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
11986 "shutdown logic\n"); 12401 "shutdown logic\n");
11987 (void) cls; 12402 GNUNET_NAT_unregister (nh);
11988 GNUNET_CONTAINER_multipeermap_iterate (neighbours, 12403 GNUNET_CONTAINER_multipeermap_iterate (neighbours,
11989 &free_neighbour_cb, NULL); 12404 &free_neighbour_cb, NULL);
11990 if (NULL != validation_task) 12405 if (NULL != validation_task)
@@ -12138,6 +12553,15 @@ run (void *cls,
12138 GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg); 12553 GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg);
12139 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); 12554 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
12140 peerstore = GNUNET_PEERSTORE_connect (GST_cfg); 12555 peerstore = GNUNET_PEERSTORE_connect (GST_cfg);
12556 nh = GNUNET_NAT_register (GST_cfg,
12557 "transport",
12558 0,
12559 0,
12560 NULL,
12561 0,
12562 NULL,
12563 NULL,
12564 NULL);
12141 if (NULL == peerstore) 12565 if (NULL == peerstore)
12142 { 12566 {
12143 GNUNET_break (0); 12567 GNUNET_break (0);
diff --git a/src/service/transport/meson.build b/src/service/transport/meson.build
index 1fdc47699..b46496b43 100644
--- a/src/service/transport/meson.build
+++ b/src/service/transport/meson.build
@@ -74,23 +74,9 @@ pkg.generate(libgnunettransportmonitor, url: 'https://www.gnunet.org',
74 description : 'Provides monitor API for accessing the transport service') 74 description : 'Provides monitor API for accessing the transport service')
75libgnunettransportmonitor_dep = declare_dependency(link_with : libgnunettransportmonitor) 75libgnunettransportmonitor_dep = declare_dependency(link_with : libgnunettransportmonitor)
76 76
77libgnunettransporttesting2 = library('gnunettransporttesting2', 77libgnunettestingtransport = library('gnunettestingtransport',
78 [ 78 [
79 'transport_api_traits.c', 79 'testing_transport_traits.c'
80 'transport_api_cmd_connecting_peers.c',
81 'transport_api_cmd_backchannel_check.c',
82 'transport_api_cmd_start_peer.c',
83 'transport_api_cmd_stop_peer.c',
84 'testing_api_cmd_start_peer.c',
85 'testing_api_cmd_stop_peer.c',
86 'transport_api_cmd_send_simple.c',
87 'transport_api_cmd_send_simple_performance.c',
88 'transport-testing2.c',
89 'transport-testing-filenames2.c',
90 'transport-testing-loggers2.c',
91 'transport-testing-main2.c',
92 'transport-testing-send2.c',
93 'transport-testing-communicator.c',
94 ], 80 ],
95 soversion: '0', 81 soversion: '0',
96 version: '0.0.0', 82 version: '0.0.0',
@@ -103,7 +89,7 @@ libgnunettransporttesting2 = library('gnunettransporttesting2',
103 include_directories: [incdir, configuration_inc], 89 include_directories: [incdir, configuration_inc],
104 install: true, 90 install: true,
105 install_dir: get_option('libdir')) 91 install_dir: get_option('libdir'))
106libgnunettransporttesting2_dep = declare_dependency(link_with : libgnunettransporttesting2) 92libgnunettestingtransport_dep = declare_dependency(link_with : libgnunettestingtransport)
107 93
108executable ('gnunet-service-transport', 94executable ('gnunet-service-transport',
109 gnunetservicetransport_src, 95 gnunetservicetransport_src,
@@ -168,12 +154,14 @@ executable ('gnunet-communicator-quic',
168 install_dir: get_option('libdir') / 'gnunet' / 'libexec') 154 install_dir: get_option('libdir') / 'gnunet' / 'libexec')
169endif 155endif
170 156
157if false
158
171libgnunettesttransport_cmd_simplesend = library('gnunet_test_transport_plugin_cmd_simple_send', 159libgnunettesttransport_cmd_simplesend = library('gnunet_test_transport_plugin_cmd_simple_send',
172 ['test_transport_plugin_cmd_simple_send.c'], 160 ['test_transport_plugin_cmd_simple_send.c'],
173 dependencies: [ 161 dependencies: [
174 libgnunetutil_dep, 162 libgnunetutil_dep,
175 libgnunettransportapplication_dep, 163 libgnunettransportapplication_dep,
176 libgnunettransporttesting2_dep, 164 libgnunettestingtransport_dep,
177 libgnunettransportcore_dep, 165 libgnunettransportcore_dep,
178 libgnunettesting_dep, 166 libgnunettesting_dep,
179 libgnunetpeerstore_dep, 167 libgnunetpeerstore_dep,
@@ -191,7 +179,7 @@ libgnunettesttransport_cmd_simplesendbc = library('gnunet_test_transport_plugin_
191 dependencies: [ 179 dependencies: [
192 libgnunetutil_dep, 180 libgnunetutil_dep,
193 libgnunettransportapplication_dep, 181 libgnunettransportapplication_dep,
194 libgnunettransporttesting2_dep, 182 libgnunettestingtransport_dep,
195 libgnunettransportcore_dep, 183 libgnunettransportcore_dep,
196 libgnunettesting_dep, 184 libgnunettesting_dep,
197 libgnunetpeerstore_dep, 185 libgnunetpeerstore_dep,
@@ -209,7 +197,7 @@ libgnunettesttransport_cmd_simplesenddv = library('gnunet_test_transport_plugin_
209 dependencies: [ 197 dependencies: [
210 libgnunetutil_dep, 198 libgnunetutil_dep,
211 libgnunettransportapplication_dep, 199 libgnunettransportapplication_dep,
212 libgnunettransporttesting2_dep, 200 libgnunettestingtransport_dep,
213 libgnunettransportcore_dep, 201 libgnunettransportcore_dep,
214 libgnunettesting_dep, 202 libgnunettesting_dep,
215 libgnunetpeerstore_dep, 203 libgnunetpeerstore_dep,
@@ -227,7 +215,7 @@ libgnunettesttransport_cmd_simplesendperf = library('gnunet_test_transport_plugi
227 dependencies: [ 215 dependencies: [
228 libgnunetutil_dep, 216 libgnunetutil_dep,
229 libgnunettransportapplication_dep, 217 libgnunettransportapplication_dep,
230 libgnunettransporttesting2_dep, 218 libgnunettestingtransport_dep,
231 libgnunettransportcore_dep, 219 libgnunettransportcore_dep,
232 libgnunettesting_dep, 220 libgnunettesting_dep,
233 libgnunetpeerstore_dep, 221 libgnunetpeerstore_dep,
@@ -244,7 +232,7 @@ libgnunettesttransport_cmd_udpback = library('gnunet_test_transport_plugin_cmd_u
244 ['test_transport_plugin_cmd_udp_backchannel.c'], 232 ['test_transport_plugin_cmd_udp_backchannel.c'],
245 dependencies: [ 233 dependencies: [
246 libgnunetutil_dep, 234 libgnunetutil_dep,
247 libgnunettransporttesting2_dep, 235 libgnunettestingtransport_dep,
248 libgnunettransportapplication_dep, 236 libgnunettransportapplication_dep,
249 libgnunettransportcore_dep, 237 libgnunettransportcore_dep,
250 libgnunettesting_dep, 238 libgnunettesting_dep,
@@ -263,7 +251,7 @@ libgnunettesttransport_cmd_natupnp = library('gnunet_test_transport_plugin_cmd_n
263 dependencies: [ 251 dependencies: [
264 libgnunetutil_dep, 252 libgnunetutil_dep,
265 libgnunettransportapplication_dep, 253 libgnunettransportapplication_dep,
266 libgnunettransporttesting2_dep, 254 libgnunettestingtransport_dep,
267 libgnunettransportcore_dep, 255 libgnunettransportcore_dep,
268 libgnunettesting_dep, 256 libgnunettesting_dep,
269 libgnunetpeerstore_dep, 257 libgnunetpeerstore_dep,
@@ -317,7 +305,7 @@ testcommunicator_basic_unix = executable('test_communicator_basic-unix',
317 dependencies: [ 305 dependencies: [
318 libgnunetutil_dep, 306 libgnunetutil_dep,
319 libgnunettransportapplication_dep, 307 libgnunettransportapplication_dep,
320 libgnunettransporttesting2_dep, 308 libgnunettestingtransport_dep,
321 libgnunettransportcore_dep, 309 libgnunettransportcore_dep,
322 libgnunettesting_dep, 310 libgnunettesting_dep,
323 libgnunetpeerstore_dep, 311 libgnunetpeerstore_dep,
@@ -333,7 +321,7 @@ testcommunicator_basic_tcp = executable('test_communicator_basic-tcp',
333 dependencies: [ 321 dependencies: [
334 libgnunetutil_dep, 322 libgnunetutil_dep,
335 libgnunettransportapplication_dep, 323 libgnunettransportapplication_dep,
336 libgnunettransporttesting2_dep, 324 libgnunettestingtransport_dep,
337 libgnunettransportcore_dep, 325 libgnunettransportcore_dep,
338 libgnunettesting_dep, 326 libgnunettesting_dep,
339 libgnunetpeerstore_dep, 327 libgnunetpeerstore_dep,
@@ -349,7 +337,7 @@ testcommunicator_basic_udp = executable('test_communicator_basic-udp',
349 dependencies: [ 337 dependencies: [
350 libgnunetutil_dep, 338 libgnunetutil_dep,
351 libgnunettransportapplication_dep, 339 libgnunettransportapplication_dep,
352 libgnunettransporttesting2_dep, 340 libgnunettestingtransport_dep,
353 libgnunettransportcore_dep, 341 libgnunettransportcore_dep,
354 libgnunettesting_dep, 342 libgnunettesting_dep,
355 libgnunetpeerstore_dep, 343 libgnunetpeerstore_dep,
@@ -366,7 +354,7 @@ if quic_dep.found() and get_option('experimental')
366 dependencies: [ 354 dependencies: [
367 libgnunetutil_dep, 355 libgnunetutil_dep,
368 libgnunettransportapplication_dep, 356 libgnunettransportapplication_dep,
369 libgnunettransporttesting2_dep, 357 libgnunettestingtransport_dep,
370 libgnunettransportcore_dep, 358 libgnunettransportcore_dep,
371 libgnunettesting_dep, 359 libgnunettesting_dep,
372 libgnunetpeerstore_dep, 360 libgnunetpeerstore_dep,
@@ -384,7 +372,7 @@ testcommunicator_rekey_tcp = executable('test_communicator_rekey-tcp',
384 dependencies: [ 372 dependencies: [
385 libgnunetutil_dep, 373 libgnunetutil_dep,
386 libgnunettransportapplication_dep, 374 libgnunettransportapplication_dep,
387 libgnunettransporttesting2_dep, 375 libgnunettestingtransport_dep,
388 libgnunettransportcore_dep, 376 libgnunettransportcore_dep,
389 libgnunettesting_dep, 377 libgnunettesting_dep,
390 libgnunetpeerstore_dep, 378 libgnunetpeerstore_dep,
@@ -401,7 +389,7 @@ testcommunicator_rekey_udp = executable('test_communicator_rekey-udp',
401 dependencies: [ 389 dependencies: [
402 libgnunetutil_dep, 390 libgnunetutil_dep,
403 libgnunettransportapplication_dep, 391 libgnunettransportapplication_dep,
404 libgnunettransporttesting2_dep, 392 libgnunettestingtransport_dep,
405 libgnunettransportcore_dep, 393 libgnunettransportcore_dep,
406 libgnunettesting_dep, 394 libgnunettesting_dep,
407 libgnunetpeerstore_dep, 395 libgnunetpeerstore_dep,
@@ -418,7 +406,7 @@ testcommunicator_backchannel_udp = executable('test_communicator_backchannel-udp
418 dependencies: [ 406 dependencies: [
419 libgnunetutil_dep, 407 libgnunetutil_dep,
420 libgnunettransportapplication_dep, 408 libgnunettransportapplication_dep,
421 libgnunettransporttesting2_dep, 409 libgnunettestingtransport_dep,
422 libgnunettransportcore_dep, 410 libgnunettransportcore_dep,
423 libgnunettesting_dep, 411 libgnunettesting_dep,
424 libgnunetpeerstore_dep, 412 libgnunetpeerstore_dep,
@@ -435,7 +423,7 @@ testcommunicator_bidirect_tcp = executable('test_communicator_bidirect-tcp',
435 dependencies: [ 423 dependencies: [
436 libgnunetutil_dep, 424 libgnunetutil_dep,
437 libgnunettransportapplication_dep, 425 libgnunettransportapplication_dep,
438 libgnunettransporttesting2_dep, 426 libgnunettestingtransport_dep,
439 libgnunettransportcore_dep, 427 libgnunettransportcore_dep,
440 libgnunettesting_dep, 428 libgnunettesting_dep,
441 libgnunetpeerstore_dep, 429 libgnunetpeerstore_dep,
@@ -499,3 +487,5 @@ test('test_communicator_backchannel-udp', testcommunicator_backchannel_udp,
499test('test_communicator_bidirect-tcp', testcommunicator_bidirect_tcp, 487test('test_communicator_bidirect-tcp', testcommunicator_bidirect_tcp,
500 workdir: meson.current_build_dir(), 488 workdir: meson.current_build_dir(),
501 suite: ['transport', 'communicator'], is_parallel: false) 489 suite: ['transport', 'communicator'], is_parallel: false)
490
491endif \ No newline at end of file
diff --git a/src/service/transport/test_communicator_basic.c b/src/service/transport/test_communicator_basic.c
index aa11ca5e0..78ac26b25 100644
--- a/src/service/transport/test_communicator_basic.c
+++ b/src/service/transport/test_communicator_basic.c
@@ -100,7 +100,7 @@ static struct GNUNET_STATISTICS_GetHandle *rekey_stats[NUM_PEERS];
100 100
101static unsigned int iterations_left[NUM_PEERS]; 101static unsigned int iterations_left[NUM_PEERS];
102 102
103#define TIMEOUT_MULTIPLIER 1 103#define TIMEOUT_MULTIPLIER 5
104 104
105#define DEFAULT_DELAY \ 105#define DEFAULT_DELAY \
106 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,200) 106 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MICROSECONDS,200)
@@ -183,7 +183,8 @@ open_queue (void *cls)
183 { 183 {
184 queue_est = GNUNET_YES; 184 queue_est = GNUNET_YES;
185 GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue (tc_hs[PEER_A], 185 GNUNET_TRANSPORT_TESTING_transport_communicator_open_queue (tc_hs[PEER_A],
186 &peer_id[PEER_B], 186 &peer_id[PEER_B]
187 ,
187 address); 188 address);
188 } 189 }
189 else 190 else
@@ -372,18 +373,24 @@ process_statistics (void *cls,
372 uint64_t value, 373 uint64_t value,
373 int is_persistent) 374 int is_persistent)
374{ 375{
375 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 376 LOG (GNUNET_ERROR_TYPE_DEBUG,
376 "Statistic: Name %s and value %" PRIu64 "\n", 377 "Statistic: Name %s and value %" PRIu64 "\n",
377 name, 378 name,
378 value); 379 value);
379 if ((0 == strcmp ("rekey", test_name)) && (0 == strcmp ( 380 if ((0 == strcmp ("rekey", test_name)) && (0 == strcmp (
380 "# rekeying successful", 381 "# rekeying successful",
381 name)) && (0 == value)) 382 name)))
382 { 383 {
383 ret = 2; 384 if (0 == value)
384 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 385 {
385 "No successful rekeying!\n"); 386 ret = 2;
386 GNUNET_SCHEDULER_shutdown (); 387 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
388 "No successful rekeying!\n");
389 GNUNET_SCHEDULER_shutdown ();
390 }
391 LOG (GNUNET_ERROR_TYPE_MESSAGE,
392 "Successful rekeys: %llu\n",
393 (unsigned long long) value);
387 } 394 }
388 if ((0 == strcmp ("backchannel", test_name)) && 395 if ((0 == strcmp ("backchannel", test_name)) &&
389 (0 == strcmp ( 396 (0 == strcmp (
@@ -403,11 +410,17 @@ process_statistics (void *cls,
403 name)) 410 name))
404 && (6000 > value)) 411 && (6000 > value))
405 { 412 {
406 ret = 2; 413 if (6000 > value)
407 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 414 {
408 "Not enough BOX messages! (want: %u, have %llu)\n", 415 ret = 2;
409 6000, (unsigned long long) value); 416 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
410 GNUNET_SCHEDULER_shutdown (); 417 "Not enough BOX messages! (want: %u, have %llu)\n",
418 6000, (unsigned long long) value);
419 GNUNET_SCHEDULER_shutdown ();
420 }
421 LOG (GNUNET_ERROR_TYPE_MESSAGE,
422 "Successful messages in BOX: %llu\n",
423 (unsigned long long) value);
411 } 424 }
412 return GNUNET_OK; 425 return GNUNET_OK;
413} 426}
@@ -584,18 +597,41 @@ choose_phase (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
584 "backchannel", 597 "backchannel",
585 test_name))) ) 598 test_name))) )
586 { 599 {
600 LOG (GNUNET_ERROR_TYPE_DEBUG, "Getting statistics UDP...\n");
587 if (NULL != box_stats[peer_nr]) 601 if (NULL != box_stats[peer_nr])
588 GNUNET_STATISTICS_get_cancel (box_stats[peer_nr]); 602 GNUNET_STATISTICS_get_cancel (box_stats[peer_nr]);
589 box_stats[peer_nr] = GNUNET_STATISTICS_get (stats[1], 603 box_stats[peer_nr] = GNUNET_STATISTICS_get (stats[1],
590 "C-UDP", 604 "communicator-udp",
591 "# messages decrypted with BOX", 605 "# messages decrypted with BOX",
592 process_statistics_box_done, 606 process_statistics_box_done,
593 &process_statistics, 607 &process_statistics,
594 tc_h); 608 tc_h);
595 if (NULL != rekey_stats[peer_nr]) 609 if (NULL != rekey_stats[peer_nr])
596 GNUNET_STATISTICS_get_cancel (rekey_stats[peer_nr]); 610 GNUNET_STATISTICS_get_cancel (rekey_stats[peer_nr]);
597 rekey_stats[peer_nr] = GNUNET_STATISTICS_get (stats[0], 611 rekey_stats[peer_nr] = GNUNET_STATISTICS_get (stats[1],
598 "C-UDP", 612 "communicator-udp",
613 "# rekeying successful",
614 process_statistics_rekey_done,
615 &process_statistics,
616 tc_h);
617 }
618 else if ((0 == strcmp ("tcp", communicator_name)) && (0 == strcmp ("rekey",
619 test_name)))
620 {
621 LOG (GNUNET_ERROR_TYPE_DEBUG, "Getting statistics... TCP\n");
622 if (NULL != box_stats[peer_nr])
623 GNUNET_STATISTICS_get_cancel (box_stats[peer_nr]);
624 box_stats[peer_nr] = GNUNET_STATISTICS_get (stats[1],
625 "communicator-tcp",
626 //"# messages decrypted with BOX",
627 NULL,
628 process_statistics_box_done,
629 &process_statistics,
630 tc_h);
631 if (NULL != rekey_stats[peer_nr])
632 GNUNET_STATISTICS_get_cancel (rekey_stats[peer_nr]);
633 rekey_stats[peer_nr] = GNUNET_STATISTICS_get (stats[1],
634 "communicator-tcp",
599 "# rekeying successful", 635 "# rekeying successful",
600 process_statistics_rekey_done, 636 process_statistics_rekey_done,
601 &process_statistics, 637 &process_statistics,
@@ -1030,8 +1066,8 @@ do_shutdown (void *cls)
1030 GNUNET_SCHEDULER_cancel (to_task[i]); 1066 GNUNET_SCHEDULER_cancel (to_task[i]);
1031 to_task[i] = NULL; 1067 to_task[i] = NULL;
1032 } 1068 }
1069 GNUNET_STATISTICS_destroy (stats[i], GNUNET_YES);
1033 GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (tc_hs[i]); 1070 GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (tc_hs[i]);
1034 GNUNET_STATISTICS_destroy (stats[i], GNUNET_NO);
1035 } 1071 }
1036} 1072}
1037 1073
@@ -1069,7 +1105,13 @@ run (void *cls)
1069 "backchannel", 1105 "backchannel",
1070 test_name))) ) 1106 test_name))) )
1071 { 1107 {
1072 stats[i] = GNUNET_STATISTICS_create ("C-UDP", 1108 stats[i] = GNUNET_STATISTICS_create ("communicator-udp",
1109 cfg_peers[i]);
1110 }
1111 else if ((0 == strcmp ("tcp", communicator_name)) && (0 == strcmp ("rekey",
1112 test_name)))
1113 {
1114 stats[i] = GNUNET_STATISTICS_create ("communicator-tcp",
1073 cfg_peers[i]); 1115 cfg_peers[i]);
1074 } 1116 }
1075 else if ((0 == strcmp ("bidirect", test_name))) 1117 else if ((0 == strcmp ("bidirect", test_name)))
diff --git a/src/service/transport/test_communicator_udp_basic_peer1.conf b/src/service/transport/test_communicator_udp_basic_peer1.conf
index 6968b3aef..83c599ae5 100644
--- a/src/service/transport/test_communicator_udp_basic_peer1.conf
+++ b/src/service/transport/test_communicator_udp_basic_peer1.conf
@@ -33,6 +33,7 @@ UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-resolver_test_1.sock
33 33
34[communicator-udp] 34[communicator-udp]
35# PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/vg_com1 35# PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=/tmp/vg_com1
36#PREFIX = valgrind --tool=callgrind
36BINDTO = 60002 37BINDTO = 60002
37DISABLE_V6 = YES 38DISABLE_V6 = YES
38MAX_QUEUE_LENGTH=5000 39MAX_QUEUE_LENGTH=5000
diff --git a/src/service/transport/test_communicator_udp_rekey_peer1.conf b/src/service/transport/test_communicator_udp_rekey_peer1.conf
index 9b0fa7497..305dd3b84 100644
--- a/src/service/transport/test_communicator_udp_rekey_peer1.conf
+++ b/src/service/transport/test_communicator_udp_rekey_peer1.conf
@@ -42,11 +42,12 @@ REKEY_INTERVAL = 100ms
42[communicator-udp] 42[communicator-udp]
43#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args 43#PREFIX = xterm -geometry 100x85 -T peer1 -e gdb --args
44#PREFIX = valgrind --leak-check=full --track-origins=yes 44#PREFIX = valgrind --leak-check=full --track-origins=yes
45#PREFIX = valgrind --tool=callgrind
45BINDTO = 60002 46BINDTO = 60002
46DISABLE_V6 = YES 47DISABLE_V6 = YES
47MAX_QUEUE_LENGTH=5000 48MAX_QUEUE_LENGTH=5000
48REKEY_INTERVAL = 100ms 49REKEY_INTERVAL = 100ms
49REKEY_MAX_BYTES=9KiB 50REKEY_MAX_BYTES=500KiB
50 51
51[communicator-test] 52[communicator-test]
52BACKCHANNEL_ENABLED = YES 53BACKCHANNEL_ENABLED = YES
diff --git a/src/service/transport/test_communicator_udp_rekey_peer2.conf b/src/service/transport/test_communicator_udp_rekey_peer2.conf
index 383ab19d2..9bce572aa 100644
--- a/src/service/transport/test_communicator_udp_rekey_peer2.conf
+++ b/src/service/transport/test_communicator_udp_rekey_peer2.conf
@@ -46,7 +46,7 @@ BINDTO = 60003
46DISABLE_V6 = YES 46DISABLE_V6 = YES
47MAX_QUEUE_LENGTH=5000 47MAX_QUEUE_LENGTH=5000
48REKEY_INTERVAL = 100ms 48REKEY_INTERVAL = 100ms
49REKEY_MAX_BYTES=9KiB 49REKEY_MAX_BYTES=500KiB
50 50
51[communicator-test] 51[communicator-test]
52BACKCHANNEL_ENABLED = YES 52BACKCHANNEL_ENABLED = YES
diff --git a/src/service/transport/test_transport_plugin_cmd_simple_send_broadcast.c b/src/service/transport/test_transport_plugin_cmd_simple_send_broadcast.c
index 62f7d820f..79b369b18 100644
--- a/src/service/transport/test_transport_plugin_cmd_simple_send_broadcast.c
+++ b/src/service/transport/test_transport_plugin_cmd_simple_send_broadcast.c
@@ -24,13 +24,11 @@
24 * @author t3sserakt 24 * @author t3sserakt
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_testing_barrier.h" 27#include "gnunet_testing_lib.h"
28#include "gnunet_testing_netjail_lib.h"
29#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
30#include "gnunet_transport_application_service.h" 29#include "gnunet_transport_application_service.h"
31#include "transport-testing2.h" 30#include "transport-testing2.h"
32#include "transport-testing-cmds.h" 31#include "transport-testing-cmds.h"
33#include "gnunet_testing_barrier.h"
34 32
35/** 33/**
36 * Generic logging shortcut 34 * Generic logging shortcut
diff --git a/src/service/transport/test_transport_plugin_cmd_simple_send_performance.c b/src/service/transport/test_transport_plugin_cmd_simple_send_performance.c
index 33deb3323..fe92e0ad9 100644
--- a/src/service/transport/test_transport_plugin_cmd_simple_send_performance.c
+++ b/src/service/transport/test_transport_plugin_cmd_simple_send_performance.c
@@ -24,13 +24,11 @@
24 * @author t3sserakt 24 * @author t3sserakt
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_testing_barrier.h"
28#include "gnunet_testing_netjail_lib.h"
29#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
30#include "gnunet_transport_application_service.h" 29#include "gnunet_transport_application_service.h"
31#include "transport-testing2.h" 30#include "transport-testing2.h"
32#include "transport-testing-cmds.h" 31#include "transport-testing-cmds.h"
33#include "gnunet_testing_barrier.h"
34 32
35/** 33/**
36 * Generic logging shortcut 34 * Generic logging shortcut
diff --git a/src/service/transport/test_transport_plugin_cmd_udp_backchannel.c b/src/service/transport/test_transport_plugin_cmd_udp_backchannel.c
index 75fb85e66..7e67d6fad 100644
--- a/src/service/transport/test_transport_plugin_cmd_udp_backchannel.c
+++ b/src/service/transport/test_transport_plugin_cmd_udp_backchannel.c
@@ -176,26 +176,15 @@ all_local_tests_prepared ()
176 176
177 177
178/** 178/**
179 * Function to start a local test case. 179 * Entry point for the plugin.
180 * 180 *
181 * @param write_message Callback to send a message to the master loop. 181 * @param cls NULL
182 * @param router_ip Global address of the network namespace. 182 * @return the exported block API
183 * @param node_ip The IP address of the node.
184 * @param m The number of the node in a network namespace.
185 * @param n The number of the network namespace.
186 * @param local_m The number of nodes in a network namespace.
187 */ 183 */
188static struct GNUNET_TESTING_Interpreter * 184void *
189start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, 185libgnunet_test_transport_plugin_cmd_udp_backchannel_init (void *cls)
190 const char *router_ip,
191 const char *node_ip,
192 const char *m,
193 const char *n,
194 const char *local_m,
195 const char *topology_data,
196 unsigned int *read_file,
197 GNUNET_TESTING_cmd_helper_finish_cb finished_cb)
198{ 186{
187 struct GNUNET_TESTING_PluginFunctions *api;
199 188
200 unsigned int n_int; 189 unsigned int n_int;
201 unsigned int m_int; 190 unsigned int m_int;
@@ -318,38 +307,42 @@ start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message,
318 GNUNET_TESTING_cmd_end () 307 GNUNET_TESTING_cmd_end ()
319 }; 308 };
320 309
321 ts->write_message = write_message; 310 return GNUNET_TESTING_make_plugin (commands);
322
323 is = GNUNET_TESTING_run (commands,
324 TIMEOUT,
325 &handle_result,
326 ts);
327 return is;
328} 311}
329 312
330 313
331/** 314GNUNET_TESTING_MAKE_PLUGIN (
332 * Entry point for the plugin. 315 libgnunet,
333 * 316 udp_backchannel,
334 * @param cls NULL 317 GNUNET_TESTING_cmd_system_create ("system-create",
335 * @return the exported block API 318 ts->testdir),
336 */ 319 GNUNET_TRANSPORT_cmd_start_peer ("start-peer",
337void * 320 "system-create",
338libgnunet_test_transport_plugin_cmd_udp_backchannel_init (void *cls) 321 num,
339{ 322 node_ip,
340 struct GNUNET_TESTING_PluginFunctions *api; 323 handlers,
341 324 ts->cfgname,
342 GNUNET_log_setup ("udp-backchannel", 325 notify_connect,
343 "DEBUG", 326 GNUNET_NO),
344 "plugin.out"); 327 GNUNET_TESTING_cmd_send_peer_ready (
345 328 "send-peer-ready",
346 api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions); 329 write_message),
347 api->start_testcase = &start_testcase; 330 block_send,
348 api->all_peers_started = &all_peers_started; 331 connect_peers,
349 api->all_local_tests_prepared = all_local_tests_prepared; 332 GNUNET_TRANSPORT_cmd_backchannel_check (
350 api->get_waiting_for_barriers = get_waiting_for_barriers; 333 "backchannel-check",
351 return api; 334 "start-peer",
352} 335 "system-create",
336 num,
337 m_int,
338 n_int,
339 topology),
340 local_prepared,
341 GNUNET_TRANSPORT_cmd_stop_peer ("stop-peer",
342 "start-peer"),
343 GNUNET_TESTING_cmd_system_destroy ("system-destroy",
344 "system-create")
345 );
353 346
354 347
355/** 348/**
diff --git a/src/service/transport/test_transport_simple_send.sh b/src/service/transport/test_transport_simple_send.sh
index 0250070be..af7515753 100755
--- a/src/service/transport/test_transport_simple_send.sh
+++ b/src/service/transport/test_transport_simple_send.sh
@@ -1,11 +1,4 @@
1#!/bin/bash 1#!/bin/bash
2if ! [ -d "/run/netns" ]; then 2exec netjail_test_master.sh ./test_transport_start_with_config test_transport_simple_send_topo.conf
3 echo You have to create the directory /run/netns. 3
4fi 4# exec netjail_test_master.sh gnunet-testing-netjail-launcher test_transport_simple_send_topo.conf
5if [ -f /proc/sys/kernel/unprivileged_userns_clone ]; then
6 if [ "$(cat /proc/sys/kernel/unprivileged_userns_clone)" != 1 ]; then
7 echo -e "Error during test setup: The kernel parameter kernel.unprivileged_userns_clone has to be set to 1! One has to execute\n\n sysctl kernel.unprivileged_userns_clone=1\n"
8 exit 78
9 fi
10fi
11exec 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/service/transport/test_transport_start_with_config.c b/src/service/transport/test_transport_start_with_config.c
index 349cd65a5..2c00dde8a 100644
--- a/src/service/transport/test_transport_start_with_config.c
+++ b/src/service/transport/test_transport_start_with_config.c
@@ -24,8 +24,7 @@
24 * @author t3sserakt 24 * @author t3sserakt
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_testing_ng_lib.h" 27#include "gnunet_testing_lib.h"
28#include "gnunet_testing_netjail_lib.h"
29#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
30 29
31#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600) 30#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 600)
diff --git a/src/service/transport/testing_api_cmd_start_peer.c b/src/service/transport/testing_api_cmd_start_peer.c
deleted file mode 100644
index 4454b2939..000000000
--- a/src/service/transport/testing_api_cmd_start_peer.c
+++ /dev/null
@@ -1,296 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_start_peer.c
23 * @brief cmd to start a peer.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "transport-testing-cmds.h"
29#include "gnunet_testing_ng_lib.h"
30#include "gnunet_transport_testing_ng_lib.h"
31
32
33/**
34 * Generic logging shortcut
35 */
36#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
37
38
39/**
40 * The run method of this cmd will start all services of a peer to test the transport service.
41 *
42 */
43static void
44start_peer_run (void *cls,
45 struct GNUNET_TESTING_Interpreter *is)
46{
47 struct GNUNET_TESTING_StartPeerState *sps = cls;
48 char *emsg = NULL;
49 struct GNUNET_PeerIdentity dummy;
50 const struct GNUNET_TESTING_Command *system_cmd;
51 const struct GNUNET_TESTING_System *tl_system;
52 char *home;
53 char *transport_unix_path;
54 char *tcp_communicator_unix_path;
55 char *udp_communicator_unix_path;
56 char *bindto;
57 char *bindto_udp;
58
59 if (GNUNET_NO == GNUNET_DISK_file_test (sps->cfgname))
60 {
61 LOG (GNUNET_ERROR_TYPE_ERROR,
62 "File not found: `%s'\n",
63 sps->cfgname);
64 GNUNET_TESTING_interpreter_fail (is);
65 return;
66 }
67
68
69 sps->cfg = GNUNET_CONFIGURATION_create ();
70 GNUNET_assert (GNUNET_OK ==
71 GNUNET_CONFIGURATION_load (sps->cfg, sps->cfgname));
72
73 GNUNET_asprintf (&home,
74 "$GNUNET_TMP/test-transport/api-tcp-p%u",
75 sps->no);
76
77 GNUNET_asprintf (&transport_unix_path,
78 "$GNUNET_RUNTIME_DIR/tng-p%u.sock",
79 sps->no);
80
81 GNUNET_asprintf (&tcp_communicator_unix_path,
82 "$GNUNET_RUNTIME_DIR/tcp-comm-p%u.sock",
83 sps->no);
84
85 GNUNET_asprintf (&udp_communicator_unix_path,
86 "$GNUNET_RUNTIME_DIR/tcp-comm-p%u.sock",
87 sps->no);
88
89 GNUNET_asprintf (&bindto,
90 "%s:60002",
91 sps->node_ip);
92
93 GNUNET_asprintf (&bindto_udp,
94 "2086");
95
96 LOG (GNUNET_ERROR_TYPE_DEBUG,
97 "node_ip %s\n",
98 bindto);
99
100 LOG (GNUNET_ERROR_TYPE_DEBUG,
101 "bind_udp %s\n",
102 GNUNET_YES == sps->broadcast ?
103 bindto_udp : bindto);
104
105 GNUNET_CONFIGURATION_set_value_string (sps->cfg, "PATHS", "GNUNET_TEST_HOME",
106 home);
107 GNUNET_CONFIGURATION_set_value_string (sps->cfg, "transport", "UNIXPATH",
108 transport_unix_path);
109 GNUNET_CONFIGURATION_set_value_string (sps->cfg, "communicator-tcp",
110 "BINDTO",
111 bindto);
112 GNUNET_CONFIGURATION_set_value_string (sps->cfg, "communicator-udp",
113 "BINDTO",
114 GNUNET_YES == sps->broadcast ?
115 bindto_udp : bindto);
116 GNUNET_CONFIGURATION_set_value_string (sps->cfg, "communicator-tcp",
117 "UNIXPATH",
118 tcp_communicator_unix_path);
119 GNUNET_CONFIGURATION_set_value_string (sps->cfg, "communicator-udp",
120 "UNIXPATH",
121 udp_communicator_unix_path);
122
123
124 system_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
125 sps->system_label);
126 GNUNET_TESTING_get_trait_test_system (system_cmd,
127 &tl_system);
128
129 sps->tl_system = tl_system;
130
131 LOG (GNUNET_ERROR_TYPE_DEBUG,
132 "Creating testing library with key number %u\n",
133 sps->no);
134
135 if (GNUNET_SYSERR ==
136 GNUNET_TESTING_configuration_create ((struct
137 GNUNET_TESTING_System *) tl_system,
138 sps->cfg))
139 {
140 LOG (GNUNET_ERROR_TYPE_DEBUG,
141 "Testing library failed to create unique configuration based on `%s'\n",
142 sps->cfgname);
143 GNUNET_CONFIGURATION_destroy (sps->cfg);
144 GNUNET_TESTING_interpreter_fail (is);
145 return;
146 }
147
148 sps->peer = GNUNET_TESTING_peer_configure ((struct
149 GNUNET_TESTING_System *) sps->
150 tl_system,
151 sps->cfg,
152 sps->no,
153 NULL,
154 &emsg);
155 if (NULL == sps->peer)
156 {
157 LOG (GNUNET_ERROR_TYPE_ERROR,
158 "Testing library failed to create unique configuration based on `%s': `%s' with key number %u\n",
159 sps->cfgname,
160 emsg,
161 sps->no);
162 GNUNET_free (emsg);
163 GNUNET_TESTING_interpreter_fail (is);
164 return;
165 }
166
167 if (GNUNET_OK != GNUNET_TESTING_peer_start (sps->peer))
168 {
169 LOG (GNUNET_ERROR_TYPE_ERROR,
170 "Testing library failed to create unique configuration based on `%s'\n",
171 sps->cfgname);
172 GNUNET_free (emsg);
173 GNUNET_TESTING_interpreter_fail (is);
174 return;
175 }
176
177 memset (&dummy,
178 '\0',
179 sizeof(dummy));
180
181 GNUNET_TESTING_peer_get_identity (sps->peer,
182 &sps->id);
183
184 if (0 == memcmp (&dummy,
185 &sps->id,
186 sizeof(struct GNUNET_PeerIdentity)))
187 {
188 LOG (GNUNET_ERROR_TYPE_ERROR,
189 "Testing library failed to obtain peer identity for peer %u\n",
190 sps->no);
191 GNUNET_free (emsg);
192 GNUNET_TESTING_interpreter_fail (is);
193 return;
194 }
195 LOG (GNUNET_ERROR_TYPE_DEBUG,
196 "Peer %u configured with identity `%s'\n",
197 sps->no,
198 GNUNET_i2s_full (&sps->id));
199
200 GNUNET_free (home);
201 GNUNET_free (transport_unix_path);
202 GNUNET_free (tcp_communicator_unix_path);
203 GNUNET_free (udp_communicator_unix_path);
204 GNUNET_free (bindto);
205 GNUNET_free (bindto_udp);
206}
207
208
209/**
210 * The cleanup function of this cmd frees resources the cmd allocated.
211 *
212 */
213static void
214start_peer_cleanup (void *cls)
215{
216 struct GNUNET_TESTING_StartPeerState *sps = cls;
217
218 //TODO Investigate why this caused problems during shutdown.
219 /*if (NULL != sps->cfg)
220 {
221 GNUNET_CONFIGURATION_destroy (sps->cfg);
222 sps->cfg = NULL;
223 }*/
224 GNUNET_free (sps->cfgname);
225 GNUNET_free (sps->node_ip);
226 GNUNET_free (sps->system_label);
227 GNUNET_free (sps->hello);
228 GNUNET_free (sps->connected_peers_map);
229 GNUNET_free (sps);
230}
231
232
233/**
234 * This function prepares an array with traits.
235 *
236 */
237static int
238start_peer_traits (void *cls,
239 const void **ret,
240 const char *trait,
241 unsigned int index)
242{
243 struct GNUNET_TESTING_StartPeerState *sps = cls;
244 struct GNUNET_TRANSPORT_ApplicationHandle *ah = sps->ah;
245 struct GNUNET_PeerIdentity *id = &sps->id;
246 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
247 sps->connected_peers_map;
248 char *hello = sps->hello;
249 size_t hello_size = sps->hello_size;
250 struct GNUNET_TESTING_Trait traits[] = {
251 GNUNET_TRANSPORT_TESTING_make_trait_application_handle ((const void *) ah),
252 GNUNET_TRANSPORT_TESTING_make_trait_peer_id ((const void *) id),
253 GNUNET_TRANSPORT_TESTING_make_trait_connected_peers_map ((const
254 void *)
255 connected_peers_map),
256 GNUNET_TRANSPORT_TESTING_make_trait_hello ((const void *) hello),
257 GNUNET_TRANSPORT_TESTING_make_trait_hello_size ((const void *) hello_size),
258 GNUNET_TRANSPORT_TESTING_make_trait_state ((const void *) sps),
259 GNUNET_TRANSPORT_TESTING_make_trait_broadcast ((const void *) &sps->broadcast),
260 GNUNET_TESTING_trait_end ()
261 };
262
263 return GNUNET_TESTING_get_trait (traits,
264 ret,
265 trait,
266 index);
267}
268
269
270struct GNUNET_TESTING_Command
271GNUNET_TESTING_cmd_start_peer (const char *label,
272 const char *system_label,
273 uint32_t no,
274 const char *node_ip,
275 const char *cfgname,
276 unsigned int broadcast)
277{
278 struct GNUNET_TESTING_StartPeerState *sps;
279 struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map =
280 GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
281
282 sps = GNUNET_new (struct GNUNET_TESTING_StartPeerState);
283 sps->no = no;
284 sps->system_label = GNUNET_strdup (system_label);
285 sps->connected_peers_map = connected_peers_map;
286 sps->cfgname = GNUNET_strdup (cfgname);
287 sps->node_ip = GNUNET_strdup (node_ip);
288 sps->broadcast = broadcast;
289
290 return GNUNET_TESTING_command_new (sps,
291 label,
292 &start_peer_run,
293 &start_peer_cleanup,
294 &start_peer_traits,
295 NULL);
296}
diff --git a/src/service/transport/testing_api_cmd_stop_peer.c b/src/service/transport/testing_api_cmd_stop_peer.c
deleted file mode 100644
index ce8d824f5..000000000
--- a/src/service/transport/testing_api_cmd_stop_peer.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file testing_api_cmd_stop_peer.c
23 * @brief cmd to stop a peer.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h"
29#include "gnunet_transport_testing_ng_lib.h"
30
31/**
32 * Generic logging shortcut
33 */
34#define LOG(kind, ...) GNUNET_log (kind, __VA_ARGS__)
35
36
37/**
38 * Struct to hold information for callbacks.
39 *
40 */
41struct StopPeerState
42{
43 // Label of the cmd to start the peer.
44 const char *start_label;
45};
46
47
48/**
49 * The run method of this cmd will stop all services of a peer which were used to test the transport service.
50 *
51 */
52static void
53stop_peer_run (void *cls,
54 struct GNUNET_TESTING_Interpreter *is)
55{
56 struct StopPeerState *stop_ps = cls;
57 const struct GNUNET_TESTING_StartPeerState *sps;
58 const struct GNUNET_TESTING_Command *start_cmd;
59
60 start_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
61 stop_ps->start_label);
62 GNUNET_TRANSPORT_TESTING_get_trait_state (start_cmd,
63 &sps);
64
65 if (NULL != sps->peer)
66 {
67 if (GNUNET_OK !=
68 GNUNET_TESTING_peer_stop (sps->peer))
69 {
70 LOG (GNUNET_ERROR_TYPE_ERROR,
71 "Testing lib failed to stop peer %u (`%s')\n",
72 sps->no,
73 GNUNET_i2s (&sps->id));
74 }
75 GNUNET_TESTING_peer_destroy (sps->peer);
76 }
77 if (NULL != sps->rh_task)
78 GNUNET_SCHEDULER_cancel (sps->rh_task);
79}
80
81
82/**
83 * The cleanup function of this cmd frees resources the cmd allocated.
84 *
85 */
86static void
87stop_peer_cleanup (void *cls)
88{
89 struct StopPeerState *sps = cls;
90
91 GNUNET_free (sps);
92}
93
94
95/**
96 * Trait function of this cmd does nothing.
97 *
98 */
99static int
100stop_peer_traits (void *cls,
101 const void **ret,
102 const char *trait,
103 unsigned int index)
104{
105 return GNUNET_OK;
106}
107
108
109/**
110 * Create command.
111 *
112 * @param label name for command.
113 * @param start_label Label of the cmd to start the peer.
114 * @return command.
115 */
116struct GNUNET_TESTING_Command
117GNUNET_TESTING_cmd_stop_peer (const char *label,
118 const char *start_label)
119{
120 struct StopPeerState *sps;
121
122 sps = GNUNET_new (struct StopPeerState);
123 sps->start_label = start_label;
124 return GNUNET_TESTING_command_new (sps,
125 label,
126 &stop_peer_run,
127 &stop_peer_cleanup,
128 &stop_peer_traits,
129 NULL);
130}
diff --git a/src/service/transport/testing_transport_traits.c b/src/service/transport/testing_transport_traits.c
new file mode 100644
index 000000000..131c42a5d
--- /dev/null
+++ b/src/service/transport/testing_transport_traits.c
@@ -0,0 +1,35 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2021 GNUnet e.V.
4
5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20
21/**
22 * @file transport/test_transport_start_with_config.c
23 * @brief Generic program to start testcases in an configurable topology.
24 * @author t3sserakt
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28#include "gnunet_testing_lib.h"
29#include "transport-testing-cmds.h"
30
31GNUNET_TRANSPORT_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT,
32 GNUNET_TRANSPORT_TESTING)
33
34GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT,
35 GNUNET_TRANSPORT_TESTING)
diff --git a/src/service/transport/transport-testing-cmds.h b/src/service/transport/transport-testing-cmds.h
index 7ebc84d11..478b3cba6 100644
--- a/src/service/transport/transport-testing-cmds.h
+++ b/src/service/transport/transport-testing-cmds.h
@@ -27,8 +27,8 @@
27#ifndef TRANSPORT_TESTING_CMDS_H 27#ifndef TRANSPORT_TESTING_CMDS_H
28#define TRANSPORT_TESTING_CMDS_H 28#define TRANSPORT_TESTING_CMDS_H
29 29
30#include "gnunet_testing_ng_lib.h" 30#include "gnunet_testing_lib.h"
31#include "gnunet_transport_testing_ng_lib.h" 31#include "gnunet_testing_transport_lib.h"
32 32
33 33
34/** 34/**
@@ -48,7 +48,7 @@ struct ConnectPeersState
48 /** 48 /**
49 * The testing system of this node. 49 * The testing system of this node.
50 */ 50 */
51 const struct GNUNET_TESTING_System *tl_system; 51 const struct GNUNET_TESTBED_System *tl_system;
52 52
53 // Label of the cmd which started the test system. 53 // Label of the cmd which started the test system.
54 const char *create_label; 54 const char *create_label;
@@ -104,27 +104,14 @@ struct ConnectPeersState
104}; 104};
105 105
106 106
107
108typedef void * 107typedef void *
109(*GNUNET_TRANSPORT_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is, 108(*GNUNET_TRANSPORT_notify_connect_cb) (struct GNUNET_TESTING_Interpreter *is,
110 const struct GNUNET_PeerIdentity *peer); 109 const struct GNUNET_PeerIdentity *peer);
111 110
112 111
113
114struct TestState 112struct TestState
115{ 113{
116 /** 114 /**
117 * Callback to write messages to the master loop.
118 *
119 */
120 GNUNET_TESTING_cmd_helper_write_cb write_message;
121
122 /**
123 * Callback to notify the helper test case has finished.
124 */
125 GNUNET_TESTING_cmd_helper_finish_cb finished_cb;
126
127 /**
128 * The name for a specific test environment directory. 115 * The name for a specific test environment directory.
129 * 116 *
130 */ 117 */
@@ -214,7 +201,7 @@ GNUNET_TRANSPORT_cmd_send_simple (const char *label,
214 topology); 201 topology);
215 202
216/** 203/**
217 * 204 *
218 * 205 *
219 * @param label name for command. 206 * @param label name for command.
220 * @param start_peer_label Label of the cmd to start a peer. 207 * @param start_peer_label Label of the cmd to start a peer.
@@ -227,13 +214,14 @@ GNUNET_TRANSPORT_cmd_send_simple (const char *label,
227 */ 214 */
228struct GNUNET_TESTING_Command 215struct GNUNET_TESTING_Command
229GNUNET_TRANSPORT_cmd_send_simple_performance (const char *label, 216GNUNET_TRANSPORT_cmd_send_simple_performance (const char *label,
230 const char *start_peer_label, 217 const char *start_peer_label,
231 const char *create_label, 218 const char *create_label,
232 uint32_t num, 219 uint32_t num,
233 int size, 220 int size,
234 int max_send, 221 int max_send,
235 struct GNUNET_TESTING_NetjailTopology * 222 struct
236 topology); 223 GNUNET_TESTING_NetjailTopology *
224 topology);
237 225
238 226
239/** 227/**
@@ -259,14 +247,14 @@ GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
259 topology); 247 topology);
260 248
261 249
262
263/** 250/**
264 * Call #op on all simple traits. 251 * Call #op on all simple traits.
265 */ 252 */
266#define GNUNET_TRANSPORT_SIMPLE_TRAITS(op, prefix) \ 253#define GNUNET_TRANSPORT_SIMPLE_TRAITS(op, prefix) \
267 op (prefix, connect_peer_state, const struct ConnectPeersState) 254 op (prefix, connect_peer_state, const struct ConnectPeersState)
268 255
269GNUNET_TRANSPORT_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_TRANSPORT_TESTING) 256GNUNET_TRANSPORT_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT,
257 GNUNET_TRANSPORT_TESTING)
270 258
271 259
272#endif 260#endif
diff --git a/src/service/transport/transport-testing-communicator.c b/src/service/transport/transport-testing-communicator.c
index 7d8abbe1e..9ee70fe7b 100644
--- a/src/service/transport/transport-testing-communicator.c
+++ b/src/service/transport/transport-testing-communicator.c
@@ -186,6 +186,7 @@ handle_communicator_available (
186 return; /* receive-only communicator */ 186 return; /* receive-only communicator */
187 } 187 }
188 tc_h->c_characteristics = ntohl (msg->cc); 188 tc_h->c_characteristics = ntohl (msg->cc);
189 GNUNET_free (tc_h->c_addr_prefix);
189 tc_h->c_addr_prefix = GNUNET_strdup ((const char *) &msg[1]); 190 tc_h->c_addr_prefix = GNUNET_strdup ((const char *) &msg[1]);
190 if (NULL != tc_h->communicator_available_cb) 191 if (NULL != tc_h->communicator_available_cb)
191 { 192 {
@@ -320,6 +321,7 @@ handle_add_address (void *cls,
320 if (0 == size) 321 if (0 == size)
321 return; /* receive-only communicator */ 322 return; /* receive-only communicator */
322 LOG (GNUNET_ERROR_TYPE_DEBUG, "received add address cb %u\n", size); 323 LOG (GNUNET_ERROR_TYPE_DEBUG, "received add address cb %u\n", size);
324 GNUNET_free (tc_h->c_address);
323 tc_h->c_address = GNUNET_strdup ((const char *) &msg[1]); 325 tc_h->c_address = GNUNET_strdup ((const char *) &msg[1]);
324 if (NULL != tc_h->add_address_cb) 326 if (NULL != tc_h->add_address_cb)
325 { 327 {
@@ -852,6 +854,7 @@ communicator_start (
852 "-c", 854 "-c",
853 tc_h->cfg_filename, 855 tc_h->cfg_filename,
854 NULL); 856 NULL);
857 GNUNET_free (loprefix);
855 if (NULL == tc_h->c_proc) 858 if (NULL == tc_h->c_proc)
856 { 859 {
857 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start communicator!"); 860 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start communicator!");
@@ -1093,6 +1096,7 @@ void
1093GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop ( 1096GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (
1094 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h) 1097 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
1095{ 1098{
1099 struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *queue;
1096 shutdown_communicator (tc_h->c_proc); 1100 shutdown_communicator (tc_h->c_proc);
1097 shutdown_service (tc_h->sh); 1101 shutdown_service (tc_h->sh);
1098 shutdown_nat (tc_h->nat_proc); 1102 shutdown_nat (tc_h->nat_proc);
@@ -1100,6 +1104,14 @@ GNUNET_TRANSPORT_TESTING_transport_communicator_service_stop (
1100 shutdown_peerstore (tc_h->ps_proc); 1104 shutdown_peerstore (tc_h->ps_proc);
1101 shutdown_statistics (tc_h->stat_proc); 1105 shutdown_statistics (tc_h->stat_proc);
1102 GNUNET_CONFIGURATION_destroy (tc_h->cfg); 1106 GNUNET_CONFIGURATION_destroy (tc_h->cfg);
1107 while (NULL != (queue = tc_h->queue_head))
1108 {
1109 GNUNET_CONTAINER_DLL_remove (tc_h->queue_head, tc_h->queue_tail, queue);
1110 GNUNET_free (queue);
1111 }
1112 GNUNET_free (tc_h->c_address);
1113 GNUNET_free (tc_h->cfg_filename);
1114 GNUNET_free (tc_h->c_addr_prefix);
1103 GNUNET_free (tc_h); 1115 GNUNET_free (tc_h);
1104} 1116}
1105 1117
diff --git a/src/service/transport/transport-testing2.c b/src/service/transport/transport-testing2.c
index 36a57b2b6..877730630 100644
--- a/src/service/transport/transport-testing2.c
+++ b/src/service/transport/transport-testing2.c
@@ -352,7 +352,6 @@ hello_iter_cb (void *cb_cls,
352 p->start_cb (p->start_cb_cls); 352 p->start_cb (p->start_cb_cls);
353 p->start_cb = NULL; 353 p->start_cb = NULL;
354 } 354 }
355 GNUNET_PEERSTORE_iteration_next (p->pic, 1);
356} 355}
357 356
358 357
diff --git a/src/service/transport/transport-testing2.h b/src/service/transport/transport-testing2.h
index a68c9df38..42ffce3f2 100644
--- a/src/service/transport/transport-testing2.h
+++ b/src/service/transport/transport-testing2.h
@@ -234,7 +234,7 @@ struct GNUNET_TRANSPORT_TESTING_Handle
234 /** 234 /**
235 * Testing library system handle 235 * Testing library system handle
236 */ 236 */
237 struct GNUNET_TESTING_System *tl_system; 237 struct GNUNET_TESTBED_System *tl_system;
238 238
239 /** 239 /**
240 * head DLL of connect contexts 240 * head DLL of connect contexts
diff --git a/src/service/transport/transport_api2_communication.c b/src/service/transport/transport_api2_communication.c
index fe7e69158..e0fdad214 100644
--- a/src/service/transport/transport_api2_communication.c
+++ b/src/service/transport/transport_api2_communication.c
@@ -598,8 +598,16 @@ handle_create_queue (void *cls, const struct GNUNET_TRANSPORT_CreateQueue *cq)
598 const char *addr = (const char *) &cq[1]; 598 const char *addr = (const char *) &cq[1];
599 struct GNUNET_TRANSPORT_CreateQueueResponse *cqr; 599 struct GNUNET_TRANSPORT_CreateQueueResponse *cqr;
600 struct GNUNET_MQ_Envelope *env; 600 struct GNUNET_MQ_Envelope *env;
601 int ret = ch->mq_init (ch->mq_init_cls, &cq->receiver, addr);
601 602
602 if (GNUNET_OK != ch->mq_init (ch->mq_init_cls, &cq->receiver, addr)) 603 if (GNUNET_NO == ret)
604 {
605 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
606 "Address `%s' is already (beging) connected to.\n",
607 addr);
608 env = GNUNET_MQ_msg (cqr, GNUNET_MESSAGE_TYPE_TRANSPORT_QUEUE_CREATE_FAIL);
609 }
610 else if (GNUNET_SYSERR == ret)
603 { 611 {
604 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 612 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
605 "Address `%s' invalid for this communicator\n", 613 "Address `%s' invalid for this communicator\n",
diff --git a/src/service/transport/transport_api_cmd_backchannel_check.c b/src/service/transport/transport_api_cmd_backchannel_check.c
index f23230798..6fa61adb7 100644
--- a/src/service/transport/transport_api_cmd_backchannel_check.c
+++ b/src/service/transport/transport_api_cmd_backchannel_check.c
@@ -67,7 +67,7 @@ struct CheckState
67 /** 67 /**
68 * The testing system of this node. 68 * The testing system of this node.
69 */ 69 */
70 const struct GNUNET_TESTING_System *tl_system; 70 const struct GNUNET_TESTBED_System *tl_system;
71 71
72 // Label of the cmd which started the test system. 72 // Label of the cmd which started the test system.
73 const char *create_label; 73 const char *create_label;
@@ -402,7 +402,7 @@ backchannel_check_run (void *cls,
402{ 402{
403 struct CheckState *cs = cls; 403 struct CheckState *cs = cls;
404 const struct GNUNET_TESTING_Command *system_cmd; 404 const struct GNUNET_TESTING_Command *system_cmd;
405 const struct GNUNET_TESTING_System *tl_system; 405 const struct GNUNET_TESTBED_System *tl_system;
406 const struct GNUNET_TESTING_Command *peer1_cmd; 406 const struct GNUNET_TESTING_Command *peer1_cmd;
407 const struct GNUNET_TRANSPORT_ApplicationHandle *ah; 407 const struct GNUNET_TRANSPORT_ApplicationHandle *ah;
408 struct GNUNET_CONTAINER_MultiShortmapIterator *node_it; 408 struct GNUNET_CONTAINER_MultiShortmapIterator *node_it;
@@ -467,7 +467,8 @@ backchannel_check_run (void *cls,
467 node_it = GNUNET_CONTAINER_multishortmap_iterator_create ( 467 node_it = GNUNET_CONTAINER_multishortmap_iterator_create (
468 namespace->nodes); 468 namespace->nodes);
469 while (GNUNET_YES == GNUNET_CONTAINER_multishortmap_iterator_next (node_it, 469 while (GNUNET_YES == GNUNET_CONTAINER_multishortmap_iterator_next (node_it,
470 &node_key, 470 &node_key
471 ,
471 (const 472 (const
472 void**) 473 void**)
473 &node)) 474 &node))
@@ -544,10 +545,10 @@ GNUNET_TRANSPORT_cmd_backchannel_check (const char *label,
544 cs->node_n = node_n; 545 cs->node_n = node_n;
545 cs->namespace_n = namespace_n; 546 cs->namespace_n = namespace_n;
546 547
547 return GNUNET_TESTING_command_new (cs, 548 return GNUNET_TESTING_command_new_ac (cs,
548 label, 549 label,
549 &backchannel_check_run, 550 &backchannel_check_run,
550 &backchannel_check_cleanup, 551 &backchannel_check_cleanup,
551 &backchannel_check_traits, 552 &backchannel_check_traits,
552 &cs->ac); 553 &cs->ac);
553} 554}
diff --git a/src/service/transport/transport_api_cmd_connecting_peers.c b/src/service/transport/transport_api_cmd_connecting_peers.c
index b7c072169..280c0e9a2 100644
--- a/src/service/transport/transport_api_cmd_connecting_peers.c
+++ b/src/service/transport/transport_api_cmd_connecting_peers.c
@@ -25,7 +25,8 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_testing_ng_lib.h" 28#include "gnunet_testing_lib.h"
29#include "gnunet_testbed_lib.h"
29#include "gnunet_transport_testing_ng_lib.h" 30#include "gnunet_transport_testing_ng_lib.h"
30#include "transport-testing-cmds.h" 31#include "transport-testing-cmds.h"
31#include "gnunet_transport_application_service.h" 32#include "gnunet_transport_application_service.h"
@@ -45,7 +46,7 @@ connect_peers_run (void *cls,
45{ 46{
46 struct ConnectPeersState *cps = cls; 47 struct ConnectPeersState *cps = cls;
47 const struct GNUNET_TESTING_Command *system_cmd; 48 const struct GNUNET_TESTING_Command *system_cmd;
48 const struct GNUNET_TESTING_System *tl_system; 49 const struct GNUNET_TESTBED_System *tl_system;
49 50
50 51
51 const struct GNUNET_TESTING_Command *peer1_cmd; 52 const struct GNUNET_TESTING_Command *peer1_cmd;
@@ -83,7 +84,7 @@ connect_peers_run (void *cls,
83 84
84 system_cmd = GNUNET_TESTING_interpreter_lookup_command (is, 85 system_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
85 cps->create_label); 86 cps->create_label);
86 GNUNET_TESTING_get_trait_test_system (system_cmd, 87 GNUNET_TESTBED_get_trait_test_system (system_cmd,
87 &tl_system); 88 &tl_system);
88 89
89 cps->tl_system = tl_system; 90 cps->tl_system = tl_system;
@@ -292,22 +293,23 @@ GNUNET_TRANSPORT_cmd_connect_peers (const char *label,
292 cps->additional_connects = additional_connects; 293 cps->additional_connects = additional_connects;
293 cps->wait_for_connect = wait_for_connect; 294 cps->wait_for_connect = wait_for_connect;
294 295
296 // FIXME: wrap with cmd_make_unblocking!
295 if (GNUNET_YES == wait_for_connect) 297 if (GNUNET_YES == wait_for_connect)
296 return GNUNET_TESTING_command_new (cps, 298 return GNUNET_TESTING_command_new_ac (cps,
297 label, 299 label,
298 &connect_peers_run, 300 &connect_peers_run,
299 &connect_peers_cleanup, 301 &connect_peers_cleanup,
300 &connect_peers_traits, 302 &connect_peers_traits,
301 &cps->ac); 303 &cps->ac);
302 else 304 else
303 return GNUNET_TESTING_command_new (cps, 305 return GNUNET_TESTING_command_new (cps,
304 label, 306 label,
305 &connect_peers_run, 307 &connect_peers_run,
306 &connect_peers_cleanup, 308 &connect_peers_cleanup,
307 &connect_peers_traits, 309 &connect_peers_traits);
308 NULL);
309} 310}
310 311
311 312
312// FIXME: likely not ideally placed here, move to its own file 313// FIXME: likely not ideally placed here, move to its own file
313GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_TRANSPORT_TESTING) 314GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT,
315 GNUNET_TRANSPORT_TESTING)
diff --git a/src/service/transport/transport_api_cmd_send_simple.c b/src/service/transport/transport_api_cmd_send_simple.c
index 3e732ffc9..b0f443584 100644
--- a/src/service/transport/transport_api_cmd_send_simple.c
+++ b/src/service/transport/transport_api_cmd_send_simple.c
@@ -118,12 +118,12 @@ send_simple_run (void *cls,
118 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; 118 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
119 const struct GNUNET_TESTING_Command *peer1_cmd; 119 const struct GNUNET_TESTING_Command *peer1_cmd;
120 const struct GNUNET_TESTING_Command *system_cmd; 120 const struct GNUNET_TESTING_Command *system_cmd;
121 const struct GNUNET_TESTING_System *tl_system; 121 const struct GNUNET_TESTBED_System *tl_system;
122 122
123 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is, 123 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
124 sss->start_peer_label); 124 sss->start_peer_label);
125 GNUNET_TRANSPORT_TESTING_get_trait_connected_peers_map (peer1_cmd, 125 GNUNET_TRANSPORT_TESTING_get_trait_connected_peers_map (peer1_cmd,
126 &connected_peers_map); 126 &connected_peers_map);
127 127
128 system_cmd = GNUNET_TESTING_interpreter_lookup_command (is, 128 system_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
129 sss->create_label); 129 sss->create_label);
@@ -157,6 +157,5 @@ GNUNET_TRANSPORT_cmd_send_simple (const char *label,
157 label, 157 label,
158 &send_simple_run, 158 &send_simple_run,
159 &send_simple_cleanup, 159 &send_simple_cleanup,
160 NULL,
161 NULL); 160 NULL);
162} 161}
diff --git a/src/service/transport/transport_api_cmd_send_simple_performance.c b/src/service/transport/transport_api_cmd_send_simple_performance.c
index 5979e47fe..a3012d9cd 100644
--- a/src/service/transport/transport_api_cmd_send_simple_performance.c
+++ b/src/service/transport/transport_api_cmd_send_simple_performance.c
@@ -168,7 +168,7 @@ send_simple_run (void *cls,
168 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map; 168 const struct GNUNET_CONTAINER_MultiShortmap *connected_peers_map;
169 const struct GNUNET_TESTING_Command *peer1_cmd; 169 const struct GNUNET_TESTING_Command *peer1_cmd;
170 const struct GNUNET_TESTING_Command *system_cmd; 170 const struct GNUNET_TESTING_Command *system_cmd;
171 const struct GNUNET_TESTING_System *tl_system; 171 const struct GNUNET_TESTBED_System *tl_system;
172 172
173 173
174 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is, 174 peer1_cmd = GNUNET_TESTING_interpreter_lookup_command (is,
@@ -208,13 +208,12 @@ GNUNET_TRANSPORT_cmd_send_simple_performance (const char *label,
208 sss->topology = topology; 208 sss->topology = topology;
209 sss->size = size; 209 sss->size = size;
210 sss->max_send = max_send; 210 sss->max_send = max_send;
211 211 cmd = GNUNET_TESTING_command_new_ac (sss,
212 cmd = GNUNET_TESTING_command_new (sss, 212 label,
213 label, 213 &send_simple_run,
214 &send_simple_run, 214 &send_simple_cleanup,
215 &send_simple_cleanup, 215 NULL,
216 NULL, 216 &sss->ac);
217 &sss->ac);
218 cmd.asynchronous_finish = GNUNET_YES; 217 cmd.asynchronous_finish = GNUNET_YES;
219 return cmd; 218 return cmd;
220} 219}
diff --git a/src/service/transport/transport_api_cmd_start_peer.c b/src/service/transport/transport_api_cmd_start_peer.c
index 311289f92..862d28b4c 100644
--- a/src/service/transport/transport_api_cmd_start_peer.c
+++ b/src/service/transport/transport_api_cmd_start_peer.c
@@ -70,7 +70,6 @@ hello_iter_cb (void *cb_cls,
70 GNUNET_PEERSTORE_iteration_stop (sps->pic); 70 GNUNET_PEERSTORE_iteration_stop (sps->pic);
71 sps->pic = NULL; 71 sps->pic = NULL;
72 GNUNET_TESTING_async_finish (&sps->ac); 72 GNUNET_TESTING_async_finish (&sps->ac);
73 GNUNET_PEERSTORE_iteration_next (sps->pic, 1);
74} 73}
75 74
76 75
@@ -85,11 +84,11 @@ retrieve_hello (void *cls)
85 struct GNUNET_TESTING_StartPeerState *sps = cls; 84 struct GNUNET_TESTING_StartPeerState *sps = cls;
86 sps->rh_task = NULL; 85 sps->rh_task = NULL;
87 sps->pic = GNUNET_PEERSTORE_iteration_start (sps->ph, 86 sps->pic = GNUNET_PEERSTORE_iteration_start (sps->ph,
88 "transport", 87 "transport",
89 &sps->id, 88 &sps->id,
90 GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, 89 GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY,
91 hello_iter_cb, 90 hello_iter_cb,
92 sps); 91 sps);
93 92
94} 93}
95 94
@@ -173,7 +172,7 @@ start_peer_run (void *cls,
173 char *emsg = NULL; 172 char *emsg = NULL;
174 struct GNUNET_PeerIdentity dummy; 173 struct GNUNET_PeerIdentity dummy;
175 const struct GNUNET_TESTING_Command *system_cmd; 174 const struct GNUNET_TESTING_Command *system_cmd;
176 const struct GNUNET_TESTING_System *tl_system; 175 const struct GNUNET_TESTBED_System *tl_system;
177 char *home; 176 char *home;
178 char *transport_unix_path; 177 char *transport_unix_path;
179 char *tcp_communicator_unix_path; 178 char *tcp_communicator_unix_path;
@@ -259,7 +258,7 @@ start_peer_run (void *cls,
259 258
260 if (GNUNET_SYSERR == 259 if (GNUNET_SYSERR ==
261 GNUNET_TESTING_configuration_create ((struct 260 GNUNET_TESTING_configuration_create ((struct
262 GNUNET_TESTING_System *) tl_system, 261 GNUNET_TESTBED_System *) tl_system,
263 sps->cfg)) 262 sps->cfg))
264 { 263 {
265 LOG (GNUNET_ERROR_TYPE_DEBUG, 264 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -271,7 +270,7 @@ start_peer_run (void *cls,
271 } 270 }
272 271
273 sps->peer = GNUNET_TESTING_peer_configure ((struct 272 sps->peer = GNUNET_TESTING_peer_configure ((struct
274 GNUNET_TESTING_System *) sps-> 273 GNUNET_TESTBED_System *) sps->
275 tl_system, 274 tl_system,
276 sps->cfg, 275 sps->cfg,
277 sps->no, 276 sps->no,
@@ -476,10 +475,10 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label,
476 handlers, 475 handlers,
477 i * sizeof(struct GNUNET_MQ_MessageHandler)); 476 i * sizeof(struct GNUNET_MQ_MessageHandler));
478 } 477 }
479 return GNUNET_TESTING_command_new (sps, 478 return GNUNET_TESTING_command_new_ac (sps,
480 label, 479 label,
481 &start_peer_run, 480 &start_peer_run,
482 &start_peer_cleanup, 481 &start_peer_cleanup,
483 &start_peer_traits, 482 &start_peer_traits,
484 &sps->ac); 483 &sps->ac);
485} 484}
diff --git a/src/service/transport/transport_api_cmd_stop_peer.c b/src/service/transport/transport_api_cmd_stop_peer.c
index fbd2b1df3..76a30d638 100644
--- a/src/service/transport/transport_api_cmd_stop_peer.c
+++ b/src/service/transport/transport_api_cmd_stop_peer.c
@@ -149,6 +149,5 @@ GNUNET_TRANSPORT_cmd_stop_peer (const char *label,
149 label, 149 label,
150 &stop_peer_run, 150 &stop_peer_run,
151 &stop_peer_cleanup, 151 &stop_peer_cleanup,
152 &stop_peer_traits, 152 &stop_peer_traits);
153 NULL);
154} 153}