diff options
240 files changed, 12795 insertions, 15474 deletions
@@ -1,3 +1,7 @@ | |||
1 | v0.21.2: | ||
2 | - Reworked TESTING API | ||
3 | - Disabled many old-style tests | ||
4 | |||
1 | v0.21.1: | 5 | v0.21.1: |
2 | - Communicator and connectivity bugfixes | 6 | - Communicator and connectivity bugfixes |
3 | 7 | ||
@@ -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 | ||
142 | main "$@" | 145 | main "$@" |
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 | |||
1235 | src/lib/json/Makefile | 1235 | src/lib/json/Makefile |
1236 | src/lib/pq/Makefile | 1236 | src/lib/pq/Makefile |
1237 | src/lib/sq/Makefile | 1237 | src/lib/sq/Makefile |
1238 | src/lib/testing/Makefile | ||
1238 | src/plugin/Makefile | 1239 | src/plugin/Makefile |
1239 | src/plugin/block/Makefile | 1240 | src/plugin/block/Makefile |
1240 | src/plugin/datacache/Makefile | 1241 | src/plugin/datacache/Makefile |
@@ -1303,7 +1304,7 @@ src/service/setu/Makefile | |||
1303 | src/service/setu/setu.conf | 1304 | src/service/setu/setu.conf |
1304 | src/service/statistics/Makefile | 1305 | src/service/statistics/Makefile |
1305 | src/service/statistics/statistics.conf | 1306 | src/service/statistics/statistics.conf |
1306 | src/service/testing/Makefile | 1307 | src/service/testbed/Makefile |
1307 | src/service/topology/Makefile | 1308 | src/service/topology/Makefile |
1308 | src/service/transport/Makefile | 1309 | src/service/transport/Makefile |
1309 | src/service/transport/transport.conf | 1310 | src/service/transport/transport.conf |
diff --git a/contrib/gana b/contrib/gana | |||
Subproject cc2d9bdb3e90af5ddebf964e3da492c04a30741 | Subproject cbe19e87d6da5f16e71573c85a717e986a43da6 | ||
diff --git a/debian/changelog b/debian/changelog index 2a318e11b..b8b403baf 100644 --- a/debian/changelog +++ b/debian/changelog | |||
@@ -1,3 +1,9 @@ | |||
1 | gnunet (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 | |||
1 | gnunet (0.21.1-1) unstable; urgency=low | 7 | gnunet (0.21.1-1) unstable; urgency=low |
2 | 8 | ||
3 | * Package for GNU Taler v0.10.0 release. | 9 | * Package for GNU Taler v0.10.0 release. |
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 | ||
350 | add_project_arguments('-DNEED_LIBGCRYPT_VERSION="1.6.0"', language : 'c') | 350 | add_project_arguments('-DNEED_LIBGCRYPT_VERSION="1.6.0"', language : 'c') |
351 | 351 | ||
352 | if cc.check_header('sys/time.h') | ||
353 | add_project_arguments('-DHAVE_SYS_TIME_H', language : 'c') | ||
354 | endif | ||
355 | if cc.check_header('sys/param.h') | ||
356 | add_project_arguments('-DHAVE_SYS_PARAM_H', language : 'c') | ||
357 | endif | ||
358 | |||
359 | # NSS | 352 | # NSS |
360 | have_nss = false | 353 | have_nss = false |
361 | if cc.check_header('nss.h') | 354 | if 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 |
391 | endif | 384 | endif |
392 | 385 | ||
393 | |||
394 | |||
395 | |||
396 | # NSS | 386 | # NSS |
397 | if cc.check_header('nss.h') | 387 | if 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 | |||
422 | if cc.has_function('getloadavg') == false | 412 | if cc.has_function('getloadavg') == false |
423 | error('getloadadv missing') | 413 | error('getloadadv missing') |
424 | endif | 414 | endif |
425 | if cc.has_function('strnlen', prefix : '#include <string.h>') | 415 | |
426 | cdata.set('HAVE_STRNLEN', 1) | 416 | syscalls = [ |
427 | endif | 417 | 'memset_s', 'explicit_bzero', 'atoll', 'stat64', |
428 | if cc.has_function('memset_s') | 418 | 'mremap', 'getrlimit', 'setrlimit', 'gethostbyname2', |
429 | cdata.set('HAVE_MEMSET_S', 1) | 419 | 'getpeerucred', 'getpeereid', 'setresuid', 'getifaddrs', 'freeifaddrs', |
430 | endif | 420 | 'getresgid', 'mallinfo2', 'malloc_size', 'malloc_usable_size', 'getrusage', |
431 | if cc.has_function('explicit_bzero') | 421 | 'random', 'srandom', 'stat', 'statfs', 'statvfs', 'wait4', 'timegm', |
432 | cdata.set('HAVE_EXPLICIT_BZERO', 1) | 422 | 'getaddrinfo', 'initgroups', 'gethostbyname' |
433 | endif | 423 | ] |
434 | if cc.has_function('gethostbyname') | 424 | |
435 | cdata.set('HAVE_GETHOSTBYNAME', 1) | 425 | str_syscalls = [ |
436 | endif | 426 | 'strnlen', 'strndup', |
437 | if cc.has_function('gethostbyname2') | 427 | ] |
438 | cdata.set('HAVE_GETHOSTBYNAME2', 1) | 428 | |
439 | endif | 429 | foreach f : syscalls |
440 | if cc.has_function('getifaddrs') | 430 | if cc.has_function(f) |
441 | cdata.set('HAVE_GETIFADDRS', 1) | 431 | define = 'HAVE_' + f.underscorify().to_upper() |
442 | endif | 432 | cdata.set(define, 1) |
443 | if cc.has_function('freeifaddrs') | 433 | endif |
444 | cdata.set('HAVE_FREEIFADDRS', 1) | 434 | endforeach |
445 | endif | 435 | |
446 | if cc.check_header('ifaddrs.h') | 436 | foreach f : str_syscalls |
447 | add_project_arguments('-DHAVE_IFADDRS_H', language : 'c') | 437 | if cc.has_function(f, prefix : '#include <string.h>') |
448 | endif | 438 | define = 'HAVE_' + f.underscorify().to_upper() |
439 | cdata.set(define, 1) | ||
440 | endif | ||
441 | endforeach | ||
442 | |||
443 | |||
444 | headers = [ | ||
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 | |||
454 | foreach 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 | ||
460 | endforeach | ||
449 | 461 | ||
450 | configure_file(#input: 'gnunet_private_config.h.in', | 462 | configure_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 382232226..db8808e2f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -99,7 +99,6 @@ src/contrib/service/set/ibf_sim.c | |||
99 | src/contrib/service/set/plugin_block_set_test.c | 99 | src/contrib/service/set/plugin_block_set_test.c |
100 | src/contrib/service/set/set_api.c | 100 | src/contrib/service/set/set_api.c |
101 | src/contrib/service/template/gnunet-service-template.c | 101 | src/contrib/service/template/gnunet-service-template.c |
102 | src/gana/gnunet-error-codes/gnunet_error_codes.c | ||
103 | src/lib/block/bg_bf.c | 102 | src/lib/block/bg_bf.c |
104 | src/lib/block/block.c | 103 | src/lib/block/block.c |
105 | src/lib/curl/curl.c | 104 | src/lib/curl/curl.c |
@@ -132,6 +131,24 @@ src/lib/sq/sq_exec.c | |||
132 | src/lib/sq/sq_prepare.c | 131 | src/lib/sq/sq_prepare.c |
133 | src/lib/sq/sq_query_helper.c | 132 | src/lib/sq/sq_query_helper.c |
134 | src/lib/sq/sq_result_helper.c | 133 | src/lib/sq/sq_result_helper.c |
134 | src/lib/testing/gnunet-cmds-helper.c | ||
135 | src/lib/testing/gnunet-testing-netjail-launcher.c | ||
136 | src/lib/testing/testing_api_barrier.c | ||
137 | src/lib/testing/testing_api_cmd_barrier_create.c | ||
138 | src/lib/testing/testing_api_cmd_barrier_reached.c | ||
139 | src/lib/testing/testing_api_cmd_batch.c | ||
140 | src/lib/testing/testing_api_cmd_exec.c | ||
141 | src/lib/testing/testing_api_cmd_finish.c | ||
142 | src/lib/testing/testing_api_cmd_get_topo.c | ||
143 | src/lib/testing/testing_api_cmd_netjail_start.c | ||
144 | src/lib/testing/testing_api_cmd_netjail_start_cmds_helper.c | ||
145 | src/lib/testing/testing_api_cmd_signal.c | ||
146 | src/lib/testing/testing_api_cmd_stat.c | ||
147 | src/lib/testing/testing_api_cmds.c | ||
148 | src/lib/testing/testing_api_loop.c | ||
149 | src/lib/testing/testing_api_main.c | ||
150 | src/lib/testing/testing_api_topology.c | ||
151 | src/lib/testing/testing_api_traits.c | ||
135 | src/lib/util/bandwidth.c | 152 | src/lib/util/bandwidth.c |
136 | src/lib/util/benchmark.c | 153 | src/lib/util/benchmark.c |
137 | src/lib/util/bio.c | 154 | src/lib/util/bio.c |
@@ -242,6 +259,9 @@ src/service/arm/arm_api.c | |||
242 | src/service/arm/arm_monitor_api.c | 259 | src/service/arm/arm_monitor_api.c |
243 | src/service/arm/gnunet-service-arm.c | 260 | src/service/arm/gnunet-service-arm.c |
244 | src/service/arm/mockup-service.c | 261 | src/service/arm/mockup-service.c |
262 | src/service/arm/testing_arm_cmd_start_peer.c | ||
263 | src/service/arm/testing_arm_cmd_stop_peer.c | ||
264 | src/service/arm/testing_arm_traits.c | ||
245 | src/service/cadet/cadet_api.c | 265 | src/service/cadet/cadet_api.c |
246 | src/service/cadet/cadet_api_drop_message.c | 266 | src/service/cadet/cadet_api_drop_message.c |
247 | src/service/cadet/cadet_api_get_channel.c | 267 | src/service/cadet/cadet_api_get_channel.c |
@@ -260,12 +280,12 @@ src/service/cadet/gnunet-service-cadet_paths.c | |||
260 | src/service/cadet/gnunet-service-cadet_peer.c | 280 | src/service/cadet/gnunet-service-cadet_peer.c |
261 | src/service/cadet/gnunet-service-cadet_tunnels.c | 281 | src/service/cadet/gnunet-service-cadet_tunnels.c |
262 | src/service/core/core_api.c | 282 | src/service/core/core_api.c |
263 | src/service/core/core_api_cmd_connecting_peers.c | ||
264 | src/service/core/core_api_monitor_peers.c | 283 | src/service/core/core_api_monitor_peers.c |
265 | src/service/core/gnunet-service-core.c | 284 | src/service/core/gnunet-service-core.c |
266 | src/service/core/gnunet-service-core_kx.c | 285 | src/service/core/gnunet-service-core_kx.c |
267 | src/service/core/gnunet-service-core_sessions.c | 286 | src/service/core/gnunet-service-core_sessions.c |
268 | src/service/core/gnunet-service-core_typemap.c | 287 | src/service/core/gnunet-service-core_typemap.c |
288 | src/service/core/testing_core_cmd_connecting_peers.c | ||
269 | src/service/datacache/datacache.c | 289 | src/service/datacache/datacache.c |
270 | src/service/datastore/datastore_api.c | 290 | src/service/datastore/datastore_api.c |
271 | src/service/datastore/gnunet-service-datastore.c | 291 | src/service/datastore/gnunet-service-datastore.c |
@@ -356,11 +376,7 @@ src/service/messenger/gnunet-service-messenger_peer_store.c | |||
356 | src/service/messenger/gnunet-service-messenger_room.c | 376 | src/service/messenger/gnunet-service-messenger_room.c |
357 | src/service/messenger/gnunet-service-messenger_service.c | 377 | src/service/messenger/gnunet-service-messenger_service.c |
358 | src/service/messenger/gnunet-service-messenger_tunnel.c | 378 | src/service/messenger/gnunet-service-messenger_tunnel.c |
359 | src/service/messenger/messenger-testing.c | ||
360 | src/service/messenger/messenger_api.c | 379 | src/service/messenger/messenger_api.c |
361 | src/service/messenger/messenger_api_cmd_join_room.c | ||
362 | src/service/messenger/messenger_api_cmd_start_service.c | ||
363 | src/service/messenger/messenger_api_cmd_stop_service.c | ||
364 | src/service/messenger/messenger_api_contact.c | 380 | src/service/messenger/messenger_api_contact.c |
365 | src/service/messenger/messenger_api_contact_store.c | 381 | src/service/messenger/messenger_api_contact_store.c |
366 | src/service/messenger/messenger_api_handle.c | 382 | src/service/messenger/messenger_api_handle.c |
@@ -370,8 +386,12 @@ src/service/messenger/messenger_api_message_control.c | |||
370 | src/service/messenger/messenger_api_message_kind.c | 386 | src/service/messenger/messenger_api_message_kind.c |
371 | src/service/messenger/messenger_api_queue_messages.c | 387 | src/service/messenger/messenger_api_queue_messages.c |
372 | src/service/messenger/messenger_api_room.c | 388 | src/service/messenger/messenger_api_room.c |
373 | src/service/messenger/messenger_api_traits.c | ||
374 | src/service/messenger/messenger_api_util.c | 389 | src/service/messenger/messenger_api_util.c |
390 | src/service/messenger/testing_messenger.c | ||
391 | src/service/messenger/testing_messenger_cmd_join_room.c | ||
392 | src/service/messenger/testing_messenger_cmd_start_service.c | ||
393 | src/service/messenger/testing_messenger_cmd_stop_service.c | ||
394 | src/service/messenger/testing_messenger_traits.c | ||
375 | src/service/namecache/gnunet-service-namecache.c | 395 | src/service/namecache/gnunet-service-namecache.c |
376 | src/service/namecache/namecache_api.c | 396 | src/service/namecache/namecache_api.c |
377 | src/service/namestore/gnunet-service-namestore.c | 397 | src/service/namestore/gnunet-service-namestore.c |
@@ -441,26 +461,10 @@ src/service/setu/ibf_sim.c | |||
441 | src/service/setu/setu_api.c | 461 | src/service/setu/setu_api.c |
442 | src/service/statistics/gnunet-service-statistics.c | 462 | src/service/statistics/gnunet-service-statistics.c |
443 | src/service/statistics/statistics_api.c | 463 | src/service/statistics/statistics_api.c |
444 | src/service/testing/gnunet-cmds-helper.c | 464 | src/service/testbed/gnunet-testbed.c |
445 | src/service/testing/gnunet-testing.c | 465 | src/service/testbed/testbed.c |
446 | src/service/testing/list-keys.c | 466 | src/service/testbed/testbed_api_cmd_system_create.c |
447 | src/service/testing/testing.c | 467 | src/service/testbed/testing_testbed_traits.c |
448 | src/service/testing/testing_api_cmd_barrier.c | ||
449 | src/service/testing/testing_api_cmd_barrier_reached.c | ||
450 | src/service/testing/testing_api_cmd_batch.c | ||
451 | src/service/testing/testing_api_cmd_block_until_external_trigger.c | ||
452 | src/service/testing/testing_api_cmd_exec_bash_script.c | ||
453 | src/service/testing/testing_api_cmd_finish.c | ||
454 | src/service/testing/testing_api_cmd_local_test_prepared.c | ||
455 | src/service/testing/testing_api_cmd_netjail_start.c | ||
456 | src/service/testing/testing_api_cmd_netjail_start_cmds_helper.c | ||
457 | src/service/testing/testing_api_cmd_netjail_stop.c | ||
458 | src/service/testing/testing_api_cmd_netjail_stop_cmds_helper.c | ||
459 | src/service/testing/testing_api_cmd_send_peer_ready.c | ||
460 | src/service/testing/testing_api_cmd_system_create.c | ||
461 | src/service/testing/testing_api_cmd_system_destroy.c | ||
462 | src/service/testing/testing_api_loop.c | ||
463 | src/service/testing/testing_api_traits.c | ||
464 | src/service/topology/gnunet-daemon-topology.c | 468 | src/service/topology/gnunet-daemon-topology.c |
465 | src/service/transport/gnunet-communicator-quic.c | 469 | src/service/transport/gnunet-communicator-quic.c |
466 | src/service/transport/gnunet-communicator-tcp.c | 470 | src/service/transport/gnunet-communicator-tcp.c |
@@ -468,8 +472,7 @@ src/service/transport/gnunet-communicator-udp.c | |||
468 | src/service/transport/gnunet-communicator-unix.c | 472 | src/service/transport/gnunet-communicator-unix.c |
469 | src/service/transport/gnunet-service-transport.c | 473 | src/service/transport/gnunet-service-transport.c |
470 | src/service/transport/gnunet-transport.c | 474 | src/service/transport/gnunet-transport.c |
471 | src/service/transport/testing_api_cmd_start_peer.c | 475 | src/service/transport/testing_transport_traits.c |
472 | src/service/transport/testing_api_cmd_stop_peer.c | ||
473 | src/service/transport/transport-testing-communicator.c | 476 | src/service/transport/transport-testing-communicator.c |
474 | src/service/transport/transport-testing-filenames2.c | 477 | src/service/transport/transport-testing-filenames2.c |
475 | src/service/transport/transport-testing-loggers2.c | 478 | src/service/transport/transport-testing-loggers2.c |
@@ -486,7 +489,6 @@ src/service/transport/transport_api_cmd_send_simple.c | |||
486 | src/service/transport/transport_api_cmd_send_simple_performance.c | 489 | src/service/transport/transport_api_cmd_send_simple_performance.c |
487 | src/service/transport/transport_api_cmd_start_peer.c | 490 | src/service/transport/transport_api_cmd_start_peer.c |
488 | src/service/transport/transport_api_cmd_stop_peer.c | 491 | src/service/transport/transport_api_cmd_stop_peer.c |
489 | src/service/transport/transport_api_traits.c | ||
490 | src/service/util/gnunet-service-resolver.c | 492 | src/service/util/gnunet-service-resolver.c |
491 | src/service/vpn/gnunet-helper-vpn.c | 493 | src/service/vpn/gnunet-helper-vpn.c |
492 | src/service/vpn/gnunet-service-vpn.c | 494 | src/service/vpn/gnunet-service-vpn.c |
@@ -10,7 +10,7 @@ msgid "" | |||
10 | msgstr "" | 10 | msgstr "" |
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-15 09:19+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,25 +348,25 @@ msgstr "Fehler beim Parsen der Gerätedaten von `%s' bei %s:%d.\n" | |||
348 | msgid "Failed to connect to CORE service!\n" | 348 | msgid "Failed to connect to CORE service!\n" |
349 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 349 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
350 | 350 | ||
351 | #: src/cli/core/gnunet-core.c:212 | 351 | #: src/cli/core/gnunet-core.c:213 |
352 | #, fuzzy | 352 | #, fuzzy |
353 | msgid "No argument given.\n" | 353 | msgid "No argument given.\n" |
354 | msgstr "# empfangene Ergebnisse" | 354 | msgstr "# empfangene Ergebnisse" |
355 | 355 | ||
356 | #: src/cli/core/gnunet-core.c:235 src/service/transport/gnunet-transport.c:1389 | 356 | #: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389 |
357 | msgid "provide information about all current connections (continuously)" | 357 | msgid "provide information about all current connections (continuously)" |
358 | msgstr "" | 358 | msgstr "" |
359 | 359 | ||
360 | #: src/cli/core/gnunet-core.c:241 | 360 | #: src/cli/core/gnunet-core.c:244 |
361 | msgid "Show our current peer identity" | 361 | msgid "Show our current peer identity" |
362 | msgstr "" | 362 | msgstr "" |
363 | 363 | ||
364 | #: src/cli/core/gnunet-core.c:248 | 364 | #: src/cli/core/gnunet-core.c:251 |
365 | #, fuzzy | 365 | #, fuzzy |
366 | msgid "Show current connections" | 366 | msgid "Show current connections" |
367 | msgstr "GNUnet Konfiguration" | 367 | msgstr "GNUnet Konfiguration" |
368 | 368 | ||
369 | #: src/cli/core/gnunet-core.c:259 | 369 | #: src/cli/core/gnunet-core.c:262 |
370 | msgid "Print information about connected peers." | 370 | msgid "Print information about connected peers." |
371 | msgstr "Informationen über verbundene Knoten ausgeben." | 371 | msgstr "Informationen über verbundene Knoten ausgeben." |
372 | 372 | ||
@@ -1089,54 +1089,54 @@ msgstr "Auf die Namespace Informationen konnte nicht zugegriffen werden.\n" | |||
1089 | msgid "Unindex a file that was previously indexed with gnunet-publish." | 1089 | msgid "Unindex a file that was previously indexed with gnunet-publish." |
1090 | msgstr "" | 1090 | msgstr "" |
1091 | 1091 | ||
1092 | #: src/cli/gns/gnunet-gns.c:268 | 1092 | #: src/cli/gns/gnunet-gns.c:269 |
1093 | #, fuzzy, c-format | 1093 | #, fuzzy, c-format |
1094 | msgid "`%s' is not a valid DNS domain name\n" | 1094 | msgid "`%s' is not a valid DNS domain name\n" |
1095 | msgstr "»%s« ist keine gültige IP-Adresse.\n" | 1095 | msgstr "»%s« ist keine gültige IP-Adresse.\n" |
1096 | 1096 | ||
1097 | #: 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 |
1098 | #, c-format | 1098 | #, c-format |
1099 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" | 1099 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" |
1100 | msgstr "" | 1100 | msgstr "" |
1101 | 1101 | ||
1102 | #: src/cli/gns/gnunet-gns.c:294 | 1102 | #: src/cli/gns/gnunet-gns.c:295 |
1103 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" | 1103 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" |
1104 | msgstr "" | 1104 | msgstr "" |
1105 | 1105 | ||
1106 | #: src/cli/gns/gnunet-gns.c:305 | 1106 | #: src/cli/gns/gnunet-gns.c:306 |
1107 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 | 1107 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 |
1108 | #, fuzzy, c-format | 1108 | #, fuzzy, c-format |
1109 | msgid "Failed to connect to GNS\n" | 1109 | msgid "Failed to connect to GNS\n" |
1110 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 1110 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
1111 | 1111 | ||
1112 | #: src/cli/gns/gnunet-gns.c:318 | 1112 | #: src/cli/gns/gnunet-gns.c:325 |
1113 | #, c-format | 1113 | #, c-format |
1114 | msgid "Invalid typename specified, assuming `ANY'\n" | 1114 | msgid "Invalid typename specified, assuming `ANY'\n" |
1115 | msgstr "" | 1115 | msgstr "" |
1116 | 1116 | ||
1117 | #: src/cli/gns/gnunet-gns.c:358 | 1117 | #: src/cli/gns/gnunet-gns.c:365 |
1118 | msgid "Lookup a record for the given name" | 1118 | msgid "Lookup a record for the given name" |
1119 | msgstr "" | 1119 | msgstr "" |
1120 | 1120 | ||
1121 | #: src/cli/gns/gnunet-gns.c:364 | 1121 | #: src/cli/gns/gnunet-gns.c:371 |
1122 | #, fuzzy | 1122 | #, fuzzy |
1123 | msgid "Specify the type of the record to lookup" | 1123 | msgid "Specify the type of the record to lookup" |
1124 | msgstr "Die Priorität des Inhalts angeben" | 1124 | msgstr "Die Priorität des Inhalts angeben" |
1125 | 1125 | ||
1126 | #: src/cli/gns/gnunet-gns.c:370 | 1126 | #: src/cli/gns/gnunet-gns.c:377 |
1127 | #, fuzzy | 1127 | #, fuzzy |
1128 | msgid "Specify a timeout for the lookup" | 1128 | msgid "Specify a timeout for the lookup" |
1129 | msgstr "Die Priorität des Inhalts angeben" | 1129 | msgstr "Die Priorität des Inhalts angeben" |
1130 | 1130 | ||
1131 | #: src/cli/gns/gnunet-gns.c:374 | 1131 | #: src/cli/gns/gnunet-gns.c:381 |
1132 | msgid "No unneeded output" | 1132 | msgid "No unneeded output" |
1133 | msgstr "" | 1133 | msgstr "" |
1134 | 1134 | ||
1135 | #: src/cli/gns/gnunet-gns.c:379 | 1135 | #: src/cli/gns/gnunet-gns.c:386 |
1136 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" | 1136 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" |
1137 | msgstr "" | 1137 | msgstr "" |
1138 | 1138 | ||
1139 | #: src/cli/gns/gnunet-gns.c:393 | 1139 | #: src/cli/gns/gnunet-gns.c:400 |
1140 | #, fuzzy | 1140 | #, fuzzy |
1141 | msgid "GNUnet GNS resolver tool" | 1141 | msgid "GNUnet GNS resolver tool" |
1142 | msgstr "GNUnet Netzwerk Topologie tracen." | 1142 | msgstr "GNUnet Netzwerk Topologie tracen." |
@@ -1657,7 +1657,11 @@ msgstr "" | |||
1657 | msgid "GNUnet NAT traversal autoconfigure daemon" | 1657 | msgid "GNUnet NAT traversal autoconfigure daemon" |
1658 | msgstr "" | 1658 | msgstr "" |
1659 | 1659 | ||
1660 | #: src/cli/nse/gnunet-nse.c:124 | 1660 | #: src/cli/nse/gnunet-nse.c:126 |
1661 | msgid "Monitor and output current estimates" | ||
1662 | msgstr "" | ||
1663 | |||
1664 | #: src/cli/nse/gnunet-nse.c:137 | ||
1661 | msgid "Show network size estimates from NSE service." | 1665 | msgid "Show network size estimates from NSE service." |
1662 | msgstr "" | 1666 | msgstr "" |
1663 | 1667 | ||
@@ -1705,86 +1709,90 @@ msgstr "" | |||
1705 | msgid "The time until the DID Document is going to expire (e.g. 5d)" | 1709 | msgid "The time until the DID Document is going to expire (e.g. 5d)" |
1706 | msgstr "" | 1710 | msgstr "" |
1707 | 1711 | ||
1708 | #: src/cli/reclaim/gnunet-reclaim.c:805 | 1712 | #: src/cli/reclaim/gnunet-reclaim.c:813 |
1709 | #, fuzzy, c-format | 1713 | #, fuzzy, c-format |
1710 | msgid "Ego is required\n" | 1714 | msgid "Ego is required\n" |
1711 | msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" | 1715 | msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" |
1712 | 1716 | ||
1713 | #: src/cli/reclaim/gnunet-reclaim.c:812 | 1717 | #: src/cli/reclaim/gnunet-reclaim.c:820 |
1714 | #, c-format | 1718 | #, c-format |
1715 | msgid "Attribute value missing!\n" | 1719 | msgid "Attribute value missing!\n" |
1716 | msgstr "" | 1720 | msgstr "" |
1717 | 1721 | ||
1718 | #: src/cli/reclaim/gnunet-reclaim.c:819 | 1722 | #: src/cli/reclaim/gnunet-reclaim.c:827 |
1719 | #, fuzzy, c-format | 1723 | #, fuzzy, c-format |
1720 | msgid "Requesting party key is required!\n" | 1724 | msgid "Requesting party key is required!\n" |
1721 | msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" | 1725 | msgstr "Option `%s' macht keinen Sinn ohne die Option `%s'.\n" |
1722 | 1726 | ||
1723 | #: src/cli/reclaim/gnunet-reclaim.c:837 | 1727 | #: src/cli/reclaim/gnunet-reclaim.c:846 |
1724 | msgid "Add or update an attribute NAME" | 1728 | msgid "Add or update an attribute NAME" |
1725 | msgstr "" | 1729 | msgstr "" |
1726 | 1730 | ||
1727 | #: src/cli/reclaim/gnunet-reclaim.c:842 | 1731 | #: src/cli/reclaim/gnunet-reclaim.c:851 |
1728 | msgid "Delete the attribute with ID" | 1732 | msgid "Delete the attribute with ID" |
1729 | msgstr "" | 1733 | msgstr "" |
1730 | 1734 | ||
1731 | #: src/cli/reclaim/gnunet-reclaim.c:847 | 1735 | #: src/cli/reclaim/gnunet-reclaim.c:856 |
1732 | msgid "The attribute VALUE" | 1736 | msgid "The attribute VALUE" |
1733 | msgstr "" | 1737 | msgstr "" |
1734 | 1738 | ||
1735 | #: src/cli/reclaim/gnunet-reclaim.c:852 | 1739 | #: src/cli/reclaim/gnunet-reclaim.c:861 |
1736 | msgid "The EGO to use" | 1740 | msgid "The EGO to use" |
1737 | msgstr "" | 1741 | msgstr "" |
1738 | 1742 | ||
1739 | #: src/cli/reclaim/gnunet-reclaim.c:858 | 1743 | #: src/cli/reclaim/gnunet-reclaim.c:867 |
1740 | msgid "Specify the relying party for issue" | 1744 | msgid "Specify the relying party for issue" |
1741 | msgstr "" | 1745 | msgstr "" |
1742 | 1746 | ||
1743 | #: src/cli/reclaim/gnunet-reclaim.c:862 | 1747 | #: src/cli/reclaim/gnunet-reclaim.c:873 |
1748 | msgid "Specify the relying party URI for a ticket to consume" | ||
1749 | msgstr "" | ||
1750 | |||
1751 | #: src/cli/reclaim/gnunet-reclaim.c:877 | ||
1744 | msgid "List attributes for EGO" | 1752 | msgid "List attributes for EGO" |
1745 | msgstr "" | 1753 | msgstr "" |
1746 | 1754 | ||
1747 | #: src/cli/reclaim/gnunet-reclaim.c:866 | 1755 | #: src/cli/reclaim/gnunet-reclaim.c:881 |
1748 | msgid "List credentials for EGO" | 1756 | msgid "List credentials for EGO" |
1749 | msgstr "" | 1757 | msgstr "" |
1750 | 1758 | ||
1751 | #: src/cli/reclaim/gnunet-reclaim.c:872 | 1759 | #: src/cli/reclaim/gnunet-reclaim.c:887 |
1752 | msgid "Credential to use for attribute" | 1760 | msgid "Credential to use for attribute" |
1753 | msgstr "" | 1761 | msgstr "" |
1754 | 1762 | ||
1755 | #: src/cli/reclaim/gnunet-reclaim.c:877 | 1763 | #: src/cli/reclaim/gnunet-reclaim.c:892 |
1756 | msgid "Credential name" | 1764 | msgid "Credential name" |
1757 | msgstr "" | 1765 | msgstr "" |
1758 | 1766 | ||
1759 | #: src/cli/reclaim/gnunet-reclaim.c:883 | 1767 | #: src/cli/reclaim/gnunet-reclaim.c:898 |
1760 | msgid "Issue a ticket for a set of attributes separated by comma" | 1768 | msgid "Issue a ticket for a set of attributes separated by comma" |
1761 | msgstr "" | 1769 | msgstr "" |
1762 | 1770 | ||
1763 | #: src/cli/reclaim/gnunet-reclaim.c:888 | 1771 | #: src/cli/reclaim/gnunet-reclaim.c:903 |
1764 | msgid "Consume a ticket" | 1772 | msgid "Consume a ticket" |
1765 | msgstr "" | 1773 | msgstr "" |
1766 | 1774 | ||
1767 | #: src/cli/reclaim/gnunet-reclaim.c:893 | 1775 | #: src/cli/reclaim/gnunet-reclaim.c:908 |
1768 | msgid "Revoke a ticket" | 1776 | msgid "Revoke a ticket" |
1769 | msgstr "" | 1777 | msgstr "" |
1770 | 1778 | ||
1771 | #: src/cli/reclaim/gnunet-reclaim.c:898 | 1779 | #: src/cli/reclaim/gnunet-reclaim.c:913 |
1772 | msgid "Type of attribute" | 1780 | msgid "Type of attribute" |
1773 | msgstr "" | 1781 | msgstr "" |
1774 | 1782 | ||
1775 | #: src/cli/reclaim/gnunet-reclaim.c:903 | 1783 | #: src/cli/reclaim/gnunet-reclaim.c:918 |
1776 | msgid "Type of credential" | 1784 | msgid "Type of credential" |
1777 | msgstr "" | 1785 | msgstr "" |
1778 | 1786 | ||
1779 | #: src/cli/reclaim/gnunet-reclaim.c:907 | 1787 | #: src/cli/reclaim/gnunet-reclaim.c:922 |
1780 | msgid "List tickets of ego" | 1788 | msgid "List tickets of ego" |
1781 | msgstr "" | 1789 | msgstr "" |
1782 | 1790 | ||
1783 | #: src/cli/reclaim/gnunet-reclaim.c:913 | 1791 | #: src/cli/reclaim/gnunet-reclaim.c:928 |
1784 | msgid "Expiration interval of the attribute" | 1792 | msgid "Expiration interval of the attribute" |
1785 | msgstr "" | 1793 | msgstr "" |
1786 | 1794 | ||
1787 | #: src/cli/reclaim/gnunet-reclaim.c:921 | 1795 | #: src/cli/reclaim/gnunet-reclaim.c:936 |
1788 | msgid "re:claimID command line tool" | 1796 | msgid "re:claimID command line tool" |
1789 | msgstr "" | 1797 | msgstr "" |
1790 | 1798 | ||
@@ -2019,33 +2027,59 @@ msgstr "Statistiken der GNUnet-Aktivitäten ausgeben." | |||
2019 | msgid "run decoder modus, otherwise runs as encoder" | 2027 | msgid "run decoder modus, otherwise runs as encoder" |
2020 | msgstr "" | 2028 | msgstr "" |
2021 | 2029 | ||
2022 | #: src/cli/util/gnunet-config.c:154 | 2030 | #: src/cli/util/gnunet-config.c:101 |
2023 | msgid "test if the current installation supports the specified BACKEND" | 2031 | msgid "test if the current installation supports the specified BACKEND" |
2024 | msgstr "" | 2032 | msgstr "" |
2025 | 2033 | ||
2026 | #: src/cli/util/gnunet-config.c:160 | 2034 | #: src/cli/util/gnunet-config.c:107 |
2027 | msgid "" | 2035 | msgid "" |
2028 | "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 " |
2029 | "GNUnet" | 2037 | "GNUnet" |
2030 | msgstr "" | 2038 | msgstr "" |
2031 | 2039 | ||
2032 | #: src/cli/util/gnunet-config.c:165 | 2040 | #: src/cli/util/gnunet-config.c:112 |
2033 | msgid "Is this an experimental build of GNUnet" | 2041 | msgid "Is this an experimental build of GNUnet" |
2034 | msgstr "" | 2042 | msgstr "" |
2035 | 2043 | ||
2036 | #: src/cli/util/gnunet-config.c:171 | 2044 | #: src/cli/util/gnunet-config.c:118 |
2037 | msgid "" | 2045 | msgid "" |
2038 | "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 " |
2039 | "GNUnet" | 2047 | "GNUnet" |
2040 | msgstr "" | 2048 | msgstr "" |
2041 | 2049 | ||
2042 | #: src/cli/util/gnunet-config.c:177 | 2050 | #: src/cli/util/gnunet-config.c:123 |
2051 | #, fuzzy | ||
2052 | msgid "Do not parse default configuration files" | ||
2053 | msgstr "GNUnet-Konfigurationsdateien bearbeiten" | ||
2054 | |||
2055 | #: src/cli/util/gnunet-config.c:129 | ||
2043 | msgid "Provide the path under which GNUnet was installed" | 2056 | msgid "Provide the path under which GNUnet was installed" |
2044 | msgstr "" | 2057 | msgstr "" |
2045 | 2058 | ||
2046 | #: src/cli/util/gnunet-config.c:192 | 2059 | #: src/cli/util/gnunet-config.c:136 |
2047 | msgid "Manipulate GNUnet configuration files" | 2060 | msgid "" |
2048 | msgstr "GNUnet-Konfigurationsdateien bearbeiten" | 2061 | "Parse main configuration from this command-line argument and not from disk" |
2062 | msgstr "" | ||
2063 | |||
2064 | #: src/cli/util/gnunet-config.c:225 | ||
2065 | #, fuzzy | ||
2066 | msgid "Failed to load default configuration, exiting ...\n" | ||
2067 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" | ||
2068 | |||
2069 | #: src/cli/util/gnunet-config.c:237 | ||
2070 | #, fuzzy | ||
2071 | msgid "Failed to parse configuration, exiting ...\n" | ||
2072 | msgstr "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 | ||
2076 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
2077 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" | ||
2078 | |||
2079 | #: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299 | ||
2080 | #, fuzzy, c-format | ||
2081 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
2082 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" | ||
2049 | 2083 | ||
2050 | #: src/cli/util/gnunet-crypto-tvg.c:1588 | 2084 | #: src/cli/util/gnunet-crypto-tvg.c:1588 |
2051 | msgid "verify a test vector from stdin" | 2085 | msgid "verify a test vector from stdin" |
@@ -2096,55 +2130,54 @@ msgstr "" | |||
2096 | msgid "Hostkeys file `%s' not found\n" | 2130 | msgid "Hostkeys file `%s' not found\n" |
2097 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | 2131 | msgstr "Kommando `%s' wurde nicht gefunden!\n" |
2098 | 2132 | ||
2099 | #: src/cli/util/gnunet-ecc.c:314 | 2133 | #: src/cli/util/gnunet-ecc.c:318 |
2100 | #, c-format | 2134 | #, c-format |
2101 | msgid "Hostkeys file `%s' is empty\n" | 2135 | msgid "Hostkeys file `%s' is empty\n" |
2102 | msgstr "" | 2136 | msgstr "" |
2103 | 2137 | ||
2104 | #: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 | 2138 | #: src/cli/util/gnunet-ecc.c:324 |
2105 | #: src/service/testing/testing.c:308 | ||
2106 | #, c-format | 2139 | #, c-format |
2107 | msgid "Incorrect hostkey file format: %s\n" | 2140 | msgid "Incorrect hostkey file format: %s\n" |
2108 | msgstr "" | 2141 | msgstr "" |
2109 | 2142 | ||
2110 | #: src/cli/util/gnunet-ecc.c:334 | 2143 | #: src/cli/util/gnunet-ecc.c:340 |
2111 | #, fuzzy, c-format | 2144 | #, fuzzy, c-format |
2112 | msgid "Could not read hostkey file: %s\n" | 2145 | msgid "Could not read hostkey file: %s\n" |
2113 | msgstr "PID konnte nicht in Datei `%s' geschrieben werden: %s.\n" | 2146 | msgstr "PID konnte nicht in Datei `%s' geschrieben werden: %s.\n" |
2114 | 2147 | ||
2115 | #: src/cli/util/gnunet-ecc.c:388 | 2148 | #: src/cli/util/gnunet-ecc.c:394 |
2116 | msgid "No hostkey file specified on command line\n" | 2149 | msgid "No hostkey file specified on command line\n" |
2117 | msgstr "" | 2150 | msgstr "" |
2118 | 2151 | ||
2119 | #: src/cli/util/gnunet-ecc.c:452 | 2152 | #: src/cli/util/gnunet-ecc.c:458 |
2120 | msgid "list keys included in a file (for testing)" | 2153 | msgid "list keys included in a file (for testing)" |
2121 | msgstr "" | 2154 | msgstr "" |
2122 | 2155 | ||
2123 | #: src/cli/util/gnunet-ecc.c:458 | 2156 | #: src/cli/util/gnunet-ecc.c:464 |
2124 | msgid "number of keys to list included in a file (for testing)" | 2157 | msgid "number of keys to list included in a file (for testing)" |
2125 | msgstr "" | 2158 | msgstr "" |
2126 | 2159 | ||
2127 | #: src/cli/util/gnunet-ecc.c:464 | 2160 | #: src/cli/util/gnunet-ecc.c:470 |
2128 | msgid "create COUNT public-private key pairs (for testing)" | 2161 | msgid "create COUNT public-private key pairs (for testing)" |
2129 | msgstr "" | 2162 | msgstr "" |
2130 | 2163 | ||
2131 | #: src/cli/util/gnunet-ecc.c:469 | 2164 | #: src/cli/util/gnunet-ecc.c:475 |
2132 | msgid "print the public key in ASCII format" | 2165 | msgid "print the public key in ASCII format" |
2133 | msgstr "" | 2166 | msgstr "" |
2134 | 2167 | ||
2135 | #: src/cli/util/gnunet-ecc.c:474 | 2168 | #: src/cli/util/gnunet-ecc.c:480 |
2136 | msgid "print the private key in ASCII format" | 2169 | msgid "print the private key in ASCII format" |
2137 | msgstr "" | 2170 | msgstr "" |
2138 | 2171 | ||
2139 | #: src/cli/util/gnunet-ecc.c:479 | 2172 | #: src/cli/util/gnunet-ecc.c:485 |
2140 | msgid "print the public key in HEX format" | 2173 | msgid "print the public key in HEX format" |
2141 | msgstr "" | 2174 | msgstr "" |
2142 | 2175 | ||
2143 | #: src/cli/util/gnunet-ecc.c:485 | 2176 | #: src/cli/util/gnunet-ecc.c:491 |
2144 | msgid "print examples of ECC operations (used for compatibility testing)" | 2177 | msgid "print examples of ECC operations (used for compatibility testing)" |
2145 | msgstr "" | 2178 | msgstr "" |
2146 | 2179 | ||
2147 | #: src/cli/util/gnunet-ecc.c:499 | 2180 | #: src/cli/util/gnunet-ecc.c:505 |
2148 | msgid "Manipulate GNUnet private ECC key files" | 2181 | msgid "Manipulate GNUnet private ECC key files" |
2149 | msgstr "" | 2182 | msgstr "" |
2150 | 2183 | ||
@@ -3222,13 +3255,13 @@ msgstr "" | |||
3222 | msgid "Invalid handle type while writing `%s'" | 3255 | msgid "Invalid handle type while writing `%s'" |
3223 | msgstr "Ungültiger Parameter: `%s'\n" | 3256 | msgstr "Ungültiger Parameter: `%s'\n" |
3224 | 3257 | ||
3225 | #: 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 |
3226 | #: src/service/arm/gnunet-service-arm.c:452 | 3259 | #: src/service/arm/gnunet-service-arm.c:452 |
3227 | #, c-format | 3260 | #, c-format |
3228 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 3261 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
3229 | msgstr "" | 3262 | msgstr "" |
3230 | 3263 | ||
3231 | #: 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 |
3232 | #: src/service/arm/gnunet-service-arm.c:456 | 3265 | #: src/service/arm/gnunet-service-arm.c:456 |
3233 | #, c-format | 3266 | #, c-format |
3234 | msgid "Using `%s' instead\n" | 3267 | msgid "Using `%s' instead\n" |
@@ -3360,17 +3393,17 @@ msgstr "" | |||
3360 | msgid "`%s' failed at %s:%d with error: %s\n" | 3393 | msgid "`%s' failed at %s:%d with error: %s\n" |
3361 | msgstr "»%s« schlug bei %s:%d mit dem Fehler %s fehl\n" | 3394 | msgstr "»%s« schlug bei %s:%d mit dem Fehler %s fehl\n" |
3362 | 3395 | ||
3363 | #: src/lib/util/crypto_ecc.c:554 | 3396 | #: src/lib/util/crypto_ecc.c:569 |
3364 | #, fuzzy, c-format | 3397 | #, fuzzy, c-format |
3365 | msgid "ECC signing failed at %s:%d: %s\n" | 3398 | msgid "ECC signing failed at %s:%d: %s\n" |
3366 | msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" | 3399 | msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" |
3367 | 3400 | ||
3368 | #: src/lib/util/crypto_ecc.c:677 | 3401 | #: src/lib/util/crypto_ecc.c:692 |
3369 | #, fuzzy, c-format | 3402 | #, fuzzy, c-format |
3370 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 3403 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
3371 | msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" | 3404 | msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" |
3372 | 3405 | ||
3373 | #: 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 |
3374 | #, fuzzy | 3407 | #, fuzzy |
3375 | msgid "Could not load peer's private key\n" | 3408 | msgid "Could not load peer's private key\n" |
3376 | msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n" | 3409 | msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n" |
@@ -3396,7 +3429,7 @@ msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" | |||
3396 | msgid "Expected `%s' to be a directory!\n" | 3429 | msgid "Expected `%s' to be a directory!\n" |
3397 | msgstr "`%s' erwartet, dass `%s' ein Verzeichnis ist!\n" | 3430 | msgstr "`%s' erwartet, dass `%s' ein Verzeichnis ist!\n" |
3398 | 3431 | ||
3399 | #: 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 |
3400 | #, fuzzy, c-format | 3433 | #, fuzzy, c-format |
3401 | msgid "Cannot obtain information about user `%s': %s\n" | 3434 | msgid "Cannot obtain information about user `%s': %s\n" |
3402 | msgstr "Fehler beim Speichern der Konfigurationsdatei: `%s': %s.\n" | 3435 | msgstr "Fehler beim Speichern der Konfigurationsdatei: `%s': %s.\n" |
@@ -3590,99 +3623,99 @@ msgstr "Sie müssen für die Option »%s« zusätzlich eine Zahl angeben.\n" | |||
3590 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 3623 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
3591 | msgstr "" | 3624 | msgstr "" |
3592 | 3625 | ||
3593 | #: src/lib/util/gnunet_error_codes.c:60 | 3626 | #: src/lib/util/gnunet_error_codes.c:59 |
3594 | msgid "No error (success)." | 3627 | msgid "No error (success)." |
3595 | msgstr "" | 3628 | msgstr "" |
3596 | 3629 | ||
3597 | #: src/lib/util/gnunet_error_codes.c:66 | 3630 | #: src/lib/util/gnunet_error_codes.c:65 |
3598 | #, fuzzy | 3631 | #, fuzzy |
3599 | msgid "Unknown and unspecified error." | 3632 | msgid "Unknown and unspecified error." |
3600 | msgstr "Unbekannter Anfragestatus" | 3633 | msgstr "Unbekannter Anfragestatus" |
3601 | 3634 | ||
3602 | #: src/lib/util/gnunet_error_codes.c:72 | 3635 | #: src/lib/util/gnunet_error_codes.c:71 |
3603 | #, fuzzy | 3636 | #, fuzzy |
3604 | msgid "Communication with service failed." | 3637 | msgid "Communication with service failed." |
3605 | msgstr "Informationen über andere GNUnet Knoten ausgeben." | 3638 | msgstr "Informationen über andere GNUnet Knoten ausgeben." |
3606 | 3639 | ||
3607 | #: src/lib/util/gnunet_error_codes.c:78 | 3640 | #: src/lib/util/gnunet_error_codes.c:77 |
3608 | #, fuzzy | 3641 | #, fuzzy |
3609 | msgid "Ego not found." | 3642 | msgid "Ego not found." |
3610 | msgstr "Kein Inhalt gefunden" | 3643 | msgstr "Kein Inhalt gefunden" |
3611 | 3644 | ||
3612 | #: src/lib/util/gnunet_error_codes.c:84 | 3645 | #: src/lib/util/gnunet_error_codes.c:83 |
3613 | msgid "Identifier already in use for another ego." | 3646 | msgid "Identifier already in use for another ego." |
3614 | msgstr "" | 3647 | msgstr "" |
3615 | 3648 | ||
3616 | #: src/lib/util/gnunet_error_codes.c:90 | 3649 | #: src/lib/util/gnunet_error_codes.c:89 |
3617 | msgid "The given ego is invalid or malformed." | 3650 | msgid "The given ego is invalid or malformed." |
3618 | msgstr "" | 3651 | msgstr "" |
3619 | 3652 | ||
3620 | #: src/lib/util/gnunet_error_codes.c:96 | 3653 | #: src/lib/util/gnunet_error_codes.c:95 |
3621 | #, fuzzy | 3654 | #, fuzzy |
3622 | msgid "Unknown namestore error." | 3655 | msgid "Unknown namestore error." |
3623 | msgstr "Unbekannter Anfragestatus" | 3656 | msgstr "Unbekannter Anfragestatus" |
3624 | 3657 | ||
3625 | #: 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 |
3626 | #, fuzzy | 3659 | #, fuzzy |
3627 | msgid "Zone iteration failed." | 3660 | msgid "Zone iteration failed." |
3628 | msgstr " Verbindung fehlgeschlagen\n" | 3661 | msgstr " Verbindung fehlgeschlagen\n" |
3629 | 3662 | ||
3630 | #: src/lib/util/gnunet_error_codes.c:108 | 3663 | #: src/lib/util/gnunet_error_codes.c:107 |
3631 | #, fuzzy | 3664 | #, fuzzy |
3632 | msgid "Zone not found." | 3665 | msgid "Zone not found." |
3633 | msgstr "Kein Inhalt gefunden" | 3666 | msgstr "Kein Inhalt gefunden" |
3634 | 3667 | ||
3635 | #: src/lib/util/gnunet_error_codes.c:114 | 3668 | #: src/lib/util/gnunet_error_codes.c:113 |
3636 | #, fuzzy | 3669 | #, fuzzy |
3637 | msgid "Record not found." | 3670 | msgid "Record not found." |
3638 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | 3671 | msgstr "Kommando `%s' wurde nicht gefunden!\n" |
3639 | 3672 | ||
3640 | #: src/lib/util/gnunet_error_codes.c:126 | 3673 | #: src/lib/util/gnunet_error_codes.c:125 |
3641 | msgid "Zone does not contain any records." | 3674 | msgid "Zone does not contain any records." |
3642 | msgstr "" | 3675 | msgstr "" |
3643 | 3676 | ||
3644 | #: src/lib/util/gnunet_error_codes.c:132 | 3677 | #: src/lib/util/gnunet_error_codes.c:131 |
3645 | #, fuzzy | 3678 | #, fuzzy |
3646 | msgid "Failed to lookup record." | 3679 | msgid "Failed to lookup record." |
3647 | msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" | 3680 | msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" |
3648 | 3681 | ||
3649 | #: src/lib/util/gnunet_error_codes.c:138 | 3682 | #: src/lib/util/gnunet_error_codes.c:137 |
3650 | #, fuzzy | 3683 | #, fuzzy |
3651 | msgid "No records given." | 3684 | msgid "No records given." |
3652 | msgstr "Kein Knoten angegeben!\n" | 3685 | msgstr "Kein Knoten angegeben!\n" |
3653 | 3686 | ||
3654 | #: src/lib/util/gnunet_error_codes.c:144 | 3687 | #: src/lib/util/gnunet_error_codes.c:143 |
3655 | msgid "Record data invalid." | 3688 | msgid "Record data invalid." |
3656 | msgstr "" | 3689 | msgstr "" |
3657 | 3690 | ||
3658 | #: src/lib/util/gnunet_error_codes.c:150 | 3691 | #: src/lib/util/gnunet_error_codes.c:149 |
3659 | #, fuzzy | 3692 | #, fuzzy |
3660 | msgid "No label given." | 3693 | msgid "No label given." |
3661 | msgstr "Kein Knoten angegeben!\n" | 3694 | msgstr "Kein Knoten angegeben!\n" |
3662 | 3695 | ||
3663 | #: src/lib/util/gnunet_error_codes.c:156 | 3696 | #: src/lib/util/gnunet_error_codes.c:155 |
3664 | #, fuzzy | 3697 | #, fuzzy |
3665 | msgid "No results given." | 3698 | msgid "No results given." |
3666 | msgstr "# empfangene Ergebnisse" | 3699 | msgstr "# empfangene Ergebnisse" |
3667 | 3700 | ||
3668 | #: src/lib/util/gnunet_error_codes.c:162 | 3701 | #: src/lib/util/gnunet_error_codes.c:161 |
3669 | msgid "Record already exists." | 3702 | msgid "Record already exists." |
3670 | msgstr "" | 3703 | msgstr "" |
3671 | 3704 | ||
3672 | #: src/lib/util/gnunet_error_codes.c:168 | 3705 | #: src/lib/util/gnunet_error_codes.c:167 |
3673 | msgid "Record size exceeds maximum limit." | 3706 | msgid "Record size exceeds maximum limit." |
3674 | msgstr "" | 3707 | msgstr "" |
3675 | 3708 | ||
3676 | #: src/lib/util/gnunet_error_codes.c:174 | 3709 | #: src/lib/util/gnunet_error_codes.c:173 |
3677 | msgid "There was an error in the database backend." | 3710 | msgid "There was an error in the database backend." |
3678 | msgstr "" | 3711 | msgstr "" |
3679 | 3712 | ||
3680 | #: src/lib/util/gnunet_error_codes.c:180 | 3713 | #: src/lib/util/gnunet_error_codes.c:179 |
3681 | #, fuzzy | 3714 | #, fuzzy |
3682 | msgid "Failed to store the given records." | 3715 | msgid "Failed to store the given records." |
3683 | msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" | 3716 | msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" |
3684 | 3717 | ||
3685 | #: src/lib/util/gnunet_error_codes.c:186 | 3718 | #: src/lib/util/gnunet_error_codes.c:185 |
3686 | msgid "Label invalid or malformed." | 3719 | msgid "Label invalid or malformed." |
3687 | msgstr "" | 3720 | msgstr "" |
3688 | 3721 | ||
@@ -3750,16 +3783,6 @@ msgstr "`%s' fehlgeschlagen für die Bibliothek `%s'. Ort: %s:%d. Fehler: %s\n" | |||
3750 | msgid "Could not determine plugin installation path.\n" | 3783 | msgid "Could not determine plugin installation path.\n" |
3751 | msgstr "Öffentliche IP-Adresse konnte nicht ermittelt werden.\n" | 3784 | msgstr "Öffentliche IP-Adresse konnte nicht ermittelt werden.\n" |
3752 | 3785 | ||
3753 | #: src/lib/util/program.c:287 | ||
3754 | #, fuzzy, c-format | ||
3755 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
3756 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" | ||
3757 | |||
3758 | #: src/lib/util/program.c:299 | ||
3759 | #, fuzzy, c-format | ||
3760 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
3761 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" | ||
3762 | |||
3763 | #: src/lib/util/program.c:314 | 3786 | #: src/lib/util/program.c:314 |
3764 | #, fuzzy, c-format | 3787 | #, fuzzy, c-format |
3765 | msgid "Unreadable configuration file `%s'. Exiting ...\n" | 3788 | msgid "Unreadable configuration file `%s'. Exiting ...\n" |
@@ -3811,120 +3834,120 @@ msgstr "Standarddienst »%s« ist nicht korrekt eingerichtet!\n" | |||
3811 | msgid "Could not resolve our FQDN: %s\n" | 3834 | msgid "Could not resolve our FQDN: %s\n" |
3812 | msgstr "`%s' konnte nicht aufgelöst werden: %s\n" | 3835 | msgstr "`%s' konnte nicht aufgelöst werden: %s\n" |
3813 | 3836 | ||
3814 | #: src/lib/util/service.c:654 | 3837 | #: src/lib/util/service.c:650 |
3815 | #, c-format | 3838 | #, c-format |
3816 | msgid "" | 3839 | msgid "" |
3817 | "Processing code for message of type %u did not call " | 3840 | "Processing code for message of type %u did not call " |
3818 | "`GNUNET_SERVICE_client_continue' after %s\n" | 3841 | "`GNUNET_SERVICE_client_continue' after %s\n" |
3819 | msgstr "" | 3842 | msgstr "" |
3820 | 3843 | ||
3821 | #: src/lib/util/service.c:838 | 3844 | #: src/lib/util/service.c:841 |
3822 | #, c-format | 3845 | #, c-format |
3823 | msgid "Unknown address family %d\n" | 3846 | msgid "Unknown address family %d\n" |
3824 | msgstr "" | 3847 | msgstr "" |
3825 | 3848 | ||
3826 | #: src/lib/util/service.c:951 | 3849 | #: src/lib/util/service.c:956 |
3827 | #, c-format | 3850 | #, c-format |
3828 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" | 3851 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" |
3829 | msgstr "" | 3852 | msgstr "" |
3830 | 3853 | ||
3831 | #: src/lib/util/service.c:992 | 3854 | #: src/lib/util/service.c:997 |
3832 | #, c-format | 3855 | #, c-format |
3833 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" | 3856 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" |
3834 | msgstr "" | 3857 | msgstr "" |
3835 | 3858 | ||
3836 | #: 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 |
3837 | #: src/service/arm/gnunet-service-arm.c:412 | 3860 | #: src/service/arm/gnunet-service-arm.c:412 |
3838 | #: src/service/arm/gnunet-service-arm.c:418 | 3861 | #: src/service/arm/gnunet-service-arm.c:418 |
3839 | #, c-format | 3862 | #, c-format |
3840 | msgid "Require valid port number for service `%s' in configuration!\n" | 3863 | msgid "Require valid port number for service `%s' in configuration!\n" |
3841 | msgstr "" | 3864 | msgstr "" |
3842 | 3865 | ||
3843 | #: 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 |
3844 | #, c-format | 3867 | #, c-format |
3845 | msgid "" | 3868 | msgid "" |
3846 | "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 " |
3847 | "domain socket: %s\n" | 3870 | "domain socket: %s\n" |
3848 | msgstr "" | 3871 | msgstr "" |
3849 | 3872 | ||
3850 | #: 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 |
3851 | #, c-format | 3874 | #, c-format |
3852 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | 3875 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" |
3853 | msgstr "" | 3876 | msgstr "" |
3854 | 3877 | ||
3855 | #: 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 |
3856 | #, c-format | 3879 | #, c-format |
3857 | msgid "Failed to resolve `%s': %s\n" | 3880 | msgid "Failed to resolve `%s': %s\n" |
3858 | msgstr "»%s« konnte nicht aufgelöst werden: %s\n" | 3881 | msgstr "»%s« konnte nicht aufgelöst werden: %s\n" |
3859 | 3882 | ||
3860 | #: 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 |
3861 | #, fuzzy, c-format | 3884 | #, fuzzy, c-format |
3862 | msgid "Failed to find %saddress for `%s'.\n" | 3885 | msgid "Failed to find %saddress for `%s'.\n" |
3863 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" | 3886 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" |
3864 | 3887 | ||
3865 | #: src/lib/util/service.c:1401 | 3888 | #: src/lib/util/service.c:1406 |
3866 | #, fuzzy, c-format | 3889 | #, fuzzy, c-format |
3867 | msgid "`%s' failed for port %d (%s).\n" | 3890 | msgid "`%s' failed for port %d (%s).\n" |
3868 | msgstr "`%s' fehlgeschlagen für Laufwerk %s: %u\n" | 3891 | msgstr "`%s' fehlgeschlagen für Laufwerk %s: %u\n" |
3869 | 3892 | ||
3870 | #: src/lib/util/service.c:1413 | 3893 | #: src/lib/util/service.c:1418 |
3871 | #, fuzzy, c-format | 3894 | #, fuzzy, c-format |
3872 | msgid "`%s' failed for port %d (%s): address already in use\n" | 3895 | msgid "`%s' failed for port %d (%s): address already in use\n" |
3873 | msgstr "`%s' schlug fehl für Port %d: %s. Läuft gnunetd bereits?\n" | 3896 | msgstr "`%s' schlug fehl für Port %d: %s. Läuft gnunetd bereits?\n" |
3874 | 3897 | ||
3875 | #: src/lib/util/service.c:1420 | 3898 | #: src/lib/util/service.c:1425 |
3876 | #, fuzzy, c-format | 3899 | #, fuzzy, c-format |
3877 | msgid "`%s' failed for `%s': address already in use\n" | 3900 | msgid "`%s' failed for `%s': address already in use\n" |
3878 | msgstr "%s schlug fehl, Nachrichten Typ %d ist bereits in Verwendung.\n" | 3901 | msgstr "%s schlug fehl, Nachrichten Typ %d ist bereits in Verwendung.\n" |
3879 | 3902 | ||
3880 | #: src/lib/util/service.c:1481 | 3903 | #: src/lib/util/service.c:1486 |
3881 | #, c-format | 3904 | #, c-format |
3882 | msgid "Specified value for `%s' of service `%s' is invalid\n" | 3905 | msgid "Specified value for `%s' of service `%s' is invalid\n" |
3883 | msgstr "" | 3906 | msgstr "" |
3884 | 3907 | ||
3885 | #: src/lib/util/service.c:1505 | 3908 | #: src/lib/util/service.c:1510 |
3886 | #, c-format | 3909 | #, c-format |
3887 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" | 3910 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" |
3888 | msgstr "" | 3911 | msgstr "" |
3889 | 3912 | ||
3890 | #: src/lib/util/service.c:1573 | 3913 | #: src/lib/util/service.c:1583 |
3891 | msgid "" | 3914 | msgid "" |
3892 | "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" |
3893 | msgstr "" | 3916 | msgstr "" |
3894 | 3917 | ||
3895 | #: src/lib/util/service.c:1644 | 3918 | #: src/lib/util/service.c:1653 |
3896 | msgid "No such user" | 3919 | msgid "No such user" |
3897 | msgstr "" | 3920 | msgstr "" |
3898 | 3921 | ||
3899 | #: src/lib/util/service.c:1658 | 3922 | #: src/lib/util/service.c:1668 |
3900 | #, c-format | 3923 | #, c-format |
3901 | msgid "Cannot change user/group to `%s': %s\n" | 3924 | msgid "Cannot change user/group to `%s': %s\n" |
3902 | msgstr "Benutzer/Gruppe kann nicht zu »%s« geändert werden: %s\n" | 3925 | msgstr "Benutzer/Gruppe kann nicht zu »%s« geändert werden: %s\n" |
3903 | 3926 | ||
3904 | #: src/lib/util/service.c:1751 | 3927 | #: src/lib/util/service.c:1767 |
3905 | msgid "Service process failed to initialize\n" | 3928 | msgid "Service process failed to initialize\n" |
3906 | msgstr "" | 3929 | msgstr "" |
3907 | 3930 | ||
3908 | #: src/lib/util/service.c:1756 | 3931 | #: src/lib/util/service.c:1772 |
3909 | msgid "Service process could not initialize server function\n" | 3932 | msgid "Service process could not initialize server function\n" |
3910 | msgstr "" | 3933 | msgstr "" |
3911 | 3934 | ||
3912 | #: src/lib/util/service.c:1761 | 3935 | #: src/lib/util/service.c:1777 |
3913 | msgid "Service process failed to report status\n" | 3936 | msgid "Service process failed to report status\n" |
3914 | msgstr "" | 3937 | msgstr "" |
3915 | 3938 | ||
3916 | #: 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 |
3917 | msgid "do daemonize (detach from terminal)" | 3940 | msgid "do daemonize (detach from terminal)" |
3918 | msgstr "" | 3941 | msgstr "" |
3919 | 3942 | ||
3920 | #: 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 |
3921 | #: 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 |
3922 | #: src/service/transport/transport-testing-communicator.c:1056 | 3945 | #: src/service/transport/transport-testing-communicator.c:1059 |
3923 | #, fuzzy, c-format | 3946 | #, fuzzy, c-format |
3924 | msgid "Malformed configuration file `%s', exit ...\n" | 3947 | msgid "Malformed configuration file `%s', exit ...\n" |
3925 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" | 3948 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" |
3926 | 3949 | ||
3927 | #: 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 |
3928 | #, fuzzy | 3951 | #, fuzzy |
3929 | msgid "Malformed configuration, exit ...\n" | 3952 | msgid "Malformed configuration, exit ...\n" |
3930 | msgstr "GNUnet Konfiguration" | 3953 | msgstr "GNUnet Konfiguration" |
@@ -4384,6 +4407,11 @@ msgstr "" | |||
4384 | msgid "Initiating shutdown as requested by client.\n" | 4407 | msgid "Initiating shutdown as requested by client.\n" |
4385 | msgstr "" | 4408 | msgstr "" |
4386 | 4409 | ||
4410 | #: src/service/arm/testing_arm_cmd_start_peer.c:197 | ||
4411 | #, c-format | ||
4412 | msgid "Failed to start `%s': %s\n" | ||
4413 | msgstr "»%s« konnte nicht gestartet werden: %s\n" | ||
4414 | |||
4387 | #: src/service/core/gnunet-service-core.c:329 | 4415 | #: src/service/core/gnunet-service-core.c:329 |
4388 | #, fuzzy | 4416 | #, fuzzy |
4389 | msgid "# send requests dropped (disconnected)" | 4417 | msgid "# send requests dropped (disconnected)" |
@@ -4565,8 +4593,8 @@ msgstr "# Bytes entschlüsselt" | |||
4565 | #: src/service/core/gnunet-service-core_sessions.c:337 | 4593 | #: src/service/core/gnunet-service-core_sessions.c:337 |
4566 | #: src/service/fs/gnunet-service-fs_cp.c:484 | 4594 | #: src/service/fs/gnunet-service-fs_cp.c:484 |
4567 | #: src/service/fs/gnunet-service-fs_cp.c:1377 | 4595 | #: src/service/fs/gnunet-service-fs_cp.c:1377 |
4568 | #: src/service/topology/gnunet-daemon-topology.c:551 | 4596 | #: src/service/topology/gnunet-daemon-topology.c:545 |
4569 | #: src/service/topology/gnunet-daemon-topology.c:633 | 4597 | #: src/service/topology/gnunet-daemon-topology.c:627 |
4570 | msgid "# peers connected" | 4598 | msgid "# peers connected" |
4571 | msgstr "# verbundener Knoten" | 4599 | msgstr "# verbundener Knoten" |
4572 | 4600 | ||
@@ -5611,7 +5639,7 @@ msgstr "GNUnet Konfiguration" | |||
5611 | 5639 | ||
5612 | #: src/service/fs/gnunet-service-fs.c:1271 | 5640 | #: src/service/fs/gnunet-service-fs.c:1271 |
5613 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 | 5641 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 |
5614 | #: src/service/topology/gnunet-daemon-topology.c:1066 | 5642 | #: src/service/topology/gnunet-daemon-topology.c:1062 |
5615 | #, fuzzy, c-format | 5643 | #, fuzzy, c-format |
5616 | msgid "Failed to connect to `%s' service.\n" | 5644 | msgid "Failed to connect to `%s' service.\n" |
5617 | msgstr "`%s' Dienst konnte nicht initialisiert werden.\n" | 5645 | msgstr "`%s' Dienst konnte nicht initialisiert werden.\n" |
@@ -6435,7 +6463,7 @@ msgid "# hostlist advertisements send" | |||
6435 | msgstr "# Bekanntmachungen von anderen übertragen" | 6463 | msgstr "# Bekanntmachungen von anderen übertragen" |
6436 | 6464 | ||
6437 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 | 6465 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 |
6438 | #: src/service/topology/gnunet-daemon-topology.c:786 | 6466 | #: src/service/topology/gnunet-daemon-topology.c:781 |
6439 | #, fuzzy, c-format | 6467 | #, fuzzy, c-format |
6440 | msgid "Error in communication with PEERSTORE service: %s\n" | 6468 | msgid "Error in communication with PEERSTORE service: %s\n" |
6441 | msgstr "Informationen über andere GNUnet Knoten ausgeben." | 6469 | msgstr "Informationen über andere GNUnet Knoten ausgeben." |
@@ -6700,12 +6728,12 @@ msgstr "" | |||
6700 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" | 6728 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
6701 | msgstr "" | 6729 | msgstr "" |
6702 | 6730 | ||
6703 | #: src/service/nat/gnunet-service-nat.c:1861 | 6731 | #: src/service/nat/gnunet-service-nat.c:1860 |
6704 | #, fuzzy | 6732 | #, fuzzy |
6705 | msgid "Connection reversal request failed\n" | 6733 | msgid "Connection reversal request failed\n" |
6706 | msgstr " Verbindung fehlgeschlagen\n" | 6734 | msgstr " Verbindung fehlgeschlagen\n" |
6707 | 6735 | ||
6708 | #: src/service/nat/gnunet-service-nat.c:1935 | 6736 | #: src/service/nat/gnunet-service-nat.c:1999 |
6709 | msgid "" | 6737 | msgid "" |
6710 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 6738 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
6711 | "disabling UPnP\n" | 6739 | "disabling UPnP\n" |
@@ -6731,42 +6759,42 @@ msgstr "Kommando `%s' wurde nicht gefunden!\n" | |||
6731 | msgid "`upnpc' command not found\n" | 6759 | msgid "`upnpc' command not found\n" |
6732 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | 6760 | msgstr "Kommando `%s' wurde nicht gefunden!\n" |
6733 | 6761 | ||
6734 | #: src/service/peerstore/gnunet-service-peerstore.c:1141 | 6762 | #: src/service/peerstore/gnunet-service-peerstore.c:1150 |
6735 | #, fuzzy, c-format | 6763 | #, fuzzy, c-format |
6736 | msgid "Failed to parse HELLO in file `%s': %s\n" | 6764 | msgid "Failed to parse HELLO in file `%s': %s\n" |
6737 | msgstr "Datei wurde als `%s' gespeichert.\n" | 6765 | msgstr "Datei wurde als `%s' gespeichert.\n" |
6738 | 6766 | ||
6739 | #: src/service/peerstore/gnunet-service-peerstore.c:1214 | 6767 | #: src/service/peerstore/gnunet-service-peerstore.c:1223 |
6740 | #, fuzzy, c-format | 6768 | #, fuzzy, c-format |
6741 | msgid "Could not load database backend `%s'\n" | 6769 | msgid "Could not load database backend `%s'\n" |
6742 | msgstr "`%s' konnte nicht aufgelöst werden: %s\n" | 6770 | msgstr "`%s' konnte nicht aufgelöst werden: %s\n" |
6743 | 6771 | ||
6744 | #: src/service/peerstore/gnunet-service-peerstore.c:1233 | 6772 | #: src/service/peerstore/gnunet-service-peerstore.c:1242 |
6745 | #, c-format | 6773 | #, c-format |
6746 | msgid "Importing HELLOs from `%s'\n" | 6774 | msgid "Importing HELLOs from `%s'\n" |
6747 | msgstr "" | 6775 | msgstr "" |
6748 | 6776 | ||
6749 | #: src/service/peerstore/gnunet-service-peerstore.c:1244 | 6777 | #: src/service/peerstore/gnunet-service-peerstore.c:1253 |
6750 | msgid "Skipping import of included HELLOs\n" | 6778 | msgid "Skipping import of included HELLOs\n" |
6751 | msgstr "" | 6779 | msgstr "" |
6752 | 6780 | ||
6753 | #: src/service/peerstore/peerstore_api.c:574 | 6781 | #: src/service/peerstore/peerstore_api.c:579 |
6754 | #, fuzzy | 6782 | #, fuzzy |
6755 | msgid "Unexpected store response.\n" | 6783 | msgid "Unexpected store response.\n" |
6756 | msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" | 6784 | msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" |
6757 | 6785 | ||
6758 | #: src/service/peerstore/peerstore_api.c:606 | 6786 | #: src/service/peerstore/peerstore_api.c:620 |
6759 | msgid "Unexpected iteration response.\n" | 6787 | msgid "Unexpected iteration response.\n" |
6760 | msgstr "" | 6788 | msgstr "" |
6761 | 6789 | ||
6762 | #: src/service/peerstore/peerstore_api.c:652 | 6790 | #: src/service/peerstore/peerstore_api.c:666 |
6763 | msgid "" | 6791 | msgid "" |
6764 | "Unexpected iteration response, no iterating client found, discarding " | 6792 | "Unexpected iteration response, no iterating client found, discarding " |
6765 | "message.\n" | 6793 | "message.\n" |
6766 | msgstr "" | 6794 | msgstr "" |
6767 | 6795 | ||
6768 | #: src/service/peerstore/peerstore_api.c:662 | 6796 | #: src/service/peerstore/peerstore_api.c:676 |
6769 | #: src/service/peerstore/peerstore_api_monitor.c:164 | 6797 | #: src/service/peerstore/peerstore_api_monitor.c:163 |
6770 | #, fuzzy | 6798 | #, fuzzy |
6771 | msgid "Received a malformed response from service." | 6799 | msgid "Received a malformed response from service." |
6772 | msgstr "Beschädigte Antwort auf `%s' von Knoten `%s' empfangen.\n" | 6800 | msgstr "Beschädigte Antwort auf `%s' von Knoten `%s' empfangen.\n" |
@@ -6938,12 +6966,12 @@ msgstr "" | |||
6938 | msgid "Namestore REST API initialized\n" | 6966 | msgid "Namestore REST API initialized\n" |
6939 | msgstr " Verbindung fehlgeschlagen\n" | 6967 | msgstr " Verbindung fehlgeschlagen\n" |
6940 | 6968 | ||
6941 | #: src/service/rest/openid_plugin.c:3102 | 6969 | #: src/service/rest/openid_plugin.c:3121 |
6942 | #, fuzzy | 6970 | #, fuzzy |
6943 | msgid "OpenID Connect REST API initialized\n" | 6971 | msgid "OpenID Connect REST API initialized\n" |
6944 | msgstr " Verbindung fehlgeschlagen\n" | 6972 | msgstr " Verbindung fehlgeschlagen\n" |
6945 | 6973 | ||
6946 | #: 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 |
6947 | #, fuzzy | 6975 | #, fuzzy |
6948 | msgid "Identity Provider REST API initialized\n" | 6976 | msgid "Identity Provider REST API initialized\n" |
6949 | msgstr " Verbindung fehlgeschlagen\n" | 6977 | msgstr " Verbindung fehlgeschlagen\n" |
@@ -6995,153 +7023,55 @@ msgstr "Dateien aus dem GNUnet herunterladen." | |||
6995 | msgid "Could not save some persistent statistics\n" | 7023 | msgid "Could not save some persistent statistics\n" |
6996 | msgstr "" | 7024 | msgstr "" |
6997 | 7025 | ||
6998 | #: src/service/testing/gnunet-testing.c:185 | 7026 | #: src/service/testbed/gnunet-testbed.c:196 |
6999 | #, c-format | ||
7000 | msgid "Could not extract hostkey %u (offset too large?)\n" | ||
7001 | msgstr "" | ||
7002 | |||
7003 | #: src/service/testing/gnunet-testing.c:275 | ||
7004 | #, c-format | ||
7005 | msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n" | ||
7006 | msgstr "" | ||
7007 | |||
7008 | #: src/service/testing/gnunet-testing.c:386 | ||
7009 | #, fuzzy | 7027 | #, fuzzy |
7010 | msgid "create unique configuration files" | 7028 | msgid "number of unique configuration files to create" |
7011 | msgstr "" | 7029 | msgstr "" |
7012 | "Einen Wert aus der Konfigurationsdatei auf der Standardausgabe ausgeben" | 7030 | "Einen Wert aus der Konfigurationsdatei auf der Standardausgabe ausgeben" |
7013 | 7031 | ||
7014 | #: src/service/testing/gnunet-testing.c:392 | 7032 | #: src/service/testbed/gnunet-testbed.c:202 |
7015 | msgid "extract hostkey file from pre-computed hostkey list" | ||
7016 | msgstr "" | ||
7017 | |||
7018 | #: src/service/testing/gnunet-testing.c:400 | ||
7019 | msgid "" | ||
7020 | "number of unique configuration files to create, or number of the hostkey to " | ||
7021 | "extract" | ||
7022 | msgstr "" | ||
7023 | |||
7024 | #: src/service/testing/gnunet-testing.c:407 | ||
7025 | msgid "configuration template" | 7033 | msgid "configuration template" |
7026 | msgstr "Konfigurationsvorlage" | 7034 | msgstr "Konfigurationsvorlage" |
7027 | 7035 | ||
7028 | #: src/service/testing/gnunet-testing.c:415 | 7036 | #: src/service/testbed/gnunet-testbed.c:218 |
7029 | msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)" | ||
7030 | msgstr "" | ||
7031 | |||
7032 | #: src/service/testing/gnunet-testing.c:432 | ||
7033 | msgid "Command line tool to access the testing library" | 7037 | msgid "Command line tool to access the testing library" |
7034 | msgstr "" | 7038 | msgstr "" |
7035 | 7039 | ||
7036 | #: src/service/testing/list-keys.c:92 | ||
7037 | msgid "list COUNT number of keys" | ||
7038 | msgstr "" | ||
7039 | |||
7040 | #: src/service/testing/testing.c:291 | ||
7041 | #, c-format | ||
7042 | msgid "Hostkeys file not found: %s\n" | ||
7043 | msgstr "" | ||
7044 | |||
7045 | #: src/service/testing/testing.c:743 | ||
7046 | #, c-format | ||
7047 | msgid "Key number %u does not exist\n" | ||
7048 | msgstr "" | ||
7049 | |||
7050 | #: src/service/testing/testing.c:1217 | ||
7051 | #, c-format | ||
7052 | msgid "" | ||
7053 | "You attempted to create a testbed with more than %u hosts. Please " | ||
7054 | "precompute more hostkeys first.\n" | ||
7055 | msgstr "" | ||
7056 | |||
7057 | #: src/service/testing/testing.c:1226 | ||
7058 | #, fuzzy, c-format | ||
7059 | msgid "Failed to initialize hostkey for peer %u\n" | ||
7060 | msgstr "SQLite Datenbank konnte nicht initialisiert werden.\n" | ||
7061 | |||
7062 | #: src/service/testing/testing.c:1236 | ||
7063 | msgid "PRIVATE_KEY option in PEER section missing in configuration\n" | ||
7064 | msgstr "" | ||
7065 | |||
7066 | #: src/service/testing/testing.c:1249 | ||
7067 | msgid "Failed to create configuration for peer (not enough free ports?)\n" | ||
7068 | msgstr "" | ||
7069 | |||
7070 | #: src/service/testing/testing.c:1265 | ||
7071 | #, fuzzy, c-format | ||
7072 | msgid "Cannot open hostkey file `%s': %s\n" | ||
7073 | msgstr "Konfigurationsdatei `%s' konnte nicht geöffnet werden.\n" | ||
7074 | |||
7075 | #: src/service/testing/testing.c:1279 | ||
7076 | #, fuzzy, c-format | ||
7077 | msgid "Failed to write hostkey file for peer %u: %s\n" | ||
7078 | msgstr "Datei wurde als `%s' gespeichert.\n" | ||
7079 | |||
7080 | #: src/service/testing/testing.c:1307 | ||
7081 | #, fuzzy, c-format | ||
7082 | msgid "Failed to write configuration file `%s' for peer %u: %s\n" | ||
7083 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" | ||
7084 | |||
7085 | #: src/service/testing/testing.c:1413 | ||
7086 | #, c-format | ||
7087 | msgid "Failed to start `%s': %s\n" | ||
7088 | msgstr "»%s« konnte nicht gestartet werden: %s\n" | ||
7089 | |||
7090 | #: src/service/testing/testing.c:1664 | ||
7091 | #, c-format | ||
7092 | msgid "Failed to load configuration from %s\n" | ||
7093 | msgstr "Konfiguration konnte nicht aus %s geladen werden\n" | ||
7094 | |||
7095 | #: src/service/testing/testing.c:2795 | ||
7096 | #, c-format | ||
7097 | msgid "Topology file %s not found\n" | ||
7098 | msgstr "" | ||
7099 | |||
7100 | #: src/service/testing/testing.c:2803 | ||
7101 | #, c-format | ||
7102 | msgid "Topology file %s has no data\n" | ||
7103 | msgstr "" | ||
7104 | |||
7105 | #: src/service/testing/testing.c:2811 | ||
7106 | #, c-format | ||
7107 | msgid "Topology file %s cannot be read\n" | ||
7108 | msgstr "" | ||
7109 | |||
7110 | #: src/service/topology/gnunet-daemon-topology.c:286 | 7040 | #: src/service/topology/gnunet-daemon-topology.c:286 |
7111 | #, fuzzy | 7041 | #, fuzzy |
7112 | msgid "# connect requests issued to ATS" | 7042 | msgid "# connect requests issued to ATS" |
7113 | msgstr "# geschlossener Verbindungen (HANGUP gesendet)" | 7043 | msgstr "# geschlossener Verbindungen (HANGUP gesendet)" |
7114 | 7044 | ||
7115 | #: src/service/topology/gnunet-daemon-topology.c:480 | 7045 | #: src/service/topology/gnunet-daemon-topology.c:475 |
7116 | #, fuzzy | 7046 | #, fuzzy |
7117 | msgid "# HELLO messages gossipped" | 7047 | msgid "# HELLO messages gossipped" |
7118 | msgstr "# ausgehender Nachrichten verworfen" | 7048 | msgstr "# ausgehender Nachrichten verworfen" |
7119 | 7049 | ||
7120 | #: src/service/topology/gnunet-daemon-topology.c:752 | 7050 | #: src/service/topology/gnunet-daemon-topology.c:747 |
7121 | #, fuzzy | 7051 | #, fuzzy |
7122 | msgid "Error in communication with PEERSTORE service to monitor.\n" | 7052 | msgid "Error in communication with PEERSTORE service to monitor.\n" |
7123 | msgstr "Informationen über andere GNUnet Knoten ausgeben." | 7053 | msgstr "Informationen über andere GNUnet Knoten ausgeben." |
7124 | 7054 | ||
7125 | #: src/service/topology/gnunet-daemon-topology.c:761 | 7055 | #: src/service/topology/gnunet-daemon-topology.c:756 |
7126 | msgid "Finished initial PEERSTORE iteration in monitor.\n" | 7056 | msgid "Finished initial PEERSTORE iteration in monitor.\n" |
7127 | msgstr "" | 7057 | msgstr "" |
7128 | 7058 | ||
7129 | #: src/service/topology/gnunet-daemon-topology.c:869 | 7059 | #: src/service/topology/gnunet-daemon-topology.c:864 |
7130 | msgid "Failed to connect to core service, can not manage topology!\n" | 7060 | msgid "Failed to connect to core service, can not manage topology!\n" |
7131 | msgstr "" | 7061 | msgstr "" |
7132 | 7062 | ||
7133 | #: src/service/topology/gnunet-daemon-topology.c:943 | 7063 | #: src/service/topology/gnunet-daemon-topology.c:938 |
7134 | msgid "# HELLO messages received" | 7064 | msgid "# HELLO messages received" |
7135 | msgstr "# HELLO-Meldungen empfangen" | 7065 | msgstr "# HELLO-Meldungen empfangen" |
7136 | 7066 | ||
7137 | #: src/service/topology/gnunet-daemon-topology.c:1095 | 7067 | #: src/service/topology/gnunet-daemon-topology.c:1091 |
7138 | msgid "GNUnet topology control" | 7068 | msgid "GNUnet topology control" |
7139 | msgstr "" | 7069 | msgstr "" |
7140 | 7070 | ||
7141 | #: src/service/transport/gnunet-communicator-quic.c:1717 | 7071 | #: src/service/transport/gnunet-communicator-quic.c:1717 |
7142 | #: src/service/transport/gnunet-communicator-tcp.c:3814 | 7072 | #: src/service/transport/gnunet-communicator-tcp.c:3814 |
7143 | #: src/service/transport/gnunet-communicator-udp.c:3562 | 7073 | #: src/service/transport/gnunet-communicator-udp.c:3579 |
7144 | #: src/service/transport/gnunet-service-transport.c:12124 | 7074 | #: src/service/transport/gnunet-service-transport.c:12543 |
7145 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7075 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7146 | msgstr "" | 7076 | msgstr "" |
7147 | 7077 | ||
@@ -7153,7 +7083,7 @@ msgstr "" | |||
7153 | msgid "GNUnet TCP communicator" | 7083 | msgid "GNUnet TCP communicator" |
7154 | msgstr "" | 7084 | msgstr "" |
7155 | 7085 | ||
7156 | #: src/service/transport/gnunet-communicator-udp.c:3637 | 7086 | #: src/service/transport/gnunet-communicator-udp.c:3654 |
7157 | msgid "GNUnet UDP communicator" | 7087 | msgid "GNUnet UDP communicator" |
7158 | msgstr "" | 7088 | msgstr "" |
7159 | 7089 | ||
@@ -7458,6 +7388,26 @@ msgid "Failed to connect to the namestore!\n" | |||
7458 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 7388 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
7459 | 7389 | ||
7460 | #, 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 | ||
7461 | #~ msgid "" | 7411 | #~ msgid "" |
7462 | #~ "Local peer: %s\n" | 7412 | #~ "Local peer: %s\n" |
7463 | #~ "\n" | 7413 | #~ "\n" |
@@ -8309,10 +8259,6 @@ msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | |||
8309 | #~ msgstr "GNUnet Konfiguration" | 8259 | #~ msgstr "GNUnet Konfiguration" |
8310 | 8260 | ||
8311 | #, fuzzy | 8261 | #, fuzzy |
8312 | #~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | ||
8313 | #~ msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" | ||
8314 | |||
8315 | #, fuzzy | ||
8316 | #~ msgid "Unreadable or malformed configuration, exit ...\n" | 8262 | #~ msgid "Unreadable or malformed configuration, exit ...\n" |
8317 | #~ msgstr "GNUnet Konfiguration" | 8263 | #~ msgstr "GNUnet Konfiguration" |
8318 | 8264 | ||
@@ -8,7 +8,7 @@ msgid "" | |||
8 | msgstr "" | 8 | msgstr "" |
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-15 09:19+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,28 +360,28 @@ msgstr "Se produjo un fallo al procesar la identidad del par «%s»\n" | |||
360 | msgid "Failed to connect to CORE service!\n" | 360 | msgid "Failed to connect to CORE service!\n" |
361 | msgstr "¡Se produjo un fallo al conectar con el servicio DHT!\n" | 361 | msgstr "¡Se produjo un fallo al conectar con el servicio DHT!\n" |
362 | 362 | ||
363 | #: src/cli/core/gnunet-core.c:212 | 363 | #: src/cli/core/gnunet-core.c:213 |
364 | #, fuzzy | 364 | #, fuzzy |
365 | msgid "No argument given.\n" | 365 | msgid "No argument given.\n" |
366 | msgstr "No se han proporcionado opciones\n" | 366 | msgstr "No se han proporcionado opciones\n" |
367 | 367 | ||
368 | # Miguel: ¿Quizá continuamente fuese mejor? | 368 | # Miguel: ¿Quizá continuamente fuese mejor? |
369 | #: src/cli/core/gnunet-core.c:235 src/service/transport/gnunet-transport.c:1389 | 369 | #: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389 |
370 | msgid "provide information about all current connections (continuously)" | 370 | msgid "provide information about all current connections (continuously)" |
371 | msgstr "" | 371 | msgstr "" |
372 | "provee información sobre todas las conexiones actuales (de forma continua)" | 372 | "provee información sobre todas las conexiones actuales (de forma continua)" |
373 | 373 | ||
374 | #: src/cli/core/gnunet-core.c:241 | 374 | #: src/cli/core/gnunet-core.c:244 |
375 | #, fuzzy | 375 | #, fuzzy |
376 | msgid "Show our current peer identity" | 376 | msgid "Show our current peer identity" |
377 | msgstr "identidad del par" | 377 | msgstr "identidad del par" |
378 | 378 | ||
379 | #: src/cli/core/gnunet-core.c:248 | 379 | #: src/cli/core/gnunet-core.c:251 |
380 | #, fuzzy | 380 | #, fuzzy |
381 | msgid "Show current connections" | 381 | msgid "Show current connections" |
382 | msgstr "# conexiones activas" | 382 | msgstr "# conexiones activas" |
383 | 383 | ||
384 | #: src/cli/core/gnunet-core.c:259 | 384 | #: src/cli/core/gnunet-core.c:262 |
385 | msgid "Print information about connected peers." | 385 | msgid "Print information about connected peers." |
386 | msgstr "Imprime información sobre los pares conectados." | 386 | msgstr "Imprime información sobre los pares conectados." |
387 | 387 | ||
@@ -1117,55 +1117,55 @@ msgstr "No se pudo empezar la operación de desindexado.\n" | |||
1117 | msgid "Unindex a file that was previously indexed with gnunet-publish." | 1117 | msgid "Unindex a file that was previously indexed with gnunet-publish." |
1118 | msgstr "Desindexa un fichero previamente indexado con «gnunet-publish»." | 1118 | msgstr "Desindexa un fichero previamente indexado con «gnunet-publish»." |
1119 | 1119 | ||
1120 | #: src/cli/gns/gnunet-gns.c:268 | 1120 | #: src/cli/gns/gnunet-gns.c:269 |
1121 | #, fuzzy, c-format | 1121 | #, fuzzy, c-format |
1122 | msgid "`%s' is not a valid DNS domain name\n" | 1122 | msgid "`%s' is not a valid DNS domain name\n" |
1123 | msgstr "«%s» no es una dirección IP válida.\n" | 1123 | msgstr "«%s» no es una dirección IP válida.\n" |
1124 | 1124 | ||
1125 | #: 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 |
1126 | #, c-format | 1126 | #, c-format |
1127 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" | 1127 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" |
1128 | msgstr "" | 1128 | msgstr "" |
1129 | "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: " |
1130 | "%s\n" | 1130 | "%s\n" |
1131 | 1131 | ||
1132 | #: src/cli/gns/gnunet-gns.c:294 | 1132 | #: src/cli/gns/gnunet-gns.c:295 |
1133 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" | 1133 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" |
1134 | msgstr "" | 1134 | msgstr "" |
1135 | 1135 | ||
1136 | #: src/cli/gns/gnunet-gns.c:305 | 1136 | #: src/cli/gns/gnunet-gns.c:306 |
1137 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 | 1137 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 |
1138 | #, c-format | 1138 | #, c-format |
1139 | msgid "Failed to connect to GNS\n" | 1139 | msgid "Failed to connect to GNS\n" |
1140 | msgstr "Se produjo un fallo al conectar con GNS\n" | 1140 | msgstr "Se produjo un fallo al conectar con GNS\n" |
1141 | 1141 | ||
1142 | #: src/cli/gns/gnunet-gns.c:318 | 1142 | #: src/cli/gns/gnunet-gns.c:325 |
1143 | #, c-format | 1143 | #, c-format |
1144 | msgid "Invalid typename specified, assuming `ANY'\n" | 1144 | msgid "Invalid typename specified, assuming `ANY'\n" |
1145 | msgstr "" | 1145 | msgstr "" |
1146 | 1146 | ||
1147 | #: src/cli/gns/gnunet-gns.c:358 | 1147 | #: src/cli/gns/gnunet-gns.c:365 |
1148 | msgid "Lookup a record for the given name" | 1148 | msgid "Lookup a record for the given name" |
1149 | msgstr "Buscar el registro para el nombre dado" | 1149 | msgstr "Buscar el registro para el nombre dado" |
1150 | 1150 | ||
1151 | #: src/cli/gns/gnunet-gns.c:364 | 1151 | #: src/cli/gns/gnunet-gns.c:371 |
1152 | msgid "Specify the type of the record to lookup" | 1152 | msgid "Specify the type of the record to lookup" |
1153 | msgstr "Especificar el tipo del registro a buscar" | 1153 | msgstr "Especificar el tipo del registro a buscar" |
1154 | 1154 | ||
1155 | #: src/cli/gns/gnunet-gns.c:370 | 1155 | #: src/cli/gns/gnunet-gns.c:377 |
1156 | #, fuzzy | 1156 | #, fuzzy |
1157 | msgid "Specify a timeout for the lookup" | 1157 | msgid "Specify a timeout for the lookup" |
1158 | msgstr "Especificar el tipo del registro a buscar" | 1158 | msgstr "Especificar el tipo del registro a buscar" |
1159 | 1159 | ||
1160 | #: src/cli/gns/gnunet-gns.c:374 | 1160 | #: src/cli/gns/gnunet-gns.c:381 |
1161 | msgid "No unneeded output" | 1161 | msgid "No unneeded output" |
1162 | msgstr "Sin salida innecesaria" | 1162 | msgstr "Sin salida innecesaria" |
1163 | 1163 | ||
1164 | #: src/cli/gns/gnunet-gns.c:379 | 1164 | #: src/cli/gns/gnunet-gns.c:386 |
1165 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" | 1165 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" |
1166 | msgstr "" | 1166 | msgstr "" |
1167 | 1167 | ||
1168 | #: src/cli/gns/gnunet-gns.c:393 | 1168 | #: src/cli/gns/gnunet-gns.c:400 |
1169 | #, fuzzy | 1169 | #, fuzzy |
1170 | msgid "GNUnet GNS resolver tool" | 1170 | msgid "GNUnet GNS resolver tool" |
1171 | msgstr "Herramienta de acceso GNUnet GNS" | 1171 | msgstr "Herramienta de acceso GNUnet GNS" |
@@ -1702,7 +1702,11 @@ msgstr "# pares desconectados debido a petición externa" | |||
1702 | msgid "GNUnet NAT traversal autoconfigure daemon" | 1702 | msgid "GNUnet NAT traversal autoconfigure daemon" |
1703 | msgstr "Demonio de ayuda en las pruebas de recorrido NAT de GNUnet" | 1703 | msgstr "Demonio de ayuda en las pruebas de recorrido NAT de GNUnet" |
1704 | 1704 | ||
1705 | #: src/cli/nse/gnunet-nse.c:124 | 1705 | #: src/cli/nse/gnunet-nse.c:126 |
1706 | msgid "Monitor and output current estimates" | ||
1707 | msgstr "" | ||
1708 | |||
1709 | #: src/cli/nse/gnunet-nse.c:137 | ||
1706 | #, fuzzy | 1710 | #, fuzzy |
1707 | msgid "Show network size estimates from NSE service." | 1711 | msgid "Show network size estimates from NSE service." |
1708 | msgstr "# Estimaciones del tamaño de red recibidas" | 1712 | msgstr "# Estimaciones del tamaño de red recibidas" |
@@ -1751,87 +1755,91 @@ msgstr "" | |||
1751 | msgid "The time until the DID Document is going to expire (e.g. 5d)" | 1755 | msgid "The time until the DID Document is going to expire (e.g. 5d)" |
1752 | msgstr "" | 1756 | msgstr "" |
1753 | 1757 | ||
1754 | #: src/cli/reclaim/gnunet-reclaim.c:805 | 1758 | #: src/cli/reclaim/gnunet-reclaim.c:813 |
1755 | #, fuzzy, c-format | 1759 | #, fuzzy, c-format |
1756 | msgid "Ego is required\n" | 1760 | msgid "Ego is required\n" |
1757 | msgstr "Las opción «%s» o «%s» es necesaria.\n" | 1761 | msgstr "Las opción «%s» o «%s» es necesaria.\n" |
1758 | 1762 | ||
1759 | #: src/cli/reclaim/gnunet-reclaim.c:812 | 1763 | #: src/cli/reclaim/gnunet-reclaim.c:820 |
1760 | #, c-format | 1764 | #, c-format |
1761 | msgid "Attribute value missing!\n" | 1765 | msgid "Attribute value missing!\n" |
1762 | msgstr "" | 1766 | msgstr "" |
1763 | 1767 | ||
1764 | #: src/cli/reclaim/gnunet-reclaim.c:819 | 1768 | #: src/cli/reclaim/gnunet-reclaim.c:827 |
1765 | #, fuzzy, c-format | 1769 | #, fuzzy, c-format |
1766 | msgid "Requesting party key is required!\n" | 1770 | msgid "Requesting party key is required!\n" |
1767 | msgstr "el parámetro --section es necesario\n" | 1771 | msgstr "el parámetro --section es necesario\n" |
1768 | 1772 | ||
1769 | #: src/cli/reclaim/gnunet-reclaim.c:837 | 1773 | #: src/cli/reclaim/gnunet-reclaim.c:846 |
1770 | msgid "Add or update an attribute NAME" | 1774 | msgid "Add or update an attribute NAME" |
1771 | msgstr "" | 1775 | msgstr "" |
1772 | 1776 | ||
1773 | #: src/cli/reclaim/gnunet-reclaim.c:842 | 1777 | #: src/cli/reclaim/gnunet-reclaim.c:851 |
1774 | msgid "Delete the attribute with ID" | 1778 | msgid "Delete the attribute with ID" |
1775 | msgstr "" | 1779 | msgstr "" |
1776 | 1780 | ||
1777 | #: src/cli/reclaim/gnunet-reclaim.c:847 | 1781 | #: src/cli/reclaim/gnunet-reclaim.c:856 |
1778 | msgid "The attribute VALUE" | 1782 | msgid "The attribute VALUE" |
1779 | msgstr "" | 1783 | msgstr "" |
1780 | 1784 | ||
1781 | #: src/cli/reclaim/gnunet-reclaim.c:852 | 1785 | #: src/cli/reclaim/gnunet-reclaim.c:861 |
1782 | #, fuzzy | 1786 | #, fuzzy |
1783 | msgid "The EGO to use" | 1787 | msgid "The EGO to use" |
1784 | msgstr "tamaño del mensaje" | 1788 | msgstr "tamaño del mensaje" |
1785 | 1789 | ||
1786 | #: src/cli/reclaim/gnunet-reclaim.c:858 | 1790 | #: src/cli/reclaim/gnunet-reclaim.c:867 |
1787 | msgid "Specify the relying party for issue" | 1791 | msgid "Specify the relying party for issue" |
1788 | msgstr "" | 1792 | msgstr "" |
1789 | 1793 | ||
1790 | #: src/cli/reclaim/gnunet-reclaim.c:862 | 1794 | #: src/cli/reclaim/gnunet-reclaim.c:873 |
1795 | msgid "Specify the relying party URI for a ticket to consume" | ||
1796 | msgstr "" | ||
1797 | |||
1798 | #: src/cli/reclaim/gnunet-reclaim.c:877 | ||
1791 | msgid "List attributes for EGO" | 1799 | msgid "List attributes for EGO" |
1792 | msgstr "" | 1800 | msgstr "" |
1793 | 1801 | ||
1794 | #: src/cli/reclaim/gnunet-reclaim.c:866 | 1802 | #: src/cli/reclaim/gnunet-reclaim.c:881 |
1795 | msgid "List credentials for EGO" | 1803 | msgid "List credentials for EGO" |
1796 | msgstr "" | 1804 | msgstr "" |
1797 | 1805 | ||
1798 | #: src/cli/reclaim/gnunet-reclaim.c:872 | 1806 | #: src/cli/reclaim/gnunet-reclaim.c:887 |
1799 | msgid "Credential to use for attribute" | 1807 | msgid "Credential to use for attribute" |
1800 | msgstr "" | 1808 | msgstr "" |
1801 | 1809 | ||
1802 | #: src/cli/reclaim/gnunet-reclaim.c:877 | 1810 | #: src/cli/reclaim/gnunet-reclaim.c:892 |
1803 | msgid "Credential name" | 1811 | msgid "Credential name" |
1804 | msgstr "" | 1812 | msgstr "" |
1805 | 1813 | ||
1806 | #: src/cli/reclaim/gnunet-reclaim.c:883 | 1814 | #: src/cli/reclaim/gnunet-reclaim.c:898 |
1807 | msgid "Issue a ticket for a set of attributes separated by comma" | 1815 | msgid "Issue a ticket for a set of attributes separated by comma" |
1808 | msgstr "" | 1816 | msgstr "" |
1809 | 1817 | ||
1810 | #: src/cli/reclaim/gnunet-reclaim.c:888 | 1818 | #: src/cli/reclaim/gnunet-reclaim.c:903 |
1811 | msgid "Consume a ticket" | 1819 | msgid "Consume a ticket" |
1812 | msgstr "" | 1820 | msgstr "" |
1813 | 1821 | ||
1814 | #: src/cli/reclaim/gnunet-reclaim.c:893 | 1822 | #: src/cli/reclaim/gnunet-reclaim.c:908 |
1815 | msgid "Revoke a ticket" | 1823 | msgid "Revoke a ticket" |
1816 | msgstr "" | 1824 | msgstr "" |
1817 | 1825 | ||
1818 | #: src/cli/reclaim/gnunet-reclaim.c:898 | 1826 | #: src/cli/reclaim/gnunet-reclaim.c:913 |
1819 | msgid "Type of attribute" | 1827 | msgid "Type of attribute" |
1820 | msgstr "" | 1828 | msgstr "" |
1821 | 1829 | ||
1822 | #: src/cli/reclaim/gnunet-reclaim.c:903 | 1830 | #: src/cli/reclaim/gnunet-reclaim.c:918 |
1823 | msgid "Type of credential" | 1831 | msgid "Type of credential" |
1824 | msgstr "" | 1832 | msgstr "" |
1825 | 1833 | ||
1826 | #: src/cli/reclaim/gnunet-reclaim.c:907 | 1834 | #: src/cli/reclaim/gnunet-reclaim.c:922 |
1827 | msgid "List tickets of ego" | 1835 | msgid "List tickets of ego" |
1828 | msgstr "" | 1836 | msgstr "" |
1829 | 1837 | ||
1830 | #: src/cli/reclaim/gnunet-reclaim.c:913 | 1838 | #: src/cli/reclaim/gnunet-reclaim.c:928 |
1831 | msgid "Expiration interval of the attribute" | 1839 | msgid "Expiration interval of the attribute" |
1832 | msgstr "" | 1840 | msgstr "" |
1833 | 1841 | ||
1834 | #: src/cli/reclaim/gnunet-reclaim.c:921 | 1842 | #: src/cli/reclaim/gnunet-reclaim.c:936 |
1835 | msgid "re:claimID command line tool" | 1843 | msgid "re:claimID command line tool" |
1836 | msgstr "" | 1844 | msgstr "" |
1837 | 1845 | ||
@@ -2071,33 +2079,59 @@ msgstr "Imprime estadÃsticas acerca de las operaciones de GNUnet." | |||
2071 | msgid "run decoder modus, otherwise runs as encoder" | 2079 | msgid "run decoder modus, otherwise runs as encoder" |
2072 | msgstr "" | 2080 | msgstr "" |
2073 | 2081 | ||
2074 | #: src/cli/util/gnunet-config.c:154 | 2082 | #: src/cli/util/gnunet-config.c:101 |
2075 | msgid "test if the current installation supports the specified BACKEND" | 2083 | msgid "test if the current installation supports the specified BACKEND" |
2076 | msgstr "" | 2084 | msgstr "" |
2077 | 2085 | ||
2078 | #: src/cli/util/gnunet-config.c:160 | 2086 | #: src/cli/util/gnunet-config.c:107 |
2079 | msgid "" | 2087 | msgid "" |
2080 | "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 " |
2081 | "GNUnet" | 2089 | "GNUnet" |
2082 | msgstr "" | 2090 | msgstr "" |
2083 | 2091 | ||
2084 | #: src/cli/util/gnunet-config.c:165 | 2092 | #: src/cli/util/gnunet-config.c:112 |
2085 | msgid "Is this an experimental build of GNUnet" | 2093 | msgid "Is this an experimental build of GNUnet" |
2086 | msgstr "" | 2094 | msgstr "" |
2087 | 2095 | ||
2088 | #: src/cli/util/gnunet-config.c:171 | 2096 | #: src/cli/util/gnunet-config.c:118 |
2089 | msgid "" | 2097 | msgid "" |
2090 | "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 " |
2091 | "GNUnet" | 2099 | "GNUnet" |
2092 | msgstr "" | 2100 | msgstr "" |
2093 | 2101 | ||
2094 | #: src/cli/util/gnunet-config.c:177 | 2102 | #: src/cli/util/gnunet-config.c:123 |
2103 | #, fuzzy | ||
2104 | msgid "Do not parse default configuration files" | ||
2105 | msgstr "Manipular ficheros de configuración de GNUnet" | ||
2106 | |||
2107 | #: src/cli/util/gnunet-config.c:129 | ||
2095 | msgid "Provide the path under which GNUnet was installed" | 2108 | msgid "Provide the path under which GNUnet was installed" |
2096 | msgstr "" | 2109 | msgstr "" |
2097 | 2110 | ||
2098 | #: src/cli/util/gnunet-config.c:192 | 2111 | #: src/cli/util/gnunet-config.c:136 |
2099 | msgid "Manipulate GNUnet configuration files" | 2112 | msgid "" |
2100 | msgstr "Manipular ficheros de configuración de GNUnet" | 2113 | "Parse main configuration from this command-line argument and not from disk" |
2114 | msgstr "" | ||
2115 | |||
2116 | #: src/cli/util/gnunet-config.c:225 | ||
2117 | #, fuzzy | ||
2118 | msgid "Failed to load default configuration, exiting ...\n" | ||
2119 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | ||
2120 | |||
2121 | #: src/cli/util/gnunet-config.c:237 | ||
2122 | #, fuzzy | ||
2123 | msgid "Failed to parse configuration, exiting ...\n" | ||
2124 | msgstr "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 | ||
2128 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
2129 | msgstr "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 | ||
2133 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
2134 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | ||
2101 | 2135 | ||
2102 | #: src/cli/util/gnunet-crypto-tvg.c:1588 | 2136 | #: src/cli/util/gnunet-crypto-tvg.c:1588 |
2103 | msgid "verify a test vector from stdin" | 2137 | msgid "verify a test vector from stdin" |
@@ -2146,57 +2180,56 @@ msgstr "" | |||
2146 | msgid "Hostkeys file `%s' not found\n" | 2180 | msgid "Hostkeys file `%s' not found\n" |
2147 | msgstr "El fichero de máquinas %s no fue encontrado\n" | 2181 | msgstr "El fichero de máquinas %s no fue encontrado\n" |
2148 | 2182 | ||
2149 | #: src/cli/util/gnunet-ecc.c:314 | 2183 | #: src/cli/util/gnunet-ecc.c:318 |
2150 | #, fuzzy, c-format | 2184 | #, fuzzy, c-format |
2151 | msgid "Hostkeys file `%s' is empty\n" | 2185 | msgid "Hostkeys file `%s' is empty\n" |
2152 | msgstr "El archivo de amigos «%s» está vacÃo.\n" | 2186 | msgstr "El archivo de amigos «%s» está vacÃo.\n" |
2153 | 2187 | ||
2154 | #: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 | 2188 | #: src/cli/util/gnunet-ecc.c:324 |
2155 | #: src/service/testing/testing.c:308 | ||
2156 | #, c-format | 2189 | #, c-format |
2157 | msgid "Incorrect hostkey file format: %s\n" | 2190 | msgid "Incorrect hostkey file format: %s\n" |
2158 | msgstr "El fichero de máquinas no tiene el formato correcto: %s\n" | 2191 | msgstr "El fichero de máquinas no tiene el formato correcto: %s\n" |
2159 | 2192 | ||
2160 | #: src/cli/util/gnunet-ecc.c:334 | 2193 | #: src/cli/util/gnunet-ecc.c:340 |
2161 | #, fuzzy, c-format | 2194 | #, fuzzy, c-format |
2162 | msgid "Could not read hostkey file: %s\n" | 2195 | msgid "Could not read hostkey file: %s\n" |
2163 | msgstr "¡No se puede leer el fichero de claves de máquina!\n" | 2196 | msgstr "¡No se puede leer el fichero de claves de máquina!\n" |
2164 | 2197 | ||
2165 | #: src/cli/util/gnunet-ecc.c:388 | 2198 | #: src/cli/util/gnunet-ecc.c:394 |
2166 | msgid "No hostkey file specified on command line\n" | 2199 | msgid "No hostkey file specified on command line\n" |
2167 | msgstr "No se ha especificado la clave de máquina en la lÃnea de comandos\n" | 2200 | msgstr "No se ha especificado la clave de máquina en la lÃnea de comandos\n" |
2168 | 2201 | ||
2169 | #: src/cli/util/gnunet-ecc.c:452 | 2202 | #: src/cli/util/gnunet-ecc.c:458 |
2170 | msgid "list keys included in a file (for testing)" | 2203 | msgid "list keys included in a file (for testing)" |
2171 | msgstr "" | 2204 | msgstr "" |
2172 | 2205 | ||
2173 | #: src/cli/util/gnunet-ecc.c:458 | 2206 | #: src/cli/util/gnunet-ecc.c:464 |
2174 | msgid "number of keys to list included in a file (for testing)" | 2207 | msgid "number of keys to list included in a file (for testing)" |
2175 | msgstr "" | 2208 | msgstr "" |
2176 | 2209 | ||
2177 | #: src/cli/util/gnunet-ecc.c:464 | 2210 | #: src/cli/util/gnunet-ecc.c:470 |
2178 | msgid "create COUNT public-private key pairs (for testing)" | 2211 | msgid "create COUNT public-private key pairs (for testing)" |
2179 | msgstr "crea «COUNT» pares de claves pública-privada (para pruebas)" | 2212 | msgstr "crea «COUNT» pares de claves pública-privada (para pruebas)" |
2180 | 2213 | ||
2181 | #: src/cli/util/gnunet-ecc.c:469 | 2214 | #: src/cli/util/gnunet-ecc.c:475 |
2182 | msgid "print the public key in ASCII format" | 2215 | msgid "print the public key in ASCII format" |
2183 | msgstr "imprime la clave pública en formato ASCII" | 2216 | msgstr "imprime la clave pública en formato ASCII" |
2184 | 2217 | ||
2185 | #: src/cli/util/gnunet-ecc.c:474 | 2218 | #: src/cli/util/gnunet-ecc.c:480 |
2186 | #, fuzzy | 2219 | #, fuzzy |
2187 | msgid "print the private key in ASCII format" | 2220 | msgid "print the private key in ASCII format" |
2188 | msgstr "imprime la clave pública en formato ASCII" | 2221 | msgstr "imprime la clave pública en formato ASCII" |
2189 | 2222 | ||
2190 | #: src/cli/util/gnunet-ecc.c:479 | 2223 | #: src/cli/util/gnunet-ecc.c:485 |
2191 | #, fuzzy | 2224 | #, fuzzy |
2192 | msgid "print the public key in HEX format" | 2225 | msgid "print the public key in HEX format" |
2193 | msgstr "imprime la clave pública en formato ASCII" | 2226 | msgstr "imprime la clave pública en formato ASCII" |
2194 | 2227 | ||
2195 | #: src/cli/util/gnunet-ecc.c:485 | 2228 | #: src/cli/util/gnunet-ecc.c:491 |
2196 | msgid "print examples of ECC operations (used for compatibility testing)" | 2229 | msgid "print examples of ECC operations (used for compatibility testing)" |
2197 | msgstr "" | 2230 | msgstr "" |
2198 | 2231 | ||
2199 | #: src/cli/util/gnunet-ecc.c:499 | 2232 | #: src/cli/util/gnunet-ecc.c:505 |
2200 | msgid "Manipulate GNUnet private ECC key files" | 2233 | msgid "Manipulate GNUnet private ECC key files" |
2201 | msgstr "Manipular los ficheros de clave privada ECC de GNUnet" | 2234 | msgstr "Manipular los ficheros de clave privada ECC de GNUnet" |
2202 | 2235 | ||
@@ -3289,14 +3322,14 @@ msgstr "" | |||
3289 | msgid "Invalid handle type while writing `%s'" | 3322 | msgid "Invalid handle type while writing `%s'" |
3290 | msgstr "Formato de tiempo no válido «%s»\n" | 3323 | msgstr "Formato de tiempo no válido «%s»\n" |
3291 | 3324 | ||
3292 | #: 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 |
3293 | #: src/service/arm/gnunet-service-arm.c:452 | 3326 | #: src/service/arm/gnunet-service-arm.c:452 |
3294 | #, c-format | 3327 | #, c-format |
3295 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 3328 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
3296 | msgstr "" | 3329 | msgstr "" |
3297 | "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" |
3298 | 3331 | ||
3299 | #: 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 |
3300 | #: src/service/arm/gnunet-service-arm.c:456 | 3333 | #: src/service/arm/gnunet-service-arm.c:456 |
3301 | #, c-format | 3334 | #, c-format |
3302 | msgid "Using `%s' instead\n" | 3335 | msgid "Using `%s' instead\n" |
@@ -3431,17 +3464,17 @@ msgstr "" | |||
3431 | msgid "`%s' failed at %s:%d with error: %s\n" | 3464 | msgid "`%s' failed at %s:%d with error: %s\n" |
3432 | msgstr "«%s» falló en %s: %d con el error: %s\n" | 3465 | msgstr "«%s» falló en %s: %d con el error: %s\n" |
3433 | 3466 | ||
3434 | #: src/lib/util/crypto_ecc.c:554 | 3467 | #: src/lib/util/crypto_ecc.c:569 |
3435 | #, c-format | 3468 | #, c-format |
3436 | msgid "ECC signing failed at %s:%d: %s\n" | 3469 | msgid "ECC signing failed at %s:%d: %s\n" |
3437 | msgstr "El firmado ECC falló en %s:%d: %s\n" | 3470 | msgstr "El firmado ECC falló en %s:%d: %s\n" |
3438 | 3471 | ||
3439 | #: src/lib/util/crypto_ecc.c:677 | 3472 | #: src/lib/util/crypto_ecc.c:692 |
3440 | #, fuzzy, c-format | 3473 | #, fuzzy, c-format |
3441 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 3474 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
3442 | msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n" | 3475 | msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n" |
3443 | 3476 | ||
3444 | #: 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 |
3445 | #, fuzzy | 3478 | #, fuzzy |
3446 | msgid "Could not load peer's private key\n" | 3479 | msgid "Could not load peer's private key\n" |
3447 | msgstr "No se pudo acceder a la clave de máquina.\n" | 3480 | msgstr "No se pudo acceder a la clave de máquina.\n" |
@@ -3466,7 +3499,7 @@ msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n" | |||
3466 | msgid "Expected `%s' to be a directory!\n" | 3499 | msgid "Expected `%s' to be a directory!\n" |
3467 | msgstr "¡Se esperaba que «%s» fuera un directorio!\n" | 3500 | msgstr "¡Se esperaba que «%s» fuera un directorio!\n" |
3468 | 3501 | ||
3469 | #: 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 |
3470 | #, c-format | 3503 | #, c-format |
3471 | msgid "Cannot obtain information about user `%s': %s\n" | 3504 | msgid "Cannot obtain information about user `%s': %s\n" |
3472 | msgstr "No se pudo obtener información acerca del usuario «%s»: %s\n" | 3505 | msgstr "No se pudo obtener información acerca del usuario «%s»: %s\n" |
@@ -3661,102 +3694,102 @@ msgstr "Tienes que introducir un número en la opción «%s».\n" | |||
3661 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 3694 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
3662 | msgstr "" | 3695 | msgstr "" |
3663 | 3696 | ||
3664 | #: src/lib/util/gnunet_error_codes.c:60 | 3697 | #: src/lib/util/gnunet_error_codes.c:59 |
3665 | msgid "No error (success)." | 3698 | msgid "No error (success)." |
3666 | msgstr "" | 3699 | msgstr "" |
3667 | 3700 | ||
3668 | #: src/lib/util/gnunet_error_codes.c:66 | 3701 | #: src/lib/util/gnunet_error_codes.c:65 |
3669 | #, fuzzy | 3702 | #, fuzzy |
3670 | msgid "Unknown and unspecified error." | 3703 | msgid "Unknown and unspecified error." |
3671 | msgstr "Error desconocido" | 3704 | msgstr "Error desconocido" |
3672 | 3705 | ||
3673 | # Miguel: ¿Conectar y conexión? | 3706 | # Miguel: ¿Conectar y conexión? |
3674 | #: src/lib/util/gnunet_error_codes.c:72 | 3707 | #: src/lib/util/gnunet_error_codes.c:71 |
3675 | #, fuzzy | 3708 | #, fuzzy |
3676 | msgid "Communication with service failed." | 3709 | msgid "Communication with service failed." |
3677 | msgstr "Error al comunicar con el servicio ARM.\n" | 3710 | msgstr "Error al comunicar con el servicio ARM.\n" |
3678 | 3711 | ||
3679 | #: src/lib/util/gnunet_error_codes.c:78 | 3712 | #: src/lib/util/gnunet_error_codes.c:77 |
3680 | #, fuzzy | 3713 | #, fuzzy |
3681 | msgid "Ego not found." | 3714 | msgid "Ego not found." |
3682 | msgstr "Contenido no encontrado" | 3715 | msgstr "Contenido no encontrado" |
3683 | 3716 | ||
3684 | #: src/lib/util/gnunet_error_codes.c:84 | 3717 | #: src/lib/util/gnunet_error_codes.c:83 |
3685 | msgid "Identifier already in use for another ego." | 3718 | msgid "Identifier already in use for another ego." |
3686 | msgstr "" | 3719 | msgstr "" |
3687 | 3720 | ||
3688 | #: src/lib/util/gnunet_error_codes.c:90 | 3721 | #: src/lib/util/gnunet_error_codes.c:89 |
3689 | msgid "The given ego is invalid or malformed." | 3722 | msgid "The given ego is invalid or malformed." |
3690 | msgstr "" | 3723 | msgstr "" |
3691 | 3724 | ||
3692 | #: src/lib/util/gnunet_error_codes.c:96 | 3725 | #: src/lib/util/gnunet_error_codes.c:95 |
3693 | #, fuzzy | 3726 | #, fuzzy |
3694 | msgid "Unknown namestore error." | 3727 | msgid "Unknown namestore error." |
3695 | msgstr "Error desconocido" | 3728 | msgstr "Error desconocido" |
3696 | 3729 | ||
3697 | #: 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 |
3698 | #, fuzzy | 3731 | #, fuzzy |
3699 | msgid "Zone iteration failed." | 3732 | msgid "Zone iteration failed." |
3700 | msgstr "# sesiones wlan creadas" | 3733 | msgstr "# sesiones wlan creadas" |
3701 | 3734 | ||
3702 | #: src/lib/util/gnunet_error_codes.c:108 | 3735 | #: src/lib/util/gnunet_error_codes.c:107 |
3703 | #, fuzzy | 3736 | #, fuzzy |
3704 | msgid "Zone not found." | 3737 | msgid "Zone not found." |
3705 | msgstr "Contenido no encontrado" | 3738 | msgstr "Contenido no encontrado" |
3706 | 3739 | ||
3707 | #: src/lib/util/gnunet_error_codes.c:114 | 3740 | #: src/lib/util/gnunet_error_codes.c:113 |
3708 | #, fuzzy | 3741 | #, fuzzy |
3709 | msgid "Record not found." | 3742 | msgid "Record not found." |
3710 | msgstr "«upnpc» no encontrado\n" | 3743 | msgstr "«upnpc» no encontrado\n" |
3711 | 3744 | ||
3712 | #: src/lib/util/gnunet_error_codes.c:126 | 3745 | #: src/lib/util/gnunet_error_codes.c:125 |
3713 | #, fuzzy | 3746 | #, fuzzy |
3714 | msgid "Zone does not contain any records." | 3747 | msgid "Zone does not contain any records." |
3715 | msgstr "El fichero '%s' no contiene un pseudónimo.\n" | 3748 | msgstr "El fichero '%s' no contiene un pseudónimo.\n" |
3716 | 3749 | ||
3717 | #: src/lib/util/gnunet_error_codes.c:132 | 3750 | #: src/lib/util/gnunet_error_codes.c:131 |
3718 | #, fuzzy | 3751 | #, fuzzy |
3719 | msgid "Failed to lookup record." | 3752 | msgid "Failed to lookup record." |
3720 | msgstr "El almacén de nombres no pudo añadir el registro\n" | 3753 | msgstr "El almacén de nombres no pudo añadir el registro\n" |
3721 | 3754 | ||
3722 | #: src/lib/util/gnunet_error_codes.c:138 | 3755 | #: src/lib/util/gnunet_error_codes.c:137 |
3723 | #, fuzzy | 3756 | #, fuzzy |
3724 | msgid "No records given." | 3757 | msgid "No records given." |
3725 | msgstr "No se han proporcionado opciones\n" | 3758 | msgstr "No se han proporcionado opciones\n" |
3726 | 3759 | ||
3727 | #: src/lib/util/gnunet_error_codes.c:144 | 3760 | #: src/lib/util/gnunet_error_codes.c:143 |
3728 | msgid "Record data invalid." | 3761 | msgid "Record data invalid." |
3729 | msgstr "" | 3762 | msgstr "" |
3730 | 3763 | ||
3731 | #: src/lib/util/gnunet_error_codes.c:150 | 3764 | #: src/lib/util/gnunet_error_codes.c:149 |
3732 | #, fuzzy | 3765 | #, fuzzy |
3733 | msgid "No label given." | 3766 | msgid "No label given." |
3734 | msgstr "No se han proporcionado opciones\n" | 3767 | msgstr "No se han proporcionado opciones\n" |
3735 | 3768 | ||
3736 | #: src/lib/util/gnunet_error_codes.c:156 | 3769 | #: src/lib/util/gnunet_error_codes.c:155 |
3737 | #, fuzzy | 3770 | #, fuzzy |
3738 | msgid "No results given." | 3771 | msgid "No results given." |
3739 | msgstr "No se han proporcionado opciones\n" | 3772 | msgstr "No se han proporcionado opciones\n" |
3740 | 3773 | ||
3741 | #: src/lib/util/gnunet_error_codes.c:162 | 3774 | #: src/lib/util/gnunet_error_codes.c:161 |
3742 | #, fuzzy | 3775 | #, fuzzy |
3743 | msgid "Record already exists." | 3776 | msgid "Record already exists." |
3744 | msgstr "El registro ya existÃa en el almacén de nombres" | 3777 | msgstr "El registro ya existÃa en el almacén de nombres" |
3745 | 3778 | ||
3746 | #: src/lib/util/gnunet_error_codes.c:168 | 3779 | #: src/lib/util/gnunet_error_codes.c:167 |
3747 | msgid "Record size exceeds maximum limit." | 3780 | msgid "Record size exceeds maximum limit." |
3748 | msgstr "" | 3781 | msgstr "" |
3749 | 3782 | ||
3750 | #: src/lib/util/gnunet_error_codes.c:174 | 3783 | #: src/lib/util/gnunet_error_codes.c:173 |
3751 | msgid "There was an error in the database backend." | 3784 | msgid "There was an error in the database backend." |
3752 | msgstr "" | 3785 | msgstr "" |
3753 | 3786 | ||
3754 | #: src/lib/util/gnunet_error_codes.c:180 | 3787 | #: src/lib/util/gnunet_error_codes.c:179 |
3755 | #, fuzzy | 3788 | #, fuzzy |
3756 | msgid "Failed to store the given records." | 3789 | msgid "Failed to store the given records." |
3757 | msgstr "El almacén de nombres no pudo añadir el registro\n" | 3790 | msgstr "El almacén de nombres no pudo añadir el registro\n" |
3758 | 3791 | ||
3759 | #: src/lib/util/gnunet_error_codes.c:186 | 3792 | #: src/lib/util/gnunet_error_codes.c:185 |
3760 | msgid "Label invalid or malformed." | 3793 | msgid "Label invalid or malformed." |
3761 | msgstr "" | 3794 | msgstr "" |
3762 | 3795 | ||
@@ -3828,16 +3861,6 @@ msgstr "Falló «%s» para la biblioteca «%s» con error: %s\n" | |||
3828 | msgid "Could not determine plugin installation path.\n" | 3861 | msgid "Could not determine plugin installation path.\n" |
3829 | msgstr "No se pudo determinar la ruta de instalación de los módulos.\n" | 3862 | msgstr "No se pudo determinar la ruta de instalación de los módulos.\n" |
3830 | 3863 | ||
3831 | #: src/lib/util/program.c:287 | ||
3832 | #, fuzzy, c-format | ||
3833 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
3834 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | ||
3835 | |||
3836 | #: src/lib/util/program.c:299 | ||
3837 | #, fuzzy, c-format | ||
3838 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
3839 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | ||
3840 | |||
3841 | #: src/lib/util/program.c:314 | 3864 | #: src/lib/util/program.c:314 |
3842 | #, fuzzy, c-format | 3865 | #, fuzzy, c-format |
3843 | msgid "Unreadable configuration file `%s'. Exiting ...\n" | 3866 | msgid "Unreadable configuration file `%s'. Exiting ...\n" |
@@ -3893,7 +3916,7 @@ msgid "Could not resolve our FQDN: %s\n" | |||
3893 | msgstr "" | 3916 | msgstr "" |
3894 | "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" |
3895 | 3918 | ||
3896 | #: src/lib/util/service.c:654 | 3919 | #: src/lib/util/service.c:650 |
3897 | #, fuzzy, c-format | 3920 | #, fuzzy, c-format |
3898 | msgid "" | 3921 | msgid "" |
3899 | "Processing code for message of type %u did not call " | 3922 | "Processing code for message of type %u did not call " |
@@ -3902,22 +3925,22 @@ msgstr "" | |||
3902 | "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 " |
3903 | "«GNUNET_SERVER_receive_done» después de %s\n" | 3926 | "«GNUNET_SERVER_receive_done» después de %s\n" |
3904 | 3927 | ||
3905 | #: src/lib/util/service.c:838 | 3928 | #: src/lib/util/service.c:841 |
3906 | #, c-format | 3929 | #, c-format |
3907 | msgid "Unknown address family %d\n" | 3930 | msgid "Unknown address family %d\n" |
3908 | msgstr "Familia de direcciones %d desconocida\n" | 3931 | msgstr "Familia de direcciones %d desconocida\n" |
3909 | 3932 | ||
3910 | #: src/lib/util/service.c:951 | 3933 | #: src/lib/util/service.c:956 |
3911 | #, c-format | 3934 | #, c-format |
3912 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" | 3935 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" |
3913 | msgstr "No se pudo procesar la especificación de red IPv4 «%s» para «%s:%s»\n" | 3936 | msgstr "No se pudo procesar la especificación de red IPv4 «%s» para «%s:%s»\n" |
3914 | 3937 | ||
3915 | #: src/lib/util/service.c:992 | 3938 | #: src/lib/util/service.c:997 |
3916 | #, c-format | 3939 | #, c-format |
3917 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" | 3940 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" |
3918 | msgstr "No se pudo procesar la especificación de red IPv6 «%s» para «%s:%s»\n" | 3941 | msgstr "No se pudo procesar la especificación de red IPv6 «%s» para «%s:%s»\n" |
3919 | 3942 | ||
3920 | #: 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 |
3921 | #: src/service/arm/gnunet-service-arm.c:412 | 3944 | #: src/service/arm/gnunet-service-arm.c:412 |
3922 | #: src/service/arm/gnunet-service-arm.c:418 | 3945 | #: src/service/arm/gnunet-service-arm.c:418 |
3923 | #, c-format | 3946 | #, c-format |
@@ -3926,7 +3949,7 @@ msgstr "" | |||
3926 | "¡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 " |
3927 | "configuración!\n" | 3950 | "configuración!\n" |
3928 | 3951 | ||
3929 | #: 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 |
3930 | #, c-format | 3953 | #, c-format |
3931 | msgid "" | 3954 | msgid "" |
3932 | "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 " |
@@ -3935,89 +3958,89 @@ msgstr "" | |||
3935 | "Deshabilitando el soporte de dominio de «sockets» UNIX para el servicio " | 3958 | "Deshabilitando el soporte de dominio de «sockets» UNIX para el servicio " |
3936 | "«%s», no se pudo crear un «socket» UNIX: %s\n" | 3959 | "«%s», no se pudo crear un «socket» UNIX: %s\n" |
3937 | 3960 | ||
3938 | #: 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 |
3939 | #, c-format | 3962 | #, c-format |
3940 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | 3963 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" |
3941 | msgstr "" | 3964 | msgstr "" |
3942 | "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 " |
3943 | "uno es necesario\n" | 3966 | "uno es necesario\n" |
3944 | 3967 | ||
3945 | #: 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 |
3946 | #, c-format | 3969 | #, c-format |
3947 | msgid "Failed to resolve `%s': %s\n" | 3970 | msgid "Failed to resolve `%s': %s\n" |
3948 | msgstr "Se produjo un fallo al resolver «%s»: %s\n" | 3971 | msgstr "Se produjo un fallo al resolver «%s»: %s\n" |
3949 | 3972 | ||
3950 | #: 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 |
3951 | #, c-format | 3974 | #, c-format |
3952 | msgid "Failed to find %saddress for `%s'.\n" | 3975 | msgid "Failed to find %saddress for `%s'.\n" |
3953 | msgstr "No se encontró la dirección %s para «%s».\n" | 3976 | msgstr "No se encontró la dirección %s para «%s».\n" |
3954 | 3977 | ||
3955 | #: src/lib/util/service.c:1401 | 3978 | #: src/lib/util/service.c:1406 |
3956 | #, c-format | 3979 | #, c-format |
3957 | msgid "`%s' failed for port %d (%s).\n" | 3980 | msgid "`%s' failed for port %d (%s).\n" |
3958 | msgstr "«%s» falló para el puerto %d (%s).\n" | 3981 | msgstr "«%s» falló para el puerto %d (%s).\n" |
3959 | 3982 | ||
3960 | #: src/lib/util/service.c:1413 | 3983 | #: src/lib/util/service.c:1418 |
3961 | #, c-format | 3984 | #, c-format |
3962 | msgid "`%s' failed for port %d (%s): address already in use\n" | 3985 | msgid "`%s' failed for port %d (%s): address already in use\n" |
3963 | msgstr "«%s» falló para el puerto %d (%s): dirección en uso actualmente\n" | 3986 | msgstr "«%s» falló para el puerto %d (%s): dirección en uso actualmente\n" |
3964 | 3987 | ||
3965 | #: src/lib/util/service.c:1420 | 3988 | #: src/lib/util/service.c:1425 |
3966 | #, fuzzy, c-format | 3989 | #, fuzzy, c-format |
3967 | msgid "`%s' failed for `%s': address already in use\n" | 3990 | msgid "`%s' failed for `%s': address already in use\n" |
3968 | msgstr "«%s» falló para «%.*s»: dirección en uso actualmente\n" | 3991 | msgstr "«%s» falló para «%.*s»: dirección en uso actualmente\n" |
3969 | 3992 | ||
3970 | #: src/lib/util/service.c:1481 | 3993 | #: src/lib/util/service.c:1486 |
3971 | #, c-format | 3994 | #, c-format |
3972 | msgid "Specified value for `%s' of service `%s' is invalid\n" | 3995 | msgid "Specified value for `%s' of service `%s' is invalid\n" |
3973 | msgstr "El valor especificado «%s» para el servicio «%s» no es válido\n" | 3996 | msgstr "El valor especificado «%s» para el servicio «%s» no es válido\n" |
3974 | 3997 | ||
3975 | #: src/lib/util/service.c:1505 | 3998 | #: src/lib/util/service.c:1510 |
3976 | #, c-format | 3999 | #, c-format |
3977 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" | 4000 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" |
3978 | msgstr "" | 4001 | msgstr "" |
3979 | "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 " |
3980 | "mismo\n" | 4003 | "mismo\n" |
3981 | 4004 | ||
3982 | #: src/lib/util/service.c:1573 | 4005 | #: src/lib/util/service.c:1583 |
3983 | msgid "" | 4006 | msgid "" |
3984 | "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" |
3985 | msgstr "" | 4008 | msgstr "" |
3986 | 4009 | ||
3987 | #: src/lib/util/service.c:1644 | 4010 | #: src/lib/util/service.c:1653 |
3988 | msgid "No such user" | 4011 | msgid "No such user" |
3989 | msgstr "No existe tal usuario" | 4012 | msgstr "No existe tal usuario" |
3990 | 4013 | ||
3991 | #: src/lib/util/service.c:1658 | 4014 | #: src/lib/util/service.c:1668 |
3992 | #, c-format | 4015 | #, c-format |
3993 | msgid "Cannot change user/group to `%s': %s\n" | 4016 | msgid "Cannot change user/group to `%s': %s\n" |
3994 | msgstr "Imposible cambiar el usuario/grupo a «%s»: %s\n" | 4017 | msgstr "Imposible cambiar el usuario/grupo a «%s»: %s\n" |
3995 | 4018 | ||
3996 | #: src/lib/util/service.c:1751 | 4019 | #: src/lib/util/service.c:1767 |
3997 | msgid "Service process failed to initialize\n" | 4020 | msgid "Service process failed to initialize\n" |
3998 | msgstr "No se pudo inicializar el proceso del servicio\n" | 4021 | msgstr "No se pudo inicializar el proceso del servicio\n" |
3999 | 4022 | ||
4000 | #: src/lib/util/service.c:1756 | 4023 | #: src/lib/util/service.c:1772 |
4001 | msgid "Service process could not initialize server function\n" | 4024 | msgid "Service process could not initialize server function\n" |
4002 | msgstr "" | 4025 | msgstr "" |
4003 | "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" |
4004 | 4027 | ||
4005 | #: src/lib/util/service.c:1761 | 4028 | #: src/lib/util/service.c:1777 |
4006 | msgid "Service process failed to report status\n" | 4029 | msgid "Service process failed to report status\n" |
4007 | msgstr "El proceso del servicio no devolvió un estado\n" | 4030 | msgstr "El proceso del servicio no devolvió un estado\n" |
4008 | 4031 | ||
4009 | #: 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 |
4010 | msgid "do daemonize (detach from terminal)" | 4033 | msgid "do daemonize (detach from terminal)" |
4011 | msgstr "demonizar (desasociar del terminal)" | 4034 | msgstr "demonizar (desasociar del terminal)" |
4012 | 4035 | ||
4013 | #: 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 |
4014 | #: 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 |
4015 | #: src/service/transport/transport-testing-communicator.c:1056 | 4038 | #: src/service/transport/transport-testing-communicator.c:1059 |
4016 | #, fuzzy, c-format | 4039 | #, fuzzy, c-format |
4017 | msgid "Malformed configuration file `%s', exit ...\n" | 4040 | msgid "Malformed configuration file `%s', exit ...\n" |
4018 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | 4041 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" |
4019 | 4042 | ||
4020 | #: 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 |
4021 | #, fuzzy | 4044 | #, fuzzy |
4022 | msgid "Malformed configuration, exit ...\n" | 4045 | msgid "Malformed configuration, exit ...\n" |
4023 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | 4046 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" |
@@ -4515,6 +4538,11 @@ msgstr "El servicio «%s» finalizó con estado %s/%d, se reiniciará en %llu ms | |||
4515 | msgid "Initiating shutdown as requested by client.\n" | 4538 | msgid "Initiating shutdown as requested by client.\n" |
4516 | msgstr "Iniciando apagado bajo petición del cliente.\n" | 4539 | msgstr "Iniciando apagado bajo petición del cliente.\n" |
4517 | 4540 | ||
4541 | #: src/service/arm/testing_arm_cmd_start_peer.c:197 | ||
4542 | #, c-format | ||
4543 | msgid "Failed to start `%s': %s\n" | ||
4544 | msgstr "Se produjo un fallo al arrancar «%s»: %s\n" | ||
4545 | |||
4518 | #: src/service/core/gnunet-service-core.c:329 | 4546 | #: src/service/core/gnunet-service-core.c:329 |
4519 | msgid "# send requests dropped (disconnected)" | 4547 | msgid "# send requests dropped (disconnected)" |
4520 | msgstr "# peticiones de envÃo descartadas (desconectado)" | 4548 | msgstr "# peticiones de envÃo descartadas (desconectado)" |
@@ -4688,8 +4716,8 @@ msgstr "# bytes de «payload» descifrados" | |||
4688 | #: src/service/core/gnunet-service-core_sessions.c:337 | 4716 | #: src/service/core/gnunet-service-core_sessions.c:337 |
4689 | #: src/service/fs/gnunet-service-fs_cp.c:484 | 4717 | #: src/service/fs/gnunet-service-fs_cp.c:484 |
4690 | #: src/service/fs/gnunet-service-fs_cp.c:1377 | 4718 | #: src/service/fs/gnunet-service-fs_cp.c:1377 |
4691 | #: src/service/topology/gnunet-daemon-topology.c:551 | 4719 | #: src/service/topology/gnunet-daemon-topology.c:545 |
4692 | #: src/service/topology/gnunet-daemon-topology.c:633 | 4720 | #: src/service/topology/gnunet-daemon-topology.c:627 |
4693 | msgid "# peers connected" | 4721 | msgid "# peers connected" |
4694 | msgstr "# pares conectados" | 4722 | msgstr "# pares conectados" |
4695 | 4723 | ||
@@ -5777,7 +5805,7 @@ msgstr "" | |||
5777 | 5805 | ||
5778 | #: src/service/fs/gnunet-service-fs.c:1271 | 5806 | #: src/service/fs/gnunet-service-fs.c:1271 |
5779 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 | 5807 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 |
5780 | #: src/service/topology/gnunet-daemon-topology.c:1066 | 5808 | #: src/service/topology/gnunet-daemon-topology.c:1062 |
5781 | #, c-format | 5809 | #, c-format |
5782 | msgid "Failed to connect to `%s' service.\n" | 5810 | msgid "Failed to connect to `%s' service.\n" |
5783 | msgstr "Se produjo un fallo al conectar con el servicio «%s».\n" | 5811 | msgstr "Se produjo un fallo al conectar con el servicio «%s».\n" |
@@ -6606,7 +6634,7 @@ msgid "# hostlist advertisements send" | |||
6606 | msgstr "# anuncios de listas de máquinas enviados" | 6634 | msgstr "# anuncios de listas de máquinas enviados" |
6607 | 6635 | ||
6608 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 | 6636 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 |
6609 | #: src/service/topology/gnunet-daemon-topology.c:786 | 6637 | #: src/service/topology/gnunet-daemon-topology.c:781 |
6610 | #, fuzzy, c-format | 6638 | #, fuzzy, c-format |
6611 | msgid "Error in communication with PEERSTORE service: %s\n" | 6639 | msgid "Error in communication with PEERSTORE service: %s\n" |
6612 | msgstr "" | 6640 | msgstr "" |
@@ -6890,12 +6918,12 @@ msgstr "" | |||
6890 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" | 6918 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
6891 | msgstr "" | 6919 | msgstr "" |
6892 | 6920 | ||
6893 | #: src/service/nat/gnunet-service-nat.c:1861 | 6921 | #: src/service/nat/gnunet-service-nat.c:1860 |
6894 | #, fuzzy | 6922 | #, fuzzy |
6895 | msgid "Connection reversal request failed\n" | 6923 | msgid "Connection reversal request failed\n" |
6896 | msgstr "Colección detenida.\n" | 6924 | msgstr "Colección detenida.\n" |
6897 | 6925 | ||
6898 | #: src/service/nat/gnunet-service-nat.c:1935 | 6926 | #: src/service/nat/gnunet-service-nat.c:1999 |
6899 | msgid "" | 6927 | msgid "" |
6900 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 6928 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
6901 | "disabling UPnP\n" | 6929 | "disabling UPnP\n" |
@@ -6919,44 +6947,44 @@ msgstr "comando «external-ip» no encontrado\n" | |||
6919 | msgid "`upnpc' command not found\n" | 6947 | msgid "`upnpc' command not found\n" |
6920 | msgstr "comando «upnpc» no encontrado\n" | 6948 | msgstr "comando «upnpc» no encontrado\n" |
6921 | 6949 | ||
6922 | #: src/service/peerstore/gnunet-service-peerstore.c:1141 | 6950 | #: src/service/peerstore/gnunet-service-peerstore.c:1150 |
6923 | #, fuzzy, c-format | 6951 | #, fuzzy, c-format |
6924 | msgid "Failed to parse HELLO in file `%s': %s\n" | 6952 | msgid "Failed to parse HELLO in file `%s': %s\n" |
6925 | msgstr "Se produjo un fallo al procesar «HELLO» en el fichero «%s»\n" | 6953 | msgstr "Se produjo un fallo al procesar «HELLO» en el fichero «%s»\n" |
6926 | 6954 | ||
6927 | #: src/service/peerstore/gnunet-service-peerstore.c:1214 | 6955 | #: src/service/peerstore/gnunet-service-peerstore.c:1223 |
6928 | #, fuzzy, c-format | 6956 | #, fuzzy, c-format |
6929 | msgid "Could not load database backend `%s'\n" | 6957 | msgid "Could not load database backend `%s'\n" |
6930 | msgstr "No se pudo leer el fichero de la lista negra «%s»\n" | 6958 | msgstr "No se pudo leer el fichero de la lista negra «%s»\n" |
6931 | 6959 | ||
6932 | #: src/service/peerstore/gnunet-service-peerstore.c:1233 | 6960 | #: src/service/peerstore/gnunet-service-peerstore.c:1242 |
6933 | #, c-format | 6961 | #, c-format |
6934 | msgid "Importing HELLOs from `%s'\n" | 6962 | msgid "Importing HELLOs from `%s'\n" |
6935 | msgstr "Importando HELLO de «%s»\n" | 6963 | msgstr "Importando HELLO de «%s»\n" |
6936 | 6964 | ||
6937 | #: src/service/peerstore/gnunet-service-peerstore.c:1244 | 6965 | #: src/service/peerstore/gnunet-service-peerstore.c:1253 |
6938 | msgid "Skipping import of included HELLOs\n" | 6966 | msgid "Skipping import of included HELLOs\n" |
6939 | msgstr "" | 6967 | msgstr "" |
6940 | 6968 | ||
6941 | #: src/service/peerstore/peerstore_api.c:574 | 6969 | #: src/service/peerstore/peerstore_api.c:579 |
6942 | #, fuzzy | 6970 | #, fuzzy |
6943 | msgid "Unexpected store response.\n" | 6971 | msgid "Unexpected store response.\n" |
6944 | msgstr "Respuesta inesperada a la operación '%s'.\n" | 6972 | msgstr "Respuesta inesperada a la operación '%s'.\n" |
6945 | 6973 | ||
6946 | #: src/service/peerstore/peerstore_api.c:606 | 6974 | #: src/service/peerstore/peerstore_api.c:620 |
6947 | #, fuzzy | 6975 | #, fuzzy |
6948 | msgid "Unexpected iteration response.\n" | 6976 | msgid "Unexpected iteration response.\n" |
6949 | msgstr "El formato de salida es desconocido, ésto no deberÃa pasar.\n" | 6977 | msgstr "El formato de salida es desconocido, ésto no deberÃa pasar.\n" |
6950 | 6978 | ||
6951 | #: src/service/peerstore/peerstore_api.c:652 | 6979 | #: src/service/peerstore/peerstore_api.c:666 |
6952 | #, fuzzy | 6980 | #, fuzzy |
6953 | msgid "" | 6981 | msgid "" |
6954 | "Unexpected iteration response, no iterating client found, discarding " | 6982 | "Unexpected iteration response, no iterating client found, discarding " |
6955 | "message.\n" | 6983 | "message.\n" |
6956 | msgstr "El formato de salida es desconocido, ésto no deberÃa pasar.\n" | 6984 | msgstr "El formato de salida es desconocido, ésto no deberÃa pasar.\n" |
6957 | 6985 | ||
6958 | #: src/service/peerstore/peerstore_api.c:662 | 6986 | #: src/service/peerstore/peerstore_api.c:676 |
6959 | #: src/service/peerstore/peerstore_api_monitor.c:164 | 6987 | #: src/service/peerstore/peerstore_api_monitor.c:163 |
6960 | #, fuzzy | 6988 | #, fuzzy |
6961 | msgid "Received a malformed response from service." | 6989 | msgid "Received a malformed response from service." |
6962 | msgstr "Recibida petición DNS mal formada de %s\n" | 6990 | msgstr "Recibida petición DNS mal formada de %s\n" |
@@ -7133,12 +7161,12 @@ msgstr "Conexión fallida\n" | |||
7133 | msgid "Namestore REST API initialized\n" | 7161 | msgid "Namestore REST API initialized\n" |
7134 | msgstr "Conexión fallida\n" | 7162 | msgstr "Conexión fallida\n" |
7135 | 7163 | ||
7136 | #: src/service/rest/openid_plugin.c:3102 | 7164 | #: src/service/rest/openid_plugin.c:3121 |
7137 | #, fuzzy | 7165 | #, fuzzy |
7138 | msgid "OpenID Connect REST API initialized\n" | 7166 | msgid "OpenID Connect REST API initialized\n" |
7139 | msgstr "Conexión fallida\n" | 7167 | msgstr "Conexión fallida\n" |
7140 | 7168 | ||
7141 | #: 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 |
7142 | #, fuzzy | 7170 | #, fuzzy |
7143 | msgid "Identity Provider REST API initialized\n" | 7171 | msgid "Identity Provider REST API initialized\n" |
7144 | msgstr "Conexión fallida\n" | 7172 | msgstr "Conexión fallida\n" |
@@ -7191,174 +7219,61 @@ msgstr "Cargando %llu bytes de estadÃsticas de «%s»\n" | |||
7191 | msgid "Could not save some persistent statistics\n" | 7219 | msgid "Could not save some persistent statistics\n" |
7192 | msgstr "No se pudieron guardar algunas estadÃsticas persistentes\n" | 7220 | msgstr "No se pudieron guardar algunas estadÃsticas persistentes\n" |
7193 | 7221 | ||
7194 | #: src/service/testing/gnunet-testing.c:185 | 7222 | #: src/service/testbed/gnunet-testbed.c:196 |
7195 | #, c-format | 7223 | #, fuzzy |
7196 | msgid "Could not extract hostkey %u (offset too large?)\n" | 7224 | msgid "number of unique configuration files to create" |
7197 | msgstr "" | ||
7198 | "No se pudo extraer la clave de máquina %u (¿desplazamiento demasiado " | ||
7199 | "grande?)\n" | ||
7200 | |||
7201 | #: src/service/testing/gnunet-testing.c:275 | ||
7202 | #, c-format | ||
7203 | msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n" | ||
7204 | msgstr "Comando desconocido, use «q» para salir o «r» para reiniciar el par\n" | ||
7205 | |||
7206 | #: src/service/testing/gnunet-testing.c:386 | ||
7207 | msgid "create unique configuration files" | ||
7208 | msgstr "crear ficheros de configuración únicos" | ||
7209 | |||
7210 | #: src/service/testing/gnunet-testing.c:392 | ||
7211 | msgid "extract hostkey file from pre-computed hostkey list" | ||
7212 | msgstr "" | ||
7213 | "extraer los ficheros de claves de máquinas de una lista pre-computada de " | ||
7214 | "claves de máquinas" | ||
7215 | |||
7216 | #: src/service/testing/gnunet-testing.c:400 | ||
7217 | msgid "" | ||
7218 | "number of unique configuration files to create, or number of the hostkey to " | ||
7219 | "extract" | ||
7220 | msgstr "" | 7225 | msgstr "" |
7221 | "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 " |
7222 | "número de claves de máquina a extraer" | 7227 | "número de claves de máquina a extraer" |
7223 | 7228 | ||
7224 | #: src/service/testing/gnunet-testing.c:407 | 7229 | #: src/service/testbed/gnunet-testbed.c:202 |
7225 | msgid "configuration template" | 7230 | msgid "configuration template" |
7226 | msgstr "plantilla de configuración" | 7231 | msgstr "plantilla de configuración" |
7227 | 7232 | ||
7228 | #: src/service/testing/gnunet-testing.c:415 | 7233 | #: src/service/testbed/gnunet-testbed.c:218 |
7229 | msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)" | ||
7230 | msgstr "" | ||
7231 | |||
7232 | #: src/service/testing/gnunet-testing.c:432 | ||
7233 | msgid "Command line tool to access the testing library" | 7234 | msgid "Command line tool to access the testing library" |
7234 | msgstr "" | 7235 | msgstr "" |
7235 | "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" |
7236 | 7237 | ||
7237 | #: src/service/testing/list-keys.c:92 | ||
7238 | #, fuzzy | ||
7239 | msgid "list COUNT number of keys" | ||
7240 | msgstr "crea «COUNT» número de pares" | ||
7241 | |||
7242 | #: src/service/testing/testing.c:291 | ||
7243 | #, c-format | ||
7244 | msgid "Hostkeys file not found: %s\n" | ||
7245 | msgstr "El fichero de máquinas no fue encontrado: %s\n" | ||
7246 | |||
7247 | #: src/service/testing/testing.c:743 | ||
7248 | #, c-format | ||
7249 | msgid "Key number %u does not exist\n" | ||
7250 | msgstr "El número de clave %u no existe\n" | ||
7251 | |||
7252 | # Miguel: "testbed" lo he traducido como baterÃa de pruebas, pero | ||
7253 | # no es una traducción muy literal. | ||
7254 | #: src/service/testing/testing.c:1217 | ||
7255 | #, c-format | ||
7256 | msgid "" | ||
7257 | "You attempted to create a testbed with more than %u hosts. Please " | ||
7258 | "precompute more hostkeys first.\n" | ||
7259 | msgstr "" | ||
7260 | "Se ha intentado crear una baterÃa de pruebas con más de %u máquinas. Por " | ||
7261 | "favor, pre-compute más claves de máquinas primero.\n" | ||
7262 | |||
7263 | #: src/service/testing/testing.c:1226 | ||
7264 | #, c-format | ||
7265 | msgid "Failed to initialize hostkey for peer %u\n" | ||
7266 | msgstr "" | ||
7267 | "Se produjo un fallo al inicializar la clave de la máquina desde el par %u\n" | ||
7268 | |||
7269 | #: src/service/testing/testing.c:1236 | ||
7270 | #, fuzzy | ||
7271 | msgid "PRIVATE_KEY option in PEER section missing in configuration\n" | ||
7272 | msgstr "¡Falta la opción «%s» en la sección «%s» de la configuración!\n" | ||
7273 | |||
7274 | #: src/service/testing/testing.c:1249 | ||
7275 | msgid "Failed to create configuration for peer (not enough free ports?)\n" | ||
7276 | msgstr "" | ||
7277 | "Se produjo un fallo al crear la configuración para el par (¿no hay " | ||
7278 | "suficientes puertos libres?)\n" | ||
7279 | |||
7280 | #: src/service/testing/testing.c:1265 | ||
7281 | #, fuzzy, c-format | ||
7282 | msgid "Cannot open hostkey file `%s': %s\n" | ||
7283 | msgstr "No se pudo abrir el fichero de claves de máquina: %s\n" | ||
7284 | |||
7285 | #: src/service/testing/testing.c:1279 | ||
7286 | #, c-format | ||
7287 | msgid "Failed to write hostkey file for peer %u: %s\n" | ||
7288 | msgstr "" | ||
7289 | "Se produjo un fallo al escribir la clave de la máquina para el par %u: %s\n" | ||
7290 | |||
7291 | #: src/service/testing/testing.c:1307 | ||
7292 | #, c-format | ||
7293 | msgid "Failed to write configuration file `%s' for peer %u: %s\n" | ||
7294 | msgstr "" | ||
7295 | "Se produjo un fallo al escribir el fichero de configuración «%s» para el par " | ||
7296 | "%u: %s\n" | ||
7297 | |||
7298 | #: src/service/testing/testing.c:1413 | ||
7299 | #, c-format | ||
7300 | msgid "Failed to start `%s': %s\n" | ||
7301 | msgstr "Se produjo un fallo al arrancar «%s»: %s\n" | ||
7302 | |||
7303 | #: src/service/testing/testing.c:1664 | ||
7304 | #, c-format | ||
7305 | msgid "Failed to load configuration from %s\n" | ||
7306 | msgstr "Se produjo un fallo al cargar la configuración de %s\n" | ||
7307 | |||
7308 | #: src/service/testing/testing.c:2795 | ||
7309 | #, c-format | ||
7310 | msgid "Topology file %s not found\n" | ||
7311 | msgstr "El fichero de topologÃa %s no fue encontrado\n" | ||
7312 | |||
7313 | #: src/service/testing/testing.c:2803 | ||
7314 | #, c-format | ||
7315 | msgid "Topology file %s has no data\n" | ||
7316 | msgstr "El fichero de topologÃa %s no tiene datos\n" | ||
7317 | |||
7318 | #: src/service/testing/testing.c:2811 | ||
7319 | #, c-format | ||
7320 | msgid "Topology file %s cannot be read\n" | ||
7321 | msgstr "El fichero de topologÃa %s no puede ser leido\n" | ||
7322 | |||
7323 | #: src/service/topology/gnunet-daemon-topology.c:286 | 7238 | #: src/service/topology/gnunet-daemon-topology.c:286 |
7324 | #, fuzzy | 7239 | #, fuzzy |
7325 | msgid "# connect requests issued to ATS" | 7240 | msgid "# connect requests issued to ATS" |
7326 | msgstr "# peticiones de conexión requeridas al servicio de transporte" | 7241 | msgstr "# peticiones de conexión requeridas al servicio de transporte" |
7327 | 7242 | ||
7328 | # gossiped?? | 7243 | # gossiped?? |
7329 | #: src/service/topology/gnunet-daemon-topology.c:480 | 7244 | #: src/service/topology/gnunet-daemon-topology.c:475 |
7330 | msgid "# HELLO messages gossipped" | 7245 | msgid "# HELLO messages gossipped" |
7331 | msgstr "# Mensajes «HELLO» rumoreados" | 7246 | msgstr "# Mensajes «HELLO» rumoreados" |
7332 | 7247 | ||
7333 | #: src/service/topology/gnunet-daemon-topology.c:752 | 7248 | #: src/service/topology/gnunet-daemon-topology.c:747 |
7334 | #, fuzzy | 7249 | #, fuzzy |
7335 | msgid "Error in communication with PEERSTORE service to monitor.\n" | 7250 | msgid "Error in communication with PEERSTORE service to monitor.\n" |
7336 | msgstr "" | 7251 | msgstr "" |
7337 | "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): " |
7338 | "%s\n" | 7253 | "%s\n" |
7339 | 7254 | ||
7340 | #: src/service/topology/gnunet-daemon-topology.c:761 | 7255 | #: src/service/topology/gnunet-daemon-topology.c:756 |
7341 | msgid "Finished initial PEERSTORE iteration in monitor.\n" | 7256 | msgid "Finished initial PEERSTORE iteration in monitor.\n" |
7342 | msgstr "" | 7257 | msgstr "" |
7343 | 7258 | ||
7344 | #: src/service/topology/gnunet-daemon-topology.c:869 | 7259 | #: src/service/topology/gnunet-daemon-topology.c:864 |
7345 | msgid "Failed to connect to core service, can not manage topology!\n" | 7260 | msgid "Failed to connect to core service, can not manage topology!\n" |
7346 | msgstr "" | 7261 | msgstr "" |
7347 | "¡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 " |
7348 | "gestionar la topologÃa!\n" | 7263 | "gestionar la topologÃa!\n" |
7349 | 7264 | ||
7350 | #: src/service/topology/gnunet-daemon-topology.c:943 | 7265 | #: src/service/topology/gnunet-daemon-topology.c:938 |
7351 | msgid "# HELLO messages received" | 7266 | msgid "# HELLO messages received" |
7352 | msgstr "# mensajes «HELLO» recibidos" | 7267 | msgstr "# mensajes «HELLO» recibidos" |
7353 | 7268 | ||
7354 | #: src/service/topology/gnunet-daemon-topology.c:1095 | 7269 | #: src/service/topology/gnunet-daemon-topology.c:1091 |
7355 | msgid "GNUnet topology control" | 7270 | msgid "GNUnet topology control" |
7356 | msgstr "" | 7271 | msgstr "" |
7357 | 7272 | ||
7358 | #: src/service/transport/gnunet-communicator-quic.c:1717 | 7273 | #: src/service/transport/gnunet-communicator-quic.c:1717 |
7359 | #: src/service/transport/gnunet-communicator-tcp.c:3814 | 7274 | #: src/service/transport/gnunet-communicator-tcp.c:3814 |
7360 | #: src/service/transport/gnunet-communicator-udp.c:3562 | 7275 | #: src/service/transport/gnunet-communicator-udp.c:3579 |
7361 | #: src/service/transport/gnunet-service-transport.c:12124 | 7276 | #: src/service/transport/gnunet-service-transport.c:12543 |
7362 | #, fuzzy | 7277 | #, fuzzy |
7363 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7278 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7364 | msgstr "" | 7279 | msgstr "" |
@@ -7375,7 +7290,7 @@ msgstr "Configurador Gtk de GNUnet" | |||
7375 | msgid "GNUnet TCP communicator" | 7290 | msgid "GNUnet TCP communicator" |
7376 | msgstr "Configurador Gtk de GNUnet" | 7291 | msgstr "Configurador Gtk de GNUnet" |
7377 | 7292 | ||
7378 | #: src/service/transport/gnunet-communicator-udp.c:3637 | 7293 | #: src/service/transport/gnunet-communicator-udp.c:3654 |
7379 | #, fuzzy | 7294 | #, fuzzy |
7380 | msgid "GNUnet UDP communicator" | 7295 | msgid "GNUnet UDP communicator" |
7381 | msgstr "Configurador Gtk de GNUnet" | 7296 | msgstr "Configurador Gtk de GNUnet" |
@@ -7695,6 +7610,94 @@ msgstr "Se produjo un fallo al crear el espacio de nombres «%s»\n" | |||
7695 | msgid "Failed to connect to the namestore!\n" | 7610 | msgid "Failed to connect to the namestore!\n" |
7696 | msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" | 7611 | msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" |
7697 | 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 | |||
7698 | #, fuzzy, c-format | 7701 | #, fuzzy, c-format |
7699 | #~ msgid "" | 7702 | #~ msgid "" |
7700 | #~ "Local peer: %s\n" | 7703 | #~ "Local peer: %s\n" |
@@ -9371,10 +9374,6 @@ msgstr "¡Se produjo un fallo al conectar con el almacén de nombres!\n" | |||
9371 | #~ msgstr "valor a establecer" | 9374 | #~ msgstr "valor a establecer" |
9372 | 9375 | ||
9373 | #, fuzzy | 9376 | #, fuzzy |
9374 | #~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | ||
9375 | #~ msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | ||
9376 | |||
9377 | #, fuzzy | ||
9378 | #~ msgid "Unreadable or malformed configuration, exit ...\n" | 9377 | #~ msgid "Unreadable or malformed configuration, exit ...\n" |
9379 | #~ 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" |
9380 | 9379 | ||
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
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-15 09:19+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,25 +334,25 @@ msgstr "" | |||
334 | msgid "Failed to connect to CORE service!\n" | 334 | msgid "Failed to connect to CORE service!\n" |
335 | msgstr "" | 335 | msgstr "" |
336 | 336 | ||
337 | #: src/cli/core/gnunet-core.c:212 | 337 | #: src/cli/core/gnunet-core.c:213 |
338 | #, fuzzy | 338 | #, fuzzy |
339 | msgid "No argument given.\n" | 339 | msgid "No argument given.\n" |
340 | msgstr "# résultats introuvables" | 340 | msgstr "# résultats introuvables" |
341 | 341 | ||
342 | #: src/cli/core/gnunet-core.c:235 src/service/transport/gnunet-transport.c:1389 | 342 | #: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389 |
343 | msgid "provide information about all current connections (continuously)" | 343 | msgid "provide information about all current connections (continuously)" |
344 | msgstr "" | 344 | msgstr "" |
345 | 345 | ||
346 | #: src/cli/core/gnunet-core.c:241 | 346 | #: src/cli/core/gnunet-core.c:244 |
347 | msgid "Show our current peer identity" | 347 | msgid "Show our current peer identity" |
348 | msgstr "" | 348 | msgstr "" |
349 | 349 | ||
350 | #: src/cli/core/gnunet-core.c:248 | 350 | #: src/cli/core/gnunet-core.c:251 |
351 | #, fuzzy | 351 | #, fuzzy |
352 | msgid "Show current connections" | 352 | msgid "Show current connections" |
353 | msgstr "# Session TCP active" | 353 | msgstr "# Session TCP active" |
354 | 354 | ||
355 | #: src/cli/core/gnunet-core.c:259 | 355 | #: src/cli/core/gnunet-core.c:262 |
356 | msgid "Print information about connected peers." | 356 | msgid "Print information about connected peers." |
357 | msgstr "" | 357 | msgstr "" |
358 | 358 | ||
@@ -1045,52 +1045,52 @@ msgstr "" | |||
1045 | msgid "Unindex a file that was previously indexed with gnunet-publish." | 1045 | msgid "Unindex a file that was previously indexed with gnunet-publish." |
1046 | msgstr "" | 1046 | msgstr "" |
1047 | 1047 | ||
1048 | #: src/cli/gns/gnunet-gns.c:268 | 1048 | #: src/cli/gns/gnunet-gns.c:269 |
1049 | #, c-format | 1049 | #, c-format |
1050 | msgid "`%s' is not a valid DNS domain name\n" | 1050 | msgid "`%s' is not a valid DNS domain name\n" |
1051 | msgstr "" | 1051 | msgstr "" |
1052 | 1052 | ||
1053 | #: 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 |
1054 | #, c-format | 1054 | #, c-format |
1055 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" | 1055 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" |
1056 | msgstr "" | 1056 | msgstr "" |
1057 | 1057 | ||
1058 | #: src/cli/gns/gnunet-gns.c:294 | 1058 | #: src/cli/gns/gnunet-gns.c:295 |
1059 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" | 1059 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" |
1060 | msgstr "" | 1060 | msgstr "" |
1061 | 1061 | ||
1062 | #: src/cli/gns/gnunet-gns.c:305 | 1062 | #: src/cli/gns/gnunet-gns.c:306 |
1063 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 | 1063 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 |
1064 | #, c-format | 1064 | #, c-format |
1065 | msgid "Failed to connect to GNS\n" | 1065 | msgid "Failed to connect to GNS\n" |
1066 | msgstr "" | 1066 | msgstr "" |
1067 | 1067 | ||
1068 | #: src/cli/gns/gnunet-gns.c:318 | 1068 | #: src/cli/gns/gnunet-gns.c:325 |
1069 | #, c-format | 1069 | #, c-format |
1070 | msgid "Invalid typename specified, assuming `ANY'\n" | 1070 | msgid "Invalid typename specified, assuming `ANY'\n" |
1071 | msgstr "" | 1071 | msgstr "" |
1072 | 1072 | ||
1073 | #: src/cli/gns/gnunet-gns.c:358 | 1073 | #: src/cli/gns/gnunet-gns.c:365 |
1074 | msgid "Lookup a record for the given name" | 1074 | msgid "Lookup a record for the given name" |
1075 | msgstr "" | 1075 | msgstr "" |
1076 | 1076 | ||
1077 | #: src/cli/gns/gnunet-gns.c:364 | 1077 | #: src/cli/gns/gnunet-gns.c:371 |
1078 | msgid "Specify the type of the record to lookup" | 1078 | msgid "Specify the type of the record to lookup" |
1079 | msgstr "" | 1079 | msgstr "" |
1080 | 1080 | ||
1081 | #: src/cli/gns/gnunet-gns.c:370 | 1081 | #: src/cli/gns/gnunet-gns.c:377 |
1082 | msgid "Specify a timeout for the lookup" | 1082 | msgid "Specify a timeout for the lookup" |
1083 | msgstr "" | 1083 | msgstr "" |
1084 | 1084 | ||
1085 | #: src/cli/gns/gnunet-gns.c:374 | 1085 | #: src/cli/gns/gnunet-gns.c:381 |
1086 | msgid "No unneeded output" | 1086 | msgid "No unneeded output" |
1087 | msgstr "" | 1087 | msgstr "" |
1088 | 1088 | ||
1089 | #: src/cli/gns/gnunet-gns.c:379 | 1089 | #: src/cli/gns/gnunet-gns.c:386 |
1090 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" | 1090 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" |
1091 | msgstr "" | 1091 | msgstr "" |
1092 | 1092 | ||
1093 | #: src/cli/gns/gnunet-gns.c:393 | 1093 | #: src/cli/gns/gnunet-gns.c:400 |
1094 | msgid "GNUnet GNS resolver tool" | 1094 | msgid "GNUnet GNS resolver tool" |
1095 | msgstr "" | 1095 | msgstr "" |
1096 | 1096 | ||
@@ -1605,7 +1605,11 @@ msgstr "" | |||
1605 | msgid "GNUnet NAT traversal autoconfigure daemon" | 1605 | msgid "GNUnet NAT traversal autoconfigure daemon" |
1606 | msgstr "" | 1606 | msgstr "" |
1607 | 1607 | ||
1608 | #: src/cli/nse/gnunet-nse.c:124 | 1608 | #: src/cli/nse/gnunet-nse.c:126 |
1609 | msgid "Monitor and output current estimates" | ||
1610 | msgstr "" | ||
1611 | |||
1612 | #: src/cli/nse/gnunet-nse.c:137 | ||
1609 | msgid "Show network size estimates from NSE service." | 1613 | msgid "Show network size estimates from NSE service." |
1610 | msgstr "" | 1614 | msgstr "" |
1611 | 1615 | ||
@@ -1653,86 +1657,90 @@ msgstr "" | |||
1653 | msgid "The time until the DID Document is going to expire (e.g. 5d)" | 1657 | msgid "The time until the DID Document is going to expire (e.g. 5d)" |
1654 | msgstr "" | 1658 | msgstr "" |
1655 | 1659 | ||
1656 | #: src/cli/reclaim/gnunet-reclaim.c:805 | 1660 | #: src/cli/reclaim/gnunet-reclaim.c:813 |
1657 | #, c-format | 1661 | #, c-format |
1658 | msgid "Ego is required\n" | 1662 | msgid "Ego is required\n" |
1659 | msgstr "" | 1663 | msgstr "" |
1660 | 1664 | ||
1661 | #: src/cli/reclaim/gnunet-reclaim.c:812 | 1665 | #: src/cli/reclaim/gnunet-reclaim.c:820 |
1662 | #, c-format | 1666 | #, c-format |
1663 | msgid "Attribute value missing!\n" | 1667 | msgid "Attribute value missing!\n" |
1664 | msgstr "" | 1668 | msgstr "" |
1665 | 1669 | ||
1666 | #: src/cli/reclaim/gnunet-reclaim.c:819 | 1670 | #: src/cli/reclaim/gnunet-reclaim.c:827 |
1667 | #, c-format | 1671 | #, c-format |
1668 | msgid "Requesting party key is required!\n" | 1672 | msgid "Requesting party key is required!\n" |
1669 | msgstr "" | 1673 | msgstr "" |
1670 | 1674 | ||
1671 | #: src/cli/reclaim/gnunet-reclaim.c:837 | 1675 | #: src/cli/reclaim/gnunet-reclaim.c:846 |
1672 | msgid "Add or update an attribute NAME" | 1676 | msgid "Add or update an attribute NAME" |
1673 | msgstr "" | 1677 | msgstr "" |
1674 | 1678 | ||
1675 | #: src/cli/reclaim/gnunet-reclaim.c:842 | 1679 | #: src/cli/reclaim/gnunet-reclaim.c:851 |
1676 | msgid "Delete the attribute with ID" | 1680 | msgid "Delete the attribute with ID" |
1677 | msgstr "" | 1681 | msgstr "" |
1678 | 1682 | ||
1679 | #: src/cli/reclaim/gnunet-reclaim.c:847 | 1683 | #: src/cli/reclaim/gnunet-reclaim.c:856 |
1680 | msgid "The attribute VALUE" | 1684 | msgid "The attribute VALUE" |
1681 | msgstr "" | 1685 | msgstr "" |
1682 | 1686 | ||
1683 | #: src/cli/reclaim/gnunet-reclaim.c:852 | 1687 | #: src/cli/reclaim/gnunet-reclaim.c:861 |
1684 | msgid "The EGO to use" | 1688 | msgid "The EGO to use" |
1685 | msgstr "" | 1689 | msgstr "" |
1686 | 1690 | ||
1687 | #: src/cli/reclaim/gnunet-reclaim.c:858 | 1691 | #: src/cli/reclaim/gnunet-reclaim.c:867 |
1688 | msgid "Specify the relying party for issue" | 1692 | msgid "Specify the relying party for issue" |
1689 | msgstr "" | 1693 | msgstr "" |
1690 | 1694 | ||
1691 | #: src/cli/reclaim/gnunet-reclaim.c:862 | 1695 | #: src/cli/reclaim/gnunet-reclaim.c:873 |
1696 | msgid "Specify the relying party URI for a ticket to consume" | ||
1697 | msgstr "" | ||
1698 | |||
1699 | #: src/cli/reclaim/gnunet-reclaim.c:877 | ||
1692 | msgid "List attributes for EGO" | 1700 | msgid "List attributes for EGO" |
1693 | msgstr "" | 1701 | msgstr "" |
1694 | 1702 | ||
1695 | #: src/cli/reclaim/gnunet-reclaim.c:866 | 1703 | #: src/cli/reclaim/gnunet-reclaim.c:881 |
1696 | msgid "List credentials for EGO" | 1704 | msgid "List credentials for EGO" |
1697 | msgstr "" | 1705 | msgstr "" |
1698 | 1706 | ||
1699 | #: src/cli/reclaim/gnunet-reclaim.c:872 | 1707 | #: src/cli/reclaim/gnunet-reclaim.c:887 |
1700 | msgid "Credential to use for attribute" | 1708 | msgid "Credential to use for attribute" |
1701 | msgstr "" | 1709 | msgstr "" |
1702 | 1710 | ||
1703 | #: src/cli/reclaim/gnunet-reclaim.c:877 | 1711 | #: src/cli/reclaim/gnunet-reclaim.c:892 |
1704 | msgid "Credential name" | 1712 | msgid "Credential name" |
1705 | msgstr "" | 1713 | msgstr "" |
1706 | 1714 | ||
1707 | #: src/cli/reclaim/gnunet-reclaim.c:883 | 1715 | #: src/cli/reclaim/gnunet-reclaim.c:898 |
1708 | msgid "Issue a ticket for a set of attributes separated by comma" | 1716 | msgid "Issue a ticket for a set of attributes separated by comma" |
1709 | msgstr "" | 1717 | msgstr "" |
1710 | 1718 | ||
1711 | #: src/cli/reclaim/gnunet-reclaim.c:888 | 1719 | #: src/cli/reclaim/gnunet-reclaim.c:903 |
1712 | msgid "Consume a ticket" | 1720 | msgid "Consume a ticket" |
1713 | msgstr "" | 1721 | msgstr "" |
1714 | 1722 | ||
1715 | #: src/cli/reclaim/gnunet-reclaim.c:893 | 1723 | #: src/cli/reclaim/gnunet-reclaim.c:908 |
1716 | msgid "Revoke a ticket" | 1724 | msgid "Revoke a ticket" |
1717 | msgstr "" | 1725 | msgstr "" |
1718 | 1726 | ||
1719 | #: src/cli/reclaim/gnunet-reclaim.c:898 | 1727 | #: src/cli/reclaim/gnunet-reclaim.c:913 |
1720 | msgid "Type of attribute" | 1728 | msgid "Type of attribute" |
1721 | msgstr "" | 1729 | msgstr "" |
1722 | 1730 | ||
1723 | #: src/cli/reclaim/gnunet-reclaim.c:903 | 1731 | #: src/cli/reclaim/gnunet-reclaim.c:918 |
1724 | msgid "Type of credential" | 1732 | msgid "Type of credential" |
1725 | msgstr "" | 1733 | msgstr "" |
1726 | 1734 | ||
1727 | #: src/cli/reclaim/gnunet-reclaim.c:907 | 1735 | #: src/cli/reclaim/gnunet-reclaim.c:922 |
1728 | msgid "List tickets of ego" | 1736 | msgid "List tickets of ego" |
1729 | msgstr "" | 1737 | msgstr "" |
1730 | 1738 | ||
1731 | #: src/cli/reclaim/gnunet-reclaim.c:913 | 1739 | #: src/cli/reclaim/gnunet-reclaim.c:928 |
1732 | msgid "Expiration interval of the attribute" | 1740 | msgid "Expiration interval of the attribute" |
1733 | msgstr "" | 1741 | msgstr "" |
1734 | 1742 | ||
1735 | #: src/cli/reclaim/gnunet-reclaim.c:921 | 1743 | #: src/cli/reclaim/gnunet-reclaim.c:936 |
1736 | msgid "re:claimID command line tool" | 1744 | msgid "re:claimID command line tool" |
1737 | msgstr "" | 1745 | msgstr "" |
1738 | 1746 | ||
@@ -1964,32 +1972,58 @@ msgstr "" | |||
1964 | msgid "run decoder modus, otherwise runs as encoder" | 1972 | msgid "run decoder modus, otherwise runs as encoder" |
1965 | msgstr "" | 1973 | msgstr "" |
1966 | 1974 | ||
1967 | #: src/cli/util/gnunet-config.c:154 | 1975 | #: src/cli/util/gnunet-config.c:101 |
1968 | msgid "test if the current installation supports the specified BACKEND" | 1976 | msgid "test if the current installation supports the specified BACKEND" |
1969 | msgstr "" | 1977 | msgstr "" |
1970 | 1978 | ||
1971 | #: src/cli/util/gnunet-config.c:160 | 1979 | #: src/cli/util/gnunet-config.c:107 |
1972 | msgid "" | 1980 | msgid "" |
1973 | "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 " |
1974 | "GNUnet" | 1982 | "GNUnet" |
1975 | msgstr "" | 1983 | msgstr "" |
1976 | 1984 | ||
1977 | #: src/cli/util/gnunet-config.c:165 | 1985 | #: src/cli/util/gnunet-config.c:112 |
1978 | msgid "Is this an experimental build of GNUnet" | 1986 | msgid "Is this an experimental build of GNUnet" |
1979 | msgstr "" | 1987 | msgstr "" |
1980 | 1988 | ||
1981 | #: src/cli/util/gnunet-config.c:171 | 1989 | #: src/cli/util/gnunet-config.c:118 |
1982 | msgid "" | 1990 | msgid "" |
1983 | "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 " |
1984 | "GNUnet" | 1992 | "GNUnet" |
1985 | msgstr "" | 1993 | msgstr "" |
1986 | 1994 | ||
1987 | #: src/cli/util/gnunet-config.c:177 | 1995 | #: src/cli/util/gnunet-config.c:123 |
1996 | #, fuzzy | ||
1997 | msgid "Do not parse default configuration files" | ||
1998 | msgstr "Résolution de « %s » échouée\n" | ||
1999 | |||
2000 | #: src/cli/util/gnunet-config.c:129 | ||
1988 | msgid "Provide the path under which GNUnet was installed" | 2001 | msgid "Provide the path under which GNUnet was installed" |
1989 | msgstr "" | 2002 | msgstr "" |
1990 | 2003 | ||
1991 | #: src/cli/util/gnunet-config.c:192 | 2004 | #: src/cli/util/gnunet-config.c:136 |
1992 | msgid "Manipulate GNUnet configuration files" | 2005 | msgid "" |
2006 | "Parse main configuration from this command-line argument and not from disk" | ||
2007 | msgstr "" | ||
2008 | |||
2009 | #: src/cli/util/gnunet-config.c:225 | ||
2010 | #, fuzzy | ||
2011 | msgid "Failed to load default configuration, exiting ...\n" | ||
2012 | msgstr "Résolution de « %s » échouée\n" | ||
2013 | |||
2014 | #: src/cli/util/gnunet-config.c:237 | ||
2015 | #, fuzzy | ||
2016 | msgid "Failed to parse configuration, exiting ...\n" | ||
2017 | msgstr "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 | ||
2021 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
2022 | msgstr "" | ||
2023 | |||
2024 | #: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299 | ||
2025 | #, c-format | ||
2026 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
1993 | msgstr "" | 2027 | msgstr "" |
1994 | 2028 | ||
1995 | #: src/cli/util/gnunet-crypto-tvg.c:1588 | 2029 | #: src/cli/util/gnunet-crypto-tvg.c:1588 |
@@ -2039,55 +2073,54 @@ msgstr "" | |||
2039 | msgid "Hostkeys file `%s' not found\n" | 2073 | msgid "Hostkeys file `%s' not found\n" |
2040 | msgstr "" | 2074 | msgstr "" |
2041 | 2075 | ||
2042 | #: src/cli/util/gnunet-ecc.c:314 | 2076 | #: src/cli/util/gnunet-ecc.c:318 |
2043 | #, c-format | 2077 | #, c-format |
2044 | msgid "Hostkeys file `%s' is empty\n" | 2078 | msgid "Hostkeys file `%s' is empty\n" |
2045 | msgstr "" | 2079 | msgstr "" |
2046 | 2080 | ||
2047 | #: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 | 2081 | #: src/cli/util/gnunet-ecc.c:324 |
2048 | #: src/service/testing/testing.c:308 | ||
2049 | #, c-format | 2082 | #, c-format |
2050 | msgid "Incorrect hostkey file format: %s\n" | 2083 | msgid "Incorrect hostkey file format: %s\n" |
2051 | msgstr "" | 2084 | msgstr "" |
2052 | 2085 | ||
2053 | #: src/cli/util/gnunet-ecc.c:334 | 2086 | #: src/cli/util/gnunet-ecc.c:340 |
2054 | #, c-format | 2087 | #, c-format |
2055 | msgid "Could not read hostkey file: %s\n" | 2088 | msgid "Could not read hostkey file: %s\n" |
2056 | msgstr "" | 2089 | msgstr "" |
2057 | 2090 | ||
2058 | #: src/cli/util/gnunet-ecc.c:388 | 2091 | #: src/cli/util/gnunet-ecc.c:394 |
2059 | msgid "No hostkey file specified on command line\n" | 2092 | msgid "No hostkey file specified on command line\n" |
2060 | msgstr "" | 2093 | msgstr "" |
2061 | 2094 | ||
2062 | #: src/cli/util/gnunet-ecc.c:452 | 2095 | #: src/cli/util/gnunet-ecc.c:458 |
2063 | msgid "list keys included in a file (for testing)" | 2096 | msgid "list keys included in a file (for testing)" |
2064 | msgstr "" | 2097 | msgstr "" |
2065 | 2098 | ||
2066 | #: src/cli/util/gnunet-ecc.c:458 | 2099 | #: src/cli/util/gnunet-ecc.c:464 |
2067 | msgid "number of keys to list included in a file (for testing)" | 2100 | msgid "number of keys to list included in a file (for testing)" |
2068 | msgstr "" | 2101 | msgstr "" |
2069 | 2102 | ||
2070 | #: src/cli/util/gnunet-ecc.c:464 | 2103 | #: src/cli/util/gnunet-ecc.c:470 |
2071 | msgid "create COUNT public-private key pairs (for testing)" | 2104 | msgid "create COUNT public-private key pairs (for testing)" |
2072 | msgstr "" | 2105 | msgstr "" |
2073 | 2106 | ||
2074 | #: src/cli/util/gnunet-ecc.c:469 | 2107 | #: src/cli/util/gnunet-ecc.c:475 |
2075 | msgid "print the public key in ASCII format" | 2108 | msgid "print the public key in ASCII format" |
2076 | msgstr "" | 2109 | msgstr "" |
2077 | 2110 | ||
2078 | #: src/cli/util/gnunet-ecc.c:474 | 2111 | #: src/cli/util/gnunet-ecc.c:480 |
2079 | msgid "print the private key in ASCII format" | 2112 | msgid "print the private key in ASCII format" |
2080 | msgstr "" | 2113 | msgstr "" |
2081 | 2114 | ||
2082 | #: src/cli/util/gnunet-ecc.c:479 | 2115 | #: src/cli/util/gnunet-ecc.c:485 |
2083 | msgid "print the public key in HEX format" | 2116 | msgid "print the public key in HEX format" |
2084 | msgstr "" | 2117 | msgstr "" |
2085 | 2118 | ||
2086 | #: src/cli/util/gnunet-ecc.c:485 | 2119 | #: src/cli/util/gnunet-ecc.c:491 |
2087 | msgid "print examples of ECC operations (used for compatibility testing)" | 2120 | msgid "print examples of ECC operations (used for compatibility testing)" |
2088 | msgstr "" | 2121 | msgstr "" |
2089 | 2122 | ||
2090 | #: src/cli/util/gnunet-ecc.c:499 | 2123 | #: src/cli/util/gnunet-ecc.c:505 |
2091 | msgid "Manipulate GNUnet private ECC key files" | 2124 | msgid "Manipulate GNUnet private ECC key files" |
2092 | msgstr "" | 2125 | msgstr "" |
2093 | 2126 | ||
@@ -3149,13 +3182,13 @@ msgstr "" | |||
3149 | msgid "Invalid handle type while writing `%s'" | 3182 | msgid "Invalid handle type while writing `%s'" |
3150 | msgstr "" | 3183 | msgstr "" |
3151 | 3184 | ||
3152 | #: 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 |
3153 | #: src/service/arm/gnunet-service-arm.c:452 | 3186 | #: src/service/arm/gnunet-service-arm.c:452 |
3154 | #, c-format | 3187 | #, c-format |
3155 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 3188 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
3156 | msgstr "" | 3189 | msgstr "" |
3157 | 3190 | ||
3158 | #: 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 |
3159 | #: src/service/arm/gnunet-service-arm.c:456 | 3192 | #: src/service/arm/gnunet-service-arm.c:456 |
3160 | #, c-format | 3193 | #, c-format |
3161 | msgid "Using `%s' instead\n" | 3194 | msgid "Using `%s' instead\n" |
@@ -3283,17 +3316,17 @@ msgstr "" | |||
3283 | msgid "`%s' failed at %s:%d with error: %s\n" | 3316 | msgid "`%s' failed at %s:%d with error: %s\n" |
3284 | msgstr "" | 3317 | msgstr "" |
3285 | 3318 | ||
3286 | #: src/lib/util/crypto_ecc.c:554 | 3319 | #: src/lib/util/crypto_ecc.c:569 |
3287 | #, c-format | 3320 | #, c-format |
3288 | msgid "ECC signing failed at %s:%d: %s\n" | 3321 | msgid "ECC signing failed at %s:%d: %s\n" |
3289 | msgstr "" | 3322 | msgstr "" |
3290 | 3323 | ||
3291 | #: src/lib/util/crypto_ecc.c:677 | 3324 | #: src/lib/util/crypto_ecc.c:692 |
3292 | #, c-format | 3325 | #, c-format |
3293 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 3326 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
3294 | msgstr "" | 3327 | msgstr "" |
3295 | 3328 | ||
3296 | #: 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 |
3297 | msgid "Could not load peer's private key\n" | 3330 | msgid "Could not load peer's private key\n" |
3298 | msgstr "" | 3331 | msgstr "" |
3299 | 3332 | ||
@@ -3317,7 +3350,7 @@ msgstr "" | |||
3317 | msgid "Expected `%s' to be a directory!\n" | 3350 | msgid "Expected `%s' to be a directory!\n" |
3318 | msgstr "" | 3351 | msgstr "" |
3319 | 3352 | ||
3320 | #: 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 |
3321 | #, c-format | 3354 | #, c-format |
3322 | msgid "Cannot obtain information about user `%s': %s\n" | 3355 | msgid "Cannot obtain information about user `%s': %s\n" |
3323 | msgstr "" | 3356 | msgstr "" |
@@ -3507,96 +3540,96 @@ msgstr "" | |||
3507 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 3540 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
3508 | msgstr "" | 3541 | msgstr "" |
3509 | 3542 | ||
3510 | #: src/lib/util/gnunet_error_codes.c:60 | 3543 | #: src/lib/util/gnunet_error_codes.c:59 |
3511 | msgid "No error (success)." | 3544 | msgid "No error (success)." |
3512 | msgstr "" | 3545 | msgstr "" |
3513 | 3546 | ||
3514 | #: src/lib/util/gnunet_error_codes.c:66 | 3547 | #: src/lib/util/gnunet_error_codes.c:65 |
3515 | #, fuzzy | 3548 | #, fuzzy |
3516 | msgid "Unknown and unspecified error." | 3549 | msgid "Unknown and unspecified error." |
3517 | msgstr "%.s Code d'erreur inconnu" | 3550 | msgstr "%.s Code d'erreur inconnu" |
3518 | 3551 | ||
3519 | #: src/lib/util/gnunet_error_codes.c:72 | 3552 | #: src/lib/util/gnunet_error_codes.c:71 |
3520 | msgid "Communication with service failed." | 3553 | msgid "Communication with service failed." |
3521 | msgstr "" | 3554 | msgstr "" |
3522 | 3555 | ||
3523 | #: src/lib/util/gnunet_error_codes.c:78 | 3556 | #: src/lib/util/gnunet_error_codes.c:77 |
3524 | #, fuzzy | 3557 | #, fuzzy |
3525 | msgid "Ego not found." | 3558 | msgid "Ego not found." |
3526 | msgstr "upnpc introuvable\n" | 3559 | msgstr "upnpc introuvable\n" |
3527 | 3560 | ||
3528 | #: src/lib/util/gnunet_error_codes.c:84 | 3561 | #: src/lib/util/gnunet_error_codes.c:83 |
3529 | msgid "Identifier already in use for another ego." | 3562 | msgid "Identifier already in use for another ego." |
3530 | msgstr "" | 3563 | msgstr "" |
3531 | 3564 | ||
3532 | #: src/lib/util/gnunet_error_codes.c:90 | 3565 | #: src/lib/util/gnunet_error_codes.c:89 |
3533 | msgid "The given ego is invalid or malformed." | 3566 | msgid "The given ego is invalid or malformed." |
3534 | msgstr "" | 3567 | msgstr "" |
3535 | 3568 | ||
3536 | #: src/lib/util/gnunet_error_codes.c:96 | 3569 | #: src/lib/util/gnunet_error_codes.c:95 |
3537 | #, fuzzy | 3570 | #, fuzzy |
3538 | msgid "Unknown namestore error." | 3571 | msgid "Unknown namestore error." |
3539 | msgstr "%.s Code d'erreur inconnu" | 3572 | msgstr "%.s Code d'erreur inconnu" |
3540 | 3573 | ||
3541 | #: 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 |
3542 | #, fuzzy | 3575 | #, fuzzy |
3543 | msgid "Zone iteration failed." | 3576 | msgid "Zone iteration failed." |
3544 | msgstr "# Session TCP active" | 3577 | msgstr "# Session TCP active" |
3545 | 3578 | ||
3546 | #: src/lib/util/gnunet_error_codes.c:108 | 3579 | #: src/lib/util/gnunet_error_codes.c:107 |
3547 | #, fuzzy | 3580 | #, fuzzy |
3548 | msgid "Zone not found." | 3581 | msgid "Zone not found." |
3549 | msgstr "upnpc introuvable\n" | 3582 | msgstr "upnpc introuvable\n" |
3550 | 3583 | ||
3551 | #: src/lib/util/gnunet_error_codes.c:114 | 3584 | #: src/lib/util/gnunet_error_codes.c:113 |
3552 | #, fuzzy | 3585 | #, fuzzy |
3553 | msgid "Record not found." | 3586 | msgid "Record not found." |
3554 | msgstr "upnpc introuvable\n" | 3587 | msgstr "upnpc introuvable\n" |
3555 | 3588 | ||
3556 | #: src/lib/util/gnunet_error_codes.c:126 | 3589 | #: src/lib/util/gnunet_error_codes.c:125 |
3557 | msgid "Zone does not contain any records." | 3590 | msgid "Zone does not contain any records." |
3558 | msgstr "" | 3591 | msgstr "" |
3559 | 3592 | ||
3560 | #: src/lib/util/gnunet_error_codes.c:132 | 3593 | #: src/lib/util/gnunet_error_codes.c:131 |
3561 | #, fuzzy | 3594 | #, fuzzy |
3562 | msgid "Failed to lookup record." | 3595 | msgid "Failed to lookup record." |
3563 | msgstr "Échec du démarrage de %s\n" | 3596 | msgstr "Échec du démarrage de %s\n" |
3564 | 3597 | ||
3565 | #: src/lib/util/gnunet_error_codes.c:138 | 3598 | #: src/lib/util/gnunet_error_codes.c:137 |
3566 | msgid "No records given." | 3599 | msgid "No records given." |
3567 | msgstr "" | 3600 | msgstr "" |
3568 | 3601 | ||
3569 | #: src/lib/util/gnunet_error_codes.c:144 | 3602 | #: src/lib/util/gnunet_error_codes.c:143 |
3570 | msgid "Record data invalid." | 3603 | msgid "Record data invalid." |
3571 | msgstr "" | 3604 | msgstr "" |
3572 | 3605 | ||
3573 | #: src/lib/util/gnunet_error_codes.c:150 | 3606 | #: src/lib/util/gnunet_error_codes.c:149 |
3574 | msgid "No label given." | 3607 | msgid "No label given." |
3575 | msgstr "" | 3608 | msgstr "" |
3576 | 3609 | ||
3577 | #: src/lib/util/gnunet_error_codes.c:156 | 3610 | #: src/lib/util/gnunet_error_codes.c:155 |
3578 | #, fuzzy | 3611 | #, fuzzy |
3579 | msgid "No results given." | 3612 | msgid "No results given." |
3580 | msgstr "# résultats introuvables" | 3613 | msgstr "# résultats introuvables" |
3581 | 3614 | ||
3582 | #: src/lib/util/gnunet_error_codes.c:162 | 3615 | #: src/lib/util/gnunet_error_codes.c:161 |
3583 | msgid "Record already exists." | 3616 | msgid "Record already exists." |
3584 | msgstr "" | 3617 | msgstr "" |
3585 | 3618 | ||
3586 | #: src/lib/util/gnunet_error_codes.c:168 | 3619 | #: src/lib/util/gnunet_error_codes.c:167 |
3587 | msgid "Record size exceeds maximum limit." | 3620 | msgid "Record size exceeds maximum limit." |
3588 | msgstr "" | 3621 | msgstr "" |
3589 | 3622 | ||
3590 | #: src/lib/util/gnunet_error_codes.c:174 | 3623 | #: src/lib/util/gnunet_error_codes.c:173 |
3591 | msgid "There was an error in the database backend." | 3624 | msgid "There was an error in the database backend." |
3592 | msgstr "" | 3625 | msgstr "" |
3593 | 3626 | ||
3594 | #: src/lib/util/gnunet_error_codes.c:180 | 3627 | #: src/lib/util/gnunet_error_codes.c:179 |
3595 | #, fuzzy | 3628 | #, fuzzy |
3596 | msgid "Failed to store the given records." | 3629 | msgid "Failed to store the given records." |
3597 | msgstr "Échec du démarrage de %s\n" | 3630 | msgstr "Échec du démarrage de %s\n" |
3598 | 3631 | ||
3599 | #: src/lib/util/gnunet_error_codes.c:186 | 3632 | #: src/lib/util/gnunet_error_codes.c:185 |
3600 | msgid "Label invalid or malformed." | 3633 | msgid "Label invalid or malformed." |
3601 | msgstr "" | 3634 | msgstr "" |
3602 | 3635 | ||
@@ -3662,16 +3695,6 @@ msgstr "" | |||
3662 | msgid "Could not determine plugin installation path.\n" | 3695 | msgid "Could not determine plugin installation path.\n" |
3663 | msgstr "" | 3696 | msgstr "" |
3664 | 3697 | ||
3665 | #: src/lib/util/program.c:287 | ||
3666 | #, c-format | ||
3667 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
3668 | msgstr "" | ||
3669 | |||
3670 | #: src/lib/util/program.c:299 | ||
3671 | #, c-format | ||
3672 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
3673 | msgstr "" | ||
3674 | |||
3675 | #: src/lib/util/program.c:314 | 3698 | #: src/lib/util/program.c:314 |
3676 | #, c-format | 3699 | #, c-format |
3677 | msgid "Unreadable configuration file `%s'. Exiting ...\n" | 3700 | msgid "Unreadable configuration file `%s'. Exiting ...\n" |
@@ -3719,120 +3742,120 @@ msgstr "" | |||
3719 | msgid "Could not resolve our FQDN: %s\n" | 3742 | msgid "Could not resolve our FQDN: %s\n" |
3720 | msgstr "Résolution de « %s » échouée : %s\n" | 3743 | msgstr "Résolution de « %s » échouée : %s\n" |
3721 | 3744 | ||
3722 | #: src/lib/util/service.c:654 | 3745 | #: src/lib/util/service.c:650 |
3723 | #, c-format | 3746 | #, c-format |
3724 | msgid "" | 3747 | msgid "" |
3725 | "Processing code for message of type %u did not call " | 3748 | "Processing code for message of type %u did not call " |
3726 | "`GNUNET_SERVICE_client_continue' after %s\n" | 3749 | "`GNUNET_SERVICE_client_continue' after %s\n" |
3727 | msgstr "" | 3750 | msgstr "" |
3728 | 3751 | ||
3729 | #: src/lib/util/service.c:838 | 3752 | #: src/lib/util/service.c:841 |
3730 | #, c-format | 3753 | #, c-format |
3731 | msgid "Unknown address family %d\n" | 3754 | msgid "Unknown address family %d\n" |
3732 | msgstr "" | 3755 | msgstr "" |
3733 | 3756 | ||
3734 | #: src/lib/util/service.c:951 | 3757 | #: src/lib/util/service.c:956 |
3735 | #, c-format | 3758 | #, c-format |
3736 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" | 3759 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" |
3737 | msgstr "" | 3760 | msgstr "" |
3738 | 3761 | ||
3739 | #: src/lib/util/service.c:992 | 3762 | #: src/lib/util/service.c:997 |
3740 | #, c-format | 3763 | #, c-format |
3741 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" | 3764 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" |
3742 | msgstr "" | 3765 | msgstr "" |
3743 | 3766 | ||
3744 | #: 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 |
3745 | #: src/service/arm/gnunet-service-arm.c:412 | 3768 | #: src/service/arm/gnunet-service-arm.c:412 |
3746 | #: src/service/arm/gnunet-service-arm.c:418 | 3769 | #: src/service/arm/gnunet-service-arm.c:418 |
3747 | #, c-format | 3770 | #, c-format |
3748 | msgid "Require valid port number for service `%s' in configuration!\n" | 3771 | msgid "Require valid port number for service `%s' in configuration!\n" |
3749 | msgstr "" | 3772 | msgstr "" |
3750 | 3773 | ||
3751 | #: 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 |
3752 | #, c-format | 3775 | #, c-format |
3753 | msgid "" | 3776 | msgid "" |
3754 | "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 " |
3755 | "domain socket: %s\n" | 3778 | "domain socket: %s\n" |
3756 | msgstr "" | 3779 | msgstr "" |
3757 | 3780 | ||
3758 | #: 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 |
3759 | #, c-format | 3782 | #, c-format |
3760 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | 3783 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" |
3761 | msgstr "" | 3784 | msgstr "" |
3762 | 3785 | ||
3763 | #: 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 |
3764 | #, c-format | 3787 | #, c-format |
3765 | msgid "Failed to resolve `%s': %s\n" | 3788 | msgid "Failed to resolve `%s': %s\n" |
3766 | msgstr "Résolution de « %s » échouée : %s\n" | 3789 | msgstr "Résolution de « %s » échouée : %s\n" |
3767 | 3790 | ||
3768 | #: 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 |
3769 | #, c-format | 3792 | #, c-format |
3770 | msgid "Failed to find %saddress for `%s'.\n" | 3793 | msgid "Failed to find %saddress for `%s'.\n" |
3771 | msgstr "" | 3794 | msgstr "" |
3772 | 3795 | ||
3773 | #: src/lib/util/service.c:1401 | 3796 | #: src/lib/util/service.c:1406 |
3774 | #, c-format | 3797 | #, c-format |
3775 | msgid "`%s' failed for port %d (%s).\n" | 3798 | msgid "`%s' failed for port %d (%s).\n" |
3776 | msgstr "" | 3799 | msgstr "" |
3777 | 3800 | ||
3778 | #: src/lib/util/service.c:1413 | 3801 | #: src/lib/util/service.c:1418 |
3779 | #, c-format | 3802 | #, c-format |
3780 | msgid "`%s' failed for port %d (%s): address already in use\n" | 3803 | msgid "`%s' failed for port %d (%s): address already in use\n" |
3781 | msgstr "" | 3804 | msgstr "" |
3782 | 3805 | ||
3783 | #: src/lib/util/service.c:1420 | 3806 | #: src/lib/util/service.c:1425 |
3784 | #, c-format | 3807 | #, c-format |
3785 | msgid "`%s' failed for `%s': address already in use\n" | 3808 | msgid "`%s' failed for `%s': address already in use\n" |
3786 | msgstr "" | 3809 | msgstr "" |
3787 | 3810 | ||
3788 | #: src/lib/util/service.c:1481 | 3811 | #: src/lib/util/service.c:1486 |
3789 | #, c-format | 3812 | #, c-format |
3790 | msgid "Specified value for `%s' of service `%s' is invalid\n" | 3813 | msgid "Specified value for `%s' of service `%s' is invalid\n" |
3791 | msgstr "" | 3814 | msgstr "" |
3792 | 3815 | ||
3793 | #: src/lib/util/service.c:1505 | 3816 | #: src/lib/util/service.c:1510 |
3794 | #, c-format | 3817 | #, c-format |
3795 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" | 3818 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" |
3796 | msgstr "" | 3819 | msgstr "" |
3797 | 3820 | ||
3798 | #: src/lib/util/service.c:1573 | 3821 | #: src/lib/util/service.c:1583 |
3799 | msgid "" | 3822 | msgid "" |
3800 | "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" |
3801 | msgstr "" | 3824 | msgstr "" |
3802 | 3825 | ||
3803 | #: src/lib/util/service.c:1644 | 3826 | #: src/lib/util/service.c:1653 |
3804 | msgid "No such user" | 3827 | msgid "No such user" |
3805 | msgstr "Aucun utilisateur trouvé" | 3828 | msgstr "Aucun utilisateur trouvé" |
3806 | 3829 | ||
3807 | #: src/lib/util/service.c:1658 | 3830 | #: src/lib/util/service.c:1668 |
3808 | #, c-format | 3831 | #, c-format |
3809 | msgid "Cannot change user/group to `%s': %s\n" | 3832 | msgid "Cannot change user/group to `%s': %s\n" |
3810 | msgstr "" | 3833 | msgstr "" |
3811 | 3834 | ||
3812 | #: src/lib/util/service.c:1751 | 3835 | #: src/lib/util/service.c:1767 |
3813 | msgid "Service process failed to initialize\n" | 3836 | msgid "Service process failed to initialize\n" |
3814 | msgstr "" | 3837 | msgstr "" |
3815 | 3838 | ||
3816 | #: src/lib/util/service.c:1756 | 3839 | #: src/lib/util/service.c:1772 |
3817 | msgid "Service process could not initialize server function\n" | 3840 | msgid "Service process could not initialize server function\n" |
3818 | msgstr "" | 3841 | msgstr "" |
3819 | 3842 | ||
3820 | #: src/lib/util/service.c:1761 | 3843 | #: src/lib/util/service.c:1777 |
3821 | msgid "Service process failed to report status\n" | 3844 | msgid "Service process failed to report status\n" |
3822 | msgstr "" | 3845 | msgstr "" |
3823 | 3846 | ||
3824 | #: 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 |
3825 | msgid "do daemonize (detach from terminal)" | 3848 | msgid "do daemonize (detach from terminal)" |
3826 | msgstr "" | 3849 | msgstr "" |
3827 | 3850 | ||
3828 | #: 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 |
3829 | #: 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 |
3830 | #: src/service/transport/transport-testing-communicator.c:1056 | 3853 | #: src/service/transport/transport-testing-communicator.c:1059 |
3831 | #, c-format | 3854 | #, c-format |
3832 | msgid "Malformed configuration file `%s', exit ...\n" | 3855 | msgid "Malformed configuration file `%s', exit ...\n" |
3833 | msgstr "" | 3856 | msgstr "" |
3834 | 3857 | ||
3835 | #: 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 |
3836 | msgid "Malformed configuration, exit ...\n" | 3859 | msgid "Malformed configuration, exit ...\n" |
3837 | msgstr "" | 3860 | msgstr "" |
3838 | 3861 | ||
@@ -4285,6 +4308,11 @@ msgstr "" | |||
4285 | msgid "Initiating shutdown as requested by client.\n" | 4308 | msgid "Initiating shutdown as requested by client.\n" |
4286 | msgstr "" | 4309 | msgstr "" |
4287 | 4310 | ||
4311 | #: src/service/arm/testing_arm_cmd_start_peer.c:197 | ||
4312 | #, c-format | ||
4313 | msgid "Failed to start `%s': %s\n" | ||
4314 | msgstr "" | ||
4315 | |||
4288 | #: src/service/core/gnunet-service-core.c:329 | 4316 | #: src/service/core/gnunet-service-core.c:329 |
4289 | msgid "# send requests dropped (disconnected)" | 4317 | msgid "# send requests dropped (disconnected)" |
4290 | msgstr "" | 4318 | msgstr "" |
@@ -4446,8 +4474,8 @@ msgstr "" | |||
4446 | #: src/service/core/gnunet-service-core_sessions.c:337 | 4474 | #: src/service/core/gnunet-service-core_sessions.c:337 |
4447 | #: src/service/fs/gnunet-service-fs_cp.c:484 | 4475 | #: src/service/fs/gnunet-service-fs_cp.c:484 |
4448 | #: src/service/fs/gnunet-service-fs_cp.c:1377 | 4476 | #: src/service/fs/gnunet-service-fs_cp.c:1377 |
4449 | #: src/service/topology/gnunet-daemon-topology.c:551 | 4477 | #: src/service/topology/gnunet-daemon-topology.c:545 |
4450 | #: src/service/topology/gnunet-daemon-topology.c:633 | 4478 | #: src/service/topology/gnunet-daemon-topology.c:627 |
4451 | msgid "# peers connected" | 4479 | msgid "# peers connected" |
4452 | msgstr "" | 4480 | msgstr "" |
4453 | 4481 | ||
@@ -5437,7 +5465,7 @@ msgstr "" | |||
5437 | 5465 | ||
5438 | #: src/service/fs/gnunet-service-fs.c:1271 | 5466 | #: src/service/fs/gnunet-service-fs.c:1271 |
5439 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 | 5467 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 |
5440 | #: src/service/topology/gnunet-daemon-topology.c:1066 | 5468 | #: src/service/topology/gnunet-daemon-topology.c:1062 |
5441 | #, c-format | 5469 | #, c-format |
5442 | msgid "Failed to connect to `%s' service.\n" | 5470 | msgid "Failed to connect to `%s' service.\n" |
5443 | msgstr "" | 5471 | msgstr "" |
@@ -6222,7 +6250,7 @@ msgid "# hostlist advertisements send" | |||
6222 | msgstr "" | 6250 | msgstr "" |
6223 | 6251 | ||
6224 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 | 6252 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 |
6225 | #: src/service/topology/gnunet-daemon-topology.c:786 | 6253 | #: src/service/topology/gnunet-daemon-topology.c:781 |
6226 | #, c-format | 6254 | #, c-format |
6227 | msgid "Error in communication with PEERSTORE service: %s\n" | 6255 | msgid "Error in communication with PEERSTORE service: %s\n" |
6228 | msgstr "" | 6256 | msgstr "" |
@@ -6476,11 +6504,11 @@ msgstr "" | |||
6476 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" | 6504 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
6477 | msgstr "" | 6505 | msgstr "" |
6478 | 6506 | ||
6479 | #: src/service/nat/gnunet-service-nat.c:1861 | 6507 | #: src/service/nat/gnunet-service-nat.c:1860 |
6480 | msgid "Connection reversal request failed\n" | 6508 | msgid "Connection reversal request failed\n" |
6481 | msgstr "" | 6509 | msgstr "" |
6482 | 6510 | ||
6483 | #: src/service/nat/gnunet-service-nat.c:1935 | 6511 | #: src/service/nat/gnunet-service-nat.c:1999 |
6484 | msgid "" | 6512 | msgid "" |
6485 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 6513 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
6486 | "disabling UPnP\n" | 6514 | "disabling UPnP\n" |
@@ -6504,41 +6532,41 @@ msgstr "" | |||
6504 | msgid "`upnpc' command not found\n" | 6532 | msgid "`upnpc' command not found\n" |
6505 | msgstr "" | 6533 | msgstr "" |
6506 | 6534 | ||
6507 | #: src/service/peerstore/gnunet-service-peerstore.c:1141 | 6535 | #: src/service/peerstore/gnunet-service-peerstore.c:1150 |
6508 | #, c-format | 6536 | #, c-format |
6509 | msgid "Failed to parse HELLO in file `%s': %s\n" | 6537 | msgid "Failed to parse HELLO in file `%s': %s\n" |
6510 | msgstr "" | 6538 | msgstr "" |
6511 | 6539 | ||
6512 | #: src/service/peerstore/gnunet-service-peerstore.c:1214 | 6540 | #: src/service/peerstore/gnunet-service-peerstore.c:1223 |
6513 | #, fuzzy, c-format | 6541 | #, fuzzy, c-format |
6514 | msgid "Could not load database backend `%s'\n" | 6542 | msgid "Could not load database backend `%s'\n" |
6515 | msgstr "Impossible d’ouvrir « %s ».\n" | 6543 | msgstr "Impossible d’ouvrir « %s ».\n" |
6516 | 6544 | ||
6517 | #: src/service/peerstore/gnunet-service-peerstore.c:1233 | 6545 | #: src/service/peerstore/gnunet-service-peerstore.c:1242 |
6518 | #, c-format | 6546 | #, c-format |
6519 | msgid "Importing HELLOs from `%s'\n" | 6547 | msgid "Importing HELLOs from `%s'\n" |
6520 | msgstr "" | 6548 | msgstr "" |
6521 | 6549 | ||
6522 | #: src/service/peerstore/gnunet-service-peerstore.c:1244 | 6550 | #: src/service/peerstore/gnunet-service-peerstore.c:1253 |
6523 | msgid "Skipping import of included HELLOs\n" | 6551 | msgid "Skipping import of included HELLOs\n" |
6524 | msgstr "" | 6552 | msgstr "" |
6525 | 6553 | ||
6526 | #: src/service/peerstore/peerstore_api.c:574 | 6554 | #: src/service/peerstore/peerstore_api.c:579 |
6527 | msgid "Unexpected store response.\n" | 6555 | msgid "Unexpected store response.\n" |
6528 | msgstr "" | 6556 | msgstr "" |
6529 | 6557 | ||
6530 | #: src/service/peerstore/peerstore_api.c:606 | 6558 | #: src/service/peerstore/peerstore_api.c:620 |
6531 | msgid "Unexpected iteration response.\n" | 6559 | msgid "Unexpected iteration response.\n" |
6532 | msgstr "" | 6560 | msgstr "" |
6533 | 6561 | ||
6534 | #: src/service/peerstore/peerstore_api.c:652 | 6562 | #: src/service/peerstore/peerstore_api.c:666 |
6535 | msgid "" | 6563 | msgid "" |
6536 | "Unexpected iteration response, no iterating client found, discarding " | 6564 | "Unexpected iteration response, no iterating client found, discarding " |
6537 | "message.\n" | 6565 | "message.\n" |
6538 | msgstr "" | 6566 | msgstr "" |
6539 | 6567 | ||
6540 | #: src/service/peerstore/peerstore_api.c:662 | 6568 | #: src/service/peerstore/peerstore_api.c:676 |
6541 | #: src/service/peerstore/peerstore_api_monitor.c:164 | 6569 | #: src/service/peerstore/peerstore_api_monitor.c:163 |
6542 | msgid "Received a malformed response from service." | 6570 | msgid "Received a malformed response from service." |
6543 | msgstr "" | 6571 | msgstr "" |
6544 | 6572 | ||
@@ -6696,11 +6724,11 @@ msgstr "" | |||
6696 | msgid "Namestore REST API initialized\n" | 6724 | msgid "Namestore REST API initialized\n" |
6697 | msgstr "" | 6725 | msgstr "" |
6698 | 6726 | ||
6699 | #: src/service/rest/openid_plugin.c:3102 | 6727 | #: src/service/rest/openid_plugin.c:3121 |
6700 | msgid "OpenID Connect REST API initialized\n" | 6728 | msgid "OpenID Connect REST API initialized\n" |
6701 | msgstr "" | 6729 | msgstr "" |
6702 | 6730 | ||
6703 | #: 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 |
6704 | msgid "Identity Provider REST API initialized\n" | 6732 | msgid "Identity Provider REST API initialized\n" |
6705 | msgstr "" | 6733 | msgstr "" |
6706 | 6734 | ||
@@ -6747,148 +6775,50 @@ msgstr "" | |||
6747 | msgid "Could not save some persistent statistics\n" | 6775 | msgid "Could not save some persistent statistics\n" |
6748 | msgstr "" | 6776 | msgstr "" |
6749 | 6777 | ||
6750 | #: src/service/testing/gnunet-testing.c:185 | 6778 | #: src/service/testbed/gnunet-testbed.c:196 |
6751 | #, c-format | 6779 | msgid "number of unique configuration files to create" |
6752 | msgid "Could not extract hostkey %u (offset too large?)\n" | ||
6753 | msgstr "" | ||
6754 | |||
6755 | #: src/service/testing/gnunet-testing.c:275 | ||
6756 | #, c-format | ||
6757 | msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n" | ||
6758 | msgstr "" | 6780 | msgstr "" |
6759 | 6781 | ||
6760 | #: src/service/testing/gnunet-testing.c:386 | 6782 | #: src/service/testbed/gnunet-testbed.c:202 |
6761 | msgid "create unique configuration files" | ||
6762 | msgstr "" | ||
6763 | |||
6764 | #: src/service/testing/gnunet-testing.c:392 | ||
6765 | msgid "extract hostkey file from pre-computed hostkey list" | ||
6766 | msgstr "" | ||
6767 | |||
6768 | #: src/service/testing/gnunet-testing.c:400 | ||
6769 | msgid "" | ||
6770 | "number of unique configuration files to create, or number of the hostkey to " | ||
6771 | "extract" | ||
6772 | msgstr "" | ||
6773 | |||
6774 | #: src/service/testing/gnunet-testing.c:407 | ||
6775 | msgid "configuration template" | 6783 | msgid "configuration template" |
6776 | msgstr "" | 6784 | msgstr "" |
6777 | 6785 | ||
6778 | #: src/service/testing/gnunet-testing.c:415 | 6786 | #: src/service/testbed/gnunet-testbed.c:218 |
6779 | msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)" | ||
6780 | msgstr "" | ||
6781 | |||
6782 | #: src/service/testing/gnunet-testing.c:432 | ||
6783 | msgid "Command line tool to access the testing library" | 6787 | msgid "Command line tool to access the testing library" |
6784 | msgstr "" | 6788 | msgstr "" |
6785 | 6789 | ||
6786 | #: src/service/testing/list-keys.c:92 | ||
6787 | msgid "list COUNT number of keys" | ||
6788 | msgstr "" | ||
6789 | |||
6790 | #: src/service/testing/testing.c:291 | ||
6791 | #, c-format | ||
6792 | msgid "Hostkeys file not found: %s\n" | ||
6793 | msgstr "" | ||
6794 | |||
6795 | #: src/service/testing/testing.c:743 | ||
6796 | #, c-format | ||
6797 | msgid "Key number %u does not exist\n" | ||
6798 | msgstr "" | ||
6799 | |||
6800 | #: src/service/testing/testing.c:1217 | ||
6801 | #, c-format | ||
6802 | msgid "" | ||
6803 | "You attempted to create a testbed with more than %u hosts. Please " | ||
6804 | "precompute more hostkeys first.\n" | ||
6805 | msgstr "" | ||
6806 | |||
6807 | #: src/service/testing/testing.c:1226 | ||
6808 | #, c-format | ||
6809 | msgid "Failed to initialize hostkey for peer %u\n" | ||
6810 | msgstr "" | ||
6811 | |||
6812 | #: src/service/testing/testing.c:1236 | ||
6813 | msgid "PRIVATE_KEY option in PEER section missing in configuration\n" | ||
6814 | msgstr "" | ||
6815 | |||
6816 | #: src/service/testing/testing.c:1249 | ||
6817 | msgid "Failed to create configuration for peer (not enough free ports?)\n" | ||
6818 | msgstr "" | ||
6819 | |||
6820 | #: src/service/testing/testing.c:1265 | ||
6821 | #, c-format | ||
6822 | msgid "Cannot open hostkey file `%s': %s\n" | ||
6823 | msgstr "" | ||
6824 | |||
6825 | #: src/service/testing/testing.c:1279 | ||
6826 | #, c-format | ||
6827 | msgid "Failed to write hostkey file for peer %u: %s\n" | ||
6828 | msgstr "" | ||
6829 | |||
6830 | #: src/service/testing/testing.c:1307 | ||
6831 | #, c-format | ||
6832 | msgid "Failed to write configuration file `%s' for peer %u: %s\n" | ||
6833 | msgstr "" | ||
6834 | |||
6835 | #: src/service/testing/testing.c:1413 | ||
6836 | #, c-format | ||
6837 | msgid "Failed to start `%s': %s\n" | ||
6838 | msgstr "" | ||
6839 | |||
6840 | #: src/service/testing/testing.c:1664 | ||
6841 | #, c-format | ||
6842 | msgid "Failed to load configuration from %s\n" | ||
6843 | msgstr "" | ||
6844 | |||
6845 | #: src/service/testing/testing.c:2795 | ||
6846 | #, c-format | ||
6847 | msgid "Topology file %s not found\n" | ||
6848 | msgstr "" | ||
6849 | |||
6850 | #: src/service/testing/testing.c:2803 | ||
6851 | #, c-format | ||
6852 | msgid "Topology file %s has no data\n" | ||
6853 | msgstr "" | ||
6854 | |||
6855 | #: src/service/testing/testing.c:2811 | ||
6856 | #, c-format | ||
6857 | msgid "Topology file %s cannot be read\n" | ||
6858 | msgstr "" | ||
6859 | |||
6860 | #: src/service/topology/gnunet-daemon-topology.c:286 | 6790 | #: src/service/topology/gnunet-daemon-topology.c:286 |
6861 | msgid "# connect requests issued to ATS" | 6791 | msgid "# connect requests issued to ATS" |
6862 | msgstr "" | 6792 | msgstr "" |
6863 | 6793 | ||
6864 | #: src/service/topology/gnunet-daemon-topology.c:480 | 6794 | #: src/service/topology/gnunet-daemon-topology.c:475 |
6865 | msgid "# HELLO messages gossipped" | 6795 | msgid "# HELLO messages gossipped" |
6866 | msgstr "" | 6796 | msgstr "" |
6867 | 6797 | ||
6868 | #: src/service/topology/gnunet-daemon-topology.c:752 | 6798 | #: src/service/topology/gnunet-daemon-topology.c:747 |
6869 | msgid "Error in communication with PEERSTORE service to monitor.\n" | 6799 | msgid "Error in communication with PEERSTORE service to monitor.\n" |
6870 | msgstr "" | 6800 | msgstr "" |
6871 | 6801 | ||
6872 | #: src/service/topology/gnunet-daemon-topology.c:761 | 6802 | #: src/service/topology/gnunet-daemon-topology.c:756 |
6873 | msgid "Finished initial PEERSTORE iteration in monitor.\n" | 6803 | msgid "Finished initial PEERSTORE iteration in monitor.\n" |
6874 | msgstr "" | 6804 | msgstr "" |
6875 | 6805 | ||
6876 | #: src/service/topology/gnunet-daemon-topology.c:869 | 6806 | #: src/service/topology/gnunet-daemon-topology.c:864 |
6877 | msgid "Failed to connect to core service, can not manage topology!\n" | 6807 | msgid "Failed to connect to core service, can not manage topology!\n" |
6878 | msgstr "" | 6808 | msgstr "" |
6879 | 6809 | ||
6880 | #: src/service/topology/gnunet-daemon-topology.c:943 | 6810 | #: src/service/topology/gnunet-daemon-topology.c:938 |
6881 | msgid "# HELLO messages received" | 6811 | msgid "# HELLO messages received" |
6882 | msgstr "" | 6812 | msgstr "" |
6883 | 6813 | ||
6884 | #: src/service/topology/gnunet-daemon-topology.c:1095 | 6814 | #: src/service/topology/gnunet-daemon-topology.c:1091 |
6885 | msgid "GNUnet topology control" | 6815 | msgid "GNUnet topology control" |
6886 | msgstr "" | 6816 | msgstr "" |
6887 | 6817 | ||
6888 | #: src/service/transport/gnunet-communicator-quic.c:1717 | 6818 | #: src/service/transport/gnunet-communicator-quic.c:1717 |
6889 | #: src/service/transport/gnunet-communicator-tcp.c:3814 | 6819 | #: src/service/transport/gnunet-communicator-tcp.c:3814 |
6890 | #: src/service/transport/gnunet-communicator-udp.c:3562 | 6820 | #: src/service/transport/gnunet-communicator-udp.c:3579 |
6891 | #: src/service/transport/gnunet-service-transport.c:12124 | 6821 | #: src/service/transport/gnunet-service-transport.c:12543 |
6892 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 6822 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
6893 | msgstr "" | 6823 | msgstr "" |
6894 | 6824 | ||
@@ -6900,7 +6830,7 @@ msgstr "" | |||
6900 | msgid "GNUnet TCP communicator" | 6830 | msgid "GNUnet TCP communicator" |
6901 | msgstr "" | 6831 | msgstr "" |
6902 | 6832 | ||
6903 | #: src/service/transport/gnunet-communicator-udp.c:3637 | 6833 | #: src/service/transport/gnunet-communicator-udp.c:3654 |
6904 | msgid "GNUnet UDP communicator" | 6834 | msgid "GNUnet UDP communicator" |
6905 | msgstr "" | 6835 | msgstr "" |
6906 | 6836 | ||
@@ -8,7 +8,7 @@ msgid "" | |||
8 | msgstr "" | 8 | msgstr "" |
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-15 09:19+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,24 +335,24 @@ msgstr "" | |||
335 | msgid "Failed to connect to CORE service!\n" | 335 | msgid "Failed to connect to CORE service!\n" |
336 | msgstr "" | 336 | msgstr "" |
337 | 337 | ||
338 | #: src/cli/core/gnunet-core.c:212 | 338 | #: src/cli/core/gnunet-core.c:213 |
339 | msgid "No argument given.\n" | 339 | msgid "No argument given.\n" |
340 | msgstr "" | 340 | msgstr "" |
341 | 341 | ||
342 | #: src/cli/core/gnunet-core.c:235 src/service/transport/gnunet-transport.c:1389 | 342 | #: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389 |
343 | msgid "provide information about all current connections (continuously)" | 343 | msgid "provide information about all current connections (continuously)" |
344 | msgstr "" | 344 | msgstr "" |
345 | 345 | ||
346 | #: src/cli/core/gnunet-core.c:241 | 346 | #: src/cli/core/gnunet-core.c:244 |
347 | msgid "Show our current peer identity" | 347 | msgid "Show our current peer identity" |
348 | msgstr "" | 348 | msgstr "" |
349 | 349 | ||
350 | #: src/cli/core/gnunet-core.c:248 | 350 | #: src/cli/core/gnunet-core.c:251 |
351 | #, fuzzy | 351 | #, fuzzy |
352 | msgid "Show current connections" | 352 | msgid "Show current connections" |
353 | msgstr "# connessioni attive" | 353 | msgstr "# connessioni attive" |
354 | 354 | ||
355 | #: src/cli/core/gnunet-core.c:259 | 355 | #: src/cli/core/gnunet-core.c:262 |
356 | msgid "Print information about connected peers." | 356 | msgid "Print information about connected peers." |
357 | msgstr "" | 357 | msgstr "" |
358 | 358 | ||
@@ -1047,52 +1047,52 @@ msgstr "" | |||
1047 | msgid "Unindex a file that was previously indexed with gnunet-publish." | 1047 | msgid "Unindex a file that was previously indexed with gnunet-publish." |
1048 | msgstr "" | 1048 | msgstr "" |
1049 | 1049 | ||
1050 | #: src/cli/gns/gnunet-gns.c:268 | 1050 | #: src/cli/gns/gnunet-gns.c:269 |
1051 | #, fuzzy, c-format | 1051 | #, fuzzy, c-format |
1052 | msgid "`%s' is not a valid DNS domain name\n" | 1052 | msgid "`%s' is not a valid DNS domain name\n" |
1053 | msgstr "`%s' non è un indirizzo IP valido.\n" | 1053 | msgstr "`%s' non è un indirizzo IP valido.\n" |
1054 | 1054 | ||
1055 | #: 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 |
1056 | #, c-format | 1056 | #, c-format |
1057 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" | 1057 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" |
1058 | msgstr "" | 1058 | msgstr "" |
1059 | 1059 | ||
1060 | #: src/cli/gns/gnunet-gns.c:294 | 1060 | #: src/cli/gns/gnunet-gns.c:295 |
1061 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" | 1061 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" |
1062 | msgstr "" | 1062 | msgstr "" |
1063 | 1063 | ||
1064 | #: src/cli/gns/gnunet-gns.c:305 | 1064 | #: src/cli/gns/gnunet-gns.c:306 |
1065 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 | 1065 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 |
1066 | #, c-format | 1066 | #, c-format |
1067 | msgid "Failed to connect to GNS\n" | 1067 | msgid "Failed to connect to GNS\n" |
1068 | msgstr "" | 1068 | msgstr "" |
1069 | 1069 | ||
1070 | #: src/cli/gns/gnunet-gns.c:318 | 1070 | #: src/cli/gns/gnunet-gns.c:325 |
1071 | #, c-format | 1071 | #, c-format |
1072 | msgid "Invalid typename specified, assuming `ANY'\n" | 1072 | msgid "Invalid typename specified, assuming `ANY'\n" |
1073 | msgstr "" | 1073 | msgstr "" |
1074 | 1074 | ||
1075 | #: src/cli/gns/gnunet-gns.c:358 | 1075 | #: src/cli/gns/gnunet-gns.c:365 |
1076 | msgid "Lookup a record for the given name" | 1076 | msgid "Lookup a record for the given name" |
1077 | msgstr "" | 1077 | msgstr "" |
1078 | 1078 | ||
1079 | #: src/cli/gns/gnunet-gns.c:364 | 1079 | #: src/cli/gns/gnunet-gns.c:371 |
1080 | msgid "Specify the type of the record to lookup" | 1080 | msgid "Specify the type of the record to lookup" |
1081 | msgstr "" | 1081 | msgstr "" |
1082 | 1082 | ||
1083 | #: src/cli/gns/gnunet-gns.c:370 | 1083 | #: src/cli/gns/gnunet-gns.c:377 |
1084 | msgid "Specify a timeout for the lookup" | 1084 | msgid "Specify a timeout for the lookup" |
1085 | msgstr "" | 1085 | msgstr "" |
1086 | 1086 | ||
1087 | #: src/cli/gns/gnunet-gns.c:374 | 1087 | #: src/cli/gns/gnunet-gns.c:381 |
1088 | msgid "No unneeded output" | 1088 | msgid "No unneeded output" |
1089 | msgstr "" | 1089 | msgstr "" |
1090 | 1090 | ||
1091 | #: src/cli/gns/gnunet-gns.c:379 | 1091 | #: src/cli/gns/gnunet-gns.c:386 |
1092 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" | 1092 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" |
1093 | msgstr "" | 1093 | msgstr "" |
1094 | 1094 | ||
1095 | #: src/cli/gns/gnunet-gns.c:393 | 1095 | #: src/cli/gns/gnunet-gns.c:400 |
1096 | msgid "GNUnet GNS resolver tool" | 1096 | msgid "GNUnet GNS resolver tool" |
1097 | msgstr "" | 1097 | msgstr "" |
1098 | 1098 | ||
@@ -1605,7 +1605,11 @@ msgstr "" | |||
1605 | msgid "GNUnet NAT traversal autoconfigure daemon" | 1605 | msgid "GNUnet NAT traversal autoconfigure daemon" |
1606 | msgstr "" | 1606 | msgstr "" |
1607 | 1607 | ||
1608 | #: src/cli/nse/gnunet-nse.c:124 | 1608 | #: src/cli/nse/gnunet-nse.c:126 |
1609 | msgid "Monitor and output current estimates" | ||
1610 | msgstr "" | ||
1611 | |||
1612 | #: src/cli/nse/gnunet-nse.c:137 | ||
1609 | msgid "Show network size estimates from NSE service." | 1613 | msgid "Show network size estimates from NSE service." |
1610 | msgstr "" | 1614 | msgstr "" |
1611 | 1615 | ||
@@ -1653,86 +1657,90 @@ msgstr "" | |||
1653 | msgid "The time until the DID Document is going to expire (e.g. 5d)" | 1657 | msgid "The time until the DID Document is going to expire (e.g. 5d)" |
1654 | msgstr "" | 1658 | msgstr "" |
1655 | 1659 | ||
1656 | #: src/cli/reclaim/gnunet-reclaim.c:805 | 1660 | #: src/cli/reclaim/gnunet-reclaim.c:813 |
1657 | #, c-format | 1661 | #, c-format |
1658 | msgid "Ego is required\n" | 1662 | msgid "Ego is required\n" |
1659 | msgstr "" | 1663 | msgstr "" |
1660 | 1664 | ||
1661 | #: src/cli/reclaim/gnunet-reclaim.c:812 | 1665 | #: src/cli/reclaim/gnunet-reclaim.c:820 |
1662 | #, c-format | 1666 | #, c-format |
1663 | msgid "Attribute value missing!\n" | 1667 | msgid "Attribute value missing!\n" |
1664 | msgstr "" | 1668 | msgstr "" |
1665 | 1669 | ||
1666 | #: src/cli/reclaim/gnunet-reclaim.c:819 | 1670 | #: src/cli/reclaim/gnunet-reclaim.c:827 |
1667 | #, c-format | 1671 | #, c-format |
1668 | msgid "Requesting party key is required!\n" | 1672 | msgid "Requesting party key is required!\n" |
1669 | msgstr "" | 1673 | msgstr "" |
1670 | 1674 | ||
1671 | #: src/cli/reclaim/gnunet-reclaim.c:837 | 1675 | #: src/cli/reclaim/gnunet-reclaim.c:846 |
1672 | msgid "Add or update an attribute NAME" | 1676 | msgid "Add or update an attribute NAME" |
1673 | msgstr "" | 1677 | msgstr "" |
1674 | 1678 | ||
1675 | #: src/cli/reclaim/gnunet-reclaim.c:842 | 1679 | #: src/cli/reclaim/gnunet-reclaim.c:851 |
1676 | msgid "Delete the attribute with ID" | 1680 | msgid "Delete the attribute with ID" |
1677 | msgstr "" | 1681 | msgstr "" |
1678 | 1682 | ||
1679 | #: src/cli/reclaim/gnunet-reclaim.c:847 | 1683 | #: src/cli/reclaim/gnunet-reclaim.c:856 |
1680 | msgid "The attribute VALUE" | 1684 | msgid "The attribute VALUE" |
1681 | msgstr "" | 1685 | msgstr "" |
1682 | 1686 | ||
1683 | #: src/cli/reclaim/gnunet-reclaim.c:852 | 1687 | #: src/cli/reclaim/gnunet-reclaim.c:861 |
1684 | msgid "The EGO to use" | 1688 | msgid "The EGO to use" |
1685 | msgstr "" | 1689 | msgstr "" |
1686 | 1690 | ||
1687 | #: src/cli/reclaim/gnunet-reclaim.c:858 | 1691 | #: src/cli/reclaim/gnunet-reclaim.c:867 |
1688 | msgid "Specify the relying party for issue" | 1692 | msgid "Specify the relying party for issue" |
1689 | msgstr "" | 1693 | msgstr "" |
1690 | 1694 | ||
1691 | #: src/cli/reclaim/gnunet-reclaim.c:862 | 1695 | #: src/cli/reclaim/gnunet-reclaim.c:873 |
1696 | msgid "Specify the relying party URI for a ticket to consume" | ||
1697 | msgstr "" | ||
1698 | |||
1699 | #: src/cli/reclaim/gnunet-reclaim.c:877 | ||
1692 | msgid "List attributes for EGO" | 1700 | msgid "List attributes for EGO" |
1693 | msgstr "" | 1701 | msgstr "" |
1694 | 1702 | ||
1695 | #: src/cli/reclaim/gnunet-reclaim.c:866 | 1703 | #: src/cli/reclaim/gnunet-reclaim.c:881 |
1696 | msgid "List credentials for EGO" | 1704 | msgid "List credentials for EGO" |
1697 | msgstr "" | 1705 | msgstr "" |
1698 | 1706 | ||
1699 | #: src/cli/reclaim/gnunet-reclaim.c:872 | 1707 | #: src/cli/reclaim/gnunet-reclaim.c:887 |
1700 | msgid "Credential to use for attribute" | 1708 | msgid "Credential to use for attribute" |
1701 | msgstr "" | 1709 | msgstr "" |
1702 | 1710 | ||
1703 | #: src/cli/reclaim/gnunet-reclaim.c:877 | 1711 | #: src/cli/reclaim/gnunet-reclaim.c:892 |
1704 | msgid "Credential name" | 1712 | msgid "Credential name" |
1705 | msgstr "" | 1713 | msgstr "" |
1706 | 1714 | ||
1707 | #: src/cli/reclaim/gnunet-reclaim.c:883 | 1715 | #: src/cli/reclaim/gnunet-reclaim.c:898 |
1708 | msgid "Issue a ticket for a set of attributes separated by comma" | 1716 | msgid "Issue a ticket for a set of attributes separated by comma" |
1709 | msgstr "" | 1717 | msgstr "" |
1710 | 1718 | ||
1711 | #: src/cli/reclaim/gnunet-reclaim.c:888 | 1719 | #: src/cli/reclaim/gnunet-reclaim.c:903 |
1712 | msgid "Consume a ticket" | 1720 | msgid "Consume a ticket" |
1713 | msgstr "" | 1721 | msgstr "" |
1714 | 1722 | ||
1715 | #: src/cli/reclaim/gnunet-reclaim.c:893 | 1723 | #: src/cli/reclaim/gnunet-reclaim.c:908 |
1716 | msgid "Revoke a ticket" | 1724 | msgid "Revoke a ticket" |
1717 | msgstr "" | 1725 | msgstr "" |
1718 | 1726 | ||
1719 | #: src/cli/reclaim/gnunet-reclaim.c:898 | 1727 | #: src/cli/reclaim/gnunet-reclaim.c:913 |
1720 | msgid "Type of attribute" | 1728 | msgid "Type of attribute" |
1721 | msgstr "" | 1729 | msgstr "" |
1722 | 1730 | ||
1723 | #: src/cli/reclaim/gnunet-reclaim.c:903 | 1731 | #: src/cli/reclaim/gnunet-reclaim.c:918 |
1724 | msgid "Type of credential" | 1732 | msgid "Type of credential" |
1725 | msgstr "" | 1733 | msgstr "" |
1726 | 1734 | ||
1727 | #: src/cli/reclaim/gnunet-reclaim.c:907 | 1735 | #: src/cli/reclaim/gnunet-reclaim.c:922 |
1728 | msgid "List tickets of ego" | 1736 | msgid "List tickets of ego" |
1729 | msgstr "" | 1737 | msgstr "" |
1730 | 1738 | ||
1731 | #: src/cli/reclaim/gnunet-reclaim.c:913 | 1739 | #: src/cli/reclaim/gnunet-reclaim.c:928 |
1732 | msgid "Expiration interval of the attribute" | 1740 | msgid "Expiration interval of the attribute" |
1733 | msgstr "" | 1741 | msgstr "" |
1734 | 1742 | ||
1735 | #: src/cli/reclaim/gnunet-reclaim.c:921 | 1743 | #: src/cli/reclaim/gnunet-reclaim.c:936 |
1736 | msgid "re:claimID command line tool" | 1744 | msgid "re:claimID command line tool" |
1737 | msgstr "" | 1745 | msgstr "" |
1738 | 1746 | ||
@@ -1964,34 +1972,60 @@ msgstr "" | |||
1964 | msgid "run decoder modus, otherwise runs as encoder" | 1972 | msgid "run decoder modus, otherwise runs as encoder" |
1965 | msgstr "" | 1973 | msgstr "" |
1966 | 1974 | ||
1967 | #: src/cli/util/gnunet-config.c:154 | 1975 | #: src/cli/util/gnunet-config.c:101 |
1968 | msgid "test if the current installation supports the specified BACKEND" | 1976 | msgid "test if the current installation supports the specified BACKEND" |
1969 | msgstr "" | 1977 | msgstr "" |
1970 | 1978 | ||
1971 | #: src/cli/util/gnunet-config.c:160 | 1979 | #: src/cli/util/gnunet-config.c:107 |
1972 | msgid "" | 1980 | msgid "" |
1973 | "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 " |
1974 | "GNUnet" | 1982 | "GNUnet" |
1975 | msgstr "" | 1983 | msgstr "" |
1976 | 1984 | ||
1977 | #: src/cli/util/gnunet-config.c:165 | 1985 | #: src/cli/util/gnunet-config.c:112 |
1978 | msgid "Is this an experimental build of GNUnet" | 1986 | msgid "Is this an experimental build of GNUnet" |
1979 | msgstr "" | 1987 | msgstr "" |
1980 | 1988 | ||
1981 | #: src/cli/util/gnunet-config.c:171 | 1989 | #: src/cli/util/gnunet-config.c:118 |
1982 | msgid "" | 1990 | msgid "" |
1983 | "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 " |
1984 | "GNUnet" | 1992 | "GNUnet" |
1985 | msgstr "" | 1993 | msgstr "" |
1986 | 1994 | ||
1987 | #: src/cli/util/gnunet-config.c:177 | 1995 | #: src/cli/util/gnunet-config.c:123 |
1996 | #, fuzzy | ||
1997 | msgid "Do not parse default configuration files" | ||
1998 | msgstr "Impossibile avviare il servizio ' %s'\n" | ||
1999 | |||
2000 | #: src/cli/util/gnunet-config.c:129 | ||
1988 | msgid "Provide the path under which GNUnet was installed" | 2001 | msgid "Provide the path under which GNUnet was installed" |
1989 | msgstr "" | 2002 | msgstr "" |
1990 | 2003 | ||
1991 | #: src/cli/util/gnunet-config.c:192 | 2004 | #: src/cli/util/gnunet-config.c:136 |
1992 | msgid "Manipulate GNUnet configuration files" | 2005 | msgid "" |
2006 | "Parse main configuration from this command-line argument and not from disk" | ||
1993 | msgstr "" | 2007 | msgstr "" |
1994 | 2008 | ||
2009 | #: src/cli/util/gnunet-config.c:225 | ||
2010 | #, fuzzy | ||
2011 | msgid "Failed to load default configuration, exiting ...\n" | ||
2012 | msgstr "Impossibile avviare il servizio ' %s'\n" | ||
2013 | |||
2014 | #: src/cli/util/gnunet-config.c:237 | ||
2015 | #, fuzzy | ||
2016 | msgid "Failed to parse configuration, exiting ...\n" | ||
2017 | msgstr "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 | ||
2021 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
2022 | msgstr "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 | ||
2026 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
2027 | msgstr "Impossibile avviare il servizio ' %s'\n" | ||
2028 | |||
1995 | #: src/cli/util/gnunet-crypto-tvg.c:1588 | 2029 | #: src/cli/util/gnunet-crypto-tvg.c:1588 |
1996 | msgid "verify a test vector from stdin" | 2030 | msgid "verify a test vector from stdin" |
1997 | msgstr "" | 2031 | msgstr "" |
@@ -2039,55 +2073,54 @@ msgstr "" | |||
2039 | msgid "Hostkeys file `%s' not found\n" | 2073 | msgid "Hostkeys file `%s' not found\n" |
2040 | msgstr "" | 2074 | msgstr "" |
2041 | 2075 | ||
2042 | #: src/cli/util/gnunet-ecc.c:314 | 2076 | #: src/cli/util/gnunet-ecc.c:318 |
2043 | #, c-format | 2077 | #, c-format |
2044 | msgid "Hostkeys file `%s' is empty\n" | 2078 | msgid "Hostkeys file `%s' is empty\n" |
2045 | msgstr "" | 2079 | msgstr "" |
2046 | 2080 | ||
2047 | #: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 | 2081 | #: src/cli/util/gnunet-ecc.c:324 |
2048 | #: src/service/testing/testing.c:308 | ||
2049 | #, c-format | 2082 | #, c-format |
2050 | msgid "Incorrect hostkey file format: %s\n" | 2083 | msgid "Incorrect hostkey file format: %s\n" |
2051 | msgstr "" | 2084 | msgstr "" |
2052 | 2085 | ||
2053 | #: src/cli/util/gnunet-ecc.c:334 | 2086 | #: src/cli/util/gnunet-ecc.c:340 |
2054 | #, c-format | 2087 | #, c-format |
2055 | msgid "Could not read hostkey file: %s\n" | 2088 | msgid "Could not read hostkey file: %s\n" |
2056 | msgstr "" | 2089 | msgstr "" |
2057 | 2090 | ||
2058 | #: src/cli/util/gnunet-ecc.c:388 | 2091 | #: src/cli/util/gnunet-ecc.c:394 |
2059 | msgid "No hostkey file specified on command line\n" | 2092 | msgid "No hostkey file specified on command line\n" |
2060 | msgstr "" | 2093 | msgstr "" |
2061 | 2094 | ||
2062 | #: src/cli/util/gnunet-ecc.c:452 | 2095 | #: src/cli/util/gnunet-ecc.c:458 |
2063 | msgid "list keys included in a file (for testing)" | 2096 | msgid "list keys included in a file (for testing)" |
2064 | msgstr "" | 2097 | msgstr "" |
2065 | 2098 | ||
2066 | #: src/cli/util/gnunet-ecc.c:458 | 2099 | #: src/cli/util/gnunet-ecc.c:464 |
2067 | msgid "number of keys to list included in a file (for testing)" | 2100 | msgid "number of keys to list included in a file (for testing)" |
2068 | msgstr "" | 2101 | msgstr "" |
2069 | 2102 | ||
2070 | #: src/cli/util/gnunet-ecc.c:464 | 2103 | #: src/cli/util/gnunet-ecc.c:470 |
2071 | msgid "create COUNT public-private key pairs (for testing)" | 2104 | msgid "create COUNT public-private key pairs (for testing)" |
2072 | msgstr "" | 2105 | msgstr "" |
2073 | 2106 | ||
2074 | #: src/cli/util/gnunet-ecc.c:469 | 2107 | #: src/cli/util/gnunet-ecc.c:475 |
2075 | msgid "print the public key in ASCII format" | 2108 | msgid "print the public key in ASCII format" |
2076 | msgstr "" | 2109 | msgstr "" |
2077 | 2110 | ||
2078 | #: src/cli/util/gnunet-ecc.c:474 | 2111 | #: src/cli/util/gnunet-ecc.c:480 |
2079 | msgid "print the private key in ASCII format" | 2112 | msgid "print the private key in ASCII format" |
2080 | msgstr "" | 2113 | msgstr "" |
2081 | 2114 | ||
2082 | #: src/cli/util/gnunet-ecc.c:479 | 2115 | #: src/cli/util/gnunet-ecc.c:485 |
2083 | msgid "print the public key in HEX format" | 2116 | msgid "print the public key in HEX format" |
2084 | msgstr "" | 2117 | msgstr "" |
2085 | 2118 | ||
2086 | #: src/cli/util/gnunet-ecc.c:485 | 2119 | #: src/cli/util/gnunet-ecc.c:491 |
2087 | msgid "print examples of ECC operations (used for compatibility testing)" | 2120 | msgid "print examples of ECC operations (used for compatibility testing)" |
2088 | msgstr "" | 2121 | msgstr "" |
2089 | 2122 | ||
2090 | #: src/cli/util/gnunet-ecc.c:499 | 2123 | #: src/cli/util/gnunet-ecc.c:505 |
2091 | msgid "Manipulate GNUnet private ECC key files" | 2124 | msgid "Manipulate GNUnet private ECC key files" |
2092 | msgstr "" | 2125 | msgstr "" |
2093 | 2126 | ||
@@ -3150,13 +3183,13 @@ msgstr "" | |||
3150 | msgid "Invalid handle type while writing `%s'" | 3183 | msgid "Invalid handle type while writing `%s'" |
3151 | msgstr "" | 3184 | msgstr "" |
3152 | 3185 | ||
3153 | #: 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 |
3154 | #: src/service/arm/gnunet-service-arm.c:452 | 3187 | #: src/service/arm/gnunet-service-arm.c:452 |
3155 | #, c-format | 3188 | #, c-format |
3156 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 3189 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
3157 | msgstr "" | 3190 | msgstr "" |
3158 | 3191 | ||
3159 | #: 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 |
3160 | #: src/service/arm/gnunet-service-arm.c:456 | 3193 | #: src/service/arm/gnunet-service-arm.c:456 |
3161 | #, c-format | 3194 | #, c-format |
3162 | msgid "Using `%s' instead\n" | 3195 | msgid "Using `%s' instead\n" |
@@ -3284,17 +3317,17 @@ msgstr "" | |||
3284 | msgid "`%s' failed at %s:%d with error: %s\n" | 3317 | msgid "`%s' failed at %s:%d with error: %s\n" |
3285 | msgstr "" | 3318 | msgstr "" |
3286 | 3319 | ||
3287 | #: src/lib/util/crypto_ecc.c:554 | 3320 | #: src/lib/util/crypto_ecc.c:569 |
3288 | #, c-format | 3321 | #, c-format |
3289 | msgid "ECC signing failed at %s:%d: %s\n" | 3322 | msgid "ECC signing failed at %s:%d: %s\n" |
3290 | msgstr "" | 3323 | msgstr "" |
3291 | 3324 | ||
3292 | #: src/lib/util/crypto_ecc.c:677 | 3325 | #: src/lib/util/crypto_ecc.c:692 |
3293 | #, c-format | 3326 | #, c-format |
3294 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 3327 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
3295 | msgstr "" | 3328 | msgstr "" |
3296 | 3329 | ||
3297 | #: 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 |
3298 | msgid "Could not load peer's private key\n" | 3331 | msgid "Could not load peer's private key\n" |
3299 | msgstr "" | 3332 | msgstr "" |
3300 | 3333 | ||
@@ -3318,7 +3351,7 @@ msgstr "" | |||
3318 | msgid "Expected `%s' to be a directory!\n" | 3351 | msgid "Expected `%s' to be a directory!\n" |
3319 | msgstr "" | 3352 | msgstr "" |
3320 | 3353 | ||
3321 | #: 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 |
3322 | #, c-format | 3355 | #, c-format |
3323 | msgid "Cannot obtain information about user `%s': %s\n" | 3356 | msgid "Cannot obtain information about user `%s': %s\n" |
3324 | msgstr "" | 3357 | msgstr "" |
@@ -3508,95 +3541,95 @@ msgstr "" | |||
3508 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 3541 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
3509 | msgstr "" | 3542 | msgstr "" |
3510 | 3543 | ||
3511 | #: src/lib/util/gnunet_error_codes.c:60 | 3544 | #: src/lib/util/gnunet_error_codes.c:59 |
3512 | msgid "No error (success)." | 3545 | msgid "No error (success)." |
3513 | msgstr "" | 3546 | msgstr "" |
3514 | 3547 | ||
3515 | #: src/lib/util/gnunet_error_codes.c:66 | 3548 | #: src/lib/util/gnunet_error_codes.c:65 |
3516 | #, fuzzy | 3549 | #, fuzzy |
3517 | msgid "Unknown and unspecified error." | 3550 | msgid "Unknown and unspecified error." |
3518 | msgstr "Comando `%s' sconosciuto.\n" | 3551 | msgstr "Comando `%s' sconosciuto.\n" |
3519 | 3552 | ||
3520 | #: src/lib/util/gnunet_error_codes.c:72 | 3553 | #: src/lib/util/gnunet_error_codes.c:71 |
3521 | msgid "Communication with service failed." | 3554 | msgid "Communication with service failed." |
3522 | msgstr "" | 3555 | msgstr "" |
3523 | 3556 | ||
3524 | #: src/lib/util/gnunet_error_codes.c:78 | 3557 | #: src/lib/util/gnunet_error_codes.c:77 |
3525 | #, fuzzy | 3558 | #, fuzzy |
3526 | msgid "Ego not found." | 3559 | msgid "Ego not found." |
3527 | msgstr "Contenuto non trovato" | 3560 | msgstr "Contenuto non trovato" |
3528 | 3561 | ||
3529 | #: src/lib/util/gnunet_error_codes.c:84 | 3562 | #: src/lib/util/gnunet_error_codes.c:83 |
3530 | msgid "Identifier already in use for another ego." | 3563 | msgid "Identifier already in use for another ego." |
3531 | msgstr "" | 3564 | msgstr "" |
3532 | 3565 | ||
3533 | #: src/lib/util/gnunet_error_codes.c:90 | 3566 | #: src/lib/util/gnunet_error_codes.c:89 |
3534 | msgid "The given ego is invalid or malformed." | 3567 | msgid "The given ego is invalid or malformed." |
3535 | msgstr "" | 3568 | msgstr "" |
3536 | 3569 | ||
3537 | #: src/lib/util/gnunet_error_codes.c:96 | 3570 | #: src/lib/util/gnunet_error_codes.c:95 |
3538 | #, fuzzy | 3571 | #, fuzzy |
3539 | msgid "Unknown namestore error." | 3572 | msgid "Unknown namestore error." |
3540 | msgstr "Comando `%s' sconosciuto.\n" | 3573 | msgstr "Comando `%s' sconosciuto.\n" |
3541 | 3574 | ||
3542 | #: 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 |
3543 | #, fuzzy | 3576 | #, fuzzy |
3544 | msgid "Zone iteration failed." | 3577 | msgid "Zone iteration failed." |
3545 | msgstr "# connessioni attive" | 3578 | msgstr "# connessioni attive" |
3546 | 3579 | ||
3547 | #: src/lib/util/gnunet_error_codes.c:108 | 3580 | #: src/lib/util/gnunet_error_codes.c:107 |
3548 | #, fuzzy | 3581 | #, fuzzy |
3549 | msgid "Zone not found." | 3582 | msgid "Zone not found." |
3550 | msgstr "Contenuto non trovato" | 3583 | msgstr "Contenuto non trovato" |
3551 | 3584 | ||
3552 | #: src/lib/util/gnunet_error_codes.c:114 | 3585 | #: src/lib/util/gnunet_error_codes.c:113 |
3553 | #, fuzzy | 3586 | #, fuzzy |
3554 | msgid "Record not found." | 3587 | msgid "Record not found." |
3555 | msgstr "upnpc non trovato\n" | 3588 | msgstr "upnpc non trovato\n" |
3556 | 3589 | ||
3557 | #: src/lib/util/gnunet_error_codes.c:126 | 3590 | #: src/lib/util/gnunet_error_codes.c:125 |
3558 | msgid "Zone does not contain any records." | 3591 | msgid "Zone does not contain any records." |
3559 | msgstr "" | 3592 | msgstr "" |
3560 | 3593 | ||
3561 | #: src/lib/util/gnunet_error_codes.c:132 | 3594 | #: src/lib/util/gnunet_error_codes.c:131 |
3562 | #, fuzzy | 3595 | #, fuzzy |
3563 | msgid "Failed to lookup record." | 3596 | msgid "Failed to lookup record." |
3564 | msgstr "Impossibile avviare il servizio.\n" | 3597 | msgstr "Impossibile avviare il servizio.\n" |
3565 | 3598 | ||
3566 | #: src/lib/util/gnunet_error_codes.c:138 | 3599 | #: src/lib/util/gnunet_error_codes.c:137 |
3567 | msgid "No records given." | 3600 | msgid "No records given." |
3568 | msgstr "" | 3601 | msgstr "" |
3569 | 3602 | ||
3570 | #: src/lib/util/gnunet_error_codes.c:144 | 3603 | #: src/lib/util/gnunet_error_codes.c:143 |
3571 | msgid "Record data invalid." | 3604 | msgid "Record data invalid." |
3572 | msgstr "" | 3605 | msgstr "" |
3573 | 3606 | ||
3574 | #: src/lib/util/gnunet_error_codes.c:150 | 3607 | #: src/lib/util/gnunet_error_codes.c:149 |
3575 | msgid "No label given." | 3608 | msgid "No label given." |
3576 | msgstr "" | 3609 | msgstr "" |
3577 | 3610 | ||
3578 | #: src/lib/util/gnunet_error_codes.c:156 | 3611 | #: src/lib/util/gnunet_error_codes.c:155 |
3579 | msgid "No results given." | 3612 | msgid "No results given." |
3580 | msgstr "" | 3613 | msgstr "" |
3581 | 3614 | ||
3582 | #: src/lib/util/gnunet_error_codes.c:162 | 3615 | #: src/lib/util/gnunet_error_codes.c:161 |
3583 | msgid "Record already exists." | 3616 | msgid "Record already exists." |
3584 | msgstr "" | 3617 | msgstr "" |
3585 | 3618 | ||
3586 | #: src/lib/util/gnunet_error_codes.c:168 | 3619 | #: src/lib/util/gnunet_error_codes.c:167 |
3587 | msgid "Record size exceeds maximum limit." | 3620 | msgid "Record size exceeds maximum limit." |
3588 | msgstr "" | 3621 | msgstr "" |
3589 | 3622 | ||
3590 | #: src/lib/util/gnunet_error_codes.c:174 | 3623 | #: src/lib/util/gnunet_error_codes.c:173 |
3591 | msgid "There was an error in the database backend." | 3624 | msgid "There was an error in the database backend." |
3592 | msgstr "" | 3625 | msgstr "" |
3593 | 3626 | ||
3594 | #: src/lib/util/gnunet_error_codes.c:180 | 3627 | #: src/lib/util/gnunet_error_codes.c:179 |
3595 | #, fuzzy | 3628 | #, fuzzy |
3596 | msgid "Failed to store the given records." | 3629 | msgid "Failed to store the given records." |
3597 | msgstr "Impossibile avviare il servizio.\n" | 3630 | msgstr "Impossibile avviare il servizio.\n" |
3598 | 3631 | ||
3599 | #: src/lib/util/gnunet_error_codes.c:186 | 3632 | #: src/lib/util/gnunet_error_codes.c:185 |
3600 | msgid "Label invalid or malformed." | 3633 | msgid "Label invalid or malformed." |
3601 | msgstr "" | 3634 | msgstr "" |
3602 | 3635 | ||
@@ -3662,16 +3695,6 @@ msgstr "" | |||
3662 | msgid "Could not determine plugin installation path.\n" | 3695 | msgid "Could not determine plugin installation path.\n" |
3663 | msgstr "" | 3696 | msgstr "" |
3664 | 3697 | ||
3665 | #: src/lib/util/program.c:287 | ||
3666 | #, fuzzy, c-format | ||
3667 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
3668 | msgstr "Impossibile avviare il servizio ' %s'\n" | ||
3669 | |||
3670 | #: src/lib/util/program.c:299 | ||
3671 | #, fuzzy, c-format | ||
3672 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
3673 | msgstr "Impossibile avviare il servizio ' %s'\n" | ||
3674 | |||
3675 | #: src/lib/util/program.c:314 | 3698 | #: src/lib/util/program.c:314 |
3676 | #, fuzzy, c-format | 3699 | #, fuzzy, c-format |
3677 | msgid "Unreadable configuration file `%s'. Exiting ...\n" | 3700 | msgid "Unreadable configuration file `%s'. Exiting ...\n" |
@@ -3720,120 +3743,120 @@ msgstr "" | |||
3720 | msgid "Could not resolve our FQDN: %s\n" | 3743 | msgid "Could not resolve our FQDN: %s\n" |
3721 | msgstr "" | 3744 | msgstr "" |
3722 | 3745 | ||
3723 | #: src/lib/util/service.c:654 | 3746 | #: src/lib/util/service.c:650 |
3724 | #, c-format | 3747 | #, c-format |
3725 | msgid "" | 3748 | msgid "" |
3726 | "Processing code for message of type %u did not call " | 3749 | "Processing code for message of type %u did not call " |
3727 | "`GNUNET_SERVICE_client_continue' after %s\n" | 3750 | "`GNUNET_SERVICE_client_continue' after %s\n" |
3728 | msgstr "" | 3751 | msgstr "" |
3729 | 3752 | ||
3730 | #: src/lib/util/service.c:838 | 3753 | #: src/lib/util/service.c:841 |
3731 | #, c-format | 3754 | #, c-format |
3732 | msgid "Unknown address family %d\n" | 3755 | msgid "Unknown address family %d\n" |
3733 | msgstr "" | 3756 | msgstr "" |
3734 | 3757 | ||
3735 | #: src/lib/util/service.c:951 | 3758 | #: src/lib/util/service.c:956 |
3736 | #, c-format | 3759 | #, c-format |
3737 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" | 3760 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" |
3738 | msgstr "" | 3761 | msgstr "" |
3739 | 3762 | ||
3740 | #: src/lib/util/service.c:992 | 3763 | #: src/lib/util/service.c:997 |
3741 | #, c-format | 3764 | #, c-format |
3742 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" | 3765 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" |
3743 | msgstr "" | 3766 | msgstr "" |
3744 | 3767 | ||
3745 | #: 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 |
3746 | #: src/service/arm/gnunet-service-arm.c:412 | 3769 | #: src/service/arm/gnunet-service-arm.c:412 |
3747 | #: src/service/arm/gnunet-service-arm.c:418 | 3770 | #: src/service/arm/gnunet-service-arm.c:418 |
3748 | #, c-format | 3771 | #, c-format |
3749 | msgid "Require valid port number for service `%s' in configuration!\n" | 3772 | msgid "Require valid port number for service `%s' in configuration!\n" |
3750 | msgstr "" | 3773 | msgstr "" |
3751 | 3774 | ||
3752 | #: 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 |
3753 | #, c-format | 3776 | #, c-format |
3754 | msgid "" | 3777 | msgid "" |
3755 | "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 " |
3756 | "domain socket: %s\n" | 3779 | "domain socket: %s\n" |
3757 | msgstr "" | 3780 | msgstr "" |
3758 | 3781 | ||
3759 | #: 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 |
3760 | #, c-format | 3783 | #, c-format |
3761 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | 3784 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" |
3762 | msgstr "" | 3785 | msgstr "" |
3763 | 3786 | ||
3764 | #: 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 |
3765 | #, c-format | 3788 | #, c-format |
3766 | msgid "Failed to resolve `%s': %s\n" | 3789 | msgid "Failed to resolve `%s': %s\n" |
3767 | msgstr "" | 3790 | msgstr "" |
3768 | 3791 | ||
3769 | #: 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 |
3770 | #, c-format | 3793 | #, c-format |
3771 | msgid "Failed to find %saddress for `%s'.\n" | 3794 | msgid "Failed to find %saddress for `%s'.\n" |
3772 | msgstr "" | 3795 | msgstr "" |
3773 | 3796 | ||
3774 | #: src/lib/util/service.c:1401 | 3797 | #: src/lib/util/service.c:1406 |
3775 | #, c-format | 3798 | #, c-format |
3776 | msgid "`%s' failed for port %d (%s).\n" | 3799 | msgid "`%s' failed for port %d (%s).\n" |
3777 | msgstr "" | 3800 | msgstr "" |
3778 | 3801 | ||
3779 | #: src/lib/util/service.c:1413 | 3802 | #: src/lib/util/service.c:1418 |
3780 | #, c-format | 3803 | #, c-format |
3781 | msgid "`%s' failed for port %d (%s): address already in use\n" | 3804 | msgid "`%s' failed for port %d (%s): address already in use\n" |
3782 | msgstr "" | 3805 | msgstr "" |
3783 | 3806 | ||
3784 | #: src/lib/util/service.c:1420 | 3807 | #: src/lib/util/service.c:1425 |
3785 | #, c-format | 3808 | #, c-format |
3786 | msgid "`%s' failed for `%s': address already in use\n" | 3809 | msgid "`%s' failed for `%s': address already in use\n" |
3787 | msgstr "" | 3810 | msgstr "" |
3788 | 3811 | ||
3789 | #: src/lib/util/service.c:1481 | 3812 | #: src/lib/util/service.c:1486 |
3790 | #, c-format | 3813 | #, c-format |
3791 | msgid "Specified value for `%s' of service `%s' is invalid\n" | 3814 | msgid "Specified value for `%s' of service `%s' is invalid\n" |
3792 | msgstr "" | 3815 | msgstr "" |
3793 | 3816 | ||
3794 | #: src/lib/util/service.c:1505 | 3817 | #: src/lib/util/service.c:1510 |
3795 | #, c-format | 3818 | #, c-format |
3796 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" | 3819 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" |
3797 | msgstr "" | 3820 | msgstr "" |
3798 | 3821 | ||
3799 | #: src/lib/util/service.c:1573 | 3822 | #: src/lib/util/service.c:1583 |
3800 | msgid "" | 3823 | msgid "" |
3801 | "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" |
3802 | msgstr "" | 3825 | msgstr "" |
3803 | 3826 | ||
3804 | #: src/lib/util/service.c:1644 | 3827 | #: src/lib/util/service.c:1653 |
3805 | msgid "No such user" | 3828 | msgid "No such user" |
3806 | msgstr "" | 3829 | msgstr "" |
3807 | 3830 | ||
3808 | #: src/lib/util/service.c:1658 | 3831 | #: src/lib/util/service.c:1668 |
3809 | #, c-format | 3832 | #, c-format |
3810 | msgid "Cannot change user/group to `%s': %s\n" | 3833 | msgid "Cannot change user/group to `%s': %s\n" |
3811 | msgstr "" | 3834 | msgstr "" |
3812 | 3835 | ||
3813 | #: src/lib/util/service.c:1751 | 3836 | #: src/lib/util/service.c:1767 |
3814 | msgid "Service process failed to initialize\n" | 3837 | msgid "Service process failed to initialize\n" |
3815 | msgstr "" | 3838 | msgstr "" |
3816 | 3839 | ||
3817 | #: src/lib/util/service.c:1756 | 3840 | #: src/lib/util/service.c:1772 |
3818 | msgid "Service process could not initialize server function\n" | 3841 | msgid "Service process could not initialize server function\n" |
3819 | msgstr "" | 3842 | msgstr "" |
3820 | 3843 | ||
3821 | #: src/lib/util/service.c:1761 | 3844 | #: src/lib/util/service.c:1777 |
3822 | msgid "Service process failed to report status\n" | 3845 | msgid "Service process failed to report status\n" |
3823 | msgstr "" | 3846 | msgstr "" |
3824 | 3847 | ||
3825 | #: 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 |
3826 | msgid "do daemonize (detach from terminal)" | 3849 | msgid "do daemonize (detach from terminal)" |
3827 | msgstr "" | 3850 | msgstr "" |
3828 | 3851 | ||
3829 | #: 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 |
3830 | #: 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 |
3831 | #: src/service/transport/transport-testing-communicator.c:1056 | 3854 | #: src/service/transport/transport-testing-communicator.c:1059 |
3832 | #, c-format | 3855 | #, c-format |
3833 | msgid "Malformed configuration file `%s', exit ...\n" | 3856 | msgid "Malformed configuration file `%s', exit ...\n" |
3834 | msgstr "" | 3857 | msgstr "" |
3835 | 3858 | ||
3836 | #: 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 |
3837 | msgid "Malformed configuration, exit ...\n" | 3860 | msgid "Malformed configuration, exit ...\n" |
3838 | msgstr "" | 3861 | msgstr "" |
3839 | 3862 | ||
@@ -4286,6 +4309,11 @@ msgstr "" | |||
4286 | msgid "Initiating shutdown as requested by client.\n" | 4309 | msgid "Initiating shutdown as requested by client.\n" |
4287 | msgstr "" | 4310 | msgstr "" |
4288 | 4311 | ||
4312 | #: src/service/arm/testing_arm_cmd_start_peer.c:197 | ||
4313 | #, c-format | ||
4314 | msgid "Failed to start `%s': %s\n" | ||
4315 | msgstr "" | ||
4316 | |||
4289 | #: src/service/core/gnunet-service-core.c:329 | 4317 | #: src/service/core/gnunet-service-core.c:329 |
4290 | msgid "# send requests dropped (disconnected)" | 4318 | msgid "# send requests dropped (disconnected)" |
4291 | msgstr "" | 4319 | msgstr "" |
@@ -4451,8 +4479,8 @@ msgstr "" | |||
4451 | #: src/service/core/gnunet-service-core_sessions.c:337 | 4479 | #: src/service/core/gnunet-service-core_sessions.c:337 |
4452 | #: src/service/fs/gnunet-service-fs_cp.c:484 | 4480 | #: src/service/fs/gnunet-service-fs_cp.c:484 |
4453 | #: src/service/fs/gnunet-service-fs_cp.c:1377 | 4481 | #: src/service/fs/gnunet-service-fs_cp.c:1377 |
4454 | #: src/service/topology/gnunet-daemon-topology.c:551 | 4482 | #: src/service/topology/gnunet-daemon-topology.c:545 |
4455 | #: src/service/topology/gnunet-daemon-topology.c:633 | 4483 | #: src/service/topology/gnunet-daemon-topology.c:627 |
4456 | msgid "# peers connected" | 4484 | msgid "# peers connected" |
4457 | msgstr "# nodi connessi" | 4485 | msgstr "# nodi connessi" |
4458 | 4486 | ||
@@ -5452,7 +5480,7 @@ msgstr "" | |||
5452 | 5480 | ||
5453 | #: src/service/fs/gnunet-service-fs.c:1271 | 5481 | #: src/service/fs/gnunet-service-fs.c:1271 |
5454 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 | 5482 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 |
5455 | #: src/service/topology/gnunet-daemon-topology.c:1066 | 5483 | #: src/service/topology/gnunet-daemon-topology.c:1062 |
5456 | #, c-format | 5484 | #, c-format |
5457 | msgid "Failed to connect to `%s' service.\n" | 5485 | msgid "Failed to connect to `%s' service.\n" |
5458 | msgstr "" | 5486 | msgstr "" |
@@ -6243,7 +6271,7 @@ msgid "# hostlist advertisements send" | |||
6243 | msgstr "" | 6271 | msgstr "" |
6244 | 6272 | ||
6245 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 | 6273 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 |
6246 | #: src/service/topology/gnunet-daemon-topology.c:786 | 6274 | #: src/service/topology/gnunet-daemon-topology.c:781 |
6247 | #, c-format | 6275 | #, c-format |
6248 | msgid "Error in communication with PEERSTORE service: %s\n" | 6276 | msgid "Error in communication with PEERSTORE service: %s\n" |
6249 | msgstr "" | 6277 | msgstr "" |
@@ -6500,11 +6528,11 @@ msgstr "" | |||
6500 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" | 6528 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
6501 | msgstr "" | 6529 | msgstr "" |
6502 | 6530 | ||
6503 | #: src/service/nat/gnunet-service-nat.c:1861 | 6531 | #: src/service/nat/gnunet-service-nat.c:1860 |
6504 | msgid "Connection reversal request failed\n" | 6532 | msgid "Connection reversal request failed\n" |
6505 | msgstr "" | 6533 | msgstr "" |
6506 | 6534 | ||
6507 | #: src/service/nat/gnunet-service-nat.c:1935 | 6535 | #: src/service/nat/gnunet-service-nat.c:1999 |
6508 | msgid "" | 6536 | msgid "" |
6509 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 6537 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
6510 | "disabling UPnP\n" | 6538 | "disabling UPnP\n" |
@@ -6528,41 +6556,41 @@ msgstr "" | |||
6528 | msgid "`upnpc' command not found\n" | 6556 | msgid "`upnpc' command not found\n" |
6529 | msgstr "" | 6557 | msgstr "" |
6530 | 6558 | ||
6531 | #: src/service/peerstore/gnunet-service-peerstore.c:1141 | 6559 | #: src/service/peerstore/gnunet-service-peerstore.c:1150 |
6532 | #, c-format | 6560 | #, c-format |
6533 | msgid "Failed to parse HELLO in file `%s': %s\n" | 6561 | msgid "Failed to parse HELLO in file `%s': %s\n" |
6534 | msgstr "" | 6562 | msgstr "" |
6535 | 6563 | ||
6536 | #: src/service/peerstore/gnunet-service-peerstore.c:1214 | 6564 | #: src/service/peerstore/gnunet-service-peerstore.c:1223 |
6537 | #, c-format | 6565 | #, c-format |
6538 | msgid "Could not load database backend `%s'\n" | 6566 | msgid "Could not load database backend `%s'\n" |
6539 | msgstr "" | 6567 | msgstr "" |
6540 | 6568 | ||
6541 | #: src/service/peerstore/gnunet-service-peerstore.c:1233 | 6569 | #: src/service/peerstore/gnunet-service-peerstore.c:1242 |
6542 | #, c-format | 6570 | #, c-format |
6543 | msgid "Importing HELLOs from `%s'\n" | 6571 | msgid "Importing HELLOs from `%s'\n" |
6544 | msgstr "" | 6572 | msgstr "" |
6545 | 6573 | ||
6546 | #: src/service/peerstore/gnunet-service-peerstore.c:1244 | 6574 | #: src/service/peerstore/gnunet-service-peerstore.c:1253 |
6547 | msgid "Skipping import of included HELLOs\n" | 6575 | msgid "Skipping import of included HELLOs\n" |
6548 | msgstr "" | 6576 | msgstr "" |
6549 | 6577 | ||
6550 | #: src/service/peerstore/peerstore_api.c:574 | 6578 | #: src/service/peerstore/peerstore_api.c:579 |
6551 | msgid "Unexpected store response.\n" | 6579 | msgid "Unexpected store response.\n" |
6552 | msgstr "" | 6580 | msgstr "" |
6553 | 6581 | ||
6554 | #: src/service/peerstore/peerstore_api.c:606 | 6582 | #: src/service/peerstore/peerstore_api.c:620 |
6555 | msgid "Unexpected iteration response.\n" | 6583 | msgid "Unexpected iteration response.\n" |
6556 | msgstr "" | 6584 | msgstr "" |
6557 | 6585 | ||
6558 | #: src/service/peerstore/peerstore_api.c:652 | 6586 | #: src/service/peerstore/peerstore_api.c:666 |
6559 | msgid "" | 6587 | msgid "" |
6560 | "Unexpected iteration response, no iterating client found, discarding " | 6588 | "Unexpected iteration response, no iterating client found, discarding " |
6561 | "message.\n" | 6589 | "message.\n" |
6562 | msgstr "" | 6590 | msgstr "" |
6563 | 6591 | ||
6564 | #: src/service/peerstore/peerstore_api.c:662 | 6592 | #: src/service/peerstore/peerstore_api.c:676 |
6565 | #: src/service/peerstore/peerstore_api_monitor.c:164 | 6593 | #: src/service/peerstore/peerstore_api_monitor.c:163 |
6566 | msgid "Received a malformed response from service." | 6594 | msgid "Received a malformed response from service." |
6567 | msgstr "" | 6595 | msgstr "" |
6568 | 6596 | ||
@@ -6721,11 +6749,11 @@ msgstr "" | |||
6721 | msgid "Namestore REST API initialized\n" | 6749 | msgid "Namestore REST API initialized\n" |
6722 | msgstr "" | 6750 | msgstr "" |
6723 | 6751 | ||
6724 | #: src/service/rest/openid_plugin.c:3102 | 6752 | #: src/service/rest/openid_plugin.c:3121 |
6725 | msgid "OpenID Connect REST API initialized\n" | 6753 | msgid "OpenID Connect REST API initialized\n" |
6726 | msgstr "" | 6754 | msgstr "" |
6727 | 6755 | ||
6728 | #: 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 |
6729 | msgid "Identity Provider REST API initialized\n" | 6757 | msgid "Identity Provider REST API initialized\n" |
6730 | msgstr "" | 6758 | msgstr "" |
6731 | 6759 | ||
@@ -6773,148 +6801,50 @@ msgstr "" | |||
6773 | msgid "Could not save some persistent statistics\n" | 6801 | msgid "Could not save some persistent statistics\n" |
6774 | msgstr "" | 6802 | msgstr "" |
6775 | 6803 | ||
6776 | #: src/service/testing/gnunet-testing.c:185 | 6804 | #: src/service/testbed/gnunet-testbed.c:196 |
6777 | #, c-format | 6805 | msgid "number of unique configuration files to create" |
6778 | msgid "Could not extract hostkey %u (offset too large?)\n" | ||
6779 | msgstr "" | ||
6780 | |||
6781 | #: src/service/testing/gnunet-testing.c:275 | ||
6782 | #, c-format | ||
6783 | msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n" | ||
6784 | msgstr "" | 6806 | msgstr "" |
6785 | 6807 | ||
6786 | #: src/service/testing/gnunet-testing.c:386 | 6808 | #: src/service/testbed/gnunet-testbed.c:202 |
6787 | msgid "create unique configuration files" | ||
6788 | msgstr "" | ||
6789 | |||
6790 | #: src/service/testing/gnunet-testing.c:392 | ||
6791 | msgid "extract hostkey file from pre-computed hostkey list" | ||
6792 | msgstr "" | ||
6793 | |||
6794 | #: src/service/testing/gnunet-testing.c:400 | ||
6795 | msgid "" | ||
6796 | "number of unique configuration files to create, or number of the hostkey to " | ||
6797 | "extract" | ||
6798 | msgstr "" | ||
6799 | |||
6800 | #: src/service/testing/gnunet-testing.c:407 | ||
6801 | msgid "configuration template" | 6809 | msgid "configuration template" |
6802 | msgstr "" | 6810 | msgstr "" |
6803 | 6811 | ||
6804 | #: src/service/testing/gnunet-testing.c:415 | 6812 | #: src/service/testbed/gnunet-testbed.c:218 |
6805 | msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)" | ||
6806 | msgstr "" | ||
6807 | |||
6808 | #: src/service/testing/gnunet-testing.c:432 | ||
6809 | msgid "Command line tool to access the testing library" | 6813 | msgid "Command line tool to access the testing library" |
6810 | msgstr "" | 6814 | msgstr "" |
6811 | 6815 | ||
6812 | #: src/service/testing/list-keys.c:92 | ||
6813 | msgid "list COUNT number of keys" | ||
6814 | msgstr "" | ||
6815 | |||
6816 | #: src/service/testing/testing.c:291 | ||
6817 | #, c-format | ||
6818 | msgid "Hostkeys file not found: %s\n" | ||
6819 | msgstr "" | ||
6820 | |||
6821 | #: src/service/testing/testing.c:743 | ||
6822 | #, c-format | ||
6823 | msgid "Key number %u does not exist\n" | ||
6824 | msgstr "" | ||
6825 | |||
6826 | #: src/service/testing/testing.c:1217 | ||
6827 | #, c-format | ||
6828 | msgid "" | ||
6829 | "You attempted to create a testbed with more than %u hosts. Please " | ||
6830 | "precompute more hostkeys first.\n" | ||
6831 | msgstr "" | ||
6832 | |||
6833 | #: src/service/testing/testing.c:1226 | ||
6834 | #, c-format | ||
6835 | msgid "Failed to initialize hostkey for peer %u\n" | ||
6836 | msgstr "" | ||
6837 | |||
6838 | #: src/service/testing/testing.c:1236 | ||
6839 | msgid "PRIVATE_KEY option in PEER section missing in configuration\n" | ||
6840 | msgstr "" | ||
6841 | |||
6842 | #: src/service/testing/testing.c:1249 | ||
6843 | msgid "Failed to create configuration for peer (not enough free ports?)\n" | ||
6844 | msgstr "" | ||
6845 | |||
6846 | #: src/service/testing/testing.c:1265 | ||
6847 | #, c-format | ||
6848 | msgid "Cannot open hostkey file `%s': %s\n" | ||
6849 | msgstr "" | ||
6850 | |||
6851 | #: src/service/testing/testing.c:1279 | ||
6852 | #, c-format | ||
6853 | msgid "Failed to write hostkey file for peer %u: %s\n" | ||
6854 | msgstr "" | ||
6855 | |||
6856 | #: src/service/testing/testing.c:1307 | ||
6857 | #, c-format | ||
6858 | msgid "Failed to write configuration file `%s' for peer %u: %s\n" | ||
6859 | msgstr "" | ||
6860 | |||
6861 | #: src/service/testing/testing.c:1413 | ||
6862 | #, c-format | ||
6863 | msgid "Failed to start `%s': %s\n" | ||
6864 | msgstr "" | ||
6865 | |||
6866 | #: src/service/testing/testing.c:1664 | ||
6867 | #, c-format | ||
6868 | msgid "Failed to load configuration from %s\n" | ||
6869 | msgstr "" | ||
6870 | |||
6871 | #: src/service/testing/testing.c:2795 | ||
6872 | #, c-format | ||
6873 | msgid "Topology file %s not found\n" | ||
6874 | msgstr "" | ||
6875 | |||
6876 | #: src/service/testing/testing.c:2803 | ||
6877 | #, c-format | ||
6878 | msgid "Topology file %s has no data\n" | ||
6879 | msgstr "" | ||
6880 | |||
6881 | #: src/service/testing/testing.c:2811 | ||
6882 | #, c-format | ||
6883 | msgid "Topology file %s cannot be read\n" | ||
6884 | msgstr "" | ||
6885 | |||
6886 | #: src/service/topology/gnunet-daemon-topology.c:286 | 6816 | #: src/service/topology/gnunet-daemon-topology.c:286 |
6887 | msgid "# connect requests issued to ATS" | 6817 | msgid "# connect requests issued to ATS" |
6888 | msgstr "" | 6818 | msgstr "" |
6889 | 6819 | ||
6890 | #: src/service/topology/gnunet-daemon-topology.c:480 | 6820 | #: src/service/topology/gnunet-daemon-topology.c:475 |
6891 | msgid "# HELLO messages gossipped" | 6821 | msgid "# HELLO messages gossipped" |
6892 | msgstr "" | 6822 | msgstr "" |
6893 | 6823 | ||
6894 | #: src/service/topology/gnunet-daemon-topology.c:752 | 6824 | #: src/service/topology/gnunet-daemon-topology.c:747 |
6895 | msgid "Error in communication with PEERSTORE service to monitor.\n" | 6825 | msgid "Error in communication with PEERSTORE service to monitor.\n" |
6896 | msgstr "" | 6826 | msgstr "" |
6897 | 6827 | ||
6898 | #: src/service/topology/gnunet-daemon-topology.c:761 | 6828 | #: src/service/topology/gnunet-daemon-topology.c:756 |
6899 | msgid "Finished initial PEERSTORE iteration in monitor.\n" | 6829 | msgid "Finished initial PEERSTORE iteration in monitor.\n" |
6900 | msgstr "" | 6830 | msgstr "" |
6901 | 6831 | ||
6902 | #: src/service/topology/gnunet-daemon-topology.c:869 | 6832 | #: src/service/topology/gnunet-daemon-topology.c:864 |
6903 | msgid "Failed to connect to core service, can not manage topology!\n" | 6833 | msgid "Failed to connect to core service, can not manage topology!\n" |
6904 | msgstr "" | 6834 | msgstr "" |
6905 | 6835 | ||
6906 | #: src/service/topology/gnunet-daemon-topology.c:943 | 6836 | #: src/service/topology/gnunet-daemon-topology.c:938 |
6907 | msgid "# HELLO messages received" | 6837 | msgid "# HELLO messages received" |
6908 | msgstr "" | 6838 | msgstr "" |
6909 | 6839 | ||
6910 | #: src/service/topology/gnunet-daemon-topology.c:1095 | 6840 | #: src/service/topology/gnunet-daemon-topology.c:1091 |
6911 | msgid "GNUnet topology control" | 6841 | msgid "GNUnet topology control" |
6912 | msgstr "" | 6842 | msgstr "" |
6913 | 6843 | ||
6914 | #: src/service/transport/gnunet-communicator-quic.c:1717 | 6844 | #: src/service/transport/gnunet-communicator-quic.c:1717 |
6915 | #: src/service/transport/gnunet-communicator-tcp.c:3814 | 6845 | #: src/service/transport/gnunet-communicator-tcp.c:3814 |
6916 | #: src/service/transport/gnunet-communicator-udp.c:3562 | 6846 | #: src/service/transport/gnunet-communicator-udp.c:3579 |
6917 | #: src/service/transport/gnunet-service-transport.c:12124 | 6847 | #: src/service/transport/gnunet-service-transport.c:12543 |
6918 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 6848 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
6919 | msgstr "" | 6849 | msgstr "" |
6920 | 6850 | ||
@@ -6926,7 +6856,7 @@ msgstr "" | |||
6926 | msgid "GNUnet TCP communicator" | 6856 | msgid "GNUnet TCP communicator" |
6927 | msgstr "" | 6857 | msgstr "" |
6928 | 6858 | ||
6929 | #: src/service/transport/gnunet-communicator-udp.c:3637 | 6859 | #: src/service/transport/gnunet-communicator-udp.c:3654 |
6930 | msgid "GNUnet UDP communicator" | 6860 | msgid "GNUnet UDP communicator" |
6931 | msgstr "" | 6861 | msgstr "" |
6932 | 6862 | ||
@@ -6,7 +6,7 @@ msgid "" | |||
6 | msgstr "" | 6 | msgstr "" |
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-15 09:19+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,26 +349,26 @@ msgstr "ÐиÑам уÑпео да обрадим идентитет парњаР| |||
349 | msgid "Failed to connect to CORE service!\n" | 349 | msgid "Failed to connect to CORE service!\n" |
350 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ЈЕЗГРЕÐОМ уÑлугом!\n" | 350 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ЈЕЗГРЕÐОМ уÑлугом!\n" |
351 | 351 | ||
352 | #: src/cli/core/gnunet-core.c:212 | 352 | #: src/cli/core/gnunet-core.c:213 |
353 | #, fuzzy | 353 | #, fuzzy |
354 | msgid "No argument given.\n" | 354 | msgid "No argument given.\n" |
355 | msgstr "ÐиÑу дате опције\n" | 355 | msgstr "ÐиÑу дате опције\n" |
356 | 356 | ||
357 | #: src/cli/core/gnunet-core.c:235 src/service/transport/gnunet-transport.c:1389 | 357 | #: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389 |
358 | msgid "provide information about all current connections (continuously)" | 358 | msgid "provide information about all current connections (continuously)" |
359 | msgstr "обезбеђује податке о Ñвим тренутним везама (непрекидно)" | 359 | msgstr "обезбеђује податке о Ñвим тренутним везама (непрекидно)" |
360 | 360 | ||
361 | #: src/cli/core/gnunet-core.c:241 | 361 | #: src/cli/core/gnunet-core.c:244 |
362 | #, fuzzy | 362 | #, fuzzy |
363 | msgid "Show our current peer identity" | 363 | msgid "Show our current peer identity" |
364 | msgstr "идентитет парњака" | 364 | msgstr "идентитет парњака" |
365 | 365 | ||
366 | #: src/cli/core/gnunet-core.c:248 | 366 | #: src/cli/core/gnunet-core.c:251 |
367 | #, fuzzy | 367 | #, fuzzy |
368 | msgid "Show current connections" | 368 | msgid "Show current connections" |
369 | msgstr "# активних веза" | 369 | msgstr "# активних веза" |
370 | 370 | ||
371 | #: src/cli/core/gnunet-core.c:259 | 371 | #: src/cli/core/gnunet-core.c:262 |
372 | msgid "Print information about connected peers." | 372 | msgid "Print information about connected peers." |
373 | msgstr "ИÑпиÑује податке о повезаним парњацима." | 373 | msgstr "ИÑпиÑује податке о повезаним парњацима." |
374 | 374 | ||
@@ -1098,53 +1098,53 @@ msgstr "" | |||
1098 | "Поништава индекÑирање датотеке која је претходно била индекÑирана Ñа „gnunet-" | 1098 | "Поништава индекÑирање датотеке која је претходно била индекÑирана Ñа „gnunet-" |
1099 | "publish“." | 1099 | "publish“." |
1100 | 1100 | ||
1101 | #: src/cli/gns/gnunet-gns.c:268 | 1101 | #: src/cli/gns/gnunet-gns.c:269 |
1102 | #, fuzzy, c-format | 1102 | #, fuzzy, c-format |
1103 | msgid "`%s' is not a valid DNS domain name\n" | 1103 | msgid "`%s' is not a valid DNS domain name\n" |
1104 | msgstr "„%s“ није иÑправна ИП адреÑа.\n" | 1104 | msgstr "„%s“ није иÑправна ИП адреÑа.\n" |
1105 | 1105 | ||
1106 | #: 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 |
1107 | #, c-format | 1107 | #, c-format |
1108 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" | 1108 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" |
1109 | msgstr "ÐиÑам уÑпео да претворим ДÐС ИДÐР„%s“ у УТФ-8: %s\n" | 1109 | msgstr "ÐиÑам уÑпео да претворим ДÐС ИДÐР„%s“ у УТФ-8: %s\n" |
1110 | 1110 | ||
1111 | #: src/cli/gns/gnunet-gns.c:294 | 1111 | #: src/cli/gns/gnunet-gns.c:295 |
1112 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" | 1112 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" |
1113 | msgstr "" | 1113 | msgstr "" |
1114 | 1114 | ||
1115 | #: src/cli/gns/gnunet-gns.c:305 | 1115 | #: src/cli/gns/gnunet-gns.c:306 |
1116 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 | 1116 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 |
1117 | #, c-format | 1117 | #, c-format |
1118 | msgid "Failed to connect to GNS\n" | 1118 | msgid "Failed to connect to GNS\n" |
1119 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ГÐС-ом\n" | 1119 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ГÐС-ом\n" |
1120 | 1120 | ||
1121 | #: src/cli/gns/gnunet-gns.c:318 | 1121 | #: src/cli/gns/gnunet-gns.c:325 |
1122 | #, c-format | 1122 | #, c-format |
1123 | msgid "Invalid typename specified, assuming `ANY'\n" | 1123 | msgid "Invalid typename specified, assuming `ANY'\n" |
1124 | msgstr "" | 1124 | msgstr "" |
1125 | 1125 | ||
1126 | #: src/cli/gns/gnunet-gns.c:358 | 1126 | #: src/cli/gns/gnunet-gns.c:365 |
1127 | msgid "Lookup a record for the given name" | 1127 | msgid "Lookup a record for the given name" |
1128 | msgstr "Претражује Ð·Ð°Ð¿Ð¸Ñ Ð·Ð° датим називом" | 1128 | msgstr "Претражује Ð·Ð°Ð¿Ð¸Ñ Ð·Ð° датим називом" |
1129 | 1129 | ||
1130 | #: src/cli/gns/gnunet-gns.c:364 | 1130 | #: src/cli/gns/gnunet-gns.c:371 |
1131 | msgid "Specify the type of the record to lookup" | 1131 | msgid "Specify the type of the record to lookup" |
1132 | msgstr "Ðаводи врÑту запиÑа за претраживање" | 1132 | msgstr "Ðаводи врÑту запиÑа за претраживање" |
1133 | 1133 | ||
1134 | #: src/cli/gns/gnunet-gns.c:370 | 1134 | #: src/cli/gns/gnunet-gns.c:377 |
1135 | #, fuzzy | 1135 | #, fuzzy |
1136 | msgid "Specify a timeout for the lookup" | 1136 | msgid "Specify a timeout for the lookup" |
1137 | msgstr "Ðаводи време иÑтека за претраживање" | 1137 | msgstr "Ðаводи време иÑтека за претраживање" |
1138 | 1138 | ||
1139 | #: src/cli/gns/gnunet-gns.c:374 | 1139 | #: src/cli/gns/gnunet-gns.c:381 |
1140 | msgid "No unneeded output" | 1140 | msgid "No unneeded output" |
1141 | msgstr "Ðема непотребног излаза" | 1141 | msgstr "Ðема непотребног излаза" |
1142 | 1142 | ||
1143 | #: src/cli/gns/gnunet-gns.c:379 | 1143 | #: src/cli/gns/gnunet-gns.c:386 |
1144 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" | 1144 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" |
1145 | msgstr "" | 1145 | msgstr "" |
1146 | 1146 | ||
1147 | #: src/cli/gns/gnunet-gns.c:393 | 1147 | #: src/cli/gns/gnunet-gns.c:400 |
1148 | msgid "GNUnet GNS resolver tool" | 1148 | msgid "GNUnet GNS resolver tool" |
1149 | msgstr "Ðлат ГÐУнет ГÐС решавача" | 1149 | msgstr "Ðлат ГÐУнет ГÐС решавача" |
1150 | 1150 | ||
@@ -1673,7 +1673,11 @@ msgstr "" | |||
1673 | msgid "GNUnet NAT traversal autoconfigure daemon" | 1673 | msgid "GNUnet NAT traversal autoconfigure daemon" |
1674 | msgstr "Демон помоћника теÑта ГÐУнет ÐÐТ попречника" | 1674 | msgstr "Демон помоћника теÑта ГÐУнет ÐÐТ попречника" |
1675 | 1675 | ||
1676 | #: src/cli/nse/gnunet-nse.c:124 | 1676 | #: src/cli/nse/gnunet-nse.c:126 |
1677 | msgid "Monitor and output current estimates" | ||
1678 | msgstr "" | ||
1679 | |||
1680 | #: src/cli/nse/gnunet-nse.c:137 | ||
1677 | msgid "Show network size estimates from NSE service." | 1681 | msgid "Show network size estimates from NSE service." |
1678 | msgstr "Показује процене величине мреже из ÐСЕ уÑлуге." | 1682 | msgstr "Показује процене величине мреже из ÐСЕ уÑлуге." |
1679 | 1683 | ||
@@ -1721,86 +1725,90 @@ msgstr "" | |||
1721 | msgid "The time until the DID Document is going to expire (e.g. 5d)" | 1725 | msgid "The time until the DID Document is going to expire (e.g. 5d)" |
1722 | msgstr "" | 1726 | msgstr "" |
1723 | 1727 | ||
1724 | #: src/cli/reclaim/gnunet-reclaim.c:805 | 1728 | #: src/cli/reclaim/gnunet-reclaim.c:813 |
1725 | #, fuzzy, c-format | 1729 | #, fuzzy, c-format |
1726 | msgid "Ego is required\n" | 1730 | msgid "Ego is required\n" |
1727 | msgstr "Потребна је иÑправна врÑта\n" | 1731 | msgstr "Потребна је иÑправна врÑта\n" |
1728 | 1732 | ||
1729 | #: src/cli/reclaim/gnunet-reclaim.c:812 | 1733 | #: src/cli/reclaim/gnunet-reclaim.c:820 |
1730 | #, c-format | 1734 | #, c-format |
1731 | msgid "Attribute value missing!\n" | 1735 | msgid "Attribute value missing!\n" |
1732 | msgstr "" | 1736 | msgstr "" |
1733 | 1737 | ||
1734 | #: src/cli/reclaim/gnunet-reclaim.c:819 | 1738 | #: src/cli/reclaim/gnunet-reclaim.c:827 |
1735 | #, fuzzy, c-format | 1739 | #, fuzzy, c-format |
1736 | msgid "Requesting party key is required!\n" | 1740 | msgid "Requesting party key is required!\n" |
1737 | msgstr "аргумент „--section“ је потребан\n" | 1741 | msgstr "аргумент „--section“ је потребан\n" |
1738 | 1742 | ||
1739 | #: src/cli/reclaim/gnunet-reclaim.c:837 | 1743 | #: src/cli/reclaim/gnunet-reclaim.c:846 |
1740 | msgid "Add or update an attribute NAME" | 1744 | msgid "Add or update an attribute NAME" |
1741 | msgstr "" | 1745 | msgstr "" |
1742 | 1746 | ||
1743 | #: src/cli/reclaim/gnunet-reclaim.c:842 | 1747 | #: src/cli/reclaim/gnunet-reclaim.c:851 |
1744 | msgid "Delete the attribute with ID" | 1748 | msgid "Delete the attribute with ID" |
1745 | msgstr "" | 1749 | msgstr "" |
1746 | 1750 | ||
1747 | #: src/cli/reclaim/gnunet-reclaim.c:847 | 1751 | #: src/cli/reclaim/gnunet-reclaim.c:856 |
1748 | msgid "The attribute VALUE" | 1752 | msgid "The attribute VALUE" |
1749 | msgstr "" | 1753 | msgstr "" |
1750 | 1754 | ||
1751 | #: src/cli/reclaim/gnunet-reclaim.c:852 | 1755 | #: src/cli/reclaim/gnunet-reclaim.c:861 |
1752 | msgid "The EGO to use" | 1756 | msgid "The EGO to use" |
1753 | msgstr "" | 1757 | msgstr "" |
1754 | 1758 | ||
1755 | #: src/cli/reclaim/gnunet-reclaim.c:858 | 1759 | #: src/cli/reclaim/gnunet-reclaim.c:867 |
1756 | msgid "Specify the relying party for issue" | 1760 | msgid "Specify the relying party for issue" |
1757 | msgstr "" | 1761 | msgstr "" |
1758 | 1762 | ||
1759 | #: src/cli/reclaim/gnunet-reclaim.c:862 | 1763 | #: src/cli/reclaim/gnunet-reclaim.c:873 |
1764 | msgid "Specify the relying party URI for a ticket to consume" | ||
1765 | msgstr "" | ||
1766 | |||
1767 | #: src/cli/reclaim/gnunet-reclaim.c:877 | ||
1760 | msgid "List attributes for EGO" | 1768 | msgid "List attributes for EGO" |
1761 | msgstr "" | 1769 | msgstr "" |
1762 | 1770 | ||
1763 | #: src/cli/reclaim/gnunet-reclaim.c:866 | 1771 | #: src/cli/reclaim/gnunet-reclaim.c:881 |
1764 | msgid "List credentials for EGO" | 1772 | msgid "List credentials for EGO" |
1765 | msgstr "" | 1773 | msgstr "" |
1766 | 1774 | ||
1767 | #: src/cli/reclaim/gnunet-reclaim.c:872 | 1775 | #: src/cli/reclaim/gnunet-reclaim.c:887 |
1768 | msgid "Credential to use for attribute" | 1776 | msgid "Credential to use for attribute" |
1769 | msgstr "" | 1777 | msgstr "" |
1770 | 1778 | ||
1771 | #: src/cli/reclaim/gnunet-reclaim.c:877 | 1779 | #: src/cli/reclaim/gnunet-reclaim.c:892 |
1772 | msgid "Credential name" | 1780 | msgid "Credential name" |
1773 | msgstr "" | 1781 | msgstr "" |
1774 | 1782 | ||
1775 | #: src/cli/reclaim/gnunet-reclaim.c:883 | 1783 | #: src/cli/reclaim/gnunet-reclaim.c:898 |
1776 | msgid "Issue a ticket for a set of attributes separated by comma" | 1784 | msgid "Issue a ticket for a set of attributes separated by comma" |
1777 | msgstr "" | 1785 | msgstr "" |
1778 | 1786 | ||
1779 | #: src/cli/reclaim/gnunet-reclaim.c:888 | 1787 | #: src/cli/reclaim/gnunet-reclaim.c:903 |
1780 | msgid "Consume a ticket" | 1788 | msgid "Consume a ticket" |
1781 | msgstr "" | 1789 | msgstr "" |
1782 | 1790 | ||
1783 | #: src/cli/reclaim/gnunet-reclaim.c:893 | 1791 | #: src/cli/reclaim/gnunet-reclaim.c:908 |
1784 | msgid "Revoke a ticket" | 1792 | msgid "Revoke a ticket" |
1785 | msgstr "" | 1793 | msgstr "" |
1786 | 1794 | ||
1787 | #: src/cli/reclaim/gnunet-reclaim.c:898 | 1795 | #: src/cli/reclaim/gnunet-reclaim.c:913 |
1788 | msgid "Type of attribute" | 1796 | msgid "Type of attribute" |
1789 | msgstr "" | 1797 | msgstr "" |
1790 | 1798 | ||
1791 | #: src/cli/reclaim/gnunet-reclaim.c:903 | 1799 | #: src/cli/reclaim/gnunet-reclaim.c:918 |
1792 | msgid "Type of credential" | 1800 | msgid "Type of credential" |
1793 | msgstr "" | 1801 | msgstr "" |
1794 | 1802 | ||
1795 | #: src/cli/reclaim/gnunet-reclaim.c:907 | 1803 | #: src/cli/reclaim/gnunet-reclaim.c:922 |
1796 | msgid "List tickets of ego" | 1804 | msgid "List tickets of ego" |
1797 | msgstr "" | 1805 | msgstr "" |
1798 | 1806 | ||
1799 | #: src/cli/reclaim/gnunet-reclaim.c:913 | 1807 | #: src/cli/reclaim/gnunet-reclaim.c:928 |
1800 | msgid "Expiration interval of the attribute" | 1808 | msgid "Expiration interval of the attribute" |
1801 | msgstr "" | 1809 | msgstr "" |
1802 | 1810 | ||
1803 | #: src/cli/reclaim/gnunet-reclaim.c:921 | 1811 | #: src/cli/reclaim/gnunet-reclaim.c:936 |
1804 | msgid "re:claimID command line tool" | 1812 | msgid "re:claimID command line tool" |
1805 | msgstr "" | 1813 | msgstr "" |
1806 | 1814 | ||
@@ -2035,33 +2043,59 @@ msgstr "ИÑпиÑује ÑтатиÑтику о ГÐУнет радњама." | |||
2035 | msgid "run decoder modus, otherwise runs as encoder" | 2043 | msgid "run decoder modus, otherwise runs as encoder" |
2036 | msgstr "" | 2044 | msgstr "" |
2037 | 2045 | ||
2038 | #: src/cli/util/gnunet-config.c:154 | 2046 | #: src/cli/util/gnunet-config.c:101 |
2039 | msgid "test if the current installation supports the specified BACKEND" | 2047 | msgid "test if the current installation supports the specified BACKEND" |
2040 | msgstr "" | 2048 | msgstr "" |
2041 | 2049 | ||
2042 | #: src/cli/util/gnunet-config.c:160 | 2050 | #: src/cli/util/gnunet-config.c:107 |
2043 | msgid "" | 2051 | msgid "" |
2044 | "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 " |
2045 | "GNUnet" | 2053 | "GNUnet" |
2046 | msgstr "" | 2054 | msgstr "" |
2047 | 2055 | ||
2048 | #: src/cli/util/gnunet-config.c:165 | 2056 | #: src/cli/util/gnunet-config.c:112 |
2049 | msgid "Is this an experimental build of GNUnet" | 2057 | msgid "Is this an experimental build of GNUnet" |
2050 | msgstr "" | 2058 | msgstr "" |
2051 | 2059 | ||
2052 | #: src/cli/util/gnunet-config.c:171 | 2060 | #: src/cli/util/gnunet-config.c:118 |
2053 | msgid "" | 2061 | msgid "" |
2054 | "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 " |
2055 | "GNUnet" | 2063 | "GNUnet" |
2056 | msgstr "" | 2064 | msgstr "" |
2057 | 2065 | ||
2058 | #: src/cli/util/gnunet-config.c:177 | 2066 | #: src/cli/util/gnunet-config.c:123 |
2067 | #, fuzzy | ||
2068 | msgid "Do not parse default configuration files" | ||
2069 | msgstr "Управља ГÐУнет датотекама подешавања" | ||
2070 | |||
2071 | #: src/cli/util/gnunet-config.c:129 | ||
2059 | msgid "Provide the path under which GNUnet was installed" | 2072 | msgid "Provide the path under which GNUnet was installed" |
2060 | msgstr "" | 2073 | msgstr "" |
2061 | 2074 | ||
2062 | #: src/cli/util/gnunet-config.c:192 | 2075 | #: src/cli/util/gnunet-config.c:136 |
2063 | msgid "Manipulate GNUnet configuration files" | 2076 | msgid "" |
2064 | msgstr "Управља ГÐУнет датотекама подешавања" | 2077 | "Parse main configuration from this command-line argument and not from disk" |
2078 | msgstr "" | ||
2079 | |||
2080 | #: src/cli/util/gnunet-config.c:225 | ||
2081 | #, fuzzy | ||
2082 | msgid "Failed to load default configuration, exiting ...\n" | ||
2083 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" | ||
2084 | |||
2085 | #: src/cli/util/gnunet-config.c:237 | ||
2086 | #, fuzzy | ||
2087 | msgid "Failed to parse configuration, exiting ...\n" | ||
2088 | msgstr "ÐиÑам уÑпео да уклоним датотеку подешавања „%s“\n" | ||
2089 | |||
2090 | #: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287 | ||
2091 | #, fuzzy, c-format | ||
2092 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
2093 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" | ||
2094 | |||
2095 | #: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299 | ||
2096 | #, fuzzy, c-format | ||
2097 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
2098 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" | ||
2065 | 2099 | ||
2066 | #: src/cli/util/gnunet-crypto-tvg.c:1588 | 2100 | #: src/cli/util/gnunet-crypto-tvg.c:1588 |
2067 | msgid "verify a test vector from stdin" | 2101 | msgid "verify a test vector from stdin" |
@@ -2114,57 +2148,56 @@ msgstr "" | |||
2114 | msgid "Hostkeys file `%s' not found\n" | 2148 | msgid "Hostkeys file `%s' not found\n" |
2115 | msgstr "ÐиÑам нашао датотеку кључа домаћина „%s“\n" | 2149 | msgstr "ÐиÑам нашао датотеку кључа домаћина „%s“\n" |
2116 | 2150 | ||
2117 | #: src/cli/util/gnunet-ecc.c:314 | 2151 | #: src/cli/util/gnunet-ecc.c:318 |
2118 | #, c-format | 2152 | #, c-format |
2119 | msgid "Hostkeys file `%s' is empty\n" | 2153 | msgid "Hostkeys file `%s' is empty\n" |
2120 | msgstr "Датотека кључа домаћина „%s“ је празна\n" | 2154 | msgstr "Датотека кључа домаћина „%s“ је празна\n" |
2121 | 2155 | ||
2122 | #: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 | 2156 | #: src/cli/util/gnunet-ecc.c:324 |
2123 | #: src/service/testing/testing.c:308 | ||
2124 | #, c-format | 2157 | #, c-format |
2125 | msgid "Incorrect hostkey file format: %s\n" | 2158 | msgid "Incorrect hostkey file format: %s\n" |
2126 | msgstr "Ðетачан формат датотеке кључа домаћина: %s\n" | 2159 | msgstr "Ðетачан формат датотеке кључа домаћина: %s\n" |
2127 | 2160 | ||
2128 | #: src/cli/util/gnunet-ecc.c:334 | 2161 | #: src/cli/util/gnunet-ecc.c:340 |
2129 | #, c-format | 2162 | #, c-format |
2130 | msgid "Could not read hostkey file: %s\n" | 2163 | msgid "Could not read hostkey file: %s\n" |
2131 | msgstr "Ðе могу да прочитам датотеку кључа домаћина: %s\n" | 2164 | msgstr "Ðе могу да прочитам датотеку кључа домаћина: %s\n" |
2132 | 2165 | ||
2133 | #: src/cli/util/gnunet-ecc.c:388 | 2166 | #: src/cli/util/gnunet-ecc.c:394 |
2134 | msgid "No hostkey file specified on command line\n" | 2167 | msgid "No hostkey file specified on command line\n" |
2135 | msgstr "Ðије наведена датотека кључа домаћина на линији наредби\n" | 2168 | msgstr "Ðије наведена датотека кључа домаћина на линији наредби\n" |
2136 | 2169 | ||
2137 | #: src/cli/util/gnunet-ecc.c:452 | 2170 | #: src/cli/util/gnunet-ecc.c:458 |
2138 | msgid "list keys included in a file (for testing)" | 2171 | msgid "list keys included in a file (for testing)" |
2139 | msgstr "иÑпиÑује кључеве укључене у датотеци (за теÑтирање)" | 2172 | msgstr "иÑпиÑује кључеве укључене у датотеци (за теÑтирање)" |
2140 | 2173 | ||
2141 | #: src/cli/util/gnunet-ecc.c:458 | 2174 | #: src/cli/util/gnunet-ecc.c:464 |
2142 | msgid "number of keys to list included in a file (for testing)" | 2175 | msgid "number of keys to list included in a file (for testing)" |
2143 | msgstr "број кључева за иÑÐ¿Ð¸Ñ ÑƒÐºÑ™ÑƒÑ‡ÐµÐ½Ð¸Ñ… у датотеци (за теÑтирање)" | 2176 | msgstr "број кључева за иÑÐ¿Ð¸Ñ ÑƒÐºÑ™ÑƒÑ‡ÐµÐ½Ð¸Ñ… у датотеци (за теÑтирање)" |
2144 | 2177 | ||
2145 | #: src/cli/util/gnunet-ecc.c:464 | 2178 | #: src/cli/util/gnunet-ecc.c:470 |
2146 | msgid "create COUNT public-private key pairs (for testing)" | 2179 | msgid "create COUNT public-private key pairs (for testing)" |
2147 | msgstr "Ñтвара БРОЈ пара јавног-личног кључа (за теÑтирање)" | 2180 | msgstr "Ñтвара БРОЈ пара јавног-личног кључа (за теÑтирање)" |
2148 | 2181 | ||
2149 | #: src/cli/util/gnunet-ecc.c:469 | 2182 | #: src/cli/util/gnunet-ecc.c:475 |
2150 | msgid "print the public key in ASCII format" | 2183 | msgid "print the public key in ASCII format" |
2151 | msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату" | 2184 | msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату" |
2152 | 2185 | ||
2153 | #: src/cli/util/gnunet-ecc.c:474 | 2186 | #: src/cli/util/gnunet-ecc.c:480 |
2154 | #, fuzzy | 2187 | #, fuzzy |
2155 | msgid "print the private key in ASCII format" | 2188 | msgid "print the private key in ASCII format" |
2156 | msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату" | 2189 | msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату" |
2157 | 2190 | ||
2158 | #: src/cli/util/gnunet-ecc.c:479 | 2191 | #: src/cli/util/gnunet-ecc.c:485 |
2159 | #, fuzzy | 2192 | #, fuzzy |
2160 | msgid "print the public key in HEX format" | 2193 | msgid "print the public key in HEX format" |
2161 | msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату" | 2194 | msgstr "иÑпиÑује јавни кључ у ÐСКРИ формату" |
2162 | 2195 | ||
2163 | #: src/cli/util/gnunet-ecc.c:485 | 2196 | #: src/cli/util/gnunet-ecc.c:491 |
2164 | msgid "print examples of ECC operations (used for compatibility testing)" | 2197 | msgid "print examples of ECC operations (used for compatibility testing)" |
2165 | msgstr "иÑпиÑује примере ЕЦЦ операција (кориÑти Ñе за теÑтирање ÑаглаÑноÑти)" | 2198 | msgstr "иÑпиÑује примере ЕЦЦ операција (кориÑти Ñе за теÑтирање ÑаглаÑноÑти)" |
2166 | 2199 | ||
2167 | #: src/cli/util/gnunet-ecc.c:499 | 2200 | #: src/cli/util/gnunet-ecc.c:505 |
2168 | msgid "Manipulate GNUnet private ECC key files" | 2201 | msgid "Manipulate GNUnet private ECC key files" |
2169 | msgstr "Управља ГÐУнет датотекама личног ЕЦЦ кључа" | 2202 | msgstr "Управља ГÐУнет датотекама личног ЕЦЦ кључа" |
2170 | 2203 | ||
@@ -3260,13 +3293,13 @@ msgstr "" | |||
3260 | msgid "Invalid handle type while writing `%s'" | 3293 | msgid "Invalid handle type while writing `%s'" |
3261 | msgstr "ÐеиÑправан формат времена „%s“\n" | 3294 | msgstr "ÐеиÑправан формат времена „%s“\n" |
3262 | 3295 | ||
3263 | #: 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 |
3264 | #: src/service/arm/gnunet-service-arm.c:452 | 3297 | #: src/service/arm/gnunet-service-arm.c:452 |
3265 | #, c-format | 3298 | #, c-format |
3266 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 3299 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
3267 | msgstr "ЈУÐИКС_ПУТÐЊР„%s“ је предуга, највећа дужина је %llu\n" | 3300 | msgstr "ЈУÐИКС_ПУТÐЊР„%s“ је предуга, највећа дужина је %llu\n" |
3268 | 3301 | ||
3269 | #: 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 |
3270 | #: src/service/arm/gnunet-service-arm.c:456 | 3303 | #: src/service/arm/gnunet-service-arm.c:456 |
3271 | #, c-format | 3304 | #, c-format |
3272 | msgid "Using `%s' instead\n" | 3305 | msgid "Using `%s' instead\n" |
@@ -3399,17 +3432,17 @@ msgstr "" | |||
3399 | msgid "`%s' failed at %s:%d with error: %s\n" | 3432 | msgid "`%s' failed at %s:%d with error: %s\n" |
3400 | msgstr "„%s“ није уÑпело на %s:%d Ñа грешком: %s\n" | 3433 | msgstr "„%s“ није уÑпело на %s:%d Ñа грешком: %s\n" |
3401 | 3434 | ||
3402 | #: src/lib/util/crypto_ecc.c:554 | 3435 | #: src/lib/util/crypto_ecc.c:569 |
3403 | #, c-format | 3436 | #, c-format |
3404 | msgid "ECC signing failed at %s:%d: %s\n" | 3437 | msgid "ECC signing failed at %s:%d: %s\n" |
3405 | msgstr "„ECC“ потпиÑивање није уÑпело на %s:%d: %s\n" | 3438 | msgstr "„ECC“ потпиÑивање није уÑпело на %s:%d: %s\n" |
3406 | 3439 | ||
3407 | #: src/lib/util/crypto_ecc.c:677 | 3440 | #: src/lib/util/crypto_ecc.c:692 |
3408 | #, c-format | 3441 | #, c-format |
3409 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 3442 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
3410 | msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s:%d: %s\n" | 3443 | msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s:%d: %s\n" |
3411 | 3444 | ||
3412 | #: 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 |
3413 | msgid "Could not load peer's private key\n" | 3446 | msgid "Could not load peer's private key\n" |
3414 | msgstr "Ðе могу да учитам лични кључ парњака\n" | 3447 | msgstr "Ðе могу да учитам лични кључ парњака\n" |
3415 | 3448 | ||
@@ -3433,7 +3466,7 @@ msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s: | |||
3433 | msgid "Expected `%s' to be a directory!\n" | 3466 | msgid "Expected `%s' to be a directory!\n" |
3434 | msgstr "Очекивах да „%s“ буде директоријум!\n" | 3467 | msgstr "Очекивах да „%s“ буде директоријум!\n" |
3435 | 3468 | ||
3436 | #: 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 |
3437 | #, c-format | 3470 | #, c-format |
3438 | msgid "Cannot obtain information about user `%s': %s\n" | 3471 | msgid "Cannot obtain information about user `%s': %s\n" |
3439 | msgstr "Ðе могу да добијем податке о кориÑнику „%s“: %s\n" | 3472 | msgstr "Ðе могу да добијем податке о кориÑнику „%s“: %s\n" |
@@ -3625,101 +3658,101 @@ msgstr "Морате да проÑледите број опцији „%s“.\n | |||
3625 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 3658 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
3626 | msgstr "" | 3659 | msgstr "" |
3627 | 3660 | ||
3628 | #: src/lib/util/gnunet_error_codes.c:60 | 3661 | #: src/lib/util/gnunet_error_codes.c:59 |
3629 | msgid "No error (success)." | 3662 | msgid "No error (success)." |
3630 | msgstr "" | 3663 | msgstr "" |
3631 | 3664 | ||
3632 | #: src/lib/util/gnunet_error_codes.c:66 | 3665 | #: src/lib/util/gnunet_error_codes.c:65 |
3633 | #, fuzzy | 3666 | #, fuzzy |
3634 | msgid "Unknown and unspecified error." | 3667 | msgid "Unknown and unspecified error." |
3635 | msgstr "%.s Ðепознат код резултата." | 3668 | msgstr "%.s Ðепознат код резултата." |
3636 | 3669 | ||
3637 | #: src/lib/util/gnunet_error_codes.c:72 | 3670 | #: src/lib/util/gnunet_error_codes.c:71 |
3638 | #, fuzzy | 3671 | #, fuzzy |
3639 | msgid "Communication with service failed." | 3672 | msgid "Communication with service failed." |
3640 | msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n" | 3673 | msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n" |
3641 | 3674 | ||
3642 | #: src/lib/util/gnunet_error_codes.c:78 | 3675 | #: src/lib/util/gnunet_error_codes.c:77 |
3643 | #, fuzzy | 3676 | #, fuzzy |
3644 | msgid "Ego not found." | 3677 | msgid "Ego not found." |
3645 | msgstr "ÐиÑам нашао Ñадржај" | 3678 | msgstr "ÐиÑам нашао Ñадржај" |
3646 | 3679 | ||
3647 | #: src/lib/util/gnunet_error_codes.c:84 | 3680 | #: src/lib/util/gnunet_error_codes.c:83 |
3648 | #, fuzzy | 3681 | #, fuzzy |
3649 | msgid "Identifier already in use for another ego." | 3682 | msgid "Identifier already in use for another ego." |
3650 | msgstr "одредник Ñе већ кориÑти за други его" | 3683 | msgstr "одредник Ñе већ кориÑти за други его" |
3651 | 3684 | ||
3652 | #: src/lib/util/gnunet_error_codes.c:90 | 3685 | #: src/lib/util/gnunet_error_codes.c:89 |
3653 | msgid "The given ego is invalid or malformed." | 3686 | msgid "The given ego is invalid or malformed." |
3654 | msgstr "" | 3687 | msgstr "" |
3655 | 3688 | ||
3656 | #: src/lib/util/gnunet_error_codes.c:96 | 3689 | #: src/lib/util/gnunet_error_codes.c:95 |
3657 | #, fuzzy | 3690 | #, fuzzy |
3658 | msgid "Unknown namestore error." | 3691 | msgid "Unknown namestore error." |
3659 | msgstr "%.s Ðепознат код резултата." | 3692 | msgstr "%.s Ðепознат код резултата." |
3660 | 3693 | ||
3661 | #: 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 |
3662 | #, fuzzy | 3695 | #, fuzzy |
3663 | msgid "Zone iteration failed." | 3696 | msgid "Zone iteration failed." |
3664 | msgstr "# Бирање парњака није уÑпело" | 3697 | msgstr "# Бирање парњака није уÑпело" |
3665 | 3698 | ||
3666 | #: src/lib/util/gnunet_error_codes.c:108 | 3699 | #: src/lib/util/gnunet_error_codes.c:107 |
3667 | #, fuzzy | 3700 | #, fuzzy |
3668 | msgid "Zone not found." | 3701 | msgid "Zone not found." |
3669 | msgstr "ÐиÑам нашао Ñадржај" | 3702 | msgstr "ÐиÑам нашао Ñадржај" |
3670 | 3703 | ||
3671 | #: src/lib/util/gnunet_error_codes.c:114 | 3704 | #: src/lib/util/gnunet_error_codes.c:113 |
3672 | #, fuzzy | 3705 | #, fuzzy |
3673 | msgid "Record not found." | 3706 | msgid "Record not found." |
3674 | msgstr "ниÑам нашао „upnpc“\n" | 3707 | msgstr "ниÑам нашао „upnpc“\n" |
3675 | 3708 | ||
3676 | #: src/lib/util/gnunet_error_codes.c:126 | 3709 | #: src/lib/util/gnunet_error_codes.c:125 |
3677 | msgid "Zone does not contain any records." | 3710 | msgid "Zone does not contain any records." |
3678 | msgstr "" | 3711 | msgstr "" |
3679 | 3712 | ||
3680 | #: src/lib/util/gnunet_error_codes.c:132 | 3713 | #: src/lib/util/gnunet_error_codes.c:131 |
3681 | #, fuzzy | 3714 | #, fuzzy |
3682 | msgid "Failed to lookup record." | 3715 | msgid "Failed to lookup record." |
3683 | msgstr "Смештај назива није уÑпео да ÑмеÑти запиÑ\n" | 3716 | msgstr "Смештај назива није уÑпео да ÑмеÑти запиÑ\n" |
3684 | 3717 | ||
3685 | #: src/lib/util/gnunet_error_codes.c:138 | 3718 | #: src/lib/util/gnunet_error_codes.c:137 |
3686 | #, fuzzy | 3719 | #, fuzzy |
3687 | msgid "No records given." | 3720 | msgid "No records given." |
3688 | msgstr "Ðије дат парњак!\n" | 3721 | msgstr "Ðије дат парњак!\n" |
3689 | 3722 | ||
3690 | #: src/lib/util/gnunet_error_codes.c:144 | 3723 | #: src/lib/util/gnunet_error_codes.c:143 |
3691 | msgid "Record data invalid." | 3724 | msgid "Record data invalid." |
3692 | msgstr "" | 3725 | msgstr "" |
3693 | 3726 | ||
3694 | #: src/lib/util/gnunet_error_codes.c:150 | 3727 | #: src/lib/util/gnunet_error_codes.c:149 |
3695 | #, fuzzy | 3728 | #, fuzzy |
3696 | msgid "No label given." | 3729 | msgid "No label given." |
3697 | msgstr "Ðије дат парњак!\n" | 3730 | msgstr "Ðије дат парњак!\n" |
3698 | 3731 | ||
3699 | #: src/lib/util/gnunet_error_codes.c:156 | 3732 | #: src/lib/util/gnunet_error_codes.c:155 |
3700 | #, fuzzy | 3733 | #, fuzzy |
3701 | msgid "No results given." | 3734 | msgid "No results given." |
3702 | msgstr "ÐиÑу дате опције\n" | 3735 | msgstr "ÐиÑу дате опције\n" |
3703 | 3736 | ||
3704 | #: src/lib/util/gnunet_error_codes.c:162 | 3737 | #: src/lib/util/gnunet_error_codes.c:161 |
3705 | #, fuzzy | 3738 | #, fuzzy |
3706 | msgid "Record already exists." | 3739 | msgid "Record already exists." |
3707 | msgstr "назив мете већ поÑтоји" | 3740 | msgstr "назив мете већ поÑтоји" |
3708 | 3741 | ||
3709 | #: src/lib/util/gnunet_error_codes.c:168 | 3742 | #: src/lib/util/gnunet_error_codes.c:167 |
3710 | msgid "Record size exceeds maximum limit." | 3743 | msgid "Record size exceeds maximum limit." |
3711 | msgstr "" | 3744 | msgstr "" |
3712 | 3745 | ||
3713 | #: src/lib/util/gnunet_error_codes.c:174 | 3746 | #: src/lib/util/gnunet_error_codes.c:173 |
3714 | msgid "There was an error in the database backend." | 3747 | msgid "There was an error in the database backend." |
3715 | msgstr "" | 3748 | msgstr "" |
3716 | 3749 | ||
3717 | #: src/lib/util/gnunet_error_codes.c:180 | 3750 | #: src/lib/util/gnunet_error_codes.c:179 |
3718 | #, fuzzy | 3751 | #, fuzzy |
3719 | msgid "Failed to store the given records." | 3752 | msgid "Failed to store the given records." |
3720 | msgstr "Смештај назива није уÑпео да ÑмеÑти запиÑ\n" | 3753 | msgstr "Смештај назива није уÑпео да ÑмеÑти запиÑ\n" |
3721 | 3754 | ||
3722 | #: src/lib/util/gnunet_error_codes.c:186 | 3755 | #: src/lib/util/gnunet_error_codes.c:185 |
3723 | msgid "Label invalid or malformed." | 3756 | msgid "Label invalid or malformed." |
3724 | msgstr "" | 3757 | msgstr "" |
3725 | 3758 | ||
@@ -3790,16 +3823,6 @@ msgstr "„%s“ није уÑпело за библиотеку '%s' Ñа грР| |||
3790 | msgid "Could not determine plugin installation path.\n" | 3823 | msgid "Could not determine plugin installation path.\n" |
3791 | msgstr "Ðе могу да одредим путању инÑталирања прикључка.\n" | 3824 | msgstr "Ðе могу да одредим путању инÑталирања прикључка.\n" |
3792 | 3825 | ||
3793 | #: src/lib/util/program.c:287 | ||
3794 | #, fuzzy, c-format | ||
3795 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
3796 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" | ||
3797 | |||
3798 | #: src/lib/util/program.c:299 | ||
3799 | #, fuzzy, c-format | ||
3800 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
3801 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" | ||
3802 | |||
3803 | #: src/lib/util/program.c:314 | 3826 | #: src/lib/util/program.c:314 |
3804 | #, fuzzy, c-format | 3827 | #, fuzzy, c-format |
3805 | msgid "Unreadable configuration file `%s'. Exiting ...\n" | 3828 | msgid "Unreadable configuration file `%s'. Exiting ...\n" |
@@ -3850,7 +3873,7 @@ msgstr "ОÑновна уÑлуга „%s“ није подешена иÑпрР| |||
3850 | msgid "Could not resolve our FQDN: %s\n" | 3873 | msgid "Could not resolve our FQDN: %s\n" |
3851 | msgstr "Ðе могу да решим наш „FQDN“ : %s\n" | 3874 | msgstr "Ðе могу да решим наш „FQDN“ : %s\n" |
3852 | 3875 | ||
3853 | #: src/lib/util/service.c:654 | 3876 | #: src/lib/util/service.c:650 |
3854 | #, fuzzy, c-format | 3877 | #, fuzzy, c-format |
3855 | msgid "" | 3878 | msgid "" |
3856 | "Processing code for message of type %u did not call " | 3879 | "Processing code for message of type %u did not call " |
@@ -3859,29 +3882,29 @@ msgstr "" | |||
3859 | "Обрађивачки код за поруку врÑте %u није позвао „GNUNET_SERVER_receive_done“ " | 3882 | "Обрађивачки код за поруку врÑте %u није позвао „GNUNET_SERVER_receive_done“ " |
3860 | "након „%s“\n" | 3883 | "након „%s“\n" |
3861 | 3884 | ||
3862 | #: src/lib/util/service.c:838 | 3885 | #: src/lib/util/service.c:841 |
3863 | #, c-format | 3886 | #, c-format |
3864 | msgid "Unknown address family %d\n" | 3887 | msgid "Unknown address family %d\n" |
3865 | msgstr "Ðепозната породица адреÑе „%d“\n" | 3888 | msgstr "Ðепозната породица адреÑе „%d“\n" |
3866 | 3889 | ||
3867 | #: src/lib/util/service.c:951 | 3890 | #: src/lib/util/service.c:956 |
3868 | #, c-format | 3891 | #, c-format |
3869 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" | 3892 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" |
3870 | msgstr "Ðе могу да обрадим Ñпецификацију ИПв4 мреже „%s“ за `%s:%s'\n" | 3893 | msgstr "Ðе могу да обрадим Ñпецификацију ИПв4 мреже „%s“ за `%s:%s'\n" |
3871 | 3894 | ||
3872 | #: src/lib/util/service.c:992 | 3895 | #: src/lib/util/service.c:997 |
3873 | #, c-format | 3896 | #, c-format |
3874 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" | 3897 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" |
3875 | msgstr "Ðе могу да обрадим Ñпецификацију ИПв6 мреже „%s“ за `%s:%s'\n" | 3898 | msgstr "Ðе могу да обрадим Ñпецификацију ИПв6 мреже „%s“ за `%s:%s'\n" |
3876 | 3899 | ||
3877 | #: 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 |
3878 | #: src/service/arm/gnunet-service-arm.c:412 | 3901 | #: src/service/arm/gnunet-service-arm.c:412 |
3879 | #: src/service/arm/gnunet-service-arm.c:418 | 3902 | #: src/service/arm/gnunet-service-arm.c:418 |
3880 | #, c-format | 3903 | #, c-format |
3881 | msgid "Require valid port number for service `%s' in configuration!\n" | 3904 | msgid "Require valid port number for service `%s' in configuration!\n" |
3882 | msgstr "Захтева иÑправан број прикључника за уÑлугу „%s“ у подешавањима!\n" | 3905 | msgstr "Захтева иÑправан број прикључника за уÑлугу „%s“ у подешавањима!\n" |
3883 | 3906 | ||
3884 | #: 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 |
3885 | #, c-format | 3908 | #, c-format |
3886 | msgid "" | 3909 | msgid "" |
3887 | "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 " |
@@ -3890,87 +3913,87 @@ msgstr "" | |||
3890 | "ИÑкључујем подршку прикључнице ЈУÐИКС домена за уÑлугу „%s“, ниÑм уÑпео да " | 3913 | "ИÑкључујем подршку прикључнице ЈУÐИКС домена за уÑлугу „%s“, ниÑм уÑпео да " |
3891 | "направим прикључницу ЈУÐИКС домена: %s\n" | 3914 | "направим прикључницу ЈУÐИКС домена: %s\n" |
3892 | 3915 | ||
3893 | #: 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 |
3894 | #, c-format | 3917 | #, c-format |
3895 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | 3918 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" |
3896 | msgstr "" | 3919 | msgstr "" |
3897 | "Ðемам ни ПРИКЉУЧÐИК ни ЈУÐИКС_ПУТÐЊУ за уÑлугу „%s“, али је једно потребно\n" | 3920 | "Ðемам ни ПРИКЉУЧÐИК ни ЈУÐИКС_ПУТÐЊУ за уÑлугу „%s“, али је једно потребно\n" |
3898 | 3921 | ||
3899 | #: 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 |
3900 | #, c-format | 3923 | #, c-format |
3901 | msgid "Failed to resolve `%s': %s\n" | 3924 | msgid "Failed to resolve `%s': %s\n" |
3902 | msgstr "ÐиÑам уÑпео да решим „%s“: %s\n" | 3925 | msgstr "ÐиÑам уÑпео да решим „%s“: %s\n" |
3903 | 3926 | ||
3904 | #: 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 |
3905 | #, c-format | 3928 | #, c-format |
3906 | msgid "Failed to find %saddress for `%s'.\n" | 3929 | msgid "Failed to find %saddress for `%s'.\n" |
3907 | msgstr "ÐиÑам уÑпео да нађем %s адреÑу за „%s“.\n" | 3930 | msgstr "ÐиÑам уÑпео да нађем %s адреÑу за „%s“.\n" |
3908 | 3931 | ||
3909 | #: src/lib/util/service.c:1401 | 3932 | #: src/lib/util/service.c:1406 |
3910 | #, c-format | 3933 | #, c-format |
3911 | msgid "`%s' failed for port %d (%s).\n" | 3934 | msgid "`%s' failed for port %d (%s).\n" |
3912 | msgstr "„%s“ није уÑпело за прикључник %d (%s).\n" | 3935 | msgstr "„%s“ није уÑпело за прикључник %d (%s).\n" |
3913 | 3936 | ||
3914 | #: src/lib/util/service.c:1413 | 3937 | #: src/lib/util/service.c:1418 |
3915 | #, c-format | 3938 | #, c-format |
3916 | msgid "`%s' failed for port %d (%s): address already in use\n" | 3939 | msgid "`%s' failed for port %d (%s): address already in use\n" |
3917 | msgstr "„%s“ није уÑпело за прикључник %d (%s): адреÑа је већ у употреби\n" | 3940 | msgstr "„%s“ није уÑпело за прикључник %d (%s): адреÑа је већ у употреби\n" |
3918 | 3941 | ||
3919 | #: src/lib/util/service.c:1420 | 3942 | #: src/lib/util/service.c:1425 |
3920 | #, c-format | 3943 | #, c-format |
3921 | msgid "`%s' failed for `%s': address already in use\n" | 3944 | msgid "`%s' failed for `%s': address already in use\n" |
3922 | msgstr "„%s“ није уÑпело за „%s“: адреÑа је већ у употреби\n" | 3945 | msgstr "„%s“ није уÑпело за „%s“: адреÑа је већ у употреби\n" |
3923 | 3946 | ||
3924 | #: src/lib/util/service.c:1481 | 3947 | #: src/lib/util/service.c:1486 |
3925 | #, c-format | 3948 | #, c-format |
3926 | msgid "Specified value for `%s' of service `%s' is invalid\n" | 3949 | msgid "Specified value for `%s' of service `%s' is invalid\n" |
3927 | msgstr "Ðаведена вредноÑÑ‚ за „%s“ уÑлуге „%s“ је неиÑправна\n" | 3950 | msgstr "Ðаведена вредноÑÑ‚ за „%s“ уÑлуге „%s“ је неиÑправна\n" |
3928 | 3951 | ||
3929 | #: src/lib/util/service.c:1505 | 3952 | #: src/lib/util/service.c:1510 |
3930 | #, c-format | 3953 | #, c-format |
3931 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" | 3954 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" |
3932 | msgstr "" | 3955 | msgstr "" |
3933 | "Ðе могу да приÑтупим унапред Ñвезаној прикључници %u, покушаћу да Ñвежем " | 3956 | "Ðе могу да приÑтупим унапред Ñвезаној прикључници %u, покушаћу да Ñвежем " |
3934 | "Ñебе Ñамог\n" | 3957 | "Ñебе Ñамог\n" |
3935 | 3958 | ||
3936 | #: src/lib/util/service.c:1573 | 3959 | #: src/lib/util/service.c:1583 |
3937 | msgid "" | 3960 | msgid "" |
3938 | "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" |
3939 | msgstr "" | 3962 | msgstr "" |
3940 | 3963 | ||
3941 | #: src/lib/util/service.c:1644 | 3964 | #: src/lib/util/service.c:1653 |
3942 | msgid "No such user" | 3965 | msgid "No such user" |
3943 | msgstr "Ðема таквог кориÑника" | 3966 | msgstr "Ðема таквог кориÑника" |
3944 | 3967 | ||
3945 | #: src/lib/util/service.c:1658 | 3968 | #: src/lib/util/service.c:1668 |
3946 | #, c-format | 3969 | #, c-format |
3947 | msgid "Cannot change user/group to `%s': %s\n" | 3970 | msgid "Cannot change user/group to `%s': %s\n" |
3948 | msgstr "Ðе могу да променим влаÑника/групу на „%s“: %s\n" | 3971 | msgstr "Ðе могу да променим влаÑника/групу на „%s“: %s\n" |
3949 | 3972 | ||
3950 | #: src/lib/util/service.c:1751 | 3973 | #: src/lib/util/service.c:1767 |
3951 | msgid "Service process failed to initialize\n" | 3974 | msgid "Service process failed to initialize\n" |
3952 | msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да Ñе покрене\n" | 3975 | msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да Ñе покрене\n" |
3953 | 3976 | ||
3954 | #: src/lib/util/service.c:1756 | 3977 | #: src/lib/util/service.c:1772 |
3955 | msgid "Service process could not initialize server function\n" | 3978 | msgid "Service process could not initialize server function\n" |
3956 | msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге не може да покрене функцију Ñервера\n" | 3979 | msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге не може да покрене функцију Ñервера\n" |
3957 | 3980 | ||
3958 | #: src/lib/util/service.c:1761 | 3981 | #: src/lib/util/service.c:1777 |
3959 | msgid "Service process failed to report status\n" | 3982 | msgid "Service process failed to report status\n" |
3960 | msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да извеÑти о Ñтању\n" | 3983 | msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да извеÑти о Ñтању\n" |
3961 | 3984 | ||
3962 | #: 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 |
3963 | msgid "do daemonize (detach from terminal)" | 3986 | msgid "do daemonize (detach from terminal)" |
3964 | msgstr "ради демонизацију (откачиње од терминала)" | 3987 | msgstr "ради демонизацију (откачиње од терминала)" |
3965 | 3988 | ||
3966 | #: 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 |
3967 | #: 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 |
3968 | #: src/service/transport/transport-testing-communicator.c:1056 | 3991 | #: src/service/transport/transport-testing-communicator.c:1059 |
3969 | #, c-format | 3992 | #, c-format |
3970 | msgid "Malformed configuration file `%s', exit ...\n" | 3993 | msgid "Malformed configuration file `%s', exit ...\n" |
3971 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" | 3994 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" |
3972 | 3995 | ||
3973 | #: 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 |
3974 | msgid "Malformed configuration, exit ...\n" | 3997 | msgid "Malformed configuration, exit ...\n" |
3975 | msgstr "Лоше подешавање, излазим ...\n" | 3998 | msgstr "Лоше подешавање, излазим ...\n" |
3976 | 3999 | ||
@@ -4440,6 +4463,11 @@ msgstr "" | |||
4440 | msgid "Initiating shutdown as requested by client.\n" | 4463 | msgid "Initiating shutdown as requested by client.\n" |
4441 | msgstr "Започињем гашење као што је затражио клијент.\n" | 4464 | msgstr "Започињем гашење као што је затражио клијент.\n" |
4442 | 4465 | ||
4466 | #: src/service/arm/testing_arm_cmd_start_peer.c:197 | ||
4467 | #, c-format | ||
4468 | msgid "Failed to start `%s': %s\n" | ||
4469 | msgstr "ÐиÑам уÑпео да покренем „%s“: %s\n" | ||
4470 | |||
4443 | #: src/service/core/gnunet-service-core.c:329 | 4471 | #: src/service/core/gnunet-service-core.c:329 |
4444 | msgid "# send requests dropped (disconnected)" | 4472 | msgid "# send requests dropped (disconnected)" |
4445 | msgstr "# захтеви Ñлања Ñу одбачени (веза је прекинута)" | 4473 | msgstr "# захтеви Ñлања Ñу одбачени (веза је прекинута)" |
@@ -4609,8 +4637,8 @@ msgstr "# бајтови утовара Ñу дешифровани" | |||
4609 | #: src/service/core/gnunet-service-core_sessions.c:337 | 4637 | #: src/service/core/gnunet-service-core_sessions.c:337 |
4610 | #: src/service/fs/gnunet-service-fs_cp.c:484 | 4638 | #: src/service/fs/gnunet-service-fs_cp.c:484 |
4611 | #: src/service/fs/gnunet-service-fs_cp.c:1377 | 4639 | #: src/service/fs/gnunet-service-fs_cp.c:1377 |
4612 | #: src/service/topology/gnunet-daemon-topology.c:551 | 4640 | #: src/service/topology/gnunet-daemon-topology.c:545 |
4613 | #: src/service/topology/gnunet-daemon-topology.c:633 | 4641 | #: src/service/topology/gnunet-daemon-topology.c:627 |
4614 | msgid "# peers connected" | 4642 | msgid "# peers connected" |
4615 | msgstr "# парњаци Ñу повезани" | 4643 | msgstr "# парњаци Ñу повезани" |
4616 | 4644 | ||
@@ -5662,7 +5690,7 @@ msgstr "" | |||
5662 | 5690 | ||
5663 | #: src/service/fs/gnunet-service-fs.c:1271 | 5691 | #: src/service/fs/gnunet-service-fs.c:1271 |
5664 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 | 5692 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 |
5665 | #: src/service/topology/gnunet-daemon-topology.c:1066 | 5693 | #: src/service/topology/gnunet-daemon-topology.c:1062 |
5666 | #, c-format | 5694 | #, c-format |
5667 | msgid "Failed to connect to `%s' service.\n" | 5695 | msgid "Failed to connect to `%s' service.\n" |
5668 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа „%s“ уÑлугом.\n" | 5696 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа „%s“ уÑлугом.\n" |
@@ -6474,7 +6502,7 @@ msgid "# hostlist advertisements send" | |||
6474 | msgstr "# рекламе ÑпиÑка домаћина Ñу поÑлате" | 6502 | msgstr "# рекламе ÑпиÑка домаћина Ñу поÑлате" |
6475 | 6503 | ||
6476 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 | 6504 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 |
6477 | #: src/service/topology/gnunet-daemon-topology.c:786 | 6505 | #: src/service/topology/gnunet-daemon-topology.c:781 |
6478 | #, fuzzy, c-format | 6506 | #, fuzzy, c-format |
6479 | msgid "Error in communication with PEERSTORE service: %s\n" | 6507 | msgid "Error in communication with PEERSTORE service: %s\n" |
6480 | msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n" | 6508 | msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n" |
@@ -6745,12 +6773,12 @@ msgstr "" | |||
6745 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" | 6773 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
6746 | msgstr "" | 6774 | msgstr "" |
6747 | 6775 | ||
6748 | #: src/service/nat/gnunet-service-nat.c:1861 | 6776 | #: src/service/nat/gnunet-service-nat.c:1860 |
6749 | #, fuzzy | 6777 | #, fuzzy |
6750 | msgid "Connection reversal request failed\n" | 6778 | msgid "Connection reversal request failed\n" |
6751 | msgstr "Веза је уÑпоÑтављена.\n" | 6779 | msgstr "Веза је уÑпоÑтављена.\n" |
6752 | 6780 | ||
6753 | #: src/service/nat/gnunet-service-nat.c:1935 | 6781 | #: src/service/nat/gnunet-service-nat.c:1999 |
6754 | msgid "" | 6782 | msgid "" |
6755 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 6783 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
6756 | "disabling UPnP\n" | 6784 | "disabling UPnP\n" |
@@ -6774,43 +6802,43 @@ msgstr "ниÑам нашао наредбу „external-ip“\n" | |||
6774 | msgid "`upnpc' command not found\n" | 6802 | msgid "`upnpc' command not found\n" |
6775 | msgstr "ниÑам нашао „upnpc“ наредбу\n" | 6803 | msgstr "ниÑам нашао „upnpc“ наредбу\n" |
6776 | 6804 | ||
6777 | #: src/service/peerstore/gnunet-service-peerstore.c:1141 | 6805 | #: src/service/peerstore/gnunet-service-peerstore.c:1150 |
6778 | #, c-format | 6806 | #, c-format |
6779 | msgid "Failed to parse HELLO in file `%s': %s\n" | 6807 | msgid "Failed to parse HELLO in file `%s': %s\n" |
6780 | msgstr "ÐиÑам уÑпео да обрадим „HELLO“ у датотеци „%s“: %s\n" | 6808 | msgstr "ÐиÑам уÑпео да обрадим „HELLO“ у датотеци „%s“: %s\n" |
6781 | 6809 | ||
6782 | #: src/service/peerstore/gnunet-service-peerstore.c:1214 | 6810 | #: src/service/peerstore/gnunet-service-peerstore.c:1223 |
6783 | #, fuzzy, c-format | 6811 | #, fuzzy, c-format |
6784 | msgid "Could not load database backend `%s'\n" | 6812 | msgid "Could not load database backend `%s'\n" |
6785 | msgstr "Ðе могу да отворим „%s“.\n" | 6813 | msgstr "Ðе могу да отворим „%s“.\n" |
6786 | 6814 | ||
6787 | #: src/service/peerstore/gnunet-service-peerstore.c:1233 | 6815 | #: src/service/peerstore/gnunet-service-peerstore.c:1242 |
6788 | #, c-format | 6816 | #, c-format |
6789 | msgid "Importing HELLOs from `%s'\n" | 6817 | msgid "Importing HELLOs from `%s'\n" |
6790 | msgstr "Увозим „HELLO“-е из „%s“\n" | 6818 | msgstr "Увозим „HELLO“-е из „%s“\n" |
6791 | 6819 | ||
6792 | #: src/service/peerstore/gnunet-service-peerstore.c:1244 | 6820 | #: src/service/peerstore/gnunet-service-peerstore.c:1253 |
6793 | msgid "Skipping import of included HELLOs\n" | 6821 | msgid "Skipping import of included HELLOs\n" |
6794 | msgstr "ПреÑкачем увоз укључених „HELLO“-а\n" | 6822 | msgstr "ПреÑкачем увоз укључених „HELLO“-а\n" |
6795 | 6823 | ||
6796 | #: src/service/peerstore/peerstore_api.c:574 | 6824 | #: src/service/peerstore/peerstore_api.c:579 |
6797 | #, fuzzy | 6825 | #, fuzzy |
6798 | msgid "Unexpected store response.\n" | 6826 | msgid "Unexpected store response.\n" |
6799 | msgstr "Ðеочекивано време за одговор Ñа „fs“ уÑлуге." | 6827 | msgstr "Ðеочекивано време за одговор Ñа „fs“ уÑлуге." |
6800 | 6828 | ||
6801 | #: src/service/peerstore/peerstore_api.c:606 | 6829 | #: src/service/peerstore/peerstore_api.c:620 |
6802 | #, fuzzy | 6830 | #, fuzzy |
6803 | msgid "Unexpected iteration response.\n" | 6831 | msgid "Unexpected iteration response.\n" |
6804 | msgstr "Ðеочекивано време за одговор Ñа „fs“ уÑлуге." | 6832 | msgstr "Ðеочекивано време за одговор Ñа „fs“ уÑлуге." |
6805 | 6833 | ||
6806 | #: src/service/peerstore/peerstore_api.c:652 | 6834 | #: src/service/peerstore/peerstore_api.c:666 |
6807 | msgid "" | 6835 | msgid "" |
6808 | "Unexpected iteration response, no iterating client found, discarding " | 6836 | "Unexpected iteration response, no iterating client found, discarding " |
6809 | "message.\n" | 6837 | "message.\n" |
6810 | msgstr "" | 6838 | msgstr "" |
6811 | 6839 | ||
6812 | #: src/service/peerstore/peerstore_api.c:662 | 6840 | #: src/service/peerstore/peerstore_api.c:676 |
6813 | #: src/service/peerstore/peerstore_api_monitor.c:164 | 6841 | #: src/service/peerstore/peerstore_api_monitor.c:163 |
6814 | #, fuzzy | 6842 | #, fuzzy |
6815 | msgid "Received a malformed response from service." | 6843 | msgid "Received a malformed response from service." |
6816 | msgstr "Примих лош ДÐС захтев од „%s“\n" | 6844 | msgstr "Примих лош ДÐС захтев од „%s“\n" |
@@ -6974,11 +7002,11 @@ msgstr "" | |||
6974 | msgid "Namestore REST API initialized\n" | 7002 | msgid "Namestore REST API initialized\n" |
6975 | msgstr "Меш је покренут\n" | 7003 | msgstr "Меш је покренут\n" |
6976 | 7004 | ||
6977 | #: src/service/rest/openid_plugin.c:3102 | 7005 | #: src/service/rest/openid_plugin.c:3121 |
6978 | msgid "OpenID Connect REST API initialized\n" | 7006 | msgid "OpenID Connect REST API initialized\n" |
6979 | msgstr "" | 7007 | msgstr "" |
6980 | 7008 | ||
6981 | #: 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 |
6982 | msgid "Identity Provider REST API initialized\n" | 7010 | msgid "Identity Provider REST API initialized\n" |
6983 | msgstr "" | 7011 | msgstr "" |
6984 | 7012 | ||
@@ -7029,162 +7057,56 @@ msgstr "Учитавам %llu бајта ÑтатиÑтике из „%s“\n" | |||
7029 | msgid "Could not save some persistent statistics\n" | 7057 | msgid "Could not save some persistent statistics\n" |
7030 | msgstr "Ðе могу да Ñачувам нешто од трајне ÑтатиÑтике\n" | 7058 | msgstr "Ðе могу да Ñачувам нешто од трајне ÑтатиÑтике\n" |
7031 | 7059 | ||
7032 | #: src/service/testing/gnunet-testing.c:185 | 7060 | #: src/service/testbed/gnunet-testbed.c:196 |
7033 | #, c-format | 7061 | #, fuzzy |
7034 | msgid "Could not extract hostkey %u (offset too large?)\n" | 7062 | msgid "number of unique configuration files to create" |
7035 | msgstr "Ðе могу да извучем кључ домаћина %u (померај је превелик?)\n" | ||
7036 | |||
7037 | #: src/service/testing/gnunet-testing.c:275 | ||
7038 | #, c-format | ||
7039 | msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n" | ||
7040 | msgstr "" | ||
7041 | "Ðепозната наредба, кориÑтите „q“ да прекинете или „r“ да поново покренете " | ||
7042 | "парњака\n" | ||
7043 | |||
7044 | #: src/service/testing/gnunet-testing.c:386 | ||
7045 | msgid "create unique configuration files" | ||
7046 | msgstr "Ñтвара јединÑтвене датотеке подешавања" | ||
7047 | |||
7048 | #: src/service/testing/gnunet-testing.c:392 | ||
7049 | msgid "extract hostkey file from pre-computed hostkey list" | ||
7050 | msgstr "" | ||
7051 | "извлачи датотеку кључа доамћина из унапред прорачунатог ÑпиÑка кључа домаћина" | ||
7052 | |||
7053 | #: src/service/testing/gnunet-testing.c:400 | ||
7054 | msgid "" | ||
7055 | "number of unique configuration files to create, or number of the hostkey to " | ||
7056 | "extract" | ||
7057 | msgstr "" | 7063 | msgstr "" |
7058 | "број јединÑтвених датотека подешавања за Ñтварање, или број кључа домаћина " | 7064 | "број јединÑтвених датотека подешавања за Ñтварање, или број кључа домаћина " |
7059 | "за извлачење" | 7065 | "за извлачење" |
7060 | 7066 | ||
7061 | #: src/service/testing/gnunet-testing.c:407 | 7067 | #: src/service/testbed/gnunet-testbed.c:202 |
7062 | msgid "configuration template" | 7068 | msgid "configuration template" |
7063 | msgstr "шаблон подешавања" | 7069 | msgstr "шаблон подешавања" |
7064 | 7070 | ||
7065 | #: src/service/testing/gnunet-testing.c:415 | 7071 | #: src/service/testbed/gnunet-testbed.c:218 |
7066 | msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)" | ||
7067 | msgstr "" | ||
7068 | "покреће дату уÑлугу, чека на Ñтандардном улазу за „r“ (поновно покретање) " | ||
7069 | "или „q“ (излази)" | ||
7070 | |||
7071 | #: src/service/testing/gnunet-testing.c:432 | ||
7072 | msgid "Command line tool to access the testing library" | 7072 | msgid "Command line tool to access the testing library" |
7073 | msgstr "Ðлат линије наредби за приезуп библиотеци теÑтирања" | 7073 | msgstr "Ðлат линије наредби за приезуп библиотеци теÑтирања" |
7074 | 7074 | ||
7075 | #: src/service/testing/list-keys.c:92 | ||
7076 | msgid "list COUNT number of keys" | ||
7077 | msgstr "иÑпиÑује УКУПÐОСТ број парњака" | ||
7078 | |||
7079 | #: src/service/testing/testing.c:291 | ||
7080 | #, c-format | ||
7081 | msgid "Hostkeys file not found: %s\n" | ||
7082 | msgstr "ÐиÑам нашао датотеку кључева домаћина: %s\n" | ||
7083 | |||
7084 | #: src/service/testing/testing.c:743 | ||
7085 | #, c-format | ||
7086 | msgid "Key number %u does not exist\n" | ||
7087 | msgstr "Број кључа %u не поÑтоји\n" | ||
7088 | |||
7089 | #: src/service/testing/testing.c:1217 | ||
7090 | #, c-format | ||
7091 | msgid "" | ||
7092 | "You attempted to create a testbed with more than %u hosts. Please " | ||
7093 | "precompute more hostkeys first.\n" | ||
7094 | msgstr "" | ||
7095 | "Покушали Ñте да направите пробно меÑто Ñа више од %u домаћина. Прво пре " | ||
7096 | "Ñвега израчунајте више кључева домаћина.\n" | ||
7097 | |||
7098 | #: src/service/testing/testing.c:1226 | ||
7099 | #, c-format | ||
7100 | msgid "Failed to initialize hostkey for peer %u\n" | ||
7101 | msgstr "ÐиÑам уÑпео да покренем кључ домаћина за парњака %u\n" | ||
7102 | |||
7103 | #: src/service/testing/testing.c:1236 | ||
7104 | msgid "PRIVATE_KEY option in PEER section missing in configuration\n" | ||
7105 | msgstr "опција „PRIVATE_KEY“ у одељку „PEER“ недоÑтаје у подешавањима\n" | ||
7106 | |||
7107 | #: src/service/testing/testing.c:1249 | ||
7108 | msgid "Failed to create configuration for peer (not enough free ports?)\n" | ||
7109 | msgstr "" | ||
7110 | "ÐиÑам уÑпео да направим подешавање за парњака (нема довољно Ñлободних " | ||
7111 | "прикључника?)\n" | ||
7112 | |||
7113 | #: src/service/testing/testing.c:1265 | ||
7114 | #, c-format | ||
7115 | msgid "Cannot open hostkey file `%s': %s\n" | ||
7116 | msgstr "Ðе могу да отворим датотеку кључа домаћина „%s“: %s\n" | ||
7117 | |||
7118 | #: src/service/testing/testing.c:1279 | ||
7119 | #, c-format | ||
7120 | msgid "Failed to write hostkey file for peer %u: %s\n" | ||
7121 | msgstr "ÐиÑам уÑпео да запишем датотеку кључа домаћина за парњака %u: %s\n" | ||
7122 | |||
7123 | #: src/service/testing/testing.c:1307 | ||
7124 | #, c-format | ||
7125 | msgid "Failed to write configuration file `%s' for peer %u: %s\n" | ||
7126 | msgstr "ÐиÑам уÑпео да запишем датотеку подешавања „%s“ за парњака %u: %s\n" | ||
7127 | |||
7128 | #: src/service/testing/testing.c:1413 | ||
7129 | #, c-format | ||
7130 | msgid "Failed to start `%s': %s\n" | ||
7131 | msgstr "ÐиÑам уÑпео да покренем „%s“: %s\n" | ||
7132 | |||
7133 | #: src/service/testing/testing.c:1664 | ||
7134 | #, c-format | ||
7135 | msgid "Failed to load configuration from %s\n" | ||
7136 | msgstr "ÐиÑам уÑпео да учитам подешавање за „%s“\n" | ||
7137 | |||
7138 | #: src/service/testing/testing.c:2795 | ||
7139 | #, c-format | ||
7140 | msgid "Topology file %s not found\n" | ||
7141 | msgstr "ÐиÑам нашао датотеку размештаја „%s“\n" | ||
7142 | |||
7143 | #: src/service/testing/testing.c:2803 | ||
7144 | #, c-format | ||
7145 | msgid "Topology file %s has no data\n" | ||
7146 | msgstr "Датотека размештаја „%s“ нема података\n" | ||
7147 | |||
7148 | #: src/service/testing/testing.c:2811 | ||
7149 | #, c-format | ||
7150 | msgid "Topology file %s cannot be read\n" | ||
7151 | msgstr "Ðе могу да прочитам датотеку размештаја „%s“\n" | ||
7152 | |||
7153 | #: src/service/topology/gnunet-daemon-topology.c:286 | 7075 | #: src/service/topology/gnunet-daemon-topology.c:286 |
7154 | #, fuzzy | 7076 | #, fuzzy |
7155 | msgid "# connect requests issued to ATS" | 7077 | msgid "# connect requests issued to ATS" |
7156 | msgstr "# захтеви везе Ñу издати преноÑу" | 7078 | msgstr "# захтеви везе Ñу издати преноÑу" |
7157 | 7079 | ||
7158 | #: src/service/topology/gnunet-daemon-topology.c:480 | 7080 | #: src/service/topology/gnunet-daemon-topology.c:475 |
7159 | msgid "# HELLO messages gossipped" | 7081 | msgid "# HELLO messages gossipped" |
7160 | msgstr "# „HELLO“ поруке Ñу наклопљене" | 7082 | msgstr "# „HELLO“ поруке Ñу наклопљене" |
7161 | 7083 | ||
7162 | #: src/service/topology/gnunet-daemon-topology.c:752 | 7084 | #: src/service/topology/gnunet-daemon-topology.c:747 |
7163 | #, fuzzy | 7085 | #, fuzzy |
7164 | msgid "Error in communication with PEERSTORE service to monitor.\n" | 7086 | msgid "Error in communication with PEERSTORE service to monitor.\n" |
7165 | msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n" | 7087 | msgstr "Грешка у комуникацији Ñа уÑлугом ПОДÐЦИ_ПÐРЊÐКÐ: %s\n" |
7166 | 7088 | ||
7167 | #: src/service/topology/gnunet-daemon-topology.c:761 | 7089 | #: src/service/topology/gnunet-daemon-topology.c:756 |
7168 | msgid "Finished initial PEERSTORE iteration in monitor.\n" | 7090 | msgid "Finished initial PEERSTORE iteration in monitor.\n" |
7169 | msgstr "" | 7091 | msgstr "" |
7170 | 7092 | ||
7171 | #: src/service/topology/gnunet-daemon-topology.c:869 | 7093 | #: src/service/topology/gnunet-daemon-topology.c:864 |
7172 | msgid "Failed to connect to core service, can not manage topology!\n" | 7094 | msgid "Failed to connect to core service, can not manage topology!\n" |
7173 | msgstr "" | 7095 | msgstr "" |
7174 | "ÐиÑам уÑпео да Ñе повежем Ñа уÑлугом језгра, не могу да радим размештајем!\n" | 7096 | "ÐиÑам уÑпео да Ñе повежем Ñа уÑлугом језгра, не могу да радим размештајем!\n" |
7175 | 7097 | ||
7176 | #: src/service/topology/gnunet-daemon-topology.c:943 | 7098 | #: src/service/topology/gnunet-daemon-topology.c:938 |
7177 | msgid "# HELLO messages received" | 7099 | msgid "# HELLO messages received" |
7178 | msgstr "# „HELLO“ поруке Ñу примљене" | 7100 | msgstr "# „HELLO“ поруке Ñу примљене" |
7179 | 7101 | ||
7180 | #: src/service/topology/gnunet-daemon-topology.c:1095 | 7102 | #: src/service/topology/gnunet-daemon-topology.c:1091 |
7181 | msgid "GNUnet topology control" | 7103 | msgid "GNUnet topology control" |
7182 | msgstr "" | 7104 | msgstr "" |
7183 | 7105 | ||
7184 | #: src/service/transport/gnunet-communicator-quic.c:1717 | 7106 | #: src/service/transport/gnunet-communicator-quic.c:1717 |
7185 | #: src/service/transport/gnunet-communicator-tcp.c:3814 | 7107 | #: src/service/transport/gnunet-communicator-tcp.c:3814 |
7186 | #: src/service/transport/gnunet-communicator-udp.c:3562 | 7108 | #: src/service/transport/gnunet-communicator-udp.c:3579 |
7187 | #: src/service/transport/gnunet-service-transport.c:12124 | 7109 | #: src/service/transport/gnunet-service-transport.c:12543 |
7188 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7110 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7189 | msgstr "УÑлузи преноÑа недоÑтају поÑтавке подешавања кључа. Излазим.\n" | 7111 | msgstr "УÑлузи преноÑа недоÑтају поÑтавке подешавања кључа. Излазим.\n" |
7190 | 7112 | ||
@@ -7196,7 +7118,7 @@ msgstr "" | |||
7196 | msgid "GNUnet TCP communicator" | 7118 | msgid "GNUnet TCP communicator" |
7197 | msgstr "" | 7119 | msgstr "" |
7198 | 7120 | ||
7199 | #: src/service/transport/gnunet-communicator-udp.c:3637 | 7121 | #: src/service/transport/gnunet-communicator-udp.c:3654 |
7200 | msgid "GNUnet UDP communicator" | 7122 | msgid "GNUnet UDP communicator" |
7201 | msgstr "" | 7123 | msgstr "" |
7202 | 7124 | ||
@@ -7500,6 +7422,88 @@ msgstr "ÐиÑам уÑпео да реплицирам блок у оÑтави | |||
7500 | msgid "Failed to connect to the namestore!\n" | 7422 | msgid "Failed to connect to the namestore!\n" |
7501 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа Ñмештајем назива!\n" | 7423 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа Ñмештајем назива!\n" |
7502 | 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 | |||
7503 | #, fuzzy, c-format | 7507 | #, fuzzy, c-format |
7504 | #~ msgid "" | 7508 | #~ msgid "" |
7505 | #~ "Local peer: %s\n" | 7509 | #~ "Local peer: %s\n" |
@@ -9280,10 +9284,6 @@ msgstr "ÐиÑам уÑпео да Ñе повежем Ñа Ñмештајем Ð | |||
9280 | #~ msgstr "вредноÑÑ‚ за поÑтављање" | 9284 | #~ msgstr "вредноÑÑ‚ за поÑтављање" |
9281 | 9285 | ||
9282 | #, fuzzy | 9286 | #, fuzzy |
9283 | #~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | ||
9284 | #~ msgstr "Лоша датотека подешавања „%s“, излазим ...\n" | ||
9285 | |||
9286 | #, fuzzy | ||
9287 | #~ msgid "Unreadable or malformed configuration, exit ...\n" | 9287 | #~ msgid "Unreadable or malformed configuration, exit ...\n" |
9288 | #~ msgstr "Лоше подешавање, излазим ...\n" | 9288 | #~ msgstr "Лоше подешавање, излазим ...\n" |
9289 | 9289 | ||
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
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-15 09:19+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,26 +349,26 @@ msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | |||
349 | msgid "Failed to connect to CORE service!\n" | 349 | msgid "Failed to connect to CORE service!\n" |
350 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 350 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
351 | 351 | ||
352 | #: src/cli/core/gnunet-core.c:212 | 352 | #: src/cli/core/gnunet-core.c:213 |
353 | #, fuzzy | 353 | #, fuzzy |
354 | msgid "No argument given.\n" | 354 | msgid "No argument given.\n" |
355 | msgstr "# byte mottogs via TCP" | 355 | msgstr "# byte mottogs via TCP" |
356 | 356 | ||
357 | #: src/cli/core/gnunet-core.c:235 src/service/transport/gnunet-transport.c:1389 | 357 | #: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389 |
358 | #, fuzzy | 358 | #, fuzzy |
359 | msgid "provide information about all current connections (continuously)" | 359 | msgid "provide information about all current connections (continuously)" |
360 | msgstr "Skriv ut information om GNUnets motparter." | 360 | msgstr "Skriv ut information om GNUnets motparter." |
361 | 361 | ||
362 | #: src/cli/core/gnunet-core.c:241 | 362 | #: src/cli/core/gnunet-core.c:244 |
363 | msgid "Show our current peer identity" | 363 | msgid "Show our current peer identity" |
364 | msgstr "" | 364 | msgstr "" |
365 | 365 | ||
366 | #: src/cli/core/gnunet-core.c:248 | 366 | #: src/cli/core/gnunet-core.c:251 |
367 | #, fuzzy | 367 | #, fuzzy |
368 | msgid "Show current connections" | 368 | msgid "Show current connections" |
369 | msgstr "Nätverksanslutning" | 369 | msgstr "Nätverksanslutning" |
370 | 370 | ||
371 | #: src/cli/core/gnunet-core.c:259 | 371 | #: src/cli/core/gnunet-core.c:262 |
372 | #, fuzzy | 372 | #, fuzzy |
373 | msgid "Print information about connected peers." | 373 | msgid "Print information about connected peers." |
374 | msgstr "Skriv ut information om GNUnets motparter." | 374 | msgstr "Skriv ut information om GNUnets motparter." |
@@ -1081,54 +1081,54 @@ msgstr "Kunde inte komma åt namnrymdsinformation.\n" | |||
1081 | msgid "Unindex a file that was previously indexed with gnunet-publish." | 1081 | msgid "Unindex a file that was previously indexed with gnunet-publish." |
1082 | msgstr "" | 1082 | msgstr "" |
1083 | 1083 | ||
1084 | #: src/cli/gns/gnunet-gns.c:268 | 1084 | #: src/cli/gns/gnunet-gns.c:269 |
1085 | #, fuzzy, c-format | 1085 | #, fuzzy, c-format |
1086 | msgid "`%s' is not a valid DNS domain name\n" | 1086 | msgid "`%s' is not a valid DNS domain name\n" |
1087 | msgstr "\"%s\" är inte tillgänglig." | 1087 | msgstr "\"%s\" är inte tillgänglig." |
1088 | 1088 | ||
1089 | #: 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 |
1090 | #, fuzzy, c-format | 1090 | #, fuzzy, c-format |
1091 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" | 1091 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" |
1092 | msgstr "Misslyckades att leverera \"%s\" meddelande.\n" | 1092 | msgstr "Misslyckades att leverera \"%s\" meddelande.\n" |
1093 | 1093 | ||
1094 | #: src/cli/gns/gnunet-gns.c:294 | 1094 | #: src/cli/gns/gnunet-gns.c:295 |
1095 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" | 1095 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" |
1096 | msgstr "" | 1096 | msgstr "" |
1097 | 1097 | ||
1098 | #: src/cli/gns/gnunet-gns.c:305 | 1098 | #: src/cli/gns/gnunet-gns.c:306 |
1099 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 | 1099 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 |
1100 | #, fuzzy, c-format | 1100 | #, fuzzy, c-format |
1101 | msgid "Failed to connect to GNS\n" | 1101 | msgid "Failed to connect to GNS\n" |
1102 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 1102 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
1103 | 1103 | ||
1104 | #: src/cli/gns/gnunet-gns.c:318 | 1104 | #: src/cli/gns/gnunet-gns.c:325 |
1105 | #, c-format | 1105 | #, c-format |
1106 | msgid "Invalid typename specified, assuming `ANY'\n" | 1106 | msgid "Invalid typename specified, assuming `ANY'\n" |
1107 | msgstr "" | 1107 | msgstr "" |
1108 | 1108 | ||
1109 | #: src/cli/gns/gnunet-gns.c:358 | 1109 | #: src/cli/gns/gnunet-gns.c:365 |
1110 | msgid "Lookup a record for the given name" | 1110 | msgid "Lookup a record for the given name" |
1111 | msgstr "" | 1111 | msgstr "" |
1112 | 1112 | ||
1113 | #: src/cli/gns/gnunet-gns.c:364 | 1113 | #: src/cli/gns/gnunet-gns.c:371 |
1114 | #, fuzzy | 1114 | #, fuzzy |
1115 | msgid "Specify the type of the record to lookup" | 1115 | msgid "Specify the type of the record to lookup" |
1116 | msgstr "ange prioritet för innehållet" | 1116 | msgstr "ange prioritet för innehållet" |
1117 | 1117 | ||
1118 | #: src/cli/gns/gnunet-gns.c:370 | 1118 | #: src/cli/gns/gnunet-gns.c:377 |
1119 | #, fuzzy | 1119 | #, fuzzy |
1120 | msgid "Specify a timeout for the lookup" | 1120 | msgid "Specify a timeout for the lookup" |
1121 | msgstr "ange prioritet för innehållet" | 1121 | msgstr "ange prioritet för innehållet" |
1122 | 1122 | ||
1123 | #: src/cli/gns/gnunet-gns.c:374 | 1123 | #: src/cli/gns/gnunet-gns.c:381 |
1124 | msgid "No unneeded output" | 1124 | msgid "No unneeded output" |
1125 | msgstr "" | 1125 | msgstr "" |
1126 | 1126 | ||
1127 | #: src/cli/gns/gnunet-gns.c:379 | 1127 | #: src/cli/gns/gnunet-gns.c:386 |
1128 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" | 1128 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" |
1129 | msgstr "" | 1129 | msgstr "" |
1130 | 1130 | ||
1131 | #: src/cli/gns/gnunet-gns.c:393 | 1131 | #: src/cli/gns/gnunet-gns.c:400 |
1132 | #, fuzzy | 1132 | #, fuzzy |
1133 | msgid "GNUnet GNS resolver tool" | 1133 | msgid "GNUnet GNS resolver tool" |
1134 | msgstr "Spåra GNUnets nätverkstopologi." | 1134 | msgstr "Spåra GNUnets nätverkstopologi." |
@@ -1659,7 +1659,11 @@ msgstr "" | |||
1659 | msgid "GNUnet NAT traversal autoconfigure daemon" | 1659 | msgid "GNUnet NAT traversal autoconfigure daemon" |
1660 | msgstr "" | 1660 | msgstr "" |
1661 | 1661 | ||
1662 | #: src/cli/nse/gnunet-nse.c:124 | 1662 | #: src/cli/nse/gnunet-nse.c:126 |
1663 | msgid "Monitor and output current estimates" | ||
1664 | msgstr "" | ||
1665 | |||
1666 | #: src/cli/nse/gnunet-nse.c:137 | ||
1663 | #, fuzzy | 1667 | #, fuzzy |
1664 | msgid "Show network size estimates from NSE service." | 1668 | msgid "Show network size estimates from NSE service." |
1665 | msgstr "# byte mottogs via TCP" | 1669 | msgstr "# byte mottogs via TCP" |
@@ -1708,87 +1712,91 @@ msgstr "" | |||
1708 | msgid "The time until the DID Document is going to expire (e.g. 5d)" | 1712 | msgid "The time until the DID Document is going to expire (e.g. 5d)" |
1709 | msgstr "" | 1713 | msgstr "" |
1710 | 1714 | ||
1711 | #: src/cli/reclaim/gnunet-reclaim.c:805 | 1715 | #: src/cli/reclaim/gnunet-reclaim.c:813 |
1712 | #, fuzzy, c-format | 1716 | #, fuzzy, c-format |
1713 | msgid "Ego is required\n" | 1717 | msgid "Ego is required\n" |
1714 | msgstr "%s: flagga \"%s\" är tvetydig\n" | 1718 | msgstr "%s: flagga \"%s\" är tvetydig\n" |
1715 | 1719 | ||
1716 | #: src/cli/reclaim/gnunet-reclaim.c:812 | 1720 | #: src/cli/reclaim/gnunet-reclaim.c:820 |
1717 | #, c-format | 1721 | #, c-format |
1718 | msgid "Attribute value missing!\n" | 1722 | msgid "Attribute value missing!\n" |
1719 | msgstr "" | 1723 | msgstr "" |
1720 | 1724 | ||
1721 | #: src/cli/reclaim/gnunet-reclaim.c:819 | 1725 | #: src/cli/reclaim/gnunet-reclaim.c:827 |
1722 | #, fuzzy, c-format | 1726 | #, fuzzy, c-format |
1723 | msgid "Requesting party key is required!\n" | 1727 | msgid "Requesting party key is required!\n" |
1724 | msgstr "%s: flagga \"%s\" är tvetydig\n" | 1728 | msgstr "%s: flagga \"%s\" är tvetydig\n" |
1725 | 1729 | ||
1726 | #: src/cli/reclaim/gnunet-reclaim.c:837 | 1730 | #: src/cli/reclaim/gnunet-reclaim.c:846 |
1727 | msgid "Add or update an attribute NAME" | 1731 | msgid "Add or update an attribute NAME" |
1728 | msgstr "" | 1732 | msgstr "" |
1729 | 1733 | ||
1730 | #: src/cli/reclaim/gnunet-reclaim.c:842 | 1734 | #: src/cli/reclaim/gnunet-reclaim.c:851 |
1731 | msgid "Delete the attribute with ID" | 1735 | msgid "Delete the attribute with ID" |
1732 | msgstr "" | 1736 | msgstr "" |
1733 | 1737 | ||
1734 | #: src/cli/reclaim/gnunet-reclaim.c:847 | 1738 | #: src/cli/reclaim/gnunet-reclaim.c:856 |
1735 | msgid "The attribute VALUE" | 1739 | msgid "The attribute VALUE" |
1736 | msgstr "" | 1740 | msgstr "" |
1737 | 1741 | ||
1738 | #: src/cli/reclaim/gnunet-reclaim.c:852 | 1742 | #: src/cli/reclaim/gnunet-reclaim.c:861 |
1739 | #, fuzzy | 1743 | #, fuzzy |
1740 | msgid "The EGO to use" | 1744 | msgid "The EGO to use" |
1741 | msgstr "meddelandestorlek" | 1745 | msgstr "meddelandestorlek" |
1742 | 1746 | ||
1743 | #: src/cli/reclaim/gnunet-reclaim.c:858 | 1747 | #: src/cli/reclaim/gnunet-reclaim.c:867 |
1744 | msgid "Specify the relying party for issue" | 1748 | msgid "Specify the relying party for issue" |
1745 | msgstr "" | 1749 | msgstr "" |
1746 | 1750 | ||
1747 | #: src/cli/reclaim/gnunet-reclaim.c:862 | 1751 | #: src/cli/reclaim/gnunet-reclaim.c:873 |
1752 | msgid "Specify the relying party URI for a ticket to consume" | ||
1753 | msgstr "" | ||
1754 | |||
1755 | #: src/cli/reclaim/gnunet-reclaim.c:877 | ||
1748 | msgid "List attributes for EGO" | 1756 | msgid "List attributes for EGO" |
1749 | msgstr "" | 1757 | msgstr "" |
1750 | 1758 | ||
1751 | #: src/cli/reclaim/gnunet-reclaim.c:866 | 1759 | #: src/cli/reclaim/gnunet-reclaim.c:881 |
1752 | msgid "List credentials for EGO" | 1760 | msgid "List credentials for EGO" |
1753 | msgstr "" | 1761 | msgstr "" |
1754 | 1762 | ||
1755 | #: src/cli/reclaim/gnunet-reclaim.c:872 | 1763 | #: src/cli/reclaim/gnunet-reclaim.c:887 |
1756 | msgid "Credential to use for attribute" | 1764 | msgid "Credential to use for attribute" |
1757 | msgstr "" | 1765 | msgstr "" |
1758 | 1766 | ||
1759 | #: src/cli/reclaim/gnunet-reclaim.c:877 | 1767 | #: src/cli/reclaim/gnunet-reclaim.c:892 |
1760 | msgid "Credential name" | 1768 | msgid "Credential name" |
1761 | msgstr "" | 1769 | msgstr "" |
1762 | 1770 | ||
1763 | #: src/cli/reclaim/gnunet-reclaim.c:883 | 1771 | #: src/cli/reclaim/gnunet-reclaim.c:898 |
1764 | msgid "Issue a ticket for a set of attributes separated by comma" | 1772 | msgid "Issue a ticket for a set of attributes separated by comma" |
1765 | msgstr "" | 1773 | msgstr "" |
1766 | 1774 | ||
1767 | #: src/cli/reclaim/gnunet-reclaim.c:888 | 1775 | #: src/cli/reclaim/gnunet-reclaim.c:903 |
1768 | msgid "Consume a ticket" | 1776 | msgid "Consume a ticket" |
1769 | msgstr "" | 1777 | msgstr "" |
1770 | 1778 | ||
1771 | #: src/cli/reclaim/gnunet-reclaim.c:893 | 1779 | #: src/cli/reclaim/gnunet-reclaim.c:908 |
1772 | msgid "Revoke a ticket" | 1780 | msgid "Revoke a ticket" |
1773 | msgstr "" | 1781 | msgstr "" |
1774 | 1782 | ||
1775 | #: src/cli/reclaim/gnunet-reclaim.c:898 | 1783 | #: src/cli/reclaim/gnunet-reclaim.c:913 |
1776 | msgid "Type of attribute" | 1784 | msgid "Type of attribute" |
1777 | msgstr "" | 1785 | msgstr "" |
1778 | 1786 | ||
1779 | #: src/cli/reclaim/gnunet-reclaim.c:903 | 1787 | #: src/cli/reclaim/gnunet-reclaim.c:918 |
1780 | msgid "Type of credential" | 1788 | msgid "Type of credential" |
1781 | msgstr "" | 1789 | msgstr "" |
1782 | 1790 | ||
1783 | #: src/cli/reclaim/gnunet-reclaim.c:907 | 1791 | #: src/cli/reclaim/gnunet-reclaim.c:922 |
1784 | msgid "List tickets of ego" | 1792 | msgid "List tickets of ego" |
1785 | msgstr "" | 1793 | msgstr "" |
1786 | 1794 | ||
1787 | #: src/cli/reclaim/gnunet-reclaim.c:913 | 1795 | #: src/cli/reclaim/gnunet-reclaim.c:928 |
1788 | msgid "Expiration interval of the attribute" | 1796 | msgid "Expiration interval of the attribute" |
1789 | msgstr "" | 1797 | msgstr "" |
1790 | 1798 | ||
1791 | #: src/cli/reclaim/gnunet-reclaim.c:921 | 1799 | #: src/cli/reclaim/gnunet-reclaim.c:936 |
1792 | msgid "re:claimID command line tool" | 1800 | msgid "re:claimID command line tool" |
1793 | msgstr "" | 1801 | msgstr "" |
1794 | 1802 | ||
@@ -2027,34 +2035,59 @@ msgstr "Skriv ut statistik om GNUnet-operationer." | |||
2027 | msgid "run decoder modus, otherwise runs as encoder" | 2035 | msgid "run decoder modus, otherwise runs as encoder" |
2028 | msgstr "" | 2036 | msgstr "" |
2029 | 2037 | ||
2030 | #: src/cli/util/gnunet-config.c:154 | 2038 | #: src/cli/util/gnunet-config.c:101 |
2031 | msgid "test if the current installation supports the specified BACKEND" | 2039 | msgid "test if the current installation supports the specified BACKEND" |
2032 | msgstr "" | 2040 | msgstr "" |
2033 | 2041 | ||
2034 | #: src/cli/util/gnunet-config.c:160 | 2042 | #: src/cli/util/gnunet-config.c:107 |
2035 | msgid "" | 2043 | msgid "" |
2036 | "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 " |
2037 | "GNUnet" | 2045 | "GNUnet" |
2038 | msgstr "" | 2046 | msgstr "" |
2039 | 2047 | ||
2040 | #: src/cli/util/gnunet-config.c:165 | 2048 | #: src/cli/util/gnunet-config.c:112 |
2041 | msgid "Is this an experimental build of GNUnet" | 2049 | msgid "Is this an experimental build of GNUnet" |
2042 | msgstr "" | 2050 | msgstr "" |
2043 | 2051 | ||
2044 | #: src/cli/util/gnunet-config.c:171 | 2052 | #: src/cli/util/gnunet-config.c:118 |
2045 | msgid "" | 2053 | msgid "" |
2046 | "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 " |
2047 | "GNUnet" | 2055 | "GNUnet" |
2048 | msgstr "" | 2056 | msgstr "" |
2049 | 2057 | ||
2050 | #: src/cli/util/gnunet-config.c:177 | 2058 | #: src/cli/util/gnunet-config.c:123 |
2059 | #, fuzzy | ||
2060 | msgid "Do not parse default configuration files" | ||
2061 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" | ||
2062 | |||
2063 | #: src/cli/util/gnunet-config.c:129 | ||
2051 | msgid "Provide the path under which GNUnet was installed" | 2064 | msgid "Provide the path under which GNUnet was installed" |
2052 | msgstr "" | 2065 | msgstr "" |
2053 | 2066 | ||
2054 | #: src/cli/util/gnunet-config.c:192 | 2067 | #: src/cli/util/gnunet-config.c:136 |
2068 | msgid "" | ||
2069 | "Parse main configuration from this command-line argument and not from disk" | ||
2070 | msgstr "" | ||
2071 | |||
2072 | #: src/cli/util/gnunet-config.c:225 | ||
2055 | #, fuzzy | 2073 | #, fuzzy |
2056 | msgid "Manipulate GNUnet configuration files" | 2074 | msgid "Failed to load default configuration, exiting ...\n" |
2057 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" | 2075 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
2076 | |||
2077 | #: src/cli/util/gnunet-config.c:237 | ||
2078 | #, fuzzy | ||
2079 | msgid "Failed to parse configuration, exiting ...\n" | ||
2080 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | ||
2081 | |||
2082 | #: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287 | ||
2083 | #, fuzzy, c-format | ||
2084 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
2085 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | ||
2086 | |||
2087 | #: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299 | ||
2088 | #, fuzzy, c-format | ||
2089 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
2090 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | ||
2058 | 2091 | ||
2059 | #: src/cli/util/gnunet-crypto-tvg.c:1588 | 2092 | #: src/cli/util/gnunet-crypto-tvg.c:1588 |
2060 | msgid "verify a test vector from stdin" | 2093 | msgid "verify a test vector from stdin" |
@@ -2101,55 +2134,54 @@ msgstr "" | |||
2101 | msgid "Hostkeys file `%s' not found\n" | 2134 | msgid "Hostkeys file `%s' not found\n" |
2102 | msgstr "\"%s\" misslyckades: tabell hittades inte!\n" | 2135 | msgstr "\"%s\" misslyckades: tabell hittades inte!\n" |
2103 | 2136 | ||
2104 | #: src/cli/util/gnunet-ecc.c:314 | 2137 | #: src/cli/util/gnunet-ecc.c:318 |
2105 | #, fuzzy, c-format | 2138 | #, fuzzy, c-format |
2106 | msgid "Hostkeys file `%s' is empty\n" | 2139 | msgid "Hostkeys file `%s' is empty\n" |
2107 | msgstr "antal meddelanden att använda per iteration" | 2140 | msgstr "antal meddelanden att använda per iteration" |
2108 | 2141 | ||
2109 | #: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 | 2142 | #: src/cli/util/gnunet-ecc.c:324 |
2110 | #: src/service/testing/testing.c:308 | ||
2111 | #, c-format | 2143 | #, c-format |
2112 | msgid "Incorrect hostkey file format: %s\n" | 2144 | msgid "Incorrect hostkey file format: %s\n" |
2113 | msgstr "" | 2145 | msgstr "" |
2114 | 2146 | ||
2115 | #: src/cli/util/gnunet-ecc.c:334 | 2147 | #: src/cli/util/gnunet-ecc.c:340 |
2116 | #, fuzzy, c-format | 2148 | #, fuzzy, c-format |
2117 | msgid "Could not read hostkey file: %s\n" | 2149 | msgid "Could not read hostkey file: %s\n" |
2118 | msgstr "Kunde inte skapa värdnyckel!\n" | 2150 | msgstr "Kunde inte skapa värdnyckel!\n" |
2119 | 2151 | ||
2120 | #: src/cli/util/gnunet-ecc.c:388 | 2152 | #: src/cli/util/gnunet-ecc.c:394 |
2121 | msgid "No hostkey file specified on command line\n" | 2153 | msgid "No hostkey file specified on command line\n" |
2122 | msgstr "" | 2154 | msgstr "" |
2123 | 2155 | ||
2124 | #: src/cli/util/gnunet-ecc.c:452 | 2156 | #: src/cli/util/gnunet-ecc.c:458 |
2125 | msgid "list keys included in a file (for testing)" | 2157 | msgid "list keys included in a file (for testing)" |
2126 | msgstr "" | 2158 | msgstr "" |
2127 | 2159 | ||
2128 | #: src/cli/util/gnunet-ecc.c:458 | 2160 | #: src/cli/util/gnunet-ecc.c:464 |
2129 | msgid "number of keys to list included in a file (for testing)" | 2161 | msgid "number of keys to list included in a file (for testing)" |
2130 | msgstr "" | 2162 | msgstr "" |
2131 | 2163 | ||
2132 | #: src/cli/util/gnunet-ecc.c:464 | 2164 | #: src/cli/util/gnunet-ecc.c:470 |
2133 | msgid "create COUNT public-private key pairs (for testing)" | 2165 | msgid "create COUNT public-private key pairs (for testing)" |
2134 | msgstr "" | 2166 | msgstr "" |
2135 | 2167 | ||
2136 | #: src/cli/util/gnunet-ecc.c:469 | 2168 | #: src/cli/util/gnunet-ecc.c:475 |
2137 | msgid "print the public key in ASCII format" | 2169 | msgid "print the public key in ASCII format" |
2138 | msgstr "" | 2170 | msgstr "" |
2139 | 2171 | ||
2140 | #: src/cli/util/gnunet-ecc.c:474 | 2172 | #: src/cli/util/gnunet-ecc.c:480 |
2141 | msgid "print the private key in ASCII format" | 2173 | msgid "print the private key in ASCII format" |
2142 | msgstr "" | 2174 | msgstr "" |
2143 | 2175 | ||
2144 | #: src/cli/util/gnunet-ecc.c:479 | 2176 | #: src/cli/util/gnunet-ecc.c:485 |
2145 | msgid "print the public key in HEX format" | 2177 | msgid "print the public key in HEX format" |
2146 | msgstr "" | 2178 | msgstr "" |
2147 | 2179 | ||
2148 | #: src/cli/util/gnunet-ecc.c:485 | 2180 | #: src/cli/util/gnunet-ecc.c:491 |
2149 | msgid "print examples of ECC operations (used for compatibility testing)" | 2181 | msgid "print examples of ECC operations (used for compatibility testing)" |
2150 | msgstr "" | 2182 | msgstr "" |
2151 | 2183 | ||
2152 | #: src/cli/util/gnunet-ecc.c:499 | 2184 | #: src/cli/util/gnunet-ecc.c:505 |
2153 | #, fuzzy | 2185 | #, fuzzy |
2154 | msgid "Manipulate GNUnet private ECC key files" | 2186 | msgid "Manipulate GNUnet private ECC key files" |
2155 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" | 2187 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" |
@@ -3241,13 +3273,13 @@ msgstr "" | |||
3241 | msgid "Invalid handle type while writing `%s'" | 3273 | msgid "Invalid handle type while writing `%s'" |
3242 | msgstr "Ogiltigt format för IP: \"%s\"\n" | 3274 | msgstr "Ogiltigt format för IP: \"%s\"\n" |
3243 | 3275 | ||
3244 | #: 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 |
3245 | #: src/service/arm/gnunet-service-arm.c:452 | 3277 | #: src/service/arm/gnunet-service-arm.c:452 |
3246 | #, c-format | 3278 | #, c-format |
3247 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 3279 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
3248 | msgstr "" | 3280 | msgstr "" |
3249 | 3281 | ||
3250 | #: 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 |
3251 | #: src/service/arm/gnunet-service-arm.c:456 | 3283 | #: src/service/arm/gnunet-service-arm.c:456 |
3252 | #, fuzzy, c-format | 3284 | #, fuzzy, c-format |
3253 | msgid "Using `%s' instead\n" | 3285 | msgid "Using `%s' instead\n" |
@@ -3376,17 +3408,17 @@ msgstr "" | |||
3376 | msgid "`%s' failed at %s:%d with error: %s\n" | 3408 | msgid "`%s' failed at %s:%d with error: %s\n" |
3377 | msgstr "\"%s\" misslyckades vid %s:%d med fel: %s\n" | 3409 | msgstr "\"%s\" misslyckades vid %s:%d med fel: %s\n" |
3378 | 3410 | ||
3379 | #: src/lib/util/crypto_ecc.c:554 | 3411 | #: src/lib/util/crypto_ecc.c:569 |
3380 | #, fuzzy, c-format | 3412 | #, fuzzy, c-format |
3381 | msgid "ECC signing failed at %s:%d: %s\n" | 3413 | msgid "ECC signing failed at %s:%d: %s\n" |
3382 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" | 3414 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" |
3383 | 3415 | ||
3384 | #: src/lib/util/crypto_ecc.c:677 | 3416 | #: src/lib/util/crypto_ecc.c:692 |
3385 | #, fuzzy, c-format | 3417 | #, fuzzy, c-format |
3386 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 3418 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
3387 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" | 3419 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" |
3388 | 3420 | ||
3389 | #: 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 |
3390 | #, fuzzy | 3422 | #, fuzzy |
3391 | msgid "Could not load peer's private key\n" | 3423 | msgid "Could not load peer's private key\n" |
3392 | msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n" | 3424 | msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n" |
@@ -3411,7 +3443,7 @@ msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" | |||
3411 | msgid "Expected `%s' to be a directory!\n" | 3443 | msgid "Expected `%s' to be a directory!\n" |
3412 | msgstr "\"%s\" förväntade att \"%s\" skulle vara en katalog!\n" | 3444 | msgstr "\"%s\" förväntade att \"%s\" skulle vara en katalog!\n" |
3413 | 3445 | ||
3414 | #: 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 |
3415 | #, fuzzy, c-format | 3447 | #, fuzzy, c-format |
3416 | msgid "Cannot obtain information about user `%s': %s\n" | 3448 | msgid "Cannot obtain information about user `%s': %s\n" |
3417 | msgstr "Kan inte öppna konfigurationsfil \"%s\".\n" | 3449 | msgstr "Kan inte öppna konfigurationsfil \"%s\".\n" |
@@ -3604,98 +3636,98 @@ msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n" | |||
3604 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 3636 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
3605 | msgstr "" | 3637 | msgstr "" |
3606 | 3638 | ||
3607 | #: src/lib/util/gnunet_error_codes.c:60 | 3639 | #: src/lib/util/gnunet_error_codes.c:59 |
3608 | msgid "No error (success)." | 3640 | msgid "No error (success)." |
3609 | msgstr "" | 3641 | msgstr "" |
3610 | 3642 | ||
3611 | #: src/lib/util/gnunet_error_codes.c:66 | 3643 | #: src/lib/util/gnunet_error_codes.c:65 |
3612 | #, fuzzy | 3644 | #, fuzzy |
3613 | msgid "Unknown and unspecified error." | 3645 | msgid "Unknown and unspecified error." |
3614 | msgstr "Okänt fel" | 3646 | msgstr "Okänt fel" |
3615 | 3647 | ||
3616 | #: src/lib/util/gnunet_error_codes.c:72 | 3648 | #: src/lib/util/gnunet_error_codes.c:71 |
3617 | #, fuzzy | 3649 | #, fuzzy |
3618 | msgid "Communication with service failed." | 3650 | msgid "Communication with service failed." |
3619 | msgstr "Skriv ut information om GNUnets motparter." | 3651 | msgstr "Skriv ut information om GNUnets motparter." |
3620 | 3652 | ||
3621 | #: src/lib/util/gnunet_error_codes.c:78 | 3653 | #: src/lib/util/gnunet_error_codes.c:77 |
3622 | #, fuzzy | 3654 | #, fuzzy |
3623 | msgid "Ego not found." | 3655 | msgid "Ego not found." |
3624 | msgstr "Kommando \"%s\" hittades inte!\n" | 3656 | msgstr "Kommando \"%s\" hittades inte!\n" |
3625 | 3657 | ||
3626 | #: src/lib/util/gnunet_error_codes.c:84 | 3658 | #: src/lib/util/gnunet_error_codes.c:83 |
3627 | msgid "Identifier already in use for another ego." | 3659 | msgid "Identifier already in use for another ego." |
3628 | msgstr "" | 3660 | msgstr "" |
3629 | 3661 | ||
3630 | #: src/lib/util/gnunet_error_codes.c:90 | 3662 | #: src/lib/util/gnunet_error_codes.c:89 |
3631 | msgid "The given ego is invalid or malformed." | 3663 | msgid "The given ego is invalid or malformed." |
3632 | msgstr "" | 3664 | msgstr "" |
3633 | 3665 | ||
3634 | #: src/lib/util/gnunet_error_codes.c:96 | 3666 | #: src/lib/util/gnunet_error_codes.c:95 |
3635 | #, fuzzy | 3667 | #, fuzzy |
3636 | msgid "Unknown namestore error." | 3668 | msgid "Unknown namestore error." |
3637 | msgstr "Okänt fel" | 3669 | msgstr "Okänt fel" |
3638 | 3670 | ||
3639 | #: 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 |
3640 | #, fuzzy | 3672 | #, fuzzy |
3641 | msgid "Zone iteration failed." | 3673 | msgid "Zone iteration failed." |
3642 | msgstr "# sessionsnycklar accepterade" | 3674 | msgstr "# sessionsnycklar accepterade" |
3643 | 3675 | ||
3644 | #: src/lib/util/gnunet_error_codes.c:108 | 3676 | #: src/lib/util/gnunet_error_codes.c:107 |
3645 | #, fuzzy | 3677 | #, fuzzy |
3646 | msgid "Zone not found." | 3678 | msgid "Zone not found." |
3647 | msgstr "Kommando \"%s\" hittades inte!\n" | 3679 | msgstr "Kommando \"%s\" hittades inte!\n" |
3648 | 3680 | ||
3649 | #: src/lib/util/gnunet_error_codes.c:114 | 3681 | #: src/lib/util/gnunet_error_codes.c:113 |
3650 | #, fuzzy | 3682 | #, fuzzy |
3651 | msgid "Record not found." | 3683 | msgid "Record not found." |
3652 | msgstr "Kommando \"%s\" hittades inte!\n" | 3684 | msgstr "Kommando \"%s\" hittades inte!\n" |
3653 | 3685 | ||
3654 | #: src/lib/util/gnunet_error_codes.c:126 | 3686 | #: src/lib/util/gnunet_error_codes.c:125 |
3655 | msgid "Zone does not contain any records." | 3687 | msgid "Zone does not contain any records." |
3656 | msgstr "" | 3688 | msgstr "" |
3657 | 3689 | ||
3658 | #: src/lib/util/gnunet_error_codes.c:132 | 3690 | #: src/lib/util/gnunet_error_codes.c:131 |
3659 | #, fuzzy | 3691 | #, fuzzy |
3660 | msgid "Failed to lookup record." | 3692 | msgid "Failed to lookup record." |
3661 | msgstr "Misslyckades att starta samling.\n" | 3693 | msgstr "Misslyckades att starta samling.\n" |
3662 | 3694 | ||
3663 | #: src/lib/util/gnunet_error_codes.c:138 | 3695 | #: src/lib/util/gnunet_error_codes.c:137 |
3664 | #, fuzzy | 3696 | #, fuzzy |
3665 | msgid "No records given." | 3697 | msgid "No records given." |
3666 | msgstr "Skriv ut information om GNUnets motparter." | 3698 | msgstr "Skriv ut information om GNUnets motparter." |
3667 | 3699 | ||
3668 | #: src/lib/util/gnunet_error_codes.c:144 | 3700 | #: src/lib/util/gnunet_error_codes.c:143 |
3669 | msgid "Record data invalid." | 3701 | msgid "Record data invalid." |
3670 | msgstr "" | 3702 | msgstr "" |
3671 | 3703 | ||
3672 | #: src/lib/util/gnunet_error_codes.c:150 | 3704 | #: src/lib/util/gnunet_error_codes.c:149 |
3673 | msgid "No label given." | 3705 | msgid "No label given." |
3674 | msgstr "" | 3706 | msgstr "" |
3675 | 3707 | ||
3676 | #: src/lib/util/gnunet_error_codes.c:156 | 3708 | #: src/lib/util/gnunet_error_codes.c:155 |
3677 | #, fuzzy | 3709 | #, fuzzy |
3678 | msgid "No results given." | 3710 | msgid "No results given." |
3679 | msgstr "# byte mottogs via TCP" | 3711 | msgstr "# byte mottogs via TCP" |
3680 | 3712 | ||
3681 | #: src/lib/util/gnunet_error_codes.c:162 | 3713 | #: src/lib/util/gnunet_error_codes.c:161 |
3682 | msgid "Record already exists." | 3714 | msgid "Record already exists." |
3683 | msgstr "" | 3715 | msgstr "" |
3684 | 3716 | ||
3685 | #: src/lib/util/gnunet_error_codes.c:168 | 3717 | #: src/lib/util/gnunet_error_codes.c:167 |
3686 | msgid "Record size exceeds maximum limit." | 3718 | msgid "Record size exceeds maximum limit." |
3687 | msgstr "" | 3719 | msgstr "" |
3688 | 3720 | ||
3689 | #: src/lib/util/gnunet_error_codes.c:174 | 3721 | #: src/lib/util/gnunet_error_codes.c:173 |
3690 | msgid "There was an error in the database backend." | 3722 | msgid "There was an error in the database backend." |
3691 | msgstr "" | 3723 | msgstr "" |
3692 | 3724 | ||
3693 | #: src/lib/util/gnunet_error_codes.c:180 | 3725 | #: src/lib/util/gnunet_error_codes.c:179 |
3694 | #, fuzzy | 3726 | #, fuzzy |
3695 | msgid "Failed to store the given records." | 3727 | msgid "Failed to store the given records." |
3696 | msgstr "Misslyckades att starta samling.\n" | 3728 | msgstr "Misslyckades att starta samling.\n" |
3697 | 3729 | ||
3698 | #: src/lib/util/gnunet_error_codes.c:186 | 3730 | #: src/lib/util/gnunet_error_codes.c:185 |
3699 | msgid "Label invalid or malformed." | 3731 | msgid "Label invalid or malformed." |
3700 | msgstr "" | 3732 | msgstr "" |
3701 | 3733 | ||
@@ -3762,16 +3794,6 @@ msgstr "\"%s\" misslyckades vid %s:%d med fel: %s\n" | |||
3762 | msgid "Could not determine plugin installation path.\n" | 3794 | msgid "Could not determine plugin installation path.\n" |
3763 | msgstr "Kunde inte fastställa min publika IPv6-adress.\n" | 3795 | msgstr "Kunde inte fastställa min publika IPv6-adress.\n" |
3764 | 3796 | ||
3765 | #: src/lib/util/program.c:287 | ||
3766 | #, fuzzy, c-format | ||
3767 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
3768 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | ||
3769 | |||
3770 | #: src/lib/util/program.c:299 | ||
3771 | #, fuzzy, c-format | ||
3772 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
3773 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | ||
3774 | |||
3775 | #: src/lib/util/program.c:314 | 3797 | #: src/lib/util/program.c:314 |
3776 | #, fuzzy, c-format | 3798 | #, fuzzy, c-format |
3777 | msgid "Unreadable configuration file `%s'. Exiting ...\n" | 3799 | msgid "Unreadable configuration file `%s'. Exiting ...\n" |
@@ -3822,121 +3844,121 @@ msgstr "" | |||
3822 | msgid "Could not resolve our FQDN: %s\n" | 3844 | msgid "Could not resolve our FQDN: %s\n" |
3823 | msgstr "Kunde inte slå upp \"%s\": %s\n" | 3845 | msgstr "Kunde inte slå upp \"%s\": %s\n" |
3824 | 3846 | ||
3825 | #: src/lib/util/service.c:654 | 3847 | #: src/lib/util/service.c:650 |
3826 | #, c-format | 3848 | #, c-format |
3827 | msgid "" | 3849 | msgid "" |
3828 | "Processing code for message of type %u did not call " | 3850 | "Processing code for message of type %u did not call " |
3829 | "`GNUNET_SERVICE_client_continue' after %s\n" | 3851 | "`GNUNET_SERVICE_client_continue' after %s\n" |
3830 | msgstr "" | 3852 | msgstr "" |
3831 | 3853 | ||
3832 | #: src/lib/util/service.c:838 | 3854 | #: src/lib/util/service.c:841 |
3833 | #, fuzzy, c-format | 3855 | #, fuzzy, c-format |
3834 | msgid "Unknown address family %d\n" | 3856 | msgid "Unknown address family %d\n" |
3835 | msgstr "Okänd operation \"%s\"\n" | 3857 | msgstr "Okänd operation \"%s\"\n" |
3836 | 3858 | ||
3837 | #: src/lib/util/service.c:951 | 3859 | #: src/lib/util/service.c:956 |
3838 | #, c-format | 3860 | #, c-format |
3839 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" | 3861 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" |
3840 | msgstr "" | 3862 | msgstr "" |
3841 | 3863 | ||
3842 | #: src/lib/util/service.c:992 | 3864 | #: src/lib/util/service.c:997 |
3843 | #, c-format | 3865 | #, c-format |
3844 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" | 3866 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" |
3845 | msgstr "" | 3867 | msgstr "" |
3846 | 3868 | ||
3847 | #: 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 |
3848 | #: src/service/arm/gnunet-service-arm.c:412 | 3870 | #: src/service/arm/gnunet-service-arm.c:412 |
3849 | #: src/service/arm/gnunet-service-arm.c:418 | 3871 | #: src/service/arm/gnunet-service-arm.c:418 |
3850 | #, c-format | 3872 | #, c-format |
3851 | msgid "Require valid port number for service `%s' in configuration!\n" | 3873 | msgid "Require valid port number for service `%s' in configuration!\n" |
3852 | msgstr "" | 3874 | msgstr "" |
3853 | 3875 | ||
3854 | #: 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 |
3855 | #, c-format | 3877 | #, c-format |
3856 | msgid "" | 3878 | msgid "" |
3857 | "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 " |
3858 | "domain socket: %s\n" | 3880 | "domain socket: %s\n" |
3859 | msgstr "" | 3881 | msgstr "" |
3860 | 3882 | ||
3861 | #: 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 |
3862 | #, c-format | 3884 | #, c-format |
3863 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | 3885 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" |
3864 | msgstr "" | 3886 | msgstr "" |
3865 | 3887 | ||
3866 | #: 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 |
3867 | #, fuzzy, c-format | 3889 | #, fuzzy, c-format |
3868 | msgid "Failed to resolve `%s': %s\n" | 3890 | msgid "Failed to resolve `%s': %s\n" |
3869 | msgstr "Misslyckades att leverera \"%s\" meddelande.\n" | 3891 | msgstr "Misslyckades att leverera \"%s\" meddelande.\n" |
3870 | 3892 | ||
3871 | #: 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 |
3872 | #, fuzzy, c-format | 3894 | #, fuzzy, c-format |
3873 | msgid "Failed to find %saddress for `%s'.\n" | 3895 | msgid "Failed to find %saddress for `%s'.\n" |
3874 | msgstr "Misslyckades att binda till UDP-port %d.\n" | 3896 | msgstr "Misslyckades att binda till UDP-port %d.\n" |
3875 | 3897 | ||
3876 | # drive = hard drive ? | 3898 | # drive = hard drive ? |
3877 | #: src/lib/util/service.c:1401 | 3899 | #: src/lib/util/service.c:1406 |
3878 | #, fuzzy, c-format | 3900 | #, fuzzy, c-format |
3879 | msgid "`%s' failed for port %d (%s).\n" | 3901 | msgid "`%s' failed for port %d (%s).\n" |
3880 | msgstr "\"%s\" misslyckades för enhet %s: %u\n" | 3902 | msgstr "\"%s\" misslyckades för enhet %s: %u\n" |
3881 | 3903 | ||
3882 | #: src/lib/util/service.c:1413 | 3904 | #: src/lib/util/service.c:1418 |
3883 | #, fuzzy, c-format | 3905 | #, fuzzy, c-format |
3884 | msgid "`%s' failed for port %d (%s): address already in use\n" | 3906 | msgid "`%s' failed for port %d (%s): address already in use\n" |
3885 | msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n" | 3907 | msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n" |
3886 | 3908 | ||
3887 | #: src/lib/util/service.c:1420 | 3909 | #: src/lib/util/service.c:1425 |
3888 | #, fuzzy, c-format | 3910 | #, fuzzy, c-format |
3889 | msgid "`%s' failed for `%s': address already in use\n" | 3911 | msgid "`%s' failed for `%s': address already in use\n" |
3890 | msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n" | 3912 | msgstr "\"%s\" misslyckades för port %d: %s. Körs verkligen gnunetd?\n" |
3891 | 3913 | ||
3892 | #: src/lib/util/service.c:1481 | 3914 | #: src/lib/util/service.c:1486 |
3893 | #, c-format | 3915 | #, c-format |
3894 | msgid "Specified value for `%s' of service `%s' is invalid\n" | 3916 | msgid "Specified value for `%s' of service `%s' is invalid\n" |
3895 | msgstr "" | 3917 | msgstr "" |
3896 | 3918 | ||
3897 | #: src/lib/util/service.c:1505 | 3919 | #: src/lib/util/service.c:1510 |
3898 | #, c-format | 3920 | #, c-format |
3899 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" | 3921 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" |
3900 | msgstr "" | 3922 | msgstr "" |
3901 | 3923 | ||
3902 | #: src/lib/util/service.c:1573 | 3924 | #: src/lib/util/service.c:1583 |
3903 | msgid "" | 3925 | msgid "" |
3904 | "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" |
3905 | msgstr "" | 3927 | msgstr "" |
3906 | 3928 | ||
3907 | #: src/lib/util/service.c:1644 | 3929 | #: src/lib/util/service.c:1653 |
3908 | msgid "No such user" | 3930 | msgid "No such user" |
3909 | msgstr "" | 3931 | msgstr "" |
3910 | 3932 | ||
3911 | #: src/lib/util/service.c:1658 | 3933 | #: src/lib/util/service.c:1668 |
3912 | #, c-format | 3934 | #, c-format |
3913 | msgid "Cannot change user/group to `%s': %s\n" | 3935 | msgid "Cannot change user/group to `%s': %s\n" |
3914 | msgstr "Kan inte ändra användare/grupp till \"%s\": %s\n" | 3936 | msgstr "Kan inte ändra användare/grupp till \"%s\": %s\n" |
3915 | 3937 | ||
3916 | #: src/lib/util/service.c:1751 | 3938 | #: src/lib/util/service.c:1767 |
3917 | msgid "Service process failed to initialize\n" | 3939 | msgid "Service process failed to initialize\n" |
3918 | msgstr "" | 3940 | msgstr "" |
3919 | 3941 | ||
3920 | #: src/lib/util/service.c:1756 | 3942 | #: src/lib/util/service.c:1772 |
3921 | msgid "Service process could not initialize server function\n" | 3943 | msgid "Service process could not initialize server function\n" |
3922 | msgstr "" | 3944 | msgstr "" |
3923 | 3945 | ||
3924 | #: src/lib/util/service.c:1761 | 3946 | #: src/lib/util/service.c:1777 |
3925 | msgid "Service process failed to report status\n" | 3947 | msgid "Service process failed to report status\n" |
3926 | msgstr "" | 3948 | msgstr "" |
3927 | 3949 | ||
3928 | #: 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 |
3929 | msgid "do daemonize (detach from terminal)" | 3951 | msgid "do daemonize (detach from terminal)" |
3930 | msgstr "" | 3952 | msgstr "" |
3931 | 3953 | ||
3932 | #: 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 |
3933 | #: 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 |
3934 | #: src/service/transport/transport-testing-communicator.c:1056 | 3956 | #: src/service/transport/transport-testing-communicator.c:1059 |
3935 | #, fuzzy, c-format | 3957 | #, fuzzy, c-format |
3936 | msgid "Malformed configuration file `%s', exit ...\n" | 3958 | msgid "Malformed configuration file `%s', exit ...\n" |
3937 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 3959 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
3938 | 3960 | ||
3939 | #: 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 |
3940 | #, fuzzy | 3962 | #, fuzzy |
3941 | msgid "Malformed configuration, exit ...\n" | 3963 | msgid "Malformed configuration, exit ...\n" |
3942 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 3964 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
@@ -4394,6 +4416,11 @@ msgstr "" | |||
4394 | msgid "Initiating shutdown as requested by client.\n" | 4416 | msgid "Initiating shutdown as requested by client.\n" |
4395 | msgstr "" | 4417 | msgstr "" |
4396 | 4418 | ||
4419 | #: src/service/arm/testing_arm_cmd_start_peer.c:197 | ||
4420 | #, fuzzy, c-format | ||
4421 | msgid "Failed to start `%s': %s\n" | ||
4422 | msgstr "Fel vid %s:%d.\n" | ||
4423 | |||
4397 | #: src/service/core/gnunet-service-core.c:329 | 4424 | #: src/service/core/gnunet-service-core.c:329 |
4398 | msgid "# send requests dropped (disconnected)" | 4425 | msgid "# send requests dropped (disconnected)" |
4399 | msgstr "" | 4426 | msgstr "" |
@@ -4580,8 +4607,8 @@ msgstr "# byte dekrypterade" | |||
4580 | #: src/service/core/gnunet-service-core_sessions.c:337 | 4607 | #: src/service/core/gnunet-service-core_sessions.c:337 |
4581 | #: src/service/fs/gnunet-service-fs_cp.c:484 | 4608 | #: src/service/fs/gnunet-service-fs_cp.c:484 |
4582 | #: src/service/fs/gnunet-service-fs_cp.c:1377 | 4609 | #: src/service/fs/gnunet-service-fs_cp.c:1377 |
4583 | #: src/service/topology/gnunet-daemon-topology.c:551 | 4610 | #: src/service/topology/gnunet-daemon-topology.c:545 |
4584 | #: src/service/topology/gnunet-daemon-topology.c:633 | 4611 | #: src/service/topology/gnunet-daemon-topology.c:627 |
4585 | #, fuzzy | 4612 | #, fuzzy |
4586 | msgid "# peers connected" | 4613 | msgid "# peers connected" |
4587 | msgstr "# av anslutna parter" | 4614 | msgstr "# av anslutna parter" |
@@ -5631,7 +5658,7 @@ msgstr "GNUnet-konfiguration" | |||
5631 | 5658 | ||
5632 | #: src/service/fs/gnunet-service-fs.c:1271 | 5659 | #: src/service/fs/gnunet-service-fs.c:1271 |
5633 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 | 5660 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 |
5634 | #: src/service/topology/gnunet-daemon-topology.c:1066 | 5661 | #: src/service/topology/gnunet-daemon-topology.c:1062 |
5635 | #, fuzzy, c-format | 5662 | #, fuzzy, c-format |
5636 | msgid "Failed to connect to `%s' service.\n" | 5663 | msgid "Failed to connect to `%s' service.\n" |
5637 | msgstr "Misslyckades att initiera tjänsten \"%s\".\n" | 5664 | msgstr "Misslyckades att initiera tjänsten \"%s\".\n" |
@@ -6450,7 +6477,7 @@ msgid "# hostlist advertisements send" | |||
6450 | msgstr "" | 6477 | msgstr "" |
6451 | 6478 | ||
6452 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 | 6479 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 |
6453 | #: src/service/topology/gnunet-daemon-topology.c:786 | 6480 | #: src/service/topology/gnunet-daemon-topology.c:781 |
6454 | #, fuzzy, c-format | 6481 | #, fuzzy, c-format |
6455 | msgid "Error in communication with PEERSTORE service: %s\n" | 6482 | msgid "Error in communication with PEERSTORE service: %s\n" |
6456 | msgstr "Skriv ut information om GNUnets motparter." | 6483 | msgstr "Skriv ut information om GNUnets motparter." |
@@ -6719,12 +6746,12 @@ msgstr "" | |||
6719 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" | 6746 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
6720 | msgstr "" | 6747 | msgstr "" |
6721 | 6748 | ||
6722 | #: src/service/nat/gnunet-service-nat.c:1861 | 6749 | #: src/service/nat/gnunet-service-nat.c:1860 |
6723 | #, fuzzy | 6750 | #, fuzzy |
6724 | msgid "Connection reversal request failed\n" | 6751 | msgid "Connection reversal request failed\n" |
6725 | msgstr "Samling stoppad.\n" | 6752 | msgstr "Samling stoppad.\n" |
6726 | 6753 | ||
6727 | #: src/service/nat/gnunet-service-nat.c:1935 | 6754 | #: src/service/nat/gnunet-service-nat.c:1999 |
6728 | msgid "" | 6755 | msgid "" |
6729 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 6756 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
6730 | "disabling UPnP\n" | 6757 | "disabling UPnP\n" |
@@ -6748,44 +6775,44 @@ msgstr "" | |||
6748 | msgid "`upnpc' command not found\n" | 6775 | msgid "`upnpc' command not found\n" |
6749 | msgstr "" | 6776 | msgstr "" |
6750 | 6777 | ||
6751 | #: src/service/peerstore/gnunet-service-peerstore.c:1141 | 6778 | #: src/service/peerstore/gnunet-service-peerstore.c:1150 |
6752 | #, fuzzy, c-format | 6779 | #, fuzzy, c-format |
6753 | msgid "Failed to parse HELLO in file `%s': %s\n" | 6780 | msgid "Failed to parse HELLO in file `%s': %s\n" |
6754 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 6781 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
6755 | 6782 | ||
6756 | #: src/service/peerstore/gnunet-service-peerstore.c:1214 | 6783 | #: src/service/peerstore/gnunet-service-peerstore.c:1223 |
6757 | #, fuzzy, c-format | 6784 | #, fuzzy, c-format |
6758 | msgid "Could not load database backend `%s'\n" | 6785 | msgid "Could not load database backend `%s'\n" |
6759 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 6786 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
6760 | 6787 | ||
6761 | #: src/service/peerstore/gnunet-service-peerstore.c:1233 | 6788 | #: src/service/peerstore/gnunet-service-peerstore.c:1242 |
6762 | #, c-format | 6789 | #, c-format |
6763 | msgid "Importing HELLOs from `%s'\n" | 6790 | msgid "Importing HELLOs from `%s'\n" |
6764 | msgstr "" | 6791 | msgstr "" |
6765 | 6792 | ||
6766 | #: src/service/peerstore/gnunet-service-peerstore.c:1244 | 6793 | #: src/service/peerstore/gnunet-service-peerstore.c:1253 |
6767 | msgid "Skipping import of included HELLOs\n" | 6794 | msgid "Skipping import of included HELLOs\n" |
6768 | msgstr "" | 6795 | msgstr "" |
6769 | 6796 | ||
6770 | #: src/service/peerstore/peerstore_api.c:574 | 6797 | #: src/service/peerstore/peerstore_api.c:579 |
6771 | #, fuzzy | 6798 | #, fuzzy |
6772 | msgid "Unexpected store response.\n" | 6799 | msgid "Unexpected store response.\n" |
6773 | msgstr "Oväntat svar till \"%s\" operation.\n" | 6800 | msgstr "Oväntat svar till \"%s\" operation.\n" |
6774 | 6801 | ||
6775 | #: src/service/peerstore/peerstore_api.c:606 | 6802 | #: src/service/peerstore/peerstore_api.c:620 |
6776 | #, fuzzy | 6803 | #, fuzzy |
6777 | msgid "Unexpected iteration response.\n" | 6804 | msgid "Unexpected iteration response.\n" |
6778 | msgstr "Utdataformat är inte känt, detta bör inte hända.\n" | 6805 | msgstr "Utdataformat är inte känt, detta bör inte hända.\n" |
6779 | 6806 | ||
6780 | #: src/service/peerstore/peerstore_api.c:652 | 6807 | #: src/service/peerstore/peerstore_api.c:666 |
6781 | #, fuzzy | 6808 | #, fuzzy |
6782 | msgid "" | 6809 | msgid "" |
6783 | "Unexpected iteration response, no iterating client found, discarding " | 6810 | "Unexpected iteration response, no iterating client found, discarding " |
6784 | "message.\n" | 6811 | "message.\n" |
6785 | msgstr "Utdataformat är inte känt, detta bör inte hända.\n" | 6812 | msgstr "Utdataformat är inte känt, detta bör inte hända.\n" |
6786 | 6813 | ||
6787 | #: src/service/peerstore/peerstore_api.c:662 | 6814 | #: src/service/peerstore/peerstore_api.c:676 |
6788 | #: src/service/peerstore/peerstore_api_monitor.c:164 | 6815 | #: src/service/peerstore/peerstore_api_monitor.c:163 |
6789 | #, fuzzy | 6816 | #, fuzzy |
6790 | msgid "Received a malformed response from service." | 6817 | msgid "Received a malformed response from service." |
6791 | msgstr "Mottog ogiltig \"%s\" begäran (storlek %d)\n" | 6818 | msgstr "Mottog ogiltig \"%s\" begäran (storlek %d)\n" |
@@ -6964,12 +6991,12 @@ msgstr " Anslutning misslyckades\n" | |||
6964 | msgid "Namestore REST API initialized\n" | 6991 | msgid "Namestore REST API initialized\n" |
6965 | msgstr " Anslutning misslyckades\n" | 6992 | msgstr " Anslutning misslyckades\n" |
6966 | 6993 | ||
6967 | #: src/service/rest/openid_plugin.c:3102 | 6994 | #: src/service/rest/openid_plugin.c:3121 |
6968 | #, fuzzy | 6995 | #, fuzzy |
6969 | msgid "OpenID Connect REST API initialized\n" | 6996 | msgid "OpenID Connect REST API initialized\n" |
6970 | msgstr " Anslutning misslyckades\n" | 6997 | msgstr " Anslutning misslyckades\n" |
6971 | 6998 | ||
6972 | #: 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 |
6973 | #, fuzzy | 7000 | #, fuzzy |
6974 | msgid "Identity Provider REST API initialized\n" | 7001 | msgid "Identity Provider REST API initialized\n" |
6975 | msgstr " Anslutning misslyckades\n" | 7002 | msgstr " Anslutning misslyckades\n" |
@@ -7023,156 +7050,55 @@ msgstr "Ladda ner filer från GNUnet." | |||
7023 | msgid "Could not save some persistent statistics\n" | 7050 | msgid "Could not save some persistent statistics\n" |
7024 | msgstr "Kunde inte skapa värdnyckel!\n" | 7051 | msgstr "Kunde inte skapa värdnyckel!\n" |
7025 | 7052 | ||
7026 | #: src/service/testing/gnunet-testing.c:185 | 7053 | #: src/service/testbed/gnunet-testbed.c:196 |
7027 | #, fuzzy, c-format | ||
7028 | msgid "Could not extract hostkey %u (offset too large?)\n" | ||
7029 | msgstr "Kunde inte skapa värdnyckel!\n" | ||
7030 | |||
7031 | #: src/service/testing/gnunet-testing.c:275 | ||
7032 | #, c-format | ||
7033 | msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n" | ||
7034 | msgstr "" | ||
7035 | |||
7036 | #: src/service/testing/gnunet-testing.c:386 | ||
7037 | #, fuzzy | 7054 | #, fuzzy |
7038 | msgid "create unique configuration files" | 7055 | msgid "number of unique configuration files to create" |
7039 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" | 7056 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" |
7040 | 7057 | ||
7041 | #: src/service/testing/gnunet-testing.c:392 | 7058 | #: src/service/testbed/gnunet-testbed.c:202 |
7042 | msgid "extract hostkey file from pre-computed hostkey list" | ||
7043 | msgstr "" | ||
7044 | |||
7045 | #: src/service/testing/gnunet-testing.c:400 | ||
7046 | #, fuzzy | ||
7047 | msgid "" | ||
7048 | "number of unique configuration files to create, or number of the hostkey to " | ||
7049 | "extract" | ||
7050 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" | ||
7051 | |||
7052 | #: src/service/testing/gnunet-testing.c:407 | ||
7053 | #, fuzzy | 7059 | #, fuzzy |
7054 | msgid "configuration template" | 7060 | msgid "configuration template" |
7055 | msgstr "Konfigurationsfil \"%s\" skapad.\n" | 7061 | msgstr "Konfigurationsfil \"%s\" skapad.\n" |
7056 | 7062 | ||
7057 | #: src/service/testing/gnunet-testing.c:415 | 7063 | #: src/service/testbed/gnunet-testbed.c:218 |
7058 | msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)" | ||
7059 | msgstr "" | ||
7060 | |||
7061 | #: src/service/testing/gnunet-testing.c:432 | ||
7062 | msgid "Command line tool to access the testing library" | 7064 | msgid "Command line tool to access the testing library" |
7063 | msgstr "" | 7065 | msgstr "" |
7064 | 7066 | ||
7065 | #: src/service/testing/list-keys.c:92 | ||
7066 | msgid "list COUNT number of keys" | ||
7067 | msgstr "" | ||
7068 | |||
7069 | #: src/service/testing/testing.c:291 | ||
7070 | #, c-format | ||
7071 | msgid "Hostkeys file not found: %s\n" | ||
7072 | msgstr "" | ||
7073 | |||
7074 | #: src/service/testing/testing.c:743 | ||
7075 | #, fuzzy, c-format | ||
7076 | msgid "Key number %u does not exist\n" | ||
7077 | msgstr "antal meddelanden att använda per iteration" | ||
7078 | |||
7079 | #: src/service/testing/testing.c:1217 | ||
7080 | #, c-format | ||
7081 | msgid "" | ||
7082 | "You attempted to create a testbed with more than %u hosts. Please " | ||
7083 | "precompute more hostkeys first.\n" | ||
7084 | msgstr "" | ||
7085 | |||
7086 | #: src/service/testing/testing.c:1226 | ||
7087 | #, fuzzy, c-format | ||
7088 | msgid "Failed to initialize hostkey for peer %u\n" | ||
7089 | msgstr "Misslyckades att initiera tjänsten \"%s\".\n" | ||
7090 | |||
7091 | #: src/service/testing/testing.c:1236 | ||
7092 | #, fuzzy | ||
7093 | msgid "PRIVATE_KEY option in PEER section missing in configuration\n" | ||
7094 | msgstr "Inga applikationer definierade i konfiguration!\n" | ||
7095 | |||
7096 | #: src/service/testing/testing.c:1249 | ||
7097 | #, fuzzy | ||
7098 | msgid "Failed to create configuration for peer (not enough free ports?)\n" | ||
7099 | msgstr "Kunde inte komma åt namnrymdsinformation.\n" | ||
7100 | |||
7101 | #: src/service/testing/testing.c:1265 | ||
7102 | #, fuzzy, c-format | ||
7103 | msgid "Cannot open hostkey file `%s': %s\n" | ||
7104 | msgstr "Kunde inte skapa värdnyckel!\n" | ||
7105 | |||
7106 | #: src/service/testing/testing.c:1279 | ||
7107 | #, fuzzy, c-format | ||
7108 | msgid "Failed to write hostkey file for peer %u: %s\n" | ||
7109 | msgstr "Kunde inte skapa användarkonto:" | ||
7110 | |||
7111 | #: src/service/testing/testing.c:1307 | ||
7112 | #, fuzzy, c-format | ||
7113 | msgid "Failed to write configuration file `%s' for peer %u: %s\n" | ||
7114 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | ||
7115 | |||
7116 | #: src/service/testing/testing.c:1413 | ||
7117 | #, fuzzy, c-format | ||
7118 | msgid "Failed to start `%s': %s\n" | ||
7119 | msgstr "Fel vid %s:%d.\n" | ||
7120 | |||
7121 | #: src/service/testing/testing.c:1664 | ||
7122 | #, fuzzy, c-format | ||
7123 | msgid "Failed to load configuration from %s\n" | ||
7124 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | ||
7125 | |||
7126 | #: src/service/testing/testing.c:2795 | ||
7127 | #, fuzzy, c-format | ||
7128 | msgid "Topology file %s not found\n" | ||
7129 | msgstr "\"%s\" misslyckades: tabell hittades inte!\n" | ||
7130 | |||
7131 | #: src/service/testing/testing.c:2803 | ||
7132 | #, c-format | ||
7133 | msgid "Topology file %s has no data\n" | ||
7134 | msgstr "" | ||
7135 | |||
7136 | #: src/service/testing/testing.c:2811 | ||
7137 | #, c-format | ||
7138 | msgid "Topology file %s cannot be read\n" | ||
7139 | msgstr "" | ||
7140 | |||
7141 | #: src/service/topology/gnunet-daemon-topology.c:286 | 7067 | #: src/service/topology/gnunet-daemon-topology.c:286 |
7142 | #, fuzzy | 7068 | #, fuzzy |
7143 | msgid "# connect requests issued to ATS" | 7069 | msgid "# connect requests issued to ATS" |
7144 | msgstr "# byte mottogs via TCP" | 7070 | msgstr "# byte mottogs via TCP" |
7145 | 7071 | ||
7146 | #: src/service/topology/gnunet-daemon-topology.c:480 | 7072 | #: src/service/topology/gnunet-daemon-topology.c:475 |
7147 | msgid "# HELLO messages gossipped" | 7073 | msgid "# HELLO messages gossipped" |
7148 | msgstr "" | 7074 | msgstr "" |
7149 | 7075 | ||
7150 | #: src/service/topology/gnunet-daemon-topology.c:752 | 7076 | #: src/service/topology/gnunet-daemon-topology.c:747 |
7151 | #, fuzzy | 7077 | #, fuzzy |
7152 | msgid "Error in communication with PEERSTORE service to monitor.\n" | 7078 | msgid "Error in communication with PEERSTORE service to monitor.\n" |
7153 | msgstr "Skriv ut information om GNUnets motparter." | 7079 | msgstr "Skriv ut information om GNUnets motparter." |
7154 | 7080 | ||
7155 | #: src/service/topology/gnunet-daemon-topology.c:761 | 7081 | #: src/service/topology/gnunet-daemon-topology.c:756 |
7156 | msgid "Finished initial PEERSTORE iteration in monitor.\n" | 7082 | msgid "Finished initial PEERSTORE iteration in monitor.\n" |
7157 | msgstr "" | 7083 | msgstr "" |
7158 | 7084 | ||
7159 | #: src/service/topology/gnunet-daemon-topology.c:869 | 7085 | #: src/service/topology/gnunet-daemon-topology.c:864 |
7160 | msgid "Failed to connect to core service, can not manage topology!\n" | 7086 | msgid "Failed to connect to core service, can not manage topology!\n" |
7161 | msgstr "" | 7087 | msgstr "" |
7162 | 7088 | ||
7163 | #: src/service/topology/gnunet-daemon-topology.c:943 | 7089 | #: src/service/topology/gnunet-daemon-topology.c:938 |
7164 | #, fuzzy | 7090 | #, fuzzy |
7165 | msgid "# HELLO messages received" | 7091 | msgid "# HELLO messages received" |
7166 | msgstr "# krypterade PONG-meddelanden mottagna" | 7092 | msgstr "# krypterade PONG-meddelanden mottagna" |
7167 | 7093 | ||
7168 | #: src/service/topology/gnunet-daemon-topology.c:1095 | 7094 | #: src/service/topology/gnunet-daemon-topology.c:1091 |
7169 | msgid "GNUnet topology control" | 7095 | msgid "GNUnet topology control" |
7170 | msgstr "" | 7096 | msgstr "" |
7171 | 7097 | ||
7172 | #: src/service/transport/gnunet-communicator-quic.c:1717 | 7098 | #: src/service/transport/gnunet-communicator-quic.c:1717 |
7173 | #: src/service/transport/gnunet-communicator-tcp.c:3814 | 7099 | #: src/service/transport/gnunet-communicator-tcp.c:3814 |
7174 | #: src/service/transport/gnunet-communicator-udp.c:3562 | 7100 | #: src/service/transport/gnunet-communicator-udp.c:3579 |
7175 | #: src/service/transport/gnunet-service-transport.c:12124 | 7101 | #: src/service/transport/gnunet-service-transport.c:12543 |
7176 | #, fuzzy | 7102 | #, fuzzy |
7177 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7103 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7178 | msgstr "GNUnet-konfiguration" | 7104 | msgstr "GNUnet-konfiguration" |
@@ -7185,7 +7111,7 @@ msgstr "" | |||
7185 | msgid "GNUnet TCP communicator" | 7111 | msgid "GNUnet TCP communicator" |
7186 | msgstr "" | 7112 | msgstr "" |
7187 | 7113 | ||
7188 | #: src/service/transport/gnunet-communicator-udp.c:3637 | 7114 | #: src/service/transport/gnunet-communicator-udp.c:3654 |
7189 | msgid "GNUnet UDP communicator" | 7115 | msgid "GNUnet UDP communicator" |
7190 | msgstr "" | 7116 | msgstr "" |
7191 | 7117 | ||
@@ -7499,6 +7425,50 @@ msgid "Failed to connect to the namestore!\n" | |||
7499 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 7425 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
7500 | 7426 | ||
7501 | #, 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 | ||
7502 | #~ msgid "" | 7472 | #~ msgid "" |
7503 | #~ "Local peer: %s\n" | 7473 | #~ "Local peer: %s\n" |
7504 | #~ "\n" | 7474 | #~ "\n" |
@@ -8465,10 +8435,6 @@ msgstr "Misslyckades att ansluta till gnunetd.\n" | |||
8465 | #~ msgstr "GNUnet-konfiguration" | 8435 | #~ msgstr "GNUnet-konfiguration" |
8466 | 8436 | ||
8467 | #, fuzzy | 8437 | #, fuzzy |
8468 | #~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | ||
8469 | #~ msgstr "Kunde inte spara konfigurationsfil \"%s\":" | ||
8470 | |||
8471 | #, fuzzy | ||
8472 | #~ msgid "Unreadable or malformed configuration, exit ...\n" | 8438 | #~ msgid "Unreadable or malformed configuration, exit ...\n" |
8473 | #~ msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 8439 | #~ msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
8474 | 8440 | ||
@@ -8,7 +8,7 @@ msgid "" | |||
8 | msgstr "" | 8 | msgstr "" |
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-15 09:19+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,26 +356,26 @@ msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | |||
356 | msgid "Failed to connect to CORE service!\n" | 356 | msgid "Failed to connect to CORE service!\n" |
357 | msgstr "Lỗi kết nối đến gnunetd.\n" | 357 | msgstr "Lỗi kết nối đến gnunetd.\n" |
358 | 358 | ||
359 | #: src/cli/core/gnunet-core.c:212 | 359 | #: src/cli/core/gnunet-core.c:213 |
360 | #, fuzzy | 360 | #, fuzzy |
361 | msgid "No argument given.\n" | 361 | msgid "No argument given.\n" |
362 | msgstr "chưa đưa ra tên" | 362 | msgstr "chưa đưa ra tên" |
363 | 363 | ||
364 | #: src/cli/core/gnunet-core.c:235 src/service/transport/gnunet-transport.c:1389 | 364 | #: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389 |
365 | #, fuzzy | 365 | #, fuzzy |
366 | msgid "provide information about all current connections (continuously)" | 366 | msgid "provide information about all current connections (continuously)" |
367 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | 367 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." |
368 | 368 | ||
369 | #: src/cli/core/gnunet-core.c:241 | 369 | #: src/cli/core/gnunet-core.c:244 |
370 | msgid "Show our current peer identity" | 370 | msgid "Show our current peer identity" |
371 | msgstr "" | 371 | msgstr "" |
372 | 372 | ||
373 | #: src/cli/core/gnunet-core.c:248 | 373 | #: src/cli/core/gnunet-core.c:251 |
374 | #, fuzzy | 374 | #, fuzzy |
375 | msgid "Show current connections" | 375 | msgid "Show current connections" |
376 | msgstr "# các kết nối dht" | 376 | msgstr "# các kết nối dht" |
377 | 377 | ||
378 | #: src/cli/core/gnunet-core.c:259 | 378 | #: src/cli/core/gnunet-core.c:262 |
379 | #, fuzzy | 379 | #, fuzzy |
380 | msgid "Print information about connected peers." | 380 | msgid "Print information about connected peers." |
381 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | 381 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." |
@@ -1108,54 +1108,54 @@ msgstr "Không thể truy cáºp đến thông tin vá» không gian tên.\n" | |||
1108 | msgid "Unindex a file that was previously indexed with gnunet-publish." | 1108 | msgid "Unindex a file that was previously indexed with gnunet-publish." |
1109 | msgstr "" | 1109 | msgstr "" |
1110 | 1110 | ||
1111 | #: src/cli/gns/gnunet-gns.c:268 | 1111 | #: src/cli/gns/gnunet-gns.c:269 |
1112 | #, fuzzy, c-format | 1112 | #, fuzzy, c-format |
1113 | msgid "`%s' is not a valid DNS domain name\n" | 1113 | msgid "`%s' is not a valid DNS domain name\n" |
1114 | msgstr "« %s » không sẵn sà ng.\n" | 1114 | msgstr "« %s » không sẵn sà ng.\n" |
1115 | 1115 | ||
1116 | #: 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 |
1117 | #, fuzzy, c-format | 1117 | #, fuzzy, c-format |
1118 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" | 1118 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" |
1119 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" | 1119 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" |
1120 | 1120 | ||
1121 | #: src/cli/gns/gnunet-gns.c:294 | 1121 | #: src/cli/gns/gnunet-gns.c:295 |
1122 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" | 1122 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" |
1123 | msgstr "" | 1123 | msgstr "" |
1124 | 1124 | ||
1125 | #: src/cli/gns/gnunet-gns.c:305 | 1125 | #: src/cli/gns/gnunet-gns.c:306 |
1126 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 | 1126 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 |
1127 | #, fuzzy, c-format | 1127 | #, fuzzy, c-format |
1128 | msgid "Failed to connect to GNS\n" | 1128 | msgid "Failed to connect to GNS\n" |
1129 | msgstr "Lỗi kết nối đến gnunetd.\n" | 1129 | msgstr "Lỗi kết nối đến gnunetd.\n" |
1130 | 1130 | ||
1131 | #: src/cli/gns/gnunet-gns.c:318 | 1131 | #: src/cli/gns/gnunet-gns.c:325 |
1132 | #, c-format | 1132 | #, c-format |
1133 | msgid "Invalid typename specified, assuming `ANY'\n" | 1133 | msgid "Invalid typename specified, assuming `ANY'\n" |
1134 | msgstr "" | 1134 | msgstr "" |
1135 | 1135 | ||
1136 | #: src/cli/gns/gnunet-gns.c:358 | 1136 | #: src/cli/gns/gnunet-gns.c:365 |
1137 | msgid "Lookup a record for the given name" | 1137 | msgid "Lookup a record for the given name" |
1138 | msgstr "" | 1138 | msgstr "" |
1139 | 1139 | ||
1140 | #: src/cli/gns/gnunet-gns.c:364 | 1140 | #: src/cli/gns/gnunet-gns.c:371 |
1141 | #, fuzzy | 1141 | #, fuzzy |
1142 | msgid "Specify the type of the record to lookup" | 1142 | msgid "Specify the type of the record to lookup" |
1143 | msgstr "xác định mức ưu tiên của nội dung" | 1143 | msgstr "xác định mức ưu tiên của nội dung" |
1144 | 1144 | ||
1145 | #: src/cli/gns/gnunet-gns.c:370 | 1145 | #: src/cli/gns/gnunet-gns.c:377 |
1146 | #, fuzzy | 1146 | #, fuzzy |
1147 | msgid "Specify a timeout for the lookup" | 1147 | msgid "Specify a timeout for the lookup" |
1148 | msgstr "xác định mức ưu tiên của nội dung" | 1148 | msgstr "xác định mức ưu tiên của nội dung" |
1149 | 1149 | ||
1150 | #: src/cli/gns/gnunet-gns.c:374 | 1150 | #: src/cli/gns/gnunet-gns.c:381 |
1151 | msgid "No unneeded output" | 1151 | msgid "No unneeded output" |
1152 | msgstr "" | 1152 | msgstr "" |
1153 | 1153 | ||
1154 | #: src/cli/gns/gnunet-gns.c:379 | 1154 | #: src/cli/gns/gnunet-gns.c:386 |
1155 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" | 1155 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" |
1156 | msgstr "" | 1156 | msgstr "" |
1157 | 1157 | ||
1158 | #: src/cli/gns/gnunet-gns.c:393 | 1158 | #: src/cli/gns/gnunet-gns.c:400 |
1159 | #, fuzzy | 1159 | #, fuzzy |
1160 | msgid "GNUnet GNS resolver tool" | 1160 | msgid "GNUnet GNS resolver tool" |
1161 | msgstr "Bản ghi lỗi GNUnet" | 1161 | msgstr "Bản ghi lỗi GNUnet" |
@@ -1683,7 +1683,11 @@ msgstr "" | |||
1683 | msgid "GNUnet NAT traversal autoconfigure daemon" | 1683 | msgid "GNUnet NAT traversal autoconfigure daemon" |
1684 | msgstr "" | 1684 | msgstr "" |
1685 | 1685 | ||
1686 | #: src/cli/nse/gnunet-nse.c:124 | 1686 | #: src/cli/nse/gnunet-nse.c:126 |
1687 | msgid "Monitor and output current estimates" | ||
1688 | msgstr "" | ||
1689 | |||
1690 | #: src/cli/nse/gnunet-nse.c:137 | ||
1687 | #, fuzzy | 1691 | #, fuzzy |
1688 | msgid "Show network size estimates from NSE service." | 1692 | msgid "Show network size estimates from NSE service." |
1689 | msgstr "# các yêu cầu get (lấy) dht được nháºn" | 1693 | msgstr "# các yêu cầu get (lấy) dht được nháºn" |
@@ -1732,87 +1736,91 @@ msgstr "" | |||
1732 | msgid "The time until the DID Document is going to expire (e.g. 5d)" | 1736 | msgid "The time until the DID Document is going to expire (e.g. 5d)" |
1733 | msgstr "" | 1737 | msgstr "" |
1734 | 1738 | ||
1735 | #: src/cli/reclaim/gnunet-reclaim.c:805 | 1739 | #: src/cli/reclaim/gnunet-reclaim.c:813 |
1736 | #, fuzzy, c-format | 1740 | #, fuzzy, c-format |
1737 | msgid "Ego is required\n" | 1741 | msgid "Ego is required\n" |
1738 | msgstr "Bị từ chối đặt tùy chá»n « %s » trong phần « %s » thà nh « %s ».\n" | 1742 | msgstr "Bị từ chối đặt tùy chá»n « %s » trong phần « %s » thà nh « %s ».\n" |
1739 | 1743 | ||
1740 | #: src/cli/reclaim/gnunet-reclaim.c:812 | 1744 | #: src/cli/reclaim/gnunet-reclaim.c:820 |
1741 | #, c-format | 1745 | #, c-format |
1742 | msgid "Attribute value missing!\n" | 1746 | msgid "Attribute value missing!\n" |
1743 | msgstr "" | 1747 | msgstr "" |
1744 | 1748 | ||
1745 | #: src/cli/reclaim/gnunet-reclaim.c:819 | 1749 | #: src/cli/reclaim/gnunet-reclaim.c:827 |
1746 | #, fuzzy, c-format | 1750 | #, fuzzy, c-format |
1747 | msgid "Requesting party key is required!\n" | 1751 | msgid "Requesting party key is required!\n" |
1748 | msgstr "đặt tên hiệu cần dùng (cần thiết)" | 1752 | msgstr "đặt tên hiệu cần dùng (cần thiết)" |
1749 | 1753 | ||
1750 | #: src/cli/reclaim/gnunet-reclaim.c:837 | 1754 | #: src/cli/reclaim/gnunet-reclaim.c:846 |
1751 | msgid "Add or update an attribute NAME" | 1755 | msgid "Add or update an attribute NAME" |
1752 | msgstr "" | 1756 | msgstr "" |
1753 | 1757 | ||
1754 | #: src/cli/reclaim/gnunet-reclaim.c:842 | 1758 | #: src/cli/reclaim/gnunet-reclaim.c:851 |
1755 | msgid "Delete the attribute with ID" | 1759 | msgid "Delete the attribute with ID" |
1756 | msgstr "" | 1760 | msgstr "" |
1757 | 1761 | ||
1758 | #: src/cli/reclaim/gnunet-reclaim.c:847 | 1762 | #: src/cli/reclaim/gnunet-reclaim.c:856 |
1759 | msgid "The attribute VALUE" | 1763 | msgid "The attribute VALUE" |
1760 | msgstr "" | 1764 | msgstr "" |
1761 | 1765 | ||
1762 | #: src/cli/reclaim/gnunet-reclaim.c:852 | 1766 | #: src/cli/reclaim/gnunet-reclaim.c:861 |
1763 | #, fuzzy | 1767 | #, fuzzy |
1764 | msgid "The EGO to use" | 1768 | msgid "The EGO to use" |
1765 | msgstr "kÃch cỡ tin nhắn" | 1769 | msgstr "kÃch cỡ tin nhắn" |
1766 | 1770 | ||
1767 | #: src/cli/reclaim/gnunet-reclaim.c:858 | 1771 | #: src/cli/reclaim/gnunet-reclaim.c:867 |
1768 | msgid "Specify the relying party for issue" | 1772 | msgid "Specify the relying party for issue" |
1769 | msgstr "" | 1773 | msgstr "" |
1770 | 1774 | ||
1771 | #: src/cli/reclaim/gnunet-reclaim.c:862 | 1775 | #: src/cli/reclaim/gnunet-reclaim.c:873 |
1776 | msgid "Specify the relying party URI for a ticket to consume" | ||
1777 | msgstr "" | ||
1778 | |||
1779 | #: src/cli/reclaim/gnunet-reclaim.c:877 | ||
1772 | msgid "List attributes for EGO" | 1780 | msgid "List attributes for EGO" |
1773 | msgstr "" | 1781 | msgstr "" |
1774 | 1782 | ||
1775 | #: src/cli/reclaim/gnunet-reclaim.c:866 | 1783 | #: src/cli/reclaim/gnunet-reclaim.c:881 |
1776 | msgid "List credentials for EGO" | 1784 | msgid "List credentials for EGO" |
1777 | msgstr "" | 1785 | msgstr "" |
1778 | 1786 | ||
1779 | #: src/cli/reclaim/gnunet-reclaim.c:872 | 1787 | #: src/cli/reclaim/gnunet-reclaim.c:887 |
1780 | msgid "Credential to use for attribute" | 1788 | msgid "Credential to use for attribute" |
1781 | msgstr "" | 1789 | msgstr "" |
1782 | 1790 | ||
1783 | #: src/cli/reclaim/gnunet-reclaim.c:877 | 1791 | #: src/cli/reclaim/gnunet-reclaim.c:892 |
1784 | msgid "Credential name" | 1792 | msgid "Credential name" |
1785 | msgstr "" | 1793 | msgstr "" |
1786 | 1794 | ||
1787 | #: src/cli/reclaim/gnunet-reclaim.c:883 | 1795 | #: src/cli/reclaim/gnunet-reclaim.c:898 |
1788 | msgid "Issue a ticket for a set of attributes separated by comma" | 1796 | msgid "Issue a ticket for a set of attributes separated by comma" |
1789 | msgstr "" | 1797 | msgstr "" |
1790 | 1798 | ||
1791 | #: src/cli/reclaim/gnunet-reclaim.c:888 | 1799 | #: src/cli/reclaim/gnunet-reclaim.c:903 |
1792 | msgid "Consume a ticket" | 1800 | msgid "Consume a ticket" |
1793 | msgstr "" | 1801 | msgstr "" |
1794 | 1802 | ||
1795 | #: src/cli/reclaim/gnunet-reclaim.c:893 | 1803 | #: src/cli/reclaim/gnunet-reclaim.c:908 |
1796 | msgid "Revoke a ticket" | 1804 | msgid "Revoke a ticket" |
1797 | msgstr "" | 1805 | msgstr "" |
1798 | 1806 | ||
1799 | #: src/cli/reclaim/gnunet-reclaim.c:898 | 1807 | #: src/cli/reclaim/gnunet-reclaim.c:913 |
1800 | msgid "Type of attribute" | 1808 | msgid "Type of attribute" |
1801 | msgstr "" | 1809 | msgstr "" |
1802 | 1810 | ||
1803 | #: src/cli/reclaim/gnunet-reclaim.c:903 | 1811 | #: src/cli/reclaim/gnunet-reclaim.c:918 |
1804 | msgid "Type of credential" | 1812 | msgid "Type of credential" |
1805 | msgstr "" | 1813 | msgstr "" |
1806 | 1814 | ||
1807 | #: src/cli/reclaim/gnunet-reclaim.c:907 | 1815 | #: src/cli/reclaim/gnunet-reclaim.c:922 |
1808 | msgid "List tickets of ego" | 1816 | msgid "List tickets of ego" |
1809 | msgstr "" | 1817 | msgstr "" |
1810 | 1818 | ||
1811 | #: src/cli/reclaim/gnunet-reclaim.c:913 | 1819 | #: src/cli/reclaim/gnunet-reclaim.c:928 |
1812 | msgid "Expiration interval of the attribute" | 1820 | msgid "Expiration interval of the attribute" |
1813 | msgstr "" | 1821 | msgstr "" |
1814 | 1822 | ||
1815 | #: src/cli/reclaim/gnunet-reclaim.c:921 | 1823 | #: src/cli/reclaim/gnunet-reclaim.c:936 |
1816 | msgid "re:claimID command line tool" | 1824 | msgid "re:claimID command line tool" |
1817 | msgstr "" | 1825 | msgstr "" |
1818 | 1826 | ||
@@ -2050,34 +2058,59 @@ msgstr "In ra thống kê vỠcác thao tác GNUnet." | |||
2050 | msgid "run decoder modus, otherwise runs as encoder" | 2058 | msgid "run decoder modus, otherwise runs as encoder" |
2051 | msgstr "" | 2059 | msgstr "" |
2052 | 2060 | ||
2053 | #: src/cli/util/gnunet-config.c:154 | 2061 | #: src/cli/util/gnunet-config.c:101 |
2054 | msgid "test if the current installation supports the specified BACKEND" | 2062 | msgid "test if the current installation supports the specified BACKEND" |
2055 | msgstr "" | 2063 | msgstr "" |
2056 | 2064 | ||
2057 | #: src/cli/util/gnunet-config.c:160 | 2065 | #: src/cli/util/gnunet-config.c:107 |
2058 | msgid "" | 2066 | msgid "" |
2059 | "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 " |
2060 | "GNUnet" | 2068 | "GNUnet" |
2061 | msgstr "" | 2069 | msgstr "" |
2062 | 2070 | ||
2063 | #: src/cli/util/gnunet-config.c:165 | 2071 | #: src/cli/util/gnunet-config.c:112 |
2064 | msgid "Is this an experimental build of GNUnet" | 2072 | msgid "Is this an experimental build of GNUnet" |
2065 | msgstr "" | 2073 | msgstr "" |
2066 | 2074 | ||
2067 | #: src/cli/util/gnunet-config.c:171 | 2075 | #: src/cli/util/gnunet-config.c:118 |
2068 | msgid "" | 2076 | msgid "" |
2069 | "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 " |
2070 | "GNUnet" | 2078 | "GNUnet" |
2071 | msgstr "" | 2079 | msgstr "" |
2072 | 2080 | ||
2073 | #: src/cli/util/gnunet-config.c:177 | 2081 | #: src/cli/util/gnunet-config.c:123 |
2082 | #, fuzzy | ||
2083 | msgid "Do not parse default configuration files" | ||
2084 | msgstr "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 | ||
2074 | msgid "Provide the path under which GNUnet was installed" | 2087 | msgid "Provide the path under which GNUnet was installed" |
2075 | msgstr "" | 2088 | msgstr "" |
2076 | 2089 | ||
2077 | #: src/cli/util/gnunet-config.c:192 | 2090 | #: src/cli/util/gnunet-config.c:136 |
2091 | msgid "" | ||
2092 | "Parse main configuration from this command-line argument and not from disk" | ||
2093 | msgstr "" | ||
2094 | |||
2095 | #: src/cli/util/gnunet-config.c:225 | ||
2078 | #, fuzzy | 2096 | #, fuzzy |
2079 | msgid "Manipulate GNUnet configuration files" | 2097 | msgid "Failed to load default configuration, exiting ...\n" |
2080 | msgstr "cáºp nháºt má»™t giá trị trong táºp tin cấu hình" | 2098 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
2099 | |||
2100 | #: src/cli/util/gnunet-config.c:237 | ||
2101 | #, fuzzy | ||
2102 | msgid "Failed to parse configuration, exiting ...\n" | ||
2103 | msgstr "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 | ||
2107 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
2108 | msgstr "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 | ||
2112 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
2113 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | ||
2081 | 2114 | ||
2082 | #: src/cli/util/gnunet-crypto-tvg.c:1588 | 2115 | #: src/cli/util/gnunet-crypto-tvg.c:1588 |
2083 | msgid "verify a test vector from stdin" | 2116 | msgid "verify a test vector from stdin" |
@@ -2124,55 +2157,54 @@ msgstr "" | |||
2124 | msgid "Hostkeys file `%s' not found\n" | 2157 | msgid "Hostkeys file `%s' not found\n" |
2125 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" | 2158 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" |
2126 | 2159 | ||
2127 | #: src/cli/util/gnunet-ecc.c:314 | 2160 | #: src/cli/util/gnunet-ecc.c:318 |
2128 | #, fuzzy, c-format | 2161 | #, fuzzy, c-format |
2129 | msgid "Hostkeys file `%s' is empty\n" | 2162 | msgid "Hostkeys file `%s' is empty\n" |
2130 | msgstr "Äịnh dạng của táºp tin « %s » là không hợp lệ.\n" | 2163 | msgstr "Äịnh dạng của táºp tin « %s » là không hợp lệ.\n" |
2131 | 2164 | ||
2132 | #: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 | 2165 | #: src/cli/util/gnunet-ecc.c:324 |
2133 | #: src/service/testing/testing.c:308 | ||
2134 | #, c-format | 2166 | #, c-format |
2135 | msgid "Incorrect hostkey file format: %s\n" | 2167 | msgid "Incorrect hostkey file format: %s\n" |
2136 | msgstr "" | 2168 | msgstr "" |
2137 | 2169 | ||
2138 | #: src/cli/util/gnunet-ecc.c:334 | 2170 | #: src/cli/util/gnunet-ecc.c:340 |
2139 | #, fuzzy, c-format | 2171 | #, fuzzy, c-format |
2140 | msgid "Could not read hostkey file: %s\n" | 2172 | msgid "Could not read hostkey file: %s\n" |
2141 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" | 2173 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" |
2142 | 2174 | ||
2143 | #: src/cli/util/gnunet-ecc.c:388 | 2175 | #: src/cli/util/gnunet-ecc.c:394 |
2144 | msgid "No hostkey file specified on command line\n" | 2176 | msgid "No hostkey file specified on command line\n" |
2145 | msgstr "" | 2177 | msgstr "" |
2146 | 2178 | ||
2147 | #: src/cli/util/gnunet-ecc.c:452 | 2179 | #: src/cli/util/gnunet-ecc.c:458 |
2148 | msgid "list keys included in a file (for testing)" | 2180 | msgid "list keys included in a file (for testing)" |
2149 | msgstr "" | 2181 | msgstr "" |
2150 | 2182 | ||
2151 | #: src/cli/util/gnunet-ecc.c:458 | 2183 | #: src/cli/util/gnunet-ecc.c:464 |
2152 | msgid "number of keys to list included in a file (for testing)" | 2184 | msgid "number of keys to list included in a file (for testing)" |
2153 | msgstr "" | 2185 | msgstr "" |
2154 | 2186 | ||
2155 | #: src/cli/util/gnunet-ecc.c:464 | 2187 | #: src/cli/util/gnunet-ecc.c:470 |
2156 | msgid "create COUNT public-private key pairs (for testing)" | 2188 | msgid "create COUNT public-private key pairs (for testing)" |
2157 | msgstr "" | 2189 | msgstr "" |
2158 | 2190 | ||
2159 | #: src/cli/util/gnunet-ecc.c:469 | 2191 | #: src/cli/util/gnunet-ecc.c:475 |
2160 | msgid "print the public key in ASCII format" | 2192 | msgid "print the public key in ASCII format" |
2161 | msgstr "" | 2193 | msgstr "" |
2162 | 2194 | ||
2163 | #: src/cli/util/gnunet-ecc.c:474 | 2195 | #: src/cli/util/gnunet-ecc.c:480 |
2164 | msgid "print the private key in ASCII format" | 2196 | msgid "print the private key in ASCII format" |
2165 | msgstr "" | 2197 | msgstr "" |
2166 | 2198 | ||
2167 | #: src/cli/util/gnunet-ecc.c:479 | 2199 | #: src/cli/util/gnunet-ecc.c:485 |
2168 | msgid "print the public key in HEX format" | 2200 | msgid "print the public key in HEX format" |
2169 | msgstr "" | 2201 | msgstr "" |
2170 | 2202 | ||
2171 | #: src/cli/util/gnunet-ecc.c:485 | 2203 | #: src/cli/util/gnunet-ecc.c:491 |
2172 | msgid "print examples of ECC operations (used for compatibility testing)" | 2204 | msgid "print examples of ECC operations (used for compatibility testing)" |
2173 | msgstr "" | 2205 | msgstr "" |
2174 | 2206 | ||
2175 | #: src/cli/util/gnunet-ecc.c:499 | 2207 | #: src/cli/util/gnunet-ecc.c:505 |
2176 | #, fuzzy | 2208 | #, fuzzy |
2177 | msgid "Manipulate GNUnet private ECC key files" | 2209 | msgid "Manipulate GNUnet private ECC key files" |
2178 | msgstr "cáºp nháºt má»™t giá trị trong táºp tin cấu hình" | 2210 | msgstr "cáºp nháºt má»™t giá trị trong táºp tin cấu hình" |
@@ -3262,13 +3294,13 @@ msgstr "" | |||
3262 | msgid "Invalid handle type while writing `%s'" | 3294 | msgid "Invalid handle type while writing `%s'" |
3263 | msgstr "Äịa chỉ IP định dạng sai: %s\n" | 3295 | msgstr "Äịa chỉ IP định dạng sai: %s\n" |
3264 | 3296 | ||
3265 | #: 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 |
3266 | #: src/service/arm/gnunet-service-arm.c:452 | 3298 | #: src/service/arm/gnunet-service-arm.c:452 |
3267 | #, c-format | 3299 | #, c-format |
3268 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 3300 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
3269 | msgstr "" | 3301 | msgstr "" |
3270 | 3302 | ||
3271 | #: 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 |
3272 | #: src/service/arm/gnunet-service-arm.c:456 | 3304 | #: src/service/arm/gnunet-service-arm.c:456 |
3273 | #, fuzzy, c-format | 3305 | #, fuzzy, c-format |
3274 | msgid "Using `%s' instead\n" | 3306 | msgid "Using `%s' instead\n" |
@@ -3401,17 +3433,17 @@ msgstr "" | |||
3401 | msgid "`%s' failed at %s:%d with error: %s\n" | 3433 | msgid "`%s' failed at %s:%d with error: %s\n" |
3402 | msgstr "« %s » bị lỗi tại %s:%d với lỗi: %s\n" | 3434 | msgstr "« %s » bị lỗi tại %s:%d với lỗi: %s\n" |
3403 | 3435 | ||
3404 | #: src/lib/util/crypto_ecc.c:554 | 3436 | #: src/lib/util/crypto_ecc.c:569 |
3405 | #, fuzzy, c-format | 3437 | #, fuzzy, c-format |
3406 | msgid "ECC signing failed at %s:%d: %s\n" | 3438 | msgid "ECC signing failed at %s:%d: %s\n" |
3407 | msgstr "%s bị lỗi tại %s:%d: « %s »\n" | 3439 | msgstr "%s bị lỗi tại %s:%d: « %s »\n" |
3408 | 3440 | ||
3409 | #: src/lib/util/crypto_ecc.c:677 | 3441 | #: src/lib/util/crypto_ecc.c:692 |
3410 | #, fuzzy, c-format | 3442 | #, fuzzy, c-format |
3411 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 3443 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
3412 | msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" | 3444 | msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" |
3413 | 3445 | ||
3414 | #: 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 |
3415 | #, fuzzy | 3447 | #, fuzzy |
3416 | msgid "Could not load peer's private key\n" | 3448 | msgid "Could not load peer's private key\n" |
3417 | msgstr "Không thể truy cáºp đến táºp tin gnunet-directory « %s »\n" | 3449 | msgstr "Không thể truy cáºp đến táºp tin gnunet-directory « %s »\n" |
@@ -3436,7 +3468,7 @@ msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" | |||
3436 | msgid "Expected `%s' to be a directory!\n" | 3468 | msgid "Expected `%s' to be a directory!\n" |
3437 | msgstr "Mong đợi « %s » là một thư mục.\n" | 3469 | msgstr "Mong đợi « %s » là một thư mục.\n" |
3438 | 3470 | ||
3439 | #: 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 |
3440 | #, c-format | 3472 | #, c-format |
3441 | msgid "Cannot obtain information about user `%s': %s\n" | 3473 | msgid "Cannot obtain information about user `%s': %s\n" |
3442 | msgstr "Không thể lấy thông tin vá» ngÆ°á»i dùng « %s »: %s\n" | 3474 | msgstr "Không thể lấy thông tin vá» ngÆ°á»i dùng « %s »: %s\n" |
@@ -3631,100 +3663,100 @@ msgstr "Phải gá»i má»™t con số cho tùy chá»n « %s ».\n" | |||
3631 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 3663 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
3632 | msgstr "" | 3664 | msgstr "" |
3633 | 3665 | ||
3634 | #: src/lib/util/gnunet_error_codes.c:60 | 3666 | #: src/lib/util/gnunet_error_codes.c:59 |
3635 | msgid "No error (success)." | 3667 | msgid "No error (success)." |
3636 | msgstr "" | 3668 | msgstr "" |
3637 | 3669 | ||
3638 | #: src/lib/util/gnunet_error_codes.c:66 | 3670 | #: src/lib/util/gnunet_error_codes.c:65 |
3639 | #, fuzzy | 3671 | #, fuzzy |
3640 | msgid "Unknown and unspecified error." | 3672 | msgid "Unknown and unspecified error." |
3641 | msgstr "Lỗi không rõ.\n" | 3673 | msgstr "Lỗi không rõ.\n" |
3642 | 3674 | ||
3643 | #: src/lib/util/gnunet_error_codes.c:72 | 3675 | #: src/lib/util/gnunet_error_codes.c:71 |
3644 | #, fuzzy | 3676 | #, fuzzy |
3645 | msgid "Communication with service failed." | 3677 | msgid "Communication with service failed." |
3646 | msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" | 3678 | msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" |
3647 | 3679 | ||
3648 | #: src/lib/util/gnunet_error_codes.c:78 | 3680 | #: src/lib/util/gnunet_error_codes.c:77 |
3649 | #, fuzzy | 3681 | #, fuzzy |
3650 | msgid "Ego not found." | 3682 | msgid "Ego not found." |
3651 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" | 3683 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" |
3652 | 3684 | ||
3653 | #: src/lib/util/gnunet_error_codes.c:84 | 3685 | #: src/lib/util/gnunet_error_codes.c:83 |
3654 | msgid "Identifier already in use for another ego." | 3686 | msgid "Identifier already in use for another ego." |
3655 | msgstr "" | 3687 | msgstr "" |
3656 | 3688 | ||
3657 | #: src/lib/util/gnunet_error_codes.c:90 | 3689 | #: src/lib/util/gnunet_error_codes.c:89 |
3658 | msgid "The given ego is invalid or malformed." | 3690 | msgid "The given ego is invalid or malformed." |
3659 | msgstr "" | 3691 | msgstr "" |
3660 | 3692 | ||
3661 | #: src/lib/util/gnunet_error_codes.c:96 | 3693 | #: src/lib/util/gnunet_error_codes.c:95 |
3662 | #, fuzzy | 3694 | #, fuzzy |
3663 | msgid "Unknown namestore error." | 3695 | msgid "Unknown namestore error." |
3664 | msgstr "Lỗi không rõ.\n" | 3696 | msgstr "Lỗi không rõ.\n" |
3665 | 3697 | ||
3666 | #: 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 |
3667 | #, fuzzy | 3699 | #, fuzzy |
3668 | msgid "Zone iteration failed." | 3700 | msgid "Zone iteration failed." |
3669 | msgstr "# các khoá phiên chạy được chấp nháºn" | 3701 | msgstr "# các khoá phiên chạy được chấp nháºn" |
3670 | 3702 | ||
3671 | #: src/lib/util/gnunet_error_codes.c:108 | 3703 | #: src/lib/util/gnunet_error_codes.c:107 |
3672 | #, fuzzy | 3704 | #, fuzzy |
3673 | msgid "Zone not found." | 3705 | msgid "Zone not found." |
3674 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" | 3706 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" |
3675 | 3707 | ||
3676 | #: src/lib/util/gnunet_error_codes.c:114 | 3708 | #: src/lib/util/gnunet_error_codes.c:113 |
3677 | #, fuzzy | 3709 | #, fuzzy |
3678 | msgid "Record not found." | 3710 | msgid "Record not found." |
3679 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" | 3711 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" |
3680 | 3712 | ||
3681 | #: src/lib/util/gnunet_error_codes.c:126 | 3713 | #: src/lib/util/gnunet_error_codes.c:125 |
3682 | #, fuzzy | 3714 | #, fuzzy |
3683 | msgid "Zone does not contain any records." | 3715 | msgid "Zone does not contain any records." |
3684 | msgstr "Táºp tin « %s » không chứa biệt hiệu.\n" | 3716 | msgstr "Táºp tin « %s » không chứa biệt hiệu.\n" |
3685 | 3717 | ||
3686 | #: src/lib/util/gnunet_error_codes.c:132 | 3718 | #: src/lib/util/gnunet_error_codes.c:131 |
3687 | #, fuzzy | 3719 | #, fuzzy |
3688 | msgid "Failed to lookup record." | 3720 | msgid "Failed to lookup record." |
3689 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | 3721 | msgstr "Lá»—i bắt đầu thu tháºp.\n" |
3690 | 3722 | ||
3691 | #: src/lib/util/gnunet_error_codes.c:138 | 3723 | #: src/lib/util/gnunet_error_codes.c:137 |
3692 | #, fuzzy | 3724 | #, fuzzy |
3693 | msgid "No records given." | 3725 | msgid "No records given." |
3694 | msgstr "chưa đưa ra tên" | 3726 | msgstr "chưa đưa ra tên" |
3695 | 3727 | ||
3696 | #: src/lib/util/gnunet_error_codes.c:144 | 3728 | #: src/lib/util/gnunet_error_codes.c:143 |
3697 | msgid "Record data invalid." | 3729 | msgid "Record data invalid." |
3698 | msgstr "" | 3730 | msgstr "" |
3699 | 3731 | ||
3700 | #: src/lib/util/gnunet_error_codes.c:150 | 3732 | #: src/lib/util/gnunet_error_codes.c:149 |
3701 | #, fuzzy | 3733 | #, fuzzy |
3702 | msgid "No label given." | 3734 | msgid "No label given." |
3703 | msgstr "chưa đưa ra tên" | 3735 | msgstr "chưa đưa ra tên" |
3704 | 3736 | ||
3705 | #: src/lib/util/gnunet_error_codes.c:156 | 3737 | #: src/lib/util/gnunet_error_codes.c:155 |
3706 | #, fuzzy | 3738 | #, fuzzy |
3707 | msgid "No results given." | 3739 | msgid "No results given." |
3708 | msgstr "chưa đưa ra tên" | 3740 | msgstr "chưa đưa ra tên" |
3709 | 3741 | ||
3710 | #: src/lib/util/gnunet_error_codes.c:162 | 3742 | #: src/lib/util/gnunet_error_codes.c:161 |
3711 | msgid "Record already exists." | 3743 | msgid "Record already exists." |
3712 | msgstr "" | 3744 | msgstr "" |
3713 | 3745 | ||
3714 | #: src/lib/util/gnunet_error_codes.c:168 | 3746 | #: src/lib/util/gnunet_error_codes.c:167 |
3715 | msgid "Record size exceeds maximum limit." | 3747 | msgid "Record size exceeds maximum limit." |
3716 | msgstr "" | 3748 | msgstr "" |
3717 | 3749 | ||
3718 | #: src/lib/util/gnunet_error_codes.c:174 | 3750 | #: src/lib/util/gnunet_error_codes.c:173 |
3719 | msgid "There was an error in the database backend." | 3751 | msgid "There was an error in the database backend." |
3720 | msgstr "" | 3752 | msgstr "" |
3721 | 3753 | ||
3722 | #: src/lib/util/gnunet_error_codes.c:180 | 3754 | #: src/lib/util/gnunet_error_codes.c:179 |
3723 | #, fuzzy | 3755 | #, fuzzy |
3724 | msgid "Failed to store the given records." | 3756 | msgid "Failed to store the given records." |
3725 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | 3757 | msgstr "Lá»—i bắt đầu thu tháºp.\n" |
3726 | 3758 | ||
3727 | #: src/lib/util/gnunet_error_codes.c:186 | 3759 | #: src/lib/util/gnunet_error_codes.c:185 |
3728 | msgid "Label invalid or malformed." | 3760 | msgid "Label invalid or malformed." |
3729 | msgstr "" | 3761 | msgstr "" |
3730 | 3762 | ||
@@ -3791,16 +3823,6 @@ msgstr "« %s » thất bại cho thư viện « %s » với lỗi: %s\n" | |||
3791 | msgid "Could not determine plugin installation path.\n" | 3823 | msgid "Could not determine plugin installation path.\n" |
3792 | msgstr "Không thể truy cáºp đến thông tin vá» không gian tên.\n" | 3824 | msgstr "Không thể truy cáºp đến thông tin vá» không gian tên.\n" |
3793 | 3825 | ||
3794 | #: src/lib/util/program.c:287 | ||
3795 | #, fuzzy, c-format | ||
3796 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
3797 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | ||
3798 | |||
3799 | #: src/lib/util/program.c:299 | ||
3800 | #, fuzzy, c-format | ||
3801 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
3802 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | ||
3803 | |||
3804 | #: src/lib/util/program.c:314 | 3826 | #: src/lib/util/program.c:314 |
3805 | #, fuzzy, c-format | 3827 | #, fuzzy, c-format |
3806 | msgid "Unreadable configuration file `%s'. Exiting ...\n" | 3828 | msgid "Unreadable configuration file `%s'. Exiting ...\n" |
@@ -3849,120 +3871,120 @@ msgstr "" | |||
3849 | msgid "Could not resolve our FQDN: %s\n" | 3871 | msgid "Could not resolve our FQDN: %s\n" |
3850 | msgstr "Không thể giải quyết « %s » (%s): %s\n" | 3872 | msgstr "Không thể giải quyết « %s » (%s): %s\n" |
3851 | 3873 | ||
3852 | #: src/lib/util/service.c:654 | 3874 | #: src/lib/util/service.c:650 |
3853 | #, c-format | 3875 | #, c-format |
3854 | msgid "" | 3876 | msgid "" |
3855 | "Processing code for message of type %u did not call " | 3877 | "Processing code for message of type %u did not call " |
3856 | "`GNUNET_SERVICE_client_continue' after %s\n" | 3878 | "`GNUNET_SERVICE_client_continue' after %s\n" |
3857 | msgstr "" | 3879 | msgstr "" |
3858 | 3880 | ||
3859 | #: src/lib/util/service.c:838 | 3881 | #: src/lib/util/service.c:841 |
3860 | #, fuzzy, c-format | 3882 | #, fuzzy, c-format |
3861 | msgid "Unknown address family %d\n" | 3883 | msgid "Unknown address family %d\n" |
3862 | msgstr "\tKhông rõ miá»n tên « %s »\n" | 3884 | msgstr "\tKhông rõ miá»n tên « %s »\n" |
3863 | 3885 | ||
3864 | #: src/lib/util/service.c:951 | 3886 | #: src/lib/util/service.c:956 |
3865 | #, c-format | 3887 | #, c-format |
3866 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" | 3888 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" |
3867 | msgstr "" | 3889 | msgstr "" |
3868 | 3890 | ||
3869 | #: src/lib/util/service.c:992 | 3891 | #: src/lib/util/service.c:997 |
3870 | #, c-format | 3892 | #, c-format |
3871 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" | 3893 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" |
3872 | msgstr "" | 3894 | msgstr "" |
3873 | 3895 | ||
3874 | #: 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 |
3875 | #: src/service/arm/gnunet-service-arm.c:412 | 3897 | #: src/service/arm/gnunet-service-arm.c:412 |
3876 | #: src/service/arm/gnunet-service-arm.c:418 | 3898 | #: src/service/arm/gnunet-service-arm.c:418 |
3877 | #, c-format | 3899 | #, c-format |
3878 | msgid "Require valid port number for service `%s' in configuration!\n" | 3900 | msgid "Require valid port number for service `%s' in configuration!\n" |
3879 | msgstr "" | 3901 | msgstr "" |
3880 | 3902 | ||
3881 | #: 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 |
3882 | #, c-format | 3904 | #, c-format |
3883 | msgid "" | 3905 | msgid "" |
3884 | "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 " |
3885 | "domain socket: %s\n" | 3907 | "domain socket: %s\n" |
3886 | msgstr "" | 3908 | msgstr "" |
3887 | 3909 | ||
3888 | #: 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 |
3889 | #, c-format | 3911 | #, c-format |
3890 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | 3912 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" |
3891 | msgstr "" | 3913 | msgstr "" |
3892 | 3914 | ||
3893 | #: 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 |
3894 | #, fuzzy, c-format | 3916 | #, fuzzy, c-format |
3895 | msgid "Failed to resolve `%s': %s\n" | 3917 | msgid "Failed to resolve `%s': %s\n" |
3896 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" | 3918 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" |
3897 | 3919 | ||
3898 | #: 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 |
3899 | #, fuzzy, c-format | 3921 | #, fuzzy, c-format |
3900 | msgid "Failed to find %saddress for `%s'.\n" | 3922 | msgid "Failed to find %saddress for `%s'.\n" |
3901 | msgstr "Lỗi đóng kết đến cổng %s %d.\n" | 3923 | msgstr "Lỗi đóng kết đến cổng %s %d.\n" |
3902 | 3924 | ||
3903 | #: src/lib/util/service.c:1401 | 3925 | #: src/lib/util/service.c:1406 |
3904 | #, fuzzy, c-format | 3926 | #, fuzzy, c-format |
3905 | msgid "`%s' failed for port %d (%s).\n" | 3927 | msgid "`%s' failed for port %d (%s).\n" |
3906 | msgstr "« %s » thất bại cho ổ đĩa « %s »: %u\n" | 3928 | msgstr "« %s » thất bại cho ổ đĩa « %s »: %u\n" |
3907 | 3929 | ||
3908 | #: src/lib/util/service.c:1413 | 3930 | #: src/lib/util/service.c:1418 |
3909 | #, fuzzy, c-format | 3931 | #, fuzzy, c-format |
3910 | msgid "`%s' failed for port %d (%s): address already in use\n" | 3932 | msgid "`%s' failed for port %d (%s): address already in use\n" |
3911 | msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n" | 3933 | msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n" |
3912 | 3934 | ||
3913 | #: src/lib/util/service.c:1420 | 3935 | #: src/lib/util/service.c:1425 |
3914 | #, fuzzy, c-format | 3936 | #, fuzzy, c-format |
3915 | msgid "`%s' failed for `%s': address already in use\n" | 3937 | msgid "`%s' failed for `%s': address already in use\n" |
3916 | msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n" | 3938 | msgstr "« %s » bị lỗi cho cổng %d. Trình gnunetd có chạy chưa?\n" |
3917 | 3939 | ||
3918 | #: src/lib/util/service.c:1481 | 3940 | #: src/lib/util/service.c:1486 |
3919 | #, c-format | 3941 | #, c-format |
3920 | msgid "Specified value for `%s' of service `%s' is invalid\n" | 3942 | msgid "Specified value for `%s' of service `%s' is invalid\n" |
3921 | msgstr "" | 3943 | msgstr "" |
3922 | 3944 | ||
3923 | #: src/lib/util/service.c:1505 | 3945 | #: src/lib/util/service.c:1510 |
3924 | #, c-format | 3946 | #, c-format |
3925 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" | 3947 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" |
3926 | msgstr "" | 3948 | msgstr "" |
3927 | 3949 | ||
3928 | #: src/lib/util/service.c:1573 | 3950 | #: src/lib/util/service.c:1583 |
3929 | msgid "" | 3951 | msgid "" |
3930 | "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" |
3931 | msgstr "" | 3953 | msgstr "" |
3932 | 3954 | ||
3933 | #: src/lib/util/service.c:1644 | 3955 | #: src/lib/util/service.c:1653 |
3934 | msgid "No such user" | 3956 | msgid "No such user" |
3935 | msgstr "Không có ngÆ°á»i dùng nhÆ° váºy" | 3957 | msgstr "Không có ngÆ°á»i dùng nhÆ° váºy" |
3936 | 3958 | ||
3937 | #: src/lib/util/service.c:1658 | 3959 | #: src/lib/util/service.c:1668 |
3938 | #, c-format | 3960 | #, c-format |
3939 | msgid "Cannot change user/group to `%s': %s\n" | 3961 | msgid "Cannot change user/group to `%s': %s\n" |
3940 | msgstr "Không thể thay đổi ngÆ°á»i dùng/nhóm thà nh « %s »: %s\n" | 3962 | msgstr "Không thể thay đổi ngÆ°á»i dùng/nhóm thà nh « %s »: %s\n" |
3941 | 3963 | ||
3942 | #: src/lib/util/service.c:1751 | 3964 | #: src/lib/util/service.c:1767 |
3943 | msgid "Service process failed to initialize\n" | 3965 | msgid "Service process failed to initialize\n" |
3944 | msgstr "" | 3966 | msgstr "" |
3945 | 3967 | ||
3946 | #: src/lib/util/service.c:1756 | 3968 | #: src/lib/util/service.c:1772 |
3947 | msgid "Service process could not initialize server function\n" | 3969 | msgid "Service process could not initialize server function\n" |
3948 | msgstr "" | 3970 | msgstr "" |
3949 | 3971 | ||
3950 | #: src/lib/util/service.c:1761 | 3972 | #: src/lib/util/service.c:1777 |
3951 | msgid "Service process failed to report status\n" | 3973 | msgid "Service process failed to report status\n" |
3952 | msgstr "" | 3974 | msgstr "" |
3953 | 3975 | ||
3954 | #: 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 |
3955 | msgid "do daemonize (detach from terminal)" | 3977 | msgid "do daemonize (detach from terminal)" |
3956 | msgstr "" | 3978 | msgstr "" |
3957 | 3979 | ||
3958 | #: 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 |
3959 | #: 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 |
3960 | #: src/service/transport/transport-testing-communicator.c:1056 | 3982 | #: src/service/transport/transport-testing-communicator.c:1059 |
3961 | #, fuzzy, c-format | 3983 | #, fuzzy, c-format |
3962 | msgid "Malformed configuration file `%s', exit ...\n" | 3984 | msgid "Malformed configuration file `%s', exit ...\n" |
3963 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 3985 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
3964 | 3986 | ||
3965 | #: 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 |
3966 | #, fuzzy | 3988 | #, fuzzy |
3967 | msgid "Malformed configuration, exit ...\n" | 3989 | msgid "Malformed configuration, exit ...\n" |
3968 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 3990 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
@@ -4429,6 +4451,11 @@ msgstr "" | |||
4429 | msgid "Initiating shutdown as requested by client.\n" | 4451 | msgid "Initiating shutdown as requested by client.\n" |
4430 | msgstr "" | 4452 | msgstr "" |
4431 | 4453 | ||
4454 | #: src/service/arm/testing_arm_cmd_start_peer.c:197 | ||
4455 | #, fuzzy, c-format | ||
4456 | msgid "Failed to start `%s': %s\n" | ||
4457 | msgstr "Lỗi chạy %s: %s %d\n" | ||
4458 | |||
4432 | #: src/service/core/gnunet-service-core.c:329 | 4459 | #: src/service/core/gnunet-service-core.c:329 |
4433 | #, fuzzy | 4460 | #, fuzzy |
4434 | msgid "# send requests dropped (disconnected)" | 4461 | msgid "# send requests dropped (disconnected)" |
@@ -4616,8 +4643,8 @@ msgstr "# các byte đã giải mã" | |||
4616 | #: src/service/core/gnunet-service-core_sessions.c:337 | 4643 | #: src/service/core/gnunet-service-core_sessions.c:337 |
4617 | #: src/service/fs/gnunet-service-fs_cp.c:484 | 4644 | #: src/service/fs/gnunet-service-fs_cp.c:484 |
4618 | #: src/service/fs/gnunet-service-fs_cp.c:1377 | 4645 | #: src/service/fs/gnunet-service-fs_cp.c:1377 |
4619 | #: src/service/topology/gnunet-daemon-topology.c:551 | 4646 | #: src/service/topology/gnunet-daemon-topology.c:545 |
4620 | #: src/service/topology/gnunet-daemon-topology.c:633 | 4647 | #: src/service/topology/gnunet-daemon-topology.c:627 |
4621 | #, fuzzy | 4648 | #, fuzzy |
4622 | msgid "# peers connected" | 4649 | msgid "# peers connected" |
4623 | msgstr "# của các đồng đẳng đã kết nối" | 4650 | msgstr "# của các đồng đẳng đã kết nối" |
@@ -5670,7 +5697,7 @@ msgstr "Lưu cấu hình ngay bây giỠkhông?" | |||
5670 | 5697 | ||
5671 | #: src/service/fs/gnunet-service-fs.c:1271 | 5698 | #: src/service/fs/gnunet-service-fs.c:1271 |
5672 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 | 5699 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 |
5673 | #: src/service/topology/gnunet-daemon-topology.c:1066 | 5700 | #: src/service/topology/gnunet-daemon-topology.c:1062 |
5674 | #, fuzzy, c-format | 5701 | #, fuzzy, c-format |
5675 | msgid "Failed to connect to `%s' service.\n" | 5702 | msgid "Failed to connect to `%s' service.\n" |
5676 | msgstr "Lỗi sơ khởi dịch vụ « %s ».\n" | 5703 | msgstr "Lỗi sơ khởi dịch vụ « %s ».\n" |
@@ -6510,7 +6537,7 @@ msgid "# hostlist advertisements send" | |||
6510 | msgstr "# Các quảng cáo ngoại được chuyển tiếp" | 6537 | msgstr "# Các quảng cáo ngoại được chuyển tiếp" |
6511 | 6538 | ||
6512 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 | 6539 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 |
6513 | #: src/service/topology/gnunet-daemon-topology.c:786 | 6540 | #: src/service/topology/gnunet-daemon-topology.c:781 |
6514 | #, fuzzy, c-format | 6541 | #, fuzzy, c-format |
6515 | msgid "Error in communication with PEERSTORE service: %s\n" | 6542 | msgid "Error in communication with PEERSTORE service: %s\n" |
6516 | msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" | 6543 | msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" |
@@ -6774,12 +6801,12 @@ msgstr "" | |||
6774 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" | 6801 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
6775 | msgstr "" | 6802 | msgstr "" |
6776 | 6803 | ||
6777 | #: src/service/nat/gnunet-service-nat.c:1861 | 6804 | #: src/service/nat/gnunet-service-nat.c:1860 |
6778 | #, fuzzy | 6805 | #, fuzzy |
6779 | msgid "Connection reversal request failed\n" | 6806 | msgid "Connection reversal request failed\n" |
6780 | msgstr "Thu tháºp bị dừng.\n" | 6807 | msgstr "Thu tháºp bị dừng.\n" |
6781 | 6808 | ||
6782 | #: src/service/nat/gnunet-service-nat.c:1935 | 6809 | #: src/service/nat/gnunet-service-nat.c:1999 |
6783 | msgid "" | 6810 | msgid "" |
6784 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 6811 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
6785 | "disabling UPnP\n" | 6812 | "disabling UPnP\n" |
@@ -6803,44 +6830,44 @@ msgstr "" | |||
6803 | msgid "`upnpc' command not found\n" | 6830 | msgid "`upnpc' command not found\n" |
6804 | msgstr "" | 6831 | msgstr "" |
6805 | 6832 | ||
6806 | #: src/service/peerstore/gnunet-service-peerstore.c:1141 | 6833 | #: src/service/peerstore/gnunet-service-peerstore.c:1150 |
6807 | #, fuzzy, c-format | 6834 | #, fuzzy, c-format |
6808 | msgid "Failed to parse HELLO in file `%s': %s\n" | 6835 | msgid "Failed to parse HELLO in file `%s': %s\n" |
6809 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 6836 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
6810 | 6837 | ||
6811 | #: src/service/peerstore/gnunet-service-peerstore.c:1214 | 6838 | #: src/service/peerstore/gnunet-service-peerstore.c:1223 |
6812 | #, fuzzy, c-format | 6839 | #, fuzzy, c-format |
6813 | msgid "Could not load database backend `%s'\n" | 6840 | msgid "Could not load database backend `%s'\n" |
6814 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" | 6841 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" |
6815 | 6842 | ||
6816 | #: src/service/peerstore/gnunet-service-peerstore.c:1233 | 6843 | #: src/service/peerstore/gnunet-service-peerstore.c:1242 |
6817 | #, c-format | 6844 | #, c-format |
6818 | msgid "Importing HELLOs from `%s'\n" | 6845 | msgid "Importing HELLOs from `%s'\n" |
6819 | msgstr "" | 6846 | msgstr "" |
6820 | 6847 | ||
6821 | #: src/service/peerstore/gnunet-service-peerstore.c:1244 | 6848 | #: src/service/peerstore/gnunet-service-peerstore.c:1253 |
6822 | msgid "Skipping import of included HELLOs\n" | 6849 | msgid "Skipping import of included HELLOs\n" |
6823 | msgstr "" | 6850 | msgstr "" |
6824 | 6851 | ||
6825 | #: src/service/peerstore/peerstore_api.c:574 | 6852 | #: src/service/peerstore/peerstore_api.c:579 |
6826 | #, fuzzy | 6853 | #, fuzzy |
6827 | msgid "Unexpected store response.\n" | 6854 | msgid "Unexpected store response.\n" |
6828 | msgstr "Gặp sá»± kiện bất thÆ°á»ng: %d\n" | 6855 | msgstr "Gặp sá»± kiện bất thÆ°á»ng: %d\n" |
6829 | 6856 | ||
6830 | #: src/service/peerstore/peerstore_api.c:606 | 6857 | #: src/service/peerstore/peerstore_api.c:620 |
6831 | #, fuzzy | 6858 | #, fuzzy |
6832 | msgid "Unexpected iteration response.\n" | 6859 | msgid "Unexpected iteration response.\n" |
6833 | msgstr "Äịnh dạng kết xuất không rõ, Ä‘iá»u nà y không nên xảy ra.\n" | 6860 | msgstr "Äịnh dạng kết xuất không rõ, Ä‘iá»u nà y không nên xảy ra.\n" |
6834 | 6861 | ||
6835 | #: src/service/peerstore/peerstore_api.c:652 | 6862 | #: src/service/peerstore/peerstore_api.c:666 |
6836 | #, fuzzy | 6863 | #, fuzzy |
6837 | msgid "" | 6864 | msgid "" |
6838 | "Unexpected iteration response, no iterating client found, discarding " | 6865 | "Unexpected iteration response, no iterating client found, discarding " |
6839 | "message.\n" | 6866 | "message.\n" |
6840 | msgstr "Äịnh dạng kết xuất không rõ, Ä‘iá»u nà y không nên xảy ra.\n" | 6867 | msgstr "Äịnh dạng kết xuất không rõ, Ä‘iá»u nà y không nên xảy ra.\n" |
6841 | 6868 | ||
6842 | #: src/service/peerstore/peerstore_api.c:662 | 6869 | #: src/service/peerstore/peerstore_api.c:676 |
6843 | #: src/service/peerstore/peerstore_api_monitor.c:164 | 6870 | #: src/service/peerstore/peerstore_api_monitor.c:163 |
6844 | #, fuzzy | 6871 | #, fuzzy |
6845 | msgid "Received a malformed response from service." | 6872 | msgid "Received a malformed response from service." |
6846 | msgstr "Nháºn yêu cầu định tuyến\n" | 6873 | msgstr "Nháºn yêu cầu định tuyến\n" |
@@ -7018,12 +7045,12 @@ msgstr "Lỗi sơ khởi lõi.\n" | |||
7018 | msgid "Namestore REST API initialized\n" | 7045 | msgid "Namestore REST API initialized\n" |
7019 | msgstr "Lỗi sơ khởi lõi.\n" | 7046 | msgstr "Lỗi sơ khởi lõi.\n" |
7020 | 7047 | ||
7021 | #: src/service/rest/openid_plugin.c:3102 | 7048 | #: src/service/rest/openid_plugin.c:3121 |
7022 | #, fuzzy | 7049 | #, fuzzy |
7023 | msgid "OpenID Connect REST API initialized\n" | 7050 | msgid "OpenID Connect REST API initialized\n" |
7024 | msgstr "Lỗi sơ khởi lõi.\n" | 7051 | msgstr "Lỗi sơ khởi lõi.\n" |
7025 | 7052 | ||
7026 | #: 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 |
7027 | #, fuzzy | 7054 | #, fuzzy |
7028 | msgid "Identity Provider REST API initialized\n" | 7055 | msgid "Identity Provider REST API initialized\n" |
7029 | msgstr "Lỗi sơ khởi lõi.\n" | 7056 | msgstr "Lỗi sơ khởi lõi.\n" |
@@ -7077,156 +7104,56 @@ msgstr "Äã tải %llu byte xuống « %s ».\n" | |||
7077 | msgid "Could not save some persistent statistics\n" | 7104 | msgid "Could not save some persistent statistics\n" |
7078 | msgstr "Không thể tạo miá»n tên.\n" | 7105 | msgstr "Không thể tạo miá»n tên.\n" |
7079 | 7106 | ||
7080 | #: src/service/testing/gnunet-testing.c:185 | 7107 | #: src/service/testbed/gnunet-testbed.c:196 |
7081 | #, fuzzy, c-format | ||
7082 | msgid "Could not extract hostkey %u (offset too large?)\n" | ||
7083 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" | ||
7084 | |||
7085 | #: src/service/testing/gnunet-testing.c:275 | ||
7086 | #, c-format | ||
7087 | msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n" | ||
7088 | msgstr "" | ||
7089 | |||
7090 | #: src/service/testing/gnunet-testing.c:386 | ||
7091 | #, fuzzy | 7108 | #, fuzzy |
7092 | msgid "create unique configuration files" | 7109 | msgid "number of unique configuration files to create" |
7093 | msgstr "cáºp nháºt má»™t giá trị trong táºp tin cấu hình" | ||
7094 | |||
7095 | #: src/service/testing/gnunet-testing.c:392 | ||
7096 | msgid "extract hostkey file from pre-computed hostkey list" | ||
7097 | msgstr "" | ||
7098 | |||
7099 | #: src/service/testing/gnunet-testing.c:400 | ||
7100 | #, fuzzy | ||
7101 | msgid "" | ||
7102 | "number of unique configuration files to create, or number of the hostkey to " | ||
7103 | "extract" | ||
7104 | msgstr "in ra đầu ra tiêu chuẩn má»™t giá trị từ táºp tin cấu hình" | 7110 | msgstr "in ra đầu ra tiêu chuẩn má»™t giá trị từ táºp tin cấu hình" |
7105 | 7111 | ||
7106 | #: src/service/testing/gnunet-testing.c:407 | 7112 | #: src/service/testbed/gnunet-testbed.c:202 |
7107 | #, fuzzy | 7113 | #, fuzzy |
7108 | msgid "configuration template" | 7114 | msgid "configuration template" |
7109 | msgstr "Cấu hình đã được lưu." | 7115 | msgstr "Cấu hình đã được lưu." |
7110 | 7116 | ||
7111 | #: src/service/testing/gnunet-testing.c:415 | 7117 | #: src/service/testbed/gnunet-testbed.c:218 |
7112 | msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)" | ||
7113 | msgstr "" | ||
7114 | |||
7115 | #: src/service/testing/gnunet-testing.c:432 | ||
7116 | msgid "Command line tool to access the testing library" | 7118 | msgid "Command line tool to access the testing library" |
7117 | msgstr "" | 7119 | msgstr "" |
7118 | 7120 | ||
7119 | #: src/service/testing/list-keys.c:92 | ||
7120 | msgid "list COUNT number of keys" | ||
7121 | msgstr "" | ||
7122 | |||
7123 | #: src/service/testing/testing.c:291 | ||
7124 | #, c-format | ||
7125 | msgid "Hostkeys file not found: %s\n" | ||
7126 | msgstr "" | ||
7127 | |||
7128 | #: src/service/testing/testing.c:743 | ||
7129 | #, fuzzy, c-format | ||
7130 | msgid "Key number %u does not exist\n" | ||
7131 | msgstr "đặt số trình ná»n cần khởi chạy" | ||
7132 | |||
7133 | #: src/service/testing/testing.c:1217 | ||
7134 | #, c-format | ||
7135 | msgid "" | ||
7136 | "You attempted to create a testbed with more than %u hosts. Please " | ||
7137 | "precompute more hostkeys first.\n" | ||
7138 | msgstr "" | ||
7139 | |||
7140 | #: src/service/testing/testing.c:1226 | ||
7141 | #, fuzzy, c-format | ||
7142 | msgid "Failed to initialize hostkey for peer %u\n" | ||
7143 | msgstr "Lỗi sơ khởi dịch vụ « %s ».\n" | ||
7144 | |||
7145 | #: src/service/testing/testing.c:1236 | ||
7146 | msgid "PRIVATE_KEY option in PEER section missing in configuration\n" | ||
7147 | msgstr "" | ||
7148 | |||
7149 | #: src/service/testing/testing.c:1249 | ||
7150 | #, fuzzy | ||
7151 | msgid "Failed to create configuration for peer (not enough free ports?)\n" | ||
7152 | msgstr "Không thể truy cáºp đến thông tin vá» không gian tên.\n" | ||
7153 | |||
7154 | #: src/service/testing/testing.c:1265 | ||
7155 | #, fuzzy, c-format | ||
7156 | msgid "Cannot open hostkey file `%s': %s\n" | ||
7157 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" | ||
7158 | |||
7159 | #: src/service/testing/testing.c:1279 | ||
7160 | #, fuzzy, c-format | ||
7161 | msgid "Failed to write hostkey file for peer %u: %s\n" | ||
7162 | msgstr "Lá»—i tạo thÆ° mục tạm thá»i." | ||
7163 | |||
7164 | #: src/service/testing/testing.c:1307 | ||
7165 | #, fuzzy, c-format | ||
7166 | msgid "Failed to write configuration file `%s' for peer %u: %s\n" | ||
7167 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | ||
7168 | |||
7169 | #: src/service/testing/testing.c:1413 | ||
7170 | #, fuzzy, c-format | ||
7171 | msgid "Failed to start `%s': %s\n" | ||
7172 | msgstr "Lỗi chạy %s: %s %d\n" | ||
7173 | |||
7174 | #: src/service/testing/testing.c:1664 | ||
7175 | #, fuzzy, c-format | ||
7176 | msgid "Failed to load configuration from %s\n" | ||
7177 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | ||
7178 | |||
7179 | #: src/service/testing/testing.c:2795 | ||
7180 | #, fuzzy, c-format | ||
7181 | msgid "Topology file %s not found\n" | ||
7182 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" | ||
7183 | |||
7184 | #: src/service/testing/testing.c:2803 | ||
7185 | #, fuzzy, c-format | ||
7186 | msgid "Topology file %s has no data\n" | ||
7187 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" | ||
7188 | |||
7189 | #: src/service/testing/testing.c:2811 | ||
7190 | #, fuzzy, c-format | ||
7191 | msgid "Topology file %s cannot be read\n" | ||
7192 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" | ||
7193 | |||
7194 | #: src/service/topology/gnunet-daemon-topology.c:286 | 7121 | #: src/service/topology/gnunet-daemon-topology.c:286 |
7195 | #, fuzzy | 7122 | #, fuzzy |
7196 | msgid "# connect requests issued to ATS" | 7123 | msgid "# connect requests issued to ATS" |
7197 | msgstr "# các yêu cầu máy/trình khách lỗ hổng được phun và o" | 7124 | msgstr "# các yêu cầu máy/trình khách lỗ hổng được phun và o" |
7198 | 7125 | ||
7199 | #: src/service/topology/gnunet-daemon-topology.c:480 | 7126 | #: src/service/topology/gnunet-daemon-topology.c:475 |
7200 | #, fuzzy | 7127 | #, fuzzy |
7201 | msgid "# HELLO messages gossipped" | 7128 | msgid "# HELLO messages gossipped" |
7202 | msgstr "# các thông báo gá»i Ä‘i bị loại bá»" | 7129 | msgstr "# các thông báo gá»i Ä‘i bị loại bá»" |
7203 | 7130 | ||
7204 | #: src/service/topology/gnunet-daemon-topology.c:752 | 7131 | #: src/service/topology/gnunet-daemon-topology.c:747 |
7205 | #, fuzzy | 7132 | #, fuzzy |
7206 | msgid "Error in communication with PEERSTORE service to monitor.\n" | 7133 | msgid "Error in communication with PEERSTORE service to monitor.\n" |
7207 | msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" | 7134 | msgstr "Cổng để liên lạc vá»›i giao diện ngÆ°á»i dùng GNUnet" |
7208 | 7135 | ||
7209 | #: src/service/topology/gnunet-daemon-topology.c:761 | 7136 | #: src/service/topology/gnunet-daemon-topology.c:756 |
7210 | msgid "Finished initial PEERSTORE iteration in monitor.\n" | 7137 | msgid "Finished initial PEERSTORE iteration in monitor.\n" |
7211 | msgstr "" | 7138 | msgstr "" |
7212 | 7139 | ||
7213 | #: src/service/topology/gnunet-daemon-topology.c:869 | 7140 | #: src/service/topology/gnunet-daemon-topology.c:864 |
7214 | msgid "Failed to connect to core service, can not manage topology!\n" | 7141 | msgid "Failed to connect to core service, can not manage topology!\n" |
7215 | msgstr "" | 7142 | msgstr "" |
7216 | 7143 | ||
7217 | #: src/service/topology/gnunet-daemon-topology.c:943 | 7144 | #: src/service/topology/gnunet-daemon-topology.c:938 |
7218 | #, fuzzy | 7145 | #, fuzzy |
7219 | msgid "# HELLO messages received" | 7146 | msgid "# HELLO messages received" |
7220 | msgstr "# các thông báo PONG đã máºt mã được nháºn" | 7147 | msgstr "# các thông báo PONG đã máºt mã được nháºn" |
7221 | 7148 | ||
7222 | #: src/service/topology/gnunet-daemon-topology.c:1095 | 7149 | #: src/service/topology/gnunet-daemon-topology.c:1091 |
7223 | msgid "GNUnet topology control" | 7150 | msgid "GNUnet topology control" |
7224 | msgstr "" | 7151 | msgstr "" |
7225 | 7152 | ||
7226 | #: src/service/transport/gnunet-communicator-quic.c:1717 | 7153 | #: src/service/transport/gnunet-communicator-quic.c:1717 |
7227 | #: src/service/transport/gnunet-communicator-tcp.c:3814 | 7154 | #: src/service/transport/gnunet-communicator-tcp.c:3814 |
7228 | #: src/service/transport/gnunet-communicator-udp.c:3562 | 7155 | #: src/service/transport/gnunet-communicator-udp.c:3579 |
7229 | #: src/service/transport/gnunet-service-transport.c:12124 | 7156 | #: src/service/transport/gnunet-service-transport.c:12543 |
7230 | #, fuzzy | 7157 | #, fuzzy |
7231 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7158 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7232 | msgstr "Lưu cấu hình ngay bây giỠkhông?" | 7159 | msgstr "Lưu cấu hình ngay bây giỠkhông?" |
@@ -7239,7 +7166,7 @@ msgstr "" | |||
7239 | msgid "GNUnet TCP communicator" | 7166 | msgid "GNUnet TCP communicator" |
7240 | msgstr "" | 7167 | msgstr "" |
7241 | 7168 | ||
7242 | #: src/service/transport/gnunet-communicator-udp.c:3637 | 7169 | #: src/service/transport/gnunet-communicator-udp.c:3654 |
7243 | msgid "GNUnet UDP communicator" | 7170 | msgid "GNUnet UDP communicator" |
7244 | msgstr "" | 7171 | msgstr "" |
7245 | 7172 | ||
@@ -7553,6 +7480,54 @@ msgid "Failed to connect to the namestore!\n" | |||
7553 | msgstr "Không kết nối được đến trình ná»n gnunetd." | 7480 | msgstr "Không kết nối được đến trình ná»n gnunetd." |
7554 | 7481 | ||
7555 | #, 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 | ||
7556 | #~ msgid "" | 7531 | #~ msgid "" |
7557 | #~ "Local peer: %s\n" | 7532 | #~ "Local peer: %s\n" |
7558 | #~ "\n" | 7533 | #~ "\n" |
@@ -8606,10 +8581,6 @@ msgstr "Không kết nối được đến trình ná»n gnunetd." | |||
8606 | #~ 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?" |
8607 | 8582 | ||
8608 | #, fuzzy | 8583 | #, fuzzy |
8609 | #~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | ||
8610 | #~ msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | ||
8611 | |||
8612 | #, fuzzy | ||
8613 | #~ msgid "Unreadable or malformed configuration, exit ...\n" | 8584 | #~ msgid "Unreadable or malformed configuration, exit ...\n" |
8614 | #~ 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 »:" |
8615 | 8586 | ||
diff --git a/po/zh_CN.po b/po/zh_CN.po index 145f268a5..b459071c3 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po | |||
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
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-15 09:19+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,27 +343,27 @@ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | |||
343 | msgid "Failed to connect to CORE service!\n" | 343 | msgid "Failed to connect to CORE service!\n" |
344 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 344 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
345 | 345 | ||
346 | #: src/cli/core/gnunet-core.c:212 | 346 | #: src/cli/core/gnunet-core.c:213 |
347 | #, fuzzy | 347 | #, fuzzy |
348 | msgid "No argument given.\n" | 348 | msgid "No argument given.\n" |
349 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" | 349 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" |
350 | 350 | ||
351 | #: src/cli/core/gnunet-core.c:235 src/service/transport/gnunet-transport.c:1389 | 351 | #: src/cli/core/gnunet-core.c:238 src/service/transport/gnunet-transport.c:1389 |
352 | msgid "provide information about all current connections (continuously)" | 352 | msgid "provide information about all current connections (continuously)" |
353 | msgstr "" | 353 | msgstr "" |
354 | 354 | ||
355 | #: src/cli/core/gnunet-core.c:241 | 355 | #: src/cli/core/gnunet-core.c:244 |
356 | msgid "Show our current peer identity" | 356 | msgid "Show our current peer identity" |
357 | msgstr "" | 357 | msgstr "" |
358 | 358 | ||
359 | #: src/cli/core/gnunet-core.c:248 | 359 | #: src/cli/core/gnunet-core.c:251 |
360 | #, fuzzy | 360 | #, fuzzy |
361 | msgid "Show current connections" | 361 | msgid "Show current connections" |
362 | msgstr "" | 362 | msgstr "" |
363 | "\n" | 363 | "\n" |
364 | "按任æ„键继ç»\n" | 364 | "按任æ„键继ç»\n" |
365 | 365 | ||
366 | #: src/cli/core/gnunet-core.c:259 | 366 | #: src/cli/core/gnunet-core.c:262 |
367 | msgid "Print information about connected peers." | 367 | msgid "Print information about connected peers." |
368 | msgstr "" | 368 | msgstr "" |
369 | 369 | ||
@@ -1060,52 +1060,52 @@ msgstr "" | |||
1060 | msgid "Unindex a file that was previously indexed with gnunet-publish." | 1060 | msgid "Unindex a file that was previously indexed with gnunet-publish." |
1061 | msgstr "" | 1061 | msgstr "" |
1062 | 1062 | ||
1063 | #: src/cli/gns/gnunet-gns.c:268 | 1063 | #: src/cli/gns/gnunet-gns.c:269 |
1064 | #, fuzzy, c-format | 1064 | #, fuzzy, c-format |
1065 | msgid "`%s' is not a valid DNS domain name\n" | 1065 | msgid "`%s' is not a valid DNS domain name\n" |
1066 | msgstr "“%sâ€ä¸å¯ç”¨ã€‚\n" | 1066 | msgstr "“%sâ€ä¸å¯ç”¨ã€‚\n" |
1067 | 1067 | ||
1068 | #: 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 |
1069 | #, fuzzy, c-format | 1069 | #, fuzzy, c-format |
1070 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" | 1070 | msgid "Failed to convert DNS IDNA name `%s' to UTF-8: %s\n" |
1071 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" | 1071 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" |
1072 | 1072 | ||
1073 | #: src/cli/gns/gnunet-gns.c:294 | 1073 | #: src/cli/gns/gnunet-gns.c:295 |
1074 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" | 1074 | msgid "Cannot resolve using GNS: GNUnet peer not running\n" |
1075 | msgstr "" | 1075 | msgstr "" |
1076 | 1076 | ||
1077 | #: src/cli/gns/gnunet-gns.c:305 | 1077 | #: src/cli/gns/gnunet-gns.c:306 |
1078 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 | 1078 | #: src/contrib/service/abd/gnunet-service-abd.c:1745 |
1079 | #, fuzzy, c-format | 1079 | #, fuzzy, c-format |
1080 | msgid "Failed to connect to GNS\n" | 1080 | msgid "Failed to connect to GNS\n" |
1081 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 1081 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
1082 | 1082 | ||
1083 | #: src/cli/gns/gnunet-gns.c:318 | 1083 | #: src/cli/gns/gnunet-gns.c:325 |
1084 | #, c-format | 1084 | #, c-format |
1085 | msgid "Invalid typename specified, assuming `ANY'\n" | 1085 | msgid "Invalid typename specified, assuming `ANY'\n" |
1086 | msgstr "" | 1086 | msgstr "" |
1087 | 1087 | ||
1088 | #: src/cli/gns/gnunet-gns.c:358 | 1088 | #: src/cli/gns/gnunet-gns.c:365 |
1089 | msgid "Lookup a record for the given name" | 1089 | msgid "Lookup a record for the given name" |
1090 | msgstr "" | 1090 | msgstr "" |
1091 | 1091 | ||
1092 | #: src/cli/gns/gnunet-gns.c:364 | 1092 | #: src/cli/gns/gnunet-gns.c:371 |
1093 | msgid "Specify the type of the record to lookup" | 1093 | msgid "Specify the type of the record to lookup" |
1094 | msgstr "" | 1094 | msgstr "" |
1095 | 1095 | ||
1096 | #: src/cli/gns/gnunet-gns.c:370 | 1096 | #: src/cli/gns/gnunet-gns.c:377 |
1097 | msgid "Specify a timeout for the lookup" | 1097 | msgid "Specify a timeout for the lookup" |
1098 | msgstr "" | 1098 | msgstr "" |
1099 | 1099 | ||
1100 | #: src/cli/gns/gnunet-gns.c:374 | 1100 | #: src/cli/gns/gnunet-gns.c:381 |
1101 | msgid "No unneeded output" | 1101 | msgid "No unneeded output" |
1102 | msgstr "" | 1102 | msgstr "" |
1103 | 1103 | ||
1104 | #: src/cli/gns/gnunet-gns.c:379 | 1104 | #: src/cli/gns/gnunet-gns.c:386 |
1105 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" | 1105 | msgid "DNS Compatibility: Name is passed in IDNA instead of UTF-8" |
1106 | msgstr "" | 1106 | msgstr "" |
1107 | 1107 | ||
1108 | #: src/cli/gns/gnunet-gns.c:393 | 1108 | #: src/cli/gns/gnunet-gns.c:400 |
1109 | #, fuzzy | 1109 | #, fuzzy |
1110 | msgid "GNUnet GNS resolver tool" | 1110 | msgid "GNUnet GNS resolver tool" |
1111 | msgstr "GNUnet 错误日志" | 1111 | msgstr "GNUnet 错误日志" |
@@ -1632,7 +1632,11 @@ msgstr "" | |||
1632 | msgid "GNUnet NAT traversal autoconfigure daemon" | 1632 | msgid "GNUnet NAT traversal autoconfigure daemon" |
1633 | msgstr "" | 1633 | msgstr "" |
1634 | 1634 | ||
1635 | #: src/cli/nse/gnunet-nse.c:124 | 1635 | #: src/cli/nse/gnunet-nse.c:126 |
1636 | msgid "Monitor and output current estimates" | ||
1637 | msgstr "" | ||
1638 | |||
1639 | #: src/cli/nse/gnunet-nse.c:137 | ||
1636 | msgid "Show network size estimates from NSE service." | 1640 | msgid "Show network size estimates from NSE service." |
1637 | msgstr "" | 1641 | msgstr "" |
1638 | 1642 | ||
@@ -1680,87 +1684,91 @@ msgstr "" | |||
1680 | msgid "The time until the DID Document is going to expire (e.g. 5d)" | 1684 | msgid "The time until the DID Document is going to expire (e.g. 5d)" |
1681 | msgstr "" | 1685 | msgstr "" |
1682 | 1686 | ||
1683 | #: src/cli/reclaim/gnunet-reclaim.c:805 | 1687 | #: src/cli/reclaim/gnunet-reclaim.c:813 |
1684 | #, fuzzy, c-format | 1688 | #, fuzzy, c-format |
1685 | msgid "Ego is required\n" | 1689 | msgid "Ego is required\n" |
1686 | msgstr "%s:选项“%sâ€æœ‰æ§ä¹‰\n" | 1690 | msgstr "%s:选项“%sâ€æœ‰æ§ä¹‰\n" |
1687 | 1691 | ||
1688 | #: src/cli/reclaim/gnunet-reclaim.c:812 | 1692 | #: src/cli/reclaim/gnunet-reclaim.c:820 |
1689 | #, c-format | 1693 | #, c-format |
1690 | msgid "Attribute value missing!\n" | 1694 | msgid "Attribute value missing!\n" |
1691 | msgstr "" | 1695 | msgstr "" |
1692 | 1696 | ||
1693 | #: src/cli/reclaim/gnunet-reclaim.c:819 | 1697 | #: src/cli/reclaim/gnunet-reclaim.c:827 |
1694 | #, fuzzy, c-format | 1698 | #, fuzzy, c-format |
1695 | msgid "Requesting party key is required!\n" | 1699 | msgid "Requesting party key is required!\n" |
1696 | msgstr "设置è¦ä½¿ç”¨çš„昵称(å¿…é¡»)" | 1700 | msgstr "设置è¦ä½¿ç”¨çš„昵称(å¿…é¡»)" |
1697 | 1701 | ||
1698 | #: src/cli/reclaim/gnunet-reclaim.c:837 | 1702 | #: src/cli/reclaim/gnunet-reclaim.c:846 |
1699 | msgid "Add or update an attribute NAME" | 1703 | msgid "Add or update an attribute NAME" |
1700 | msgstr "" | 1704 | msgstr "" |
1701 | 1705 | ||
1702 | #: src/cli/reclaim/gnunet-reclaim.c:842 | 1706 | #: src/cli/reclaim/gnunet-reclaim.c:851 |
1703 | msgid "Delete the attribute with ID" | 1707 | msgid "Delete the attribute with ID" |
1704 | msgstr "" | 1708 | msgstr "" |
1705 | 1709 | ||
1706 | #: src/cli/reclaim/gnunet-reclaim.c:847 | 1710 | #: src/cli/reclaim/gnunet-reclaim.c:856 |
1707 | msgid "The attribute VALUE" | 1711 | msgid "The attribute VALUE" |
1708 | msgstr "" | 1712 | msgstr "" |
1709 | 1713 | ||
1710 | #: src/cli/reclaim/gnunet-reclaim.c:852 | 1714 | #: src/cli/reclaim/gnunet-reclaim.c:861 |
1711 | #, fuzzy | 1715 | #, fuzzy |
1712 | msgid "The EGO to use" | 1716 | msgid "The EGO to use" |
1713 | msgstr "消æ¯å°ºå¯¸" | 1717 | msgstr "消æ¯å°ºå¯¸" |
1714 | 1718 | ||
1715 | #: src/cli/reclaim/gnunet-reclaim.c:858 | 1719 | #: src/cli/reclaim/gnunet-reclaim.c:867 |
1716 | msgid "Specify the relying party for issue" | 1720 | msgid "Specify the relying party for issue" |
1717 | msgstr "" | 1721 | msgstr "" |
1718 | 1722 | ||
1719 | #: src/cli/reclaim/gnunet-reclaim.c:862 | 1723 | #: src/cli/reclaim/gnunet-reclaim.c:873 |
1724 | msgid "Specify the relying party URI for a ticket to consume" | ||
1725 | msgstr "" | ||
1726 | |||
1727 | #: src/cli/reclaim/gnunet-reclaim.c:877 | ||
1720 | msgid "List attributes for EGO" | 1728 | msgid "List attributes for EGO" |
1721 | msgstr "" | 1729 | msgstr "" |
1722 | 1730 | ||
1723 | #: src/cli/reclaim/gnunet-reclaim.c:866 | 1731 | #: src/cli/reclaim/gnunet-reclaim.c:881 |
1724 | msgid "List credentials for EGO" | 1732 | msgid "List credentials for EGO" |
1725 | msgstr "" | 1733 | msgstr "" |
1726 | 1734 | ||
1727 | #: src/cli/reclaim/gnunet-reclaim.c:872 | 1735 | #: src/cli/reclaim/gnunet-reclaim.c:887 |
1728 | msgid "Credential to use for attribute" | 1736 | msgid "Credential to use for attribute" |
1729 | msgstr "" | 1737 | msgstr "" |
1730 | 1738 | ||
1731 | #: src/cli/reclaim/gnunet-reclaim.c:877 | 1739 | #: src/cli/reclaim/gnunet-reclaim.c:892 |
1732 | msgid "Credential name" | 1740 | msgid "Credential name" |
1733 | msgstr "" | 1741 | msgstr "" |
1734 | 1742 | ||
1735 | #: src/cli/reclaim/gnunet-reclaim.c:883 | 1743 | #: src/cli/reclaim/gnunet-reclaim.c:898 |
1736 | msgid "Issue a ticket for a set of attributes separated by comma" | 1744 | msgid "Issue a ticket for a set of attributes separated by comma" |
1737 | msgstr "" | 1745 | msgstr "" |
1738 | 1746 | ||
1739 | #: src/cli/reclaim/gnunet-reclaim.c:888 | 1747 | #: src/cli/reclaim/gnunet-reclaim.c:903 |
1740 | msgid "Consume a ticket" | 1748 | msgid "Consume a ticket" |
1741 | msgstr "" | 1749 | msgstr "" |
1742 | 1750 | ||
1743 | #: src/cli/reclaim/gnunet-reclaim.c:893 | 1751 | #: src/cli/reclaim/gnunet-reclaim.c:908 |
1744 | msgid "Revoke a ticket" | 1752 | msgid "Revoke a ticket" |
1745 | msgstr "" | 1753 | msgstr "" |
1746 | 1754 | ||
1747 | #: src/cli/reclaim/gnunet-reclaim.c:898 | 1755 | #: src/cli/reclaim/gnunet-reclaim.c:913 |
1748 | msgid "Type of attribute" | 1756 | msgid "Type of attribute" |
1749 | msgstr "" | 1757 | msgstr "" |
1750 | 1758 | ||
1751 | #: src/cli/reclaim/gnunet-reclaim.c:903 | 1759 | #: src/cli/reclaim/gnunet-reclaim.c:918 |
1752 | msgid "Type of credential" | 1760 | msgid "Type of credential" |
1753 | msgstr "" | 1761 | msgstr "" |
1754 | 1762 | ||
1755 | #: src/cli/reclaim/gnunet-reclaim.c:907 | 1763 | #: src/cli/reclaim/gnunet-reclaim.c:922 |
1756 | msgid "List tickets of ego" | 1764 | msgid "List tickets of ego" |
1757 | msgstr "" | 1765 | msgstr "" |
1758 | 1766 | ||
1759 | #: src/cli/reclaim/gnunet-reclaim.c:913 | 1767 | #: src/cli/reclaim/gnunet-reclaim.c:928 |
1760 | msgid "Expiration interval of the attribute" | 1768 | msgid "Expiration interval of the attribute" |
1761 | msgstr "" | 1769 | msgstr "" |
1762 | 1770 | ||
1763 | #: src/cli/reclaim/gnunet-reclaim.c:921 | 1771 | #: src/cli/reclaim/gnunet-reclaim.c:936 |
1764 | msgid "re:claimID command line tool" | 1772 | msgid "re:claimID command line tool" |
1765 | msgstr "" | 1773 | msgstr "" |
1766 | 1774 | ||
@@ -1997,34 +2005,59 @@ msgstr "" | |||
1997 | msgid "run decoder modus, otherwise runs as encoder" | 2005 | msgid "run decoder modus, otherwise runs as encoder" |
1998 | msgstr "" | 2006 | msgstr "" |
1999 | 2007 | ||
2000 | #: src/cli/util/gnunet-config.c:154 | 2008 | #: src/cli/util/gnunet-config.c:101 |
2001 | msgid "test if the current installation supports the specified BACKEND" | 2009 | msgid "test if the current installation supports the specified BACKEND" |
2002 | msgstr "" | 2010 | msgstr "" |
2003 | 2011 | ||
2004 | #: src/cli/util/gnunet-config.c:160 | 2012 | #: src/cli/util/gnunet-config.c:107 |
2005 | msgid "" | 2013 | msgid "" |
2006 | "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 " |
2007 | "GNUnet" | 2015 | "GNUnet" |
2008 | msgstr "" | 2016 | msgstr "" |
2009 | 2017 | ||
2010 | #: src/cli/util/gnunet-config.c:165 | 2018 | #: src/cli/util/gnunet-config.c:112 |
2011 | msgid "Is this an experimental build of GNUnet" | 2019 | msgid "Is this an experimental build of GNUnet" |
2012 | msgstr "" | 2020 | msgstr "" |
2013 | 2021 | ||
2014 | #: src/cli/util/gnunet-config.c:171 | 2022 | #: src/cli/util/gnunet-config.c:118 |
2015 | msgid "" | 2023 | msgid "" |
2016 | "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 " |
2017 | "GNUnet" | 2025 | "GNUnet" |
2018 | msgstr "" | 2026 | msgstr "" |
2019 | 2027 | ||
2020 | #: src/cli/util/gnunet-config.c:177 | 2028 | #: src/cli/util/gnunet-config.c:123 |
2029 | #, fuzzy | ||
2030 | msgid "Do not parse default configuration files" | ||
2031 | msgstr "更改é…置文件ä¸çš„一个值" | ||
2032 | |||
2033 | #: src/cli/util/gnunet-config.c:129 | ||
2021 | msgid "Provide the path under which GNUnet was installed" | 2034 | msgid "Provide the path under which GNUnet was installed" |
2022 | msgstr "" | 2035 | msgstr "" |
2023 | 2036 | ||
2024 | #: src/cli/util/gnunet-config.c:192 | 2037 | #: src/cli/util/gnunet-config.c:136 |
2038 | msgid "" | ||
2039 | "Parse main configuration from this command-line argument and not from disk" | ||
2040 | msgstr "" | ||
2041 | |||
2042 | #: src/cli/util/gnunet-config.c:225 | ||
2025 | #, fuzzy | 2043 | #, fuzzy |
2026 | msgid "Manipulate GNUnet configuration files" | 2044 | msgid "Failed to load default configuration, exiting ...\n" |
2027 | msgstr "更改é…置文件ä¸çš„一个值" | 2045 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
2046 | |||
2047 | #: src/cli/util/gnunet-config.c:237 | ||
2048 | #, fuzzy | ||
2049 | msgid "Failed to parse configuration, exiting ...\n" | ||
2050 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | ||
2051 | |||
2052 | #: src/cli/util/gnunet-config.c:249 src/lib/util/program.c:287 | ||
2053 | #, fuzzy, c-format | ||
2054 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
2055 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | ||
2056 | |||
2057 | #: src/cli/util/gnunet-config.c:263 src/lib/util/program.c:299 | ||
2058 | #, fuzzy, c-format | ||
2059 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
2060 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | ||
2028 | 2061 | ||
2029 | #: src/cli/util/gnunet-crypto-tvg.c:1588 | 2062 | #: src/cli/util/gnunet-crypto-tvg.c:1588 |
2030 | msgid "verify a test vector from stdin" | 2063 | msgid "verify a test vector from stdin" |
@@ -2071,55 +2104,54 @@ msgstr "" | |||
2071 | msgid "Hostkeys file `%s' not found\n" | 2104 | msgid "Hostkeys file `%s' not found\n" |
2072 | msgstr "" | 2105 | msgstr "" |
2073 | 2106 | ||
2074 | #: src/cli/util/gnunet-ecc.c:314 | 2107 | #: src/cli/util/gnunet-ecc.c:318 |
2075 | #, fuzzy, c-format | 2108 | #, fuzzy, c-format |
2076 | msgid "Hostkeys file `%s' is empty\n" | 2109 | msgid "Hostkeys file `%s' is empty\n" |
2077 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | 2110 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" |
2078 | 2111 | ||
2079 | #: src/cli/util/gnunet-ecc.c:319 src/service/testing/list-keys.c:47 | 2112 | #: src/cli/util/gnunet-ecc.c:324 |
2080 | #: src/service/testing/testing.c:308 | ||
2081 | #, c-format | 2113 | #, c-format |
2082 | msgid "Incorrect hostkey file format: %s\n" | 2114 | msgid "Incorrect hostkey file format: %s\n" |
2083 | msgstr "" | 2115 | msgstr "" |
2084 | 2116 | ||
2085 | #: src/cli/util/gnunet-ecc.c:334 | 2117 | #: src/cli/util/gnunet-ecc.c:340 |
2086 | #, fuzzy, c-format | 2118 | #, fuzzy, c-format |
2087 | msgid "Could not read hostkey file: %s\n" | 2119 | msgid "Could not read hostkey file: %s\n" |
2088 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | 2120 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" |
2089 | 2121 | ||
2090 | #: src/cli/util/gnunet-ecc.c:388 | 2122 | #: src/cli/util/gnunet-ecc.c:394 |
2091 | msgid "No hostkey file specified on command line\n" | 2123 | msgid "No hostkey file specified on command line\n" |
2092 | msgstr "" | 2124 | msgstr "" |
2093 | 2125 | ||
2094 | #: src/cli/util/gnunet-ecc.c:452 | 2126 | #: src/cli/util/gnunet-ecc.c:458 |
2095 | msgid "list keys included in a file (for testing)" | 2127 | msgid "list keys included in a file (for testing)" |
2096 | msgstr "" | 2128 | msgstr "" |
2097 | 2129 | ||
2098 | #: src/cli/util/gnunet-ecc.c:458 | 2130 | #: src/cli/util/gnunet-ecc.c:464 |
2099 | msgid "number of keys to list included in a file (for testing)" | 2131 | msgid "number of keys to list included in a file (for testing)" |
2100 | msgstr "" | 2132 | msgstr "" |
2101 | 2133 | ||
2102 | #: src/cli/util/gnunet-ecc.c:464 | 2134 | #: src/cli/util/gnunet-ecc.c:470 |
2103 | msgid "create COUNT public-private key pairs (for testing)" | 2135 | msgid "create COUNT public-private key pairs (for testing)" |
2104 | msgstr "" | 2136 | msgstr "" |
2105 | 2137 | ||
2106 | #: src/cli/util/gnunet-ecc.c:469 | 2138 | #: src/cli/util/gnunet-ecc.c:475 |
2107 | msgid "print the public key in ASCII format" | 2139 | msgid "print the public key in ASCII format" |
2108 | msgstr "" | 2140 | msgstr "" |
2109 | 2141 | ||
2110 | #: src/cli/util/gnunet-ecc.c:474 | 2142 | #: src/cli/util/gnunet-ecc.c:480 |
2111 | msgid "print the private key in ASCII format" | 2143 | msgid "print the private key in ASCII format" |
2112 | msgstr "" | 2144 | msgstr "" |
2113 | 2145 | ||
2114 | #: src/cli/util/gnunet-ecc.c:479 | 2146 | #: src/cli/util/gnunet-ecc.c:485 |
2115 | msgid "print the public key in HEX format" | 2147 | msgid "print the public key in HEX format" |
2116 | msgstr "" | 2148 | msgstr "" |
2117 | 2149 | ||
2118 | #: src/cli/util/gnunet-ecc.c:485 | 2150 | #: src/cli/util/gnunet-ecc.c:491 |
2119 | msgid "print examples of ECC operations (used for compatibility testing)" | 2151 | msgid "print examples of ECC operations (used for compatibility testing)" |
2120 | msgstr "" | 2152 | msgstr "" |
2121 | 2153 | ||
2122 | #: src/cli/util/gnunet-ecc.c:499 | 2154 | #: src/cli/util/gnunet-ecc.c:505 |
2123 | #, fuzzy | 2155 | #, fuzzy |
2124 | msgid "Manipulate GNUnet private ECC key files" | 2156 | msgid "Manipulate GNUnet private ECC key files" |
2125 | msgstr "更改é…置文件ä¸çš„一个值" | 2157 | msgstr "更改é…置文件ä¸çš„一个值" |
@@ -3197,13 +3229,13 @@ msgstr "" | |||
3197 | msgid "Invalid handle type while writing `%s'" | 3229 | msgid "Invalid handle type while writing `%s'" |
3198 | msgstr "IP æ ¼å¼æ— 效:“%sâ€\n" | 3230 | msgstr "IP æ ¼å¼æ— 效:“%sâ€\n" |
3199 | 3231 | ||
3200 | #: 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 |
3201 | #: src/service/arm/gnunet-service-arm.c:452 | 3233 | #: src/service/arm/gnunet-service-arm.c:452 |
3202 | #, c-format | 3234 | #, c-format |
3203 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" | 3235 | msgid "UNIXPATH `%s' too long, maximum length is %llu\n" |
3204 | msgstr "" | 3236 | msgstr "" |
3205 | 3237 | ||
3206 | #: 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 |
3207 | #: src/service/arm/gnunet-service-arm.c:456 | 3239 | #: src/service/arm/gnunet-service-arm.c:456 |
3208 | #, fuzzy, c-format | 3240 | #, fuzzy, c-format |
3209 | msgid "Using `%s' instead\n" | 3241 | msgid "Using `%s' instead\n" |
@@ -3332,17 +3364,17 @@ msgstr "" | |||
3332 | msgid "`%s' failed at %s:%d with error: %s\n" | 3364 | msgid "`%s' failed at %s:%d with error: %s\n" |
3333 | msgstr "“%sâ€äºŽ %s:%d 处失败,错误为:%s\n" | 3365 | msgstr "“%sâ€äºŽ %s:%d 处失败,错误为:%s\n" |
3334 | 3366 | ||
3335 | #: src/lib/util/crypto_ecc.c:554 | 3367 | #: src/lib/util/crypto_ecc.c:569 |
3336 | #, fuzzy, c-format | 3368 | #, fuzzy, c-format |
3337 | msgid "ECC signing failed at %s:%d: %s\n" | 3369 | msgid "ECC signing failed at %s:%d: %s\n" |
3338 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" | 3370 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" |
3339 | 3371 | ||
3340 | #: src/lib/util/crypto_ecc.c:677 | 3372 | #: src/lib/util/crypto_ecc.c:692 |
3341 | #, fuzzy, c-format | 3373 | #, fuzzy, c-format |
3342 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 3374 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
3343 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" | 3375 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" |
3344 | 3376 | ||
3345 | #: 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 |
3346 | #, fuzzy | 3378 | #, fuzzy |
3347 | msgid "Could not load peer's private key\n" | 3379 | msgid "Could not load peer's private key\n" |
3348 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | 3380 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" |
@@ -3367,7 +3399,7 @@ msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" | |||
3367 | msgid "Expected `%s' to be a directory!\n" | 3399 | msgid "Expected `%s' to be a directory!\n" |
3368 | msgstr "“%sâ€åº”为目录ï¼\n" | 3400 | msgstr "“%sâ€åº”为目录ï¼\n" |
3369 | 3401 | ||
3370 | #: 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 |
3371 | #, c-format | 3403 | #, c-format |
3372 | msgid "Cannot obtain information about user `%s': %s\n" | 3404 | msgid "Cannot obtain information about user `%s': %s\n" |
3373 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" | 3405 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" |
@@ -3558,94 +3590,94 @@ msgstr "您必须å‘“%sâ€é€‰é¡¹ä¼ 递一个数å—。\n" | |||
3558 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 3590 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
3559 | msgstr "" | 3591 | msgstr "" |
3560 | 3592 | ||
3561 | #: src/lib/util/gnunet_error_codes.c:60 | 3593 | #: src/lib/util/gnunet_error_codes.c:59 |
3562 | msgid "No error (success)." | 3594 | msgid "No error (success)." |
3563 | msgstr "" | 3595 | msgstr "" |
3564 | 3596 | ||
3565 | #: src/lib/util/gnunet_error_codes.c:66 | 3597 | #: src/lib/util/gnunet_error_codes.c:65 |
3566 | #, fuzzy | 3598 | #, fuzzy |
3567 | msgid "Unknown and unspecified error." | 3599 | msgid "Unknown and unspecified error." |
3568 | msgstr "未知的用户“%sâ€\n" | 3600 | msgstr "未知的用户“%sâ€\n" |
3569 | 3601 | ||
3570 | #: src/lib/util/gnunet_error_codes.c:72 | 3602 | #: src/lib/util/gnunet_error_codes.c:71 |
3571 | #, fuzzy | 3603 | #, fuzzy |
3572 | msgid "Communication with service failed." | 3604 | msgid "Communication with service failed." |
3573 | msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n" | 3605 | msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n" |
3574 | 3606 | ||
3575 | #: src/lib/util/gnunet_error_codes.c:78 | 3607 | #: src/lib/util/gnunet_error_codes.c:77 |
3576 | msgid "Ego not found." | 3608 | msgid "Ego not found." |
3577 | msgstr "" | 3609 | msgstr "" |
3578 | 3610 | ||
3579 | #: src/lib/util/gnunet_error_codes.c:84 | 3611 | #: src/lib/util/gnunet_error_codes.c:83 |
3580 | msgid "Identifier already in use for another ego." | 3612 | msgid "Identifier already in use for another ego." |
3581 | msgstr "" | 3613 | msgstr "" |
3582 | 3614 | ||
3583 | #: src/lib/util/gnunet_error_codes.c:90 | 3615 | #: src/lib/util/gnunet_error_codes.c:89 |
3584 | msgid "The given ego is invalid or malformed." | 3616 | msgid "The given ego is invalid or malformed." |
3585 | msgstr "" | 3617 | msgstr "" |
3586 | 3618 | ||
3587 | #: src/lib/util/gnunet_error_codes.c:96 | 3619 | #: src/lib/util/gnunet_error_codes.c:95 |
3588 | #, fuzzy | 3620 | #, fuzzy |
3589 | msgid "Unknown namestore error." | 3621 | msgid "Unknown namestore error." |
3590 | msgstr "未知的用户“%sâ€\n" | 3622 | msgstr "未知的用户“%sâ€\n" |
3591 | 3623 | ||
3592 | #: 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 |
3593 | msgid "Zone iteration failed." | 3625 | msgid "Zone iteration failed." |
3594 | msgstr "" | 3626 | msgstr "" |
3595 | 3627 | ||
3596 | #: src/lib/util/gnunet_error_codes.c:108 | 3628 | #: src/lib/util/gnunet_error_codes.c:107 |
3597 | msgid "Zone not found." | 3629 | msgid "Zone not found." |
3598 | msgstr "" | 3630 | msgstr "" |
3599 | 3631 | ||
3600 | #: src/lib/util/gnunet_error_codes.c:114 | 3632 | #: src/lib/util/gnunet_error_codes.c:113 |
3601 | msgid "Record not found." | 3633 | msgid "Record not found." |
3602 | msgstr "" | 3634 | msgstr "" |
3603 | 3635 | ||
3604 | #: src/lib/util/gnunet_error_codes.c:126 | 3636 | #: src/lib/util/gnunet_error_codes.c:125 |
3605 | msgid "Zone does not contain any records." | 3637 | msgid "Zone does not contain any records." |
3606 | msgstr "" | 3638 | msgstr "" |
3607 | 3639 | ||
3608 | #: src/lib/util/gnunet_error_codes.c:132 | 3640 | #: src/lib/util/gnunet_error_codes.c:131 |
3609 | #, fuzzy | 3641 | #, fuzzy |
3610 | msgid "Failed to lookup record." | 3642 | msgid "Failed to lookup record." |
3611 | msgstr "è¿è¡Œ %s失败:%s %d\n" | 3643 | msgstr "è¿è¡Œ %s失败:%s %d\n" |
3612 | 3644 | ||
3613 | #: src/lib/util/gnunet_error_codes.c:138 | 3645 | #: src/lib/util/gnunet_error_codes.c:137 |
3614 | #, fuzzy | 3646 | #, fuzzy |
3615 | msgid "No records given." | 3647 | msgid "No records given." |
3616 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" | 3648 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" |
3617 | 3649 | ||
3618 | #: src/lib/util/gnunet_error_codes.c:144 | 3650 | #: src/lib/util/gnunet_error_codes.c:143 |
3619 | msgid "Record data invalid." | 3651 | msgid "Record data invalid." |
3620 | msgstr "" | 3652 | msgstr "" |
3621 | 3653 | ||
3622 | #: src/lib/util/gnunet_error_codes.c:150 | 3654 | #: src/lib/util/gnunet_error_codes.c:149 |
3623 | msgid "No label given." | 3655 | msgid "No label given." |
3624 | msgstr "" | 3656 | msgstr "" |
3625 | 3657 | ||
3626 | #: src/lib/util/gnunet_error_codes.c:156 | 3658 | #: src/lib/util/gnunet_error_codes.c:155 |
3627 | #, fuzzy | 3659 | #, fuzzy |
3628 | msgid "No results given." | 3660 | msgid "No results given." |
3629 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" | 3661 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" |
3630 | 3662 | ||
3631 | #: src/lib/util/gnunet_error_codes.c:162 | 3663 | #: src/lib/util/gnunet_error_codes.c:161 |
3632 | msgid "Record already exists." | 3664 | msgid "Record already exists." |
3633 | msgstr "" | 3665 | msgstr "" |
3634 | 3666 | ||
3635 | #: src/lib/util/gnunet_error_codes.c:168 | 3667 | #: src/lib/util/gnunet_error_codes.c:167 |
3636 | msgid "Record size exceeds maximum limit." | 3668 | msgid "Record size exceeds maximum limit." |
3637 | msgstr "" | 3669 | msgstr "" |
3638 | 3670 | ||
3639 | #: src/lib/util/gnunet_error_codes.c:174 | 3671 | #: src/lib/util/gnunet_error_codes.c:173 |
3640 | msgid "There was an error in the database backend." | 3672 | msgid "There was an error in the database backend." |
3641 | msgstr "" | 3673 | msgstr "" |
3642 | 3674 | ||
3643 | #: src/lib/util/gnunet_error_codes.c:180 | 3675 | #: src/lib/util/gnunet_error_codes.c:179 |
3644 | #, fuzzy | 3676 | #, fuzzy |
3645 | msgid "Failed to store the given records." | 3677 | msgid "Failed to store the given records." |
3646 | msgstr "è¿è¡Œ %s失败:%s %d\n" | 3678 | msgstr "è¿è¡Œ %s失败:%s %d\n" |
3647 | 3679 | ||
3648 | #: src/lib/util/gnunet_error_codes.c:186 | 3680 | #: src/lib/util/gnunet_error_codes.c:185 |
3649 | msgid "Label invalid or malformed." | 3681 | msgid "Label invalid or malformed." |
3650 | msgstr "" | 3682 | msgstr "" |
3651 | 3683 | ||
@@ -3712,16 +3744,6 @@ msgstr "" | |||
3712 | msgid "Could not determine plugin installation path.\n" | 3744 | msgid "Could not determine plugin installation path.\n" |
3713 | msgstr "æ— æ³•ç¡®å®šç”¨æˆ·ç•Œé¢å®šä¹‰æ–‡ä»¶ã€‚" | 3745 | msgstr "æ— æ³•ç¡®å®šç”¨æˆ·ç•Œé¢å®šä¹‰æ–‡ä»¶ã€‚" |
3714 | 3746 | ||
3715 | #: src/lib/util/program.c:287 | ||
3716 | #, fuzzy, c-format | ||
3717 | msgid "Unreadable configuration file `%s', exiting ...\n" | ||
3718 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | ||
3719 | |||
3720 | #: src/lib/util/program.c:299 | ||
3721 | #, fuzzy, c-format | ||
3722 | msgid "Malformed configuration file `%s', exiting ...\n" | ||
3723 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | ||
3724 | |||
3725 | #: src/lib/util/program.c:314 | 3747 | #: src/lib/util/program.c:314 |
3726 | #, fuzzy, c-format | 3748 | #, fuzzy, c-format |
3727 | msgid "Unreadable configuration file `%s'. Exiting ...\n" | 3749 | msgid "Unreadable configuration file `%s'. Exiting ...\n" |
@@ -3770,120 +3792,120 @@ msgstr "" | |||
3770 | msgid "Could not resolve our FQDN: %s\n" | 3792 | msgid "Could not resolve our FQDN: %s\n" |
3771 | msgstr "æ— æ³•è§£æžâ€œ%sâ€(%s):%s\n" | 3793 | msgstr "æ— æ³•è§£æžâ€œ%sâ€(%s):%s\n" |
3772 | 3794 | ||
3773 | #: src/lib/util/service.c:654 | 3795 | #: src/lib/util/service.c:650 |
3774 | #, c-format | 3796 | #, c-format |
3775 | msgid "" | 3797 | msgid "" |
3776 | "Processing code for message of type %u did not call " | 3798 | "Processing code for message of type %u did not call " |
3777 | "`GNUNET_SERVICE_client_continue' after %s\n" | 3799 | "`GNUNET_SERVICE_client_continue' after %s\n" |
3778 | msgstr "" | 3800 | msgstr "" |
3779 | 3801 | ||
3780 | #: src/lib/util/service.c:838 | 3802 | #: src/lib/util/service.c:841 |
3781 | #, c-format | 3803 | #, c-format |
3782 | msgid "Unknown address family %d\n" | 3804 | msgid "Unknown address family %d\n" |
3783 | msgstr "" | 3805 | msgstr "" |
3784 | 3806 | ||
3785 | #: src/lib/util/service.c:951 | 3807 | #: src/lib/util/service.c:956 |
3786 | #, c-format | 3808 | #, c-format |
3787 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" | 3809 | msgid "Could not parse IPv4 network specification `%s' for `%s:%s'\n" |
3788 | msgstr "" | 3810 | msgstr "" |
3789 | 3811 | ||
3790 | #: src/lib/util/service.c:992 | 3812 | #: src/lib/util/service.c:997 |
3791 | #, c-format | 3813 | #, c-format |
3792 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" | 3814 | msgid "Could not parse IPv6 network specification `%s' for `%s:%s'\n" |
3793 | msgstr "" | 3815 | msgstr "" |
3794 | 3816 | ||
3795 | #: 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 |
3796 | #: src/service/arm/gnunet-service-arm.c:412 | 3818 | #: src/service/arm/gnunet-service-arm.c:412 |
3797 | #: src/service/arm/gnunet-service-arm.c:418 | 3819 | #: src/service/arm/gnunet-service-arm.c:418 |
3798 | #, c-format | 3820 | #, c-format |
3799 | msgid "Require valid port number for service `%s' in configuration!\n" | 3821 | msgid "Require valid port number for service `%s' in configuration!\n" |
3800 | msgstr "" | 3822 | msgstr "" |
3801 | 3823 | ||
3802 | #: 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 |
3803 | #, c-format | 3825 | #, c-format |
3804 | msgid "" | 3826 | msgid "" |
3805 | "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 " |
3806 | "domain socket: %s\n" | 3828 | "domain socket: %s\n" |
3807 | msgstr "" | 3829 | msgstr "" |
3808 | 3830 | ||
3809 | #: 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 |
3810 | #, c-format | 3832 | #, c-format |
3811 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" | 3833 | msgid "Have neither PORT nor UNIXPATH for service `%s', but one is required\n" |
3812 | msgstr "" | 3834 | msgstr "" |
3813 | 3835 | ||
3814 | #: 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 |
3815 | #, fuzzy, c-format | 3837 | #, fuzzy, c-format |
3816 | msgid "Failed to resolve `%s': %s\n" | 3838 | msgid "Failed to resolve `%s': %s\n" |
3817 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" | 3839 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" |
3818 | 3840 | ||
3819 | #: 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 |
3820 | #, fuzzy, c-format | 3842 | #, fuzzy, c-format |
3821 | msgid "Failed to find %saddress for `%s'.\n" | 3843 | msgid "Failed to find %saddress for `%s'.\n" |
3822 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | 3844 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" |
3823 | 3845 | ||
3824 | #: src/lib/util/service.c:1401 | 3846 | #: src/lib/util/service.c:1406 |
3825 | #, fuzzy, c-format | 3847 | #, fuzzy, c-format |
3826 | msgid "`%s' failed for port %d (%s).\n" | 3848 | msgid "`%s' failed for port %d (%s).\n" |
3827 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" | 3849 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" |
3828 | 3850 | ||
3829 | #: src/lib/util/service.c:1413 | 3851 | #: src/lib/util/service.c:1418 |
3830 | #, c-format | 3852 | #, c-format |
3831 | msgid "`%s' failed for port %d (%s): address already in use\n" | 3853 | msgid "`%s' failed for port %d (%s): address already in use\n" |
3832 | msgstr "" | 3854 | msgstr "" |
3833 | 3855 | ||
3834 | #: src/lib/util/service.c:1420 | 3856 | #: src/lib/util/service.c:1425 |
3835 | #, fuzzy, c-format | 3857 | #, fuzzy, c-format |
3836 | msgid "`%s' failed for `%s': address already in use\n" | 3858 | msgid "`%s' failed for `%s': address already in use\n" |
3837 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" | 3859 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" |
3838 | 3860 | ||
3839 | #: src/lib/util/service.c:1481 | 3861 | #: src/lib/util/service.c:1486 |
3840 | #, c-format | 3862 | #, c-format |
3841 | msgid "Specified value for `%s' of service `%s' is invalid\n" | 3863 | msgid "Specified value for `%s' of service `%s' is invalid\n" |
3842 | msgstr "" | 3864 | msgstr "" |
3843 | 3865 | ||
3844 | #: src/lib/util/service.c:1505 | 3866 | #: src/lib/util/service.c:1510 |
3845 | #, c-format | 3867 | #, c-format |
3846 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" | 3868 | msgid "Could not access pre-bound socket %u, will try to bind myself\n" |
3847 | msgstr "" | 3869 | msgstr "" |
3848 | 3870 | ||
3849 | #: src/lib/util/service.c:1573 | 3871 | #: src/lib/util/service.c:1583 |
3850 | msgid "" | 3872 | msgid "" |
3851 | "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" |
3852 | msgstr "" | 3874 | msgstr "" |
3853 | 3875 | ||
3854 | #: src/lib/util/service.c:1644 | 3876 | #: src/lib/util/service.c:1653 |
3855 | msgid "No such user" | 3877 | msgid "No such user" |
3856 | msgstr "æ— æ¤ç”¨æˆ·" | 3878 | msgstr "æ— æ¤ç”¨æˆ·" |
3857 | 3879 | ||
3858 | #: src/lib/util/service.c:1658 | 3880 | #: src/lib/util/service.c:1668 |
3859 | #, c-format | 3881 | #, c-format |
3860 | msgid "Cannot change user/group to `%s': %s\n" | 3882 | msgid "Cannot change user/group to `%s': %s\n" |
3861 | msgstr "æ— æ³•æ›´æ”¹ç”¨æˆ·/组为“%sâ€ï¼š%s\n" | 3883 | msgstr "æ— æ³•æ›´æ”¹ç”¨æˆ·/组为“%sâ€ï¼š%s\n" |
3862 | 3884 | ||
3863 | #: src/lib/util/service.c:1751 | 3885 | #: src/lib/util/service.c:1767 |
3864 | msgid "Service process failed to initialize\n" | 3886 | msgid "Service process failed to initialize\n" |
3865 | msgstr "" | 3887 | msgstr "" |
3866 | 3888 | ||
3867 | #: src/lib/util/service.c:1756 | 3889 | #: src/lib/util/service.c:1772 |
3868 | msgid "Service process could not initialize server function\n" | 3890 | msgid "Service process could not initialize server function\n" |
3869 | msgstr "" | 3891 | msgstr "" |
3870 | 3892 | ||
3871 | #: src/lib/util/service.c:1761 | 3893 | #: src/lib/util/service.c:1777 |
3872 | msgid "Service process failed to report status\n" | 3894 | msgid "Service process failed to report status\n" |
3873 | msgstr "" | 3895 | msgstr "" |
3874 | 3896 | ||
3875 | #: 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 |
3876 | msgid "do daemonize (detach from terminal)" | 3898 | msgid "do daemonize (detach from terminal)" |
3877 | msgstr "" | 3899 | msgstr "" |
3878 | 3900 | ||
3879 | #: 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 |
3880 | #: 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 |
3881 | #: src/service/transport/transport-testing-communicator.c:1056 | 3903 | #: src/service/transport/transport-testing-communicator.c:1059 |
3882 | #, fuzzy, c-format | 3904 | #, fuzzy, c-format |
3883 | msgid "Malformed configuration file `%s', exit ...\n" | 3905 | msgid "Malformed configuration file `%s', exit ...\n" |
3884 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 3906 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
3885 | 3907 | ||
3886 | #: 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 |
3887 | #, fuzzy | 3909 | #, fuzzy |
3888 | msgid "Malformed configuration, exit ...\n" | 3910 | msgid "Malformed configuration, exit ...\n" |
3889 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 3911 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
@@ -4347,6 +4369,11 @@ msgstr "" | |||
4347 | msgid "Initiating shutdown as requested by client.\n" | 4369 | msgid "Initiating shutdown as requested by client.\n" |
4348 | msgstr "" | 4370 | msgstr "" |
4349 | 4371 | ||
4372 | #: src/service/arm/testing_arm_cmd_start_peer.c:197 | ||
4373 | #, fuzzy, c-format | ||
4374 | msgid "Failed to start `%s': %s\n" | ||
4375 | msgstr "è¿è¡Œ %s失败:%s %d\n" | ||
4376 | |||
4350 | #: src/service/core/gnunet-service-core.c:329 | 4377 | #: src/service/core/gnunet-service-core.c:329 |
4351 | msgid "# send requests dropped (disconnected)" | 4378 | msgid "# send requests dropped (disconnected)" |
4352 | msgstr "" | 4379 | msgstr "" |
@@ -4511,8 +4538,8 @@ msgstr "" | |||
4511 | #: src/service/core/gnunet-service-core_sessions.c:337 | 4538 | #: src/service/core/gnunet-service-core_sessions.c:337 |
4512 | #: src/service/fs/gnunet-service-fs_cp.c:484 | 4539 | #: src/service/fs/gnunet-service-fs_cp.c:484 |
4513 | #: src/service/fs/gnunet-service-fs_cp.c:1377 | 4540 | #: src/service/fs/gnunet-service-fs_cp.c:1377 |
4514 | #: src/service/topology/gnunet-daemon-topology.c:551 | 4541 | #: src/service/topology/gnunet-daemon-topology.c:545 |
4515 | #: src/service/topology/gnunet-daemon-topology.c:633 | 4542 | #: src/service/topology/gnunet-daemon-topology.c:627 |
4516 | msgid "# peers connected" | 4543 | msgid "# peers connected" |
4517 | msgstr "" | 4544 | msgstr "" |
4518 | 4545 | ||
@@ -5523,7 +5550,7 @@ msgstr "ç«‹å³ä¿å˜é…置?" | |||
5523 | 5550 | ||
5524 | #: src/service/fs/gnunet-service-fs.c:1271 | 5551 | #: src/service/fs/gnunet-service-fs.c:1271 |
5525 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 | 5552 | #: src/service/hostlist/gnunet-daemon-hostlist.c:343 |
5526 | #: src/service/topology/gnunet-daemon-topology.c:1066 | 5553 | #: src/service/topology/gnunet-daemon-topology.c:1062 |
5527 | #, fuzzy, c-format | 5554 | #, fuzzy, c-format |
5528 | msgid "Failed to connect to `%s' service.\n" | 5555 | msgid "Failed to connect to `%s' service.\n" |
5529 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 5556 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
@@ -6322,7 +6349,7 @@ msgid "# hostlist advertisements send" | |||
6322 | msgstr "" | 6349 | msgstr "" |
6323 | 6350 | ||
6324 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 | 6351 | #: src/service/hostlist/gnunet-daemon-hostlist_server.c:483 |
6325 | #: src/service/topology/gnunet-daemon-topology.c:786 | 6352 | #: src/service/topology/gnunet-daemon-topology.c:781 |
6326 | #, fuzzy, c-format | 6353 | #, fuzzy, c-format |
6327 | msgid "Error in communication with PEERSTORE service: %s\n" | 6354 | msgid "Error in communication with PEERSTORE service: %s\n" |
6328 | msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n" | 6355 | msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n" |
@@ -6584,11 +6611,11 @@ msgstr "" | |||
6584 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" | 6611 | msgid "Malformed punched hole specification `%s' (IPv6 address invalid)" |
6585 | msgstr "" | 6612 | msgstr "" |
6586 | 6613 | ||
6587 | #: src/service/nat/gnunet-service-nat.c:1861 | 6614 | #: src/service/nat/gnunet-service-nat.c:1860 |
6588 | msgid "Connection reversal request failed\n" | 6615 | msgid "Connection reversal request failed\n" |
6589 | msgstr "" | 6616 | msgstr "" |
6590 | 6617 | ||
6591 | #: src/service/nat/gnunet-service-nat.c:1935 | 6618 | #: src/service/nat/gnunet-service-nat.c:1999 |
6592 | msgid "" | 6619 | msgid "" |
6593 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " | 6620 | "UPnP enabled in configuration, but UPnP client `upnpc` command not found, " |
6594 | "disabling UPnP\n" | 6621 | "disabling UPnP\n" |
@@ -6612,44 +6639,44 @@ msgstr "" | |||
6612 | msgid "`upnpc' command not found\n" | 6639 | msgid "`upnpc' command not found\n" |
6613 | msgstr "" | 6640 | msgstr "" |
6614 | 6641 | ||
6615 | #: src/service/peerstore/gnunet-service-peerstore.c:1141 | 6642 | #: src/service/peerstore/gnunet-service-peerstore.c:1150 |
6616 | #, fuzzy, c-format | 6643 | #, fuzzy, c-format |
6617 | msgid "Failed to parse HELLO in file `%s': %s\n" | 6644 | msgid "Failed to parse HELLO in file `%s': %s\n" |
6618 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 6645 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
6619 | 6646 | ||
6620 | #: src/service/peerstore/gnunet-service-peerstore.c:1214 | 6647 | #: src/service/peerstore/gnunet-service-peerstore.c:1223 |
6621 | #, fuzzy, c-format | 6648 | #, fuzzy, c-format |
6622 | msgid "Could not load database backend `%s'\n" | 6649 | msgid "Could not load database backend `%s'\n" |
6623 | msgstr "æ— æ³•è§£æžâ€œ%sâ€(%s):%s\n" | 6650 | msgstr "æ— æ³•è§£æžâ€œ%sâ€(%s):%s\n" |
6624 | 6651 | ||
6625 | #: src/service/peerstore/gnunet-service-peerstore.c:1233 | 6652 | #: src/service/peerstore/gnunet-service-peerstore.c:1242 |
6626 | #, c-format | 6653 | #, c-format |
6627 | msgid "Importing HELLOs from `%s'\n" | 6654 | msgid "Importing HELLOs from `%s'\n" |
6628 | msgstr "" | 6655 | msgstr "" |
6629 | 6656 | ||
6630 | #: src/service/peerstore/gnunet-service-peerstore.c:1244 | 6657 | #: src/service/peerstore/gnunet-service-peerstore.c:1253 |
6631 | msgid "Skipping import of included HELLOs\n" | 6658 | msgid "Skipping import of included HELLOs\n" |
6632 | msgstr "" | 6659 | msgstr "" |
6633 | 6660 | ||
6634 | #: src/service/peerstore/peerstore_api.c:574 | 6661 | #: src/service/peerstore/peerstore_api.c:579 |
6635 | #, fuzzy | 6662 | #, fuzzy |
6636 | msgid "Unexpected store response.\n" | 6663 | msgid "Unexpected store response.\n" |
6637 | msgstr "已完æˆæ•°æ®ä»“库轮æ¢ã€‚\n" | 6664 | msgstr "已完æˆæ•°æ®ä»“库轮æ¢ã€‚\n" |
6638 | 6665 | ||
6639 | #: src/service/peerstore/peerstore_api.c:606 | 6666 | #: src/service/peerstore/peerstore_api.c:620 |
6640 | #, fuzzy | 6667 | #, fuzzy |
6641 | msgid "Unexpected iteration response.\n" | 6668 | msgid "Unexpected iteration response.\n" |
6642 | msgstr "è¾“å‡ºæ ¼å¼æœªçŸ¥ï¼Œä¸åº”出现这ç§æƒ…况。\n" | 6669 | msgstr "è¾“å‡ºæ ¼å¼æœªçŸ¥ï¼Œä¸åº”出现这ç§æƒ…况。\n" |
6643 | 6670 | ||
6644 | #: src/service/peerstore/peerstore_api.c:652 | 6671 | #: src/service/peerstore/peerstore_api.c:666 |
6645 | #, fuzzy | 6672 | #, fuzzy |
6646 | msgid "" | 6673 | msgid "" |
6647 | "Unexpected iteration response, no iterating client found, discarding " | 6674 | "Unexpected iteration response, no iterating client found, discarding " |
6648 | "message.\n" | 6675 | "message.\n" |
6649 | msgstr "è¾“å‡ºæ ¼å¼æœªçŸ¥ï¼Œä¸åº”出现这ç§æƒ…况。\n" | 6676 | msgstr "è¾“å‡ºæ ¼å¼æœªçŸ¥ï¼Œä¸åº”出现这ç§æƒ…况。\n" |
6650 | 6677 | ||
6651 | #: src/service/peerstore/peerstore_api.c:662 | 6678 | #: src/service/peerstore/peerstore_api.c:676 |
6652 | #: src/service/peerstore/peerstore_api_monitor.c:164 | 6679 | #: src/service/peerstore/peerstore_api_monitor.c:163 |
6653 | #, fuzzy | 6680 | #, fuzzy |
6654 | msgid "Received a malformed response from service." | 6681 | msgid "Received a malformed response from service." |
6655 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" | 6682 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" |
@@ -6813,11 +6840,11 @@ msgstr "" | |||
6813 | msgid "Namestore REST API initialized\n" | 6840 | msgid "Namestore REST API initialized\n" |
6814 | msgstr "" | 6841 | msgstr "" |
6815 | 6842 | ||
6816 | #: src/service/rest/openid_plugin.c:3102 | 6843 | #: src/service/rest/openid_plugin.c:3121 |
6817 | msgid "OpenID Connect REST API initialized\n" | 6844 | msgid "OpenID Connect REST API initialized\n" |
6818 | msgstr "" | 6845 | msgstr "" |
6819 | 6846 | ||
6820 | #: 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 |
6821 | msgid "Identity Provider REST API initialized\n" | 6848 | msgid "Identity Provider REST API initialized\n" |
6822 | msgstr "" | 6849 | msgstr "" |
6823 | 6850 | ||
@@ -6869,153 +6896,53 @@ msgstr "" | |||
6869 | msgid "Could not save some persistent statistics\n" | 6896 | msgid "Could not save some persistent statistics\n" |
6870 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 6897 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
6871 | 6898 | ||
6872 | #: src/service/testing/gnunet-testing.c:185 | 6899 | #: src/service/testbed/gnunet-testbed.c:196 |
6873 | #, fuzzy, c-format | ||
6874 | msgid "Could not extract hostkey %u (offset too large?)\n" | ||
6875 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | ||
6876 | |||
6877 | #: src/service/testing/gnunet-testing.c:275 | ||
6878 | #, c-format | ||
6879 | msgid "Unknown command, use 'q' to quit or 'r' to restart peer\n" | ||
6880 | msgstr "" | ||
6881 | |||
6882 | #: src/service/testing/gnunet-testing.c:386 | ||
6883 | #, fuzzy | ||
6884 | msgid "create unique configuration files" | ||
6885 | msgstr "更改é…置文件ä¸çš„一个值" | ||
6886 | |||
6887 | #: src/service/testing/gnunet-testing.c:392 | ||
6888 | msgid "extract hostkey file from pre-computed hostkey list" | ||
6889 | msgstr "" | ||
6890 | |||
6891 | #: src/service/testing/gnunet-testing.c:400 | ||
6892 | #, fuzzy | 6900 | #, fuzzy |
6893 | msgid "" | 6901 | msgid "number of unique configuration files to create" |
6894 | "number of unique configuration files to create, or number of the hostkey to " | ||
6895 | "extract" | ||
6896 | msgstr "打å°é…置文件ä¸çš„ä¸€ä¸ªå€¼åˆ°æ ‡å‡†è¾“å‡º" | 6902 | msgstr "打å°é…置文件ä¸çš„ä¸€ä¸ªå€¼åˆ°æ ‡å‡†è¾“å‡º" |
6897 | 6903 | ||
6898 | #: src/service/testing/gnunet-testing.c:407 | 6904 | #: src/service/testbed/gnunet-testbed.c:202 |
6899 | #, fuzzy | 6905 | #, fuzzy |
6900 | msgid "configuration template" | 6906 | msgid "configuration template" |
6901 | msgstr "é…置已ä¿å˜" | 6907 | msgstr "é…置已ä¿å˜" |
6902 | 6908 | ||
6903 | #: src/service/testing/gnunet-testing.c:415 | 6909 | #: src/service/testbed/gnunet-testbed.c:218 |
6904 | msgid "run the given service, wait on stdin for 'r' (restart) or 'q' (quit)" | ||
6905 | msgstr "" | ||
6906 | |||
6907 | #: src/service/testing/gnunet-testing.c:432 | ||
6908 | msgid "Command line tool to access the testing library" | 6910 | msgid "Command line tool to access the testing library" |
6909 | msgstr "" | 6911 | msgstr "" |
6910 | 6912 | ||
6911 | #: src/service/testing/list-keys.c:92 | ||
6912 | msgid "list COUNT number of keys" | ||
6913 | msgstr "" | ||
6914 | |||
6915 | #: src/service/testing/testing.c:291 | ||
6916 | #, c-format | ||
6917 | msgid "Hostkeys file not found: %s\n" | ||
6918 | msgstr "" | ||
6919 | |||
6920 | #: src/service/testing/testing.c:743 | ||
6921 | #, c-format | ||
6922 | msgid "Key number %u does not exist\n" | ||
6923 | msgstr "" | ||
6924 | |||
6925 | #: src/service/testing/testing.c:1217 | ||
6926 | #, c-format | ||
6927 | msgid "" | ||
6928 | "You attempted to create a testbed with more than %u hosts. Please " | ||
6929 | "precompute more hostkeys first.\n" | ||
6930 | msgstr "" | ||
6931 | |||
6932 | #: src/service/testing/testing.c:1226 | ||
6933 | #, fuzzy, c-format | ||
6934 | msgid "Failed to initialize hostkey for peer %u\n" | ||
6935 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | ||
6936 | |||
6937 | #: src/service/testing/testing.c:1236 | ||
6938 | msgid "PRIVATE_KEY option in PEER section missing in configuration\n" | ||
6939 | msgstr "" | ||
6940 | |||
6941 | #: src/service/testing/testing.c:1249 | ||
6942 | #, fuzzy | ||
6943 | msgid "Failed to create configuration for peer (not enough free ports?)\n" | ||
6944 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | ||
6945 | |||
6946 | #: src/service/testing/testing.c:1265 | ||
6947 | #, fuzzy, c-format | ||
6948 | msgid "Cannot open hostkey file `%s': %s\n" | ||
6949 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | ||
6950 | |||
6951 | #: src/service/testing/testing.c:1279 | ||
6952 | #, fuzzy, c-format | ||
6953 | msgid "Failed to write hostkey file for peer %u: %s\n" | ||
6954 | msgstr "å‘é€æ¶ˆæ¯å¤±è´¥ã€‚\n" | ||
6955 | |||
6956 | #: src/service/testing/testing.c:1307 | ||
6957 | #, fuzzy, c-format | ||
6958 | msgid "Failed to write configuration file `%s' for peer %u: %s\n" | ||
6959 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | ||
6960 | |||
6961 | #: src/service/testing/testing.c:1413 | ||
6962 | #, fuzzy, c-format | ||
6963 | msgid "Failed to start `%s': %s\n" | ||
6964 | msgstr "è¿è¡Œ %s失败:%s %d\n" | ||
6965 | |||
6966 | #: src/service/testing/testing.c:1664 | ||
6967 | #, fuzzy, c-format | ||
6968 | msgid "Failed to load configuration from %s\n" | ||
6969 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | ||
6970 | |||
6971 | #: src/service/testing/testing.c:2795 | ||
6972 | #, c-format | ||
6973 | msgid "Topology file %s not found\n" | ||
6974 | msgstr "" | ||
6975 | |||
6976 | #: src/service/testing/testing.c:2803 | ||
6977 | #, c-format | ||
6978 | msgid "Topology file %s has no data\n" | ||
6979 | msgstr "" | ||
6980 | |||
6981 | #: src/service/testing/testing.c:2811 | ||
6982 | #, c-format | ||
6983 | msgid "Topology file %s cannot be read\n" | ||
6984 | msgstr "" | ||
6985 | |||
6986 | #: src/service/topology/gnunet-daemon-topology.c:286 | 6913 | #: src/service/topology/gnunet-daemon-topology.c:286 |
6987 | msgid "# connect requests issued to ATS" | 6914 | msgid "# connect requests issued to ATS" |
6988 | msgstr "" | 6915 | msgstr "" |
6989 | 6916 | ||
6990 | #: src/service/topology/gnunet-daemon-topology.c:480 | 6917 | #: src/service/topology/gnunet-daemon-topology.c:475 |
6991 | msgid "# HELLO messages gossipped" | 6918 | msgid "# HELLO messages gossipped" |
6992 | msgstr "" | 6919 | msgstr "" |
6993 | 6920 | ||
6994 | #: src/service/topology/gnunet-daemon-topology.c:752 | 6921 | #: src/service/topology/gnunet-daemon-topology.c:747 |
6995 | #, fuzzy | 6922 | #, fuzzy |
6996 | msgid "Error in communication with PEERSTORE service to monitor.\n" | 6923 | msgid "Error in communication with PEERSTORE service to monitor.\n" |
6997 | msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n" | 6924 | msgstr "连接 %s:%u 出错。守护程åºåœ¨è¿è¡Œå—?\n" |
6998 | 6925 | ||
6999 | #: src/service/topology/gnunet-daemon-topology.c:761 | 6926 | #: src/service/topology/gnunet-daemon-topology.c:756 |
7000 | msgid "Finished initial PEERSTORE iteration in monitor.\n" | 6927 | msgid "Finished initial PEERSTORE iteration in monitor.\n" |
7001 | msgstr "" | 6928 | msgstr "" |
7002 | 6929 | ||
7003 | #: src/service/topology/gnunet-daemon-topology.c:869 | 6930 | #: src/service/topology/gnunet-daemon-topology.c:864 |
7004 | msgid "Failed to connect to core service, can not manage topology!\n" | 6931 | msgid "Failed to connect to core service, can not manage topology!\n" |
7005 | msgstr "" | 6932 | msgstr "" |
7006 | 6933 | ||
7007 | #: src/service/topology/gnunet-daemon-topology.c:943 | 6934 | #: src/service/topology/gnunet-daemon-topology.c:938 |
7008 | msgid "# HELLO messages received" | 6935 | msgid "# HELLO messages received" |
7009 | msgstr "" | 6936 | msgstr "" |
7010 | 6937 | ||
7011 | #: src/service/topology/gnunet-daemon-topology.c:1095 | 6938 | #: src/service/topology/gnunet-daemon-topology.c:1091 |
7012 | msgid "GNUnet topology control" | 6939 | msgid "GNUnet topology control" |
7013 | msgstr "" | 6940 | msgstr "" |
7014 | 6941 | ||
7015 | #: src/service/transport/gnunet-communicator-quic.c:1717 | 6942 | #: src/service/transport/gnunet-communicator-quic.c:1717 |
7016 | #: src/service/transport/gnunet-communicator-tcp.c:3814 | 6943 | #: src/service/transport/gnunet-communicator-tcp.c:3814 |
7017 | #: src/service/transport/gnunet-communicator-udp.c:3562 | 6944 | #: src/service/transport/gnunet-communicator-udp.c:3579 |
7018 | #: src/service/transport/gnunet-service-transport.c:12124 | 6945 | #: src/service/transport/gnunet-service-transport.c:12543 |
7019 | #, fuzzy | 6946 | #, fuzzy |
7020 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 6947 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7021 | msgstr "ç«‹å³ä¿å˜é…置?" | 6948 | msgstr "ç«‹å³ä¿å˜é…置?" |
@@ -7028,7 +6955,7 @@ msgstr "" | |||
7028 | msgid "GNUnet TCP communicator" | 6955 | msgid "GNUnet TCP communicator" |
7029 | msgstr "" | 6956 | msgstr "" |
7030 | 6957 | ||
7031 | #: src/service/transport/gnunet-communicator-udp.c:3637 | 6958 | #: src/service/transport/gnunet-communicator-udp.c:3654 |
7032 | msgid "GNUnet UDP communicator" | 6959 | msgid "GNUnet UDP communicator" |
7033 | msgstr "" | 6960 | msgstr "" |
7034 | 6961 | ||
@@ -7332,6 +7259,38 @@ msgstr "å‘é€æ¶ˆæ¯å¤±è´¥ã€‚\n" | |||
7332 | msgid "Failed to connect to the namestore!\n" | 7259 | msgid "Failed to connect to the namestore!\n" |
7333 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 7260 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
7334 | 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 | |||
7335 | #, fuzzy | 7294 | #, fuzzy |
7336 | #~ msgid "number of PeerIDs to request" | 7295 | #~ msgid "number of PeerIDs to request" |
7337 | #~ msgstr "è¿ä»£æ¬¡æ•°" | 7296 | #~ msgstr "è¿ä»£æ¬¡æ•°" |
@@ -7789,10 +7748,6 @@ msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | |||
7789 | #~ msgstr "ç«‹å³ä¿å˜é…置?" | 7748 | #~ msgstr "ç«‹å³ä¿å˜é…置?" |
7790 | 7749 | ||
7791 | #, fuzzy | 7750 | #, fuzzy |
7792 | #~ msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | ||
7793 | #~ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | ||
7794 | |||
7795 | #, fuzzy | ||
7796 | #~ msgid "Unreadable or malformed configuration, exit ...\n" | 7751 | #~ msgid "Unreadable or malformed configuration, exit ...\n" |
7797 | #~ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 7752 | #~ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
7798 | 7753 | ||
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 994d90952..819ca903e 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am | |||
@@ -3,9 +3,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_builddir)/src/include | |||
3 | 3 | ||
4 | dist_pkgdata_DATA = \ | 4 | dist_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 \ |
7 | netjail/netjail_exec.sh \ | ||
8 | netjail/netjail_start_new.sh \ | ||
8 | netjail/netjail_stop.sh \ | 9 | netjail/netjail_stop.sh \ |
10 | netjail/netjail_test_master.sh \ | ||
9 | netjail/topo.sh \ | 11 | netjail/topo.sh \ |
10 | testing-ng/block.sh | 12 | testing-ng/block.sh |
11 | 13 | ||
@@ -20,11 +22,13 @@ EXTRA_DIST = \ | |||
20 | sphinx_update.sh | 22 | sphinx_update.sh |
21 | 23 | ||
22 | install-data-hook: | 24 | install-data-hook: |
23 | chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_core.sh' | 25 | chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_core.sh' |
24 | chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_start.sh' | 26 | chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_start.sh' |
25 | chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_stop.sh' | 27 | chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_start_new.sh' |
26 | chmod o+x '$(DESTDIR)$(pkgdatadir)/netjail_exec.sh' | 28 | chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_exec.sh' |
27 | chmod o+x '$(DESTDIR)$(pkgdatadir)/topo.sh' | 29 | chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_stop.sh' |
28 | chmod o+x '$(DESTDIR)$(pkgdatadir)/block.sh' | 30 | chmod +x '$(DESTDIR)$(pkgdatadir)/netjail_test_master.sh' |
31 | chmod +x '$(DESTDIR)$(pkgdatadir)/topo.sh' | ||
32 | chmod +x '$(DESTDIR)$(pkgdatadir)/block.sh' | ||
29 | 33 | ||
30 | ## EOF | 34 | ## 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 @@ | |||
1 | install_data([ | 1 | install_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) |
27 | endforeach | 26 | endforeach |
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 | ||
218 | netjail_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 | |||
226 | netjail_node_exec_without_fds_and_sudo() { | ||
227 | NODE=$1 | ||
228 | shift 1 | ||
229 | |||
230 | ip netns exec $NODE $@ | ||
231 | } | ||
232 | |||
233 | netjail_kill() { | 218 | netjail_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 index 34edf56bf..a9678cc57 100755..100644 --- a/scripts/netjail/netjail_exec.sh +++ b/scripts/netjail/netjail_exec.sh | |||
@@ -1,15 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | . "$(dirname $0)/netjail_core.sh" | 2 | . "$(dirname $0)/netjail_core.sh" |
3 | 3 | ||
4 | set -eu | 4 | NODE=$1 |
5 | set -x | 5 | shift 1 |
6 | 6 | ||
7 | export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | 7 | ip netns exec $NODE $@ |
8 | |||
9 | M=$1 | ||
10 | N=$2 | ||
11 | |||
12 | NODE=$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 | ||
15 | netjail_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 | |||
8 | export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | 8 | export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
9 | 9 | ||
10 | filename=$1 | 10 | filename=$1 |
11 | PREFIX=$2 | 11 | PREFIX=$PPID |
12 | readfile=$3 | 12 | readfile=$2 |
13 | 13 | ||
14 | BROADCAST=0 | 14 | BROADCAST=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 | |||
16 | if [ $readfile -eq 0 ] | 19 | if [ $readfile -eq 0 ] |
17 | then | 20 | then |
18 | read_topology_string "$filename" | 21 | read_topology_string "$filename" |
diff --git a/scripts/netjail/netjail_start_new.sh b/scripts/netjail/netjail_start_new.sh new file mode 100755 index 000000000..ed9ba71e4 --- /dev/null +++ b/scripts/netjail/netjail_start_new.sh | |||
@@ -0,0 +1,266 @@ | |||
1 | #!/bin/bash | ||
2 | . "$(dirname $0)/netjail_core.sh" | ||
3 | echo gaga | ||
4 | set -u | ||
5 | set -x | ||
6 | |||
7 | filename=$1 | ||
8 | |||
9 | PREFIX=$2 | ||
10 | readfile=$3 | ||
11 | |||
12 | echo gaga | ||
13 | if [ $readfile -eq 0 ] | ||
14 | then | ||
15 | cmd='gnunet-config -n ' | ||
16 | option=' -R ' | ||
17 | else | ||
18 | echo read file | ||
19 | cmd='gnunet-config -n ' | ||
20 | option=' -c ' | ||
21 | fi | ||
22 | echo cmd $cmd | ||
23 | # The order in which the namespaces of the topology are created must be in sync with the order the topology file is parsed in the C code. | ||
24 | |||
25 | configure_subnet_peer() | ||
26 | { | ||
27 | X=$1 | ||
28 | Y=$2 | ||
29 | echo subnet peers $X $Y | ||
30 | for Z in $(seq ${CARRIER_SUBNET_PEERS[$X,$Y]}); do | ||
31 | |||
32 | echo gaga 5 | ||
33 | TOTAL_NODES=$(($TOTAL_NODES+1)) | ||
34 | |||
35 | SETUP_PROGRAMMS=$($cmd-s CARRIER-$X-SUBNET-$Y-PEER-$Z -o SETUP_PROGRAMMS$option"$filename") | ||
36 | if [ -n "$SETUP_PROGRAMMS" ] | ||
37 | then | ||
38 | CARRIER_SUBNET_PEER_SETUP_PROGRAMMS[$X,$Y,$Z]=$SETUP_PROGRAMMS | ||
39 | else | ||
40 | CARRIER_SUBNET_PEER_SETUP_PROGRAMMS[$X,$Y,$Z]=$PEER_SETUP_PROGRAMMS | ||
41 | fi | ||
42 | CARRIER_SUBNET_PEER_TESTBED_PLUGIN=$($cmd-s CARRIER-$X-SUBNET-$Y-PEER-$Z -o TESTBED_PLUGIN$option"$filename") | ||
43 | if [ -n "$CARRIER_SUBNET_PEER_TESTBED_PLUGIN" ] | ||
44 | then | ||
45 | CARRIER_SUBNET_PEER_TESTBED_PLUGIN[$X,$Y,Z]=$CARRIER_SUBNET_PEER_TESTBED_PLUGIN | ||
46 | else | ||
47 | CARRIER_SUBNET_PEER_TESTBED_PLUGIN[$X,$Y,Z]=$DEFAULT_TESTBED_PLUGIN | ||
48 | fi | ||
49 | |||
50 | ADDRESS=${CARRIER_NET/X/$X} | ||
51 | ADDRESS=${ADDRESS/Y/$Y} | ||
52 | ADDRESS=${ADDRESS/Z/$Z} | ||
53 | netjail_node | ||
54 | SUBNET_PEER[$X,$Y,$Z]=$RESULT | ||
55 | netjail_node_link_bridge ${SUBNET_PEER[$X,$Y,$Z]} ${SUBNET_ROUTER_NETS[$X,$Y]} $ADDRESS 24 | ||
56 | done | ||
57 | } | ||
58 | |||
59 | configure_carrier_subnet() | ||
60 | { | ||
61 | X=$1 | ||
62 | |||
63 | for Y in $(seq ${CARRIER_SUBNETS[$X]}); do | ||
64 | |||
65 | echo gaga 4 | ||
66 | TOTAL_NODES=$(($TOTAL_NODES+1)) | ||
67 | |||
68 | SETUP_PROGRAMMS=$($cmd-s CARRIER-$X-SUBNET-$Y -o SETUP_PROGRAMMS$option"$filename") | ||
69 | if [ -n "$SETUP_PROGRAMMS" ] | ||
70 | then | ||
71 | CARRIER_SUBNET_SETUP_PROGRAMMS[$X,$Y]=$SETUP_PROGRAMMS | ||
72 | else | ||
73 | CARRIER_SUBNET_SETUP_PROGRAMMS[$X,$Y]=$SUBNET_SETUP_PROGRAMMS | ||
74 | fi | ||
75 | echo subnets $Y | ||
76 | CARRIER_SUBNET=$($cmd-s CARRIER-$X-SUBNET-$Y -o SUBNET$option"$filename") | ||
77 | if [ -n "$CARRIER_SUBNET" ] | ||
78 | then | ||
79 | CARRIER_SUBNET[$X,$Y]=$CARRIER_SUBNET | ||
80 | else | ||
81 | CARRIER_SUBNET[$X,$Y]=$DEFAULT_CARRIER_SUBNET | ||
82 | fi | ||
83 | CARRIER_SUBNET_PEERS=$($cmd-s CARRIER-$X-SUBNET-$Y -o SUBNET_PEERS$option"$filename") | ||
84 | if [ -n "$CARRIER_SUBNET_PEERS" ] | ||
85 | then | ||
86 | CARRIER_SUBNET_PEERS[$X,$Y]=$CARRIER_SUBNET_PEERS | ||
87 | else | ||
88 | CARRIER_SUBNET_PEERS[$X,$Y]=$DEFAULT_SUBNET_PEERS | ||
89 | fi | ||
90 | CARRIER_SUBNET_TESTBED_PLUGIN=$($cmd-s CARRIER-$X-SUBNET-$Y -o TESTBED_PLUGIN$option"$filename") | ||
91 | if [ -n "$CARRIER_SUBNET_TESTBED_PLUGIN" ] | ||
92 | then | ||
93 | CARRIER_SUBNET_TESTBED_PLUGIN[$X,$Y]=$CARRIER_SUBNET_TESTBED_PLUGIN | ||
94 | else | ||
95 | CARRIER_SUBNET_TESTBED_PLUGIN[$X,$Y]=$DEFAULT_TESTBED_PLUGIN | ||
96 | fi | ||
97 | |||
98 | SUBNET_NODE_NUMBER[$X]=$((${CARRIER_PEERS[$X]}+$Y)) | ||
99 | ADDRESS=${CARRIER_NET/X/$X} | ||
100 | ADDRESS=${ADDRESS/Y/${SUBNET_NODE_NUMBER[$X]}} | ||
101 | ADDRESS=${ADDRESS/Z/0} | ||
102 | netjail_node | ||
103 | SUBNET_ROUTERS[$X,$Y]=$RESULT | ||
104 | netjail_node_link_bridge ${SUBNET_ROUTERS[$X,$Y]} ${CARRIER_ROUTER_NETS[$X]} $ADDRESS 16 | ||
105 | SUBNET_ROUTER_EXT_IF[$X]=$RESULT | ||
106 | netjail_bridge | ||
107 | SUBNET_ROUTER_NETS[$X,$Y]=$RESULT | ||
108 | |||
109 | configure_subnet_peer $X $Y | ||
110 | |||
111 | echo gaga 5.5 ${SUBNET_ROUTERS[$X,$Y]} | ||
112 | |||
113 | ADDRESS=${CARRIER_NET/X/$X} | ||
114 | ADDRESS=${ADDRESS/Y/${SUBNET_NODE_NUMBER[$X]}} | ||
115 | ADDRESS=${ADDRESS/Z/$((${CARRIER_SUBNET_PEERS[$X,$Y]+}1))} | ||
116 | netjail_node_link_bridge ${SUBNET_ROUTERS[$X,$Y]} ${SUBNET_ROUTER_NETS[$X,$Y]} $ADDRESS 24 | ||
117 | for Z in $(seq ${CARRIER_SUBNET_PEERS[$X,$Y]}); do | ||
118 | netjail_node_add_default ${SUBNET_PEER[$X,$Y,$Z]} $ADDRESS | ||
119 | done | ||
120 | echo gaga 6 | ||
121 | done | ||
122 | } | ||
123 | |||
124 | configure_carrier_peer() | ||
125 | { | ||
126 | X=$1 | ||
127 | for Y in $(seq ${CARRIER_PEERS[$X]}); do | ||
128 | |||
129 | echo gaga 3 | ||
130 | TOTAL_NODES=$(($TOTAL_NODES+1)) | ||
131 | |||
132 | CARRIER_PEER_TESTBED_PLUGIN=$($cmd-s CARRIER-$X-PEER-$Y -o TESTBED_PLUGIN$option"$filename") | ||
133 | if [ -n "$CARRIER_PEER_TESTBED_PLUGIN" ] | ||
134 | then | ||
135 | CARRIER_PEER_TESTBED_PLUGIN[$X,$Y]=$CARRIER_PEER_TESTBED_PLUGIN | ||
136 | else | ||
137 | CARRIER_PEER_TESTBED_PLUGIN[$X,$Y]=$DEFAULT_TESTBED_PLUGIN | ||
138 | fi | ||
139 | ADDRESS=${CARRIER_NET/X/$X} | ||
140 | ADDRESS=${ADDRESS/Y/$Y} | ||
141 | ADDRESS=${ADDRESS/Z/0} | ||
142 | netjail_node | ||
143 | CARRIER_PEER[$X,$Y]=$RESULT | ||
144 | netjail_node_link_bridge ${CARRIER_PEER[$X,$Y]} ${CARRIER_ROUTER_NETS[$X]} $ADDRESS 24 | ||
145 | done | ||
146 | } | ||
147 | |||
148 | configure_carriers () | ||
149 | { | ||
150 | X=$1 | ||
151 | |||
152 | SETUP_PROGRAMMS=$($cmd-s CARRIER-$X -o SETUP_PROGRAMMS$option"$filename") | ||
153 | if [ -n "$SETUP_PROGRAMMS" ] | ||
154 | then | ||
155 | CARRIER_SETUP_PROGRAMMS[$X]=$SETUP_PROGRAMMS | ||
156 | else | ||
157 | CARRIER_SETUP_PROGRAMMS[$X]=$CARRIER_SETUP_PROGRAMMS[0] | ||
158 | fi | ||
159 | SUBNET=$($cmd-s CARRIER-$X -o SUBNET$option"$filename") | ||
160 | if [ -n "$SUBNET" ] | ||
161 | then | ||
162 | SUBNET[$X]=$SUBNET | ||
163 | else | ||
164 | SUBNET[$X]=$DEFAULT_SUBNET | ||
165 | fi | ||
166 | CARRIER_TESTBED_PLUGIN=$($cmd-s CARRIER-$X -o TESTBED_PLUGIN$option"$filename") | ||
167 | if [ -n "$CARRIER_TESTBED_PLUGIN" ] | ||
168 | then | ||
169 | CARRIER_TESTBED_PLUGIN[$X]=$CARRIER_TESTBED_PLUGIN | ||
170 | else | ||
171 | CARRIER_TESTBED_PLUGIN[$X]=$DEFAULT_TESTBED_PLUGIN | ||
172 | fi | ||
173 | CARRIER_PEERS=$($cmd-s CARRIER-$X -o CARRIER_PEERS$option"$filename") | ||
174 | if [ -n "$CARRIER_PEERS" ] | ||
175 | then | ||
176 | CARRIER_PEERS[$X]=$CARRIER_PEERS | ||
177 | else | ||
178 | CARRIER_PEERS[$X]=$DEFAULT_CARRIER_PEERS | ||
179 | fi | ||
180 | CARRIER_SUBNETS=$($cmd-s CARRIER-$X -o SUBNETS$option"$filename") | ||
181 | if [ -n "$CARRIER_SUBNETS" ] | ||
182 | then | ||
183 | CARRIER_SUBNETS[$X]=$CARRIER_SUBNETS | ||
184 | else | ||
185 | CARRIER_SUBNETS[$X]=$DEFAULT_SUBNETS | ||
186 | fi | ||
187 | # FIXME configure backbone peers | ||
188 | |||
189 | echo gaga 2 | ||
190 | ADDRESS=${INET/X/$TOTAL_NODES} | ||
191 | netjail_node | ||
192 | CARRIER_ROUTERS[$X]=$RESULT | ||
193 | netjail_node_link_bridge ${CARRIER_ROUTERS[$X]} $NETWORK_NET $ADDRESS 16 | ||
194 | netjail_bridge | ||
195 | CARRIER_ROUTER_NETS[$X]=$RESULT | ||
196 | |||
197 | configure_carrier_peer $X | ||
198 | configure_carrier_subnet $X | ||
199 | |||
200 | echo gaga 7 ${CARRIER_PEERS[$X]} | ||
201 | |||
202 | ROUTER_ADDRESS=${CARRIER_NET/X/$X} | ||
203 | ROUTER_ADDRESS=${ROUTER_ADDRESS/Y/$((${SUBNET_NODE_NUMBER[$X]}+1))} | ||
204 | ROUTER_ADDRESS=${ROUTER_ADDRESS/Z/0} | ||
205 | netjail_node_link_bridge ${CARRIER_ROUTERS[$X]} ${CARRIER_ROUTER_NETS[$X]} $ROUTER_ADDRESS 24 | ||
206 | for Y in $(seq ${CARRIER_PEERS[$X]}); do | ||
207 | netjail_node_add_default ${CARRIER_PEER[$X,$Y]} $ROUTER_ADDRESS | ||
208 | done | ||
209 | echo gaga 7.5 | ||
210 | for Y in $(seq ${CARRIER_SUBNETS[$X]}); do | ||
211 | netjail_node_add_default ${SUBNET_ROUTERS[$X,$Y]} $ROUTER_ADDRESS | ||
212 | done | ||
213 | echo gaga 8 | ||
214 | } | ||
215 | |||
216 | DEFAULT_SUBNET=10.X.0.0 | ||
217 | DEFAULT_CARRIER_SUBNET=10.X.Y.0 | ||
218 | |||
219 | INET=192.168.1.X | ||
220 | CARRIER_NET=10.X.Y.Z | ||
221 | |||
222 | |||
223 | CARRIER_SETUP_PROGRAMMS[0]=$($cmd-s DEFAULTs -o CARRIER_SETUP_PROGRAMMS$option"$filename") | ||
224 | SUBNET_SETUP_PROGRAMMS=$($cmd-s DEFAULTs -o SUBNET_SETUP_PROGRAMMS$option"$filename") | ||
225 | PEER_SETUP_PROGRAMMS[0]=$($cmd-s DEFAULTs -o PEER_SETUP_PROGRAMMS$option"$filename") | ||
226 | DEFAULT_SUBNETS=$($cmd-s DEFAULTs -o SUBNETS$option"$filename") | ||
227 | DEFAULT_TESTBED_PLUGIN=$($cmd-s DEFAULTs -o TESTBED_PLUGIN$option"$filename") | ||
228 | DEFAULT_CARRIER_PEERS=$($cmd-s DEFAULTs -o CARRIER_PEERS$option"$filename") | ||
229 | DEFAULT_SUBNET_PEERS=$($cmd-s DEFAULTs -o SUBNET_PEERS$option"$filename") | ||
230 | BACKBONE_PEERS=$($cmd-s BACKBONE -o BACKBONE_PEERS$option"$filename") | ||
231 | CARRIERS=$($cmd-s BACKBONE -o CARRIERS$option"$filename") | ||
232 | |||
233 | TOTAL_NODES=0 | ||
234 | |||
235 | netjail_bridge | ||
236 | NETWORK_NET=$RESULT | ||
237 | |||
238 | echo gaga 1 $BACKBONE_PEERS | ||
239 | |||
240 | for X in $(seq $BACKBONE_PEERS); do | ||
241 | echo gaga 1.1 | ||
242 | TOTAL_NODES=$(($TOTAL_NODES+1)) | ||
243 | BACKBONE_PEER_TESTBED_PLUGIN=$($cmd-s BACKBONE-PEER-$X -o TESTBED_PLUGIN$option"$filename") | ||
244 | if [ -n "$BACKBONE_PEER_TESTBED_PLUGIN" ] | ||
245 | then | ||
246 | BACKBONE_PEER_TESTBED_PLUGIN[$X]=$BACKBONE_PEER_TESTBED_PLUGIN | ||
247 | else | ||
248 | BACKBONE_PEER_TESTBED_PLUGIN[$X]=$DEFAULT_TESTBED_PLUGIN | ||
249 | fi | ||
250 | # FIXME configure backbone peers | ||
251 | |||
252 | echo gaga 0 $BACKBONE_PEER_TESTBED_PLUGIN | ||
253 | netjail_node | ||
254 | BB_PEERS[$X]=$RESULT | ||
255 | ADDRESS=${INET/X/$TOTAL_NODES} | ||
256 | netjail_node_link_bridge ${BB_PEERS[$X]} $NETWORK_NET $ADDRESS 16 | ||
257 | done | ||
258 | |||
259 | IPT=iptables-nft | ||
260 | |||
261 | for X in $(seq $CARRIERS); do | ||
262 | TOTAL_NODES=$(($TOTAL_NODES+1)) | ||
263 | configure_carriers $X | ||
264 | done | ||
265 | |||
266 | |||
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 | |||
8 | export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | 8 | export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
9 | 9 | ||
10 | filename=$1 | 10 | filename=$1 |
11 | PREFIX=$2 | 11 | PREFIX=$PPID |
12 | readfile=$3 | 12 | readfile=$3 |
13 | 13 | ||
14 | if [ $readfile -eq 0 ] | 14 | if [ $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 | ||
2 | if ! [ -d "/run/netns" ]; | ||
3 | then | ||
4 | echo "You have to create the directory '/run/netns'." | ||
5 | exit 77 | ||
6 | fi | ||
7 | if [ -f /proc/sys/kernel/unprivileged_userns_clone ]; | ||
8 | then | ||
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 | ||
14 | else | ||
15 | echo -e "Error during test setup: The kernel lacks the parameter 'kernel.unprivileged_userns_clone'\n" | ||
16 | exit 77 | ||
17 | fi | ||
18 | exec 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 d351a2f7f..00b08eefc 100644 --- a/src/cli/core/gnunet-core.c +++ b/src/cli/core/gnunet-core.c | |||
@@ -204,14 +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 | } |
210 | if (! show_pid && ! show_conns && ! monitor_connections) | 211 | if (! show_pid && ! show_conns && ! monitor_connections) |
211 | { | 212 | { |
212 | fprintf (stderr, "%s", _ ("No argument given.\n")); | 213 | fprintf (stderr, "%s", _ ("No argument given.\n")); |
214 | GNUNET_free (keyfile); | ||
213 | return; | 215 | return; |
214 | } | 216 | } |
217 | GNUNET_free (keyfile); | ||
215 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | 218 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
216 | } | 219 | } |
217 | 220 | ||
diff --git a/src/cli/gns/test_dns2gns.sh b/src/cli/gns/test_dns2gns.sh index a6024ca3c..a5657a719 100755 --- a/src/cli/gns/test_dns2gns.sh +++ b/src/cli/gns/test_dns2gns.sh | |||
@@ -8,7 +8,7 @@ if [ -z $LOCATION ] | |||
8 | then | 8 | then |
9 | LOCATION="gnunet-config" | 9 | LOCATION="gnunet-config" |
10 | fi | 10 | fi |
11 | $LOCATION --version 1> /dev/null | 11 | $LOCATION --list-sections 1> /dev/null |
12 | if test $? != 0 | 12 | if test $? != 0 |
13 | then | 13 | then |
14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_at_lookup.sh b/src/cli/gns/test_gns_at_lookup.sh index 6a2c958de..b10ecfd18 100755 --- a/src/cli/gns/test_gns_at_lookup.sh +++ b/src/cli/gns/test_gns_at_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_box_sbox.sh b/src/cli/gns/test_gns_box_sbox.sh index d7e95912e..062194091 100755 --- a/src/cli/gns/test_gns_box_sbox.sh +++ b/src/cli/gns/test_gns_box_sbox.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_caa_lookup.sh b/src/cli/gns/test_gns_caa_lookup.sh index fb488f47b..5740caf4c 100755 --- a/src/cli/gns/test_gns_caa_lookup.sh +++ b/src/cli/gns/test_gns_caa_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_config_lookup.sh b/src/cli/gns/test_gns_config_lookup.sh index bda08f87b..4b01ddbd8 100755 --- a/src/cli/gns/test_gns_config_lookup.sh +++ b/src/cli/gns/test_gns_config_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_delegated_lookup.sh b/src/cli/gns/test_gns_delegated_lookup.sh index 5105abdb5..b90d2d750 100755 --- a/src/cli/gns/test_gns_delegated_lookup.sh +++ b/src/cli/gns/test_gns_delegated_lookup.sh | |||
@@ -8,7 +8,7 @@ if [ -z $LOCATION ] | |||
8 | then | 8 | then |
9 | LOCATION="gnunet-config" | 9 | LOCATION="gnunet-config" |
10 | fi | 10 | fi |
11 | $LOCATION --version 1> /dev/null | 11 | $LOCATION --list-sections 1> /dev/null |
12 | if test $? != 0 | 12 | if test $? != 0 |
13 | then | 13 | then |
14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_dht_lookup.sh b/src/cli/gns/test_gns_dht_lookup.sh index da87d8477..bd342fff7 100755 --- a/src/cli/gns/test_gns_dht_lookup.sh +++ b/src/cli/gns/test_gns_dht_lookup.sh | |||
@@ -8,7 +8,7 @@ if [ -z $LOCATION ] | |||
8 | then | 8 | then |
9 | LOCATION="gnunet-config" | 9 | LOCATION="gnunet-config" |
10 | fi | 10 | fi |
11 | $LOCATION --version 1> /dev/null | 11 | $LOCATION --list-sections 1> /dev/null |
12 | if test $? != 0 | 12 | if test $? != 0 |
13 | then | 13 | then |
14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_gns2dns_cname_lookup.sh b/src/cli/gns/test_gns_gns2dns_cname_lookup.sh index c33c9d132..885c9991a 100755 --- a/src/cli/gns/test_gns_gns2dns_cname_lookup.sh +++ b/src/cli/gns/test_gns_gns2dns_cname_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_gns2dns_lookup.sh b/src/cli/gns/test_gns_gns2dns_lookup.sh index 43a4756d3..4e2801432 100755 --- a/src/cli/gns/test_gns_gns2dns_lookup.sh +++ b/src/cli/gns/test_gns_gns2dns_lookup.sh | |||
@@ -6,7 +6,7 @@ if [ -z $LOCATION ] | |||
6 | then | 6 | then |
7 | LOCATION="gnunet-config" | 7 | LOCATION="gnunet-config" |
8 | fi | 8 | fi |
9 | $LOCATION --version 1> /dev/null | 9 | $LOCATION --list-sections 1> /dev/null |
10 | if test $? != 0 | 10 | if test $? != 0 |
11 | then | 11 | then |
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_gns2dns_zkey_lookup.sh b/src/cli/gns/test_gns_gns2dns_zkey_lookup.sh index 03549314e..e497815a7 100755 --- a/src/cli/gns/test_gns_gns2dns_zkey_lookup.sh +++ b/src/cli/gns/test_gns_gns2dns_zkey_lookup.sh | |||
@@ -6,7 +6,7 @@ if [ -z $LOCATION ] | |||
6 | then | 6 | then |
7 | LOCATION="gnunet-config" | 7 | LOCATION="gnunet-config" |
8 | fi | 8 | fi |
9 | $LOCATION --version 1> /dev/null | 9 | $LOCATION --list-sections 1> /dev/null |
10 | if test $? != 0 | 10 | if test $? != 0 |
11 | then | 11 | then |
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_ipv6_lookup.sh b/src/cli/gns/test_gns_ipv6_lookup.sh index 31e662f68..1b4849b32 100755 --- a/src/cli/gns/test_gns_ipv6_lookup.sh +++ b/src/cli/gns/test_gns_ipv6_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_lightest.sh b/src/cli/gns/test_gns_lightest.sh index 2d2203e66..dff5db225 100755 --- a/src/cli/gns/test_gns_lightest.sh +++ b/src/cli/gns/test_gns_lightest.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_lookup.sh b/src/cli/gns/test_gns_lookup.sh index 92dfae28b..5cdd7791f 100755 --- a/src/cli/gns/test_gns_lookup.sh +++ b/src/cli/gns/test_gns_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_multiple_record_lookup.sh b/src/cli/gns/test_gns_multiple_record_lookup.sh index 52a487329..958f85cd4 100755 --- a/src/cli/gns/test_gns_multiple_record_lookup.sh +++ b/src/cli/gns/test_gns_multiple_record_lookup.sh | |||
@@ -13,7 +13,7 @@ if [ -z $LOCATION ] | |||
13 | then | 13 | then |
14 | LOCATION="gnunet-config" | 14 | LOCATION="gnunet-config" |
15 | fi | 15 | fi |
16 | $LOCATION --version 1> /dev/null | 16 | $LOCATION --list-sections 1> /dev/null |
17 | if test $? != 0 | 17 | if test $? != 0 |
18 | then | 18 | then |
19 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 19 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_mx_lookup.sh b/src/cli/gns/test_gns_mx_lookup.sh index 6f2b8192d..d13bbcba7 100755 --- a/src/cli/gns/test_gns_mx_lookup.sh +++ b/src/cli/gns/test_gns_mx_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_quickupdate.sh b/src/cli/gns/test_gns_quickupdate.sh index eac69103d..e3877b6f0 100755 --- a/src/cli/gns/test_gns_quickupdate.sh +++ b/src/cli/gns/test_gns_quickupdate.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_redirect_lookup.sh b/src/cli/gns/test_gns_redirect_lookup.sh index 90729713d..d07406511 100755 --- a/src/cli/gns/test_gns_redirect_lookup.sh +++ b/src/cli/gns/test_gns_redirect_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_rel_expiration.sh b/src/cli/gns/test_gns_rel_expiration.sh index a240cfd0f..01a61bcb3 100755 --- a/src/cli/gns/test_gns_rel_expiration.sh +++ b/src/cli/gns/test_gns_rel_expiration.sh | |||
@@ -14,7 +14,7 @@ then | |||
14 | exit 77 | 14 | exit 77 |
15 | fi | 15 | fi |
16 | 16 | ||
17 | $LOCATION --version 1> /dev/null | 17 | $LOCATION --list-sections 1> /dev/null |
18 | if test $? != 0 | 18 | if test $? != 0 |
19 | then | 19 | then |
20 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 20 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_revocation.sh b/src/cli/gns/test_gns_revocation.sh index 2253adcb4..f3c9b3d8c 100755 --- a/src/cli/gns/test_gns_revocation.sh +++ b/src/cli/gns/test_gns_revocation.sh | |||
@@ -8,7 +8,7 @@ if [ -z $LOCATION ] | |||
8 | then | 8 | then |
9 | LOCATION="gnunet-config" | 9 | LOCATION="gnunet-config" |
10 | fi | 10 | fi |
11 | $LOCATION --version 1> /dev/null | 11 | $LOCATION --list-sections 1> /dev/null |
12 | if test $? != 0 | 12 | if test $? != 0 |
13 | then | 13 | then |
14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_sbox.sh b/src/cli/gns/test_gns_sbox.sh index 6918bf130..313590587 100755 --- a/src/cli/gns/test_gns_sbox.sh +++ b/src/cli/gns/test_gns_sbox.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_sbox_simple.sh b/src/cli/gns/test_gns_sbox_simple.sh index f0d31e471..e29a00be1 100755 --- a/src/cli/gns/test_gns_sbox_simple.sh +++ b/src/cli/gns/test_gns_sbox_simple.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_soa_lookup.sh b/src/cli/gns/test_gns_soa_lookup.sh index a697782bb..cd358cc32 100755 --- a/src/cli/gns/test_gns_soa_lookup.sh +++ b/src/cli/gns/test_gns_soa_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_txt_lookup.sh b/src/cli/gns/test_gns_txt_lookup.sh index 4e36e8ad8..038ee596b 100755 --- a/src/cli/gns/test_gns_txt_lookup.sh +++ b/src/cli/gns/test_gns_txt_lookup.sh | |||
@@ -7,7 +7,7 @@ if [ -z $LOCATION ] | |||
7 | then | 7 | then |
8 | LOCATION="gnunet-config" | 8 | LOCATION="gnunet-config" |
9 | fi | 9 | fi |
10 | $LOCATION --version 1> /dev/null | 10 | $LOCATION --list-sections 1> /dev/null |
11 | if test $? != 0 | 11 | if test $? != 0 |
12 | then | 12 | then |
13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 13 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/gns/test_gns_zkey_lookup.sh b/src/cli/gns/test_gns_zkey_lookup.sh index 3d4aefc7c..d7cc1a475 100755 --- a/src/cli/gns/test_gns_zkey_lookup.sh +++ b/src/cli/gns/test_gns_zkey_lookup.sh | |||
@@ -8,7 +8,7 @@ if [ -z $LOCATION ] | |||
8 | then | 8 | then |
9 | LOCATION="gnunet-config" | 9 | LOCATION="gnunet-config" |
10 | fi | 10 | fi |
11 | $LOCATION --version 1> /dev/null | 11 | $LOCATION --list-sections 1> /dev/null |
12 | if test $? != 0 | 12 | if test $? != 0 |
13 | then | 13 | then |
14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | 14 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" |
diff --git a/src/cli/reclaim/test_reclaim.conf b/src/cli/reclaim/test_reclaim.conf index 83a5c30d9..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] |
10 | START_ON_DEMAND = YES | 10 | START_ON_DEMAND = YES |
11 | PREFIX = 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 |
12 | BASIC_AUTH_ENABLED = NO | ||
12 | 13 | ||
13 | [transport] | 14 | [transport] |
14 | PLUGINS = | 15 | PLUGINS = |
@@ -34,6 +35,10 @@ ZONE_PUBLISH_TIME_WINDOW = 1 h | |||
34 | DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0 | 35 | DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0 |
35 | 36 | ||
36 | [reclaim-rest-plugin] | 37 | [reclaim-rest-plugin] |
37 | address = http://localhost:8000/#/login | ||
38 | psw = mysupersecretpassword | ||
39 | expiration_time = 3600 | 38 | expiration_time = 3600 |
39 | JWT_SECRET = secret | ||
40 | OIDC_USERINFO_CONSUME_TIMEOUT = 5s | ||
41 | OIDC_DIR = $GNUNET_DATA_HOME/oidc | ||
42 | OIDC_CLIENT_HMAC_SECRET = secret | ||
43 | OIDC_JSON_WEB_ALGORITHM = RS256 | ||
44 | ADDRESS = https://ui.reclaim/#/login | ||
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 | ||
2 | trap "gnunet-arm -e -c test_reclaim.conf" SIGINT | ||
3 | |||
4 | LOCATION=$(which gnunet-config) | ||
5 | if [ -z $LOCATION ] | ||
6 | then | ||
7 | LOCATION="gnunet-config" | ||
8 | fi | ||
9 | $LOCATION --version 1>/dev/null | ||
10 | if test $? != 0 | ||
11 | then | ||
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
13 | exit 77 | ||
14 | fi | ||
15 | |||
16 | rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f` | ||
17 | |||
18 | which timeout >/dev/null 2>&1 && DO_TIMEOUT="timeout 30" | ||
19 | |||
20 | RES=0 | ||
21 | TEST_ATTR="test" | ||
22 | REDIRECT_URI="https://example.gns.alt/my_cb" | ||
23 | SCOPE="\"openid email name\"" | ||
24 | gnunet-arm -s -c test_reclaim.conf | ||
25 | gnunet-arm -i rest -c test_reclaim.conf | ||
26 | gnunet-arm -I | ||
27 | gnunet-identity -C testego -c test_reclaim.conf | ||
28 | gnunet-identity -C rpego -c test_reclaim.conf | ||
29 | TEST_KEY=$(gnunet-identity -d -e rpego -q -c test_reclaim.conf) | ||
30 | SUBJECT_KEY=$(gnunet-identity -d -e testego -q -c test_reclaim.conf) | ||
31 | gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf | ||
32 | gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf | ||
33 | |||
34 | # Register client | ||
35 | gnunet-namestore -z rpego -a -n @ -t RECLAIM_OIDC_CLIENT -V "My RP" -e 1d -p -c test_reclaim.conf | ||
36 | gnunet-namestore -z rpego -a -n @ -t RECLAIM_OIDC_REDIRECT -V $REDIRECT_URI -e 1d -p -c test_reclaim.conf | ||
37 | |||
38 | gnunet-gns -u @.$TEST_KEY -t RECLAIM_OIDC_REDIRECT -c test_reclaim.conf | ||
39 | curl -v -X POST -H -v "http://localhost:7776/openid/login" --data "{\"identity\": \"$SUBJECT_KEY\"}" | ||
40 | |||
41 | PKCE_CHALLENGE=$(echo -n secret | openssl dgst -binary -sha256 | openssl base64 | sed 's/\=//g' | sed 's/+/-/g' | sed 's/\//_/g') | ||
42 | |||
43 | CODE=$(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 | |||
46 | echo "Code: $CODE" | ||
47 | |||
48 | curl -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 | |||
50 | gnunet-identity -D testego -c test_reclaim.conf | ||
51 | gnunet-identity -D rpego -c test_reclaim.conf | ||
52 | gnunet-arm -e -c test_reclaim.conf | ||
53 | if test $RES != 0 | ||
54 | then | ||
55 | echo "Failed." | ||
56 | fi | ||
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 | */ |
36 | static char *backend_check; | 36 | static 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 | */ |
47 | static int is_experimental; | 46 | static int is_experimental; |
48 | 47 | ||
48 | /** | ||
49 | * Do not load default configuration | ||
50 | */ | ||
51 | static int no_defaults; | ||
52 | |||
53 | /** | ||
54 | * Parse configuration from this memory. | ||
55 | */ | ||
56 | static 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 | */ |
53 | static int libs; | 61 | static 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 | */ | ||
74 | static void | ||
75 | run (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 | ||
83 | check_PROGRAMS = \ | 83 | #check_PROGRAMS = \ |
84 | test_consensus_api | 84 | # test_consensus_api |
85 | 85 | ||
86 | if ENABLE_TEST_RUN | 86 | if 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/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? |
50 | if false | ||
50 | 51 | ||
51 | testconsensusapi = executable ('test_consensus_api', | 52 | testconsensusapi = executable ('test_consensus_api', |
52 | ['test_consensus_api.c'], | 53 | ['test_consensus_api.c'], |
@@ -64,3 +65,5 @@ configure_file(input : 'test_consensus.conf', | |||
64 | test('test_consensus_api', testconsensusapi, | 65 | test('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 | |||
69 | endif \ 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 = \ | |||
22 | libexec_PROGRAMS = \ | 22 | libexec_PROGRAMS = \ |
23 | gnunet-service-conversation | 23 | gnunet-service-conversation |
24 | 24 | ||
25 | check_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 | ||
30 | pkgcfg_DATA = conversation.conf | 30 | pkgcfg_DATA = conversation.conf |
31 | endif | 31 | endif |
@@ -83,17 +83,17 @@ libgnunetconversation_la_LDFLAGS = \ | |||
83 | if BUILD_PULSE_HELPERS | 83 | if BUILD_PULSE_HELPERS |
84 | AUDIO_HELPER_RECD=gnunet-helper-audio-record | 84 | AUDIO_HELPER_RECD=gnunet-helper-audio-record |
85 | AUDIO_HELPER_PLAY=gnunet-helper-audio-playback | 85 | AUDIO_HELPER_PLAY=gnunet-helper-audio-playback |
86 | AUDIO_TESTS=$(check_PROGRAMS) | 86 | #AUDIO_TESTS=$(check_PROGRAMS) |
87 | else | 87 | else |
88 | if BUILD_GST_HELPERS | 88 | if BUILD_GST_HELPERS |
89 | AUDIO_HELPER_RECD=gnunet-helper-audio-record | 89 | AUDIO_HELPER_RECD=gnunet-helper-audio-record |
90 | AUDIO_HELPER_PLAY=gnunet-helper-audio-playback | 90 | AUDIO_HELPER_PLAY=gnunet-helper-audio-playback |
91 | AUDIO_TESTS=$(check_PROGRAMS) | 91 | #AUDIO_TESTS=$(check_PROGRAMS) |
92 | else | 92 | else |
93 | if BUILD_EXPERIMENTAL_HELPERS | 93 | if BUILD_EXPERIMENTAL_HELPERS |
94 | AUDIO_HELPER_RECD=gnunet-helper-audio-record | 94 | AUDIO_HELPER_RECD=gnunet-helper-audio-record |
95 | AUDIO_HELPER_PLAY=gnunet-helper-audio-playback | 95 | AUDIO_HELPER_PLAY=gnunet-helper-audio-playback |
96 | AUDIO_TESTS=$(check_PROGRAMS) | 96 | #AUDIO_TESTS=$(check_PROGRAMS) |
97 | endif | 97 | endif |
98 | endif | 98 | endif |
99 | endif | 99 | endif |
@@ -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 | ||
122 | gnunet_helper_audio_playback_SOURCES = \ | 122 | gnunet_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 | # |
130 | else | 130 | else |
131 | if BUILD_GST_HELPERS | 131 | if BUILD_GST_HELPERS |
132 | gnunet_helper_audio_record_SOURCES = \ | 132 | gnunet_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 | ||
193 | gnunet_conversation_SOURCES = \ | 193 | gnunet_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 | ||
208 | gnunet_conversation_test_SOURCES = \ | 208 | gnunet_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 | ||
219 | test_conversation_api_SOURCES = \ | 219 | test_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 | ||
148 | if false | ||
149 | |||
148 | testconvapi = executable ('test_conversation_api', | 150 | testconvapi = 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 | |||
201 | test('test_conversation_api_reject', testconvapireject, workdir: meson.current_build_dir(), | 203 | test('test_conversation_api_reject', testconvapireject, workdir: meson.current_build_dir(), |
202 | suite: ['conversation', 'contrib']) | 204 | suite: ['conversation', 'contrib']) |
203 | 205 | ||
206 | endif \ No newline at end of file | ||
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 8f39faab6..ea8bae62f 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 \ |
@@ -81,7 +80,6 @@ gnunetinclude_HEADERS = \ | |||
81 | gnunet_network_lib.h \ | 80 | gnunet_network_lib.h \ |
82 | gnunet_nse_service.h \ | 81 | gnunet_nse_service.h \ |
83 | gnunet_nt_lib.h \ | 82 | gnunet_nt_lib.h \ |
84 | gnunet_op_lib.h \ | ||
85 | gnunet_os_lib.h \ | 83 | gnunet_os_lib.h \ |
86 | gnunet_peer_lib.h \ | 84 | gnunet_peer_lib.h \ |
87 | gnunet_peerstore_plugin.h \ | 85 | gnunet_peerstore_plugin.h \ |
@@ -110,18 +108,17 @@ gnunetinclude_HEADERS = \ | |||
110 | gnunet_sq_lib.h \ | 108 | gnunet_sq_lib.h \ |
111 | gnunet_statistics_service.h \ | 109 | gnunet_statistics_service.h \ |
112 | gnunet_strings_lib.h \ | 110 | gnunet_strings_lib.h \ |
113 | gnunet_testing_barrier.h \ | ||
114 | gnunet_testing_lib.h \ | 111 | gnunet_testing_lib.h \ |
115 | gnunet_testing_plugin.h \ | 112 | gnunet_testing_arm_lib.h \ |
116 | gnunet_testing_ng_lib.h \ | 113 | gnunet_testing_core_lib.h \ |
117 | gnunet_testing_loop_lib.h \ | 114 | gnunet_testing_testbed_lib.h \ |
118 | gnunet_testing_netjail_lib.h \ | 115 | gnunet_testing_transport_lib.h \ |
116 | gnunet_testbed_lib.h \ | ||
119 | gnunet_time_lib.h \ | 117 | gnunet_time_lib.h \ |
120 | gnunet_transport_application_service.h \ | 118 | gnunet_transport_application_service.h \ |
121 | gnunet_transport_communication_service.h \ | 119 | gnunet_transport_communication_service.h \ |
122 | gnunet_transport_monitor_service.h \ | 120 | gnunet_transport_monitor_service.h \ |
123 | gnunet_transport_core_service.h \ | 121 | gnunet_transport_core_service.h \ |
124 | gnunet_transport_testing_ng_lib.h \ | ||
125 | gnunet_tun_lib.h \ | 122 | gnunet_tun_lib.h \ |
126 | gnunet_uri_lib.h \ | 123 | gnunet_uri_lib.h \ |
127 | gnunet_util_lib.h \ | 124 | gnunet_util_lib.h \ |
diff --git a/src/include/gettext.h b/src/include/gettext.h index 6e98f197a..d62a3db7d 100644 --- a/src/include/gettext.h +++ b/src/include/gettext.h | |||
@@ -20,6 +20,10 @@ | |||
20 | #define _LIBGETTEXT_H 1 | 20 | #define _LIBGETTEXT_H 1 |
21 | 21 | ||
22 | /* NLS can be disabled through the configure --disable-nls option. */ | 22 | /* NLS can be disabled through the configure --disable-nls option. */ |
23 | #ifndef ENABLE_NLS | ||
24 | #define ENABLE_NLS 0 | ||
25 | #endif | ||
26 | |||
23 | #if ENABLE_NLS | 27 | #if ENABLE_NLS |
24 | 28 | ||
25 | /* Get declarations of GNU message catalog functions. */ | 29 | /* Get declarations of GNU message catalog functions. */ |
@@ -47,11 +51,11 @@ | |||
47 | #define dgettext(Domainname, Msgid) ((const char *) (Msgid)) | 51 | #define dgettext(Domainname, Msgid) ((const char *) (Msgid)) |
48 | #define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) | 52 | #define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) |
49 | #define ngettext(Msgid1, Msgid2, N) \ | 53 | #define ngettext(Msgid1, Msgid2, N) \ |
50 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) | 54 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) |
51 | #define dngettext(Domainname, Msgid1, Msgid2, N) \ | 55 | #define dngettext(Domainname, Msgid1, Msgid2, N) \ |
52 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) | 56 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) |
53 | #define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ | 57 | #define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ |
54 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) | 58 | ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) |
55 | /* slight modification here to avoid warnings: generate GNUNET_NO code, | 59 | /* slight modification here to avoid warnings: generate GNUNET_NO code, |
56 | not even the cast... */ | 60 | not even the cast... */ |
57 | #define textdomain(Domainname) | 61 | #define textdomain(Domainname) |
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 | */ |
246 | typedef void | 246 | typedef 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 | */ |
261 | typedef void | 262 | typedef 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 | */ |
278 | typedef void | 280 | typedef 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 | */ |
296 | struct GNUNET_ARM_Handle * | 299 | struct GNUNET_ARM_Handle * |
297 | GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 300 | GNUNET_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 | */ |
307 | void | 311 | void |
308 | GNUNET_ARM_disconnect (struct GNUNET_ARM_Handle *h); | 312 | GNUNET_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 | */ |
317 | void | 322 | void |
318 | GNUNET_ARM_operation_cancel (struct GNUNET_ARM_Operation *op); | 323 | GNUNET_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 | */ |
329 | struct GNUNET_ARM_Operation * | 335 | struct GNUNET_ARM_Operation * |
330 | GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, | 336 | GNUNET_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 | */ |
349 | struct GNUNET_ARM_Operation * | 356 | struct GNUNET_ARM_Operation * |
350 | GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, | 357 | GNUNET_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 | */ |
366 | struct GNUNET_ARM_Operation * | 374 | struct GNUNET_ARM_Operation * |
367 | GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, | 375 | GNUNET_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 | */ |
388 | typedef void | 396 | typedef 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 | */ |
406 | struct GNUNET_ARM_MonitorHandle * | 414 | struct GNUNET_ARM_MonitorHandle * |
407 | GNUNET_ARM_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 415 | GNUNET_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 | */ |
417 | void | 426 | void |
418 | GNUNET_ARM_monitor_stop (struct GNUNET_ARM_MonitorHandle *h); | 427 | GNUNET_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 | */ |
491 | void | 495 | void |
492 | GNUNET_log_nocheck (enum GNUNET_ErrorType kind, const char *message, ...) | 496 | GNUNET_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 | */ |
643 | const char * | 650 | const char * |
644 | GNUNET_b2s (const void *buf, | 651 | GNUNET_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 | */ |
678 | enum GNUNET_GenericReturnValue | 685 | enum GNUNET_GenericReturnValue |
679 | GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile); | 686 | GNUNET_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 | */ |
692 | void | 701 | void |
693 | GNUNET_logger_add (GNUNET_Logger logger, void *logger_cls); | 702 | GNUNET_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 | */ |
703 | void | 713 | void |
704 | GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls); | 714 | GNUNET_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 | */ |
1263 | enum GNUNET_GenericReturnValue | 1283 | bool |
1264 | GNUNET_is_zero_ (const void *a, | 1284 | GNUNET_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 | */ |
1581 | void * | 1605 | void * |
1582 | GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber); | 1606 | GNUNET_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 | */ |
1661 | void * | 1687 | void * |
1662 | GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber); | 1688 | GNUNET_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 | */ |
1669 | void * | 1697 | void * |
1670 | GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber); | 1698 | GNUNET_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 | */ |
1682 | void | 1713 | void |
1683 | GNUNET_xfree_ (void *ptr, const char *filename, int linenumber); | 1714 | GNUNET_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 | */ |
1693 | char * | 1726 | char * |
1694 | GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber); | 1727 | GNUNET_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 | */ |
68 | struct GNUNET_CONFIGURATION_Handle * | 68 | struct GNUNET_CONFIGURATION_Handle * |
69 | GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg); | 69 | GNUNET_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 | */ |
77 | void | 78 | void |
78 | GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg); | 79 | GNUNET_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 | */ |
90 | enum GNUNET_GenericReturnValue | 92 | enum GNUNET_GenericReturnValue |
91 | GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, | 93 | GNUNET_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 | */ |
103 | enum GNUNET_GenericReturnValue | 106 | enum GNUNET_GenericReturnValue |
104 | GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, | 107 | GNUNET_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 | */ |
140 | enum GNUNET_GenericReturnValue | 144 | enum GNUNET_GenericReturnValue |
141 | GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | 145 | GNUNET_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 | */ |
153 | char * | 158 | char * |
154 | GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | 159 | GNUNET_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 * | |||
168 | GNUNET_CONFIGURATION_serialize_diagnostics ( | 174 | GNUNET_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 | */ |
181 | enum GNUNET_GenericReturnValue | 188 | enum GNUNET_GenericReturnValue |
182 | GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | 189 | GNUNET_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 | */ |
195 | enum GNUNET_GenericReturnValue | 203 | enum GNUNET_GenericReturnValue |
196 | GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, | 204 | GNUNET_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 | */ |
235 | enum GNUNET_GenericReturnValue | 244 | enum GNUNET_GenericReturnValue |
236 | GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); | 245 | GNUNET_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 | */ |
246 | typedef enum GNUNET_GenericReturnValue | 256 | typedef 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 | */ |
262 | enum GNUNET_GenericReturnValue | 273 | enum GNUNET_GenericReturnValue |
263 | GNUNET_CONFIGURATION_parse_and_run (const char *filename, | 274 | GNUNET_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 | */ |
311 | void | 323 | void |
312 | GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, | 324 | GNUNET_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 | */ |
337 | void | 350 | void |
338 | GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg, | 351 | GNUNET_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 | */ |
598 | void | 612 | void |
599 | GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg, | 613 | GNUNET_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 50937324d..b74bbcd1e 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -1736,6 +1736,15 @@ GNUNET_CRYPTO_edx25519_key_clear (struct GNUNET_CRYPTO_Edx25519PrivateKey *pk); | |||
1736 | void | 1736 | void |
1737 | GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk); | 1737 | GNUNET_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 | */ | ||
1745 | void | ||
1746 | GNUNET_CRYPTO_private_key_clear (struct GNUNET_CRYPTO_PrivateKey *pk); | ||
1747 | |||
1739 | 1748 | ||
1740 | /** | 1749 | /** |
1741 | * @ingroup crypto | 1750 | * @ingroup crypto |
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h index 390e8c153..451ddf12b 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 | /** |
@@ -440,15 +440,6 @@ GNUNET_GETOPT_option_verbose (unsigned int *level); | |||
440 | 440 | ||
441 | 441 | ||
442 | /** | 442 | /** |
443 | * Allow user to specify log file name (-l option) | ||
444 | * | ||
445 | * @param[out] logfn set to the name of the logfile | ||
446 | */ | ||
447 | struct GNUNET_GETOPT_CommandLineOption | ||
448 | GNUNET_GETOPT_option_logfile (char **logfn); | ||
449 | |||
450 | |||
451 | /** | ||
452 | * Allow user to specify configuration file name (-c option) | 443 | * Allow user to specify configuration file name (-c option) |
453 | * | 444 | * |
454 | * @param[out] fn set to the name of the configuration file | 445 | * @param[out] fn set to the name of the configuration file |
@@ -481,9 +472,9 @@ GNUNET_GETOPT_option_exclusive (struct GNUNET_GETOPT_CommandLineOption opt); | |||
481 | * Marker for the end of the list of options. | 472 | * Marker for the end of the list of options. |
482 | */ | 473 | */ |
483 | #define GNUNET_GETOPT_OPTION_END \ | 474 | #define GNUNET_GETOPT_OPTION_END \ |
484 | { \ | 475 | { \ |
485 | '\0', NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL \ | 476 | '\0', NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL \ |
486 | } | 477 | } |
487 | 478 | ||
488 | 479 | ||
489 | /** | 480 | /** |
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; | |||
173 | struct GNUNET_HELPER_SendHandle * | 173 | struct GNUNET_HELPER_SendHandle * |
174 | GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, | 174 | GNUNET_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 e9c17eef9..2059e127f 100644 --- a/src/include/gnunet_json_lib.h +++ b/src/include/gnunet_json_lib.h | |||
@@ -441,6 +441,28 @@ GNUNET_JSON_spec_blinded_message (const char *name, | |||
441 | struct GNUNET_CRYPTO_BlindedMessage **msg); | 441 | struct GNUNET_CRYPTO_BlindedMessage **msg); |
442 | 442 | ||
443 | 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 | */ | ||
450 | struct GNUNET_JSON_Specification | ||
451 | GNUNET_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 | */ | ||
461 | struct GNUNET_JSON_Specification | ||
462 | GNUNET_JSON_spec_unblinded_signature (const char *field, | ||
463 | struct GNUNET_CRYPTO_UnblindedSignature **ub_sig); | ||
464 | |||
465 | |||
444 | /* ****************** Generic generator interface ******************* */ | 466 | /* ****************** Generic generator interface ******************* */ |
445 | 467 | ||
446 | 468 | ||
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 | */ |
333 | typedef int | 334 | typedef 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_os_lib.h b/src/include/gnunet_os_lib.h index c1e193720..93296c96b 100644 --- a/src/include/gnunet_os_lib.h +++ b/src/include/gnunet_os_lib.h | |||
@@ -403,6 +403,10 @@ void | |||
403 | GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc, | 403 | GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc, |
404 | void *proc_cls); | 404 | void *proc_cls); |
405 | 405 | ||
406 | #ifndef HAVE_SYSCONF | ||
407 | #define HAVE_SYSCONF 0 | ||
408 | #endif | ||
409 | |||
406 | /** | 410 | /** |
407 | * @brief Get maximum string length returned by gethostname() | 411 | * @brief Get maximum string length returned by gethostname() |
408 | */ | 412 | */ |
@@ -473,12 +477,13 @@ GNUNET_OS_process_get_pid (struct GNUNET_OS_Process *proc); | |||
473 | * @return pointer to process structure of the new process, NULL on error | 477 | * @return pointer to process structure of the new process, NULL on error |
474 | */ | 478 | */ |
475 | struct GNUNET_OS_Process * | 479 | struct GNUNET_OS_Process * |
476 | GNUNET_OS_start_process_vap (enum GNUNET_OS_InheritStdioFlags std_inheritance, | 480 | GNUNET_OS_start_process_vap ( |
477 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | 481 | enum GNUNET_OS_InheritStdioFlags std_inheritance, |
478 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 482 | struct GNUNET_DISK_PipeHandle *pipe_stdin, |
479 | struct GNUNET_DISK_PipeHandle *pipe_stderr, | 483 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
480 | const char *filename, | 484 | struct GNUNET_DISK_PipeHandle *pipe_stderr, |
481 | char *const argv[]); | 485 | const char *filename, |
486 | char *const argv[]); | ||
482 | 487 | ||
483 | 488 | ||
484 | /** | 489 | /** |
@@ -493,11 +498,13 @@ GNUNET_OS_start_process_vap (enum GNUNET_OS_InheritStdioFlags std_inheritance, | |||
493 | * @return pointer to process structure of the new process, NULL on error | 498 | * @return pointer to process structure of the new process, NULL on error |
494 | */ | 499 | */ |
495 | struct GNUNET_OS_Process * | 500 | struct GNUNET_OS_Process * |
496 | GNUNET_OS_start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance, | 501 | GNUNET_OS_start_process ( |
497 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | 502 | enum GNUNET_OS_InheritStdioFlags std_inheritance, |
498 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 503 | struct GNUNET_DISK_PipeHandle *pipe_stdin, |
499 | struct GNUNET_DISK_PipeHandle *pipe_stderr, | 504 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
500 | const char *filename, ...); | 505 | struct GNUNET_DISK_PipeHandle *pipe_stderr, |
506 | const char *filename, | ||
507 | ...); | ||
501 | 508 | ||
502 | 509 | ||
503 | /** | 510 | /** |
@@ -512,11 +519,14 @@ GNUNET_OS_start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance, | |||
512 | * @return pointer to process structure of the new process, NULL on error | 519 | * @return pointer to process structure of the new process, NULL on error |
513 | */ | 520 | */ |
514 | struct GNUNET_OS_Process * | 521 | struct GNUNET_OS_Process * |
515 | GNUNET_OS_start_process_va (enum GNUNET_OS_InheritStdioFlags std_inheritance, | 522 | GNUNET_OS_start_process_va ( |
516 | struct GNUNET_DISK_PipeHandle *pipe_stdin, | 523 | enum GNUNET_OS_InheritStdioFlags std_inheritance, |
517 | struct GNUNET_DISK_PipeHandle *pipe_stdout, | 524 | struct GNUNET_DISK_PipeHandle *pipe_stdin, |
518 | struct GNUNET_DISK_PipeHandle *pipe_stderr, | 525 | struct GNUNET_DISK_PipeHandle *pipe_stdout, |
519 | const char *filename, va_list va); | 526 | struct GNUNET_DISK_PipeHandle *pipe_stderr, |
527 | const char *filename, | ||
528 | va_list va); | ||
529 | |||
520 | 530 | ||
521 | /** | 531 | /** |
522 | * Start a process. | 532 | * Start a process. |
@@ -530,10 +540,11 @@ GNUNET_OS_start_process_va (enum GNUNET_OS_InheritStdioFlags std_inheritance, | |||
530 | * @return pointer to process structure of the new process, NULL on error | 540 | * @return pointer to process structure of the new process, NULL on error |
531 | */ | 541 | */ |
532 | struct GNUNET_OS_Process * | 542 | struct GNUNET_OS_Process * |
533 | GNUNET_OS_start_process_v (enum GNUNET_OS_InheritStdioFlags std_inheritance, | 543 | GNUNET_OS_start_process_v ( |
534 | const int *lsocks, | 544 | enum GNUNET_OS_InheritStdioFlags std_inheritance, |
535 | const char *filename, | 545 | const int *lsocks, |
536 | char *const argv[]); | 546 | const char *filename, |
547 | char *const argv[]); | ||
537 | 548 | ||
538 | 549 | ||
539 | /** | 550 | /** |
@@ -554,9 +565,11 @@ GNUNET_OS_start_process_v (enum GNUNET_OS_InheritStdioFlags std_inheritance, | |||
554 | * @return pointer to process structure of the new process, NULL on error | 565 | * @return pointer to process structure of the new process, NULL on error |
555 | */ | 566 | */ |
556 | struct GNUNET_OS_Process * | 567 | struct GNUNET_OS_Process * |
557 | GNUNET_OS_start_process_s (enum GNUNET_OS_InheritStdioFlags std_inheritance, | 568 | GNUNET_OS_start_process_s ( |
558 | const int *lsocks, | 569 | enum GNUNET_OS_InheritStdioFlags std_inheritance, |
559 | const char *filename, ...); | 570 | const int *lsocks, |
571 | const char *filename, | ||
572 | ...); | ||
560 | 573 | ||
561 | 574 | ||
562 | /** | 575 | /** |
@@ -596,11 +609,12 @@ GNUNET_OS_command_stop (struct GNUNET_OS_CommandHandle *cmd); | |||
596 | * @return NULL on error | 609 | * @return NULL on error |
597 | */ | 610 | */ |
598 | struct GNUNET_OS_CommandHandle * | 611 | struct GNUNET_OS_CommandHandle * |
599 | GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, | 612 | GNUNET_OS_command_run ( |
600 | void *proc_cls, | 613 | GNUNET_OS_LineProcessor proc, |
601 | struct GNUNET_TIME_Relative timeout, | 614 | void *proc_cls, |
602 | const char *binary, | 615 | struct GNUNET_TIME_Relative timeout, |
603 | ...); | 616 | const char *binary, |
617 | ...); | ||
604 | 618 | ||
605 | 619 | ||
606 | /** | 620 | /** |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index 6ab008d16..9fce48386 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -2778,19 +2778,6 @@ extern "C" { | |||
2778 | */ | 2778 | */ |
2779 | #define GNUNET_MESSAGE_TYPE_XDHT_P2P_NOTIFY_SUCCESSOR_CONFIRMATION 892 | 2779 | #define GNUNET_MESSAGE_TYPE_XDHT_P2P_NOTIFY_SUCCESSOR_CONFIRMATION 892 |
2780 | 2780 | ||
2781 | #if ENABLE_MALICIOUS | ||
2782 | /** | ||
2783 | * Turn X-VINE DHT service malicious | ||
2784 | */ | ||
2785 | #define GNUNET_MESSAGE_TYPE_DHT_ACT_MALICIOUS 893 | ||
2786 | |||
2787 | /** | ||
2788 | * Acknowledge receiving ACT MALICIOUS request | ||
2789 | */ | ||
2790 | #define GNUNET_MESSAGE_TYPE_DHT_CLIENT_ACT_MALICIOUS_OK 894 | ||
2791 | |||
2792 | #endif | ||
2793 | |||
2794 | 2781 | ||
2795 | /******************************************************************************* | 2782 | /******************************************************************************* |
2796 | * Whanau DHT messages | 2783 | * Whanau DHT messages |
@@ -2875,6 +2862,10 @@ extern "C" { | |||
2875 | */ | 2862 | */ |
2876 | #define GNUNET_MESSAGE_TYPE_RPS_CS_SEED 954 | 2863 | #define GNUNET_MESSAGE_TYPE_RPS_CS_SEED 954 |
2877 | 2864 | ||
2865 | #ifndef ENABLE_MALICIOUS | ||
2866 | #define ENABLE_MALICIOUS 0 | ||
2867 | #endif | ||
2868 | |||
2878 | #if ENABLE_MALICIOUS | 2869 | #if ENABLE_MALICIOUS |
2879 | /** | 2870 | /** |
2880 | * Turn RPS service malicious | 2871 | * Turn RPS service malicious |
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 | */ | ||
7 | struct 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 | */ | ||
30 | struct GNUNET_TESTBED_System * | ||
31 | GNUNET_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 | */ | ||
59 | struct GNUNET_TESTBED_System * | ||
60 | GNUNET_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 | */ | ||
73 | void | ||
74 | GNUNET_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 | */ | ||
85 | uint16_t | ||
86 | GNUNET_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 | */ | ||
97 | void | ||
98 | GNUNET_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 | */ | ||
122 | enum GNUNET_GenericReturnValue | ||
123 | GNUNET_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 | */ | ||
14 | struct GNUNET_TESTING_Command | ||
15 | GNUNET_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 | */ | ||
28 | struct GNUNET_TESTING_Command | ||
29 | GNUNET_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 | |||
43 | GNUNET_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 | |||
33 | struct 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 | */ | ||
42 | struct 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 | */ | ||
63 | struct 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 | */ | ||
90 | struct GNUNET_TESTING_Command | ||
91 | GNUNET_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 | */ | ||
112 | struct GNUNET_TESTING_Command | ||
113 | GNUNET_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) | |
154 | GNUNET_CORE_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_CORE_TESTING) | ||
155 | 154 | ||
155 | GNUNET_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..95961b640 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 | */ | ||
75 | struct GNUNET_TESTING_Interpreter; | ||
76 | |||
77 | /** | ||
78 | * State each asynchronous command must have in its closure. | ||
79 | */ | ||
80 | struct 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 | 119 | void |
36 | * management or distributed testbed maintenance (those are provided by the | 120 | GNUNET_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 | */ | ||
129 | void | ||
130 | GNUNET_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 | */ |
145 | typedef 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 | */ | ||
157 | typedef 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 | /** |
53 | extern "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 | */ | ||
171 | typedef 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 \ | 189 | struct GNUNET_TESTING_Command |
64 | GNUNET_CRYPTO_EddsaPrivateKey) | 190 | GNUNET_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 | */ |
77 | struct GNUNET_TESTING_System; | 216 | struct 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 | */ |
83 | struct GNUNET_TESTING_Peer; | 229 | void |
230 | GNUNET_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 | */ |
89 | struct GNUNET_TESTING_SharedService | 238 | struct 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 | 350 | const struct GNUNET_TESTING_Command * |
117 | * overridden with the value of the environmental variable | 351 | GNUNET_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 | */ |
129 | struct GNUNET_TESTING_System * | 363 | const struct GNUNET_TESTING_Command * |
130 | GNUNET_TESTING_system_create (const char *testdir, | 364 | GNUNET_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 | */ | ||
161 | struct GNUNET_TESTING_System * | ||
162 | GNUNET_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 | */ |
179 | void | 376 | void |
180 | GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, | 377 | GNUNET_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 | */ | ||
387 | void | ||
388 | GNUNET_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 | */ |
201 | struct GNUNET_CRYPTO_EddsaPrivateKey * | 398 | const char * |
202 | GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, | 399 | GNUNET_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 | */ |
213 | uint16_t | 408 | void |
214 | GNUNET_TESTING_reserve_port (struct GNUNET_TESTING_System *system); | 409 | GNUNET_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 | */ |
224 | void | 419 | void |
225 | GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system, | 420 | GNUNET_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 | */ | ||
430 | typedef 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 | */ |
246 | int | 445 | void |
247 | GNUNET_TESTING_configuration_create (struct GNUNET_TESTING_System *system, | 446 | GNUNET_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 | */ |
266 | struct GNUNET_TESTING_Peer * | 461 | struct GNUNET_TESTING_Command |
267 | GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, | 462 | GNUNET_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 | */ |
280 | void | 475 | struct GNUNET_TESTING_Command |
281 | GNUNET_TESTING_peer_get_identity (struct GNUNET_TESTING_Peer *peer, | 476 | GNUNET_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 | */ | ||
484 | struct 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 | */ |
292 | int | 520 | struct GNUNET_TESTING_Command |
293 | GNUNET_TESTING_peer_start (struct GNUNET_TESTING_Peer *peer); | 521 | GNUNET_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 | */ |
305 | int | 534 | struct GNUNET_TESTING_Command |
306 | GNUNET_TESTING_peer_stop (struct GNUNET_TESTING_Peer *peer); | 535 | GNUNET_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 | */ |
316 | void | 548 | struct GNUNET_TESTING_Command |
317 | GNUNET_TESTING_peer_destroy (struct GNUNET_TESTING_Peer *peer); | 549 | GNUNET_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 | */ |
327 | int | 562 | struct GNUNET_TESTING_Command |
328 | GNUNET_TESTING_peer_kill (struct GNUNET_TESTING_Peer *peer); | 563 | GNUNET_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_new.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 | */ |
338 | int | 580 | struct GNUNET_TESTING_Command |
339 | GNUNET_TESTING_peer_wait (struct GNUNET_TESTING_Peer *peer); | 581 | GNUNET_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 | */ |
350 | typedef void | 596 | struct GNUNET_TESTING_Command |
351 | (*GNUNET_TESTING_PeerStopCallback) (void *cls, | 597 | GNUNET_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 | |||
603 | struct GNUNET_TESTING_Command | ||
604 | GNUNET_TESTING_cmd_load_topology_from_file ( | ||
605 | const char *label, | ||
606 | const char *filename); | ||
607 | |||
608 | |||
609 | struct GNUNET_TESTING_Command | ||
610 | GNUNET_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 | */ |
367 | int | 627 | struct GNUNET_TESTING_Command |
368 | GNUNET_TESTING_peer_stop_async (struct GNUNET_TESTING_Peer *peer, | 628 | GNUNET_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 | */ |
382 | void | 643 | const struct GNUNET_TESTING_Command |
383 | GNUNET_TESTING_peer_stop_async_cancel (struct GNUNET_TESTING_Peer *peer); | 644 | GNUNET_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 | */ | ||
658 | struct GNUNET_TESTING_Command | ||
659 | GNUNET_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 | */ | ||
672 | struct GNUNET_TESTING_Command | ||
673 | GNUNET_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 | */ | ||
683 | const struct GNUNET_TESTING_Command | ||
684 | GNUNET_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 | */ | ||
696 | const struct GNUNET_TESTING_Command | ||
697 | GNUNET_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 | */ | ||
717 | struct GNUNET_TESTING_Command | ||
718 | GNUNET_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 | */ |
394 | typedef void | 732 | typedef 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 | */ |
416 | int | 749 | struct GNUNET_TESTING_Interpreter * |
417 | GNUNET_TESTING_peer_run (const char *testdir, | 750 | GNUNET_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 | */ |
444 | int | 765 | int |
445 | GNUNET_TESTING_service_run (const char *testdir, | 766 | GNUNET_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 | */ | ||
777 | struct GNUNET_TESTING_PluginFunctions; | ||
778 | |||
779 | |||
780 | struct GNUNET_TESTING_PluginFunctions * | ||
781 | GNUNET_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 | */ | ||
813 | struct 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 | */ | ||
839 | struct GNUNET_TESTING_Trait | ||
840 | GNUNET_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 | */ | ||
852 | enum GNUNET_GenericReturnValue | ||
853 | GNUNET_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 | |||
973 | GNUNET_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 | */ | ||
56 | struct GNUNET_TESTING_Interpreter; | ||
57 | |||
58 | /** | ||
59 | * State each asynchronous command must have in its closure. | ||
60 | */ | ||
61 | struct 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 | */ | ||
93 | void | ||
94 | GNUNET_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 | */ | ||
102 | void | ||
103 | GNUNET_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 | */ | ||
113 | typedef 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 | */ | ||
124 | typedef 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 | */ | ||
138 | typedef 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 | */ | ||
155 | struct GNUNET_TESTING_Command | ||
156 | GNUNET_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 | */ | ||
167 | struct 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 | */ | ||
180 | void | ||
181 | GNUNET_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 | */ | ||
188 | struct 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. | ||
305 | const struct GNUNET_TESTING_Command * | ||
306 | GNUNET_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 | */ | ||
318 | const struct GNUNET_TESTING_Command * | ||
319 | GNUNET_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 | */ | ||
333 | const struct GNUNET_TESTING_Command * | ||
334 | GNUNET_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 | */ | ||
344 | void | ||
345 | GNUNET_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 | */ | ||
360 | struct GNUNET_TESTING_Command | ||
361 | GNUNET_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 | */ | ||
375 | const struct GNUNET_TESTING_Command | ||
376 | GNUNET_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 | */ | ||
390 | struct GNUNET_TESTING_Command | ||
391 | GNUNET_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 | */ | ||
404 | typedef 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 | */ | ||
421 | struct GNUNET_TESTING_Interpreter * | ||
422 | GNUNET_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 | */ | ||
438 | int | ||
439 | GNUNET_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 | */ | ||
452 | struct GNUNET_TESTING_Command | ||
453 | GNUNET_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 | */ | ||
466 | struct GNUNET_TESTING_Command | ||
467 | GNUNET_TESTING_cmd_batch (const char *label, | ||
468 | struct GNUNET_TESTING_Command *batch); | ||
469 | |||
470 | |||
471 | /** | ||
472 | * Performance counter. | ||
473 | */ | ||
474 | struct 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 | */ | ||
509 | struct GNUNET_TESTING_Command | ||
510 | GNUNET_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 | */ | ||
524 | struct 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 | */ | ||
550 | struct GNUNET_TESTING_Trait | ||
551 | GNUNET_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 | */ | ||
563 | enum GNUNET_GenericReturnValue | ||
564 | GNUNET_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 | |||
682 | GNUNET_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 | |||
694 | GNUNET_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 | */ | ||
49 | struct GNUNET_TESTING_Command | ||
50 | GNUNET_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 | */ | ||
62 | struct GNUNET_TESTING_Command | ||
63 | GNUNET_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 | */ | ||
76 | const struct GNUNET_TESTING_Command | ||
77 | GNUNET_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 | |||
96 | GNUNET_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 | |||
112 | GNUNET_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 | ||
34 | extern "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 | */ | ||
48 | typedef 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 | */ | ||
55 | typedef 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 | */ | ||
77 | typedef 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 | */ | ||
97 | typedef 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 | */ | ||
108 | typedef 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 | */ | ||
119 | typedef 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 | */ | ||
126 | struct 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 | */ | ||
15 | struct GNUNET_TESTING_Command | ||
16 | GNUNET_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 | */ | ||
26 | struct GNUNET_TESTING_Command | ||
27 | GNUNET_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 | |||
38 | GNUNET_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 | */ |
35 | struct GNUNET_TRANSPORT_ApplicationHandle; | 35 | struct GNUNET_TRANSPORT_ApplicationHandle; |
36 | 36 | ||
37 | /** | ||
38 | * FIXME: what is this? | ||
39 | */ | ||
40 | struct GNUNET_TESTING_StartPeerState; | ||
41 | |||
42 | 37 | ||
43 | // FIXME: breaks naming conventions | 38 | // FIXME: breaks naming conventions |
44 | typedef void * | 39 | typedef 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? |
51 | struct GNUNET_TESTING_StartPeerState | 45 | struct 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) | |
209 | GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_TRANSPORT_TESTING) | 200 | |
201 | |||
202 | GNUNET_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_util_lib.h b/src/include/gnunet_util_lib.h index ee850bc3c..86a1204bb 100644 --- a/src/include/gnunet_util_lib.h +++ b/src/include/gnunet_util_lib.h | |||
@@ -63,7 +63,7 @@ extern "C" | |||
63 | * this service available to anyone but yourself. | 63 | * this service available to anyone but yourself. |
64 | */ | 64 | */ |
65 | #define GNUNET_AGPL_URL "https://git.gnunet.org/gnunet.git/tag/?h=v" \ | 65 | #define GNUNET_AGPL_URL "https://git.gnunet.org/gnunet.git/tag/?h=v" \ |
66 | GNUNET_VERSION | 66 | GNUNET_VERSION |
67 | 67 | ||
68 | #include "gnunet_config.h" | 68 | #include "gnunet_config.h" |
69 | #include "gnunet_common.h" | 69 | #include "gnunet_common.h" |
@@ -79,7 +79,6 @@ extern "C" | |||
79 | #include "gnunet_mq_lib.h" | 79 | #include "gnunet_mq_lib.h" |
80 | #include "gnunet_nt_lib.h" | 80 | #include "gnunet_nt_lib.h" |
81 | #include "gnunet_nc_lib.h" | 81 | #include "gnunet_nc_lib.h" |
82 | #include "gnunet_op_lib.h" | ||
83 | #include "gnunet_os_lib.h" | 82 | #include "gnunet_os_lib.h" |
84 | #include "gnunet_peer_lib.h" | 83 | #include "gnunet_peer_lib.h" |
85 | #include "gnunet_plugin_lib.h" | 84 | #include "gnunet_plugin_lib.h" |
@@ -103,42 +102,6 @@ extern "C" | |||
103 | */ | 102 | */ |
104 | #define GNUNET_S(a) #a | 103 | #define GNUNET_S(a) #a |
105 | 104 | ||
106 | /** | ||
107 | * Try to compress the given block of data using libz. Only returns | ||
108 | * the compressed block if compression worked and the new block is | ||
109 | * actually smaller. Decompress using #GNUNET_decompress(). | ||
110 | * | ||
111 | * @param data block to compress; if compression | ||
112 | * resulted in a smaller block, the first | ||
113 | * bytes of data are updated to the compressed | ||
114 | * data | ||
115 | * @param old_size number of bytes in data | ||
116 | * @param[out] result set to the compressed data, if compression worked | ||
117 | * @param[out] new_size set to size of result, if compression worked | ||
118 | * @return #GNUNET_YES if compression reduce the size, | ||
119 | * #GNUNET_NO if compression did not help | ||
120 | */ | ||
121 | int | ||
122 | GNUNET_try_compression (const char *data, | ||
123 | size_t old_size, | ||
124 | char **result, | ||
125 | size_t *new_size); | ||
126 | |||
127 | /** | ||
128 | * Decompress input, return the decompressed data as output. Dual to | ||
129 | * #GNUNET_try_compression(). Caller must set @a output_size to the | ||
130 | * number of bytes that were originally compressed. | ||
131 | * | ||
132 | * @param input compressed data | ||
133 | * @param input_size number of bytes in input | ||
134 | * @param output_size expected size of the output | ||
135 | * @return NULL on error, buffer of @a output_size decompressed bytes otherwise | ||
136 | */ | ||
137 | char * | ||
138 | GNUNET_decompress (const char *input, | ||
139 | size_t input_size, | ||
140 | size_t output_size); | ||
141 | |||
142 | 105 | ||
143 | #if 0 /* keep Emacsens' auto-indent happy */ | 106 | #if 0 /* keep Emacsens' auto-indent happy */ |
144 | { | 107 | { |
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 | ||
5 | SUBDIRS = \ | 5 | SUBDIRS = \ |
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 = \ | |||
75 | test_gnsrecord_lsd0001testvectors_SOURCES = \ | 75 | test_gnsrecord_lsd0001testvectors_SOURCES = \ |
76 | test_gnsrecord_testvectors.c | 76 | test_gnsrecord_testvectors.c |
77 | test_gnsrecord_lsd0001testvectors_LDADD = \ | 77 | test_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 = \ | |||
83 | test_gnsrecord_serialization_SOURCES = \ | 82 | test_gnsrecord_serialization_SOURCES = \ |
84 | test_gnsrecord_serialization.c | 83 | test_gnsrecord_serialization.c |
85 | test_gnsrecord_serialization_LDADD = \ | 84 | test_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 | ||
90 | test_gnsrecord_block_expiration_SOURCES = \ | 88 | test_gnsrecord_block_expiration_SOURCES = \ |
91 | test_gnsrecord_block_expiration.c | 89 | test_gnsrecord_block_expiration.c |
92 | test_gnsrecord_block_expiration_LDADD = \ | 90 | test_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 = \ | |||
98 | test_gnsrecord_crypto_SOURCES = \ | 95 | test_gnsrecord_crypto_SOURCES = \ |
99 | test_gnsrecord_crypto.c | 96 | test_gnsrecord_crypto.c |
100 | test_gnsrecord_crypto_LDADD = \ | 97 | test_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 = \ | |||
106 | perf_gnsrecord_crypto_SOURCES = \ | 102 | perf_gnsrecord_crypto_SOURCES = \ |
107 | perf_gnsrecord_crypto.c | 103 | perf_gnsrecord_crypto.c |
108 | perf_gnsrecord_crypto_LDADD = \ | 104 | perf_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/json/json_helper.c b/src/lib/json/json_helper.c index ce73fb316..5c2f8ae05 100644 --- a/src/lib/json/json_helper.c +++ b/src/lib/json/json_helper.c | |||
@@ -1344,4 +1344,268 @@ GNUNET_JSON_spec_blinded_message (const char *name, | |||
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | 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 | */ | ||
1355 | static enum GNUNET_GenericReturnValue | ||
1356 | parse_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 | */ | ||
1447 | static void | ||
1448 | clean_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 | |||
1463 | struct GNUNET_JSON_Specification | ||
1464 | GNUNET_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 | */ | ||
1486 | static enum GNUNET_GenericReturnValue | ||
1487 | parse_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 | */ | ||
1579 | static void | ||
1580 | clean_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 | |||
1594 | struct GNUNET_JSON_Specification | ||
1595 | GNUNET_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 | |||
1347 | /* end of json_helper.c */ | 1611 | /* end of json_helper.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]) | |||
6 | subdir('sq', if_found : [sqlite_dep]) | 6 | subdir('sq', if_found : [sqlite_dep]) |
7 | subdir('pq', if_found : [pq_dep]) | 7 | subdir('pq', if_found : [pq_dep]) |
8 | subdir('gnsrecord') | 8 | subdir('gnsrecord') |
9 | subdir('testing') | ||
diff --git a/src/lib/pq/Makefile.am b/src/lib/pq/Makefile.am index 91014dbfe..299cebccc 100644 --- a/src/lib/pq/Makefile.am +++ b/src/lib/pq/Makefile.am | |||
@@ -32,7 +32,7 @@ libgnunetpq_la_LIBADD = -lpq \ | |||
32 | libgnunetpq_la_LDFLAGS = \ | 32 | libgnunetpq_la_LDFLAGS = \ |
33 | $(POSTGRESQL_LDFLAGS) \ | 33 | $(POSTGRESQL_LDFLAGS) \ |
34 | $(GN_LIB_LDFLAGS) \ | 34 | $(GN_LIB_LDFLAGS) \ |
35 | -version-info 7:0:2 | 35 | -version-info 7:1:2 |
36 | 36 | ||
37 | if ENABLE_TEST_RUN | 37 | if ENABLE_TEST_RUN |
38 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 38 | 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/lib/pq/pq_result_helper.c b/src/lib/pq/pq_result_helper.c index cbb1e8e8e..c7d7f9abd 100644 --- a/src/lib/pq/pq_result_helper.c +++ b/src/lib/pq/pq_result_helper.c | |||
@@ -1264,22 +1264,35 @@ extract_array_generic ( | |||
1264 | *((void **) dst) = NULL; | 1264 | *((void **) dst) = NULL; |
1265 | 1265 | ||
1266 | #define FAIL_IF(cond) \ | 1266 | #define FAIL_IF(cond) \ |
1267 | do { \ | 1267 | do { \ |
1268 | if ((cond)) \ | 1268 | if ((cond)) \ |
1269 | { \ | 1269 | { \ |
1270 | GNUNET_break (! (cond)); \ | 1270 | GNUNET_break (! (cond)); \ |
1271 | goto FAIL; \ | 1271 | goto FAIL; \ |
1272 | } \ | 1272 | } \ |
1273 | } while (0) | 1273 | } while (0) |
1274 | 1274 | ||
1275 | col_num = PQfnumber (result, fname); | 1275 | col_num = PQfnumber (result, fname); |
1276 | FAIL_IF (0 > col_num); | 1276 | FAIL_IF (0 > col_num); |
1277 | 1277 | ||
1278 | data_sz = PQgetlength (result, row, col_num); | 1278 | data_sz = PQgetlength (result, row, col_num); |
1279 | FAIL_IF (0 > data_sz); | 1279 | FAIL_IF (0 > data_sz); |
1280 | FAIL_IF (sizeof(header) > (size_t) data_sz); | ||
1281 | |||
1282 | 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); | ||
1283 | FAIL_IF (NULL == data); | 1296 | FAIL_IF (NULL == data); |
1284 | 1297 | ||
1285 | { | 1298 | { |
@@ -1391,7 +1404,8 @@ extract_array_generic ( | |||
1391 | case array_of_rel_time: | 1404 | case array_of_rel_time: |
1392 | if (NULL != dst_size) | 1405 | if (NULL != dst_size) |
1393 | *dst_size = sizeof(struct GNUNET_TIME_Relative) * (header.dim); | 1406 | *dst_size = sizeof(struct GNUNET_TIME_Relative) * (header.dim); |
1394 | out = GNUNET_new_array (header.dim, struct GNUNET_TIME_Relative); | 1407 | out = GNUNET_new_array (header.dim, |
1408 | struct GNUNET_TIME_Relative); | ||
1395 | *((void **) dst) = out; | 1409 | *((void **) dst) = out; |
1396 | for (uint32_t i = 0; i < header.dim; i++) | 1410 | for (uint32_t i = 0; i < header.dim; i++) |
1397 | { | 1411 | { |
@@ -1408,7 +1422,8 @@ extract_array_generic ( | |||
1408 | case array_of_timestamp: | 1422 | case array_of_timestamp: |
1409 | if (NULL != dst_size) | 1423 | if (NULL != dst_size) |
1410 | *dst_size = sizeof(struct GNUNET_TIME_Timestamp) * (header.dim); | 1424 | *dst_size = sizeof(struct GNUNET_TIME_Timestamp) * (header.dim); |
1411 | out = GNUNET_new_array (header.dim, struct GNUNET_TIME_Timestamp); | 1425 | out = GNUNET_new_array (header.dim, |
1426 | struct GNUNET_TIME_Timestamp); | ||
1412 | *((void **) dst) = out; | 1427 | *((void **) dst) = out; |
1413 | for (uint32_t i = 0; i < header.dim; i++) | 1428 | for (uint32_t i = 0; i < header.dim; i++) |
1414 | { | 1429 | { |
@@ -1920,7 +1935,8 @@ clean_blind_sign_pub (void *cls, | |||
1920 | 1935 | ||
1921 | struct GNUNET_PQ_ResultSpec | 1936 | struct GNUNET_PQ_ResultSpec |
1922 | GNUNET_PQ_result_spec_blind_sign_pub (const char *name, | 1937 | GNUNET_PQ_result_spec_blind_sign_pub (const char *name, |
1923 | struct GNUNET_CRYPTO_BlindSignPublicKey **pub) | 1938 | struct GNUNET_CRYPTO_BlindSignPublicKey ** |
1939 | pub) | ||
1924 | { | 1940 | { |
1925 | struct GNUNET_PQ_ResultSpec res = { | 1941 | struct GNUNET_PQ_ResultSpec res = { |
1926 | .conv = &extract_blind_sign_pub, | 1942 | .conv = &extract_blind_sign_pub, |
@@ -2040,7 +2056,7 @@ extract_blind_sign_priv (void *cls, | |||
2040 | */ | 2056 | */ |
2041 | static void | 2057 | static void |
2042 | clean_blind_sign_priv (void *cls, | 2058 | clean_blind_sign_priv (void *cls, |
2043 | void *rd) | 2059 | void *rd) |
2044 | { | 2060 | { |
2045 | struct GNUNET_CRYPTO_BlindSignPrivateKey **priv = rd; | 2061 | struct GNUNET_CRYPTO_BlindSignPrivateKey **priv = rd; |
2046 | 2062 | ||
@@ -2052,7 +2068,8 @@ clean_blind_sign_priv (void *cls, | |||
2052 | 2068 | ||
2053 | struct GNUNET_PQ_ResultSpec | 2069 | struct GNUNET_PQ_ResultSpec |
2054 | GNUNET_PQ_result_spec_blind_sign_priv (const char *name, | 2070 | GNUNET_PQ_result_spec_blind_sign_priv (const char *name, |
2055 | struct GNUNET_CRYPTO_BlindSignPrivateKey **priv) | 2071 | struct GNUNET_CRYPTO_BlindSignPrivateKey |
2072 | **priv) | ||
2056 | { | 2073 | { |
2057 | struct GNUNET_PQ_ResultSpec res = { | 2074 | struct GNUNET_PQ_ResultSpec res = { |
2058 | .conv = &extract_blind_sign_priv, | 2075 | .conv = &extract_blind_sign_priv, |
@@ -2064,4 +2081,5 @@ GNUNET_PQ_result_spec_blind_sign_priv (const char *name, | |||
2064 | return res; | 2081 | return res; |
2065 | } | 2082 | } |
2066 | 2083 | ||
2084 | |||
2067 | /* 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 | |||
7 | test_testing_servicestartup | 7 | test_testing_servicestartup |
8 | test_testing_sharedservices | 8 | test_testing_sharedservices |
9 | gnunet-cmds-helper | 9 | gnunet-cmds-helper |
10 | test_testing_api | ||
11 | gnunet-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 | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | if USE_COVERAGE | ||
5 | AM_CFLAGS = --coverage -O0 | ||
6 | XLIB = -lgcov | ||
7 | endif | ||
8 | |||
9 | libexecdir= $(pkglibdir)/libexec/ | ||
10 | |||
11 | libexec_PROGRAMS = \ | ||
12 | gnunet-cmds-helper | ||
13 | |||
14 | plugindir = $(libdir)/gnunet | ||
15 | |||
16 | lib_LTLIBRARIES = \ | ||
17 | libgnunettesting.la | ||
18 | |||
19 | gnunet_cmds_helper_SOURCES = \ | ||
20 | gnunet-cmds-helper.c testing_cmds.h | ||
21 | gnunet_cmds_helper_LDADD = $(XLIB) \ | ||
22 | libgnunettesting.la \ | ||
23 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
24 | $(LTLIBINTL) | ||
25 | |||
26 | libgnunettesting_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 | ||
43 | libgnunettesting_la_LIBADD = \ | ||
44 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
45 | $(LTLIBINTL) | ||
46 | libgnunettesting_la_LDFLAGS = \ | ||
47 | $(GN_LIB_LDFLAGS) \ | ||
48 | -version-info 3:0:0 | ||
49 | |||
50 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH; | ||
51 | |||
52 | |||
53 | bin_PROGRAMS = \ | ||
54 | gnunet-testing-netjail-launcher | ||
55 | |||
56 | gnunet_testing_netjail_launcher_SOURCES = \ | ||
57 | gnunet-testing-netjail-launcher.c | ||
58 | gnunet_testing_netjail_launcher_LDADD = $(XLIB) \ | ||
59 | libgnunettesting.la \ | ||
60 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
61 | $(LTLIBINTL) | ||
62 | |||
63 | check_PROGRAMS = \ | ||
64 | test_testing_api | ||
65 | |||
66 | check_SCRIPTS = \ | ||
67 | test_netjail_api.sh | ||
68 | |||
69 | TESTS = \ | ||
70 | $(check_PROGRAMS) \ | ||
71 | $(check_SCRIPTS) | ||
72 | |||
73 | test_testing_api_SOURCES = \ | ||
74 | test_testing_api.c | ||
75 | test_testing_api_LDADD = \ | ||
76 | libgnunettesting.la \ | ||
77 | -lgnunetutil \ | ||
78 | $(XLIB) | ||
79 | |||
80 | EXTRA_DIST = \ | ||
81 | $(check_SCRIPTS) \ | ||
82 | test_netjail_topo.conf | ||
83 | |||
84 | plugin_LTLIBRARIES = \ | ||
85 | libgnunet_test_testing_plugin_ping.la | ||
86 | |||
87 | libgnunet_test_testing_plugin_ping_la_SOURCES = \ | ||
88 | test_testing_plugin_ping.c | ||
89 | libgnunet_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..93d4d96de --- /dev/null +++ b/src/lib/testing/gnunet-cmds-helper.c | |||
@@ -0,0 +1,549 @@ | |||
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 | */ | ||
57 | struct 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 | |||
81 | static struct WriteContext *wc_head; | ||
82 | |||
83 | static struct WriteContext *wc_tail; | ||
84 | |||
85 | static struct GNUNET_TESTING_Interpreter *is; | ||
86 | |||
87 | static const char *my_node_id; | ||
88 | |||
89 | /** | ||
90 | * Plugin to dynamically load a test case. | ||
91 | */ | ||
92 | static struct GNUNET_TESTING_PluginFunctions *plugin; | ||
93 | |||
94 | /** | ||
95 | * Name of our plugin. | ||
96 | */ | ||
97 | static char *plugin_name; | ||
98 | |||
99 | /** | ||
100 | * The loaded topology. | ||
101 | */ | ||
102 | struct GNUNET_TESTING_NetjailTopology *njt; | ||
103 | |||
104 | /** | ||
105 | * Our message stream tokenizer | ||
106 | */ | ||
107 | static struct GNUNET_MessageStreamTokenizer *tokenizer; | ||
108 | |||
109 | /** | ||
110 | * Disk handle from stdin | ||
111 | */ | ||
112 | static struct GNUNET_DISK_FileHandle *stdin_fd; | ||
113 | |||
114 | /** | ||
115 | * Disk handle for stdout | ||
116 | */ | ||
117 | static struct GNUNET_DISK_FileHandle *stdout_fd; | ||
118 | |||
119 | /** | ||
120 | * Task identifier for the read task | ||
121 | */ | ||
122 | static struct GNUNET_SCHEDULER_Task *read_task_id; | ||
123 | |||
124 | /** | ||
125 | * Task identifier for the write task | ||
126 | */ | ||
127 | static struct GNUNET_SCHEDULER_Task *write_task_id; | ||
128 | |||
129 | /** | ||
130 | * Result to return in case we fail | ||
131 | */ | ||
132 | static int global_ret; | ||
133 | |||
134 | /** | ||
135 | * Set to true once we are finished and should exit | ||
136 | * after sending our final message to the parent. | ||
137 | */ | ||
138 | static bool finished; | ||
139 | |||
140 | |||
141 | /** | ||
142 | * Task to shut down cleanly | ||
143 | * | ||
144 | * @param cls NULL | ||
145 | */ | ||
146 | static void | ||
147 | do_shutdown (void *cls) | ||
148 | { | ||
149 | struct WriteContext *wc; | ||
150 | |||
151 | if (NULL != read_task_id) | ||
152 | { | ||
153 | GNUNET_SCHEDULER_cancel (read_task_id); | ||
154 | read_task_id = NULL; | ||
155 | } | ||
156 | if (NULL != write_task_id) | ||
157 | { | ||
158 | GNUNET_SCHEDULER_cancel (write_task_id); | ||
159 | write_task_id = NULL; | ||
160 | } | ||
161 | while (NULL != (wc = wc_head)) | ||
162 | { | ||
163 | GNUNET_CONTAINER_DLL_remove (wc_head, | ||
164 | wc_tail, | ||
165 | wc); | ||
166 | GNUNET_free (wc->data); | ||
167 | GNUNET_free (wc); | ||
168 | } | ||
169 | if (NULL != tokenizer) | ||
170 | { | ||
171 | GNUNET_MST_destroy (tokenizer); | ||
172 | tokenizer = NULL; | ||
173 | } | ||
174 | if (NULL != plugin) | ||
175 | { | ||
176 | GNUNET_PLUGIN_unload (plugin_name, | ||
177 | plugin); | ||
178 | } | ||
179 | if (NULL != njt) | ||
180 | { | ||
181 | GNUNET_TESTING_free_topology (njt); | ||
182 | njt = NULL; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | |||
187 | /** | ||
188 | * Task to write to the standard out | ||
189 | * | ||
190 | * @param cls the WriteContext | ||
191 | */ | ||
192 | static void | ||
193 | write_task (void *cls) | ||
194 | { | ||
195 | struct WriteContext *wc = wc_head; | ||
196 | ssize_t bytes_wrote; | ||
197 | |||
198 | write_task_id = NULL; | ||
199 | if (NULL == wc) | ||
200 | { | ||
201 | if (finished) | ||
202 | GNUNET_SCHEDULER_shutdown (); | ||
203 | return; | ||
204 | } | ||
205 | bytes_wrote | ||
206 | = GNUNET_DISK_file_write (stdout_fd, | ||
207 | wc->data + wc->pos, | ||
208 | wc->length - wc->pos); | ||
209 | if (GNUNET_SYSERR == bytes_wrote) | ||
210 | { | ||
211 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, | ||
212 | "write"); | ||
213 | GNUNET_free (wc->data); | ||
214 | GNUNET_free (wc); | ||
215 | global_ret = EXIT_FAILURE; | ||
216 | GNUNET_SCHEDULER_shutdown (); | ||
217 | return; | ||
218 | } | ||
219 | wc->pos += bytes_wrote; | ||
220 | if (wc->pos == wc->length) | ||
221 | { | ||
222 | GNUNET_CONTAINER_DLL_remove (wc_head, | ||
223 | wc_tail, | ||
224 | wc); | ||
225 | GNUNET_free (wc->data); | ||
226 | GNUNET_free (wc); | ||
227 | } | ||
228 | write_task_id | ||
229 | = GNUNET_SCHEDULER_add_write_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
230 | stdout_fd, | ||
231 | &write_task, | ||
232 | NULL); | ||
233 | } | ||
234 | |||
235 | |||
236 | /** | ||
237 | * Callback to write a message to the parent process. | ||
238 | * | ||
239 | */ | ||
240 | static void | ||
241 | write_message (const struct GNUNET_MessageHeader *message) | ||
242 | { | ||
243 | struct WriteContext *wc; | ||
244 | size_t msg_length = ntohs (message->size); | ||
245 | |||
246 | wc = GNUNET_new (struct WriteContext); | ||
247 | wc->length = msg_length; | ||
248 | wc->data = GNUNET_memdup (message, | ||
249 | msg_length); | ||
250 | GNUNET_CONTAINER_DLL_insert_tail (wc_head, | ||
251 | wc_tail, | ||
252 | wc); | ||
253 | if (NULL == write_task_id) | ||
254 | { | ||
255 | GNUNET_assert (wc_head == wc); | ||
256 | write_task_id | ||
257 | = GNUNET_SCHEDULER_add_write_file ( | ||
258 | GNUNET_TIME_UNIT_FOREVER_REL, | ||
259 | stdout_fd, | ||
260 | &write_task, | ||
261 | NULL); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | |||
266 | static void | ||
267 | finished_cb (void *cls, | ||
268 | enum GNUNET_GenericReturnValue rv) | ||
269 | { | ||
270 | struct GNUNET_TESTING_CommandLocalFinished reply = { | ||
271 | .header.type = htons (GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED), | ||
272 | .header.size = htons (sizeof (reply)), | ||
273 | .rv = htonl ((uint32_t) rv) | ||
274 | }; | ||
275 | |||
276 | (void) cls; | ||
277 | finished = true; | ||
278 | write_message (&reply.header); | ||
279 | } | ||
280 | |||
281 | |||
282 | static enum GNUNET_GenericReturnValue | ||
283 | check_helper_init ( | ||
284 | void *cls, | ||
285 | const struct GNUNET_TESTING_CommandHelperInit *msg) | ||
286 | { | ||
287 | uint16_t msize = htons (msg->header.size); | ||
288 | uint32_t barrier_count = htonl (msg->barrier_count); | ||
289 | size_t bs = barrier_count * sizeof (struct GNUNET_ShortHashCode); | ||
290 | size_t left = msize - bs - sizeof (*msg); | ||
291 | const struct GNUNET_ShortHashCode *bd | ||
292 | = (const struct GNUNET_ShortHashCode *) &msg[1]; | ||
293 | const char *topo = (const char *) &bd[barrier_count]; | ||
294 | |||
295 | if (msize < bs + sizeof (*msg)) | ||
296 | { | ||
297 | GNUNET_break_op (0); | ||
298 | return GNUNET_SYSERR; | ||
299 | } | ||
300 | if ('\0' != topo[left - 1]) | ||
301 | { | ||
302 | GNUNET_break_op (0); | ||
303 | return GNUNET_SYSERR; | ||
304 | } | ||
305 | return GNUNET_OK; | ||
306 | } | ||
307 | |||
308 | |||
309 | static void | ||
310 | handle_helper_init ( | ||
311 | void *cls, | ||
312 | const struct GNUNET_TESTING_CommandHelperInit *msg) | ||
313 | { | ||
314 | uint16_t msize = htons (msg->header.size); | ||
315 | uint32_t barrier_count = htonl (msg->barrier_count); | ||
316 | size_t bs = barrier_count * sizeof (struct GNUNET_ShortHashCode); | ||
317 | size_t left = msize - bs - sizeof (*msg); | ||
318 | const struct GNUNET_ShortHashCode *bd | ||
319 | = (const struct GNUNET_ShortHashCode *) &msg[1]; | ||
320 | const char *topo = (const char *) &bd[barrier_count]; | ||
321 | |||
322 | |||
323 | GNUNET_assert ('\0' == topo[left - 1]); | ||
324 | njt = GNUNET_TESTING_get_topo_from_string_ (topo); | ||
325 | if (NULL == njt) | ||
326 | { | ||
327 | GNUNET_break_op (0); | ||
328 | global_ret = EXIT_FAILURE; | ||
329 | GNUNET_SCHEDULER_shutdown (); | ||
330 | return; | ||
331 | } | ||
332 | plugin_name = GNUNET_TESTING_get_plugin_from_topo (njt, | ||
333 | my_node_id); | ||
334 | plugin = GNUNET_PLUGIN_load (plugin_name, | ||
335 | (void *) my_node_id); | ||
336 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
337 | "Starting plugin `%s' for node %s\n", | ||
338 | plugin_name, | ||
339 | my_node_id); | ||
340 | if (NULL == plugin) | ||
341 | { | ||
342 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
343 | "Plugin `%s' not found!\n", | ||
344 | plugin_name); | ||
345 | global_ret = EXIT_FAILURE; | ||
346 | GNUNET_SCHEDULER_shutdown (); | ||
347 | return; | ||
348 | } | ||
349 | struct GNUNET_TESTING_Command *commands = plugin->cls; | ||
350 | unsigned int i; | ||
351 | |||
352 | for (i = 0; NULL != commands[i].run; i++) | ||
353 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
354 | "helper %s\n", | ||
355 | commands[i].label.value); | ||
356 | is = plugin->start_testcase (plugin->cls, | ||
357 | topo, | ||
358 | barrier_count, | ||
359 | bd, | ||
360 | &write_message, | ||
361 | &finished_cb, | ||
362 | NULL); | ||
363 | } | ||
364 | |||
365 | |||
366 | static void | ||
367 | handle_helper_barrier_crossable ( | ||
368 | void *cls, | ||
369 | const struct GNUNET_TESTING_CommandBarrierSatisfied *cbs) | ||
370 | { | ||
371 | struct GNUNET_TESTING_Barrier *barrier; | ||
372 | |||
373 | if (NULL == is) | ||
374 | { | ||
375 | /* Barrier satisfied *before* helper_init?! */ | ||
376 | GNUNET_break_op (0); | ||
377 | global_ret = EXIT_FAILURE; | ||
378 | GNUNET_SCHEDULER_shutdown (); | ||
379 | return; | ||
380 | } | ||
381 | barrier = GNUNET_TESTING_get_barrier2_ (is, | ||
382 | &cbs->barrier_key); | ||
383 | if (barrier->satisfied) | ||
384 | { | ||
385 | /* Barrier satisfied *twice* is strange... */ | ||
386 | GNUNET_break_op (0); | ||
387 | global_ret = EXIT_FAILURE; | ||
388 | GNUNET_SCHEDULER_shutdown (); | ||
389 | return; | ||
390 | } | ||
391 | barrier->satisfied = true; | ||
392 | GNUNET_TESTING_loop_notify_children_ (is, | ||
393 | &cbs->header); | ||
394 | for (unsigned int i = 0; i<barrier->cnt_waiting; i++) | ||
395 | GNUNET_TESTING_async_finish (barrier->waiting[i]); | ||
396 | GNUNET_array_grow (barrier->waiting, | ||
397 | barrier->cnt_waiting, | ||
398 | 0); | ||
399 | } | ||
400 | |||
401 | |||
402 | /** | ||
403 | * Functions with this signature are called whenever a | ||
404 | * complete message is received by the tokenizer. | ||
405 | * | ||
406 | * Do not call #GNUNET_mst_destroy() in this callback | ||
407 | * | ||
408 | * @param cls identification of the client | ||
409 | * @param message the actual message | ||
410 | * @return #GNUNET_OK on success, | ||
411 | * #GNUNET_NO to stop further processing (no error) | ||
412 | * #GNUNET_SYSERR to stop further processing with error | ||
413 | */ | ||
414 | static enum GNUNET_GenericReturnValue | ||
415 | tokenizer_cb (void *cls, | ||
416 | const struct GNUNET_MessageHeader *message) | ||
417 | { | ||
418 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
419 | GNUNET_MQ_hd_var_size ( | ||
420 | helper_init, | ||
421 | GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT, | ||
422 | struct GNUNET_TESTING_CommandHelperInit, | ||
423 | NULL), | ||
424 | GNUNET_MQ_hd_fixed_size ( | ||
425 | helper_barrier_crossable, | ||
426 | GNUNET_MESSAGE_TYPE_CMDS_HELPER_BARRIER_CROSSABLE, | ||
427 | struct GNUNET_TESTING_CommandBarrierSatisfied, | ||
428 | NULL), | ||
429 | GNUNET_MQ_handler_end () | ||
430 | }; | ||
431 | |||
432 | return GNUNET_MQ_handle_message (handlers, | ||
433 | message); | ||
434 | } | ||
435 | |||
436 | |||
437 | /** | ||
438 | * Task to read from stdin | ||
439 | * | ||
440 | * @param cls NULL | ||
441 | */ | ||
442 | static void | ||
443 | read_task (void *cls) | ||
444 | { | ||
445 | char buf[GNUNET_MAX_MESSAGE_SIZE]; | ||
446 | ssize_t sread; | ||
447 | |||
448 | read_task_id = NULL; | ||
449 | sread = GNUNET_DISK_file_read (stdin_fd, | ||
450 | buf, | ||
451 | sizeof(buf)); | ||
452 | if (GNUNET_SYSERR == sread) | ||
453 | { | ||
454 | GNUNET_break (0); | ||
455 | global_ret = EXIT_FAILURE; | ||
456 | GNUNET_SCHEDULER_shutdown (); | ||
457 | return; | ||
458 | } | ||
459 | if (0 == sread) | ||
460 | { | ||
461 | LOG_DEBUG ("STDIN eof\n"); | ||
462 | GNUNET_SCHEDULER_shutdown (); | ||
463 | return; | ||
464 | } | ||
465 | if (GNUNET_OK != | ||
466 | GNUNET_MST_from_buffer (tokenizer, | ||
467 | buf, | ||
468 | sread, | ||
469 | GNUNET_NO, | ||
470 | GNUNET_NO)) | ||
471 | { | ||
472 | GNUNET_break (0); | ||
473 | global_ret = EXIT_FAILURE; | ||
474 | GNUNET_SCHEDULER_shutdown (); | ||
475 | return; | ||
476 | } | ||
477 | read_task_id | ||
478 | = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
479 | stdin_fd, | ||
480 | &read_task, | ||
481 | NULL); | ||
482 | } | ||
483 | |||
484 | |||
485 | /** | ||
486 | * Main function that will be run. | ||
487 | * | ||
488 | * @param cls closure | ||
489 | * @param args remaining command-line arguments | ||
490 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | ||
491 | * @param cfg configuration | ||
492 | */ | ||
493 | static void | ||
494 | run (void *cls, | ||
495 | char *const *args, | ||
496 | const char *cfgfile, | ||
497 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
498 | { | ||
499 | if (NULL == args[0]) | ||
500 | { | ||
501 | /* must be called with our node ID as 1st argument */ | ||
502 | GNUNET_break_op (0); | ||
503 | global_ret = EXIT_INVALIDARGUMENT; | ||
504 | return; | ||
505 | } | ||
506 | my_node_id = args[0]; | ||
507 | tokenizer = GNUNET_MST_create (&tokenizer_cb, | ||
508 | NULL); | ||
509 | stdin_fd = GNUNET_DISK_get_handle_from_native (stdin); | ||
510 | stdout_fd = GNUNET_DISK_get_handle_from_native (stdout); | ||
511 | read_task_id = GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, | ||
512 | stdin_fd, | ||
513 | &read_task, | ||
514 | NULL); | ||
515 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | ||
516 | NULL); | ||
517 | } | ||
518 | |||
519 | |||
520 | /** | ||
521 | * Main function | ||
522 | * | ||
523 | * @param argc the number of command line arguments | ||
524 | * @param argv command line arg array | ||
525 | * @return return code | ||
526 | */ | ||
527 | int | ||
528 | main (int argc, | ||
529 | char **argv) | ||
530 | { | ||
531 | struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
532 | GNUNET_GETOPT_OPTION_END | ||
533 | }; | ||
534 | enum GNUNET_GenericReturnValue ret; | ||
535 | |||
536 | ret = GNUNET_PROGRAM_run (argc, | ||
537 | argv, | ||
538 | "gnunet-cmds-helper", | ||
539 | "Helper for starting a local interpreter loop", | ||
540 | options, | ||
541 | &run, | ||
542 | NULL); | ||
543 | if (GNUNET_OK != ret) | ||
544 | return 1; | ||
545 | return global_ret; | ||
546 | } | ||
547 | |||
548 | |||
549 | /* 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 | |||
32 | int | ||
33 | main (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 @@ | |||
1 | libgnunettesting_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 | |||
18 | libgnunettesting = 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')) | ||
27 | libgnunettesting_dep = declare_dependency(link_with : libgnunettesting) | ||
28 | pkg.generate(libgnunettesting, url: 'https://www.gnunet.org', | ||
29 | description : 'Provides API for gnunet testing') | ||
30 | |||
31 | executable ('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 | ||
2 | exec ../../../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..216e3ae7c --- /dev/null +++ b/src/lib/testing/test_netjail_topo.conf | |||
@@ -0,0 +1,12 @@ | |||
1 | [DEFAULTS] | ||
2 | SUBNETS = 1 | ||
3 | CARRIER_SETUP_PROGRAMMS = iptables -A INPUT -p icmp -j DROP;tc qdisc add dev $UPLINK root netm delay 100ms 10ms; | ||
4 | SUBNET_SETUP_PROGRAMMS = iptables -A INPUT -p icmp -j DROP;tc qdisc add dev $UPLINK root netm delay 100ms 10ms; | ||
5 | PEER_SETUP_PROGRAMMS = iptables -A INPUT -p icmp -j DROP;tc qdisc add dev $UPLINK root netm delay 100ms 10ms; | ||
6 | TESTBED_PLUGIN = libgnunet_test_testing_plugin_ping | ||
7 | CARRIER_PEERS = 1 | ||
8 | SUBNET_PEERS = 1 | ||
9 | |||
10 | [BACKBONE] | ||
11 | CARRIERS = 1 | ||
12 | BACKBONE_PEERS = 1 | ||
diff --git a/src/lib/testing/test_testing_api.c b/src/lib/testing/test_testing_api.c new file mode 100644 index 000000000..bfcc83e74 --- /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 | |||
29 | int | ||
30 | main (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_file ( | ||
56 | "load-topology", | ||
57 | "test_netjail_topo.conf"), // 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..5d8f44fa3 --- /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 | |||
30 | GNUNET_TESTING_MAKE_PLUGIN ( | ||
31 | libgnunet_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 | |||
38 | void | ||
39 | GNUNET_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 | */ | ||
33 | struct 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 | |||
74 | void | ||
75 | GNUNET_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 | */ | ||
41 | static enum GNUNET_GenericReturnValue | ||
42 | barrier_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 | */ | ||
64 | static void | ||
65 | barrier_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 | */ | ||
79 | static void | ||
80 | barrier_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 | |||
90 | struct GNUNET_TESTING_Command | ||
91 | GNUNET_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 | */ | ||
40 | struct 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 | */ | ||
66 | static void | ||
67 | barrier_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 | */ | ||
137 | static void | ||
138 | barrier_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 | */ | ||
155 | static enum GNUNET_GenericReturnValue | ||
156 | barrier_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 | |||
172 | struct GNUNET_TESTING_Command | ||
173 | GNUNET_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 | |||
183 | GNUNET_TESTING_cmd_batch_next_ (void *cls) | 178 | GNUNET_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 | ||
213 | void | 219 | void |
214 | GNUNET_TESTING_cmd_batch_set_current_ (const struct GNUNET_TESTING_Command *cmd, | 220 | GNUNET_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 | */ | ||
35 | bool | ||
36 | GNUNET_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 | */ | ||
47 | bool | ||
48 | GNUNET_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 | */ | ||
56 | struct GNUNET_TESTING_Command * | ||
57 | GNUNET_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 | */ | ||
67 | void | ||
68 | GNUNET_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 | |||
32 | struct 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 | */ | ||
76 | static void | ||
77 | exec_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 | */ | ||
111 | static void | ||
112 | child_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 | */ | ||
142 | static void | ||
143 | exec_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 | */ | ||
167 | static enum GNUNET_GenericReturnValue | ||
168 | traits (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 | |||
186 | const struct GNUNET_TESTING_Command | ||
187 | GNUNET_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 | |||
216 | const struct GNUNET_TESTING_Command | ||
217 | GNUNET_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 | */ |
108 | static void | 122 | static void |
109 | run_finish (void *cls, | 123 | run_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 | ||
170 | const struct GNUNET_TESTING_Command | 187 | const struct GNUNET_TESTING_Command |
171 | GNUNET_TESTING_cmd_finish (const char *finish_label, | 188 | GNUNET_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 | ||
187 | struct GNUNET_TESTING_Command | 208 | struct GNUNET_TESTING_Command |
188 | GNUNET_TESTING_cmd_make_unblocking (struct GNUNET_TESTING_Command cmd) | 209 | GNUNET_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 | |||
35 | struct 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 | */ | ||
69 | static void | ||
70 | cleanup (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 | */ | ||
87 | static enum GNUNET_GenericReturnValue | ||
88 | traits (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 | |||
107 | static char * | ||
108 | get_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 | */ | ||
155 | static void | ||
156 | run (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 | |||
176 | struct GNUNET_TESTING_Command | ||
177 | GNUNET_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 | |||
196 | struct GNUNET_TESTING_Command | ||
197 | GNUNET_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..eede2fea6 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 | */ |
107 | static void | 97 | static void |
108 | child_completed_callback (void *cls, | 98 | child_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,9 @@ 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 | pid, |
187 | read_file, | 182 | "0", |
188 | NULL | 183 | NULL |
189 | }; | 184 | }; |
190 | 185 | ||
@@ -201,31 +196,27 @@ netjail_start_run (void *cls, | |||
201 | &child_completed_callback, | 196 | &child_completed_callback, |
202 | ns); | 197 | ns); |
203 | GNUNET_break (NULL != ns->cwh); | 198 | GNUNET_break (NULL != ns->cwh); |
204 | GNUNET_free (read_file); | ||
205 | GNUNET_free (script_name); | 199 | GNUNET_free (script_name); |
206 | GNUNET_free (data_dir); | 200 | GNUNET_free (data_dir); |
207 | } | 201 | } |
208 | 202 | ||
209 | 203 | ||
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 | */ | ||
217 | struct GNUNET_TESTING_Command | 204 | struct GNUNET_TESTING_Command |
218 | GNUNET_TESTING_cmd_netjail_start (const char *label, | 205 | GNUNET_TESTING_cmd_netjail_setup ( |
219 | char *topology_config, | 206 | const char *label, |
220 | unsigned int *read_file) | 207 | const char *script, |
208 | const char *topology_cmd_label) | ||
221 | { | 209 | { |
222 | struct NetJailState *ns; | 210 | struct NetJailState *ns; |
223 | 211 | ||
224 | ns = GNUNET_new (struct NetJailState); | 212 | ns = GNUNET_new (struct NetJailState); |
225 | ns->topology_config = topology_config; | 213 | ns->script = script; |
226 | ns->read_file = read_file; | 214 | ns->topology_cmd_label = topology_cmd_label; |
227 | return GNUNET_TESTING_command_new (ns, label, | 215 | return GNUNET_TESTING_command_new_ac ( |
228 | &netjail_start_run, | 216 | ns, |
229 | &netjail_start_cleanup, | 217 | label, |
230 | NULL, &ns->ac); | 218 | &netjail_start_run, |
219 | &netjail_start_cleanup, | ||
220 | NULL, | ||
221 | &ns->ac); | ||
231 | } | 222 | } |
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..a90447235 --- /dev/null +++ b/src/lib/testing/testing_api_cmd_netjail_start_cmds_helper.c | |||
@@ -0,0 +1,595 @@ | |||
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 | */ | ||
44 | struct TestingSystemCount; | ||
45 | |||
46 | |||
47 | /** | ||
48 | * Struct to store information handed over to callbacks. | ||
49 | */ | ||
50 | struct 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 | */ | ||
118 | struct 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 | */ | ||
153 | static void | ||
154 | clear_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 | |||
175 | static void | ||
176 | handle_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 | |||
230 | static void | ||
231 | handle_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 | */ | ||
264 | static enum GNUNET_GenericReturnValue | ||
265 | helper_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 | */ | ||
302 | static void | ||
303 | exp_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 | |||
319 | static enum GNUNET_GenericReturnValue | ||
320 | add_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 | */ | ||
336 | static bool | ||
337 | send_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 | */ | ||
405 | static bool | ||
406 | start_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 *data_dir; | ||
413 | char *script_name; | ||
414 | struct GNUNET_HELPER_Handle *helper; | ||
415 | |||
416 | data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR); | ||
417 | GNUNET_asprintf (&script_name, | ||
418 | "%s%s", | ||
419 | data_dir, | ||
420 | NETJAIL_EXEC_SCRIPT); | ||
421 | GNUNET_snprintf (node_id, | ||
422 | sizeof (node_id), | ||
423 | "if%06x-%06x\n", | ||
424 | (unsigned int) getpid (), | ||
425 | script_num); | ||
426 | { | ||
427 | char *const script_argv[] = { | ||
428 | script_name, | ||
429 | node_id, | ||
430 | gnunet_cmds_helper, | ||
431 | node_id, | ||
432 | NULL | ||
433 | }; | ||
434 | helper = GNUNET_HELPER_start ( | ||
435 | GNUNET_YES, /* with control pipe */ | ||
436 | script_argv[0], | ||
437 | script_argv, | ||
438 | &helper_mst, | ||
439 | &exp_cb, | ||
440 | ns); | ||
441 | } | ||
442 | GNUNET_free (gnunet_cmds_helper); | ||
443 | if (NULL == helper) | ||
444 | { | ||
445 | GNUNET_break (0); | ||
446 | return false; | ||
447 | } | ||
448 | GNUNET_array_append (ns->helpers, | ||
449 | ns->n_helpers, | ||
450 | helper); | ||
451 | GNUNET_TESTING_add_netjail_helper_ (ns->is, | ||
452 | helper); | ||
453 | GNUNET_free (data_dir); | ||
454 | GNUNET_free (script_name); | ||
455 | return send_start_messages (ns, | ||
456 | helper); | ||
457 | } | ||
458 | |||
459 | |||
460 | /** | ||
461 | * Function run when the cmd terminates (good or bad) with timeout. | ||
462 | * | ||
463 | * @param cls the interpreter state | ||
464 | */ | ||
465 | static void | ||
466 | do_timeout (void *cls) | ||
467 | { | ||
468 | struct NetJailState *ns = cls; | ||
469 | |||
470 | ns->timeout_task = NULL; | ||
471 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
472 | "Terminating cmd due to global timeout\n"); | ||
473 | GNUNET_TESTING_async_finish (&ns->ac); | ||
474 | } | ||
475 | |||
476 | |||
477 | /** | ||
478 | * This function starts a helper process for each node. | ||
479 | * | ||
480 | * @param cls closure. | ||
481 | * @param cmd CMD being run. | ||
482 | * @param is interpreter state. | ||
483 | */ | ||
484 | static void | ||
485 | netjail_exec_run (void *cls, | ||
486 | struct GNUNET_TESTING_Interpreter *is) | ||
487 | { | ||
488 | struct NetJailState *ns = cls; | ||
489 | struct GNUNET_TESTING_NetjailTopology *topology; | ||
490 | bool failed = false; | ||
491 | const struct GNUNET_TESTING_Command *topo_cmd; | ||
492 | |||
493 | ns->is = is; | ||
494 | topo_cmd = GNUNET_TESTING_interpreter_lookup_command (is, | ||
495 | ns->topology_cmd_label); | ||
496 | if (NULL == topo_cmd) | ||
497 | GNUNET_TESTING_FAIL (is); | ||
498 | if (GNUNET_OK != | ||
499 | GNUNET_TESTING_get_trait_topology_string (topo_cmd, | ||
500 | &ns->topology_data)) | ||
501 | GNUNET_TESTING_FAIL (is); | ||
502 | topology | ||
503 | = GNUNET_TESTING_get_topo_from_string_ (ns->topology_data); | ||
504 | for (unsigned int i = 1; i <= topology->total; i++) | ||
505 | { | ||
506 | if (! start_helper (ns, | ||
507 | i)) | ||
508 | { | ||
509 | failed = true; | ||
510 | break; | ||
511 | } | ||
512 | } | ||
513 | GNUNET_TESTING_free_topology (topology); | ||
514 | if (failed) | ||
515 | { | ||
516 | ns->failed = true; | ||
517 | GNUNET_TESTING_FAIL (is); | ||
518 | } | ||
519 | ns->timeout_task | ||
520 | = GNUNET_SCHEDULER_add_delayed (ns->timeout, | ||
521 | &do_timeout, | ||
522 | ns); | ||
523 | } | ||
524 | |||
525 | |||
526 | /** | ||
527 | * Code to clean up resource this cmd used. | ||
528 | * | ||
529 | * @param cls closure | ||
530 | */ | ||
531 | static void | ||
532 | netjail_exec_cleanup (void *cls) | ||
533 | { | ||
534 | struct NetJailState *ns = cls; | ||
535 | |||
536 | if (NULL != ns->timeout_task) | ||
537 | { | ||
538 | GNUNET_SCHEDULER_cancel (ns->timeout_task); | ||
539 | ns->timeout_task = NULL; | ||
540 | } | ||
541 | for (unsigned int i = 0; i<ns->n_helpers; i++) | ||
542 | GNUNET_HELPER_stop (ns->helpers[i], | ||
543 | GNUNET_YES); | ||
544 | GNUNET_free (ns); | ||
545 | } | ||
546 | |||
547 | |||
548 | /** | ||
549 | * This function prepares an array with traits. | ||
550 | */ | ||
551 | static enum GNUNET_GenericReturnValue | ||
552 | netjail_exec_traits (void *cls, | ||
553 | const void **ret, | ||
554 | const char *trait, | ||
555 | unsigned int index) | ||
556 | { | ||
557 | struct NetJailState *ns = cls; | ||
558 | struct GNUNET_TESTING_Trait traits[] = { | ||
559 | GNUNET_TESTING_trait_end () | ||
560 | }; | ||
561 | |||
562 | (void) ns; | ||
563 | return GNUNET_TESTING_get_trait (traits, | ||
564 | ret, | ||
565 | trait, | ||
566 | index); | ||
567 | } | ||
568 | |||
569 | |||
570 | /** | ||
571 | * Create command. | ||
572 | * | ||
573 | * @param label Name for the command. | ||
574 | * @param topology_data topology data | ||
575 | * @param timeout Before this timeout is reached this cmd MUST finish. | ||
576 | * @return command. | ||
577 | */ | ||
578 | struct GNUNET_TESTING_Command | ||
579 | GNUNET_TESTING_cmd_netjail_start_helpers ( | ||
580 | const char *label, | ||
581 | const char *topology_cmd_label, | ||
582 | struct GNUNET_TIME_Relative timeout) | ||
583 | { | ||
584 | struct NetJailState *ns; | ||
585 | |||
586 | ns = GNUNET_new (struct NetJailState); | ||
587 | ns->topology_cmd_label = topology_cmd_label; | ||
588 | ns->timeout = timeout; | ||
589 | return GNUNET_TESTING_command_new_ac (ns, | ||
590 | label, | ||
591 | &netjail_exec_run, | ||
592 | &netjail_exec_cleanup, | ||
593 | &netjail_exec_traits, | ||
594 | &ns->ac); | ||
595 | } | ||
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 | */ | ||
31 | struct 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 | */ | ||
51 | static void | ||
52 | signal_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 | */ | ||
87 | static void | ||
88 | signal_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 | */ | ||
104 | struct GNUNET_TESTING_Command | ||
105 | GNUNET_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 | */ | ||
34 | static void | ||
35 | stat_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 | */ | ||
45 | static void | ||
46 | stat_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 | */ | ||
100 | static void | ||
101 | do_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 | */ | ||
136 | static void | ||
137 | stat_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 | |||
149 | struct GNUNET_TESTING_Command | ||
150 | GNUNET_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 | |||
33 | struct GNUNET_TESTING_Command | ||
34 | GNUNET_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 | |||
58 | void | ||
59 | GNUNET_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 | |||
74 | struct GNUNET_TESTING_Command | ||
75 | GNUNET_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 | |||
84 | struct GNUNET_TESTING_Command | ||
85 | GNUNET_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..098de8a05 --- /dev/null +++ b/src/lib/testing/testing_api_loop.c | |||
@@ -0,0 +1,1024 @@ | |||
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 | |||
37 | struct 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 | */ | ||
54 | struct 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 | |||
146 | const struct GNUNET_TESTING_Command * | ||
147 | GNUNET_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 | ¤t)); | ||
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 | |||
204 | const struct GNUNET_TESTING_Command * | ||
205 | GNUNET_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 | |||
225 | static void | ||
226 | send_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 | |||
240 | void | ||
241 | GNUNET_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 | |||
266 | void | ||
267 | GNUNET_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 | */ | ||
282 | static void | ||
283 | finish_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 | */ | ||
348 | static void | ||
349 | interpreter_run (void *cls); | ||
350 | |||
351 | |||
352 | void | ||
353 | GNUNET_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 | |||
394 | void | ||
395 | GNUNET_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 | */ | ||
441 | static void | ||
442 | interpreter_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 | |||
464 | void | ||
465 | GNUNET_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 | |||
509 | void | ||
510 | GNUNET_TESTING_interpreter_skip ( | ||
511 | struct GNUNET_TESTING_Interpreter *is) | ||
512 | { | ||
513 | is->skip = true; | ||
514 | GNUNET_TESTING_interpreter_fail (is); | ||
515 | } | ||
516 | |||
517 | |||
518 | void | ||
519 | GNUNET_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 | |||
527 | void | ||
528 | GNUNET_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 | */ | ||
550 | static void | ||
551 | do_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 | |||
563 | static void | ||
564 | setup_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 | |||
603 | struct GNUNET_TESTING_Interpreter * | ||
604 | GNUNET_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 | |||
625 | static struct GNUNET_TESTING_Interpreter * | ||
626 | start_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 | |||
678 | struct GNUNET_TESTING_PluginFunctions * | ||
679 | GNUNET_TESTING_make_plugin ( | ||
680 | const struct GNUNET_TESTING_Command *commands) | ||
681 | { | ||
682 | struct GNUNET_TESTING_PluginFunctions *api; | ||
683 | struct GNUNET_TESTING_Command *commands_copy; | ||
684 | unsigned int i; | ||
685 | |||
686 | for (i = 0; NULL != commands[i].run; i++) | ||
687 | ; | ||
688 | commands_copy = GNUNET_malloc_large ( (i + 1) | ||
689 | * sizeof (struct | ||
690 | GNUNET_TESTING_Command)); | ||
691 | memcpy (commands_copy, | ||
692 | commands, | ||
693 | sizeof (struct GNUNET_TESTING_Command) * i + 1); | ||
694 | |||
695 | api = GNUNET_new (struct GNUNET_TESTING_PluginFunctions); | ||
696 | api->cls = (void *) commands_copy; | ||
697 | api->start_testcase = &start_testcase; | ||
698 | return api; | ||
699 | } | ||
700 | |||
701 | |||
702 | void | ||
703 | GNUNET_TESTING_add_netjail_helper_ (struct GNUNET_TESTING_Interpreter *is, | ||
704 | struct GNUNET_HELPER_Handle *helper) | ||
705 | { | ||
706 | GNUNET_array_append (is->helpers, | ||
707 | is->n_helpers, | ||
708 | helper); | ||
709 | } | ||
710 | |||
711 | |||
712 | struct GNUNET_TESTING_Barrier * | ||
713 | GNUNET_TESTING_get_barrier2_ (struct GNUNET_TESTING_Interpreter *is, | ||
714 | const struct GNUNET_ShortHashCode *create_key) | ||
715 | { | ||
716 | return GNUNET_CONTAINER_multishortmap_get (is->barriers, | ||
717 | create_key); | ||
718 | } | ||
719 | |||
720 | |||
721 | struct GNUNET_TESTING_Barrier * | ||
722 | GNUNET_TESTING_get_barrier_ (struct GNUNET_TESTING_Interpreter *is, | ||
723 | const char *barrier_name) | ||
724 | { | ||
725 | struct GNUNET_ShortHashCode create_key; | ||
726 | |||
727 | if (NULL == is->barriers) | ||
728 | return NULL; | ||
729 | GNUNET_TESTING_barrier_name_hash_ (barrier_name, | ||
730 | &create_key); | ||
731 | return GNUNET_TESTING_get_barrier2_ (is, | ||
732 | &create_key); | ||
733 | } | ||
734 | |||
735 | |||
736 | void | ||
737 | GNUNET_TESTING_add_barrier_ (struct GNUNET_TESTING_Interpreter *is, | ||
738 | struct GNUNET_TESTING_Barrier *barrier) | ||
739 | { | ||
740 | if (NULL == is->barriers) | ||
741 | is->barriers | ||
742 | = GNUNET_CONTAINER_multishortmap_create (1, | ||
743 | true); | ||
744 | /* We always use the barrier we encountered | ||
745 | most recently under a given label, thus replace */ | ||
746 | (void) GNUNET_CONTAINER_multishortmap_put ( | ||
747 | is->barriers, | ||
748 | &barrier->barrier_id, | ||
749 | barrier, | ||
750 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE); | ||
751 | } | ||
752 | |||
753 | |||
754 | unsigned int | ||
755 | GNUNET_TESTING_barrier_count_ ( | ||
756 | struct GNUNET_TESTING_Interpreter *is) | ||
757 | { | ||
758 | return NULL != is->barriers ? GNUNET_CONTAINER_multishortmap_size (is->barriers) : 0; | ||
759 | } | ||
760 | |||
761 | |||
762 | void | ||
763 | GNUNET_TESTING_barrier_iterate_ ( | ||
764 | struct GNUNET_TESTING_Interpreter *is, | ||
765 | GNUNET_CONTAINER_ShortmapIterator cb, | ||
766 | void *cb_cls) | ||
767 | { | ||
768 | if (NULL != is->barriers) | ||
769 | GNUNET_CONTAINER_multishortmap_iterate (is->barriers, | ||
770 | cb, | ||
771 | cb_cls); | ||
772 | } | ||
773 | |||
774 | |||
775 | void | ||
776 | GNUNET_TESTING_interpreter_commands_iterate ( | ||
777 | struct GNUNET_TESTING_Interpreter *is, | ||
778 | bool asc, | ||
779 | GNUNET_TESTING_CommandIterator cb, | ||
780 | void *cb_cls) | ||
781 | { | ||
782 | unsigned int start; | ||
783 | unsigned int end; | ||
784 | int inc; | ||
785 | |||
786 | if (asc) | ||
787 | { | ||
788 | inc = 1; | ||
789 | start = 0; | ||
790 | end = is->ip; | ||
791 | } | ||
792 | else | ||
793 | { | ||
794 | inc = -1; | ||
795 | start = is->ip; | ||
796 | end = 0; | ||
797 | } | ||
798 | for (unsigned int off = start; off != end + inc; off += inc) | ||
799 | { | ||
800 | const struct GNUNET_TESTING_Command *cmd | ||
801 | = &is->commands[off]; | ||
802 | |||
803 | cb (cb_cls, | ||
804 | cmd); | ||
805 | } | ||
806 | } | ||
807 | |||
808 | |||
809 | void | ||
810 | GNUNET_TESTING_interpreter_current_cmd_touch ( | ||
811 | struct GNUNET_TESTING_Interpreter *is) | ||
812 | { | ||
813 | is->commands[is->ip].last_req_time | ||
814 | = GNUNET_TIME_absolute_get (); | ||
815 | } | ||
816 | |||
817 | |||
818 | void | ||
819 | GNUNET_TESTING_interpreter_current_cmd_inc_tries ( | ||
820 | struct GNUNET_TESTING_Interpreter *is) | ||
821 | { | ||
822 | is->commands[is->ip].num_tries++; | ||
823 | } | ||
824 | |||
825 | |||
826 | const char * | ||
827 | GNUNET_TESTING_interpreter_current_cmd_get_label ( | ||
828 | struct GNUNET_TESTING_Interpreter *is) | ||
829 | { | ||
830 | return is->commands[is->ip].label.value; | ||
831 | } | ||
832 | |||
833 | |||
834 | /** | ||
835 | * State for a "rewind" CMD. | ||
836 | */ | ||
837 | struct RewindIpState | ||
838 | { | ||
839 | /** | ||
840 | * Instruction pointer to set into the interpreter. | ||
841 | */ | ||
842 | const char *target_label; | ||
843 | |||
844 | /** | ||
845 | * How many times this set should take place. However, this value lives at | ||
846 | * the calling process, and this CMD is only in charge of checking and | ||
847 | * decremeting it. | ||
848 | */ | ||
849 | unsigned int counter; | ||
850 | }; | ||
851 | |||
852 | |||
853 | /** | ||
854 | * Seek for the @a target command in @a batch (and rewind to it | ||
855 | * if successful). | ||
856 | * | ||
857 | * @param is the interpreter state (for failures) | ||
858 | * @param cmd batch to search for @a target | ||
859 | * @param target command to search for | ||
860 | * @return #GNUNET_OK on success, #GNUNET_NO if target was not found, | ||
861 | * #GNUNET_SYSERR if target is in the future and we failed | ||
862 | */ | ||
863 | static enum GNUNET_GenericReturnValue | ||
864 | seek_batch (struct GNUNET_TESTING_Interpreter *is, | ||
865 | const struct GNUNET_TESTING_Command *cmd, | ||
866 | const struct GNUNET_TESTING_Command *target) | ||
867 | { | ||
868 | unsigned int new_ip; | ||
869 | struct GNUNET_TESTING_Command **batch; | ||
870 | const struct GNUNET_TESTING_Command *current; | ||
871 | const struct GNUNET_TESTING_Command *icmd; | ||
872 | bool found = false; | ||
873 | |||
874 | GNUNET_assert (GNUNET_OK == | ||
875 | GNUNET_TESTING_get_trait_cmd (cmd, | ||
876 | ¤t)); | ||
877 | GNUNET_assert (GNUNET_OK == | ||
878 | GNUNET_TESTING_get_trait_batch_cmds (cmd, | ||
879 | &batch)); | ||
880 | for (new_ip = 0; | ||
881 | NULL != (icmd = &((*batch)[new_ip]))->run; | ||
882 | new_ip++) | ||
883 | { | ||
884 | if (current == target) | ||
885 | current = NULL; | ||
886 | if (icmd == target) | ||
887 | { | ||
888 | found = true; | ||
889 | break; | ||
890 | } | ||
891 | if (GNUNET_TESTING_cmd_is_batch_ (icmd)) | ||
892 | { | ||
893 | enum GNUNET_GenericReturnValue ret | ||
894 | = seek_batch (is, | ||
895 | icmd, | ||
896 | target); | ||
897 | if (GNUNET_SYSERR == ret) | ||
898 | return GNUNET_SYSERR; /* failure! */ | ||
899 | if (GNUNET_OK == ret) | ||
900 | { | ||
901 | found = true; | ||
902 | break; | ||
903 | } | ||
904 | } | ||
905 | } | ||
906 | if (! found) | ||
907 | return GNUNET_NO; /* not found */ | ||
908 | if (NULL == current) | ||
909 | { | ||
910 | /* refuse to jump forward */ | ||
911 | GNUNET_break (0); | ||
912 | GNUNET_TESTING_interpreter_fail (is); | ||
913 | return GNUNET_SYSERR; | ||
914 | } | ||
915 | GNUNET_TESTING_cmd_batch_set_current_ (cmd, | ||
916 | new_ip); | ||
917 | return GNUNET_OK; | ||
918 | } | ||
919 | |||
920 | |||
921 | /** | ||
922 | * Run the "rewind" CMD. | ||
923 | * | ||
924 | * @param cls closure. | ||
925 | * @param cmd command being executed now. | ||
926 | * @param is the interpreter state. | ||
927 | */ | ||
928 | static void | ||
929 | rewind_ip_run (void *cls, | ||
930 | struct GNUNET_TESTING_Interpreter *is) | ||
931 | { | ||
932 | struct RewindIpState *ris = cls; | ||
933 | const struct GNUNET_TESTING_Command *target; | ||
934 | const struct GNUNET_TESTING_Command *icmd; | ||
935 | unsigned int new_ip; | ||
936 | bool found = false; | ||
937 | |||
938 | if (0 == ris->counter) | ||
939 | return; | ||
940 | target | ||
941 | = GNUNET_TESTING_interpreter_lookup_command (is, | ||
942 | ris->target_label); | ||
943 | if (NULL == target) | ||
944 | { | ||
945 | GNUNET_break (0); | ||
946 | GNUNET_TESTING_interpreter_fail (is); | ||
947 | return; | ||
948 | } | ||
949 | ris->counter--; | ||
950 | for (new_ip = 0; | ||
951 | NULL != (icmd = &is->commands[new_ip])->run; | ||
952 | new_ip++) | ||
953 | { | ||
954 | if (icmd == target) | ||
955 | { | ||
956 | found = true; | ||
957 | break; | ||
958 | } | ||
959 | if (GNUNET_TESTING_cmd_is_batch_ (icmd)) | ||
960 | { | ||
961 | enum GNUNET_GenericReturnValue ret | ||
962 | = seek_batch (is, | ||
963 | icmd, | ||
964 | target); | ||
965 | if (GNUNET_SYSERR == ret) | ||
966 | { | ||
967 | /* failure! */ | ||
968 | GNUNET_break (0); | ||
969 | GNUNET_TESTING_interpreter_fail (is); | ||
970 | return; | ||
971 | } | ||
972 | if (GNUNET_OK == ret) | ||
973 | { | ||
974 | /* counter subtraction below for batch */ | ||
975 | found = true; | ||
976 | break; | ||
977 | } | ||
978 | } | ||
979 | } | ||
980 | if (! found) | ||
981 | { | ||
982 | GNUNET_break (0); | ||
983 | GNUNET_TESTING_interpreter_fail (is); | ||
984 | return; | ||
985 | } | ||
986 | if (new_ip > (unsigned int) is->ip) | ||
987 | { | ||
988 | /* refuse to jump forward */ | ||
989 | GNUNET_break (0); | ||
990 | GNUNET_TESTING_interpreter_fail (is); | ||
991 | return; | ||
992 | } | ||
993 | is->ip = new_ip; | ||
994 | } | ||
995 | |||
996 | |||
997 | static void | ||
998 | rewind_ip_free (void *cls) | ||
999 | { | ||
1000 | struct RewindIpState *ris = cls; | ||
1001 | |||
1002 | GNUNET_free (ris); | ||
1003 | } | ||
1004 | |||
1005 | |||
1006 | struct GNUNET_TESTING_Command | ||
1007 | GNUNET_TESTING_cmd_rewind_ip (const char *label, | ||
1008 | const char *target_label, | ||
1009 | unsigned int counter) | ||
1010 | { | ||
1011 | struct RewindIpState *ris; | ||
1012 | |||
1013 | ris = GNUNET_new (struct RewindIpState); | ||
1014 | ris->target_label = target_label; | ||
1015 | ris->counter = counter; | ||
1016 | return GNUNET_TESTING_command_new (ris, | ||
1017 | label, | ||
1018 | &rewind_ip_run, | ||
1019 | &rewind_ip_free, | ||
1020 | NULL); | ||
1021 | } | ||
1022 | |||
1023 | |||
1024 | /* 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 | */ | ||
37 | typedef 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 | */ | ||
45 | struct 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 | */ | ||
85 | void | ||
86 | GNUNET_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 | */ | ||
97 | void | ||
98 | GNUNET_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 | */ | ||
106 | void | ||
107 | GNUNET_TESTING_interpreter_next_ (void *cls); | ||
108 | |||
109 | |||
110 | void | ||
111 | GNUNET_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 | */ | ||
121 | void | ||
122 | GNUNET_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 | */ | ||
134 | void | ||
135 | GNUNET_TESTING_add_barrier_ ( | ||
136 | struct GNUNET_TESTING_Interpreter *is, | ||
137 | struct GNUNET_TESTING_Barrier *barrier); | ||
138 | |||
139 | |||
140 | struct GNUNET_TESTING_Barrier * | ||
141 | GNUNET_TESTING_get_barrier2_ ( | ||
142 | struct GNUNET_TESTING_Interpreter *is, | ||
143 | const struct GNUNET_ShortHashCode *create_key); | ||
144 | |||
145 | |||
146 | struct GNUNET_TESTING_Barrier * | ||
147 | GNUNET_TESTING_get_barrier_ ( | ||
148 | struct GNUNET_TESTING_Interpreter *is, | ||
149 | const char *barrier_name); | ||
150 | |||
151 | |||
152 | unsigned int | ||
153 | GNUNET_TESTING_barrier_count_ ( | ||
154 | struct GNUNET_TESTING_Interpreter *is); | ||
155 | |||
156 | |||
157 | void | ||
158 | GNUNET_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 | */ | ||
36 | struct 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 | */ | ||
67 | static void | ||
68 | handle_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 | |||
93 | static void | ||
94 | do_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 | */ | ||
112 | static void | ||
113 | loop_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 | |||
126 | int | ||
127 | GNUNET_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..22cfd85fe --- /dev/null +++ b/src/lib/testing/testing_api_topology.c | |||
@@ -0,0 +1,1355 @@ | |||
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 | */ | ||
64 | static unsigned int | ||
65 | get_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 | */ | ||
92 | static char * | ||
93 | get_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? | ||
113 | static char * | ||
114 | get_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 | */ | ||
133 | static unsigned int | ||
134 | get_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 | */ | ||
163 | static char * | ||
164 | get_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 | */ | ||
203 | static struct GNUNET_TESTING_NodeConnection * | ||
204 | get_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 | */ | ||
312 | static void | ||
313 | node_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 | */ | ||
365 | static int | ||
366 | log_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 | */ | ||
412 | static int | ||
413 | log_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 | */ | ||
431 | static int | ||
432 | log_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 | */ | ||
459 | static void | ||
460 | get_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 | */ | ||
541 | struct GNUNET_TESTING_NetjailNode * | ||
542 | GNUNET_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 | */ | ||
563 | struct GNUNET_TESTING_NodeConnection * | ||
564 | GNUNET_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 | |||
581 | int | ||
582 | free_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 | |||
613 | int | ||
614 | free_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 | |||
629 | static int | ||
630 | free_value_cb (void *cls, | ||
631 | const struct GNUNET_ShortHashCode *key, | ||
632 | void *value) | ||
633 | { | ||
634 | (void) cls; | ||
635 | |||
636 | GNUNET_free (value); | ||
637 | |||
638 | return GNUNET_OK; | ||
639 | } | ||
640 | |||
641 | |||
642 | static int | ||
643 | free_subnets_cb (void *cls, | ||
644 | const struct GNUNET_ShortHashCode *key, | ||
645 | void *value) | ||
646 | { | ||
647 | (void) cls; | ||
648 | struct GNUNET_TESTING_NetjailSubnet *subnet = value; | ||
649 | |||
650 | GNUNET_CONTAINER_multishortmap_iterate (subnet->peers, | ||
651 | &free_value_cb, | ||
652 | NULL); | ||
653 | |||
654 | GNUNET_free (subnet); | ||
655 | |||
656 | return GNUNET_OK; | ||
657 | } | ||
658 | |||
659 | |||
660 | static int | ||
661 | free_carriers_cb (void *cls, | ||
662 | const struct GNUNET_ShortHashCode *key, | ||
663 | void *value) | ||
664 | { | ||
665 | (void) cls; | ||
666 | struct GNUNET_TESTING_NetjailCarrier *carrier = value; | ||
667 | |||
668 | GNUNET_CONTAINER_multishortmap_iterate (carrier->peers, | ||
669 | &free_value_cb, | ||
670 | NULL); | ||
671 | GNUNET_CONTAINER_multishortmap_iterate (carrier->subnets, | ||
672 | &free_subnets_cb, | ||
673 | NULL); | ||
674 | |||
675 | GNUNET_free (carrier); | ||
676 | |||
677 | return GNUNET_OK; | ||
678 | } | ||
679 | |||
680 | |||
681 | /** | ||
682 | * Deallocate memory of the struct GNUNET_TESTING_NetjailTopology. | ||
683 | * | ||
684 | * @param topology The GNUNET_TESTING_NetjailTopology to be deallocated. | ||
685 | */ | ||
686 | void | ||
687 | GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology) | ||
688 | { | ||
689 | GNUNET_CONTAINER_multishortmap_iterate (topology->backbone_peers, | ||
690 | &free_value_cb, | ||
691 | NULL); | ||
692 | GNUNET_CONTAINER_multishortmap_iterate (topology->carriers, | ||
693 | &free_carriers_cb, | ||
694 | NULL); | ||
695 | GNUNET_free (topology->plugin); | ||
696 | GNUNET_free (topology); | ||
697 | } | ||
698 | |||
699 | |||
700 | /** | ||
701 | * Deallocate memory of the struct GNUNET_TESTING_NetjailTopology. | ||
702 | * | ||
703 | * @param topology The GNUNET_TESTING_NetjailTopology to be deallocated. | ||
704 | * | ||
705 | void | ||
706 | GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology) | ||
707 | { | ||
708 | GNUNET_CONTAINER_multishortmap_iterate (topology->map_namespaces, | ||
709 | &free_namespaces_cb, | ||
710 | NULL); | ||
711 | GNUNET_CONTAINER_multishortmap_destroy (topology->map_namespaces); | ||
712 | GNUNET_CONTAINER_multishortmap_iterate (topology->map_globals, | ||
713 | &free_nodes_cb, | ||
714 | NULL); | ||
715 | GNUNET_CONTAINER_multishortmap_destroy (topology->map_globals); | ||
716 | GNUNET_free (topology->plugin); | ||
717 | GNUNET_free (topology); | ||
718 | }*/ | ||
719 | |||
720 | |||
721 | unsigned int | ||
722 | GNUNET_TESTING_calculate_num ( | ||
723 | struct GNUNET_TESTING_NodeConnection *node_connection, | ||
724 | struct GNUNET_TESTING_NetjailTopology *topology) | ||
725 | { | ||
726 | unsigned int n, m, num; | ||
727 | |||
728 | n = node_connection->namespace_n; | ||
729 | m = node_connection->node_n; | ||
730 | |||
731 | if (0 == n) | ||
732 | num = m; | ||
733 | else | ||
734 | num = (n - 1) * topology->nodes_m + m + topology->nodes_x; | ||
735 | |||
736 | return num; | ||
737 | } | ||
738 | |||
739 | |||
740 | /** | ||
741 | * Get the address for a specific communicator from a connection. | ||
742 | * | ||
743 | * @param connection The connection we like to have the address from. | ||
744 | * @param prefix The communicator protocol prefix. | ||
745 | * @return The address of the communicator. | ||
746 | */ | ||
747 | char * | ||
748 | GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection, | ||
749 | const char *prefix) | ||
750 | { | ||
751 | struct GNUNET_TESTING_NetjailNode *node; | ||
752 | char *addr; | ||
753 | char *template; | ||
754 | unsigned int node_n; | ||
755 | |||
756 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
757 | "get address prefix: %s node_n: %u\n", | ||
758 | prefix, | ||
759 | connection->node_n); | ||
760 | |||
761 | node = connection->node; | ||
762 | if (connection->namespace_n == node->namespace_n) | ||
763 | { | ||
764 | template = CONNECT_ADDRESS_TEMPLATE; | ||
765 | node_n = connection->node_n; | ||
766 | } | ||
767 | else if (0 == connection->namespace_n) | ||
768 | { | ||
769 | template = KNOWN_CONNECT_ADDRESS_TEMPLATE; | ||
770 | node_n = connection->node_n; | ||
771 | } | ||
772 | else if (1 == connection->node_n) | ||
773 | { | ||
774 | template = ROUTER_CONNECT_ADDRESS_TEMPLATE; | ||
775 | node_n = connection->namespace_n; | ||
776 | } | ||
777 | else | ||
778 | { | ||
779 | return NULL; | ||
780 | } | ||
781 | |||
782 | if (0 == strcmp (PREFIX_TCP, prefix) || | ||
783 | 0 == strcmp (PREFIX_UDP, prefix) || | ||
784 | 0 == strcmp (PREFIX_UDP_NATTED, prefix) || | ||
785 | 0 == strcmp (PREFIX_TCP_NATTED, prefix)) | ||
786 | { | ||
787 | GNUNET_asprintf (&addr, | ||
788 | template, | ||
789 | prefix, | ||
790 | node_n); | ||
791 | } | ||
792 | else | ||
793 | { | ||
794 | GNUNET_assert (0); | ||
795 | } | ||
796 | |||
797 | return addr; | ||
798 | } | ||
799 | |||
800 | |||
801 | /** | ||
802 | * Get the number of unintentional additional connections the node waits for. | ||
803 | * | ||
804 | * @param num The specific node we want the additional connects for. | ||
805 | * @return The number of additional connects | ||
806 | */ | ||
807 | unsigned int | ||
808 | GNUNET_TESTING_get_additional_connects (unsigned int num, | ||
809 | struct GNUNET_TESTING_NetjailTopology * | ||
810 | topology) | ||
811 | { | ||
812 | struct GNUNET_TESTING_NetjailNode *node; | ||
813 | struct GNUNET_TESTING_NetjailNamespace *namespace; | ||
814 | struct GNUNET_TESTING_NodeConnection *node_connections; | ||
815 | |||
816 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
817 | "get_additional_connects\n"); | ||
818 | |||
819 | get_node_info (num, topology, &node, &namespace, &node_connections); | ||
820 | |||
821 | if (NULL == node) | ||
822 | { | ||
823 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
824 | "No info found for node %d\n", num); | ||
825 | return 0; | ||
826 | } | ||
827 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
828 | "node additional_connects for node %p\n", | ||
829 | node); | ||
830 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
831 | "node additional_connects: %u\n", | ||
832 | node->additional_connects); | ||
833 | |||
834 | return node->additional_connects; | ||
835 | } | ||
836 | |||
837 | char * | ||
838 | GNUNET_TESTING_get_plugin_from_topo ( | ||
839 | struct GNUNET_TESTING_NetjailTopology *njt, | ||
840 | const char *my_node_id) | ||
841 | { | ||
842 | return njt->plugin; | ||
843 | } | ||
844 | |||
845 | |||
846 | static void | ||
847 | create_subnet_peers (struct GNUNET_CONFIGURATION_Handle *cfg, | ||
848 | struct GNUNET_TESTING_NetjailTopology *topology, | ||
849 | struct GNUNET_TESTING_NetjailSubnet *subnet) | ||
850 | { | ||
851 | struct GNUNET_HashCode hc; | ||
852 | subnet->peers = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
853 | |||
854 | for (int i = 1; i < subnet->number_peers; i++) | ||
855 | { | ||
856 | struct GNUNET_ShortHashCode hkey; | ||
857 | struct GNUNET_TESTING_NetjailSubnetPeer *subnet_peer = GNUNET_new (struct GNUNET_TESTING_NetjailSubnetPeer); | ||
858 | |||
859 | topology->total++; | ||
860 | GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc); | ||
861 | memcpy (&hkey, | ||
862 | &hc, | ||
863 | sizeof (hkey)); | ||
864 | GNUNET_CONTAINER_multishortmap_put (subnet->peers, | ||
865 | &hkey, | ||
866 | subnet_peer, | ||
867 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
868 | } | ||
869 | } | ||
870 | |||
871 | |||
872 | static void | ||
873 | create_subnets (struct GNUNET_CONFIGURATION_Handle *cfg, | ||
874 | struct GNUNET_TESTING_NetjailTopology *topology, | ||
875 | struct GNUNET_TESTING_NetjailCarrier *carrier) | ||
876 | { | ||
877 | struct GNUNET_HashCode hc; | ||
878 | carrier->subnets = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
879 | |||
880 | for (int i = 1; i < carrier->number_subnets; i++) | ||
881 | { | ||
882 | struct GNUNET_ShortHashCode hkey; | ||
883 | struct GNUNET_TESTING_NetjailSubnet *subnet = GNUNET_new (struct GNUNET_TESTING_NetjailSubnet); | ||
884 | char *section; | ||
885 | |||
886 | topology->total++; | ||
887 | subnet->number = topology->total; | ||
888 | subnet->index = i; | ||
889 | GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc); | ||
890 | memcpy (&hkey, | ||
891 | &hc, | ||
892 | sizeof (hkey)); | ||
893 | GNUNET_CONTAINER_multishortmap_put (carrier->subnets, | ||
894 | &hkey, | ||
895 | subnet, | ||
896 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
897 | GNUNET_asprintf (§ion, "CARRIER-%u-SUBNET-%u", carrier->index, i); | ||
898 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, | ||
899 | section, | ||
900 | "SUBNET_PEERS", | ||
901 | (unsigned long long *) &subnet->number_peers)) | ||
902 | { | ||
903 | subnet->number_peers = topology->default_subnet_peers; | ||
904 | } | ||
905 | |||
906 | create_subnet_peers (cfg, topology, subnet); | ||
907 | |||
908 | GNUNET_free (section); | ||
909 | } | ||
910 | } | ||
911 | |||
912 | |||
913 | static void | ||
914 | create_peers (struct GNUNET_CONFIGURATION_Handle *cfg, | ||
915 | struct GNUNET_TESTING_NetjailTopology *topology, | ||
916 | struct GNUNET_TESTING_NetjailCarrier *carrier) | ||
917 | { | ||
918 | struct GNUNET_HashCode hc; | ||
919 | carrier->peers = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
920 | |||
921 | for (int i = 1; i < carrier->number_peers; i++) | ||
922 | { | ||
923 | struct GNUNET_ShortHashCode hkey; | ||
924 | struct GNUNET_TESTING_NetjailCarrierPeer *peer = GNUNET_new (struct GNUNET_TESTING_NetjailCarrierPeer); | ||
925 | |||
926 | topology->total++; | ||
927 | peer->number = topology->total; | ||
928 | GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc); | ||
929 | memcpy (&hkey, | ||
930 | &hc, | ||
931 | sizeof (hkey)); | ||
932 | GNUNET_CONTAINER_multishortmap_put (carrier->peers, | ||
933 | &hkey, | ||
934 | peer, | ||
935 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
936 | //GNUNET_asprintf (§ion, "CARRIER-%u-PEER-%u", carrier->index, i); | ||
937 | } | ||
938 | } | ||
939 | |||
940 | |||
941 | struct GNUNET_TESTING_NetjailTopology * | ||
942 | GNUNET_TESTING_get_topo_from_string_ (const char *input) | ||
943 | { | ||
944 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
945 | struct GNUNET_TESTING_NetjailTopology *topology = GNUNET_new (struct GNUNET_TESTING_NetjailTopology); | ||
946 | topology->backbone_peers = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
947 | topology->carriers = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
948 | struct GNUNET_HashCode hc; | ||
949 | |||
950 | cfg = GNUNET_CONFIGURATION_create (); | ||
951 | GNUNET_assert (NULL != topology->carriers); | ||
952 | |||
953 | if (GNUNET_OK != | ||
954 | GNUNET_CONFIGURATION_deserialize (cfg, | ||
955 | input, | ||
956 | strlen (input), | ||
957 | NULL)) | ||
958 | { | ||
959 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
960 | _ ("Failed to parse configuration.\n")); | ||
961 | GNUNET_CONFIGURATION_destroy (cfg); | ||
962 | return NULL; | ||
963 | } | ||
964 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, | ||
965 | "DEFAULTS", | ||
966 | "SUBNETS", | ||
967 | &(topology->default_subnets))) | ||
968 | { | ||
969 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
970 | "Missing default SUBNETS!\n"); | ||
971 | return NULL; | ||
972 | } | ||
973 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, | ||
974 | "DEFAULTS", | ||
975 | "TESTBED_PLUGIN", | ||
976 | &topology->plugin)) | ||
977 | { | ||
978 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
979 | "Missing default TESTBED_PLUGIN!\n"); | ||
980 | return NULL; | ||
981 | } | ||
982 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, | ||
983 | "DEFAULTS", | ||
984 | "CARRIER_PEERS", | ||
985 | &(topology->default_carrier_peers))) | ||
986 | { | ||
987 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
988 | "Missing default CARRIER_PEERS!\n"); | ||
989 | return NULL; | ||
990 | } | ||
991 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, | ||
992 | "DEFAULTS", | ||
993 | "SUBNET_PEERS", | ||
994 | &(topology->default_subnet_peers))) | ||
995 | { | ||
996 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
997 | "Missing default SUBNET_PEERS!\n"); | ||
998 | return NULL; | ||
999 | } | ||
1000 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, | ||
1001 | "BACKBONE", | ||
1002 | "CARRIERS", | ||
1003 | &(topology->num_carriers))) | ||
1004 | { | ||
1005 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1006 | "No carrier configured!\n"); | ||
1007 | return NULL; | ||
1008 | } | ||
1009 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, | ||
1010 | "BACKBONE", | ||
1011 | "BACKBONE_PEERS", | ||
1012 | &(topology->num_backbone_peers))) | ||
1013 | { | ||
1014 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
1015 | "No backbone peers configured!\n"); | ||
1016 | return NULL; | ||
1017 | } | ||
1018 | for (int i = 0;i < topology->num_backbone_peers; i++) | ||
1019 | { | ||
1020 | struct GNUNET_TESTING_NetjailBackbonePeer *peer = GNUNET_new (struct GNUNET_TESTING_NetjailBackbonePeer); | ||
1021 | struct GNUNET_ShortHashCode hkey; | ||
1022 | |||
1023 | topology->total++; | ||
1024 | peer->number = topology->total; | ||
1025 | GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc); | ||
1026 | memcpy (&hkey, | ||
1027 | &hc, | ||
1028 | sizeof (hkey)); | ||
1029 | GNUNET_CONTAINER_multishortmap_put (topology->backbone_peers, | ||
1030 | &hkey, | ||
1031 | peer, | ||
1032 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
1033 | } | ||
1034 | GNUNET_assert (NULL != topology->carriers); | ||
1035 | for (int i = 0;i < topology->num_carriers; i++) | ||
1036 | { | ||
1037 | struct GNUNET_TESTING_NetjailCarrier *carrier = GNUNET_new (struct GNUNET_TESTING_NetjailCarrier); | ||
1038 | struct GNUNET_ShortHashCode hkey; | ||
1039 | char *section; | ||
1040 | |||
1041 | topology->total++; | ||
1042 | carrier->number = topology->total; | ||
1043 | GNUNET_CRYPTO_hash (&topology->total, sizeof(topology->total), &hc); | ||
1044 | memcpy (&hkey, | ||
1045 | &hc, | ||
1046 | sizeof (hkey)); | ||
1047 | GNUNET_assert (NULL != topology->carriers); | ||
1048 | GNUNET_CONTAINER_multishortmap_put (topology->carriers, | ||
1049 | &hkey, | ||
1050 | carrier, | ||
1051 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
1052 | GNUNET_asprintf (§ion, "CARRIER-%u", i); | ||
1053 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, | ||
1054 | section, | ||
1055 | "SUBNETS", | ||
1056 | (unsigned long long *) &carrier->number_subnets)) | ||
1057 | { | ||
1058 | carrier->number_subnets = topology->default_subnets; | ||
1059 | } | ||
1060 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, | ||
1061 | section, | ||
1062 | "CARRIER_PEERS", | ||
1063 | (unsigned long long *) &carrier->number_peers)) | ||
1064 | { | ||
1065 | carrier->number_peers = topology->default_carrier_peers; | ||
1066 | } | ||
1067 | create_peers (cfg, topology, carrier); | ||
1068 | create_subnets (cfg, topology, carrier); | ||
1069 | |||
1070 | GNUNET_free (section); | ||
1071 | } | ||
1072 | |||
1073 | GNUNET_free (cfg); | ||
1074 | |||
1075 | return topology; | ||
1076 | } | ||
1077 | |||
1078 | |||
1079 | /** | ||
1080 | * Parse the topology data. | ||
1081 | * | ||
1082 | * @param data The topology data. | ||
1083 | * @return The GNUNET_TESTING_NetjailTopology | ||
1084 | * | ||
1085 | struct GNUNET_TESTING_NetjailTopology * | ||
1086 | GNUNET_TESTING_get_topo_from_string_ (const char *input) | ||
1087 | { | ||
1088 | char *token; | ||
1089 | char *key = NULL; | ||
1090 | unsigned int out; | ||
1091 | char *rest = NULL; | ||
1092 | char *value = NULL; | ||
1093 | char *value2; | ||
1094 | char *data; | ||
1095 | int ret; | ||
1096 | struct GNUNET_TESTING_NetjailTopology *topo; | ||
1097 | struct GNUNET_TESTING_NetjailRouter *router; | ||
1098 | struct GNUNET_TESTING_NetjailNamespace *namespace; | ||
1099 | struct GNUNET_HashCode hc; | ||
1100 | |||
1101 | data = GNUNET_strdup (input); | ||
1102 | token = strtok_r (data, "\n", &rest); | ||
1103 | topo = GNUNET_new (struct GNUNET_TESTING_NetjailTopology); | ||
1104 | topo->map_namespaces = | ||
1105 | GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
1106 | topo->map_globals = | ||
1107 | GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
1108 | |||
1109 | while (NULL != token) | ||
1110 | { | ||
1111 | if (NULL != key) | ||
1112 | GNUNET_free (key); | ||
1113 | key = get_key (token); | ||
1114 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1115 | "In the loop with token: %s beginning with %s\n", | ||
1116 | token, | ||
1117 | key); | ||
1118 | if (0 == strcmp (key, "M")) | ||
1119 | { | ||
1120 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1121 | "Get first Value for M.\n"); | ||
1122 | out = get_first_value (token); | ||
1123 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1124 | "M: %u\n", | ||
1125 | out); | ||
1126 | topo->nodes_m = out; | ||
1127 | } | ||
1128 | else if (0 == strcmp (key, "N")) | ||
1129 | { | ||
1130 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1131 | "Get first Value for N.\n"); | ||
1132 | out = get_first_value (token); | ||
1133 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1134 | "N: %u\n", | ||
1135 | out); | ||
1136 | topo->namespaces_n = out; | ||
1137 | } | ||
1138 | else if (0 == strcmp (key, "X")) | ||
1139 | { | ||
1140 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1141 | "Get first Value for X.\n"); | ||
1142 | out = get_first_value (token); | ||
1143 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1144 | "X: %u\n", | ||
1145 | out); | ||
1146 | topo->nodes_x = out; | ||
1147 | } | ||
1148 | else if (0 == strcmp (key, "AC")) | ||
1149 | { | ||
1150 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1151 | "Get first Value for AC.\n"); | ||
1152 | out = get_first_value (token); | ||
1153 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1154 | "AC: %u\n", | ||
1155 | out); | ||
1156 | topo->additional_connects = out; | ||
1157 | } | ||
1158 | else if (0 == strcmp (key, "T")) | ||
1159 | { | ||
1160 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1161 | "Get first string value for T.\n"); | ||
1162 | value = get_first_string_value (token); | ||
1163 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1164 | "value: %s\n", | ||
1165 | value); | ||
1166 | topo->plugin = value; | ||
1167 | } | ||
1168 | else if (0 == strcmp (key, "K")) | ||
1169 | { | ||
1170 | struct GNUNET_ShortHashCode hkey_k; | ||
1171 | struct GNUNET_TESTING_NetjailNode *k_node = GNUNET_new (struct | ||
1172 | GNUNET_TESTING_NetjailNode); | ||
1173 | |||
1174 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1175 | "Get first Value for K.\n"); | ||
1176 | out = get_first_value (token); | ||
1177 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1178 | "K: %u\n", | ||
1179 | out); | ||
1180 | k_node->node_n = out; | ||
1181 | GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); | ||
1182 | memcpy (&hkey_k, | ||
1183 | &hc, | ||
1184 | sizeof (hkey_k)); | ||
1185 | k_node->is_global = GNUNET_YES; | ||
1186 | |||
1187 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( | ||
1188 | topo->map_globals, | ||
1189 | &hkey_k)) | ||
1190 | GNUNET_break (0); | ||
1191 | else | ||
1192 | GNUNET_CONTAINER_multishortmap_put (topo->map_globals, | ||
1193 | &hkey_k, | ||
1194 | k_node, | ||
1195 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
1196 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1197 | "Get value for key value on K.\n"); | ||
1198 | value = get_value ("plugin", token); | ||
1199 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1200 | "value: %s\n", | ||
1201 | value); | ||
1202 | k_node->plugin = value; | ||
1203 | parse_ac (k_node, token); | ||
1204 | node_connections (token, k_node); | ||
1205 | GNUNET_free (value); | ||
1206 | } | ||
1207 | else if (0 == strcmp (key, "R")) | ||
1208 | { | ||
1209 | struct GNUNET_ShortHashCode hkey_r; | ||
1210 | router = GNUNET_new (struct GNUNET_TESTING_NetjailRouter); | ||
1211 | |||
1212 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1213 | "Get first Value for R.\n"); | ||
1214 | out = get_first_value (token); | ||
1215 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1216 | "R: %u\n", | ||
1217 | out); | ||
1218 | GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); | ||
1219 | memcpy (&hkey_r, | ||
1220 | &hc, | ||
1221 | sizeof (hkey_r)); | ||
1222 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1223 | "Get value for key tcp_port on R.\n"); | ||
1224 | value = get_value ("tcp_port", token); | ||
1225 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1226 | "tcp_port: %s\n", | ||
1227 | value); | ||
1228 | ret = sscanf (value, "%u", &(router->tcp_port)); | ||
1229 | GNUNET_free (value); | ||
1230 | GNUNET_break (0 != ret && 1 >= router->tcp_port); | ||
1231 | |||
1232 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1233 | "Get value for key udp_port on R.\n"); | ||
1234 | value2 = get_value ("udp_port", token); | ||
1235 | ret = sscanf (value2, "%u", &(router->udp_port)); | ||
1236 | GNUNET_free (value2); | ||
1237 | GNUNET_break (0 != ret && 1 >= router->udp_port); | ||
1238 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1239 | "udp_port: %s\n", | ||
1240 | value2); | ||
1241 | GNUNET_free (value2); | ||
1242 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( | ||
1243 | topo->map_namespaces, | ||
1244 | &hkey_r)) | ||
1245 | { | ||
1246 | namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces, | ||
1247 | &hkey_r); | ||
1248 | } | ||
1249 | else | ||
1250 | { | ||
1251 | namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace); | ||
1252 | namespace->namespace_n = out; | ||
1253 | namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
1254 | GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces, | ||
1255 | &hkey_r, | ||
1256 | namespace, | ||
1257 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
1258 | } | ||
1259 | namespace->router = router; | ||
1260 | |||
1261 | } | ||
1262 | else if (0 == strcmp (key, "P")) | ||
1263 | { | ||
1264 | struct GNUNET_TESTING_NetjailNode *p_node = GNUNET_new (struct | ||
1265 | GNUNET_TESTING_NetjailNode); | ||
1266 | struct GNUNET_ShortHashCode hkey_p; | ||
1267 | |||
1268 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1269 | "Get first Value for P.\n"); | ||
1270 | out = get_first_value (token); | ||
1271 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1272 | "P: %u\n", | ||
1273 | out); | ||
1274 | GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); | ||
1275 | memcpy (&hkey_p, | ||
1276 | &hc, | ||
1277 | sizeof (hkey_p)); | ||
1278 | |||
1279 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( | ||
1280 | topo->map_namespaces, | ||
1281 | &hkey_p)) | ||
1282 | { | ||
1283 | namespace = GNUNET_CONTAINER_multishortmap_get (topo->map_namespaces, | ||
1284 | &hkey_p); | ||
1285 | } | ||
1286 | else | ||
1287 | { | ||
1288 | namespace = GNUNET_new (struct GNUNET_TESTING_NetjailNamespace); | ||
1289 | namespace->nodes = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO); | ||
1290 | namespace->namespace_n = out; | ||
1291 | GNUNET_CONTAINER_multishortmap_put (topo->map_namespaces, | ||
1292 | &hkey_p, | ||
1293 | namespace, | ||
1294 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
1295 | } | ||
1296 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1297 | "Get second Value for P.\n"); | ||
1298 | out = get_second_value (token); | ||
1299 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1300 | "P: %u\n", | ||
1301 | out); | ||
1302 | GNUNET_CRYPTO_hash (&out, sizeof(out), &hc); | ||
1303 | memcpy (&hkey_p, | ||
1304 | &hc, | ||
1305 | sizeof (hkey_p)); | ||
1306 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_contains ( | ||
1307 | namespace->nodes, | ||
1308 | &hkey_p)) | ||
1309 | { | ||
1310 | GNUNET_break (0); | ||
1311 | } | ||
1312 | else | ||
1313 | { | ||
1314 | |||
1315 | GNUNET_CONTAINER_multishortmap_put (namespace->nodes, | ||
1316 | &hkey_p, | ||
1317 | p_node, | ||
1318 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | ||
1319 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1320 | "Get value for key plugin on P.\n"); | ||
1321 | value = get_value ("plugin", token); | ||
1322 | if (NULL != value) | ||
1323 | { | ||
1324 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1325 | "plugin: %s\n", | ||
1326 | value); | ||
1327 | p_node->plugin = value; | ||
1328 | } | ||
1329 | p_node->node_n = out; | ||
1330 | p_node->namespace_n = namespace->namespace_n; | ||
1331 | } | ||
1332 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1333 | "Get AC Value for P.\n"); | ||
1334 | parse_ac (p_node, token); | ||
1335 | node_connections (token, p_node); | ||
1336 | } | ||
1337 | token = strtok_r (NULL, "\n", &rest); | ||
1338 | if (NULL != token) | ||
1339 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1340 | "Next token %s\n", | ||
1341 | token); | ||
1342 | } | ||
1343 | if (NULL != key) | ||
1344 | GNUNET_free (key); | ||
1345 | GNUNET_free (data); | ||
1346 | return topo; | ||
1347 | }*/ | ||
1348 | |||
1349 | |||
1350 | GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS ( | ||
1351 | GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, | ||
1352 | GNUNET_TESTING) | ||
1353 | |||
1354 | |||
1355 | /* end of netjail.c */ | ||
diff --git a/src/include/gnunet_testing_netjail_lib.h b/src/lib/testing/testing_api_topology.h index 843fce0d5..45afb9114 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 | */ | ||
216 | struct 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 | */ | ||
227 | struct 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 | */ | ||
238 | struct 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 | */ | ||
274 | struct 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 | */ | ||
300 | struct 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 | */ |
217 | struct GNUNET_TESTING_NetjailTopology | 311 | struct GNUNET_TESTING_NetjailTopology |
218 | { | 312 | { |
219 | 313 | ||
220 | /** | 314 | /** |
315 | * Default number of subnets per carrier. | ||
316 | */ | ||
317 | unsigned long long default_subnets; | ||
318 | |||
319 | /** | ||
320 | * Default number of peers per carrier. | ||
321 | */ | ||
322 | unsigned long long default_carrier_peers; | ||
323 | |||
324 | /** | ||
325 | * Default number of peers per subnet. | ||
326 | */ | ||
327 | unsigned long long 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 | * Default number of backbone peers. | ||
335 | */ | ||
336 | unsigned long long num_backbone_peers; | ||
337 | |||
338 | /** | ||
339 | * Number of carriers. | ||
340 | */ | ||
341 | unsigned long long num_carriers; | ||
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 | */ | ||
262 | struct GNUNET_TESTING_NetjailTopology * | ||
263 | GNUNET_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 | */ |
273 | struct GNUNET_TESTING_NetjailTopology * | 396 | struct GNUNET_TESTING_NetjailTopology * |
274 | GNUNET_TESTING_get_topo_from_string (const char *data); | 397 | GNUNET_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 | */ |
283 | unsigned int | 406 | unsigned int |
284 | GNUNET_TESTING_get_additional_connects (unsigned int num, | 407 | GNUNET_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 | */ |
307 | struct GNUNET_TESTING_NodeConnection * | 431 | struct GNUNET_TESTING_NodeConnection * |
308 | GNUNET_TESTING_get_connections (unsigned int num, | 432 | GNUNET_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 | */ |
319 | char * | 444 | char * |
320 | GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection, | 445 | GNUNET_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 | */ | ||
453 | char * | ||
454 | GNUNET_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 | */ |
329 | void | 464 | void |
330 | GNUNET_TESTING_free_topology (struct GNUNET_TESTING_NetjailTopology *topology); | 465 | GNUNET_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 | */ |
340 | unsigned int | 475 | unsigned int |
341 | GNUNET_TESTING_calculate_num (struct | 476 | GNUNET_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 | */ | ||
350 | struct 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 | */ | ||
372 | struct 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 | */ | ||
394 | struct GNUNET_TESTING_Command | ||
395 | GNUNET_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 | */ | ||
405 | struct GNUNET_TESTING_Command | ||
406 | GNUNET_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 | */ | ||
418 | struct GNUNET_TESTING_Command | ||
419 | GNUNET_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 | */ | ||
432 | struct GNUNET_TESTING_Command | ||
433 | GNUNET_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 | */ | ||
449 | struct GNUNET_TESTING_Command | ||
450 | GNUNET_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 | */ | ||
466 | struct GNUNET_TESTING_Command | ||
467 | GNUNET_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 | */ | ||
480 | struct GNUNET_TESTING_Command | ||
481 | GNUNET_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 | */ | ||
492 | struct GNUNET_TESTING_Command | ||
493 | GNUNET_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 | */ | ||
504 | struct GNUNET_TESTING_Command | ||
505 | GNUNET_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 | */ | ||
521 | struct GNUNET_TESTING_Command | ||
522 | GNUNET_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 | ||
543 | GNUNET_TESTING_SIMPLE_NETJAIL_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_TESTING) | 490 | GNUNET_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? */ | 32 | GNUNET_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, |
36 | 33 | GNUNET_TESTING) | |
37 | GNUNET_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_TESTING) | ||
38 | |||
39 | GNUNET_TESTING_INDEXED_TRAITS (GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT, GNUNET_TESTING) | ||
40 | |||
41 | GNUNET_TESTING_LOOP_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_TESTING) | ||
42 | |||
43 | GNUNET_TESTING_LOOP_INDEXED_TRAITS (GNUNET_TESTING_MAKE_IMPL_INDEXED_TRAIT, GNUNET_TESTING) | ||
44 | |||
45 | GNUNET_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..79876556b --- /dev/null +++ b/src/lib/testing/testing_cmds.h | |||
@@ -0,0 +1,109 @@ | |||
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 | #include "gnunet_common.h" | ||
31 | |||
32 | #define HELPER_CMDS_BINARY "gnunet-cmds-helper" | ||
33 | |||
34 | #define NETJAIL_EXEC_SCRIPT "netjail_exec.sh" | ||
35 | |||
36 | GNUNET_NETWORK_STRUCT_BEGIN | ||
37 | |||
38 | /** | ||
39 | * Initialization message for gnunet-cmds-testbed to start cmd binary. | ||
40 | */ | ||
41 | struct GNUNET_TESTING_CommandHelperInit | ||
42 | { | ||
43 | /** | ||
44 | * Type is #GNUNET_MESSAGE_TYPE_CMDS_HELPER_INIT | ||
45 | */ | ||
46 | struct GNUNET_MessageHeader header; | ||
47 | |||
48 | /** | ||
49 | * Number of barriers the helper inherits. | ||
50 | */ | ||
51 | uint32_t barrier_count GNUNET_PACKED; | ||
52 | |||
53 | /* Followed by barrier_count barrier hashes */ | ||
54 | |||
55 | /* Followed by topology data */ | ||
56 | }; | ||
57 | |||
58 | |||
59 | struct GNUNET_TESTING_CommandLocalFinished | ||
60 | { | ||
61 | /** | ||
62 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_FINISHED | ||
63 | */ | ||
64 | struct GNUNET_MessageHeader header; | ||
65 | |||
66 | /** | ||
67 | * The exit status local test return with in NBO. | ||
68 | */ | ||
69 | uint32_t rv GNUNET_PACKED; | ||
70 | }; | ||
71 | |||
72 | |||
73 | /** | ||
74 | * Child to parent: I reached the given barrier, | ||
75 | * increment the counter (or pass to grandparent). | ||
76 | */ | ||
77 | struct GNUNET_TESTING_CommandBarrierReached | ||
78 | { | ||
79 | struct GNUNET_MessageHeader header; | ||
80 | struct GNUNET_ShortHashCode barrier_key; | ||
81 | }; | ||
82 | |||
83 | |||
84 | /** | ||
85 | * Parent to child: you're inheriting a barrier. | ||
86 | * If the barrier was already satisfied, the parent | ||
87 | * must sent a separate barrier satisfied message. | ||
88 | */ | ||
89 | struct GNUNET_TESTING_CommandBarrierInherited | ||
90 | { | ||
91 | struct GNUNET_MessageHeader header; | ||
92 | struct GNUNET_ShortHashCode barrier_key; | ||
93 | }; | ||
94 | |||
95 | |||
96 | /** | ||
97 | * Parent to child: this barrier was satisfied. | ||
98 | */ | ||
99 | struct GNUNET_TESTING_CommandBarrierSatisfied | ||
100 | { | ||
101 | struct GNUNET_MessageHeader header; | ||
102 | struct GNUNET_ShortHashCode barrier_key; | ||
103 | }; | ||
104 | |||
105 | |||
106 | GNUNET_NETWORK_STRUCT_END | ||
107 | |||
108 | #endif | ||
109 | /* end of testing_cmds.h */ | ||
diff --git a/src/lib/util/Makefile.am b/src/lib/util/Makefile.am index 4d052c57b..38dd4c2ad 100644 --- a/src/lib/util/Makefile.am +++ b/src/lib/util/Makefile.am | |||
@@ -84,8 +84,7 @@ libgnunetutil_la_SOURCES = \ | |||
84 | mq.c \ | 84 | mq.c \ |
85 | nc.c \ | 85 | nc.c \ |
86 | network.c \ | 86 | network.c \ |
87 | nt.c \ | 87 | nt.c \ |
88 | op.c \ | ||
89 | os_installation.c \ | 88 | os_installation.c \ |
90 | os_network.c \ | 89 | os_network.c \ |
91 | os_priority.c \ | 90 | os_priority.c \ |
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 | */ | ||
59 | void * | 47 | void * |
60 | GNUNET_xmalloc_ (size_t size, const char *filename, int linenumber) | 48 | GNUNET_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 | */ | ||
91 | void ** | 72 | void ** |
92 | GNUNET_xnew_array_2d_ (size_t n, | 73 | GNUNET_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 | */ | ||
127 | void *** | 93 | void *** |
128 | GNUNET_xnew_array_3d_ (size_t n, | 94 | GNUNET_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 | */ | ||
191 | void * | 155 | void * |
192 | GNUNET_xmalloc_unchecked_ (size_t size, const char *filename, int linenumber) | 156 | GNUNET_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 | */ | ||
219 | void * | 174 | void * |
220 | GNUNET_xrealloc_ (void *ptr, size_t n, const char *filename, int linenumber) | 175 | GNUNET_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 | */ | ||
283 | void | 234 | void |
284 | GNUNET_xfree_ (void *ptr, | 235 | GNUNET_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 | */ | ||
315 | char * | 258 | char * |
316 | GNUNET_xstrdup_ (const char *str, const char *filename, int linenumber) | 259 | GNUNET_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 |
330 | static size_t | 280 | static size_t |
331 | strnlen (const char *s, size_t n) | 281 | strnlen (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 | */ | ||
354 | char * | 298 | char * |
355 | GNUNET_xstrndup_ (const char *str, | 299 | GNUNET_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 | */ | ||
385 | void | 321 | void |
386 | GNUNET_xgrow_ (void **old, | 322 | GNUNET_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 | */ | ||
428 | int | 363 | int |
429 | GNUNET_asprintf (char **buf, const char *format, ...) | 364 | GNUNET_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 | */ | ||
455 | int | 389 | int |
456 | GNUNET_snprintf (char *buf, size_t size, const char *format, ...) | 390 | GNUNET_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 | /** | 424 | bool |
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 | */ | ||
491 | enum GNUNET_GenericReturnValue | ||
492 | GNUNET_is_zero_ (const void *a, | 425 | GNUNET_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 | ||
414 | static void | ||
415 | buffer_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 | |||
414 | void | 429 | void |
415 | GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk) | 430 | GNUNET_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 | ||
421 | void | 436 | void |
422 | GNUNET_CRYPTO_ecdsa_key_clear (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk) | 437 | GNUNET_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 | ||
428 | void | 443 | void |
429 | GNUNET_CRYPTO_eddsa_key_clear (struct GNUNET_CRYPTO_EddsaPrivateKey *pk) | 444 | GNUNET_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_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 | ||
46 | void | ||
47 | GNUNET_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 | |||
46 | ssize_t | 63 | ssize_t |
47 | GNUNET_CRYPTO_private_key_get_length (const struct | 64 | GNUNET_CRYPTO_private_key_get_length (const struct |
48 | GNUNET_CRYPTO_PrivateKey *key) | 65 | GNUNET_CRYPTO_PrivateKey *key) |
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) | |||
612 | struct GNUNET_HELPER_SendHandle * | 612 | struct GNUNET_HELPER_SendHandle * |
613 | GNUNET_HELPER_send (struct GNUNET_HELPER_Handle *h, | 613 | GNUNET_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/op.c b/src/lib/util/op.c deleted file mode 100644 index a8fc3de4a..000000000 --- a/src/lib/util/op.c +++ /dev/null | |||
@@ -1,335 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2016 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 | ||
23 | * Asynchronous operations; register callbacks for operations and call them when a response arrives. | ||
24 | * | ||
25 | * @author Gabor X Toth | ||
26 | */ | ||
27 | |||
28 | #include "platform.h" | ||
29 | #include <inttypes.h> | ||
30 | |||
31 | |||
32 | #include "gnunet_util_lib.h" | ||
33 | |||
34 | #define LOG(kind, ...) GNUNET_log_from (kind, "util-op", __VA_ARGS__) | ||
35 | |||
36 | struct OperationListItem | ||
37 | { | ||
38 | struct OperationListItem *prev; | ||
39 | struct OperationListItem *next; | ||
40 | |||
41 | /** | ||
42 | * Operation ID. | ||
43 | */ | ||
44 | uint64_t op_id; | ||
45 | |||
46 | /** | ||
47 | * Continuation to invoke with the result of an operation. | ||
48 | */ | ||
49 | GNUNET_ResultCallback result_cb; | ||
50 | |||
51 | /** | ||
52 | * Closure for @a result_cb. | ||
53 | */ | ||
54 | void *cls; | ||
55 | |||
56 | /** | ||
57 | * User context. | ||
58 | */ | ||
59 | void *ctx; | ||
60 | }; | ||
61 | |||
62 | |||
63 | /** | ||
64 | * Operations handle. | ||
65 | */ | ||
66 | |||
67 | struct GNUNET_OP_Handle | ||
68 | { | ||
69 | /** | ||
70 | * First operation in the linked list. | ||
71 | */ | ||
72 | struct OperationListItem *op_head; | ||
73 | |||
74 | /** | ||
75 | * Last operation in the linked list. | ||
76 | */ | ||
77 | struct OperationListItem *op_tail; | ||
78 | |||
79 | /** | ||
80 | * Last operation ID used. | ||
81 | */ | ||
82 | uint64_t last_op_id; | ||
83 | }; | ||
84 | |||
85 | |||
86 | /** | ||
87 | * Create new operations handle. | ||
88 | */ | ||
89 | struct GNUNET_OP_Handle * | ||
90 | GNUNET_OP_create () | ||
91 | { | ||
92 | return GNUNET_new (struct GNUNET_OP_Handle); | ||
93 | } | ||
94 | |||
95 | |||
96 | /** | ||
97 | * Destroy operations handle. | ||
98 | */ | ||
99 | void | ||
100 | GNUNET_OP_destroy (struct GNUNET_OP_Handle *h) | ||
101 | { | ||
102 | GNUNET_free (h); | ||
103 | } | ||
104 | |||
105 | |||
106 | /** | ||
107 | * Get a unique operation ID to distinguish between asynchronous requests. | ||
108 | * | ||
109 | * @param h | ||
110 | * Operations handle. | ||
111 | * | ||
112 | * @return Operation ID to use. | ||
113 | */ | ||
114 | uint64_t | ||
115 | GNUNET_OP_get_next_id (struct GNUNET_OP_Handle *h) | ||
116 | { | ||
117 | return ++h->last_op_id; | ||
118 | } | ||
119 | |||
120 | |||
121 | /** | ||
122 | * Find operation by ID. | ||
123 | * | ||
124 | * @param h | ||
125 | * Operations handle. | ||
126 | * @param op_id | ||
127 | * Operation ID to look up. | ||
128 | * | ||
129 | * @return Operation, or NULL if not found. | ||
130 | */ | ||
131 | static struct OperationListItem * | ||
132 | op_find (struct GNUNET_OP_Handle *h, | ||
133 | uint64_t op_id) | ||
134 | { | ||
135 | struct OperationListItem *op; | ||
136 | |||
137 | for (op = h->op_head; NULL != op; op = op->next) | ||
138 | if (op->op_id == op_id) | ||
139 | return op; | ||
140 | return NULL; | ||
141 | } | ||
142 | |||
143 | |||
144 | /** | ||
145 | * Find operation by ID. | ||
146 | * | ||
147 | * @param h | ||
148 | * Operations handle. | ||
149 | * @param op_id | ||
150 | * Operation ID to look up. | ||
151 | * @param[out] result_cb | ||
152 | * If an operation was found, its result callback is returned here. | ||
153 | * @param[out] cls | ||
154 | * If an operation was found, its closure is returned here. | ||
155 | * @param[out] ctx | ||
156 | * If an operation was found, its user context is returned here. | ||
157 | * | ||
158 | * @return #GNUNET_YES if an operation was found, | ||
159 | * #GNUNET_NO if not found. | ||
160 | */ | ||
161 | int | ||
162 | GNUNET_OP_get (struct GNUNET_OP_Handle *h, | ||
163 | uint64_t op_id, | ||
164 | GNUNET_ResultCallback *result_cb, | ||
165 | void **cls, | ||
166 | void **ctx) | ||
167 | { | ||
168 | struct OperationListItem *op = op_find (h, op_id); | ||
169 | |||
170 | if (NULL != op) | ||
171 | { | ||
172 | if (NULL != result_cb) | ||
173 | *result_cb = op->result_cb; | ||
174 | if (NULL != cls) | ||
175 | *cls = op->cls; | ||
176 | if (NULL != ctx) | ||
177 | *ctx = op->ctx; | ||
178 | return GNUNET_YES; | ||
179 | } | ||
180 | return GNUNET_NO; | ||
181 | } | ||
182 | |||
183 | |||
184 | /** | ||
185 | * Add a new operation. | ||
186 | * | ||
187 | * @param h | ||
188 | * Operations handle. | ||
189 | * @param result_cb | ||
190 | * Function to call with the result of the operation. | ||
191 | * @param cls | ||
192 | * Closure for @a result_cb. | ||
193 | * @param ctx | ||
194 | * User context. | ||
195 | * | ||
196 | * @return ID of the new operation. | ||
197 | */ | ||
198 | uint64_t | ||
199 | GNUNET_OP_add (struct GNUNET_OP_Handle *h, | ||
200 | GNUNET_ResultCallback result_cb, | ||
201 | void *cls, | ||
202 | void *ctx) | ||
203 | { | ||
204 | struct OperationListItem *op; | ||
205 | |||
206 | op = GNUNET_new (struct OperationListItem); | ||
207 | op->op_id = GNUNET_OP_get_next_id (h); | ||
208 | op->result_cb = result_cb; | ||
209 | op->cls = cls; | ||
210 | op->ctx = ctx; | ||
211 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, | ||
212 | h->op_tail, | ||
213 | op); | ||
214 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
215 | "%p Added operation #%" PRIu64 "\n", | ||
216 | h, op->op_id); | ||
217 | return op->op_id; | ||
218 | } | ||
219 | |||
220 | |||
221 | /** | ||
222 | * Remove an operation, and call its result callback (unless it was cancelled). | ||
223 | * | ||
224 | * | ||
225 | * @param h | ||
226 | * Operations handle. | ||
227 | * @param op_id | ||
228 | * Operation ID. | ||
229 | * @param result_code | ||
230 | * Result of the operation. | ||
231 | * @param data | ||
232 | * Data result of the operation. | ||
233 | * @param data_size | ||
234 | * Size of @a data. | ||
235 | * @param[out] ctx | ||
236 | * User context. | ||
237 | * @param cancel | ||
238 | * Is the operation cancelled? | ||
239 | * #GNUNET_NO Not cancelled, result callback is called. | ||
240 | * #GNUNET_YES Cancelled, result callback is not called. | ||
241 | * | ||
242 | * @return #GNUNET_YES if the operation was found and removed, | ||
243 | * #GNUNET_NO if the operation was not found. | ||
244 | */ | ||
245 | static int | ||
246 | op_result (struct GNUNET_OP_Handle *h, | ||
247 | uint64_t op_id, | ||
248 | int64_t result_code, | ||
249 | const void *data, | ||
250 | uint16_t data_size, | ||
251 | void **ctx, | ||
252 | uint8_t cancel) | ||
253 | { | ||
254 | if (0 == op_id) | ||
255 | return GNUNET_NO; | ||
256 | |||
257 | struct OperationListItem *op = op_find (h, op_id); | ||
258 | if (NULL == op) | ||
259 | { | ||
260 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
261 | "Could not find operation #%" PRIu64 "\n", op_id); | ||
262 | return GNUNET_NO; | ||
263 | } | ||
264 | |||
265 | if (NULL != ctx) | ||
266 | *ctx = op->ctx; | ||
267 | |||
268 | GNUNET_CONTAINER_DLL_remove (h->op_head, | ||
269 | h->op_tail, | ||
270 | op); | ||
271 | |||
272 | if ((GNUNET_YES != cancel) && | ||
273 | (NULL != op->result_cb)) | ||
274 | op->result_cb (op->cls, | ||
275 | result_code, data, | ||
276 | data_size); | ||
277 | GNUNET_free (op); | ||
278 | return GNUNET_YES; | ||
279 | } | ||
280 | |||
281 | |||
282 | /** | ||
283 | * Call the result callback of an operation and remove it. | ||
284 | * | ||
285 | * @param h | ||
286 | * Operations handle. | ||
287 | * @param op_id | ||
288 | * Operation ID. | ||
289 | * @param result_code | ||
290 | * Result of the operation. | ||
291 | * @param data | ||
292 | * Data result of the operation. | ||
293 | * @param data_size | ||
294 | * Size of @a data. | ||
295 | * @param[out] ctx | ||
296 | * User context. | ||
297 | * | ||
298 | * @return #GNUNET_YES if the operation was found and removed, | ||
299 | * #GNUNET_NO if the operation was not found. | ||
300 | */ | ||
301 | int | ||
302 | GNUNET_OP_result (struct GNUNET_OP_Handle *h, | ||
303 | uint64_t op_id, | ||
304 | int64_t result_code, | ||
305 | const void *data, | ||
306 | uint16_t data_size, | ||
307 | void **ctx) | ||
308 | { | ||
309 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
310 | "%p Received result for operation #%" PRIu64 ": %" PRId64 " (size: %u)\n", | ||
311 | h, op_id, result_code, data_size); | ||
312 | return op_result (h, op_id, result_code, data, data_size, ctx, GNUNET_NO); | ||
313 | } | ||
314 | |||
315 | |||
316 | /** | ||
317 | * Remove / cancel an operation. | ||
318 | * | ||
319 | * @param h | ||
320 | * Operations handle. | ||
321 | * @param op_id | ||
322 | * Operation ID. | ||
323 | * | ||
324 | * @return #GNUNET_YES if the operation was found and removed, | ||
325 | * #GNUNET_NO if the operation was not found. | ||
326 | */ | ||
327 | int | ||
328 | GNUNET_OP_remove (struct GNUNET_OP_Handle *h, | ||
329 | uint64_t op_id) | ||
330 | { | ||
331 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
332 | "%p Cancelling operation #%" PRIu64 "\n", | ||
333 | h, op_id); | ||
334 | return op_result (h, op_id, 0, NULL, 0, NULL, GNUNET_YES); | ||
335 | } | ||
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 | */ |
361 | static int | 355 | static enum GNUNET_GenericReturnValue |
362 | have_non_monitor_clients (struct GNUNET_SERVICE_Handle *sh) | 356 | have_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 | */ |
382 | static void | 379 | static void |
383 | do_suspend (struct GNUNET_SERVICE_Handle *sh, enum SuspendReason sr) | 380 | do_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 | */ |
440 | static int | 438 | static bool |
441 | check_ipv4_listed (const struct GNUNET_STRINGS_IPv4NetworkPolicy *list, | 439 | check_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 | */ |
467 | static int | 461 | static bool |
468 | check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list, | 462 | check_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; | ||
476 | NEXT: | ||
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 | */ |
595 | static void | 588 | static void |
596 | service_mq_cancel (struct GNUNET_MQ_Handle *mq, void *impl_state) | 589 | service_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 | */ |
617 | static void | 611 | static void |
618 | service_mq_error_handler (void *cls, enum GNUNET_MQ_Error error) | 612 | service_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 | */ |
872 | static void | 876 | static void |
873 | do_resume (struct GNUNET_SERVICE_Handle *sh, enum SuspendReason sr) | 877 | do_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 | */ |
931 | static int | 936 | static enum GNUNET_GenericReturnValue |
932 | process_acl4 (struct GNUNET_STRINGS_IPv4NetworkPolicy **ret, | 937 | process_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 | */ |
972 | static int | 977 | static enum GNUNET_GenericReturnValue |
973 | process_acl6 (struct GNUNET_STRINGS_IPv6NetworkPolicy **ret, | 978 | process_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 | */ |
1460 | static int | 1465 | static enum GNUNET_GenericReturnValue |
1461 | setup_service (struct GNUNET_SERVICE_Handle *sh) | 1466 | setup_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 | */ |
1627 | static int | 1638 | static enum GNUNET_GenericReturnValue |
1628 | set_user_id (struct GNUNET_SERVICE_Handle *sh) | 1639 | set_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 | */ |
1716 | static int | 1729 | static enum GNUNET_GenericReturnValue |
1717 | detach_terminal (struct GNUNET_SERVICE_Handle *sh) | 1730 | detach_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 | */ |
1823 | static void | 1842 | static void |
1824 | return_agpl (void *cls, const struct GNUNET_MessageHeader *msg) | 1843 | return_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 | */ | ||
1879 | struct GNUNET_SERVICE_Handle * | 1866 | struct GNUNET_SERVICE_Handle * |
1880 | GNUNET_SERVICE_start (const char *service_name, | 1867 | GNUNET_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 | */ |
1902 | static void | ||
1903 | finish_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 | |||
1912 | void | 1937 | void |
1913 | GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv) | 1938 | GNUNET_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 | */ |
2143 | struct ServiceHandleList | 2186 | struct ServiceHandleList |
@@ -2153,10 +2196,11 @@ struct ServiceHandleList | |||
2153 | }; | 2196 | }; |
2154 | 2197 | ||
2155 | /* The service list */ | 2198 | /* The service list */ |
2156 | static struct ServiceHandleList *hll_head = NULL; | 2199 | static struct ServiceHandleList *hll_head; |
2157 | 2200 | ||
2158 | /* The service list */ | 2201 | /* The service list */ |
2159 | static struct ServiceHandleList *hll_tail = NULL; | 2202 | static struct ServiceHandleList *hll_tail; |
2203 | |||
2160 | 2204 | ||
2161 | int | 2205 | int |
2162 | GNUNET_SERVICE_register_ (const char *service_name, | 2206 | GNUNET_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 | ||
2192 | static void | 2237 | static void |
2193 | do_registered_services_shutdown (void *cls) | 2238 | do_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) | |||
2216 | static void | 2264 | static void |
2217 | launch_registered_services (void *cls) | 2265 | launch_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); | ||
2330 | shutdown: | 2391 | shutdown: |
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 | */ | ||
2346 | void | 2401 | void |
2347 | GNUNET_SERVICE_suspend (struct GNUNET_SERVICE_Handle *sh) | 2402 | GNUNET_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 | */ | ||
2358 | void | 2409 | void |
2359 | GNUNET_SERVICE_resume (struct GNUNET_SERVICE_Handle *sh) | 2410 | GNUNET_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 | */ | ||
2407 | void | 2454 | void |
2408 | GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c) | 2455 | GNUNET_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 | */ | ||
2431 | void | 2471 | void |
2432 | GNUNET_SERVICE_client_disable_continue_warning (struct GNUNET_SERVICE_Client *c) | 2472 | GNUNET_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 | */ | ||
2448 | static void | ||
2449 | finish_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 | */ | ||
2488 | void | 2483 | void |
2489 | GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c) | 2484 | GNUNET_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 | */ | ||
2547 | void | 2532 | void |
2548 | GNUNET_SERVICE_shutdown (struct GNUNET_SERVICE_Handle *sh) | 2533 | GNUNET_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 | */ | ||
2571 | void | 2548 | void |
2572 | GNUNET_SERVICE_client_mark_monitor (struct GNUNET_SERVICE_Client *c) | 2549 | GNUNET_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 | */ | ||
2588 | void | 2558 | void |
2589 | GNUNET_SERVICE_client_persist (struct GNUNET_SERVICE_Client *c) | 2559 | GNUNET_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 | */ | ||
2601 | struct GNUNET_MQ_Handle * | 2565 | struct GNUNET_MQ_Handle * |
2602 | GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c) | 2566 | GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c) |
2603 | { | 2567 | { |
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 | |||
103 | perf_plugin_datastore_heap_SOURCES = \ | 103 | perf_plugin_datastore_heap_SOURCES = \ |
104 | perf_plugin_datastore.c | 104 | perf_plugin_datastore.c |
105 | perf_plugin_datastore_heap_LDADD = \ | 105 | perf_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 | ||
109 | test_plugin_datastore_heap_SOURCES = \ | 108 | test_plugin_datastore_heap_SOURCES = \ |
110 | test_plugin_datastore.c | 109 | test_plugin_datastore.c |
111 | test_plugin_datastore_heap_LDADD = \ | 110 | test_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 | ||
116 | perf_plugin_datastore_sqlite_SOURCES = \ | 114 | perf_plugin_datastore_sqlite_SOURCES = \ |
117 | perf_plugin_datastore.c | 115 | perf_plugin_datastore.c |
118 | perf_plugin_datastore_sqlite_LDADD = \ | 116 | perf_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 | ||
122 | test_plugin_datastore_sqlite_SOURCES = \ | 119 | test_plugin_datastore_sqlite_SOURCES = \ |
123 | test_plugin_datastore.c | 120 | test_plugin_datastore.c |
124 | test_plugin_datastore_sqlite_LDADD = \ | 121 | test_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 | ||
129 | test_plugin_datastore_postgres_SOURCES = \ | 125 | test_plugin_datastore_postgres_SOURCES = \ |
130 | test_plugin_datastore.c | 126 | test_plugin_datastore.c |
131 | test_plugin_datastore_postgres_LDADD = \ | 127 | test_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 | ||
135 | perf_plugin_datastore_postgres_SOURCES = \ | 130 | perf_plugin_datastore_postgres_SOURCES = \ |
136 | perf_plugin_datastore.c | 131 | perf_plugin_datastore.c |
137 | perf_plugin_datastore_postgres_LDADD = \ | 132 | perf_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 = \ | |||
86 | test_plugin_namecache_flat_SOURCES = \ | 86 | test_plugin_namecache_flat_SOURCES = \ |
87 | test_plugin_namecache.c | 87 | test_plugin_namecache.c |
88 | test_plugin_namecache_flat_LDADD = \ | 88 | test_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 | ||
92 | test_plugin_namecache_sqlite_SOURCES = \ | 91 | test_plugin_namecache_sqlite_SOURCES = \ |
93 | test_plugin_namecache.c | 92 | test_plugin_namecache.c |
94 | test_plugin_namecache_sqlite_LDADD = \ | 93 | test_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 | ||
98 | test_plugin_namecache_postgres_SOURCES = \ | 96 | test_plugin_namecache_postgres_SOURCES = \ |
99 | test_plugin_namecache.c | 97 | test_plugin_namecache.c |
100 | test_plugin_namecache_postgres_LDADD = \ | 98 | test_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 | ||
104 | EXTRA_DIST = \ | 101 | EXTRA_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 = \ | |||
31 | test_plugin_peerstore_sqlite_SOURCES = \ | 31 | test_plugin_peerstore_sqlite_SOURCES = \ |
32 | test_plugin_peerstore.c | 32 | test_plugin_peerstore.c |
33 | test_plugin_peerstore_sqlite_LDADD = \ | 33 | test_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 | ||
37 | check_PROGRAMS = \ | 36 | check_PROGRAMS = \ |
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 @@ | |||
1 | SUBDIRS = \ | 1 | SUBDIRS = \ |
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 |
14 | endif | 14 | endif |
15 | 15 | ||
16 | lib_LTLIBRARIES = libgnunetarm.la | 16 | lib_LTLIBRARIES = \ |
17 | libgnunetarm.la \ | ||
18 | libgnunettestingarm.la | ||
17 | 19 | ||
18 | libgnunetarm_la_SOURCES = \ | 20 | libgnunetarm_la_SOURCES = \ |
19 | arm_api.c arm_monitor_api.c arm.h | 21 | arm_api.c \ |
22 | arm_monitor_api.c \ | ||
23 | arm.h | ||
20 | libgnunetarm_la_LIBADD = \ | 24 | libgnunetarm_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 | ||
31 | libgnunettestingarm_la_SOURCES = \ | ||
32 | testing_arm_cmd_start_peer.c \ | ||
33 | testing_arm_cmd_stop_peer.c \ | ||
34 | testing_arm_traits.c | ||
35 | libgnunettestingarm_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) | ||
42 | libgnunettestingarm_la_LDFLAGS = \ | ||
43 | $(GN_LIB_LDFLAGS) \ | ||
44 | -version-info 0:0:0 | ||
45 | |||
27 | 46 | ||
28 | noinst_PROGRAMS = \ | 47 | noinst_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 | */ |
349 | static int | 349 | static enum GNUNET_GenericReturnValue |
350 | check_arm_list_result (void *cls, | 350 | check_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 | */ |
518 | static int | 518 | static enum GNUNET_GenericReturnValue |
519 | reconnect_arm (struct GNUNET_ARM_Handle *h) | 519 | reconnect_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 | */ |
576 | struct GNUNET_ARM_Handle * | 576 | struct GNUNET_ARM_Handle * |
577 | GNUNET_ARM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | 577 | GNUNET_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 ("edbinary, | 714 | GNUNET_asprintf ("edbinary, |
@@ -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 | */ |
925 | struct GNUNET_ARM_Operation * | 933 | struct GNUNET_ARM_Operation * |
926 | GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, | 934 | GNUNET_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 | */ |
1037 | struct GNUNET_ARM_Operation * | 1046 | struct GNUNET_ARM_Operation * |
1038 | GNUNET_ARM_request_service_stop (struct GNUNET_ARM_Handle *h, | 1047 | GNUNET_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 | */ |
1072 | struct GNUNET_ARM_Operation * | 1082 | struct GNUNET_ARM_Operation * |
1073 | GNUNET_ARM_request_service_list (struct GNUNET_ARM_Handle *h, | 1083 | GNUNET_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 | */ | ||
37 | struct 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 | */ | ||
84 | static void | ||
85 | conn_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 | */ | ||
105 | static void | ||
106 | start_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 | */ | ||
219 | static void | ||
220 | start_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 | */ | ||
253 | static enum GNUNET_GenericReturnValue | ||
254 | start_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 | |||
276 | struct GNUNET_TESTING_Command | ||
277 | GNUNET_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 | */ | ||
37 | struct 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 | */ | ||
67 | static void | ||
68 | stop_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 | */ | ||
89 | static void | ||
90 | stop_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 | */ | ||
120 | static void | ||
121 | stop_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 | */ | ||
140 | static int | ||
141 | stop_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 | |||
158 | struct GNUNET_TESTING_Command | ||
159 | GNUNET_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 | ||
32 | GNUNET_TRANSPORT_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_TRANSPORT_TESTING) | 31 | |
32 | GNUNET_TESTING_ARM_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, | ||
33 | GNUNET_TESTING_ARM) | ||
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 | ||
60 | if false | ||
61 | |||
60 | testcadetlocalmq = executable ('test_cadet_local_mq', | 62 | testcadetlocalmq = 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) |
71 | test('test_cadet_local_mq', testcadetlocalmq, workdir: meson.current_build_dir(), suite: 'cadet') | 73 | test('test_cadet_local_mq', testcadetlocalmq, workdir: meson.current_build_dir(), suite: 'cadet') |
72 | 74 | ||
75 | |||
76 | endif \ 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 |
16 | endif | 16 | endif |
17 | 17 | ||
18 | plugin_LTLIBRARIES = \ | 18 | #plugin_LTLIBRARIES = \ |
19 | libgnunet_test_core_plugin_cmd_just_run.la | 19 | # libgnunet_test_core_plugin_cmd_just_run.la |
20 | |||
21 | TESTING_LIBS = \ | ||
22 | libgnunetcoretesting.la | ||
23 | 20 | ||
24 | lib_LTLIBRARIES = \ | 21 | lib_LTLIBRARIES = \ |
25 | libgnunetcore.la \ | 22 | libgnunetcore.la |
26 | $(TESTING_LIBS) | 23 | # libgnunettestingcore.la |
27 | 24 | ||
28 | libgnunetcore_la_SOURCES = \ | 25 | libgnunetcore_la_SOURCES = \ |
29 | core_api.c core.h \ | 26 | core_api.c core.h \ |
@@ -38,13 +35,13 @@ libgnunetcore_la_LDFLAGS = \ | |||
38 | libgnunet_test_core_plugin_cmd_just_run_la_SOURCES = \ | 35 | libgnunet_test_core_plugin_cmd_just_run_la_SOURCES = \ |
39 | test_core_plugin_cmd_just_run.c | 36 | test_core_plugin_cmd_just_run.c |
40 | libgnunet_test_core_plugin_cmd_just_run_la_LIBADD = \ | 37 | libgnunet_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 = \ | |||
52 | libgnunet_test_core_plugin_cmd_just_run_la_LDFLAGS = \ | 49 | libgnunet_test_core_plugin_cmd_just_run_la_LDFLAGS = \ |
53 | $(GN_PLUGIN_LDFLAGS) | 50 | $(GN_PLUGIN_LDFLAGS) |
54 | 51 | ||
55 | libgnunetcoretesting_la_SOURCES = \ | 52 | libgnunettestingcore_la_SOURCES = \ |
56 | core_api_cmd_connecting_peers.c | 53 | testing_core_cmd_connecting_peers.c |
57 | libgnunetcoretesting_la_LIBADD = \ | 54 | libgnunettestingcore_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 |
66 | libgnunetcoretesting_la_LDFLAGS = \ | 63 | libgnunettestingcore_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 | ||
88 | TESTING_TESTS = \ | 85 | #TESTING_TESTS = \ |
89 | test_core_api_send_to_self | 86 | # test_core_api_send_to_self |
90 | 87 | ||
91 | check_PROGRAMS = \ | 88 | check_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 |
107 | test_core_api_send_to_self_LDADD = \ | 104 | test_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 | ||
112 | test_core_api_start_only_SOURCES = \ | 109 | test_core_api_start_only_SOURCES = \ |
113 | test_core_api_start_only.c | 110 | test_core_api_start_only.c |
114 | test_core_api_start_only_LDADD = \ | 111 | test_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) | |||
31 | pkg.generate(libgnunetcore, url: 'https://www.gnunet.org', | 31 | pkg.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 | ||
34 | if false | ||
35 | |||
34 | libgnunetcoretesting = library('gnunetcoretesting', | 36 | libgnunetcoretesting = 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 | ||
70 | endif | ||
71 | |||
68 | executable ('gnunet-service-core', | 72 | executable ('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 | ||
94 | if false | ||
95 | |||
90 | testcore_api_send_self = executable ('test_core_api_send_to_self', | 96 | testcore_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()) |
112 | test('test_core_api_start_only', testcore_api_start, | 118 | test('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 | |||
121 | endif \ 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 |
277 | GNUNET_CORE_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_CORE_TESTING) | 276 | GNUNET_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 | |||
59 | test_datacache_sqlite_SOURCES = \ | 59 | test_datacache_sqlite_SOURCES = \ |
60 | test_datacache.c | 60 | test_datacache.c |
61 | test_datacache_sqlite_LDADD = \ | 61 | test_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 | ||
66 | test_datacache_quota_sqlite_SOURCES = \ | 65 | test_datacache_quota_sqlite_SOURCES = \ |
67 | test_datacache_quota.c | 66 | test_datacache_quota.c |
68 | test_datacache_quota_sqlite_LDADD = \ | 67 | test_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 | ||
73 | test_datacache_heap_SOURCES = \ | 71 | test_datacache_heap_SOURCES = \ |
74 | test_datacache.c | 72 | test_datacache.c |
75 | test_datacache_heap_LDADD = \ | 73 | test_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 | ||
80 | test_datacache_quota_heap_SOURCES = \ | 77 | test_datacache_quota_heap_SOURCES = \ |
81 | test_datacache_quota.c | 78 | test_datacache_quota.c |
82 | test_datacache_quota_heap_LDADD = \ | 79 | test_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 | ||
87 | test_datacache_postgres_SOURCES = \ | 83 | test_datacache_postgres_SOURCES = \ |
88 | test_datacache.c | 84 | test_datacache.c |
89 | test_datacache_postgres_LDADD = \ | 85 | test_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 | ||
94 | test_datacache_quota_postgres_SOURCES = \ | 89 | test_datacache_quota_postgres_SOURCES = \ |
95 | test_datacache_quota.c | 90 | test_datacache_quota.c |
96 | test_datacache_quota_postgres_LDADD = \ | 91 | test_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) |
61 | endif | 61 | endif |
62 | 62 | ||
63 | check_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 | ||
70 | if ENABLE_TEST_RUN | 70 | if ENABLE_TEST_RUN |
71 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 71 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; |
72 | TESTS = $(check_PROGRAMS) | 72 | TESTS = $(check_PROGRAMS) |
73 | endif | 73 | endif |
74 | 74 | ||
75 | test_datastore_api_heap_SOURCES = \ | 75 | test_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 | ||
41 | if false | ||
42 | |||
41 | testds_sqlite = executable ('test_store_api_sqlite', | 43 | testds_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 | ||
135 | endif | ||
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 45157243d..a27918fbe 100644 --- a/src/service/dht/meson.build +++ b/src/service/dht/meson.build | |||
@@ -54,6 +54,8 @@ executable ('gnunet-service-dht', | |||
54 | install: true, | 54 | install: true, |
55 | install_dir: get_option('libdir')/'gnunet'/'libexec') | 55 | install_dir: get_option('libdir')/'gnunet'/'libexec') |
56 | 56 | ||
57 | if false | ||
58 | |||
57 | libgnunettestingdhtu = library('gnunettestingdhtu', | 59 | libgnunettestingdhtu = library('gnunettestingdhtu', |
58 | ['testing_dhtu_cmd_send.c'], | 60 | ['testing_dhtu_cmd_send.c'], |
59 | soversion: '0', | 61 | soversion: '0', |
@@ -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 | |||
101 | endif \ 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 | |||
103 | check_PROGRAMS = \ | 121 | check_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 | ||
128 | if ENABLE_TEST_RUN | 130 | if ENABLE_TEST_RUN |
129 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 131 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; |
130 | TESTS = test_fs_directory \ | 132 | TESTS = $(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 | ||
141 | endif | 133 | endif |
142 | 134 | ||
143 | 135 | ||
diff --git a/src/service/gns/gns_tld_api.c b/src/service/gns/gns_tld_api.c index 63b5ac552..7a6864010 100644 --- a/src/service/gns/gns_tld_api.c +++ b/src/service/gns/gns_tld_api.c | |||
@@ -23,8 +23,8 @@ | |||
23 | * @author Martin Schanzenbach | 23 | * @author Martin Schanzenbach |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "gnunet_common.h" | ||
27 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_common.h" | ||
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_constants.h" | 29 | #include "gnunet_constants.h" |
30 | #include "gnunet_arm_service.h" | 30 | #include "gnunet_arm_service.h" |
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 | ||
47 | check_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 | ||
63 | EXTRA_DIST = \ | 63 | EXTRA_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 | ||
7 | subdir('util') | 7 | subdir('util') |
8 | subdir('statistics') | 8 | subdir('statistics') |
9 | # FIXME: subdir('testbed') | ||
9 | subdir('arm') | 10 | subdir('arm') |
10 | subdir('testing') | ||
11 | subdir('peerstore') | 11 | subdir('peerstore') |
12 | subdir('nat') | 12 | subdir('nat') |
13 | subdir('nat-auto') | 13 | subdir('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 | ||
24 | plugin_LTLIBRARIES = \ | 24 | #plugin_LTLIBRARIES = \ |
25 | libgnunet_test_messenger_plugin_cmd_simple_join.la | 25 | # libgnunet_test_messenger_plugin_cmd_simple_join.la |
26 | |||
27 | TESTING_LIBS = \ | ||
28 | libgnunetmessengertesting.la | ||
29 | 26 | ||
30 | lib_LTLIBRARIES = \ | 27 | lib_LTLIBRARIES = \ |
31 | libgnunetmessenger.la \ | 28 | libgnunetmessenger.la \ |
32 | $(EXP_LIB) \ | 29 | $(EXP_LIB) |
33 | $(TESTING_LIBS) | 30 | # libgnunettestingmessenger.la |
34 | 31 | ||
35 | libgnunetmessenger_la_SOURCES = \ | 32 | libgnunetmessenger_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 | ||
57 | libgnunetmessengertesting_la_SOURCES = \ | 54 | libgnunettestingmessenger_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 |
63 | libgnunetmessengertesting_la_LIBADD = \ | 60 | libgnunettestingmessenger_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 |
84 | libgnunet_test_messenger_plugin_cmd_simple_join_la_LIBADD = \ | 81 | libgnunet_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 | ||
133 | check_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 |
148 | test_messenger_api_LDADD = \ | 145 | test_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 | ||
153 | test_messenger_anonymous_SOURCES = \ | 150 | test_messenger_anonymous_SOURCES = \ |
154 | test_messenger_anonymous.c | 151 | test_messenger_anonymous.c |
155 | test_messenger_anonymous_LDADD = \ | 152 | test_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 | ||
160 | EXTRA_DIST = \ | 157 | EXTRA_DIST = \ |
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 | ||
34 | struct GNUNET_TESTING_Command | 32 | struct 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 df4499fe0..12a326202 100644 --- a/src/service/messenger/messenger_api.c +++ b/src/service/messenger/messenger_api.c | |||
@@ -745,25 +745,33 @@ dequeue_messages_from_room (struct GNUNET_MESSENGER_Room *room) | |||
745 | if (message) | 745 | if (message) |
746 | destroy_message (message); | 746 | destroy_message (message); |
747 | 747 | ||
748 | memset (&key, 0, sizeof(key)); | ||
748 | message = dequeue_from_messages (&(room->queue), &key, &transcript); | 749 | message = dequeue_from_messages (&(room->queue), &key, &transcript); |
749 | 750 | ||
750 | if (! message) | 751 | if (! message) |
751 | { | 752 | { |
752 | message = transcript; | 753 | message = transcript; |
754 | transcript = NULL; | ||
753 | continue; | 755 | continue; |
754 | } | 756 | } |
755 | 757 | ||
756 | send_message_to_room (room, message, &key, &hash); | 758 | send_message_to_room (room, message, &key, &hash); |
757 | 759 | ||
758 | if (! transcript) | 760 | if (! transcript) |
761 | { | ||
762 | GNUNET_CRYPTO_private_key_clear (&key); | ||
759 | continue; | 763 | continue; |
764 | } | ||
760 | 765 | ||
761 | 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)); | ||
762 | GNUNET_CRYPTO_key_get_public (&key, &pubkey); | 769 | GNUNET_CRYPTO_key_get_public (&key, &pubkey); |
763 | 770 | ||
764 | if (GNUNET_YES == encrypt_message (transcript, &pubkey)) | 771 | if (GNUNET_YES == encrypt_message (transcript, &pubkey)) |
765 | { | 772 | { |
766 | send_message_to_room (room, transcript, &key, &other); | 773 | send_message_to_room (room, transcript, &key, &other); |
774 | GNUNET_CRYPTO_private_key_clear (&key); | ||
767 | 775 | ||
768 | link_room_message (room, &hash, &other); | 776 | link_room_message (room, &hash, &other); |
769 | link_room_message (room, &other, &hash); | 777 | link_room_message (room, &other, &hash); |
@@ -773,6 +781,7 @@ dequeue_messages_from_room (struct GNUNET_MESSENGER_Room *room) | |||
773 | "Sending transcript aborted: Encryption failed!\n"); | 781 | "Sending transcript aborted: Encryption failed!\n"); |
774 | 782 | ||
775 | destroy_message (transcript); | 783 | destroy_message (transcript); |
784 | transcript = NULL; | ||
776 | } while (message); | 785 | } while (message); |
777 | 786 | ||
778 | return GNUNET_YES; | 787 | return GNUNET_YES; |
@@ -885,7 +894,9 @@ GNUNET_MESSENGER_set_key (struct GNUNET_MESSENGER_Handle *handle, | |||
885 | GNUNET_memcpy (&priv, key, sizeof (priv)); | 894 | GNUNET_memcpy (&priv, key, sizeof (priv)); |
886 | 895 | ||
887 | 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); |
888 | set_handle_key (handle, &priv); | 897 | GNUNET_CRYPTO_private_key_clear (&priv); |
898 | |||
899 | set_handle_key (handle, key); | ||
889 | return GNUNET_YES; | 900 | return GNUNET_YES; |
890 | } | 901 | } |
891 | 902 | ||
diff --git a/src/service/messenger/messenger_api_message.c b/src/service/messenger/messenger_api_message.c index 04234adb5..fa281cb37 100644 --- a/src/service/messenger/messenger_api_message.c +++ b/src/service/messenger/messenger_api_message.c | |||
@@ -32,7 +32,7 @@ | |||
32 | struct GNUNET_MESSENGER_MessageSignature | 32 | struct 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 | ||
38 | struct GNUNET_MESSENGER_ShortMessage | 38 | struct GNUNET_MESSENGER_ShortMessage |
@@ -964,7 +964,7 @@ sign_message (struct GNUNET_MESSENGER_Message *message, | |||
964 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); | 964 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); |
965 | signature.purpose.size = htonl (sizeof(signature)); | 965 | signature.purpose.size = htonl (sizeof(signature)); |
966 | 966 | ||
967 | GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); | 967 | GNUNET_memcpy (&(signature.hash), hash, sizeof(signature.hash)); |
968 | GNUNET_CRYPTO_sign (key, &signature, &(message->header.signature)); | 968 | GNUNET_CRYPTO_sign (key, &signature, &(message->header.signature)); |
969 | 969 | ||
970 | message->header.signature.type = key->type; | 970 | message->header.signature.type = key->type; |
@@ -991,8 +991,8 @@ sign_message_by_peer (struct GNUNET_MESSENGER_Message *message, | |||
991 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); | 991 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); |
992 | signature.purpose.size = htonl (sizeof(signature)); | 992 | signature.purpose.size = htonl (sizeof(signature)); |
993 | 993 | ||
994 | GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); | 994 | GNUNET_memcpy (&(signature.hash), hash, sizeof(signature.hash)); |
995 | GNUNET_CRYPTO_sign_by_peer_identity (cfg, &signature.purpose, | 995 | GNUNET_CRYPTO_sign_by_peer_identity (cfg, &(signature.purpose), |
996 | &(message->header.signature. | 996 | &(message->header.signature. |
997 | eddsa_signature)); | 997 | eddsa_signature)); |
998 | 998 | ||
@@ -1018,7 +1018,7 @@ verify_message (const struct GNUNET_MESSENGER_Message *message, | |||
1018 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); | 1018 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); |
1019 | signature.purpose.size = htonl (sizeof(signature)); | 1019 | signature.purpose.size = htonl (sizeof(signature)); |
1020 | 1020 | ||
1021 | GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); | 1021 | GNUNET_memcpy (&(signature.hash), hash, sizeof(signature.hash)); |
1022 | 1022 | ||
1023 | return GNUNET_CRYPTO_signature_verify ( | 1023 | return GNUNET_CRYPTO_signature_verify ( |
1024 | GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE, &signature, | 1024 | GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE, &signature, |
@@ -1041,10 +1041,10 @@ verify_message_by_peer (const struct GNUNET_MESSENGER_Message *message, | |||
1041 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); | 1041 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); |
1042 | signature.purpose.size = htonl (sizeof(signature)); | 1042 | signature.purpose.size = htonl (sizeof(signature)); |
1043 | 1043 | ||
1044 | GNUNET_memcpy (&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); | 1044 | GNUNET_memcpy (&(signature.hash), hash, sizeof(signature.hash)); |
1045 | 1045 | ||
1046 | return GNUNET_CRYPTO_verify_peer_identity ( | 1046 | return GNUNET_CRYPTO_verify_peer_identity ( |
1047 | GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE, &signature.purpose, | 1047 | GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE, &(signature.purpose), |
1048 | &(message->header.signature. | 1048 | &(message->header.signature. |
1049 | eddsa_signature), identity); | 1049 | eddsa_signature), identity); |
1050 | } | 1050 | } |
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 | ||
22 | if HAVE_SQLITE | 22 | if HAVE_SQLITE |
23 | check_PROGRAMS = \ | 23 | #check_PROGRAMS = \ |
24 | $(TESTING_TESTS) | 24 | # $(TESTING_TESTS) |
25 | endif | 25 | endif |
26 | 26 | ||
27 | if ENABLE_TEST_RUN | 27 | if 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 | |||
87 | endif | 87 | endif |
88 | endif | 88 | endif |
89 | 89 | ||
90 | check_PROGRAMS = \ | 90 | #check_PROGRAMS = \ |
91 | $(SQLITE_TESTS) \ | 91 | # $(SQLITE_TESTS) \ |
92 | $(POSTGRES_TESTS) | 92 | # $(POSTGRES_TESTS) |
93 | 93 | ||
94 | if ENABLE_TEST_RUN | 94 | if ENABLE_TEST_RUN |
95 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 95 | AM_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 448a9d2b3..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. |
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 | ||
56 | if false | ||
57 | |||
56 | namestoreapitestnames = [ | 58 | namestoreapitestnames = [ |
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 |
101 | endforeach | 103 | endforeach |
102 | 104 | ||
105 | endif | ||
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 00584ab8a..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 | */ |
1818 | static void | 1818 | static void |
1819 | handle_request_connection_reversal (void *cls, | 1819 | handle_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]; |
@@ -1871,47 +1870,29 @@ handle_request_connection_reversal (void *cls, | |||
1871 | * @param message the message received | 1870 | * @param message the message received |
1872 | * @return #GNUNET_OK if message is well-formed | 1871 | * @return #GNUNET_OK if message is well-formed |
1873 | */ | 1872 | */ |
1874 | static int | 1873 | static enum GNUNET_GenericReturnValue |
1875 | check_add_global_address(void *cls, | 1874 | check_add_global_address ( |
1876 | const struct GNUNET_NAT_AddGlobalAddressMessage *message) | 1875 | void *cls, |
1876 | const struct GNUNET_NAT_AddGlobalAddressMessage *message) | ||
1877 | { | 1877 | { |
1878 | char *addr = GNUNET_malloc (ntohs (message->address_length)); | 1878 | const char *buf = (const char *) &message[1]; |
1879 | uint16_t blen = ntohs (message->address_length); | ||
1879 | size_t left = ntohs (message->header.size) - sizeof(*message); | 1880 | size_t left = ntohs (message->header.size) - sizeof(*message); |
1880 | 1881 | ||
1881 | GNUNET_memcpy (addr, (const char *) &message[1], ntohs (message->address_length)); | ||
1882 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1883 | "message size %u natting address %s length %u left %u\n", | ||
1884 | ntohs (message->header.size), | ||
1885 | addr, | ||
1886 | ntohs (message->address_length), | ||
1887 | left); | ||
1888 | |||
1889 | if (left != ntohs (message->address_length)) | 1882 | if (left != ntohs (message->address_length)) |
1890 | { | 1883 | { |
1891 | GNUNET_break (0); | 1884 | GNUNET_break_op (0); |
1885 | return GNUNET_SYSERR; | ||
1886 | } | ||
1887 | if ('\0' != buf[blen - 1]) | ||
1888 | { | ||
1889 | GNUNET_break_op (0); | ||
1892 | return GNUNET_SYSERR; | 1890 | return GNUNET_SYSERR; |
1893 | } | 1891 | } |
1894 | GNUNET_free (addr); | ||
1895 | return GNUNET_OK; | 1892 | return GNUNET_OK; |
1896 | } | 1893 | } |
1897 | 1894 | ||
1898 | 1895 | ||
1899 | static int | ||
1900 | is_nat_v4 (const struct in_addr *ip); | ||
1901 | |||
1902 | |||
1903 | static int | ||
1904 | is_nat_v6 (const struct in6_addr *ip); | ||
1905 | |||
1906 | |||
1907 | static void | ||
1908 | notify_client (enum GNUNET_NAT_AddressClass ac, | ||
1909 | struct ClientHandle *ch, | ||
1910 | int add, | ||
1911 | const void *addr, | ||
1912 | size_t addr_len); | ||
1913 | |||
1914 | |||
1915 | /** | 1896 | /** |
1916 | * Handle #GNUNET_MESSAGE_TYPE_NAT_ADD_GLOBAL_ADDRESS message from | 1897 | * Handle #GNUNET_MESSAGE_TYPE_NAT_ADD_GLOBAL_ADDRESS message from |
1917 | * client. | 1898 | * client. |
@@ -1920,72 +1901,29 @@ notify_client (enum GNUNET_NAT_AddressClass ac, | |||
1920 | * @param message the message received | 1901 | * @param message the message received |
1921 | */ | 1902 | */ |
1922 | static void | 1903 | static void |
1923 | handle_add_global_address(void *cls, | 1904 | handle_add_global_address ( |
1924 | const struct GNUNET_NAT_AddGlobalAddressMessage *message) | 1905 | void *cls, |
1906 | const struct GNUNET_NAT_AddGlobalAddressMessage *message) | ||
1925 | { | 1907 | { |
1926 | struct ClientHandle *ch = cls; | 1908 | struct ClientHandle *ch = cls; |
1927 | char *buf = GNUNET_malloc (ntohs (message->address_length)); | 1909 | const char *buf = (const char *) &message[1]; |
1928 | //= (const char *) &message[1]; | 1910 | uint16_t blen = ntohs (message->address_length); |
1929 | struct sockaddr *sockaddr = NULL; | 1911 | struct sockaddr_in sockaddr_ipv4 = { |
1930 | socklen_t addr_len; | 1912 | .sin_family = AF_INET |
1931 | struct sockaddr_in *sockaddr_ipv4 = GNUNET_malloc(sizeof(struct sockaddr_in)); | 1913 | }; |
1932 | enum GNUNET_NAT_AddressClass ac; | 1914 | |
1933 | 1915 | GNUNET_assert ('\0' == buf[blen - 1]); | |
1934 | GNUNET_memcpy (buf, (const char *) &message[1], ntohs (message->address_length)); | 1916 | if (1 != inet_pton (AF_INET, |
1935 | memset(sockaddr_ipv4, 0, sizeof(struct sockaddr_in)); | 1917 | buf, |
1936 | sockaddr_ipv4->sin_family = AF_INET; | 1918 | &sockaddr_ipv4.sin_addr)) |
1937 | |||
1938 | if (1 == inet_pton(AF_INET, buf, &(sockaddr_ipv4->sin_addr))) | ||
1939 | { | ||
1940 | sockaddr = (struct sockaddr *)sockaddr_ipv4; | ||
1941 | addr_len = sizeof(struct sockaddr_in); | ||
1942 | ac = is_nat_v4 (&((const struct sockaddr_in *)sockaddr_ipv4)->sin_addr) | ||
1943 | ? GNUNET_NAT_AC_LAN | ||
1944 | : GNUNET_NAT_AC_EXTERN; | ||
1945 | } | ||
1946 | else | ||
1947 | { | ||
1948 | GNUNET_free(sockaddr_ipv4); | ||
1949 | sockaddr_ipv4 = NULL; | ||
1950 | } | ||
1951 | |||
1952 | if (NULL == sockaddr) | ||
1953 | { | ||
1954 | struct sockaddr_in6 *sockaddr_ipv6 = malloc(sizeof(struct sockaddr_in6)); | ||
1955 | |||
1956 | if (sockaddr_ipv6 != NULL) | ||
1957 | { | ||
1958 | memset(sockaddr_ipv6, 0, sizeof(struct sockaddr_in6)); | ||
1959 | sockaddr_ipv6->sin6_family = AF_INET6; | ||
1960 | |||
1961 | if (1 == inet_pton(AF_INET6, buf, &(sockaddr_ipv6->sin6_addr))) | ||
1962 | { | ||
1963 | GNUNET_break (0); | ||
1964 | GNUNET_SERVICE_client_continue (ch->client); | ||
1965 | GNUNET_free (buf); | ||
1966 | return; | ||
1967 | } | ||
1968 | else | ||
1969 | { | ||
1970 | GNUNET_free(sockaddr_ipv6); | ||
1971 | sockaddr_ipv6 = NULL; | ||
1972 | } | ||
1973 | } | ||
1974 | } | ||
1975 | |||
1976 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1977 | "3 natting address %s\n", | ||
1978 | buf); | ||
1979 | if (NULL == sockaddr) | ||
1980 | { | 1919 | { |
1981 | GNUNET_break (0); | 1920 | GNUNET_break (0); |
1982 | GNUNET_SERVICE_client_continue (ch->client); | 1921 | GNUNET_SERVICE_client_continue (ch->client); |
1983 | GNUNET_free (buf); | ||
1984 | return; | 1922 | return; |
1985 | } | 1923 | } |
1986 | notify_clients_stun_change (sockaddr_ipv4, GNUNET_YES); | 1924 | notify_clients_stun_change (&sockaddr_ipv4, |
1925 | GNUNET_YES); | ||
1987 | GNUNET_SERVICE_client_continue (ch->client); | 1926 | GNUNET_SERVICE_client_continue (ch->client); |
1988 | GNUNET_free (buf); | ||
1989 | } | 1927 | } |
1990 | 1928 | ||
1991 | 1929 | ||
diff --git a/src/service/nat/nat_api.c b/src/service/nat/nat_api.c index 219a11e81..52c74d5db 100644 --- a/src/service/nat/nat_api.c +++ b/src/service/nat/nat_api.c | |||
@@ -455,31 +455,6 @@ GNUNET_NAT_register (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
455 | return nh; | 455 | return nh; |
456 | } | 456 | } |
457 | 457 | ||
458 | |||
459 | /** | ||
460 | * Get the IP address without the port number. | ||
461 | * | ||
462 | * @param address The string contains a communicator prefix, IP address and port | ||
463 | * like this 'tcp-92.68.150.1:55452'. | ||
464 | * @return String with prefix and IP address only. | ||
465 | */ | ||
466 | static char * | ||
467 | get_address_without_port (const char *address) | ||
468 | { | ||
469 | const char *colon; | ||
470 | char *colon_rest; | ||
471 | size_t colon_rest_length; | ||
472 | char *address_without_port; | ||
473 | |||
474 | colon = strchr (address,':'); | ||
475 | colon_rest = GNUNET_strndup (address, colon - address); | ||
476 | colon_rest_length = strlen (colon_rest); | ||
477 | address_without_port = GNUNET_strndup (&colon_rest[4], colon_rest_length - 4); | ||
478 | GNUNET_free (colon_rest); | ||
479 | |||
480 | return address_without_port; | ||
481 | } | ||
482 | |||
483 | void | 458 | void |
484 | GNUNET_NAT_add_global_address (struct GNUNET_NAT_Handle *nh, | 459 | GNUNET_NAT_add_global_address (struct GNUNET_NAT_Handle *nh, |
485 | char *addr, | 460 | char *addr, |
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 | |||
49 | endif | 49 | endif |
50 | 50 | ||
51 | check_PROGRAMS = \ | 51 | check_PROGRAMS = \ |
52 | test_nse_api \ | 52 | perf_kdf |
53 | perf_kdf \ | 53 | # test_nse_api \ |
54 | $(MULTIPEER_TEST) | 54 | # $(MULTIPEER_TEST) |
55 | 55 | ||
56 | if ENABLE_TEST_RUN | 56 | if ENABLE_TEST_RUN |
57 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 57 | 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/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 | ||
44 | check_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 | ||
50 | EXTRA_DIST = \ | 50 | EXTRA_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 5d0f037a1..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 | |||
495 | static void | ||
496 | destroy_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 | ||
@@ -1098,7 +1105,7 @@ client_disconnect_cb (void *cls, | |||
1098 | while (NULL != (iter = pc->op_head)) | 1105 | while (NULL != (iter = pc->op_head)) |
1099 | { | 1106 | { |
1100 | GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, iter); | 1107 | GNUNET_CONTAINER_DLL_remove (pc->op_head, pc->op_tail, iter); |
1101 | GNUNET_free (iter); | 1108 | destroy_iteration (iter); |
1102 | } | 1109 | } |
1103 | GNUNET_free (pc); | 1110 | GNUNET_free (pc); |
1104 | } | 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 | ||
41 | if false | ||
42 | |||
41 | testpeerstore_api_iterate = executable ('test_peerstore_api_iterate', | 43 | testpeerstore_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, | |||
90 | test('perf_peerstore_api_store', testpeerstore_api_perf, | 92 | test('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 | 95 | endif \ 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 898d58a2c..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" |
@@ -455,7 +453,7 @@ GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h) | |||
455 | /******************************************************************************/ | 453 | /******************************************************************************/ |
456 | 454 | ||
457 | static void | 455 | static void |
458 | destroy_storecontext(struct GNUNET_PEERSTORE_StoreContext *sc) | 456 | destroy_storecontext (struct GNUNET_PEERSTORE_StoreContext *sc) |
459 | { | 457 | { |
460 | GNUNET_CONTAINER_DLL_remove (sc->h->store_head, sc->h->store_tail, sc); | 458 | GNUNET_CONTAINER_DLL_remove (sc->h->store_head, sc->h->store_tail, sc); |
461 | GNUNET_free (sc->sub_system); | 459 | GNUNET_free (sc->sub_system); |
@@ -464,6 +462,7 @@ destroy_storecontext(struct GNUNET_PEERSTORE_StoreContext *sc) | |||
464 | GNUNET_free (sc); | 462 | GNUNET_free (sc); |
465 | } | 463 | } |
466 | 464 | ||
465 | |||
467 | /** | 466 | /** |
468 | * Cancel a store request | 467 | * Cancel a store request |
469 | * | 468 | * |
@@ -475,7 +474,7 @@ GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc) | |||
475 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 474 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
476 | "store cancel with sc %p \n", | 475 | "store cancel with sc %p \n", |
477 | sc); | 476 | sc); |
478 | destroy_storecontext(sc); | 477 | destroy_storecontext (sc); |
479 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 478 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
480 | "store cancel with sc %p is null\n", | 479 | "store cancel with sc %p is null\n", |
481 | sc); | 480 | sc); |
@@ -591,7 +590,7 @@ handle_store_result (void *cls, const struct PeerstoreResultMessage *msg) | |||
591 | /******************************************************************************/ | 590 | /******************************************************************************/ |
592 | 591 | ||
593 | static void | 592 | static void |
594 | destroy_iteratecontext(struct GNUNET_PEERSTORE_IterateContext *ic) | 593 | destroy_iteratecontext (struct GNUNET_PEERSTORE_IterateContext *ic) |
595 | { | 594 | { |
596 | GNUNET_CONTAINER_DLL_remove (ic->h->iterate_head, ic->h->iterate_tail, ic); | 595 | GNUNET_CONTAINER_DLL_remove (ic->h->iterate_head, ic->h->iterate_tail, ic); |
597 | GNUNET_free (ic->sub_system); | 596 | GNUNET_free (ic->sub_system); |
diff --git a/src/service/peerstore/peerstore_api_monitor.c b/src/service/peerstore/peerstore_api_monitor.c index da5af3c86..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 | ||
239 | struct GNUNET_PEERSTORE_Monitor * | 238 | struct GNUNET_PEERSTORE_Monitor * |
240 | GNUNET_PEERSTORE_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | 239 | GNUNET_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 | ||
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 |
38 | endif | 38 | endif |
39 | 39 | ||
40 | check_PROGRAMS = $(VPN_TEST) | 40 | # check_PROGRAMS = $(VPN_TEST) |
41 | 41 | ||
42 | if ENABLE_TEST_RUN | 42 | if ENABLE_TEST_RUN |
43 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 43 | AM_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 |
61 | test_gns_vpn_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) | 61 | test_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 |
65 | test_gnunet_vpn_4_over_LDADD = $(MHD_LIBS) @LIBCURL@ \ | 65 | test_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 |
69 | test_gnunet_vpn_4_over_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) | 69 | test_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 |
73 | test_gnunet_vpn_6_over_LDADD = $(MHD_LIBS) @LIBCURL@ \ | 73 | test_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 |
77 | test_gnunet_vpn_6_over_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) | 77 | test_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 |
81 | test_gnunet_vpn_4_to_6_LDADD = $(MHD_LIBS) @LIBCURL@ \ | 81 | test_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 |
85 | test_gnunet_vpn_4_to_6_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) | 85 | test_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 |
89 | test_gnunet_vpn_6_to_4_LDADD = $(MHD_LIBS) @LIBCURL@ \ | 89 | test_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 |
93 | test_gnunet_vpn_6_to_4_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) | 93 | test_gnunet_vpn_6_to_4_CFLAGS = $(MHD_CFLAGS) @LIBCURL_CPPFLAGS@ $(AM_CFLAGS) |
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 \ | |||
75 | gnunet_daemon_regexprofiler_LDFLAGS = \ | 75 | gnunet_daemon_regexprofiler_LDFLAGS = \ |
76 | $(GN_LIBINTL) | 76 | $(GN_LIBINTL) |
77 | 77 | ||
78 | check_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 | ||
86 | if ENABLE_TEST_RUN | 86 | if 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/oidc_helper.c b/src/service/rest/oidc_helper.c index c0b2459f6..08c99dc8b 100644 --- a/src/service/rest/oidc_helper.c +++ b/src/service/rest/oidc_helper.c | |||
@@ -27,6 +27,8 @@ | |||
27 | #include <inttypes.h> | 27 | #include <inttypes.h> |
28 | #include <jansson.h> | 28 | #include <jansson.h> |
29 | #include <jose/jose.h> | 29 | #include <jose/jose.h> |
30 | #include "gnunet_gns_service.h" | ||
31 | #include "gnunet_gnsrecord_lib.h" | ||
30 | #include "gnunet_util_lib.h" | 32 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_reclaim_lib.h" | 33 | #include "gnunet_reclaim_lib.h" |
32 | #include "gnunet_reclaim_service.h" | 34 | #include "gnunet_reclaim_service.h" |
@@ -587,7 +589,8 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_PrivateKey *issuer, | |||
587 | /** PLAINTEXT **/ | 589 | /** PLAINTEXT **/ |
588 | // Assign ticket | 590 | // Assign ticket |
589 | memset (¶ms, 0, sizeof(params)); | 591 | memset (¶ms, 0, sizeof(params)); |
590 | params.ticket = *ticket; | 592 | memcpy (params.ticket.gns_name, ticket->gns_name, strlen (ticket->gns_name) |
593 | + 1); | ||
591 | // Assign nonce | 594 | // Assign nonce |
592 | payload_len = sizeof(struct OIDC_Parameters); | 595 | payload_len = sizeof(struct OIDC_Parameters); |
593 | if ((NULL != nonce_str) && (strcmp ("", nonce_str) != 0)) | 596 | if ((NULL != nonce_str) && (strcmp ("", nonce_str) != 0)) |
@@ -756,7 +759,7 @@ OIDC_parse_authz_code (const char *rp_uri, | |||
756 | struct GNUNET_RECLAIM_AttributeList **attrs, | 759 | struct GNUNET_RECLAIM_AttributeList **attrs, |
757 | struct GNUNET_RECLAIM_PresentationList **presentations, | 760 | struct GNUNET_RECLAIM_PresentationList **presentations, |
758 | char **nonce_str, | 761 | char **nonce_str, |
759 | enum OIDC_VerificationOptions opts) | 762 | enum OIDC_VerificationOptions opts, char **emsg) |
760 | { | 763 | { |
761 | char *code_payload; | 764 | char *code_payload; |
762 | char *ptr; | 765 | char *ptr; |
@@ -766,6 +769,7 @@ OIDC_parse_authz_code (const char *rp_uri, | |||
766 | char *code_challenge; | 769 | char *code_challenge; |
767 | struct GNUNET_CRYPTO_EccSignaturePurpose *purpose; | 770 | struct GNUNET_CRYPTO_EccSignaturePurpose *purpose; |
768 | struct GNUNET_CRYPTO_Signature *signature; | 771 | struct GNUNET_CRYPTO_Signature *signature; |
772 | struct GNUNET_CRYPTO_PublicKey iss; | ||
769 | uint32_t code_challenge_len; | 773 | uint32_t code_challenge_len; |
770 | uint32_t attrs_ser_len; | 774 | uint32_t attrs_ser_len; |
771 | uint32_t pres_ser_len; | 775 | uint32_t pres_ser_len; |
@@ -774,6 +778,8 @@ OIDC_parse_authz_code (const char *rp_uri, | |||
774 | uint32_t nonce_len = 0; | 778 | uint32_t nonce_len = 0; |
775 | struct OIDC_Parameters *params; | 779 | struct OIDC_Parameters *params; |
776 | 780 | ||
781 | |||
782 | GNUNET_GNS_parse_ztld (ticket->gns_name, &iss); | ||
777 | 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); |
778 | code_payload = NULL; | 784 | code_payload = NULL; |
779 | code_payload_len = | 785 | code_payload_len = |
@@ -807,6 +813,8 @@ OIDC_parse_authz_code (const char *rp_uri, | |||
807 | code_challenge_len, | 813 | code_challenge_len, |
808 | code_verifier)) | 814 | code_verifier)) |
809 | { | 815 | { |
816 | GNUNET_asprintf (emsg, "Code verifier `%s' invalid for challenge `%s'", | ||
817 | code_verifier, code_challenge); | ||
810 | GNUNET_free (code_payload); | 818 | GNUNET_free (code_payload); |
811 | return GNUNET_SYSERR; | 819 | return GNUNET_SYSERR; |
812 | } | 820 | } |
@@ -828,12 +836,13 @@ OIDC_parse_authz_code (const char *rp_uri, | |||
828 | GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN, | 836 | GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN, |
829 | purpose, | 837 | purpose, |
830 | signature, | 838 | signature, |
831 | cid)) | 839 | &iss)) |
832 | { | 840 | { |
833 | GNUNET_free (code_payload); | 841 | GNUNET_free (code_payload); |
834 | if (NULL != *nonce_str) | 842 | if (NULL != *nonce_str) |
835 | GNUNET_free (*nonce_str); | 843 | GNUNET_free (*nonce_str); |
836 | 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"); | ||
837 | return GNUNET_SYSERR; | 846 | return GNUNET_SYSERR; |
838 | } | 847 | } |
839 | // Attributes | 848 | // Attributes |
@@ -899,6 +908,7 @@ OIDC_access_token_new (const struct GNUNET_RECLAIM_Ticket *ticket, | |||
899 | sizeof(*ticket), | 908 | sizeof(*ticket), |
900 | &tkt_b64); | 909 | &tkt_b64); |
901 | GNUNET_asprintf (&access_token, "%s-%s", tkt_b64, rp_uri); | 910 | GNUNET_asprintf (&access_token, "%s-%s", tkt_b64, rp_uri); |
911 | GNUNET_free (tkt_b64); | ||
902 | return access_token; | 912 | return access_token; |
903 | } | 913 | } |
904 | 914 | ||
diff --git a/src/service/rest/oidc_helper.h b/src/service/rest/oidc_helper.h index 1732a044b..d706daa6b 100644 --- a/src/service/rest/oidc_helper.h +++ b/src/service/rest/oidc_helper.h | |||
@@ -138,7 +138,7 @@ OIDC_parse_authz_code (const char *rp_uri, | |||
138 | struct GNUNET_RECLAIM_AttributeList **attrs, | 138 | struct GNUNET_RECLAIM_AttributeList **attrs, |
139 | struct GNUNET_RECLAIM_PresentationList **presentations, | 139 | struct GNUNET_RECLAIM_PresentationList **presentations, |
140 | char **nonce, | 140 | char **nonce, |
141 | enum OIDC_VerificationOptions opts); | 141 | enum OIDC_VerificationOptions opts, char **emsg); |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * Build a token response for a token request | 144 | * Build a token response for a token request |
diff --git a/src/service/rest/openid_plugin.c b/src/service/rest/openid_plugin.c index cd3f975a4..fc1125690 100644 --- a/src/service/rest/openid_plugin.c +++ b/src/service/rest/openid_plugin.c | |||
@@ -2265,14 +2265,16 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2265 | } | 2265 | } |
2266 | 2266 | ||
2267 | // decode code | 2267 | // decode code |
2268 | char *emsg = NULL; | ||
2268 | if (GNUNET_OK != OIDC_parse_authz_code (received_cid, &cid, code, | 2269 | if (GNUNET_OK != OIDC_parse_authz_code (received_cid, &cid, code, |
2269 | code_verifier, | 2270 | code_verifier, |
2270 | &ticket, | 2271 | &ticket, |
2271 | &cl, &pl, &nonce, | 2272 | &cl, &pl, &nonce, |
2272 | OIDC_VERIFICATION_DEFAULT)) | 2273 | OIDC_VERIFICATION_DEFAULT, |
2274 | &emsg)) | ||
2273 | { | 2275 | { |
2274 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST); | 2276 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST); |
2275 | handle->edesc = GNUNET_strdup ("invalid code"); | 2277 | handle->edesc = emsg; |
2276 | handle->response_code = MHD_HTTP_BAD_REQUEST; | 2278 | handle->response_code = MHD_HTTP_BAD_REQUEST; |
2277 | GNUNET_free (code); | 2279 | GNUNET_free (code); |
2278 | if (NULL != code_verifier) | 2280 | if (NULL != code_verifier) |
@@ -2313,14 +2315,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2313 | jwa = JWT_ALG_VALUE_RSA; | 2315 | jwa = JWT_ALG_VALUE_RSA; |
2314 | } | 2316 | } |
2315 | 2317 | ||
2316 | char *tmp = GNUNET_strdup (ticket.gns_name); | ||
2317 | GNUNET_assert (NULL != strtok (tmp, ".")); | ||
2318 | char *key = strtok (NULL, "."); | ||
2319 | struct GNUNET_CRYPTO_PublicKey issuer; | 2318 | struct GNUNET_CRYPTO_PublicKey issuer; |
2320 | GNUNET_assert (NULL != key); | 2319 | GNUNET_GNS_parse_ztld (ticket.gns_name, &issuer); |
2321 | GNUNET_assert (GNUNET_OK == | ||
2322 | GNUNET_CRYPTO_public_key_from_string (key, &issuer)); | ||
2323 | GNUNET_free (tmp); | ||
2324 | 2320 | ||
2325 | if (! strcmp (jwa, JWT_ALG_VALUE_RSA)) | 2321 | if (! strcmp (jwa, JWT_ALG_VALUE_RSA)) |
2326 | { | 2322 | { |
@@ -2394,7 +2390,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2394 | 2390 | ||
2395 | if (NULL != nonce) | 2391 | if (NULL != nonce) |
2396 | GNUNET_free (nonce); | 2392 | GNUNET_free (nonce); |
2397 | access_token = OIDC_access_token_new (&ticket); | 2393 | access_token = OIDC_access_token_new (&ticket, handle->oidc->redirect_uri); |
2398 | /** | 2394 | /** |
2399 | * Store mapping from access token to code so we can later | 2395 | * Store mapping from access token to code so we can later |
2400 | * fall back on the provided attributes in userinfo one time. | 2396 | * fall back on the provided attributes in userinfo one time. |
@@ -2598,13 +2594,14 @@ consume_fail (void *cls) | |||
2598 | sizeof(struct GNUNET_CRYPTO_PublicKey)); | 2594 | sizeof(struct GNUNET_CRYPTO_PublicKey)); |
2599 | 2595 | ||
2600 | // decode code | 2596 | // decode code |
2597 | char *emsg; | ||
2601 | if (GNUNET_OK != OIDC_parse_authz_code (received_cid, &cid, | 2598 | if (GNUNET_OK != OIDC_parse_authz_code (received_cid, &cid, |
2602 | cached_code, NULL, &ticket, | 2599 | cached_code, NULL, &ticket, |
2603 | &cl, &pl, &nonce, | 2600 | &cl, &pl, &nonce, |
2604 | OIDC_VERIFICATION_NO_CODE_VERIFIER)) | 2601 | OIDC_VERIFICATION_NO_CODE_VERIFIER, &emsg)) |
2605 | { | 2602 | { |
2606 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST); | 2603 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_REQUEST); |
2607 | handle->edesc = GNUNET_strdup ("invalid code"); | 2604 | handle->edesc = emsg; |
2608 | handle->response_code = MHD_HTTP_BAD_REQUEST; | 2605 | handle->response_code = MHD_HTTP_BAD_REQUEST; |
2609 | GNUNET_free (cached_code); | 2606 | GNUNET_free (cached_code); |
2610 | if (NULL != nonce) | 2607 | if (NULL != nonce) |
@@ -2700,8 +2697,9 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2700 | return; | 2697 | return; |
2701 | } | 2698 | } |
2702 | 2699 | ||
2700 | char *rp_uri; | ||
2703 | if (GNUNET_OK != OIDC_access_token_parse (authorization_access_token, | 2701 | if (GNUNET_OK != OIDC_access_token_parse (authorization_access_token, |
2704 | &ticket)) | 2702 | &ticket, &rp_uri)) |
2705 | { | 2703 | { |
2706 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN); | 2704 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN); |
2707 | handle->edesc = GNUNET_strdup ("The access token is invalid"); | 2705 | handle->edesc = GNUNET_strdup ("The access token is invalid"); |
@@ -2727,9 +2725,11 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2727 | handle); | 2725 | handle); |
2728 | handle->idp_op = GNUNET_RECLAIM_ticket_consume (idp, | 2726 | handle->idp_op = GNUNET_RECLAIM_ticket_consume (idp, |
2729 | &handle->ticket, | 2727 | &handle->ticket, |
2728 | rp_uri, | ||
2730 | &consume_ticket, | 2729 | &consume_ticket, |
2731 | handle); | 2730 | handle); |
2732 | GNUNET_free (authorization); | 2731 | GNUNET_free (authorization); |
2732 | GNUNET_free (rp_uri); | ||
2733 | } | 2733 | } |
2734 | 2734 | ||
2735 | 2735 | ||
diff --git a/src/service/rest/reclaim_plugin.c b/src/service/rest/reclaim_plugin.c index ed86601d1..10b6b7bdc 100644 --- a/src/service/rest/reclaim_plugin.c +++ b/src/service/rest/reclaim_plugin.c | |||
@@ -24,8 +24,8 @@ | |||
24 | * @brief GNUnet reclaim REST plugin | 24 | * @brief GNUnet reclaim REST plugin |
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | #include "gnunet_json_lib.h" | ||
28 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_json_lib.h" | ||
29 | #include "microhttpd.h" | 29 | #include "microhttpd.h" |
30 | #include <inttypes.h> | 30 | #include <inttypes.h> |
31 | #include <jansson.h> | 31 | #include <jansson.h> |
@@ -1231,7 +1231,7 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1231 | json_error_t err; | 1231 | json_error_t err; |
1232 | struct GNUNET_JSON_Specification tktspec[] = | 1232 | struct GNUNET_JSON_Specification tktspec[] = |
1233 | { GNUNET_RECLAIM_JSON_spec_ticket (&ticket), | 1233 | { GNUNET_RECLAIM_JSON_spec_ticket (&ticket), |
1234 | GNUNET_JSON_spec_string("rp_uri", &rp_uri), | 1234 | GNUNET_JSON_spec_string ("rp_uri", &rp_uri), |
1235 | GNUNET_JSON_spec_end () }; | 1235 | GNUNET_JSON_spec_end () }; |
1236 | 1236 | ||
1237 | if (0 >= handle->rest_handle->data_size) | 1237 | if (0 >= handle->rest_handle->data_size) |
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/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 | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | if USE_COVERAGE | ||
5 | AM_CFLAGS = --coverage -O0 | ||
6 | XLIB = -lgcov | ||
7 | endif | ||
8 | |||
9 | libexecdir= $(pkglibdir)/libexec/ | ||
10 | |||
11 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
12 | |||
13 | lib_LTLIBRARIES = \ | ||
14 | libgnunettestbed.la \ | ||
15 | libgnunettestingtestbed.la | ||
16 | |||
17 | libgnunettestbed_la_SOURCES = \ | ||
18 | testbed.c | ||
19 | libgnunettestbed_la_LIBADD = \ | ||
20 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
21 | |||
22 | libgnunettestingtestbed_la_SOURCES = \ | ||
23 | testbed_api_cmd_system_create.c \ | ||
24 | testing_testbed_traits.c | ||
25 | libgnunettestingtestbed_la_LIBADD = \ | ||
26 | libgnunettestbed.la \ | ||
27 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ | ||
28 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
29 | |||
30 | |||
31 | bin_PROGRAMS = \ | ||
32 | gnunet-testbed | ||
33 | |||
34 | gnunet_testbed_SOURCES = \ | ||
35 | gnunet-testbed.c | ||
36 | gnunet_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 | |||
42 | check_PROGRAMS = \ | ||
43 | test_testbed_portreservation | ||
44 | |||
45 | AM_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 | |||
49 | test_testbed_portreservation_SOURCES = \ | ||
50 | test_testbed_portreservation.c | ||
51 | test_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 | */ | ||
37 | static int ret; | ||
38 | |||
39 | /** | ||
40 | * Number of config files to create. | ||
41 | */ | ||
42 | static unsigned int create_no; | ||
43 | |||
44 | /** | ||
45 | * Filename of the config template to be written. | ||
46 | */ | ||
47 | static char *create_cfg_template; | ||
48 | |||
49 | |||
50 | static int | ||
51 | create_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 | */ | ||
157 | static void | ||
158 | run_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 | */ | ||
188 | int | ||
189 | main (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 | |||
44 | run (void *cls, char *const *args, const char *cfgfile, | 44 | run (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 | ||
78 | end: | 78 | end: |
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 | */ | ||
53 | struct 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 | |||
104 | struct GNUNET_TESTBED_System * | ||
105 | GNUNET_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 | |||
135 | struct GNUNET_TESTBED_System * | ||
136 | GNUNET_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 | |||
149 | void | ||
150 | GNUNET_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 | |||
162 | uint16_t | ||
163 | GNUNET_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 | |||
251 | void | ||
252 | GNUNET_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 | */ | ||
276 | struct 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 | */ | ||
322 | static void | ||
323 | update_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 | */ | ||
419 | static void | ||
420 | update_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 | |||
531 | enum GNUNET_GenericReturnValue | ||
532 | GNUNET_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 | */ |
37 | struct TestSystemState | 36 | struct 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 | */ |
112 | struct GNUNET_TESTING_Command | 107 | struct GNUNET_TESTING_Command |
113 | GNUNET_TESTING_cmd_system_create (const char *label, | 108 | GNUNET_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 | |||
32 | GNUNET_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 | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | if USE_COVERAGE | ||
5 | AM_CFLAGS = --coverage -O0 | ||
6 | XLIB = -lgcov | ||
7 | endif | ||
8 | |||
9 | libexecdir= $(pkglibdir)/libexec/ | ||
10 | |||
11 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
12 | |||
13 | dist_pkgcfg_DATA = \ | ||
14 | testing.conf | ||
15 | |||
16 | libexec_PROGRAMS = \ | ||
17 | test_testing_start_with_config \ | ||
18 | gnunet-cmds-helper | ||
19 | |||
20 | plugindir = $(libdir)/gnunet | ||
21 | |||
22 | lib_LTLIBRARIES = \ | ||
23 | libgnunettesting.la | ||
24 | |||
25 | gnunet_cmds_helper_SOURCES = \ | ||
26 | gnunet-cmds-helper.c | ||
27 | gnunet_cmds_helper_LDADD = $(XLIB) \ | ||
28 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
29 | libgnunettesting.la \ | ||
30 | $(LTLIBINTL) $(Z_LIBS) | ||
31 | |||
32 | libgnunettesting_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 | ||
50 | libgnunettesting_la_LIBADD = \ | ||
51 | $(top_builddir)/src/service/arm/libgnunetarm.la \ | ||
52 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
53 | $(LTLIBINTL) | ||
54 | libgnunettesting_la_LDFLAGS = \ | ||
55 | $(GN_LIB_LDFLAGS) \ | ||
56 | -version-info 2:0:1 | ||
57 | |||
58 | bin_PROGRAMS = \ | ||
59 | gnunet-testing | ||
60 | |||
61 | noinst_PROGRAMS = \ | ||
62 | list-keys | ||
63 | |||
64 | gnunet_testing_SOURCES = \ | ||
65 | gnunet-testing.c | ||
66 | gnunet_testing_LDADD = \ | ||
67 | libgnunettesting.la \ | ||
68 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
69 | $(GN_LIBINTL) | ||
70 | |||
71 | list_keys_SOURCES = \ | ||
72 | list-keys.c | ||
73 | list_keys_LDADD = \ | ||
74 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
75 | $(GN_LIBINTL) | ||
76 | |||
77 | |||
78 | check_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 | |||
94 | test_testing_start_with_config_SOURCES = \ | ||
95 | test_testing_start_with_config.c | ||
96 | test_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 | |||
101 | test_testing_portreservation_SOURCES = \ | ||
102 | test_testing_portreservation.c | ||
103 | test_testing_portreservation_LDADD = \ | ||
104 | libgnunettesting.la \ | ||
105 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
106 | |||
107 | test_testing_peerstartup_SOURCES = \ | ||
108 | test_testing_peerstartup.c | ||
109 | test_testing_peerstartup_LDADD = \ | ||
110 | libgnunettesting.la \ | ||
111 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
112 | |||
113 | test_testing_peerstartup2_SOURCES = \ | ||
114 | test_testing_peerstartup2.c | ||
115 | test_testing_peerstartup2_LDADD = \ | ||
116 | libgnunettesting.la \ | ||
117 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
118 | |||
119 | test_testing_servicestartup_SOURCES = \ | ||
120 | test_testing_servicestartup.c | ||
121 | test_testing_servicestartup_LDADD = \ | ||
122 | libgnunettesting.la \ | ||
123 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
124 | |||
125 | test_testing_sharedservices_SOURCES = \ | ||
126 | test_testing_sharedservices.c | ||
127 | test_testing_sharedservices_LDADD = \ | ||
128 | libgnunettesting.la \ | ||
129 | $(top_builddir)/src/lib/util/libgnunetutil.la | ||
130 | |||
131 | EXTRA_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 | |||
80 | struct GNUNET_SCHEDULER_Task *finished_task; | ||
81 | |||
82 | struct GNUNET_TESTING_Interpreter *is; | ||
83 | |||
84 | /** | ||
85 | * Struct with information about a specific node and the whole network namespace setup. | ||
86 | * | ||
87 | */ | ||
88 | struct 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 | */ | ||
128 | struct 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 | |||
149 | static struct GNUNET_OS_Process *cmd_binary_process;*/ | ||
150 | |||
151 | /** | ||
152 | * Plugin to dynamically load a test case. | ||
153 | */ | ||
154 | struct TestcasePlugin *plugin; | ||
155 | |||
156 | /** | ||
157 | * Our message stream tokenizer | ||
158 | */ | ||
159 | struct GNUNET_MessageStreamTokenizer *tokenizer; | ||
160 | |||
161 | /** | ||
162 | * Disk handle from stdin | ||
163 | */ | ||
164 | static struct GNUNET_DISK_FileHandle *stdin_fd; | ||
165 | |||
166 | /** | ||
167 | * Disk handle for stdout | ||
168 | */ | ||
169 | static struct GNUNET_DISK_FileHandle *stdout_fd; | ||
170 | |||
171 | /** | ||
172 | * Pipe used to communicate shutdown via signal. | ||
173 | */ | ||
174 | static struct GNUNET_DISK_PipeHandle *sigpipe; | ||
175 | |||
176 | /** | ||
177 | * Task identifier for the read task | ||
178 | */ | ||
179 | static struct GNUNET_SCHEDULER_Task *read_task_id; | ||
180 | |||
181 | /** | ||
182 | * Task identifier for the write task | ||
183 | */ | ||
184 | static struct GNUNET_SCHEDULER_Task *write_task_id; | ||
185 | |||
186 | /** | ||
187 | * Are we done reading messages from stdin? | ||
188 | */ | ||
189 | static int done_reading; | ||
190 | |||
191 | /** | ||
192 | * Result to return in case we fail | ||
193 | */ | ||
194 | static int status; | ||
195 | |||
196 | |||
197 | /** | ||
198 | * Task to shut down cleanly | ||
199 | * | ||
200 | * @param cls NULL | ||
201 | */ | ||
202 | static void | ||
203 | do_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 | */ | ||
239 | static void | ||
240 | write_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 | */ | ||
278 | static void | ||
279 | write_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 | |||
297 | static void | ||
298 | delay_shutdown_cb () | ||
299 | { | ||
300 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
301 | "doing shutdown after delay\n"); | ||
302 | GNUNET_SCHEDULER_shutdown (); | ||
303 | } | ||
304 | |||
305 | |||
306 | struct GNUNET_MessageHeader * | ||
307 | GNUNET_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 | |||
321 | static void | ||
322 | finished_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 | */ | ||
359 | static enum GNUNET_GenericReturnValue | ||
360 | tokenizer_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 | |||
505 | error: | ||
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 | */ | ||
519 | static void | ||
520 | read_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 | */ | ||
570 | static void | ||
571 | run (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 | */ | ||
599 | static void | ||
600 | sighandler_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 | */ | ||
623 | int | ||
624 | main (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 | */ | ||
37 | static int ret; | ||
38 | |||
39 | /** | ||
40 | * Filename of the hostkey file we should write, | ||
41 | * null if we should not write a hostkey file. | ||
42 | */ | ||
43 | static char *create_hostkey; | ||
44 | |||
45 | /** | ||
46 | * Non-zero if we should create config files. | ||
47 | */ | ||
48 | static int create_cfg; | ||
49 | |||
50 | /** | ||
51 | * Number of config files to create. | ||
52 | */ | ||
53 | static unsigned int create_no; | ||
54 | |||
55 | /** | ||
56 | * Filename of the config template to be written. | ||
57 | */ | ||
58 | static char *create_cfg_template; | ||
59 | |||
60 | /** | ||
61 | * Service we are supposed to run. | ||
62 | */ | ||
63 | static char *run_service_name; | ||
64 | |||
65 | /** | ||
66 | * File handle to STDIN, for reading restart/quit commands. | ||
67 | */ | ||
68 | static struct GNUNET_DISK_FileHandle *fh; | ||
69 | |||
70 | /** | ||
71 | * Temporary filename, used with '-r' to write the configuration to. | ||
72 | */ | ||
73 | static char *tmpfilename; | ||
74 | |||
75 | /** | ||
76 | * Task identifier of the task that waits for stdin. | ||
77 | */ | ||
78 | static struct GNUNET_SCHEDULER_Task *tid; | ||
79 | |||
80 | /** | ||
81 | * Peer started for '-r'. | ||
82 | */ | ||
83 | static struct GNUNET_TESTING_Peer *my_peer; | ||
84 | |||
85 | |||
86 | static int | ||
87 | create_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 | |||
172 | static int | ||
173 | create_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 | */ | ||
217 | static void | ||
218 | cleanup (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 | */ | ||
245 | static void | ||
246 | stdin_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 | */ | ||
293 | static void | ||
294 | testing_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 | */ | ||
331 | static void | ||
332 | run_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 | */ | ||
379 | int | ||
380 | main (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 | |||
5 | static unsigned int nkeys; | ||
6 | static unsigned int nskip; | ||
7 | static 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 | */ | ||
17 | static void | ||
18 | run (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 | |||
85 | int | ||
86 | main (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 @@ | |||
1 | libgnunettesting_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 | |||
21 | gnunettesting_src = ['gnunet-testing.c'] | ||
22 | gnunetservicetesting_src = ['gnunet-service-testing.c'] | ||
23 | |||
24 | configure_file(input : 'testing.conf', | ||
25 | output : 'testing.conf', | ||
26 | configuration : cdata, | ||
27 | install: true, | ||
28 | install_dir: pkgcfgdir) | ||
29 | |||
30 | |||
31 | libgnunettesting = 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')) | ||
41 | libgnunettesting_dep = declare_dependency(link_with : libgnunettesting) | ||
42 | pkg.generate(libgnunettesting, url: 'https://www.gnunet.org', | ||
43 | description : 'Provides API for gnunet testing') | ||
44 | |||
45 | executable ('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 | |||
54 | executable ('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] | ||
2 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-testing/ | ||
3 | |||
4 | [transport] | ||
5 | PLUGINS = tcp | ||
6 | |||
7 | [transport-tcp] | ||
8 | TESTING_IGNORE_KEYS = SOMETHING;KEY1;ACCEPT_FROM; | ||
9 | |||
10 | [transport-tcp] | ||
11 | BINDTO = 127.0.0.1 | ||
12 | |||
13 | [nat] | ||
14 | DISABLEV6 = YES | ||
15 | ENABLE_UPNP = NO | ||
16 | BEHIND_NAT = NO | ||
17 | ALLOW_NAT = NO | ||
18 | INTERNAL_ADDRESS = 127.0.0.1 | ||
19 | EXTERNAL_ADDRESS = 127.0.0.1 | ||
20 | USE_LOCALADDR = NO | ||
21 | |||
22 | |||
23 | [rps] | ||
24 | START_ON_DEMAND = NO | ||
25 | IMMEDIATE_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 | */ | ||
38 | int status; | ||
39 | |||
40 | /** | ||
41 | * The testing context | ||
42 | */ | ||
43 | struct 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 | */ | ||
67 | static void | ||
68 | do_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 | */ | ||
89 | static void | ||
90 | run (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 | |||
119 | end: | ||
120 | GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx); | ||
121 | GNUNET_free (emsg); | ||
122 | } | ||
123 | |||
124 | |||
125 | int | ||
126 | main (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 | */ | ||
50 | int status; | ||
51 | |||
52 | /** | ||
53 | * The testing context | ||
54 | */ | ||
55 | struct 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 | |||
86 | static void | ||
87 | do_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 | */ | ||
106 | static void | ||
107 | do_shutdown (void *cls); | ||
108 | |||
109 | |||
110 | static void | ||
111 | peer_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 | */ | ||
138 | static void | ||
139 | do_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 | */ | ||
159 | static void | ||
160 | run (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 | |||
197 | end: | ||
198 | FAIL_TEST (0); | ||
199 | GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx); | ||
200 | GNUNET_free (emsg); | ||
201 | } | ||
202 | |||
203 | |||
204 | int | ||
205 | main (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 | */ | ||
38 | static 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 | */ | ||
47 | static void | ||
48 | test_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 | */ | ||
62 | int | ||
63 | main (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 | */ | ||
39 | int status; | ||
40 | |||
41 | /** | ||
42 | * The testing context | ||
43 | */ | ||
44 | struct 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 | */ | ||
68 | static void | ||
69 | do_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 | */ | ||
95 | static void | ||
96 | run (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 | |||
140 | end: | ||
141 | GNUNET_SCHEDULER_add_now (&do_shutdown, test_ctx); | ||
142 | GNUNET_free (emsg); | ||
143 | } | ||
144 | |||
145 | |||
146 | int | ||
147 | main (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] | ||
2 | GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-testing/ | ||
3 | |||
4 | [testbed-logger] | ||
5 | PORT = 59132 | ||
6 | UNIXPATH = $GNUNET_RUNTIME_DIR/testbed-logger.sock | ||
7 | DIR = $GNUNET_TMP/testbed-logger | ||
8 | |||
9 | [transport] | ||
10 | PLUGINS = tcp | ||
11 | |||
12 | [transport-tcp] | ||
13 | TESTING_IGNORE_KEYS = SOMETHING;KEY1;ACCEPT_FROM; | ||
14 | |||
15 | [transport-tcp] | ||
16 | BINDTO = 127.0.0.1 | ||
17 | |||
18 | [nat] | ||
19 | DISABLEV6 = YES | ||
20 | ENABLE_UPNP = NO | ||
21 | BEHIND_NAT = NO | ||
22 | ALLOW_NAT = NO | ||
23 | INTERNAL_ADDRESS = 127.0.0.1 | ||
24 | EXTERNAL_ADDRESS = 127.0.0.1 | ||
25 | USE_LOCALADDR = NO | ||
26 | |||
27 | |||
28 | [rps] | ||
29 | START_ON_DEMAND = NO | ||
30 | IMMEDIATE_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 | |||
34 | int | ||
35 | main (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 | |||
86 | struct 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 | |||
101 | struct 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 | */ | ||
121 | struct 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 | */ | ||
194 | struct 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 | */ | ||
275 | static enum GNUNET_GenericReturnValue | ||
276 | hostkeys_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 | */ | ||
338 | static void | ||
339 | hostkeys_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 | */ | ||
358 | static void | ||
359 | cfg_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 | */ | ||
391 | struct GNUNET_TESTING_System * | ||
392 | GNUNET_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 | */ | ||
476 | struct GNUNET_TESTING_System * | ||
477 | GNUNET_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 | |||
492 | static void | ||
493 | cleanup_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 | |||
508 | static enum GNUNET_GenericReturnValue | ||
509 | start_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 | |||
535 | static void | ||
536 | stop_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 | */ | ||
556 | void | ||
557 | GNUNET_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 | */ | ||
597 | uint16_t | ||
598 | GNUNET_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 | */ | ||
693 | void | ||
694 | GNUNET_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 | */ | ||
731 | struct GNUNET_CRYPTO_EddsaPrivateKey * | ||
732 | GNUNET_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 | */ | ||
761 | struct 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 | */ | ||
807 | static void | ||
808 | update_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 | */ | ||
904 | static void | ||
905 | update_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 | |||
1010 | static struct SharedServiceInstance * | ||
1011 | associate_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 | */ | ||
1103 | static int | ||
1104 | GNUNET_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 | */ | ||
1166 | int | ||
1167 | GNUNET_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 | */ | ||
1187 | struct GNUNET_TESTING_Peer * | ||
1188 | GNUNET_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 | |||
1340 | err_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 | */ | ||
1358 | void | ||
1359 | GNUNET_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 | */ | ||
1380 | int | ||
1381 | GNUNET_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 | */ | ||
1429 | int | ||
1430 | GNUNET_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 | */ | ||
1461 | int | ||
1462 | GNUNET_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 | */ | ||
1484 | int | ||
1485 | GNUNET_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 | */ | ||
1502 | static void | ||
1503 | disconn_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 | |||
1524 | int | ||
1525 | GNUNET_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 | */ | ||
1549 | void | ||
1550 | GNUNET_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 | */ | ||
1565 | void | ||
1566 | GNUNET_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 | |||
1591 | int | ||
1592 | GNUNET_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 | */ | ||
1604 | struct 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 | */ | ||
1633 | static void | ||
1634 | service_run_main (void *cls) | ||
1635 | { | ||
1636 | struct ServiceContext *sc = cls; | ||
1637 | |||
1638 | sc->tm (sc->tm_cls, sc->cfg, sc->peer); | ||
1639 | } | ||
1640 | |||
1641 | |||
1642 | int | ||
1643 | GNUNET_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 | */ | ||
1733 | static unsigned int | ||
1734 | get_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 | */ | ||
1760 | static char * | ||
1761 | get_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 | */ | ||
1791 | static char * | ||
1792 | get_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 | */ | ||
1825 | static unsigned int | ||
1826 | get_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 | */ | ||
1856 | static char * | ||
1857 | get_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 | */ | ||
1896 | static struct GNUNET_TESTING_NodeConnection * | ||
1897 | get_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 | */ | ||
2005 | static void | ||
2006 | node_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 | */ | ||
2058 | static int | ||
2059 | log_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 | */ | ||
2103 | static int | ||
2104 | log_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 | */ | ||
2118 | static int | ||
2119 | log_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 | */ | ||
2146 | static void | ||
2147 | get_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 | */ | ||
2228 | struct GNUNET_TESTING_NetjailNode * | ||
2229 | GNUNET_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 | */ | ||
2250 | struct GNUNET_TESTING_NodeConnection * | ||
2251 | GNUNET_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 | */ | ||
2275 | struct GNUNET_PeerIdentity * | ||
2276 | GNUNET_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 | |||
2293 | int | ||
2294 | free_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 | |||
2325 | int | ||
2326 | free_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 | */ | ||
2346 | void | ||
2347 | GNUNET_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 | |||
2360 | unsigned int | ||
2361 | GNUNET_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 | */ | ||
2386 | char * | ||
2387 | GNUNET_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 | */ | ||
2446 | unsigned int | ||
2447 | GNUNET_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 | |||
2477 | static void | ||
2478 | parse_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 | */ | ||
2514 | struct GNUNET_TESTING_NetjailTopology * | ||
2515 | GNUNET_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 | */ | ||
2785 | struct GNUNET_TESTING_NetjailTopology * | ||
2786 | GNUNET_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 | |||
29 | GNUNET_NETWORK_STRUCT_BEGIN | ||
30 | |||
31 | /** | ||
32 | * Message send to a child loop to inform the child loop about a barrier being advanced. | ||
33 | */ | ||
34 | struct 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 | */ | ||
48 | struct 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 | |||
68 | struct 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 | |||
88 | GNUNET_NETWORK_STRUCT_END | ||
89 | |||
90 | /** | ||
91 | * Handle for a plugin. | ||
92 | */ | ||
93 | struct 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 | |||
142 | struct CommandListEntry | ||
143 | { | ||
144 | struct CommandListEntry *next; | ||
145 | |||
146 | struct CommandListEntry *prev; | ||
147 | |||
148 | struct GNUNET_TESTING_Command *command; | ||
149 | }; | ||
150 | |||
151 | |||
152 | struct 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 | */ | ||
225 | bool | ||
226 | GNUNET_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 | */ | ||
234 | bool | ||
235 | GNUNET_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 | */ | ||
243 | struct GNUNET_TESTING_Command * | ||
244 | GNUNET_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 | */ | ||
256 | void | ||
257 | GNUNET_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 | */ | ||
268 | bool | ||
269 | GNUNET_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 | */ | ||
277 | void | ||
278 | GNUNET_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 | */ | ||
292 | void | ||
293 | GNUNET_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 | */ | ||
311 | struct GNUNET_TESTING_NetjailNode * | ||
312 | GNUNET_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 | */ | ||
323 | struct GNUNET_TESTING_Barrier * | ||
324 | GNUNET_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 | */ | ||
334 | void | ||
335 | GNUNET_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 | |||
39 | struct 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 | ||
54 | void | ||
55 | GNUNET_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 | |||
80 | bool | ||
81 | GNUNET_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 | */ | ||
113 | static enum GNUNET_GenericReturnValue | ||
114 | barrier_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 | */ | ||
136 | static void | ||
137 | barrier_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 | */ | ||
152 | static void | ||
153 | barrier_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 | |||
164 | struct GNUNET_TESTING_NetjailNode * | ||
165 | GNUNET_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 | |||
182 | struct GNUNET_TESTING_Command | ||
183 | GNUNET_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 | */ | ||
43 | struct 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 | */ | ||
89 | static void | ||
90 | barrier_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 | */ | ||
156 | static void | ||
157 | barrier_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 | */ | ||
174 | static enum GNUNET_GenericReturnValue | ||
175 | barrier_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 | */ | ||
206 | struct GNUNET_TESTING_Command | ||
207 | GNUNET_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 | */ | ||
43 | static void | ||
44 | block_until_all_peers_started_cleanup (void *cls) | ||
45 | { | ||
46 | struct BlockState *bs = cls; | ||
47 | |||
48 | GNUNET_free (bs); | ||
49 | } | ||
50 | |||
51 | |||
52 | static int | ||
53 | block_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 | */ | ||
77 | static void | ||
78 | block_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 | */ | ||
105 | struct GNUNET_TESTING_Command | ||
106 | GNUNET_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 | |||
32 | struct 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 | */ | ||
74 | static void | ||
75 | exec_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 | */ | ||
105 | static void | ||
106 | child_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 | */ | ||
136 | static void | ||
137 | exec_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 | |||
195 | const struct GNUNET_TESTING_Command | ||
196 | GNUNET_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 | */ | ||
44 | enum GNUNET_GenericReturnValue | ||
45 | local_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 | */ | ||
66 | static void | ||
67 | local_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 | */ | ||
79 | static void | ||
80 | local_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 | |||
97 | struct GNUNET_TESTING_Command | ||
98 | GNUNET_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 | */ | ||
47 | struct 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 | */ | ||
73 | struct 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 | */ | ||
176 | struct 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 | */ | ||
216 | static void | ||
217 | netjail_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 | */ | ||
228 | static enum GNUNET_GenericReturnValue | ||
229 | netjail_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 | */ | ||
258 | static void | ||
259 | clear_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 | |||
271 | static void | ||
272 | send_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 | |||
307 | static void | ||
308 | send_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 | |||
326 | static void | ||
327 | send_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 | |||
343 | void | ||
344 | barrier_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 | |||
378 | void | ||
379 | barrier_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 | */ | ||
427 | static int | ||
428 | helper_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 | */ | ||
522 | static void | ||
523 | exp_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 | */ | ||
540 | static struct GNUNET_TESTING_CommandHelperInit * | ||
541 | create_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 | */ | ||
565 | static void | ||
566 | start_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 | */ | ||
821 | static void | ||
822 | do_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 | */ | ||
842 | static void | ||
843 | netjail_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 | */ | ||
892 | struct GNUNET_TESTING_Command | ||
893 | GNUNET_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 | */ | ||
40 | struct 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 | */ | ||
72 | static void | ||
73 | netjail_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 | */ | ||
100 | static void | ||
101 | child_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 | */ | ||
127 | static void | ||
128 | netjail_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 | |||
186 | struct GNUNET_TESTING_Command | ||
187 | GNUNET_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 | */ | ||
38 | struct 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 | */ | ||
71 | static void | ||
72 | stop_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 | */ | ||
86 | static void | ||
87 | stop_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 | */ | ||
138 | struct GNUNET_TESTING_Command | ||
139 | GNUNET_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 | */ | ||
39 | struct 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 | */ | ||
59 | static enum GNUNET_GenericReturnValue | ||
60 | send_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 | */ | ||
73 | static void | ||
74 | send_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 | */ | ||
86 | static void | ||
87 | send_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 | */ | ||
110 | struct GNUNET_TESTING_Command | ||
111 | GNUNET_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 | */ | ||
38 | struct 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 | */ | ||
49 | static void | ||
50 | system_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 | */ | ||
70 | static void | ||
71 | system_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 | */ | ||
83 | static enum GNUNET_GenericReturnValue | ||
84 | system_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 | */ | ||
100 | struct GNUNET_TESTING_Command | ||
101 | GNUNET_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 | */ | ||
40 | struct 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 | */ | ||
125 | static const struct GNUNET_TESTING_Command * | ||
126 | get_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 | |||
192 | const struct GNUNET_TESTING_Command * | ||
193 | GNUNET_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 | |||
203 | const struct GNUNET_TESTING_Command * | ||
204 | GNUNET_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 | |||
214 | const struct GNUNET_TESTING_Command * | ||
215 | GNUNET_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 | */ | ||
240 | static void | ||
241 | clear_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 | */ | ||
255 | static void | ||
256 | send_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 | */ | ||
293 | struct 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 | |||
307 | static enum GNUNET_GenericReturnValue | ||
308 | free_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 | |||
334 | static void | ||
335 | free_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 | |||
353 | static enum GNUNET_GenericReturnValue | ||
354 | free_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 | */ | ||
381 | static void | ||
382 | finish_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 | */ | ||
441 | static void | ||
442 | interpreter_run (void *cls); | ||
443 | |||
444 | |||
445 | /** | ||
446 | * Current command is done, run the next one. | ||
447 | */ | ||
448 | static void | ||
449 | interpreter_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 | |||
478 | void | ||
479 | GNUNET_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 | |||
513 | void | ||
514 | GNUNET_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 | |||
527 | void | ||
528 | GNUNET_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 | */ | ||
547 | struct GNUNET_TESTING_Command * | ||
548 | GNUNET_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 | */ | ||
560 | static void | ||
561 | interpreter_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 | */ | ||
613 | static void | ||
614 | do_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 | |||
626 | struct GNUNET_TESTING_Interpreter * | ||
627 | GNUNET_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 | |||
665 | struct GNUNET_TESTING_Command | ||
666 | GNUNET_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 | |||
689 | void | ||
690 | GNUNET_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 | |||
705 | struct GNUNET_TESTING_Command | ||
706 | GNUNET_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 | */ | ||
719 | struct 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 | */ | ||
745 | static void | ||
746 | handle_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 | */ | ||
765 | static void | ||
766 | loop_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 | |||
777 | int | ||
778 | GNUNET_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 | |||
793 | void | ||
794 | GNUNET_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 | |||
803 | struct GNUNET_TESTING_Barrier * | ||
804 | GNUNET_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 | */ | ||
827 | void | ||
828 | GNUNET_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 | |||
850 | void | ||
851 | GNUNET_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 | |||
33 | GNUNET_NETWORK_STRUCT_BEGIN | ||
34 | |||
35 | /** | ||
36 | * Initialization message for gnunet-cmds-testbed to start cmd binary. | ||
37 | */ | ||
38 | struct 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 | */ | ||
57 | struct GNUNET_TESTING_CommandHelperReply | ||
58 | { | ||
59 | /** | ||
60 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_REPLY | ||
61 | */ | ||
62 | struct GNUNET_MessageHeader header; | ||
63 | }; | ||
64 | |||
65 | struct GNUNET_TESTING_CommandPeerStarted | ||
66 | { | ||
67 | /** | ||
68 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_PEER_STARTED | ||
69 | */ | ||
70 | struct GNUNET_MessageHeader header; | ||
71 | }; | ||
72 | |||
73 | struct GNUNET_TESTING_CommandAllPeersStarted | ||
74 | { | ||
75 | /** | ||
76 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_ALL_PEERS_STARTED | ||
77 | */ | ||
78 | struct GNUNET_MessageHeader header; | ||
79 | }; | ||
80 | |||
81 | struct 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 | |||
95 | struct GNUNET_TESTING_CommandLocalTestPrepared | ||
96 | { | ||
97 | /** | ||
98 | * Type is GNUNET_MESSAGE_TYPE_CMDS_HELPER_LOCAL_TEST_PREPARED | ||
99 | */ | ||
100 | struct GNUNET_MessageHeader header; | ||
101 | }; | ||
102 | |||
103 | struct 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 | |||
111 | GNUNET_NETWORK_STRUCT_END | ||
112 | |||
113 | /** | ||
114 | * Global state of the interpreter, used by a command | ||
115 | * to access information about other commands. | ||
116 | */ | ||
117 | struct 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 | */ | ||
127 | struct GNUNET_TESTING_Command * | ||
128 | GNUNET_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 | */ | ||
138 | void | ||
139 | GNUNET_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 | |||
3 | declare -A K_PLUGIN | ||
4 | declare -A R_TCP | ||
5 | declare -A R_UDP | ||
6 | declare -A P_PLUGIN | ||
7 | |||
8 | extract_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 | |||
54 | read_topology(){ | ||
55 | |||
56 | local filename=$1 | ||
57 | while 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 | ||
95 | done < $filename | ||
96 | } | ||
97 | |||
98 | |||
99 | |||
diff --git a/src/service/topology/gnunet-daemon-topology.c b/src/service/topology/gnunet-daemon-topology.c index 159ba2a07..a95b67908 100644 --- a/src/service/topology/gnunet-daemon-topology.c +++ b/src/service/topology/gnunet-daemon-topology.c | |||
@@ -699,6 +699,7 @@ consider_for_advertising (const struct GNUNET_MessageHeader *hello) | |||
699 | GNUNET_HELLO_builder_iterate (builder_old, | 699 | GNUNET_HELLO_builder_iterate (builder_old, |
700 | &address_iterator, | 700 | &address_iterator, |
701 | &num_addresses_old); | 701 | &num_addresses_old); |
702 | GNUNET_HELLO_builder_free (builder_old); | ||
702 | if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) && | 703 | if (GNUNET_TIME_absolute_cmp (new_hello_exp, >, now) && |
703 | (GNUNET_TIME_absolute_cmp (new_hello_exp, >, old_hello_exp) || | 704 | (GNUNET_TIME_absolute_cmp (new_hello_exp, >, old_hello_exp) || |
704 | num_addresses_old < num_addresses_new)) | 705 | num_addresses_old < num_addresses_new)) |
diff --git a/src/service/transport/Makefile.am b/src/service/transport/Makefile.am index 56ed8fc13..eac451882 100644 --- a/src/service/transport/Makefile.am +++ b/src/service/transport/Makefile.am | |||
@@ -15,11 +15,10 @@ if USE_COVERAGE | |||
15 | endif | 15 | endif |
16 | 16 | ||
17 | noinst_PROGRAMS = \ | 17 | noinst_PROGRAMS = \ |
18 | test_transport_start_with_config \ | ||
19 | gnunet-communicator-udp | 18 | gnunet-communicator-udp |
20 | 19 | ||
21 | TESTING_LIBS = \ | 20 | TESTING_LIBS = \ |
22 | libgnunettransporttesting2.la | 21 | libgnunettestingtransport.la |
23 | 22 | ||
24 | lib_LTLIBRARIES = \ | 23 | lib_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 | ||
31 | libgnunettransporttesting2_la_SOURCES = \ | 30 | libgnunettestingtransport_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 \ | 43 | libgnunettestingtransport_la_LIBADD = \ |
45 | transport-testing-main2.c \ | ||
46 | transport-testing-send2.c \ | ||
47 | transport-testing-communicator.c transport-testing-communicator.h | ||
48 | libgnunettransporttesting2_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 |
56 | libgnunettransporttesting2_la_LDFLAGS = \ | 52 | libgnunettestingtransport_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 |
@@ -189,21 +185,21 @@ gnunet_service_transport_LDADD = \ | |||
189 | $(LIBGCRYPT_LIBS) \ | 185 | $(LIBGCRYPT_LIBS) \ |
190 | $(GN_LIBINTL) | 186 | $(GN_LIBINTL) |
191 | 187 | ||
192 | plugin_LTLIBRARIES = \ | 188 | #plugin_LTLIBRARIES = \ |
193 | libgnunet_test_transport_plugin_cmd_simple_send_performance.la \ | 189 | # libgnunet_test_transport_plugin_cmd_simple_send_performance.la \ |
194 | libgnunet_test_transport_plugin_cmd_nat_upnp.la \ | 190 | # libgnunet_test_transport_plugin_cmd_nat_upnp.la \ |
195 | libgnunet_test_transport_plugin_cmd_simple_send.la \ | 191 | # libgnunet_test_transport_plugin_cmd_simple_send.la \ |
196 | libgnunet_test_transport_plugin_cmd_simple_send_broadcast.la \ | 192 | # libgnunet_test_transport_plugin_cmd_simple_send_broadcast.la \ |
197 | libgnunet_test_transport_plugin_cmd_simple_send_dv.la \ | 193 | # libgnunet_test_transport_plugin_cmd_simple_send_dv.la \ |
198 | libgnunet_test_transport_plugin_cmd_udp_backchannel.la | 194 | # libgnunet_test_transport_plugin_cmd_udp_backchannel.la |
199 | 195 | ||
200 | libgnunet_test_transport_plugin_cmd_nat_upnp_la_SOURCES = \ | 196 | libgnunet_test_transport_plugin_cmd_nat_upnp_la_SOURCES = \ |
201 | test_transport_plugin_cmd_nat_upnp.c | 197 | test_transport_plugin_cmd_nat_upnp.c |
202 | libgnunet_test_transport_plugin_cmd_nat_upnp_la_LIBADD = \ | 198 | libgnunet_test_transport_plugin_cmd_nat_upnp_la_LIBADD = \ |
203 | libgnunettransporttesting2.la \ | 199 | libgnunettestingtransport.la \ |
204 | libgnunettransportapplication.la \ | 200 | libgnunettransportapplication.la \ |
205 | libgnunettransportcore.la \ | 201 | libgnunettransportcore.la \ |
206 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 202 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
207 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ | 203 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ |
208 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 204 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
209 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | 205 | $(top_builddir)/src/lib/hello/libgnunethello.la \ |
@@ -216,10 +212,10 @@ libgnunet_test_transport_plugin_cmd_nat_upnp_la_LDFLAGS = \ | |||
216 | libgnunet_test_transport_plugin_cmd_udp_backchannel_la_SOURCES = \ | 212 | libgnunet_test_transport_plugin_cmd_udp_backchannel_la_SOURCES = \ |
217 | test_transport_plugin_cmd_udp_backchannel.c | 213 | test_transport_plugin_cmd_udp_backchannel.c |
218 | libgnunet_test_transport_plugin_cmd_udp_backchannel_la_LIBADD = \ | 214 | libgnunet_test_transport_plugin_cmd_udp_backchannel_la_LIBADD = \ |
219 | libgnunettransporttesting2.la \ | 215 | libgnunettestingtransport.la \ |
220 | libgnunettransportapplication.la \ | 216 | libgnunettransportapplication.la \ |
221 | libgnunettransportcore.la \ | 217 | libgnunettransportcore.la \ |
222 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 218 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
223 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ | 219 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ |
224 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 220 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
225 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | 221 | $(top_builddir)/src/lib/hello/libgnunethello.la \ |
@@ -232,10 +228,10 @@ libgnunet_test_transport_plugin_cmd_udp_backchannel_la_LDFLAGS = \ | |||
232 | libgnunet_test_transport_plugin_cmd_simple_send_la_SOURCES = \ | 228 | libgnunet_test_transport_plugin_cmd_simple_send_la_SOURCES = \ |
233 | test_transport_plugin_cmd_simple_send.c | 229 | test_transport_plugin_cmd_simple_send.c |
234 | libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = \ | 230 | libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = \ |
235 | libgnunettransporttesting2.la \ | 231 | libgnunettestingtransport.la \ |
236 | libgnunettransportapplication.la \ | 232 | libgnunettransportapplication.la \ |
237 | libgnunettransportcore.la \ | 233 | libgnunettransportcore.la \ |
238 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 234 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
239 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ | 235 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ |
240 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 236 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
241 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | 237 | $(top_builddir)/src/lib/hello/libgnunethello.la \ |
@@ -248,10 +244,10 @@ libgnunet_test_transport_plugin_cmd_simple_send_la_LDFLAGS = \ | |||
248 | libgnunet_test_transport_plugin_cmd_simple_send_performance_la_SOURCES = \ | 244 | libgnunet_test_transport_plugin_cmd_simple_send_performance_la_SOURCES = \ |
249 | test_transport_plugin_cmd_simple_send_performance.c | 245 | test_transport_plugin_cmd_simple_send_performance.c |
250 | libgnunet_test_transport_plugin_cmd_simple_send_performance_la_LIBADD = \ | 246 | libgnunet_test_transport_plugin_cmd_simple_send_performance_la_LIBADD = \ |
251 | libgnunettransporttesting2.la \ | 247 | libgnunettestingtransport.la \ |
252 | libgnunettransportapplication.la \ | 248 | libgnunettransportapplication.la \ |
253 | libgnunettransportcore.la \ | 249 | libgnunettransportcore.la \ |
254 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 250 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
255 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ | 251 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ |
256 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 252 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
257 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | 253 | $(top_builddir)/src/lib/hello/libgnunethello.la \ |
@@ -264,10 +260,10 @@ libgnunet_test_transport_plugin_cmd_simple_send_performance_la_LDFLAGS = \ | |||
264 | libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_SOURCES = \ | 260 | libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_SOURCES = \ |
265 | test_transport_plugin_cmd_simple_send_broadcast.c | 261 | test_transport_plugin_cmd_simple_send_broadcast.c |
266 | libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_LIBADD = \ | 262 | libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_LIBADD = \ |
267 | libgnunettransporttesting2.la \ | 263 | libgnunettestingtransport.la \ |
268 | libgnunettransportapplication.la \ | 264 | libgnunettransportapplication.la \ |
269 | libgnunettransportcore.la \ | 265 | libgnunettransportcore.la \ |
270 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 266 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
271 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ | 267 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ |
272 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 268 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
273 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | 269 | $(top_builddir)/src/lib/hello/libgnunethello.la \ |
@@ -280,10 +276,10 @@ libgnunet_test_transport_plugin_cmd_simple_send_broadcast_la_LDFLAGS = \ | |||
280 | libgnunet_test_transport_plugin_cmd_simple_send_dv_la_SOURCES = \ | 276 | libgnunet_test_transport_plugin_cmd_simple_send_dv_la_SOURCES = \ |
281 | test_transport_plugin_cmd_simple_send_dv.c | 277 | test_transport_plugin_cmd_simple_send_dv.c |
282 | libgnunet_test_transport_plugin_cmd_simple_send_dv_la_LIBADD = \ | 278 | libgnunet_test_transport_plugin_cmd_simple_send_dv_la_LIBADD = \ |
283 | libgnunettransporttesting2.la \ | 279 | libgnunettestingtransport.la \ |
284 | libgnunettransportapplication.la \ | 280 | libgnunettransportapplication.la \ |
285 | libgnunettransportcore.la \ | 281 | libgnunettransportcore.la \ |
286 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 282 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
287 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ | 283 | $(top_builddir)/src/service/peerstore/libgnunetpeerstore.la \ |
288 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ | 284 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la \ |
289 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | 285 | $(top_builddir)/src/lib/hello/libgnunethello.la \ |
@@ -304,17 +300,17 @@ check_PROGRAMS = \ | |||
304 | if HAVE_EXPERIMENTAL | 300 | if HAVE_EXPERIMENTAL |
305 | check_PROGRAMS += test_communicator_basic-quic \ | 301 | check_PROGRAMS += test_communicator_basic-quic \ |
306 | test_communicator_basic-unix | 302 | test_communicator_basic-unix |
307 | check_SCRIPTS= \ | 303 | # check_SCRIPTS= \ |
308 | test_transport_start_testcase.sh \ | 304 | # test_transport_start_testcase.sh \ |
309 | test_transport_simple_send_performance.sh \ | 305 | # test_transport_simple_send_performance.sh \ |
310 | test_transport_nat_icmp_tcp.sh \ | 306 | # test_transport_nat_icmp_tcp.sh \ |
311 | test_transport_nat_upnp.sh \ | 307 | # test_transport_nat_upnp.sh \ |
312 | test_transport_simple_send_string.sh \ | 308 | # test_transport_simple_send_string.sh \ |
313 | test_transport_simple_send.sh \ | 309 | # test_transport_simple_send.sh \ |
314 | test_transport_simple_send_broadcast.sh \ | 310 | # test_transport_simple_send_broadcast.sh \ |
315 | test_transport_udp_backchannel.sh \ | 311 | # test_transport_udp_backchannel.sh \ |
316 | test_transport_simple_send_dv_circle.sh \ | 312 | # test_transport_simple_send_dv_circle.sh \ |
317 | test_transport_simple_send_dv_inverse.sh | 313 | # test_transport_simple_send_dv_inverse.sh |
318 | endif | 314 | endif |
319 | 315 | ||
320 | if ENABLE_TEST_RUN | 316 | if ENABLE_TEST_RUN |
@@ -325,76 +321,68 @@ TESTS = \ | |||
325 | endif | 321 | endif |
326 | 322 | ||
327 | 323 | ||
328 | test_transport_start_with_config_SOURCES = \ | ||
329 | test_transport_start_with_config.c | ||
330 | test_transport_start_with_config_LDADD = \ | ||
331 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | ||
332 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | ||
333 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | ||
334 | libgnunettransportcore.la \ | ||
335 | libgnunettransporttesting2.la | ||
336 | 324 | ||
337 | test_communicator_basic_unix_SOURCES = \ | 325 | test_communicator_basic_unix_SOURCES = \ |
338 | test_communicator_basic.c | 326 | test_communicator_basic.c |
339 | test_communicator_basic_unix_LDADD = \ | 327 | test_communicator_basic_unix_LDADD = \ |
340 | libgnunettransporttesting2.la \ | 328 | libgnunettestingtransport.la \ |
341 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 329 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
342 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 330 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
343 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la | 331 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la |
344 | 332 | ||
345 | test_communicator_basic_tcp_SOURCES = \ | 333 | test_communicator_basic_tcp_SOURCES = \ |
346 | test_communicator_basic.c | 334 | test_communicator_basic.c |
347 | test_communicator_basic_tcp_LDADD = \ | 335 | test_communicator_basic_tcp_LDADD = \ |
348 | libgnunettransporttesting2.la \ | 336 | libgnunettestingtransport.la \ |
349 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 337 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
350 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 338 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
351 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la | 339 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la |
352 | 340 | ||
353 | test_communicator_basic_udp_SOURCES = \ | 341 | test_communicator_basic_udp_SOURCES = \ |
354 | test_communicator_basic.c | 342 | test_communicator_basic.c |
355 | test_communicator_basic_udp_LDADD = \ | 343 | test_communicator_basic_udp_LDADD = \ |
356 | libgnunettransporttesting2.la \ | 344 | libgnunettestingtransport.la \ |
357 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 345 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
358 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 346 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
359 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la | 347 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la |
360 | 348 | ||
361 | test_communicator_basic_quic_SOURCES = \ | 349 | test_communicator_basic_quic_SOURCES = \ |
362 | test_communicator_basic.c | 350 | test_communicator_basic.c |
363 | test_communicator_basic_quic_LDADD = \ | 351 | test_communicator_basic_quic_LDADD = \ |
364 | libgnunettransporttesting2.la \ | 352 | libgnunettestingtransport.la \ |
365 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 353 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
366 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 354 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
367 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la | 355 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la |
368 | 356 | ||
369 | test_communicator_rekey_tcp_SOURCES = \ | 357 | test_communicator_rekey_tcp_SOURCES = \ |
370 | test_communicator_basic.c | 358 | test_communicator_basic.c |
371 | test_communicator_rekey_tcp_LDADD = \ | 359 | test_communicator_rekey_tcp_LDADD = \ |
372 | libgnunettransporttesting2.la \ | 360 | libgnunettestingtransport.la \ |
373 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 361 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
374 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 362 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
375 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la | 363 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la |
376 | 364 | ||
377 | test_communicator_rekey_udp_SOURCES = \ | 365 | test_communicator_rekey_udp_SOURCES = \ |
378 | test_communicator_basic.c | 366 | test_communicator_basic.c |
379 | test_communicator_rekey_udp_LDADD = \ | 367 | test_communicator_rekey_udp_LDADD = \ |
380 | libgnunettransporttesting2.la \ | 368 | libgnunettestingtransport.la \ |
381 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 369 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
382 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 370 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
383 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la | 371 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la |
384 | 372 | ||
385 | test_communicator_backchannel_udp_SOURCES = \ | 373 | test_communicator_backchannel_udp_SOURCES = \ |
386 | test_communicator_basic.c | 374 | test_communicator_basic.c |
387 | test_communicator_backchannel_udp_LDADD = \ | 375 | test_communicator_backchannel_udp_LDADD = \ |
388 | libgnunettransporttesting2.la \ | 376 | libgnunettestingtransport.la \ |
389 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 377 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
390 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 378 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
391 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la | 379 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la |
392 | 380 | ||
393 | test_communicator_bidirect_tcp_SOURCES = \ | 381 | test_communicator_bidirect_tcp_SOURCES = \ |
394 | test_communicator_basic.c | 382 | test_communicator_basic.c |
395 | test_communicator_bidirect_tcp_LDADD = \ | 383 | test_communicator_bidirect_tcp_LDADD = \ |
396 | libgnunettransporttesting2.la \ | 384 | libgnunettestingtransport.la \ |
397 | $(top_builddir)/src/service/testing/libgnunettesting.la \ | 385 | $(top_builddir)/src/lib/testing/libgnunettesting.la \ |
398 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 386 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
399 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la | 387 | $(top_builddir)/src/service/statistics/libgnunetstatistics.la |
400 | 388 | ||
@@ -403,7 +391,7 @@ test_transport_api2_tcp_SOURCES = \ | |||
403 | test_transport_api2_tcp_LDADD = \ | 391 | test_transport_api2_tcp_LDADD = \ |
404 | $(top_builddir)/src/lib/hello/libgnunethello.la \ | 392 | $(top_builddir)/src/lib/hello/libgnunethello.la \ |
405 | $(top_builddir)/src/lib/util/libgnunetutil.la \ | 393 | $(top_builddir)/src/lib/util/libgnunetutil.la \ |
406 | libgnunettransporttesting2.la | 394 | libgnunettestingtransport.la |
407 | 395 | ||
408 | EXTRA_DIST = \ | 396 | EXTRA_DIST = \ |
409 | test_transport_start_testcase.sh \ | 397 | test_transport_start_testcase.sh \ |
diff --git a/src/service/transport/gnunet-communicator-tcp.c b/src/service/transport/gnunet-communicator-tcp.c index 02a547335..5d9b9055f 100644 --- a/src/service/transport/gnunet-communicator-tcp.c +++ b/src/service/transport/gnunet-communicator-tcp.c | |||
@@ -27,8 +27,8 @@ | |||
27 | * - support NAT connection reversal method (#5529) | 27 | * - support NAT connection reversal method (#5529) |
28 | * - support other TCP-specific NAT traversal methods (#5531) | 28 | * - support other TCP-specific NAT traversal methods (#5531) |
29 | */ | 29 | */ |
30 | #include "gnunet_common.h" | ||
31 | #include "platform.h" | 30 | #include "platform.h" |
31 | #include "gnunet_common.h" | ||
32 | #include "gnunet_util_lib.h" | 32 | #include "gnunet_util_lib.h" |
33 | #include "gnunet_core_service.h" | 33 | #include "gnunet_core_service.h" |
34 | #include "gnunet_peerstore_service.h" | 34 | #include "gnunet_peerstore_service.h" |
@@ -2369,7 +2369,6 @@ extract_address (const char *bindto) | |||
2369 | char *token; | 2369 | char *token; |
2370 | char *cp; | 2370 | char *cp; |
2371 | char *rest = NULL; | 2371 | char *rest = NULL; |
2372 | char *res; | ||
2373 | 2372 | ||
2374 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2373 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2375 | "extract address with bindto %s\n", | 2374 | "extract address with bindto %s\n", |
@@ -2402,8 +2401,7 @@ extract_address (const char *bindto) | |||
2402 | else | 2401 | else |
2403 | { | 2402 | { |
2404 | token++; | 2403 | token++; |
2405 | res = GNUNET_strdup (token); | 2404 | addr = GNUNET_strdup (token); |
2406 | addr = GNUNET_strdup (res); | ||
2407 | } | 2405 | } |
2408 | } | 2406 | } |
2409 | 2407 | ||
@@ -3349,6 +3347,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address) | |||
3349 | { | 3347 | { |
3350 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3348 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3351 | "Queue for %s already exists or is in construction\n", address); | 3349 | "Queue for %s already exists or is in construction\n", address); |
3350 | GNUNET_free (in); | ||
3352 | return GNUNET_NO; | 3351 | return GNUNET_NO; |
3353 | } | 3352 | } |
3354 | switch (in->sa_family) | 3353 | switch (in->sa_family) |
@@ -3799,7 +3798,8 @@ init_socket (struct sockaddr *addr, | |||
3799 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3798 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3800 | "Bound to `%s'\n", | 3799 | "Bound to `%s'\n", |
3801 | GNUNET_a2s ((const struct sockaddr *) &in_sto, sto_len)); | 3800 | GNUNET_a2s ((const struct sockaddr *) &in_sto, sto_len)); |
3802 | stats = GNUNET_STATISTICS_create ("communicator-tcp", cfg); | 3801 | if (NULL == stats) |
3802 | stats = GNUNET_STATISTICS_create ("communicator-tcp", cfg); | ||
3803 | 3803 | ||
3804 | if (NULL == is) | 3804 | if (NULL == is) |
3805 | is = GNUNET_NT_scanner_init (); | 3805 | is = GNUNET_NT_scanner_init (); |
diff --git a/src/service/transport/gnunet-communicator-udp.c b/src/service/transport/gnunet-communicator-udp.c index e9496c571..fa5294218 100644 --- a/src/service/transport/gnunet-communicator-udp.c +++ b/src/service/transport/gnunet-communicator-udp.c | |||
@@ -883,6 +883,8 @@ bi_destroy (struct BroadcastInterface *bi) | |||
883 | GNUNET_free (bi); | 883 | GNUNET_free (bi); |
884 | } | 884 | } |
885 | 885 | ||
886 | static int | ||
887 | secret_destroy (struct SharedSecret *ss); | ||
886 | 888 | ||
887 | /** | 889 | /** |
888 | * Destroys a receiving state due to timeout or shutdown. | 890 | * Destroys a receiving state due to timeout or shutdown. |
@@ -892,7 +894,7 @@ bi_destroy (struct BroadcastInterface *bi) | |||
892 | static void | 894 | static void |
893 | receiver_destroy (struct ReceiverAddress *receiver) | 895 | receiver_destroy (struct ReceiverAddress *receiver) |
894 | { | 896 | { |
895 | 897 | struct SharedSecret *ss; | |
896 | receiver->receiver_destroy_called = GNUNET_YES; | 898 | receiver->receiver_destroy_called = GNUNET_YES; |
897 | 899 | ||
898 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 900 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -909,6 +911,11 @@ receiver_destroy (struct ReceiverAddress *receiver) | |||
909 | GNUNET_TRANSPORT_communicator_mq_del (receiver->d_qh); | 911 | GNUNET_TRANSPORT_communicator_mq_del (receiver->d_qh); |
910 | receiver->d_qh = NULL; | 912 | receiver->d_qh = NULL; |
911 | } | 913 | } |
914 | else if (NULL != receiver->d_mq) | ||
915 | { | ||
916 | GNUNET_MQ_destroy (receiver->d_mq); | ||
917 | receiver->d_mq = NULL; | ||
918 | } | ||
912 | GNUNET_assert (GNUNET_YES == | 919 | GNUNET_assert (GNUNET_YES == |
913 | GNUNET_CONTAINER_multihashmap_remove (receivers, | 920 | GNUNET_CONTAINER_multihashmap_remove (receivers, |
914 | &receiver->key, | 921 | &receiver->key, |
@@ -918,6 +925,10 @@ receiver_destroy (struct ReceiverAddress *receiver) | |||
918 | "# receivers active", | 925 | "# receivers active", |
919 | GNUNET_CONTAINER_multihashmap_size (receivers), | 926 | GNUNET_CONTAINER_multihashmap_size (receivers), |
920 | GNUNET_NO); | 927 | GNUNET_NO); |
928 | while (NULL != (ss = receiver->ss_head)) | ||
929 | { | ||
930 | secret_destroy (ss); | ||
931 | } | ||
921 | GNUNET_free (receiver->address); | 932 | GNUNET_free (receiver->address); |
922 | GNUNET_free (receiver->foreign_addr); | 933 | GNUNET_free (receiver->foreign_addr); |
923 | GNUNET_free (receiver); | 934 | GNUNET_free (receiver); |
@@ -1065,6 +1076,7 @@ secret_destroy (struct SharedSecret *ss) | |||
1065 | static void | 1076 | static void |
1066 | sender_destroy (struct SenderAddress *sender) | 1077 | sender_destroy (struct SenderAddress *sender) |
1067 | { | 1078 | { |
1079 | struct SharedSecret *ss; | ||
1068 | sender->sender_destroy_called = GNUNET_YES; | 1080 | sender->sender_destroy_called = GNUNET_YES; |
1069 | GNUNET_assert ( | 1081 | GNUNET_assert ( |
1070 | GNUNET_YES == | 1082 | GNUNET_YES == |
@@ -1074,6 +1086,10 @@ sender_destroy (struct SenderAddress *sender) | |||
1074 | "# senders active", | 1086 | "# senders active", |
1075 | GNUNET_CONTAINER_multihashmap_size (senders), | 1087 | GNUNET_CONTAINER_multihashmap_size (senders), |
1076 | GNUNET_NO); | 1088 | GNUNET_NO); |
1089 | while (NULL != (ss = sender->ss_head)) | ||
1090 | { | ||
1091 | secret_destroy (ss); | ||
1092 | } | ||
1077 | GNUNET_free (sender->address); | 1093 | GNUNET_free (sender->address); |
1078 | GNUNET_free (sender); | 1094 | GNUNET_free (sender); |
1079 | } | 1095 | } |
@@ -2892,6 +2908,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address) | |||
2892 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2908 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2893 | "receiver %s already exist or is being connected to\n", | 2909 | "receiver %s already exist or is being connected to\n", |
2894 | address); | 2910 | address); |
2911 | GNUNET_free (in); | ||
2895 | return GNUNET_NO; | 2912 | return GNUNET_NO; |
2896 | } | 2913 | } |
2897 | 2914 | ||
diff --git a/src/service/transport/gnunet-service-transport.c b/src/service/transport/gnunet-service-transport.c index f4be5e759..91ce801db 100644 --- a/src/service/transport/gnunet-service-transport.c +++ b/src/service/transport/gnunet-service-transport.c | |||
@@ -920,7 +920,7 @@ struct TransportValidationResponseMessage | |||
920 | struct TransportGlobalNattedAddress | 920 | struct TransportGlobalNattedAddress |
921 | { | 921 | { |
922 | /** | 922 | /** |
923 | * Length of the address following the struct. | 923 | * Length of the address following the struct in NBO. |
924 | */ | 924 | */ |
925 | unsigned int address_length; | 925 | unsigned int address_length; |
926 | 926 | ||
@@ -3657,6 +3657,8 @@ remove_global_addresses (void *cls, | |||
3657 | struct TransportGlobalNattedAddress *tgna = value; | 3657 | struct TransportGlobalNattedAddress *tgna = value; |
3658 | 3658 | ||
3659 | GNUNET_free (tgna); | 3659 | GNUNET_free (tgna); |
3660 | |||
3661 | return GNUNET_OK; | ||
3660 | } | 3662 | } |
3661 | 3663 | ||
3662 | 3664 | ||
@@ -3681,6 +3683,7 @@ free_neighbour (struct Neighbour *neighbour) | |||
3681 | GNUNET_CONTAINER_multipeermap_iterate (neighbour->natted_addresses, | 3683 | GNUNET_CONTAINER_multipeermap_iterate (neighbour->natted_addresses, |
3682 | &remove_global_addresses, | 3684 | &remove_global_addresses, |
3683 | NULL); | 3685 | NULL); |
3686 | GNUNET_CONTAINER_multipeermap_destroy (neighbour->natted_addresses); | ||
3684 | while (NULL != (dvh = neighbour->dv_head)) | 3687 | while (NULL != (dvh = neighbour->dv_head)) |
3685 | { | 3688 | { |
3686 | struct DistanceVector *dv = dvh->dv; | 3689 | struct DistanceVector *dv = dvh->dv; |
@@ -5344,27 +5347,35 @@ static char * | |||
5344 | get_address_without_port (const char *address); | 5347 | get_address_without_port (const char *address); |
5345 | 5348 | ||
5346 | 5349 | ||
5350 | struct AddGlobalAddressesContext | ||
5351 | { | ||
5352 | size_t off; | ||
5353 | char *tgnas; | ||
5354 | }; | ||
5355 | |||
5356 | |||
5347 | static enum GNUNET_GenericReturnValue | 5357 | static enum GNUNET_GenericReturnValue |
5348 | add_global_addresses (void *cls, | 5358 | add_global_addresses (void *cls, |
5349 | const struct GNUNET_PeerIdentity *pid, | 5359 | const struct GNUNET_PeerIdentity *pid, |
5350 | void *value) | 5360 | void *value) |
5351 | { | 5361 | { |
5352 | char *tgnas = cls; | 5362 | struct AddGlobalAddressesContext *ctx = cls; |
5353 | struct TransportGlobalNattedAddress *tgna = value; | 5363 | struct TransportGlobalNattedAddress *tgna = value; |
5354 | char *addr = (char *) &tgna[1]; | 5364 | char *addr = (char *) &tgna[1]; |
5355 | size_t address_len = strlen (addr); | 5365 | size_t address_len = strlen (addr); |
5356 | unsigned int off = 0; | ||
5357 | 5366 | ||
5358 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 5367 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
5359 | "sending address %s length %u\n", | 5368 | "sending address %s length %lu\n", |
5360 | addr, | 5369 | addr, |
5361 | address_len); | 5370 | address_len); |
5362 | tgna = GNUNET_malloc (sizeof (struct TransportGlobalNattedAddress) + address_len); | 5371 | tgna = GNUNET_malloc (sizeof (struct TransportGlobalNattedAddress) + address_len); |
5363 | tgna->address_length = htonl (address_len); | 5372 | tgna->address_length = htonl (address_len); |
5364 | GNUNET_memcpy (&tgna[1], addr, address_len); | 5373 | GNUNET_memcpy (&tgna[1], addr, address_len); |
5365 | GNUNET_memcpy (&tgnas[off], tgna, sizeof (struct TransportGlobalNattedAddress) + address_len); | 5374 | GNUNET_memcpy (&(ctx->tgnas[ctx->off]), tgna, sizeof (struct TransportGlobalNattedAddress) + address_len); |
5366 | GNUNET_free (tgna); | 5375 | GNUNET_free (tgna); |
5367 | off += sizeof(struct TransportGlobalNattedAddress) + address_len; | 5376 | ctx->off += sizeof(struct TransportGlobalNattedAddress) + address_len; |
5377 | |||
5378 | return GNUNET_OK; | ||
5368 | } | 5379 | } |
5369 | 5380 | ||
5370 | 5381 | ||
@@ -5386,17 +5397,20 @@ consider_sending_fc (void *cls) | |||
5386 | 5397 | ||
5387 | if (0 < n->number_of_addresses) | 5398 | if (0 < n->number_of_addresses) |
5388 | { | 5399 | { |
5389 | char *tgnas = GNUNET_malloc (n->number_of_addresses * sizeof (struct TransportGlobalNattedAddress) + n->size_of_global_addresses); | 5400 | size_t addresses_size = |
5390 | 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; | ||
5391 | 5406 | ||
5392 | addresses_size = n->number_of_addresses * sizeof (struct TransportGlobalNattedAddress) + n->size_of_global_addresses; | ||
5393 | fc = GNUNET_malloc (sizeof (struct TransportFlowControlMessage) + addresses_size); | 5407 | fc = GNUNET_malloc (sizeof (struct TransportFlowControlMessage) + addresses_size); |
5394 | fc->header.size = htons (sizeof(struct TransportFlowControlMessage) + addresses_size); | 5408 | fc->header.size = htons (sizeof(struct TransportFlowControlMessage) + addresses_size); |
5395 | fc->size_of_addresses = htonl (n->size_of_global_addresses); | 5409 | fc->size_of_addresses = htonl (n->size_of_global_addresses); |
5396 | fc->number_of_addresses = htonl (n->number_of_addresses); | 5410 | fc->number_of_addresses = htonl (n->number_of_addresses); |
5397 | GNUNET_CONTAINER_multipeermap_iterate (n->natted_addresses, | 5411 | GNUNET_CONTAINER_multipeermap_iterate (n->natted_addresses, |
5398 | &add_global_addresses, | 5412 | &add_global_addresses, |
5399 | tgnas); | 5413 | &ctx); |
5400 | GNUNET_memcpy (&fc[1], tgnas, addresses_size); | 5414 | GNUNET_memcpy (&fc[1], tgnas, addresses_size); |
5401 | GNUNET_free (tgnas); | 5415 | GNUNET_free (tgnas); |
5402 | } | 5416 | } |
@@ -5939,19 +5953,16 @@ handle_add_address (void *cls, | |||
5939 | struct TransportClient *tc = cls; | 5953 | struct TransportClient *tc = cls; |
5940 | struct AddressListEntry *ale; | 5954 | struct AddressListEntry *ale; |
5941 | size_t slen; | 5955 | size_t slen; |
5942 | char *address; | ||
5943 | 5956 | ||
5944 | /* 0-termination of &aam[1] was checked in #check_add_address */ | 5957 | /* 0-termination of &aam[1] was checked in #check_add_address */ |
5945 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 5958 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
5946 | "Communicator added address `%s'!\n", | 5959 | "Communicator added address `%s'!\n", |
5947 | (const char *) &aam[1]); | 5960 | (const char *) &aam[1]); |
5948 | slen = ntohs (aam->header.size) - sizeof(*aam); | 5961 | slen = ntohs (aam->header.size) - sizeof(*aam); |
5949 | address = GNUNET_malloc (slen); | ||
5950 | memcpy (address, &aam[1], slen); | ||
5951 | ale = create_address_entry (tc, | 5962 | ale = create_address_entry (tc, |
5952 | GNUNET_TIME_relative_ntoh (aam->expiration), | 5963 | GNUNET_TIME_relative_ntoh (aam->expiration), |
5953 | (enum GNUNET_NetworkType) ntohl (aam->nt), | 5964 | (enum GNUNET_NetworkType) ntohl (aam->nt), |
5954 | address, | 5965 | (const char *) &aam[1], |
5955 | aam->aid, | 5966 | aam->aid, |
5956 | slen); | 5967 | slen); |
5957 | GNUNET_CONTAINER_DLL_insert (tc->details.communicator.addr_head, | 5968 | GNUNET_CONTAINER_DLL_insert (tc->details.communicator.addr_head, |
@@ -9610,11 +9621,10 @@ static int | |||
9610 | check_flow_control (void *cls, const struct TransportFlowControlMessage *fc) | 9621 | check_flow_control (void *cls, const struct TransportFlowControlMessage *fc) |
9611 | { | 9622 | { |
9612 | (void) cls; | 9623 | (void) cls; |
9613 | struct TransportGlobalNattedAddress *addresses = (struct TransportGlobalNattedAddress *) &fc[1]; | ||
9614 | unsigned int number_of_addresses = ntohl (fc->number_of_addresses); | 9624 | unsigned int number_of_addresses = ntohl (fc->number_of_addresses); |
9615 | 9625 | ||
9616 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 9626 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
9617 | "Flow control header size %u size of addresses %u number of addresses %u size of message struct %u second struct %u\n", | 9627 | "Flow control header size %u size of addresses %u number of addresses %u size of message struct %lu second struct %lu\n", |
9618 | ntohs (fc->header.size), | 9628 | ntohs (fc->header.size), |
9619 | ntohl (fc->size_of_addresses), | 9629 | ntohl (fc->size_of_addresses), |
9620 | ntohl (fc->number_of_addresses), | 9630 | ntohl (fc->number_of_addresses), |
@@ -11595,16 +11605,14 @@ iterate_address_and_compare_cb (void *cls, | |||
11595 | const char *uri) | 11605 | const char *uri) |
11596 | { | 11606 | { |
11597 | struct Queue *queue = cls; | 11607 | struct Queue *queue = cls; |
11598 | struct Neighbour *neighbour = queue->neighbour; | ||
11599 | const char *dash; | ||
11600 | const char *slash; | 11608 | const char *slash; |
11601 | char *address_uri; | 11609 | char *address_uri; |
11602 | char *prefix; | 11610 | char *prefix; |
11603 | char *uri_without_port; | 11611 | char *uri_without_port; |
11604 | char *address_uri_without_port = get_address_without_port (queue->address); | 11612 | char *address_uri_without_port; |
11605 | 11613 | ||
11606 | slash = strrchr (uri, '/'); | 11614 | slash = strrchr (uri, '/'); |
11607 | prefix = GNUNET_strndup (uri, (slash - uri) - 2); | 11615 | prefix = GNUNET_strndup (uri, (slash - uri) - 2); |
11608 | GNUNET_assert (NULL != slash); | 11616 | GNUNET_assert (NULL != slash); |
11609 | slash++; | 11617 | slash++; |
11610 | GNUNET_asprintf (&address_uri, | 11618 | GNUNET_asprintf (&address_uri, |
@@ -11674,7 +11682,8 @@ contains_address (void *cls, | |||
11674 | struct TransportGlobalNattedAddress *tgna = value; | 11682 | struct TransportGlobalNattedAddress *tgna = value; |
11675 | char *addr = (char *) &tgna[1]; | 11683 | char *addr = (char *) &tgna[1]; |
11676 | 11684 | ||
11677 | if (0 == GNUNET_memcmp (addr, tgna_cls->addr)) | 11685 | if (strlen(tgna_cls->addr) == ntohl (tgna->address_length) |
11686 | && 0 == strncmp (addr, tgna_cls->addr, ntohl (tgna->address_length))) | ||
11678 | { | 11687 | { |
11679 | tgna_cls->tgna = tgna; | 11688 | tgna_cls->tgna = tgna; |
11680 | return GNUNET_NO; | 11689 | return GNUNET_NO; |
@@ -11728,18 +11737,20 @@ check_for_global_natted (void *cls, | |||
11728 | GNUNET_HELLO_builder_free (builder); | 11737 | GNUNET_HELLO_builder_free (builder); |
11729 | 11738 | ||
11730 | tgna_cls.addr = get_address_without_port (queue->address); | 11739 | tgna_cls.addr = get_address_without_port (queue->address); |
11740 | tgna_cls.tgna = NULL; | ||
11731 | address_len_without_port = strlen (tgna_cls.addr); | 11741 | address_len_without_port = strlen (tgna_cls.addr); |
11732 | GNUNET_CONTAINER_multipeermap_get_multiple (neighbour->natted_addresses, | 11742 | GNUNET_CONTAINER_multipeermap_get_multiple (neighbour->natted_addresses, |
11733 | &neighbour->pid, | 11743 | &neighbour->pid, |
11734 | &contains_address, | 11744 | &contains_address, |
11735 | &tgna_cls); | 11745 | &tgna_cls); |
11736 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 11746 | if (NULL != tgna_cls.tgna) |
11737 | " tgna_cls.tgna tgna %p %u %u %u\n", | 11747 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
11738 | tgna_cls.tgna, | 11748 | " tgna_cls.tgna tgna %p %lu %u %u\n", |
11739 | neighbour->size_of_global_addresses, | 11749 | tgna_cls.tgna, |
11740 | tgna_cls.tgna->address_length, | 11750 | neighbour->size_of_global_addresses, |
11741 | neighbour->number_of_addresses); | 11751 | ntohl (tgna_cls.tgna->address_length), |
11742 | if (0 == tgna_cls.tgna->address_length && GNUNET_YES == queue->is_global_natted) | 11752 | neighbour->number_of_addresses); |
11753 | if (NULL == tgna_cls.tgna && GNUNET_YES == queue->is_global_natted) | ||
11743 | { | 11754 | { |
11744 | struct TransportGlobalNattedAddress *tgna; | 11755 | struct TransportGlobalNattedAddress *tgna; |
11745 | 11756 | ||
@@ -11756,7 +11767,7 @@ check_for_global_natted (void *cls, | |||
11756 | "Created tgna %p\n", | 11767 | "Created tgna %p\n", |
11757 | tgna); | 11768 | tgna); |
11758 | } | 11769 | } |
11759 | else if (0 != tgna_cls.tgna->address_length && GNUNET_NO == queue->is_global_natted) | 11770 | else if (NULL != tgna_cls.tgna && GNUNET_NO == queue->is_global_natted) |
11760 | { | 11771 | { |
11761 | GNUNET_CONTAINER_multipeermap_remove (neighbour->natted_addresses, | 11772 | GNUNET_CONTAINER_multipeermap_remove (neighbour->natted_addresses, |
11762 | &neighbour->pid, | 11773 | &neighbour->pid, |
diff --git a/src/service/transport/meson.build b/src/service/transport/meson.build index 1fdc47699..2f01c4a44 100644 --- a/src/service/transport/meson.build +++ b/src/service/transport/meson.build | |||
@@ -74,23 +74,10 @@ 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') |
75 | libgnunettransportmonitor_dep = declare_dependency(link_with : libgnunettransportmonitor) | 75 | libgnunettransportmonitor_dep = declare_dependency(link_with : libgnunettransportmonitor) |
76 | 76 | ||
77 | libgnunettransporttesting2 = library('gnunettransporttesting2', | 77 | libgnunettestingtransport = library('gnunettestingtransport', |
78 | [ | 78 | [ |
79 | 'transport_api_traits.c', | 79 | 'testing_transport_traits.c', |
80 | 'transport_api_cmd_connecting_peers.c', | 80 | 'transport-testing-communicator.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 | ], | 81 | ], |
95 | soversion: '0', | 82 | soversion: '0', |
96 | version: '0.0.0', | 83 | version: '0.0.0', |
@@ -103,7 +90,7 @@ libgnunettransporttesting2 = library('gnunettransporttesting2', | |||
103 | include_directories: [incdir, configuration_inc], | 90 | include_directories: [incdir, configuration_inc], |
104 | install: true, | 91 | install: true, |
105 | install_dir: get_option('libdir')) | 92 | install_dir: get_option('libdir')) |
106 | libgnunettransporttesting2_dep = declare_dependency(link_with : libgnunettransporttesting2) | 93 | libgnunettestingtransport_dep = declare_dependency(link_with : libgnunettestingtransport) |
107 | 94 | ||
108 | executable ('gnunet-service-transport', | 95 | executable ('gnunet-service-transport', |
109 | gnunetservicetransport_src, | 96 | gnunetservicetransport_src, |
@@ -168,12 +155,14 @@ executable ('gnunet-communicator-quic', | |||
168 | install_dir: get_option('libdir') / 'gnunet' / 'libexec') | 155 | install_dir: get_option('libdir') / 'gnunet' / 'libexec') |
169 | endif | 156 | endif |
170 | 157 | ||
158 | if false | ||
159 | |||
171 | libgnunettesttransport_cmd_simplesend = library('gnunet_test_transport_plugin_cmd_simple_send', | 160 | libgnunettesttransport_cmd_simplesend = library('gnunet_test_transport_plugin_cmd_simple_send', |
172 | ['test_transport_plugin_cmd_simple_send.c'], | 161 | ['test_transport_plugin_cmd_simple_send.c'], |
173 | dependencies: [ | 162 | dependencies: [ |
174 | libgnunetutil_dep, | 163 | libgnunetutil_dep, |
175 | libgnunettransportapplication_dep, | 164 | libgnunettransportapplication_dep, |
176 | libgnunettransporttesting2_dep, | 165 | libgnunettestingtransport_dep, |
177 | libgnunettransportcore_dep, | 166 | libgnunettransportcore_dep, |
178 | libgnunettesting_dep, | 167 | libgnunettesting_dep, |
179 | libgnunetpeerstore_dep, | 168 | libgnunetpeerstore_dep, |
@@ -191,7 +180,7 @@ libgnunettesttransport_cmd_simplesendbc = library('gnunet_test_transport_plugin_ | |||
191 | dependencies: [ | 180 | dependencies: [ |
192 | libgnunetutil_dep, | 181 | libgnunetutil_dep, |
193 | libgnunettransportapplication_dep, | 182 | libgnunettransportapplication_dep, |
194 | libgnunettransporttesting2_dep, | 183 | libgnunettestingtransport_dep, |
195 | libgnunettransportcore_dep, | 184 | libgnunettransportcore_dep, |
196 | libgnunettesting_dep, | 185 | libgnunettesting_dep, |
197 | libgnunetpeerstore_dep, | 186 | libgnunetpeerstore_dep, |
@@ -209,7 +198,7 @@ libgnunettesttransport_cmd_simplesenddv = library('gnunet_test_transport_plugin_ | |||
209 | dependencies: [ | 198 | dependencies: [ |
210 | libgnunetutil_dep, | 199 | libgnunetutil_dep, |
211 | libgnunettransportapplication_dep, | 200 | libgnunettransportapplication_dep, |
212 | libgnunettransporttesting2_dep, | 201 | libgnunettestingtransport_dep, |
213 | libgnunettransportcore_dep, | 202 | libgnunettransportcore_dep, |
214 | libgnunettesting_dep, | 203 | libgnunettesting_dep, |
215 | libgnunetpeerstore_dep, | 204 | libgnunetpeerstore_dep, |
@@ -227,7 +216,7 @@ libgnunettesttransport_cmd_simplesendperf = library('gnunet_test_transport_plugi | |||
227 | dependencies: [ | 216 | dependencies: [ |
228 | libgnunetutil_dep, | 217 | libgnunetutil_dep, |
229 | libgnunettransportapplication_dep, | 218 | libgnunettransportapplication_dep, |
230 | libgnunettransporttesting2_dep, | 219 | libgnunettestingtransport_dep, |
231 | libgnunettransportcore_dep, | 220 | libgnunettransportcore_dep, |
232 | libgnunettesting_dep, | 221 | libgnunettesting_dep, |
233 | libgnunetpeerstore_dep, | 222 | libgnunetpeerstore_dep, |
@@ -244,7 +233,7 @@ libgnunettesttransport_cmd_udpback = library('gnunet_test_transport_plugin_cmd_u | |||
244 | ['test_transport_plugin_cmd_udp_backchannel.c'], | 233 | ['test_transport_plugin_cmd_udp_backchannel.c'], |
245 | dependencies: [ | 234 | dependencies: [ |
246 | libgnunetutil_dep, | 235 | libgnunetutil_dep, |
247 | libgnunettransporttesting2_dep, | 236 | libgnunettestingtransport_dep, |
248 | libgnunettransportapplication_dep, | 237 | libgnunettransportapplication_dep, |
249 | libgnunettransportcore_dep, | 238 | libgnunettransportcore_dep, |
250 | libgnunettesting_dep, | 239 | libgnunettesting_dep, |
@@ -263,7 +252,7 @@ libgnunettesttransport_cmd_natupnp = library('gnunet_test_transport_plugin_cmd_n | |||
263 | dependencies: [ | 252 | dependencies: [ |
264 | libgnunetutil_dep, | 253 | libgnunetutil_dep, |
265 | libgnunettransportapplication_dep, | 254 | libgnunettransportapplication_dep, |
266 | libgnunettransporttesting2_dep, | 255 | libgnunettestingtransport_dep, |
267 | libgnunettransportcore_dep, | 256 | libgnunettransportcore_dep, |
268 | libgnunettesting_dep, | 257 | libgnunettesting_dep, |
269 | libgnunetpeerstore_dep, | 258 | libgnunetpeerstore_dep, |
@@ -275,6 +264,7 @@ libgnunettesttransport_cmd_natupnp = library('gnunet_test_transport_plugin_cmd_n | |||
275 | include_directories: [incdir, configuration_inc], | 264 | include_directories: [incdir, configuration_inc], |
276 | install: true, | 265 | install: true, |
277 | install_dir: get_option('libdir')/'gnunet') | 266 | install_dir: get_option('libdir')/'gnunet') |
267 | endif | ||
278 | 268 | ||
279 | configure_file(input : 'test_transport_defaults.conf', | 269 | configure_file(input : 'test_transport_defaults.conf', |
280 | output : 'test_transport_defaults.conf', | 270 | output : 'test_transport_defaults.conf', |
@@ -317,7 +307,7 @@ testcommunicator_basic_unix = executable('test_communicator_basic-unix', | |||
317 | dependencies: [ | 307 | dependencies: [ |
318 | libgnunetutil_dep, | 308 | libgnunetutil_dep, |
319 | libgnunettransportapplication_dep, | 309 | libgnunettransportapplication_dep, |
320 | libgnunettransporttesting2_dep, | 310 | libgnunettestingtransport_dep, |
321 | libgnunettransportcore_dep, | 311 | libgnunettransportcore_dep, |
322 | libgnunettesting_dep, | 312 | libgnunettesting_dep, |
323 | libgnunetpeerstore_dep, | 313 | libgnunetpeerstore_dep, |
@@ -333,7 +323,7 @@ testcommunicator_basic_tcp = executable('test_communicator_basic-tcp', | |||
333 | dependencies: [ | 323 | dependencies: [ |
334 | libgnunetutil_dep, | 324 | libgnunetutil_dep, |
335 | libgnunettransportapplication_dep, | 325 | libgnunettransportapplication_dep, |
336 | libgnunettransporttesting2_dep, | 326 | libgnunettestingtransport_dep, |
337 | libgnunettransportcore_dep, | 327 | libgnunettransportcore_dep, |
338 | libgnunettesting_dep, | 328 | libgnunettesting_dep, |
339 | libgnunetpeerstore_dep, | 329 | libgnunetpeerstore_dep, |
@@ -349,7 +339,7 @@ testcommunicator_basic_udp = executable('test_communicator_basic-udp', | |||
349 | dependencies: [ | 339 | dependencies: [ |
350 | libgnunetutil_dep, | 340 | libgnunetutil_dep, |
351 | libgnunettransportapplication_dep, | 341 | libgnunettransportapplication_dep, |
352 | libgnunettransporttesting2_dep, | 342 | libgnunettestingtransport_dep, |
353 | libgnunettransportcore_dep, | 343 | libgnunettransportcore_dep, |
354 | libgnunettesting_dep, | 344 | libgnunettesting_dep, |
355 | libgnunetpeerstore_dep, | 345 | libgnunetpeerstore_dep, |
@@ -366,7 +356,7 @@ if quic_dep.found() and get_option('experimental') | |||
366 | dependencies: [ | 356 | dependencies: [ |
367 | libgnunetutil_dep, | 357 | libgnunetutil_dep, |
368 | libgnunettransportapplication_dep, | 358 | libgnunettransportapplication_dep, |
369 | libgnunettransporttesting2_dep, | 359 | libgnunettestingtransport_dep, |
370 | libgnunettransportcore_dep, | 360 | libgnunettransportcore_dep, |
371 | libgnunettesting_dep, | 361 | libgnunettesting_dep, |
372 | libgnunetpeerstore_dep, | 362 | libgnunetpeerstore_dep, |
@@ -384,7 +374,7 @@ testcommunicator_rekey_tcp = executable('test_communicator_rekey-tcp', | |||
384 | dependencies: [ | 374 | dependencies: [ |
385 | libgnunetutil_dep, | 375 | libgnunetutil_dep, |
386 | libgnunettransportapplication_dep, | 376 | libgnunettransportapplication_dep, |
387 | libgnunettransporttesting2_dep, | 377 | libgnunettestingtransport_dep, |
388 | libgnunettransportcore_dep, | 378 | libgnunettransportcore_dep, |
389 | libgnunettesting_dep, | 379 | libgnunettesting_dep, |
390 | libgnunetpeerstore_dep, | 380 | libgnunetpeerstore_dep, |
@@ -401,7 +391,7 @@ testcommunicator_rekey_udp = executable('test_communicator_rekey-udp', | |||
401 | dependencies: [ | 391 | dependencies: [ |
402 | libgnunetutil_dep, | 392 | libgnunetutil_dep, |
403 | libgnunettransportapplication_dep, | 393 | libgnunettransportapplication_dep, |
404 | libgnunettransporttesting2_dep, | 394 | libgnunettestingtransport_dep, |
405 | libgnunettransportcore_dep, | 395 | libgnunettransportcore_dep, |
406 | libgnunettesting_dep, | 396 | libgnunettesting_dep, |
407 | libgnunetpeerstore_dep, | 397 | libgnunetpeerstore_dep, |
@@ -418,7 +408,7 @@ testcommunicator_backchannel_udp = executable('test_communicator_backchannel-udp | |||
418 | dependencies: [ | 408 | dependencies: [ |
419 | libgnunetutil_dep, | 409 | libgnunetutil_dep, |
420 | libgnunettransportapplication_dep, | 410 | libgnunettransportapplication_dep, |
421 | libgnunettransporttesting2_dep, | 411 | libgnunettestingtransport_dep, |
422 | libgnunettransportcore_dep, | 412 | libgnunettransportcore_dep, |
423 | libgnunettesting_dep, | 413 | libgnunettesting_dep, |
424 | libgnunetpeerstore_dep, | 414 | libgnunetpeerstore_dep, |
@@ -435,7 +425,7 @@ testcommunicator_bidirect_tcp = executable('test_communicator_bidirect-tcp', | |||
435 | dependencies: [ | 425 | dependencies: [ |
436 | libgnunetutil_dep, | 426 | libgnunetutil_dep, |
437 | libgnunettransportapplication_dep, | 427 | libgnunettransportapplication_dep, |
438 | libgnunettransporttesting2_dep, | 428 | libgnunettestingtransport_dep, |
439 | libgnunettransportcore_dep, | 429 | libgnunettransportcore_dep, |
440 | libgnunettesting_dep, | 430 | libgnunettesting_dep, |
441 | libgnunetpeerstore_dep, | 431 | libgnunetpeerstore_dep, |
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 | */ |
188 | static struct GNUNET_TESTING_Interpreter * | 184 | void * |
189 | start_testcase (GNUNET_TESTING_cmd_helper_write_cb write_message, | 185 | libgnunet_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 | /** | 314 | GNUNET_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", |
337 | void * | 320 | "system-create", |
338 | libgnunet_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 |
2 | if ! [ -d "/run/netns" ]; then | 2 | exec 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 | |
4 | fi | 4 | # exec netjail_test_master.sh gnunet-testing-netjail-launcher test_transport_simple_send_topo.conf |
5 | if [ -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 | ||
10 | fi | ||
11 | exec unshare -r -nmU bash -c "mount -t tmpfs --make-rshared tmpfs /run/netns; ./test_transport_start_with_config test_transport_simple_send_topo.conf" | ||
diff --git a/src/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 | */ | ||
43 | static void | ||
44 | start_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 | */ | ||
213 | static void | ||
214 | start_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 | */ | ||
237 | static int | ||
238 | start_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 | |||
270 | struct GNUNET_TESTING_Command | ||
271 | GNUNET_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 | */ | ||
41 | struct 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 | */ | ||
52 | static void | ||
53 | stop_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 | */ | ||
86 | static void | ||
87 | stop_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 | */ | ||
99 | static int | ||
100 | stop_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 | */ | ||
116 | struct GNUNET_TESTING_Command | ||
117 | GNUNET_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 | |||
31 | GNUNET_TRANSPORT_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, | ||
32 | GNUNET_TRANSPORT_TESTING) | ||
33 | |||
34 | GNUNET_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 | |||
108 | typedef void * | 107 | typedef 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 | |||
114 | struct TestState | 112 | struct 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 | */ |
228 | struct GNUNET_TESTING_Command | 215 | struct GNUNET_TESTING_Command |
229 | GNUNET_TRANSPORT_cmd_send_simple_performance (const char *label, | 216 | GNUNET_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 | ||
269 | GNUNET_TRANSPORT_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_DECL_SIMPLE_TRAIT, GNUNET_TRANSPORT_TESTING) | 256 | GNUNET_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-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_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 |
313 | GNUNET_TRANSPORT_TESTING_SIMPLE_TRAITS (GNUNET_TESTING_MAKE_IMPL_SIMPLE_TRAIT, GNUNET_TRANSPORT_TESTING) | 314 | GNUNET_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 5afbb338b..862d28b4c 100644 --- a/src/service/transport/transport_api_cmd_start_peer.c +++ b/src/service/transport/transport_api_cmd_start_peer.c | |||
@@ -84,11 +84,11 @@ retrieve_hello (void *cls) | |||
84 | struct GNUNET_TESTING_StartPeerState *sps = cls; | 84 | struct GNUNET_TESTING_StartPeerState *sps = cls; |
85 | sps->rh_task = NULL; | 85 | sps->rh_task = NULL; |
86 | sps->pic = GNUNET_PEERSTORE_iteration_start (sps->ph, | 86 | sps->pic = GNUNET_PEERSTORE_iteration_start (sps->ph, |
87 | "transport", | 87 | "transport", |
88 | &sps->id, | 88 | &sps->id, |
89 | GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, | 89 | GNUNET_PEERSTORE_TRANSPORT_HELLO_KEY, |
90 | hello_iter_cb, | 90 | hello_iter_cb, |
91 | sps); | 91 | sps); |
92 | 92 | ||
93 | } | 93 | } |
94 | 94 | ||
@@ -172,7 +172,7 @@ start_peer_run (void *cls, | |||
172 | char *emsg = NULL; | 172 | char *emsg = NULL; |
173 | struct GNUNET_PeerIdentity dummy; | 173 | struct GNUNET_PeerIdentity dummy; |
174 | const struct GNUNET_TESTING_Command *system_cmd; | 174 | const struct GNUNET_TESTING_Command *system_cmd; |
175 | const struct GNUNET_TESTING_System *tl_system; | 175 | const struct GNUNET_TESTBED_System *tl_system; |
176 | char *home; | 176 | char *home; |
177 | char *transport_unix_path; | 177 | char *transport_unix_path; |
178 | char *tcp_communicator_unix_path; | 178 | char *tcp_communicator_unix_path; |
@@ -258,7 +258,7 @@ start_peer_run (void *cls, | |||
258 | 258 | ||
259 | if (GNUNET_SYSERR == | 259 | if (GNUNET_SYSERR == |
260 | GNUNET_TESTING_configuration_create ((struct | 260 | GNUNET_TESTING_configuration_create ((struct |
261 | GNUNET_TESTING_System *) tl_system, | 261 | GNUNET_TESTBED_System *) tl_system, |
262 | sps->cfg)) | 262 | sps->cfg)) |
263 | { | 263 | { |
264 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 264 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -270,7 +270,7 @@ start_peer_run (void *cls, | |||
270 | } | 270 | } |
271 | 271 | ||
272 | sps->peer = GNUNET_TESTING_peer_configure ((struct | 272 | sps->peer = GNUNET_TESTING_peer_configure ((struct |
273 | GNUNET_TESTING_System *) sps-> | 273 | GNUNET_TESTBED_System *) sps-> |
274 | tl_system, | 274 | tl_system, |
275 | sps->cfg, | 275 | sps->cfg, |
276 | sps->no, | 276 | sps->no, |
@@ -475,10 +475,10 @@ GNUNET_TRANSPORT_cmd_start_peer (const char *label, | |||
475 | handlers, | 475 | handlers, |
476 | i * sizeof(struct GNUNET_MQ_MessageHandler)); | 476 | i * sizeof(struct GNUNET_MQ_MessageHandler)); |
477 | } | 477 | } |
478 | return GNUNET_TESTING_command_new (sps, | 478 | return GNUNET_TESTING_command_new_ac (sps, |
479 | label, | 479 | label, |
480 | &start_peer_run, | 480 | &start_peer_run, |
481 | &start_peer_cleanup, | 481 | &start_peer_cleanup, |
482 | &start_peer_traits, | 482 | &start_peer_traits, |
483 | &sps->ac); | 483 | &sps->ac); |
484 | } | 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 | } |