[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: fix #8962 by making project data no long
From: |
gnunet |
Subject: |
[gnunet] branch master updated: fix #8962 by making project data no longer a global but instead passing it explicitly where required |
Date: |
Thu, 14 Nov 2024 21:37:34 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 9ab62c62c fix #8962 by making project data no longer a global but
instead passing it explicitly where required
9ab62c62c is described below
commit 9ab62c62c3d508033d31ea5289013255ec7a0c87
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Nov 14 21:37:09 2024 +0100
fix #8962 by making project data no longer a global but instead passing it
explicitly where required
---
src/cli/arm/gnunet-arm.c | 7 +-
src/cli/cadet/gnunet-cadet.c | 3 +-
src/cli/core/gnunet-core.c | 3 +-
src/cli/datastore/gnunet-datastore.c | 3 +-
src/cli/dht/gnunet-dht-get.c | 1 +
src/cli/dht/gnunet-dht-hello.c | 1 +
src/cli/dht/gnunet-dht-monitor.c | 3 +-
src/cli/dht/gnunet-dht-put.c | 1 +
src/cli/fs/gnunet-auto-share.c | 9 +-
src/cli/fs/gnunet-directory.c | 3 +-
src/cli/fs/gnunet-download.c | 1 +
src/cli/fs/gnunet-fs.c | 3 +-
src/cli/fs/gnunet-publish.c | 13 +-
src/cli/fs/gnunet-search.c | 15 +-
src/cli/fs/gnunet-unindex.c | 1 +
src/cli/gns/gnunet-gns.c | 3 +-
src/cli/hello/gnunet-hello.c | 5 +-
src/cli/identity/gnunet-identity.c | 3 +-
src/cli/messenger/gnunet-messenger.c | 12 +-
src/cli/namecache/gnunet-namecache.c | 16 +-
src/cli/namestore/gnunet-namestore-dbtool.c | 7 +-
src/cli/namestore/gnunet-namestore-zonefile.c | 27 +-
src/cli/namestore/gnunet-namestore.c | 3 +-
src/cli/namestore/gnunet-zoneimport.c | 21 +-
src/cli/nat-auto/gnunet-nat-auto.c | 5 +-
src/cli/nat/gnunet-nat.c | 3 +-
src/cli/nse/gnunet-nse.c | 3 +-
src/cli/reclaim/gnunet-did.c | 17 +-
src/cli/reclaim/gnunet-reclaim.c | 16 +-
src/cli/revocation/gnunet-revocation-tvg.c | 15 +-
src/cli/revocation/gnunet-revocation.c | 16 +-
src/cli/statistics/gnunet-statistics.c | 6 +-
src/cli/util/gnunet-base32.c | 14 +-
src/cli/util/gnunet-config-diff.c | 5 +-
src/cli/util/gnunet-config.c | 21 +-
src/cli/util/gnunet-crypto-tvg.c | 3 +-
src/cli/util/gnunet-ecc.c | 3 +-
src/cli/util/gnunet-resolver.c | 3 +-
src/cli/util/gnunet-scrypt.c | 3 +-
src/cli/util/gnunet-uri.c | 6 +-
src/cli/vpn/gnunet-vpn.c | 16 +-
src/contrib/cli/template/gnunet-template.c | 17 +-
.../service/scalarproduct/gnunet-scalarproduct.c | 6 +-
src/contrib/service/set/gnunet-set-ibf-profiler.c | 3 +-
src/include/gnunet_configuration_lib.h | 37 +-
src/include/gnunet_disk_lib.h | 4 +-
src/include/gnunet_getopt_lib.h | 4 +-
src/include/gnunet_helper_lib.h | 4 +-
src/include/gnunet_os_lib.h | 30 +-
src/include/gnunet_plugin_lib.h | 36 +-
src/include/gnunet_program_lib.h | 34 +-
src/include/gnunet_service_lib.h | 29 +-
src/lib/block/block.c | 12 +-
src/lib/gnsrecord/gnsrecord.c | 22 +-
src/lib/gnsrecord/gnsrecord_pow.c | 3 +-
src/lib/gnsrecord/gnunet-gnsrecord-tvg.c | 3 +-
src/lib/gnsrecord/perf_gnsrecord_crypto.c | 13 +-
.../gnsrecord/test_gnsrecord_block_expiration.c | 9 +-
src/lib/gnsrecord/test_gnsrecord_crypto.c | 9 +-
src/lib/gnsrecord/test_gnsrecord_serialization.c | 4 +-
src/lib/testing/gnunet-cmds-helper.c | 10 +-
src/lib/testing/testing_api_cmd_netjail_start.c | 4 +-
.../testing_api_cmd_netjail_start_cmds_helper.c | 71 ++--
src/lib/testing/testing_api_topology.c | 23 +-
src/lib/util/Makefile.am | 1 -
src/lib/util/configuration.c | 448 ++++++++++++++++-----
src/lib/util/configuration_helper.c | 308 --------------
src/lib/util/disk.c | 32 +-
src/lib/util/getopt_helpers.c | 39 +-
src/lib/util/helper.c | 6 +-
src/lib/util/os_installation.c | 310 +++++++-------
src/lib/util/plugin.c | 168 ++++----
src/lib/util/program.c | 92 +++--
src/lib/util/service.c | 105 +++--
src/lib/util/test_client.c | 3 +-
src/lib/util/test_configuration.c | 24 +-
src/lib/util/test_getopt.c | 7 +-
src/lib/util/test_mq.c | 5 +-
src/lib/util/test_os_start_process.c | 37 +-
src/lib/util/test_plugin.c | 9 +-
src/lib/util/test_program.c | 12 +-
src/lib/util/test_service.c | 3 +-
src/lib/util/test_speedup.c | 3 +-
src/lib/util/test_time.c | 2 +-
src/plugin/datastore/perf_plugin_datastore.c | 10 +-
src/plugin/datastore/test_plugin_datastore.c | 10 +-
src/plugin/fs/test_plugin_block_fs.c | 2 +-
src/plugin/namecache/test_plugin_namecache.c | 15 +-
src/plugin/namestore/test_plugin_namestore.c | 25 +-
src/plugin/peerstore/test_plugin_peerstore.c | 6 +-
src/service/arm/arm_api.c | 3 +-
src/service/arm/gnunet-service-arm.c | 7 +-
src/service/arm/test_arm_api.c | 3 +-
src/service/arm/test_exponential_backoff.c | 5 +-
src/service/arm/test_gnunet_service_arm.c | 5 +-
src/service/arm/testing_arm_cmd_start_peer.c | 5 +-
src/service/cadet/cadet_api.c | 33 +-
src/service/datacache/datacache.c | 27 +-
src/service/datastore/gnunet-service-datastore.c | 8 +-
src/service/dns/gnunet-dns-monitor.c | 5 +-
src/service/dns/gnunet-dns-redirector.c | 3 +-
src/service/dns/gnunet-service-dns.c | 11 +-
src/service/exit/gnunet-daemon-exit.c | 10 +-
src/service/fs/fs_dirmetascan.c | 3 +-
src/service/fs/gnunet-daemon-fsprofiler.c | 3 +-
src/service/fs/gnunet-service-fs.c | 7 +-
src/service/fs/test_fs_file_information.c | 3 +-
src/service/fs/test_fs_uri.c | 6 +-
src/service/gns/gnunet-bcd.c | 6 +-
src/service/gns/gnunet-dns2gns.c | 12 +-
src/service/gns/gnunet-gns-benchmark.c | 5 +-
src/service/gns/gnunet-gns-proxy.c | 24 +-
src/service/gns/gnunet-service-gns.c | 11 +-
src/service/gns/test_gns_proxy.c | 18 +-
src/service/hostlist/gnunet-daemon-hostlist.c | 3 +-
src/service/identity/gnunet-service-identity.c | 19 +-
src/service/messenger/gnunet-service-messenger.c | 35 +-
.../messenger/gnunet-service-messenger_member.c | 39 +-
.../gnunet-service-messenger_member_session.c | 6 +-
.../messenger/gnunet-service-messenger_operation.c | 38 +-
.../messenger/gnunet-service-messenger_service.h | 4 +-
src/service/namecache/gnunet-service-namecache.c | 3 +-
src/service/namestore/gnunet-service-namestore.c | 24 +-
src/service/nat-auto/gnunet-service-nat-auto.c | 6 +-
src/service/nat-auto/nat_auto_api.c | 2 +-
src/service/nat/gnunet-service-nat_helper.c | 16 +-
src/service/peerstore/gnunet-service-peerstore.c | 11 +-
src/service/pt/gnunet-daemon-pt.c | 3 +-
src/service/reclaim/gnunet-service-reclaim.c | 1 +
src/service/reclaim/reclaim_attribute.c | 25 +-
src/service/reclaim/reclaim_credential.c | 19 +-
src/service/regex/gnunet-daemon-regexprofiler.c | 3 +-
src/service/rest/config_plugin.c | 5 +-
src/service/setu/gnunet-setu-ibf-profiler.c | 3 +-
src/service/statistics/test_statistics_api.c | 9 +-
src/service/statistics/test_statistics_api_loop.c | 9 +-
src/service/statistics/test_statistics_api_watch.c | 7 +-
.../test_statistics_api_watch_zero_value.c | 6 +-
src/service/testbed/gnunet-testbed.c | 5 +-
src/service/testbed/test_testbed_portreservation.c | 3 +-
src/service/topology/gnunet-daemon-topology.c | 16 +-
src/service/transport/gnunet-communicator-http3.c | 11 +-
src/service/transport/gnunet-communicator-tcp.c | 3 +-
src/service/transport/gnunet-communicator-unix.c | 3 +-
src/service/transport/test_communicator_basic.c | 3 +-
.../transport/transport-testing-communicator.c | 24 +-
src/service/util/test_resolver_api.c | 15 +-
src/service/vpn/gnunet-service-vpn.c | 71 ++--
148 files changed, 1710 insertions(+), 1351 deletions(-)
diff --git a/src/cli/arm/gnunet-arm.c b/src/cli/arm/gnunet-arm.c
index e15e50419..2ee903202 100644
--- a/src/cli/arm/gnunet-arm.c
+++ b/src/cli/arm/gnunet-arm.c
@@ -384,7 +384,8 @@ stop_callback (void *cls,
GNUNET_asprintf (&msg,
"%s",
_ (
- "Failed to send a stop request to the ARM service:
%s\n"));
+ "Failed to send a stop request to the ARM service:
%s\n")
+ );
fprintf (stdout, msg, req_string (rs));
GNUNET_free (msg);
GNUNET_SCHEDULER_shutdown ();
@@ -676,7 +677,8 @@ list_callback (void *cls,
service_info[i].binary);
break;
case GNUNET_ARM_SERVICE_STATUS_FAILED:
- restart_in = GNUNET_TIME_absolute_get_remaining
(service_info[i].restart_at);
+ restart_in = GNUNET_TIME_absolute_get_remaining (service_info[i].
+ restart_at);
fprintf (stdout,
"%s (binary='%s', status=failed, exit_status=%d,
restart_delay='%s')\n",
service_info[i].name,
@@ -1038,6 +1040,7 @@ main (int argc, char *const *argv)
if (GNUNET_OK ==
(lret = GNUNET_PROGRAM_run (
+ GNUNET_OS_project_data_gnunet (),
argc,
argv,
"gnunet-arm",
diff --git a/src/cli/cadet/gnunet-cadet.c b/src/cli/cadet/gnunet-cadet.c
index 047d961ea..fd79f0fed 100644
--- a/src/cli/cadet/gnunet-cadet.c
+++ b/src/cli/cadet/gnunet-cadet.c
@@ -829,7 +829,8 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END
};
- res = GNUNET_PROGRAM_run (argc,
+ res = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-cadet (OPTIONS | PEER_ID SHARED_SECRET)",
gettext_noop (helpstr),
diff --git a/src/cli/core/gnunet-core.c b/src/cli/core/gnunet-core.c
index 16ce0051b..6d9b54926 100644
--- a/src/cli/core/gnunet-core.c
+++ b/src/cli/core/gnunet-core.c
@@ -276,7 +276,8 @@ main (int argc, char *const *argv)
&show_conns),
GNUNET_GETOPT_OPTION_END };
- res = GNUNET_PROGRAM_run (argc,
+ res = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-core",
gettext_noop (
diff --git a/src/cli/datastore/gnunet-datastore.c
b/src/cli/datastore/gnunet-datastore.c
index 7fa346f50..ea581ec00 100644
--- a/src/cli/datastore/gnunet-datastore.c
+++ b/src/cli/datastore/gnunet-datastore.c
@@ -490,7 +490,8 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END };
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-datastore",
gettext_noop ("Manipulate GNUnet datastore"),
diff --git a/src/cli/dht/gnunet-dht-get.c b/src/cli/dht/gnunet-dht-get.c
index 6b7851c01..c1391eed8 100644
--- a/src/cli/dht/gnunet-dht-get.c
+++ b/src/cli/dht/gnunet-dht-get.c
@@ -327,6 +327,7 @@ main (int argc, char *const *argv)
ret = (GNUNET_OK ==
GNUNET_PROGRAM_run (
+ GNUNET_OS_project_data_gnunet (),
argc,
argv,
"gnunet-dht-get",
diff --git a/src/cli/dht/gnunet-dht-hello.c b/src/cli/dht/gnunet-dht-hello.c
index 33f203adf..8704ceb09 100644
--- a/src/cli/dht/gnunet-dht-hello.c
+++ b/src/cli/dht/gnunet-dht-hello.c
@@ -155,6 +155,7 @@ main (int argc,
enum GNUNET_GenericReturnValue iret;
iret = GNUNET_PROGRAM_run (
+ GNUNET_OS_project_data_gnunet (),
argc,
argv,
"gnunet-dht-hello [URL]",
diff --git a/src/cli/dht/gnunet-dht-monitor.c b/src/cli/dht/gnunet-dht-monitor.c
index 566fbb74a..ecdddf009 100644
--- a/src/cli/dht/gnunet-dht-monitor.c
+++ b/src/cli/dht/gnunet-dht-monitor.c
@@ -326,7 +326,8 @@ main (int argc, char *const *argv)
return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-dht-monitor",
gettext_noop (
diff --git a/src/cli/dht/gnunet-dht-put.c b/src/cli/dht/gnunet-dht-put.c
index 69923d8ba..63b9a90a9 100644
--- a/src/cli/dht/gnunet-dht-put.c
+++ b/src/cli/dht/gnunet-dht-put.c
@@ -230,6 +230,7 @@ main (int argc, char *const *argv)
expiration = GNUNET_TIME_UNIT_HOURS;
ret = (GNUNET_OK ==
GNUNET_PROGRAM_run (
+ GNUNET_OS_project_data_gnunet (),
argc,
argv,
"gnunet-dht-put",
diff --git a/src/cli/fs/gnunet-auto-share.c b/src/cli/fs/gnunet-auto-share.c
index 87780d0c5..8d246dc27 100644
--- a/src/cli/fs/gnunet-auto-share.c
+++ b/src/cli/fs/gnunet-auto-share.c
@@ -430,7 +430,8 @@ sighandler_child_death ()
GNUNET_break (
1 ==
GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle (sigpipe,
-
GNUNET_DISK_PIPE_END_WRITE),
+
GNUNET_DISK_PIPE_END_WRITE)
+ ,
&c,
sizeof(c)));
errno = old_errno; /* restore errno */
@@ -484,7 +485,7 @@ work (void *cls)
NULL,
NULL,
"gnunet-publish",
- (char * const*)argv);
+ (char * const*) argv);
if (NULL == publish_proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -715,7 +716,8 @@ main (int argc, char *const *argv)
'd',
"disable-creation-time",
gettext_noop (
- "disable adding the creation time to the metadata of the uploaded
file"),
+ "disable adding the creation time to the metadata of the uploaded
file")
+ ,
&do_disable_creation_time),
GNUNET_GETOPT_option_flag (
@@ -753,6 +755,7 @@ main (int argc, char *const *argv)
ok =
(GNUNET_OK ==
GNUNET_PROGRAM_run (
+ GNUNET_OS_project_data_gnunet (),
argc,
argv,
"gnunet-auto-share [OPTIONS] FILENAME",
diff --git a/src/cli/fs/gnunet-directory.c b/src/cli/fs/gnunet-directory.c
index 8ddb4e09b..c74bc8297 100644
--- a/src/cli/fs/gnunet-directory.c
+++ b/src/cli/fs/gnunet-directory.c
@@ -191,7 +191,8 @@ main (int argc, char *const *argv)
};
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-directory [OPTIONS] FILENAME",
gettext_noop (
diff --git a/src/cli/fs/gnunet-download.c b/src/cli/fs/gnunet-download.c
index 8498889ba..f60f9ed77 100644
--- a/src/cli/fs/gnunet-download.c
+++ b/src/cli/fs/gnunet-download.c
@@ -364,6 +364,7 @@ main (int argc, char *const *argv)
ret =
(GNUNET_OK ==
GNUNET_PROGRAM_run (
+ GNUNET_OS_project_data_gnunet (),
argc,
argv,
"gnunet-download [OPTIONS] URI",
diff --git a/src/cli/fs/gnunet-fs.c b/src/cli/fs/gnunet-fs.c
index ba974fd21..ea0938ee3 100644
--- a/src/cli/fs/gnunet-fs.c
+++ b/src/cli/fs/gnunet-fs.c
@@ -168,7 +168,8 @@ main (int argc,
};
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-fs [OPTIONS]",
gettext_noop ("Special file-sharing operations"),
diff --git a/src/cli/fs/gnunet-publish.c b/src/cli/fs/gnunet-publish.c
index 1bce10ccf..999318c3c 100644
--- a/src/cli/fs/gnunet-publish.c
+++ b/src/cli/fs/gnunet-publish.c
@@ -861,11 +861,11 @@ run (void *cls,
}
cfg = c;
fs_handle = GNUNET_FS_start (cfg,
- "gnunet-publish",
- &progress_cb,
- NULL,
- GNUNET_FS_FLAGS_NONE,
- GNUNET_FS_OPTIONS_END);
+ "gnunet-publish",
+ &progress_cb,
+ NULL,
+ GNUNET_FS_FLAGS_NONE,
+ GNUNET_FS_OPTIONS_END);
if (NULL == fs_handle)
{
fprintf (stderr, _ ("Could not initialize `%s' subsystem.\n"), "FS");
@@ -991,7 +991,8 @@ main (int argc, char *const *argv)
ret =
(GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-publish [OPTIONS] FILENAME",
gettext_noop ("Publish a file or directory on
GNUnet"),
diff --git a/src/cli/fs/gnunet-search.c b/src/cli/fs/gnunet-search.c
index bc852ae4d..c0716b73d 100644
--- a/src/cli/fs/gnunet-search.c
+++ b/src/cli/fs/gnunet-search.c
@@ -35,7 +35,7 @@
#define GNUNET_SEARCH_log(kind, ...) \
- GNUNET_log_from (kind, "gnunet-search", __VA_ARGS__)
+ GNUNET_log_from (kind, "gnunet-search", __VA_ARGS__)
/* The default settings that we use for the printed output */
@@ -176,7 +176,7 @@ print_escape_sequence (const char *const esc)
default: printf ("\\%c", *cursor); return cursor + 1;
}
- maybe_codepoint:
+maybe_codepoint:
if (probe < 256)
putchar (probe);
else
@@ -227,7 +227,7 @@ item_printer (void *const cls,
next_spec = strchr (cursor, '%');
next_esc = strchr (cursor, '\\');
- parse_format:
+parse_format:
/* If an escape sequence exists before the next format specifier... */
if (next_esc && (! next_spec || next_esc < next_spec))
@@ -305,7 +305,7 @@ print_search_result (const char *const filename,
char *placeholder;
struct GNUNET_SEARCH_MetadataPrinterInfo info;
- parse_format:
+parse_format:
/* If an escape sequence exists before the next format specifier... */
if (next_esc && (! next_spec || next_esc < next_spec))
{
@@ -329,7 +329,7 @@ print_search_result (const char *const filename,
case 'a':
info.flags = METADATA_PRINTER_FLAG_NONE;
- iterate_meta:
+iterate_meta:
info.counter = 0;
GNUNET_FS_meta_data_iterate (metadata, &item_printer, &info);
break;
@@ -413,7 +413,7 @@ print_search_result (const char *const filename,
case '%': putchar ('%'); break;
case '\0': putchar ('%'); return;
- not_a_specifier:
+not_a_specifier:
default: printf ("%%%c", *next_spec); break;
}
cursor = next_spec + 1;
@@ -798,7 +798,8 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END };
if (GNUNET_SYSERR ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-search [OPTIONS] KEYWORD1 KEYWORD2 ...",
gettext_noop ("Search for files that have been "
diff --git a/src/cli/fs/gnunet-unindex.c b/src/cli/fs/gnunet-unindex.c
index a9af814cf..cb912c4e0 100644
--- a/src/cli/fs/gnunet-unindex.c
+++ b/src/cli/fs/gnunet-unindex.c
@@ -185,6 +185,7 @@ main (int argc, char *const *argv)
ret = (GNUNET_OK ==
GNUNET_PROGRAM_run (
+ GNUNET_OS_project_data_gnunet (),
argc,
argv,
"gnunet-unindex [OPTIONS] FILENAME",
diff --git a/src/cli/gns/gnunet-gns.c b/src/cli/gns/gnunet-gns.c
index b67e5eb1d..8ef0d4253 100644
--- a/src/cli/gns/gnunet-gns.c
+++ b/src/cli/gns/gnunet-gns.c
@@ -389,7 +389,8 @@ main (int argc, char *const *argv)
timeout = GNUNET_TIME_UNIT_FOREVER_REL;
GNUNET_log_setup ("gnunet-gns", "WARNING", NULL);
- ret = GNUNET_PROGRAM_run (argc,
+ ret = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-gns",
_ ("GNUnet GNS resolver tool"),
diff --git a/src/cli/hello/gnunet-hello.c b/src/cli/hello/gnunet-hello.c
index 107a8bf97..bc644ce08 100644
--- a/src/cli/hello/gnunet-hello.c
+++ b/src/cli/hello/gnunet-hello.c
@@ -170,7 +170,7 @@ hello_iter (void *cls, const struct GNUNET_PEERSTORE_Record
*record,
{
struct GNUNET_HELLO_Builder *hb;
- hb = GNUNET_HELLO_builder_from_parser(hp);
+ hb = GNUNET_HELLO_builder_from_parser (hp);
if (GNUNET_NO == binary_output)
{
char *url;
@@ -428,7 +428,8 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END
};
- res = GNUNET_PROGRAM_run (argc,
+ res = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-hello",
gettext_noop (
diff --git a/src/cli/identity/gnunet-identity.c
b/src/cli/identity/gnunet-identity.c
index e6eba33d9..81fe09340 100644
--- a/src/cli/identity/gnunet-identity.c
+++ b/src/cli/identity/gnunet-identity.c
@@ -616,7 +616,8 @@ main (int argc, char *const *argv)
int res;
global_ret = TIMEOUT_STATUS_CODE; /* timeout */
- res = GNUNET_PROGRAM_run (argc,
+ res = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-identity",
gettext_noop ("Maintain egos"),
diff --git a/src/cli/messenger/gnunet-messenger.c
b/src/cli/messenger/gnunet-messenger.c
index 6afeb8089..5d5a8819a 100644
--- a/src/cli/messenger/gnunet-messenger.c
+++ b/src/cli/messenger/gnunet-messenger.c
@@ -655,8 +655,12 @@ main (int argc,
GNUNET_GETOPT_OPTION_END
};
- return (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "gnunet-messenger\0",
- gettext_noop (description), options,
- &run,
- NULL) ? EXIT_SUCCESS :
EXIT_FAILURE);
+ return (GNUNET_OK ==
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
+ argv,
+ "gnunet-messenger\0",
+ gettext_noop (description), options,
+ &run,
+ NULL) ? EXIT_SUCCESS : EXIT_FAILURE);
}
diff --git a/src/cli/namecache/gnunet-namecache.c
b/src/cli/namecache/gnunet-namecache.c
index 94e7732fe..002b83f70 100644
--- a/src/cli/namecache/gnunet-namecache.c
+++ b/src/cli/namecache/gnunet-namecache.c
@@ -223,13 +223,15 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END };
GNUNET_log_setup ("gnunet-namecache", "WARNING", NULL);
- if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
- argv,
- "gnunet-namecache",
- _ ("GNUnet zone manipulation tool"),
- options,
- &run,
- NULL))
+ if (GNUNET_OK !=
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
+ argv,
+ "gnunet-namecache",
+ _ ("GNUnet zone manipulation tool"),
+ options,
+ &run,
+ NULL))
{
return 1;
}
diff --git a/src/cli/namestore/gnunet-namestore-dbtool.c
b/src/cli/namestore/gnunet-namestore-dbtool.c
index 24b4a5e00..2d120e7e9 100644
--- a/src/cli/namestore/gnunet-namestore-dbtool.c
+++ b/src/cli/namestore/gnunet-namestore-dbtool.c
@@ -99,7 +99,9 @@ run (void *cls,
GNUNET_asprintf (&db_lib_name,
"libgnunet_plugin_namestore_%s",
pluginname);
- plugin = GNUNET_PLUGIN_load (db_lib_name, (void *) cfg);
+ plugin = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ db_lib_name,
+ (void *) cfg);
if (NULL == plugin)
{
fprintf (stderr,
@@ -177,7 +179,8 @@ main (int argc, char *const *argv)
"WARNING",
NULL);
if (GNUNET_OK !=
- (lret = GNUNET_PROGRAM_run (argc,
+ (lret = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-namestore-dbtool",
_ (
diff --git a/src/cli/namestore/gnunet-namestore-zonefile.c
b/src/cli/namestore/gnunet-namestore-zonefile.c
index ec5734783..16c56bbb6 100644
--- a/src/cli/namestore/gnunet-namestore-zonefile.c
+++ b/src/cli/namestore/gnunet-namestore-zonefile.c
@@ -149,7 +149,6 @@ enum ZonefileImportState
};
-
/**
* Task run on shutdown. Cleans up everything.
*
@@ -183,6 +182,7 @@ do_shutdown (void *cls)
GNUNET_SCHEDULER_cancel (parse_task);
}
+
static void
parse (void *cls);
@@ -220,6 +220,7 @@ trim (char *line)
return ltrimmed;
}
+
static char*
next_token (char *token)
{
@@ -229,6 +230,7 @@ next_token (char *token)
return next;
}
+
static int
parse_ttl (char *token, struct GNUNET_TIME_Relative *pttl)
{
@@ -251,6 +253,7 @@ parse_ttl (char *token, struct GNUNET_TIME_Relative *pttl)
return GNUNET_OK;
}
+
static int
parse_origin (char *token, char *porigin)
{
@@ -266,6 +269,7 @@ parse_origin (char *token, char *porigin)
return GNUNET_OK;
}
+
static void
origin_create_cb (void *cls, const struct GNUNET_CRYPTO_PrivateKey *pk,
enum GNUNET_ErrorCode ec)
@@ -283,6 +287,7 @@ origin_create_cb (void *cls, const struct
GNUNET_CRYPTO_PrivateKey *pk,
parse_task = GNUNET_SCHEDULER_add_now (&parse, NULL);
}
+
static void
origin_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego)
{
@@ -304,6 +309,7 @@ origin_lookup_cb (void *cls, struct GNUNET_IDENTITY_Ego
*ego)
parse_task = GNUNET_SCHEDULER_add_now (&parse, NULL);
}
+
static void
add_continuation (void *cls, enum GNUNET_ErrorCode ec)
{
@@ -332,7 +338,6 @@ add_continuation (void *cls, enum GNUNET_ErrorCode ec)
}
-
/**
* Main function that will be run.
*
@@ -471,7 +476,8 @@ parse (void *cls)
rd_count);
state = ZS_NAME_CHANGED;
}
- else {
+ else
+ {
strcpy (lastname, newname);
}
}
@@ -588,12 +594,12 @@ parse (void *cls)
if (rd_count > 0)
{
ns_qe = GNUNET_NAMESTORE_record_set_store (ns,
- &zone_pkey,
- lastname,
- rd_count,
- rd,
- &add_continuation,
- NULL);
+ &zone_pkey,
+ lastname,
+ rd_count,
+ rd,
+ &add_continuation,
+ NULL);
published_sets++;
published_records += rd_count;
for (int i = 0; i < rd_count; i++)
@@ -709,7 +715,8 @@ main (int argc, char *const *argv)
GNUNET_log_setup ("gnunet-namestore-dbtool", "WARNING", NULL);
if (GNUNET_OK !=
- (lret = GNUNET_PROGRAM_run (argc,
+ (lret = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-namestore-zonefile",
_ (
diff --git a/src/cli/namestore/gnunet-namestore.c
b/src/cli/namestore/gnunet-namestore.c
index d2d3fef6c..328001032 100644
--- a/src/cli/namestore/gnunet-namestore.c
+++ b/src/cli/namestore/gnunet-namestore.c
@@ -2264,7 +2264,8 @@ main (int argc, char *const *argv)
is_maintenance = -1;
GNUNET_log_setup ("gnunet-namestore", "WARNING", NULL);
if (GNUNET_OK !=
- (lret = GNUNET_PROGRAM_run (argc,
+ (lret = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-namestore",
_ ("GNUnet zone manipulation tool"),
diff --git a/src/cli/namestore/gnunet-zoneimport.c
b/src/cli/namestore/gnunet-zoneimport.c
index 1888a6026..d670a274d 100644
--- a/src/cli/namestore/gnunet-zoneimport.c
+++ b/src/cli/namestore/gnunet-zoneimport.c
@@ -1220,7 +1220,8 @@ process_queue (void *cls)
continue;
}
req->op_start_time = GNUNET_TIME_absolute_get ();
- req->rs = GNUNET_DNSSTUB_resolve (dns_ctx, raw, raw_size, &process_result,
req);
+ req->rs = GNUNET_DNSSTUB_resolve (dns_ctx, raw, raw_size, &process_result,
+ req);
GNUNET_assert (NULL != req->rs);
req->issue_num++;
lookups++;
@@ -1853,14 +1854,16 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END };
int ret;
- if (GNUNET_OK != (ret = GNUNET_PROGRAM_run (argc,
- argv,
- "gnunet-zoneimport",
- "import DNS zone into namestore",
- options,
- &run,
- NULL)))
- return ret;
+ if (GNUNET_OK !=
+ (ret = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
+ argv,
+ "gnunet-zoneimport",
+ "import DNS zone into namestore",
+ options,
+ &run,
+ NULL)))
+ return 1;
fprintf (stderr,
"Rejected %u names, had %u cached, did %u lookups, stored %u record
sets\n"
"Found %u records, %u lookups failed, %u/%u pending on shutdown\n",
diff --git a/src/cli/nat-auto/gnunet-nat-auto.c
b/src/cli/nat-auto/gnunet-nat-auto.c
index f28baaeb0..08890b287 100644
--- a/src/cli/nat-auto/gnunet-nat-auto.c
+++ b/src/cli/nat-auto/gnunet-nat-auto.c
@@ -199,7 +199,7 @@ auto_config_cb (void *cls,
struct GNUNET_CONFIGURATION_Handle *def_cfg;
GNUNET_CONFIGURATION_set_value_string (new_cfg, "ARM", "CONFIG", NULL);
- def_cfg = GNUNET_CONFIGURATION_create ();
+ def_cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
GNUNET_break (GNUNET_OK == GNUNET_CONFIGURATION_load (def_cfg, NULL));
if (GNUNET_OK !=
GNUNET_CONFIGURATION_write_diffs (def_cfg, new_cfg, cfg_file))
@@ -347,7 +347,8 @@ main (int argc, char *const argv[])
GNUNET_GETOPT_OPTION_END };
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-nat-auto [options]",
_ ("GNUnet NAT traversal autoconfiguration"),
diff --git a/src/cli/nat/gnunet-nat.c b/src/cli/nat/gnunet-nat.c
index 841265afe..770f31d33 100644
--- a/src/cli/nat/gnunet-nat.c
+++ b/src/cli/nat/gnunet-nat.c
@@ -456,7 +456,8 @@ main (int argc, char *const argv[])
};
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-nat [options]",
_ ("GNUnet NAT traversal autoconfigure daemon"),
diff --git a/src/cli/nse/gnunet-nse.c b/src/cli/nse/gnunet-nse.c
index b88697695..c3bf24ec7 100644
--- a/src/cli/nse/gnunet-nse.c
+++ b/src/cli/nse/gnunet-nse.c
@@ -130,7 +130,8 @@ main (int argc, char *const *argv)
status = 1;
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-nse",
gettext_noop (
diff --git a/src/cli/reclaim/gnunet-did.c b/src/cli/reclaim/gnunet-did.c
index 2258f0116..134667dc7 100644
--- a/src/cli/reclaim/gnunet-did.c
+++ b/src/cli/reclaim/gnunet-did.c
@@ -653,13 +653,16 @@ main (int argc, char *const argv[])
GNUNET_GETOPT_OPTION_END
};
- if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
- argv,
- "gnunet-did",
- "Manage Decentralized Identities
(DIDs)",
- options,
- &run,
- NULL))
+ if (GNUNET_OK !=
+ GNUNET_PROGRAM_run (
+ GNUNET_OS_project_data_gnunet (),
+ argc,
+ argv,
+ "gnunet-did",
+ "Manage Decentralized Identities (DIDs)",
+ options,
+ &run,
+ NULL))
return 1;
else
return ret;
diff --git a/src/cli/reclaim/gnunet-reclaim.c b/src/cli/reclaim/gnunet-reclaim.c
index dd5110fac..55a1dbdcb 100644
--- a/src/cli/reclaim/gnunet-reclaim.c
+++ b/src/cli/reclaim/gnunet-reclaim.c
@@ -930,13 +930,15 @@ main (int argc, char *const argv[])
GNUNET_GETOPT_OPTION_END
};
exp_interval = GNUNET_TIME_UNIT_HOURS;
- if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
- argv,
- "gnunet-reclaim",
- _ ("re:claimID command line tool"),
- options,
- &run,
- NULL))
+ if (GNUNET_OK !=
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
+ argv,
+ "gnunet-reclaim",
+ _ ("re:claimID command line tool"),
+ options,
+ &run,
+ NULL))
return 1;
else
return ret;
diff --git a/src/cli/revocation/gnunet-revocation-tvg.c
b/src/cli/revocation/gnunet-revocation-tvg.c
index 5c2bfbe45..ca3f4668e 100644
--- a/src/cli/revocation/gnunet-revocation-tvg.c
+++ b/src/cli/revocation/gnunet-revocation-tvg.c
@@ -112,7 +112,7 @@ run_with_key (struct GNUNET_CRYPTO_PrivateKey *id_priv)
ssize_t key_len;
GNUNET_CRYPTO_key_get_public (id_priv,
- &id_pub);
+ &id_pub);
GNUNET_STRINGS_data_to_string (&id_pub,
GNUNET_CRYPTO_public_key_get_length (
&id_pub),
@@ -129,10 +129,10 @@ run_with_key (struct GNUNET_CRYPTO_PrivateKey *id_priv)
fprintf (stdout, "\n");
pow = GNUNET_malloc (GNUNET_MAX_POW_SIZE);
GNUNET_GNSRECORD_pow_init (id_priv,
- pow);
+ pow);
ph = GNUNET_GNSRECORD_pow_start (pow,
- TEST_EPOCHS,
- TEST_DIFFICULTY);
+ TEST_EPOCHS,
+ TEST_DIFFICULTY);
fprintf (stdout, "Difficulty (%d base difficulty + %d epochs): %d\n\n",
TEST_DIFFICULTY,
TEST_EPOCHS,
@@ -154,8 +154,8 @@ run_with_key (struct GNUNET_CRYPTO_PrivateKey *id_priv)
exp = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
TEST_EPOCHS);
GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_check_pow (pow,
- TEST_DIFFICULTY,
- exp));
+ TEST_DIFFICULTY,
+ exp));
fprintf (stdout, "Proof:\n");
print_bytes (pow,
GNUNET_GNSRECORD_proof_get_size (pow),
@@ -217,7 +217,8 @@ main (int argc,
"INFO",
NULL));
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv,
"gnunet-revocation-tvg",
"Generate test vectors for revocation",
options,
diff --git a/src/cli/revocation/gnunet-revocation.c
b/src/cli/revocation/gnunet-revocation.c
index f4122a6f3..364802628 100644
--- a/src/cli/revocation/gnunet-revocation.c
+++ b/src/cli/revocation/gnunet-revocation.c
@@ -561,13 +561,15 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END
};
- ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc,
- argv,
- "gnunet-revocation",
- gettext_noop ("help text"),
- options,
- &run,
- NULL))
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
+ argv,
+ "gnunet-revocation",
+ gettext_noop ("help text"),
+ options,
+ &run,
+ NULL))
? ret
: 1;
return ret;
diff --git a/src/cli/statistics/gnunet-statistics.c
b/src/cli/statistics/gnunet-statistics.c
index 63513c9ee..32456dc82 100644
--- a/src/cli/statistics/gnunet-statistics.c
+++ b/src/cli/statistics/gnunet-statistics.c
@@ -621,7 +621,8 @@ iter_check_config (void *cls,
{
/* Found the config - stop iteration successfully */
GNUNET_array_grow (nodes, num_nodes, num_nodes + 1);
- nodes[num_nodes - 1].conf = GNUNET_CONFIGURATION_create ();
+ nodes[num_nodes - 1].conf = GNUNET_CONFIGURATION_create (
+ GNUNET_OS_project_data_gnunet ());
nodes[num_nodes - 1].index_node = num_nodes - 1;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_load (nodes[num_nodes - 1].conf, filename))
@@ -868,7 +869,8 @@ main (int argc, char *const *argv)
remote_host = NULL;
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-statistics [options [value]]",
gettext_noop (
diff --git a/src/cli/util/gnunet-base32.c b/src/cli/util/gnunet-base32.c
index 195f5ff7a..f0d557660 100644
--- a/src/cli/util/gnunet-base32.c
+++ b/src/cli/util/gnunet-base32.c
@@ -41,12 +41,14 @@ main (int argc,
{
int decode = 0;
const struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_flag ('d',
- "decode",
- gettext_noop (
- "run decoder modus, otherwise runs as
encoder"),
- &decode),
- GNUNET_GETOPT_option_help ("Crockford base32 encoder/decoder"),
+ GNUNET_GETOPT_option_flag (
+ 'd',
+ "decode",
+ gettext_noop (
+ "run decoder modus, otherwise runs as encoder"),
+ &decode),
+ GNUNET_GETOPT_option_help (GNUNET_OS_project_data_gnunet (),
+ "Crockford base32 encoder/decoder"),
GNUNET_GETOPT_option_version (PACKAGE_VERSION),
GNUNET_GETOPT_OPTION_END
};
diff --git a/src/cli/util/gnunet-config-diff.c
b/src/cli/util/gnunet-config-diff.c
index e1e3ffd5d..6290ee119 100644
--- a/src/cli/util/gnunet-config-diff.c
+++ b/src/cli/util/gnunet-config-diff.c
@@ -1,4 +1,3 @@
-
#include "platform.h"
#include <gnunet_util_lib.h>
@@ -13,8 +12,8 @@ main (int argc, char **argv)
fprintf (stderr, "Invoke using `%s DEFAULTS-IN DIFFS'\n", argv[0]);
return 1;
}
- i1 = GNUNET_CONFIGURATION_create ();
- i2 = GNUNET_CONFIGURATION_create ();
+ i1 = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
+ i2 = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if ((GNUNET_OK != GNUNET_CONFIGURATION_load (i1, argv[1])) ||
(GNUNET_OK != GNUNET_CONFIGURATION_load (i2, argv[2])))
return 1;
diff --git a/src/cli/util/gnunet-config.c b/src/cli/util/gnunet-config.c
index 1f0346f60..50c98cfb6 100644
--- a/src/cli/util/gnunet-config.c
+++ b/src/cli/util/gnunet-config.c
@@ -23,7 +23,6 @@
* @brief tool to access and manipulate GNUnet configuration files
* @author Christian Grothoff
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
@@ -77,18 +76,19 @@ int
main (int argc,
char *const *argv)
{
+ const struct GNUNET_OS_ProjectData *pd
+ = GNUNET_OS_project_data_gnunet ();
struct GNUNET_CONFIGURATION_ConfigSettings cs = {
.api_version = GNUNET_UTIL_VERSION,
.global_ret = EXIT_SUCCESS
};
- const struct GNUNET_OS_ProjectData *pd
- = GNUNET_OS_project_data_get ();
char *cfgfile = NULL;
char *loglev = NULL;
char *logfile = NULL;
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_cfgfile (&cfgfile),
- GNUNET_GETOPT_option_help ("gnunet-config [OPTIONS]"),
+ GNUNET_GETOPT_option_help (pd,
+ "gnunet-config [OPTIONS]"),
GNUNET_GETOPT_option_loglevel (&loglev),
GNUNET_GETOPT_option_logfile (&logfile),
GNUNET_GETOPT_option_version (pd->version),
@@ -142,7 +142,7 @@ main (int argc,
if ( (NULL != pd->config_file) &&
(NULL != pd->user_config_file) )
- cfgfile = GNUNET_CONFIGURATION_default_filename ();
+ cfgfile = GNUNET_CONFIGURATION_default_filename (pd);
iret = GNUNET_GETOPT_run ("gnunet-config",
options,
argc,
@@ -180,8 +180,10 @@ main (int argc,
}
if (1 == cflags || 1 == libs || 1 == prefix)
{
- char *prefixdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
- char *libdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR);
+ char *prefixdir = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_PREFIX);
+ char *libdir = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LIBDIR);
if (1 == cflags)
{
@@ -208,7 +210,8 @@ main (int argc,
"libgnunet_plugin_%s",
backend_check);
iret = (GNUNET_OK ==
- GNUNET_PLUGIN_test (name)) ? 0 : 77;
+ GNUNET_PLUGIN_test (pd,
+ name)) ? 0 : 77;
GNUNET_free (name);
GNUNET_free (cfgfile);
return iret;
@@ -217,7 +220,7 @@ main (int argc,
{
struct GNUNET_CONFIGURATION_Handle *cfg;
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (pd);
if (NULL != ram_config)
{
diff --git a/src/cli/util/gnunet-crypto-tvg.c b/src/cli/util/gnunet-crypto-tvg.c
index d6eeeaa14..61d829326 100644
--- a/src/cli/util/gnunet-crypto-tvg.c
+++ b/src/cli/util/gnunet-crypto-tvg.c
@@ -1594,7 +1594,8 @@ main (int argc,
"INFO",
NULL));
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv,
"gnunet-crypto-tvg",
"Generate test vectors for cryptographic operations",
options,
diff --git a/src/cli/util/gnunet-ecc.c b/src/cli/util/gnunet-ecc.c
index 978dac233..bc68bfeab 100644
--- a/src/cli/util/gnunet-ecc.c
+++ b/src/cli/util/gnunet-ecc.c
@@ -495,7 +495,8 @@ main (int argc, char *const *argv)
list_keys_count = UINT32_MAX;
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-ecc [OPTIONS] keyfile [VANITY_PREFIX]",
gettext_noop (
diff --git a/src/cli/util/gnunet-resolver.c b/src/cli/util/gnunet-resolver.c
index 5c44aaf18..f46bf1b5a 100644
--- a/src/cli/util/gnunet-resolver.c
+++ b/src/cli/util/gnunet-resolver.c
@@ -173,7 +173,8 @@ main (int argc, char *const *argv)
int ret;
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv,
"gnunet-resolver [hostname]",
gettext_noop ("Use built-in GNUnet stub
resolver"),
options,
diff --git a/src/cli/util/gnunet-scrypt.c b/src/cli/util/gnunet-scrypt.c
index 251623077..d1a57f19c 100644
--- a/src/cli/util/gnunet-scrypt.c
+++ b/src/cli/util/gnunet-scrypt.c
@@ -304,7 +304,8 @@ main (int argc, char *const *argv)
ret =
(GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-scrypt [OPTIONS] prooffile",
gettext_noop ("Manipulate GNUnet proof of work
files"),
diff --git a/src/cli/util/gnunet-uri.c b/src/cli/util/gnunet-uri.c
index 626fe2ec3..de5ba12cd 100644
--- a/src/cli/util/gnunet-uri.c
+++ b/src/cli/util/gnunet-uri.c
@@ -143,7 +143,8 @@ sighandler_child_death ()
GNUNET_break (
1 ==
GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle (sigpipe,
-
GNUNET_DISK_PIPE_END_WRITE),
+
GNUNET_DISK_PIPE_END_WRITE)
+ ,
&c,
sizeof(c)));
errno = old_errno; /* restore errno */
@@ -170,7 +171,8 @@ main (int argc, char *const *argv)
GNUNET_assert (sigpipe != NULL);
shc_chld =
GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death);
- ret = GNUNET_PROGRAM_run (argc,
+ ret = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-uri URI",
gettext_noop (
diff --git a/src/cli/vpn/gnunet-vpn.c b/src/cli/vpn/gnunet-vpn.c
index b45903eb3..f93c6fbd4 100644
--- a/src/cli/vpn/gnunet-vpn.c
+++ b/src/cli/vpn/gnunet-vpn.c
@@ -344,13 +344,15 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END };
ret =
- (GNUNET_OK == GNUNET_PROGRAM_run (argc,
- argv,
- "gnunet-vpn",
- gettext_noop ("Setup tunnels via VPN."),
- options,
- &run,
- NULL))
+ (GNUNET_OK ==
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
+ argv,
+ "gnunet-vpn",
+ gettext_noop ("Setup tunnels via VPN."),
+ options,
+ &run,
+ NULL))
? ret
: 1;
return ret;
diff --git a/src/contrib/cli/template/gnunet-template.c
b/src/contrib/cli/template/gnunet-template.c
index 7b9a287b9..e87a40f68 100644
--- a/src/contrib/cli/template/gnunet-template.c
+++ b/src/contrib/cli/template/gnunet-template.c
@@ -66,13 +66,16 @@ main (int argc, char *const *argv)
GNUNET_GETOPT_OPTION_END
};
- ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc,
- argv,
- "gnunet-template",
- gettext_noop ("help text"),
- options,
- &run,
- NULL))
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (
+ GNUNET_OS_project_data_gnunet (),
+ argc,
+ argv,
+ "gnunet-template",
+ gettext_noop ("help text"),
+ options,
+ &run,
+ NULL))
? ret
: 1;
return ret;
diff --git a/src/contrib/service/scalarproduct/gnunet-scalarproduct.c
b/src/contrib/service/scalarproduct/gnunet-scalarproduct.c
index 5ebab5baf..dcac20a73 100644
--- a/src/contrib/service/scalarproduct/gnunet-scalarproduct.c
+++ b/src/contrib/service/scalarproduct/gnunet-scalarproduct.c
@@ -322,7 +322,8 @@ run (void *cls,
&peer_id,
elements,
element_count,
-
&requester_callback,
+
&requester_callback
+ ,
NULL)))) ||
((NULL == input_peer_id) &&
(NULL == (computation
@@ -389,7 +390,8 @@ main (int argc, char *const *argv)
};
return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-scalarproduct",
gettext_noop (
diff --git a/src/contrib/service/set/gnunet-set-ibf-profiler.c
b/src/contrib/service/set/gnunet-set-ibf-profiler.c
index 6465b15b8..e20fb39bc 100644
--- a/src/contrib/service/set/gnunet-set-ibf-profiler.c
+++ b/src/contrib/service/set/gnunet-set-ibf-profiler.c
@@ -296,7 +296,8 @@ main (int argc, char **argv)
GNUNET_GETOPT_OPTION_END
};
- GNUNET_PROGRAM_run2 (argc,
+ GNUNET_PROGRAM_run2 (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-consensus-ibf",
"help",
diff --git a/src/include/gnunet_configuration_lib.h
b/src/include/gnunet_configuration_lib.h
index 0981d9f9e..d856658b3 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -35,7 +35,7 @@
#ifndef GNUNET_CONFIGURATION_LIB_H
#define GNUNET_CONFIGURATION_LIB_H
-
+#include "gnunet_os_lib.h"
#include "gnunet_time_lib.h"
#ifdef __cplusplus
@@ -53,10 +53,12 @@ struct GNUNET_CONFIGURATION_Handle;
/**
* Create a new configuration object.
+ *
+ * @param pd project data to use to determine paths
* @return fresh configuration object
*/
struct GNUNET_CONFIGURATION_Handle *
-GNUNET_CONFIGURATION_create (void);
+GNUNET_CONFIGURATION_create (const struct GNUNET_OS_ProjectData *pd);
/**
@@ -85,7 +87,7 @@ GNUNET_CONFIGURATION_destroy (
* defaults and then parse the specific configuration file
* to overwrite the defaults.
*
- * @param cfg configuration to update
+ * @param[in,out] cfg configuration to update
* @param filename name of the configuration file, NULL to load defaults
* @return #GNUNET_OK on success, #GNUNET_SYSERR on error
*/
@@ -109,28 +111,18 @@ GNUNET_CONFIGURATION_load_from (
const char *defaults_d);
-/**
- * Return GNUnet's default configuration. A new configuration is allocated
- * each time and it's up to the caller to destroy it when done. This function
- * returns GNUnet's configuration even when #GNUNET_OS_init has been called
- * with a value different from #GNUNET_OS_project_data_default.
- *
- * @return a freshly allocated configuration
- */
-struct GNUNET_CONFIGURATION_Handle *
-GNUNET_CONFIGURATION_default (void);
-
-
/**
* Return the filename of the default configuration filename
* that is used when no explicit configuration entry point
* has been specified.
*
+ * @param pd project data to use to determine paths
* @returns NULL if no default configuration file can be located,
* a newly allocated string otherwise
*/
char *
-GNUNET_CONFIGURATION_default_filename (void);
+GNUNET_CONFIGURATION_default_filename (
+ const struct GNUNET_OS_ProjectData *pd);
/**
@@ -264,6 +256,7 @@ typedef enum GNUNET_GenericReturnValue
* @a cb with the resulting configuration object. Then free the
* configuration object and return the status value from @a cb.
*
+ * @param pd project data to use to determine paths
* @param filename configuration to parse, NULL for "default"
* @param cb function to run
* @param cb_cls closure for @a cb
@@ -272,6 +265,7 @@ typedef enum GNUNET_GenericReturnValue
*/
enum GNUNET_GenericReturnValue
GNUNET_CONFIGURATION_parse_and_run (
+ const struct GNUNET_OS_ProjectData *pd,
const char *filename,
GNUNET_CONFIGURATION_Callback cb,
void *cb_cls);
@@ -287,6 +281,17 @@ GNUNET_CONFIGURATION_enable_diagnostics (
struct GNUNET_CONFIGURATION_Handle *cfg);
+/**
+ * Return the project data associated with this configuration.
+ *
+ * @param cfg a configuration
+ * @return associated project data, never NULL
+ */
+const struct GNUNET_OS_ProjectData *
+GNUNET_CONFIGURATION_get_project_data (
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
+
+
/**
* Function to iterate over options.
*
diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h
index 584f90148..6ed9edb79 100644
--- a/src/include/gnunet_disk_lib.h
+++ b/src/include/gnunet_disk_lib.h
@@ -721,11 +721,13 @@ GNUNET_DISK_directory_remove (const char *filename);
* Remove the directory given under @a option in
* section [PATHS] in configuration under @a cfg_filename
*
+ * @param pd project data to use to determine paths
* @param cfg_filename configuration file to parse
* @param option option with the dir name to purge
*/
void
-GNUNET_DISK_purge_cfg_dir (const char *cfg_filename,
+GNUNET_DISK_purge_cfg_dir (const struct GNUNET_OS_ProjectData *pd,
+ const char *cfg_filename,
const char *option);
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h
index 451ddf12b..c3553692e 100644
--- a/src/include/gnunet_getopt_lib.h
+++ b/src/include/gnunet_getopt_lib.h
@@ -166,10 +166,12 @@ struct GNUNET_GETOPT_CommandLineOption
* Defining the option to print the command line
* help text (-h option).
*
+ * @param pd project data to determine details about the application
* @param about string with brief description of the application
*/
struct GNUNET_GETOPT_CommandLineOption
-GNUNET_GETOPT_option_help (const char *about);
+GNUNET_GETOPT_option_help (const struct GNUNET_OS_ProjectData *pd,
+ const char *about);
/**
diff --git a/src/include/gnunet_helper_lib.h b/src/include/gnunet_helper_lib.h
index 57630c45c..f6fcf8e24 100644
--- a/src/include/gnunet_helper_lib.h
+++ b/src/include/gnunet_helper_lib.h
@@ -70,6 +70,7 @@ typedef void
* restarted when it dies except when it is stopped using GNUNET_HELPER_stop()
* or when the exp_cb callback is not NULL.
*
+ * @param pd project data to use to determine paths
* @param with_control_pipe does the helper support the use of a control pipe
for signalling?
* @param binary_name name of the binary to run
* @param binary_argv NULL-terminated list of arguments to give when starting
the binary (this
@@ -82,7 +83,8 @@ typedef void
* @return the new Handle, NULL on error
*/
struct GNUNET_HELPER_Handle *
-GNUNET_HELPER_start (int with_control_pipe,
+GNUNET_HELPER_start (const struct GNUNET_OS_ProjectData *pd,
+ int with_control_pipe,
const char *binary_name,
char *const binary_argv[],
GNUNET_MessageTokenizerCallback cb,
diff --git a/src/include/gnunet_os_lib.h b/src/include/gnunet_os_lib.h
index 3f662694a..65635e0b3 100644
--- a/src/include/gnunet_os_lib.h
+++ b/src/include/gnunet_os_lib.h
@@ -311,23 +311,19 @@ struct GNUNET_OS_ProjectData
* Return default project data used by 'libgnunetutil' for GNUnet.
*/
const struct GNUNET_OS_ProjectData *
-GNUNET_OS_project_data_default (void);
+GNUNET_OS_project_data_gnunet (void);
/**
- * @return current (actual) project data.
- */
-const struct GNUNET_OS_ProjectData *
-GNUNET_OS_project_data_get (void);
-
-
-/**
- * Setup OS subsystem with project data.
+ * Setup OS subsystem for the given project data and package.
+ * Initializes GNU Gettext.
*
- * @param pd project data used to determine paths.
+ * @param package_name name of the package for GNU gettext
+ * @param pd project data to use to determine paths
*/
void
-GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd);
+GNUNET_OS_init (const char *package_name,
+ const struct GNUNET_OS_ProjectData *pd);
/**
@@ -335,11 +331,13 @@ GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd);
* #GNUNET_OS_IPK_SELF_PREFIX, the current running apps installation
* directory.
*
+ * @param pd project data to use to determine paths
* @param dirkind what kind of directory is desired?
* @return a pointer to the dir path (to be freed by the caller)
*/
char *
-GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind);
+GNUNET_OS_installation_get_path (const struct GNUNET_OS_ProjectData *pd,
+ enum GNUNET_OS_InstallationPathKind dirkind);
/**
@@ -347,11 +345,13 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind);
* binary, try to prefix it with the libexec/-directory to get the
* full path.
*
+ * @param pd project data to use to determine paths
* @param progname name of the binary
* @return full path to the binary, if possible, otherwise copy of 'progname'
*/
char *
-GNUNET_OS_get_libexec_binary_path (const char *progname);
+GNUNET_OS_get_libexec_binary_path (const struct GNUNET_OS_ProjectData *pd,
+ const char *progname);
/**
@@ -361,13 +361,15 @@ GNUNET_OS_get_libexec_binary_path (const char *progname);
* GNUNET_OS_get_libexec_binary_path. If @a progname is an absolute path, a
* copy of this path is returned.
*
+ * @param pd project data to use to determine paths
* @param cfg configuration to inspect
* @param progname name of the binary
* @return full path to the binary, if possible, a copy of @a progname
* otherwise
*/
char *
-GNUNET_OS_get_suid_binary_path (const struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_OS_get_suid_binary_path (const struct GNUNET_OS_ProjectData *pd,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *progname);
diff --git a/src/include/gnunet_plugin_lib.h b/src/include/gnunet_plugin_lib.h
index 2a9cde47f..6308a21d6 100644
--- a/src/include/gnunet_plugin_lib.h
+++ b/src/include/gnunet_plugin_lib.h
@@ -18,7 +18,7 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
-#if !defined (__GNUNET_UTIL_LIB_H_INSIDE__)
+#if ! defined (__GNUNET_UTIL_LIB_H_INSIDE__)
#error "Only <gnunet_util_lib.h> can be included directly."
#endif
@@ -67,11 +67,13 @@ typedef void *
* Note that the library must export a symbol called
* "library_name_init" for the test to succeed.
*
+ * @param pd project data with library search path
* @param library_name name of the plugin to test if it is installed
* @return #GNUNET_YES if the plugin exists, #GNUNET_NO if not
*/
enum GNUNET_GenericReturnValue
-GNUNET_PLUGIN_test (const char *library_name);
+GNUNET_PLUGIN_test (const struct GNUNET_OS_ProjectData *pd,
+ const char *library_name);
/**
@@ -82,12 +84,14 @@ GNUNET_PLUGIN_test (const char *library_name);
* "library_name_init" and "library_name_done". These will be called
* when the library is loaded and unloaded respectively.
*
+ * @param pd project data with library search path
* @param library_name name of the plugin to load
* @param arg argument to the plugin initialization function
* @return whatever the initialization function returned, NULL on error
*/
void *
-GNUNET_PLUGIN_load (const char *library_name,
+GNUNET_PLUGIN_load (const struct GNUNET_OS_ProjectData *pd,
+ const char *library_name,
void *arg);
@@ -114,40 +118,20 @@ typedef void
* "basename_ANYTHING_init" and "basename_ANYTHING__done". These will
* be called when the library is loaded and unloaded respectively.
*
+ * @param pd project data with library search path
* @param basename basename of the plugins to load
* @param arg argument to the plugin initialization function
* @param cb function to call for each plugin found
* @param cb_cls closure for @a cb
*/
void
-GNUNET_PLUGIN_load_all (const char *basename,
+GNUNET_PLUGIN_load_all (const struct GNUNET_OS_ProjectData *pd,
+ const char *basename,
void *arg,
GNUNET_PLUGIN_LoaderCallback cb,
void *cb_cls);
-/**
- * Load all compatible plugins with the given base name while inside the given
- * context (i.e. a specific project data structure.)
- *
- * Note that the library must export symbols called `basename_ANYTHING_init`
- * and `basename_ANYTHING__done`. These will be called when the library is
- * loaded and unloaded respectively.
- *
- * @param ctx the context used to find the plugins
- * @param basename basename of the plugins to load
- * @param arg argument to the plugin initialization function
- * @param cb function to call for each plugin found
- * @param cb_cls closure for @a cb
- */
-void
-GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx,
- const char *basename,
- void *arg,
- GNUNET_PLUGIN_LoaderCallback cb,
- void *cb_cls);
-
-
/**
* Unload plugin (runs the "done" callback and returns whatever "done"
* returned). The plugin is then unloaded.
diff --git a/src/include/gnunet_program_lib.h b/src/include/gnunet_program_lib.h
index 083aad2bf..dc4df9706 100644
--- a/src/include/gnunet_program_lib.h
+++ b/src/include/gnunet_program_lib.h
@@ -72,6 +72,7 @@ typedef void
* Run a standard GNUnet command startup sequence (initialize loggers
* and configuration, parse options).
*
+ * @param pd project data for the project the program belongs to
* @param argc number of command line arguments in @a argv
* @param argv command line arguments
* @param binaryName our expected name
@@ -87,7 +88,8 @@ typedef void
* #GNUNET_OK on success (#a task was invoked)
*/
enum GNUNET_GenericReturnValue
-GNUNET_PROGRAM_run2 (int argc,
+GNUNET_PROGRAM_run2 (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
const char *binaryName,
const char *binaryHelp,
@@ -101,6 +103,7 @@ GNUNET_PROGRAM_run2 (int argc,
* Run a standard GNUnet command startup sequence (initialize loggers
* and configuration, parse options).
*
+ * @param pd project data for the project the program belongs to
* @param argc number of command line arguments
* @param argv command line arguments
* @param binaryName our expected name
@@ -114,7 +117,8 @@ GNUNET_PROGRAM_run2 (int argc,
* #GNUNET_OK on success (#a task was invoked)
*/
enum GNUNET_GenericReturnValue
-GNUNET_PROGRAM_run (int argc,
+GNUNET_PROGRAM_run (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
const char *binaryName,
const char *binaryHelp,
@@ -122,16 +126,23 @@ GNUNET_PROGRAM_run (int argc,
GNUNET_PROGRAM_Main task,
void *task_cls);
+
enum GNUNET_GenericReturnValue
GNUNET_DAEMON_register (const char *daemon_name,
const char *daemon_desc,
GNUNET_PROGRAM_Main task);
+
/**
* Start all services and daemons in a single process.
+ *
+ * @param pd project data for the project the program belongs to
+ * @param argc number of command line arguments
+ * @param argv command line arguments
*/
void
-GNUNET_PROGRAM_monolith_main (int argc,
+GNUNET_PROGRAM_monolith_main (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
struct GNUNET_CONFIGURATION_Handle *cfg);
@@ -145,7 +156,8 @@ GNUNET_PROGRAM_monolith_main (int argc,
struct GNUNET_GETOPT_CommandLineOption options[] = { \
GNUNET_GETOPT_OPTION_END \
}; \
- ret = GNUNET_PROGRAM_run (argc, \
+ ret = GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (), \
+ argc, \
argv, \
daemon_name, \
daemon_help, \
@@ -169,9 +181,14 @@ GNUNET_PROGRAM_monolith_main (int argc,
/**
* Create configuration handle from options and configuration file.
+ *
+ * @param pd project data for the project the program belongs to
+ * @param argc number of command line arguments
+ * @param argv command line arguments
*/
enum GNUNET_GenericReturnValue
-GNUNET_PROGRAM_conf_and_options (int argc,
+GNUNET_PROGRAM_conf_and_options (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
struct GNUNET_CONFIGURATION_Handle *cfg);
@@ -179,9 +196,14 @@ GNUNET_PROGRAM_conf_and_options (int argc,
/**
* Run the mainloop in a monolithic libgnunet.
* Must be called such that services are actually launched.
+ *
+ * @param pd project data for the project the program belongs to
+ * @param argc number of command line arguments
+ * @param argv command line arguments
*/
void
-GNUNET_DAEMON_main (int argc,
+GNUNET_DAEMON_main (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
struct GNUNET_CONFIGURATION_Handle *cfg,
enum GNUNET_GenericReturnValue with_scheduler);
diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h
index 10b6860bc..23bceb3c2 100644
--- a/src/include/gnunet_service_lib.h
+++ b/src/include/gnunet_service_lib.h
@@ -176,6 +176,7 @@ typedef void
*
* The service must be stopped using #GNUNET_SERVICE_stop().
*
+ * @param pd project data for the service
* @param service_name name of the service to run
* @param cfg configuration to use
* @param connect_cb function to call whenever a client connects
@@ -187,7 +188,8 @@ typedef void
* @return NULL on error
*/
struct GNUNET_SERVICE_Handle *
-GNUNET_SERVICE_start (const char *service_name,
+GNUNET_SERVICE_start (const struct GNUNET_OS_ProjectData *pd,
+ const char *service_name,
const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_SERVICE_ConnectHandler connect_cb,
GNUNET_SERVICE_DisconnectHandler disconnect_cb,
@@ -231,6 +233,7 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv);
* dropped. Additionally, clients can be dropped at any time using
* #GNUNET_SERVICE_client_drop().
*
+ * @param pd project data for the service
* @param argc number of command-line arguments in @a argv
* @param argv array of command-line arguments
* @param service_name name of the service to run
@@ -245,7 +248,8 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv);
* @return 0 on success, non-zero on error
*/
int
-GNUNET_SERVICE_run_ (int argc,
+GNUNET_SERVICE_run_ (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
const char *service_name,
enum GNUNET_SERVICE_Options options,
@@ -284,6 +288,7 @@ GNUNET_SERVICE_run_ (int argc,
* dropped. Additionally, clients can be dropped at any time using
* #GNUNET_SERVICE_client_drop().
*
+ * @param pd project data for the service
* @param service_name name of the service to run
* @param options options controlling shutdown of the service
* @param service_init_cb function to call once the service is ready
@@ -297,6 +302,7 @@ GNUNET_SERVICE_run_ (int argc,
*/
int
GNUNET_SERVICE_register_ (
+ const struct GNUNET_OS_ProjectData *pd,
const char *service_name,
enum GNUNET_SERVICE_Options options,
GNUNET_SERVICE_InitCallback service_init_cb,
@@ -364,7 +370,8 @@ GNUNET_SERVICE_register_ (
* </code>
*/
#ifndef HAVE_GNUNET_MONOLITH
-#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb,
connect_cb, \
+#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, \
+ connect_cb, \
disconnect_cb, cls, ...) \
int \
main (int argc, \
@@ -373,7 +380,8 @@ GNUNET_SERVICE_register_ (
struct GNUNET_MQ_MessageHandler mh[] = { \
__VA_ARGS__ \
}; \
- return GNUNET_SERVICE_run_ (argc, \
+ return GNUNET_SERVICE_run_ (GNUNET_OS_project_data_gnunet (), \
+ argc, \
argv, \
service_name, \
service_options, \
@@ -384,7 +392,8 @@ GNUNET_SERVICE_register_ (
mh); \
}
#else
-#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb,
connect_cb, \
+#define GNUNET_SERVICE_MAIN(pd, service_name, service_options, init_cb, \
+ connect_cb, \
disconnect_cb, cls, ...) \
static int __attribute__ ((constructor)) \
init (void) \
@@ -392,7 +401,8 @@ GNUNET_SERVICE_register_ (
struct GNUNET_MQ_MessageHandler mh[] = { \
__VA_ARGS__ \
}; \
- return GNUNET_SERVICE_register_ (service_name, \
+ return GNUNET_SERVICE_register_ (pd, \
+ service_name, \
service_options, \
init_cb, \
connect_cb, \
@@ -407,7 +417,8 @@ GNUNET_SERVICE_register_ (
* Must be called such that services are actually launched.
*/
void
-GNUNET_SERVICE_main (int argc,
+GNUNET_SERVICE_main (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
struct GNUNET_CONFIGURATION_Handle *cfg,
enum GNUNET_GenericReturnValue with_scheduler);
@@ -460,8 +471,8 @@ GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client
*c);
* @param c client for which to disable the warning
*/
void
-GNUNET_SERVICE_client_disable_continue_warning (struct
- GNUNET_SERVICE_Client *c);
+GNUNET_SERVICE_client_disable_continue_warning (
+ struct GNUNET_SERVICE_Client *c);
/**
diff --git a/src/lib/block/block.c b/src/lib/block/block.c
index 9edc7ce5e..40e472c9c 100644
--- a/src/lib/block/block.c
+++ b/src/lib/block/block.c
@@ -140,14 +140,16 @@ struct GNUNET_BLOCK_Context *
GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_BLOCK_Context *ctx;
+ const struct GNUNET_OS_ProjectData *pd;
ctx = GNUNET_new (struct GNUNET_BLOCK_Context);
ctx->cfg = cfg;
- GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (),
- "libgnunet_plugin_block_",
- (void *) cfg,
- &add_plugin,
- ctx);
+ pd = GNUNET_CONFIGURATION_get_project_data (cfg);
+ GNUNET_PLUGIN_load_all (pd,
+ "libgnunet_plugin_block_",
+ (void *) cfg,
+ &add_plugin,
+ ctx);
return ctx;
}
diff --git a/src/lib/gnsrecord/gnsrecord.c b/src/lib/gnsrecord/gnsrecord.c
index c94b2298a..94d067cec 100644
--- a/src/lib/gnsrecord/gnsrecord.c
+++ b/src/lib/gnsrecord/gnsrecord.c
@@ -99,17 +99,18 @@ init ()
if (1 == once)
return;
once = 1;
-
- GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (),
- "libgnunet_plugin_gnsrecord_",
- NULL,
- &add_plugin,
- NULL);
+ GNUNET_PLUGIN_load_all (GNUNET_OS_project_data_gnunet (),
+ "libgnunet_plugin_gnsrecord_",
+ NULL,
+ &add_plugin,
+ NULL);
}
+
void
GNSRECORD_fini (void);
+
/**
* Dual function to #init().
*/
@@ -117,11 +118,6 @@ void __attribute__ ((destructor))
GNSRECORD_fini (void)
{
struct Plugin *plugin;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
- const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default ();
-
- if (pd != dpd)
- GNUNET_OS_init (dpd);
for (unsigned int i = 0; i < num_plugins; i++)
{
@@ -133,10 +129,6 @@ GNSRECORD_fini (void)
GNUNET_free (plugin);
}
GNUNET_free (gns_plugins);
-
- if (pd != dpd)
- GNUNET_OS_init (pd);
-
gns_plugins = NULL;
once = 0;
num_plugins = 0;
diff --git a/src/lib/gnsrecord/gnsrecord_pow.c
b/src/lib/gnsrecord/gnsrecord_pow.c
index 1107671f0..a3d514721 100644
--- a/src/lib/gnsrecord/gnsrecord_pow.c
+++ b/src/lib/gnsrecord/gnsrecord_pow.c
@@ -17,12 +17,11 @@
SPDX-License-Identifier: AGPL3.0-or-later
*/
-
-
/**
* @brief API for proof of work
* @author Martin Schanzenbach
*/
+#include "platform.h"
#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include "gnunet_gnsrecord_lib.h"
diff --git a/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
b/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
index affbebc78..4ee563845 100644
--- a/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
+++ b/src/lib/gnsrecord/gnunet-gnsrecord-tvg.c
@@ -529,7 +529,8 @@ main (int argc,
// gcry_control (GCRYCTL_SET_DEBUG_FLAGS, 1u, 0);
// gcry_control (GCRYCTL_SET_VERBOSITY, 99);
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv,
"gnunet-gns-tvg",
"Generate test vectors for GNS",
options,
diff --git a/src/lib/gnsrecord/perf_gnsrecord_crypto.c
b/src/lib/gnsrecord/perf_gnsrecord_crypto.c
index 82f26a643..c0835d365 100644
--- a/src/lib/gnsrecord/perf_gnsrecord_crypto.c
+++ b/src/lib/gnsrecord/perf_gnsrecord_crypto.c
@@ -91,11 +91,11 @@ run (void *cls,
for (unsigned int i = 0; i < ROUNDS; i++)
{
GNUNET_assert (GNUNET_OK == GNUNET_GNSRECORD_block_create2 (&privkey,
- expire,
- s_name,
- s_rd,
- RECORDS,
- &block));
+ expire,
+ s_name,
+ s_rd,
+ RECORDS,
+ &block));
GNUNET_GNSRECORD_query_from_private_key (&privkey,
s_name,
&query);
@@ -125,7 +125,8 @@ main (int argc, char *argv[])
};
if (GNUNET_OK !=
- GNUNET_PROGRAM_run ((sizeof(argvx) / sizeof(char *)) - 1,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argvx) / sizeof(char *)) - 1,
argvx,
"perf-gnsrecord-crypto",
"nohelp", options,
diff --git a/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
b/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
index 8ff082ac2..db847ba7d 100644
--- a/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
+++ b/src/lib/gnsrecord/test_gnsrecord_block_expiration.c
@@ -77,7 +77,8 @@ run (void *cls, char *const *args, const char *cfgfile,
GNUNET_assert (expiration_abs.abs_value_us ==
GNUNET_GNSRECORD_record_get_expiration_time (2,
rd,
-
GNUNET_TIME_UNIT_ZERO_ABS).abs_value_us);
+
GNUNET_TIME_UNIT_ZERO_ABS)
+ .abs_value_us);
rd[1].expiration_time = expiration_abs_shadow.abs_value_us;
rd[1].record_type = TEST_RECORD_TYPE;
@@ -91,7 +92,8 @@ run (void *cls, char *const *args, const char *cfgfile,
GNUNET_assert (expiration_abs_shadow.abs_value_us ==
GNUNET_GNSRECORD_record_get_expiration_time (2,
rd,
-
GNUNET_TIME_UNIT_ZERO_ABS).abs_value_us);
+
GNUNET_TIME_UNIT_ZERO_ABS)
+ .abs_value_us);
GNUNET_free (tmp_data0);
GNUNET_free (tmp_data1);
res = 0;
@@ -108,7 +110,8 @@ main (int argc, char *argv[])
};
res = 1;
- GNUNET_PROGRAM_run ((sizeof(argvx) / sizeof(char *)) - 1, argvx,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argvx) / sizeof(char *)) - 1, argvx,
"test-namestore-api",
"nohelp", options, &run, &res);
return res;
diff --git a/src/lib/gnsrecord/test_gnsrecord_crypto.c
b/src/lib/gnsrecord/test_gnsrecord_crypto.c
index 5721350d4..8fe1d3475 100644
--- a/src/lib/gnsrecord/test_gnsrecord_crypto.c
+++ b/src/lib/gnsrecord/test_gnsrecord_crypto.c
@@ -101,11 +101,11 @@ test_with_type (struct GNUNET_CRYPTO_PrivateKey *privkey)
struct GNUNET_HashCode query_priv;
struct GNUNET_HashCode query_block;
struct GNUNET_TIME_Absolute expire = GNUNET_TIME_UNIT_FOREVER_ABS;
- char* tmp_data;
+ char*tmp_data;
/* get public key */
GNUNET_CRYPTO_key_get_public (privkey,
- &pubkey);
+ &pubkey);
/* test query derivation */
GNUNET_GNSRECORD_query_from_private_key (privkey,
@@ -146,7 +146,7 @@ test_with_type (struct GNUNET_CRYPTO_PrivateKey *privkey)
for (int i = 0; i < RECORDS; i++)
{
tmp_data = (char*) s_rd[i].data;
- GNUNET_free(tmp_data);
+ GNUNET_free (tmp_data);
}
GNUNET_free (s_rd);
GNUNET_free (block);
@@ -199,7 +199,8 @@ main (int argc, char *argv[])
};
res = 1;
- GNUNET_PROGRAM_run ((sizeof(argvx) / sizeof(char *)) - 1,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argvx) / sizeof(char *)) - 1,
argvx,
"test-gnsrecord-crypto",
"nohelp", options,
diff --git a/src/lib/gnsrecord/test_gnsrecord_serialization.c
b/src/lib/gnsrecord/test_gnsrecord_serialization.c
index 6e96dbb3a..e94ae28f4 100644
--- a/src/lib/gnsrecord/test_gnsrecord_serialization.c
+++ b/src/lib/gnsrecord/test_gnsrecord_serialization.c
@@ -147,7 +147,9 @@ main (int argcx, char *argvx[])
};
res = 1;
- GNUNET_PROGRAM_run ((sizeof(argv) / sizeof(char *)) - 1, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argv) / sizeof(char *)) - 1,
+ argv,
"test_namestore_record_serialization",
"nohelp", options, &run, &res);
return res;
diff --git a/src/lib/testing/gnunet-cmds-helper.c
b/src/lib/testing/gnunet-cmds-helper.c
index 7b5021cf2..3d5c2bef2 100644
--- a/src/lib/testing/gnunet-cmds-helper.c
+++ b/src/lib/testing/gnunet-cmds-helper.c
@@ -334,6 +334,8 @@ handle_helper_init (
const struct GNUNET_ShortHashCode *bd
= (const struct GNUNET_ShortHashCode *) &msg[1];
const char *topo = (const char *) &bd[barrier_count];
+ const struct GNUNET_OS_ProjectData *pd
+ = GNUNET_OS_project_data_gnunet ();
if (NULL != plugin)
{
@@ -355,7 +357,8 @@ handle_helper_init (
}
plugin_name = GNUNET_TESTING_get_plugin_from_topo (njt,
my_node_id);
- plugin = GNUNET_PLUGIN_load (plugin_name,
+ plugin = GNUNET_PLUGIN_load (pd,
+ plugin_name,
(void *) my_node_id);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting plugin `%s' for node %s\n",
@@ -557,8 +560,11 @@ main (int argc,
GNUNET_GETOPT_OPTION_END
};
enum GNUNET_GenericReturnValue ret;
+ const struct GNUNET_OS_ProjectData *pd
+ = GNUNET_OS_project_data_gnunet ();
- ret = GNUNET_PROGRAM_run (argc,
+ ret = GNUNET_PROGRAM_run (pd,
+ argc,
argv,
"gnunet-cmds-helper",
"Helper for starting a local interpreter loop",
diff --git a/src/lib/testing/testing_api_cmd_netjail_start.c
b/src/lib/testing/testing_api_cmd_netjail_start.c
index 847dbc44b..77f03ace6 100644
--- a/src/lib/testing/testing_api_cmd_netjail_start.c
+++ b/src/lib/testing/testing_api_cmd_netjail_start.c
@@ -144,7 +144,9 @@ netjail_start_run (void *cls,
GNUNET_TESTING_get_trait_topology_string (topo_cmd,
&topology_data))
GNUNET_TESTING_FAIL (is);
- data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
+ data_dir = GNUNET_OS_installation_get_path (
+ GNUNET_OS_project_data_gnunet (),
+ GNUNET_OS_IPK_DATADIR);
GNUNET_asprintf (&script_name,
"%s%s",
data_dir,
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
index 0482dc26b..5c2cf4980 100644
--- a/src/lib/testing/testing_api_cmd_netjail_start_cmds_helper.c
+++ b/src/lib/testing/testing_api_cmd_netjail_start_cmds_helper.c
@@ -215,8 +215,8 @@ handle_helper_barrier_reached (
{
ns->failed = true;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "We did not found the barrier that was supposedly
reached.!\n");
- GNUNET_TESTING_async_fail (&ns->ac);
+ "We did not found the barrier that was supposedly
reached.!\n");
+ GNUNET_TESTING_async_fail (&ns->ac);
}
return;
}
@@ -325,7 +325,7 @@ helper_mst (void *cls,
{
ns->failed = true;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "We got an unknown message from the helper process!\n");
+ "We got an unknown message from the helper process!\n");
GNUNET_TESTING_async_fail (&ns->ac);
}
}
@@ -448,15 +448,19 @@ static bool
start_helper (struct NetJailState *ns,
unsigned int script_num)
{
+ const struct GNUNET_OS_ProjectData *pd
+ = GNUNET_OS_project_data_gnunet ();
char *gnunet_cmds_helper
- = GNUNET_OS_get_libexec_binary_path (HELPER_CMDS_BINARY);
+ = GNUNET_OS_get_libexec_binary_path (pd,
+ HELPER_CMDS_BINARY);
+ char *data_dir
+ = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_DATADIR);
char node_id[32];
- char *data_dir;
char *script_name;
struct GNUNET_HELPER_Handle *helper;
struct HelperState *hs = GNUNET_new (struct HelperState);
- data_dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
GNUNET_asprintf (&script_name,
"%s%s",
data_dir,
@@ -476,12 +480,13 @@ start_helper (struct NetJailState *ns,
};
hs->ns = ns;
helper = GNUNET_HELPER_start (
- GNUNET_YES, /*
with control pipe */
- script_argv[0],
- script_argv,
- &helper_mst,
- &exp_cb,
- hs);
+ pd,
+ GNUNET_YES, /*
with control pipe */
+ script_argv[0],
+ script_argv,
+ &helper_mst,
+ &exp_cb,
+ hs);
hs->helper = helper;
}
GNUNET_free (gnunet_cmds_helper);
@@ -524,8 +529,8 @@ do_timeout (void *cls)
static int
start_peer (void *cls,
- const struct GNUNET_ShortHashCode *key,
- void *value)
+ const struct GNUNET_ShortHashCode *key,
+ void *value)
{
struct NetJailState *ns = cls;
@@ -544,8 +549,8 @@ start_peer (void *cls,
static int
start_subnets (void *cls,
- const struct GNUNET_ShortHashCode *key,
- void *value)
+ const struct GNUNET_ShortHashCode *key,
+ void *value)
{
struct NetJailState *ns = cls;
struct GNUNET_TESTING_NetjailSubnet *subnet = value;
@@ -555,8 +560,8 @@ start_subnets (void *cls,
"Starting subnet %u.\n",
node_number);
if (GNUNET_SYSERR == GNUNET_CONTAINER_multishortmap_iterate (subnet->peers,
- &start_peer,
- ns))
+ &start_peer,
+ ns))
return GNUNET_SYSERR;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Subnet started.\n");
@@ -577,12 +582,12 @@ start_carriers (void *cls,
"Starting carrier %u.\n",
node_number);
if (GNUNET_SYSERR == GNUNET_CONTAINER_multishortmap_iterate (carrier->peers,
- &start_peer,
- ns))
+ &start_peer,
+ ns))
return GNUNET_SYSERR;
if (GNUNET_SYSERR == GNUNET_CONTAINER_multishortmap_iterate
(carrier->subnets,
- &start_subnets,
- ns))
+ &start_subnets,
+ ns))
return GNUNET_SYSERR;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -621,15 +626,19 @@ netjail_exec_run (void *cls,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Number of nodes: %u\n",
topology->total);
- if (GNUNET_SYSERR == GNUNET_CONTAINER_multishortmap_iterate
(topology->backbone_peers,
- &start_peer,
- ns))
+ if (GNUNET_SYSERR == GNUNET_CONTAINER_multishortmap_iterate (topology->
+ backbone_peers,
+ &start_peer,
+ ns))
failed = true;
- if (true == failed || GNUNET_SYSERR ==
GNUNET_CONTAINER_multishortmap_iterate (topology->carriers,
-
&start_carriers,
-
ns))
+ if (true == failed || GNUNET_SYSERR == GNUNET_CONTAINER_multishortmap_iterate
+ (topology->carriers,
+ &
+ start_carriers,
+ ns))
+
failed = true;
-
+
GNUNET_TESTING_free_topology (topology);
if (failed)
{
@@ -641,8 +650,8 @@ netjail_exec_run (void *cls,
else
ns->timeout_task
= GNUNET_SCHEDULER_add_delayed (ns->timeout,
- &do_timeout,
- ns);
+ &do_timeout,
+ ns);
}
diff --git a/src/lib/testing/testing_api_topology.c
b/src/lib/testing/testing_api_topology.c
index 833612382..be0d68e9f 100644
--- a/src/lib/testing/testing_api_topology.c
+++ b/src/lib/testing/testing_api_topology.c
@@ -29,8 +29,8 @@
* @author Christian Grothoff
*
*/
-#include "gnunet_common.h"
#include "platform.h"
+#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include "gnunet_testing_lib.h"
#include "testing_api_topology.h"
@@ -611,11 +611,14 @@ GNUNET_TESTING_get_topo_from_string_ (const char *input)
struct GNUNET_HashCode hc = {0};
struct GNUNET_TESTING_NetjailTopology *topology = GNUNET_new (struct
GNUNET_TESTING_NetjailTopology);
- topology->backbone_peers = GNUNET_CONTAINER_multishortmap_create
(1,GNUNET_NO)
- ;
- topology->carriers = GNUNET_CONTAINER_multishortmap_create (1,GNUNET_NO);
- cfg = GNUNET_CONFIGURATION_create ();
+ topology->backbone_peers
+ = GNUNET_CONTAINER_multishortmap_create (1,
+ GNUNET_NO);
+ topology->carriers
+ = GNUNET_CONTAINER_multishortmap_create (1,
+ GNUNET_NO);
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
GNUNET_assert (NULL != topology->carriers);
if (GNUNET_OK !=
@@ -629,11 +632,11 @@ GNUNET_TESTING_get_topo_from_string_ (const char *input)
GNUNET_CONFIGURATION_destroy (cfg);
return NULL;
}
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
- "DEFAULTS",
- "SUBNETS",
- &(topology->
- default_subnets)))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg,
+ "DEFAULTS",
+ "SUBNETS",
+ &topology->default_subnets))
{
LOG (GNUNET_ERROR_TYPE_ERROR,
"Missing default SUBNETS!\n");
diff --git a/src/lib/util/Makefile.am b/src/lib/util/Makefile.am
index f323b8220..5af862bf0 100644
--- a/src/lib/util/Makefile.am
+++ b/src/lib/util/Makefile.am
@@ -50,7 +50,6 @@ libgnunetutil_la_SOURCES = \
common_logging.c \
compress.c \
configuration.c \
- configuration_helper.c \
consttime_memcmp.c \
container_bloomfilter.c \
container_heap.c \
diff --git a/src/lib/util/configuration.c b/src/lib/util/configuration.c
index a3fb94ab2..ff6a9b0ff 100644
--- a/src/lib/util/configuration.c
+++ b/src/lib/util/configuration.c
@@ -162,6 +162,11 @@ struct GNUNET_CONFIGURATION_Handle
*/
struct ConfigFile *loaded_files_tail;
+ /**
+ * Project data for this configuration object.
+ */
+ const struct GNUNET_OS_ProjectData *pd;
+
/**
* Current nesting level of file loading.
*/
@@ -219,15 +224,17 @@ GNUNET_CONFIGURATION_enable_diagnostics (
struct GNUNET_CONFIGURATION_Handle *
-GNUNET_CONFIGURATION_create ()
+GNUNET_CONFIGURATION_create (const struct GNUNET_OS_ProjectData *pd)
{
struct GNUNET_CONFIGURATION_Handle *cfg;
char *p;
cfg = GNUNET_new (struct GNUNET_CONFIGURATION_Handle);
+ cfg->pd = pd;
/* make certain values from the project data available
as PATHS */
- p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
+ p = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_DATADIR);
if (NULL != p)
{
GNUNET_CONFIGURATION_set_value_string (cfg,
@@ -236,7 +243,8 @@ GNUNET_CONFIGURATION_create ()
p);
GNUNET_free (p);
}
- p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR);
+ p = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LIBDIR);
if (NULL != p)
{
GNUNET_CONFIGURATION_set_value_string (cfg,
@@ -245,7 +253,8 @@ GNUNET_CONFIGURATION_create ()
p);
GNUNET_free (p);
}
- p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR);
+ p = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_BINDIR);
if (NULL != p)
{
GNUNET_CONFIGURATION_set_value_string (cfg,
@@ -254,7 +263,8 @@ GNUNET_CONFIGURATION_create ()
p);
GNUNET_free (p);
}
- p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX);
+ p = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_PREFIX);
if (NULL != p)
{
GNUNET_CONFIGURATION_set_value_string (cfg,
@@ -263,7 +273,8 @@ GNUNET_CONFIGURATION_create ()
p);
GNUNET_free (p);
}
- p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR);
+ p = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LOCALEDIR);
if (NULL != p)
{
GNUNET_CONFIGURATION_set_value_string (cfg,
@@ -272,7 +283,8 @@ GNUNET_CONFIGURATION_create ()
p);
GNUNET_free (p);
}
- p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_ICONDIR);
+ p = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_ICONDIR);
if (NULL != p)
{
GNUNET_CONFIGURATION_set_value_string (cfg,
@@ -281,7 +293,8 @@ GNUNET_CONFIGURATION_create ()
p);
GNUNET_free (p);
}
- p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DOCDIR);
+ p = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_DOCDIR);
if (NULL != p)
{
GNUNET_CONFIGURATION_set_value_string (cfg,
@@ -290,7 +303,8 @@ GNUNET_CONFIGURATION_create ()
p);
GNUNET_free (p);
}
- p = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBEXECDIR);
+ p = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LIBEXECDIR);
if (NULL != p)
{
GNUNET_CONFIGURATION_set_value_string (cfg,
@@ -326,14 +340,15 @@ GNUNET_CONFIGURATION_destroy (struct
GNUNET_CONFIGURATION_Handle *cfg)
enum GNUNET_GenericReturnValue
-GNUNET_CONFIGURATION_parse_and_run (const char *filename,
+GNUNET_CONFIGURATION_parse_and_run (const struct GNUNET_OS_ProjectData *pd,
+ const char *filename,
GNUNET_CONFIGURATION_Callback cb,
void *cb_cls)
{
struct GNUNET_CONFIGURATION_Handle *cfg;
enum GNUNET_GenericReturnValue ret;
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (pd);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_load (cfg,
filename))
@@ -342,7 +357,8 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename,
GNUNET_CONFIGURATION_destroy (cfg);
return GNUNET_SYSERR;
}
- ret = cb (cb_cls, cfg);
+ ret = cb (cb_cls,
+ cfg);
GNUNET_CONFIGURATION_destroy (cfg);
return ret;
}
@@ -582,7 +598,7 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg,
goto cleanup;
}
- other_cfg = GNUNET_CONFIGURATION_create ();
+ other_cfg = GNUNET_CONFIGURATION_create (cfg->pd);
other_cfg->restrict_section = restrict_section;
inner_ret = GNUNET_CONFIGURATION_parse (other_cfg,
inline_path);
@@ -593,7 +609,8 @@ handle_inline (struct GNUNET_CONFIGURATION_Handle *cfg,
goto cleanup;
}
- cs = find_section (other_cfg, restrict_section);
+ cs = find_section (other_cfg,
+ restrict_section);
if (NULL == cs)
{
LOG (GNUNET_ERROR_TYPE_INFO,
@@ -1537,7 +1554,7 @@ GNUNET_CONFIGURATION_dup (
{
struct GNUNET_CONFIGURATION_Handle *ret;
- ret = GNUNET_CONFIGURATION_create ();
+ ret = GNUNET_CONFIGURATION_create (cfg->pd);
GNUNET_CONFIGURATION_iterate (cfg,
©_entry,
ret);
@@ -1582,9 +1599,12 @@ GNUNET_CONFIGURATION_get_diff (
{
struct DiffHandle diffHandle;
- diffHandle.cfgDiff = GNUNET_CONFIGURATION_create ();
+ GNUNET_break (cfg_default->pd == cfg_new->pd);
+ diffHandle.cfgDiff = GNUNET_CONFIGURATION_create (cfg_new->pd);
diffHandle.cfg_default = cfg_default;
- GNUNET_CONFIGURATION_iterate (cfg_new, &compare_entries, &diffHandle);
+ GNUNET_CONFIGURATION_iterate (cfg_new,
+ &compare_entries,
+ &diffHandle);
return diffHandle.cfgDiff;
}
@@ -2400,7 +2420,8 @@ GNUNET_CONFIGURATION_load_from (
enum GNUNET_GenericReturnValue fun_ret;
if (GNUNET_SYSERR ==
- GNUNET_DISK_directory_scan (defaults_d, &collect_files_cb,
+ GNUNET_DISK_directory_scan (defaults_d,
+ &collect_files_cb,
&files_context))
return GNUNET_SYSERR; /* no configuration at all found */
qsort (files_context.files,
@@ -2416,11 +2437,14 @@ GNUNET_CONFIGURATION_load_from (
ext = strrchr (filename, '.');
if ((NULL == ext) || (0 != strcmp (ext, ".conf")))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Skipping file `%s'\n", filename);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Skipping file `%s'\n",
+ filename);
fun_ret = GNUNET_OK;
goto cleanup;
}
- fun_ret = GNUNET_CONFIGURATION_parse (cfg, filename);
+ fun_ret = GNUNET_CONFIGURATION_parse (cfg,
+ filename);
if (fun_ret != GNUNET_OK)
break;
}
@@ -2438,10 +2462,10 @@ cleanup:
char *
-GNUNET_CONFIGURATION_default_filename (void)
+GNUNET_CONFIGURATION_default_filename (
+ const struct GNUNET_OS_ProjectData *pd)
{
char *cfg_fn;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
const char *xdg = getenv ("XDG_CONFIG_HOME");
if (NULL != xdg)
@@ -2463,7 +2487,8 @@ GNUNET_CONFIGURATION_default_filename (void)
GNUNET_asprintf (&cfg_fn,
"/etc/%s",
pd->config_file);
- if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn))
+ if (GNUNET_OK ==
+ GNUNET_DISK_file_test_read (cfg_fn))
return cfg_fn;
GNUNET_free (cfg_fn);
@@ -2471,7 +2496,8 @@ GNUNET_CONFIGURATION_default_filename (void)
"/etc/%s/%s",
pd->project_dirname,
pd->config_file);
- if (GNUNET_OK == GNUNET_DISK_file_test_read (cfg_fn))
+ if (GNUNET_OK ==
+ GNUNET_DISK_file_test_read (cfg_fn))
return cfg_fn;
GNUNET_free (cfg_fn);
@@ -2479,86 +2505,6 @@ GNUNET_CONFIGURATION_default_filename (void)
}
-struct GNUNET_CONFIGURATION_Handle *
-GNUNET_CONFIGURATION_default (void)
-{
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
- const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default ();
- const char *xdg = getenv ("XDG_CONFIG_HOME");
- char *cfgname = NULL;
- struct GNUNET_CONFIGURATION_Handle *cfg;
-
- /* Makes sure function implicitly looking at the installation directory (for
- example GNUNET_CONFIGURATION_load further down) use GNUnet's environment
- instead of the caller's. It's done at the start to make sure as many
- functions as possible are directed to the proper paths. */
- GNUNET_OS_init (dpd);
-
- cfg = GNUNET_CONFIGURATION_create ();
-
- /* First, try user configuration. */
- if (NULL != xdg)
- GNUNET_asprintf (&cfgname,
- "%s/%s",
- xdg,
- dpd->config_file);
- else
- cfgname = GNUNET_strdup (dpd->user_config_file);
-
- /* If user config doesn't exist, try in
- /etc/<projdir>/<cfgfile> and /etc/<cfgfile> */
- if (GNUNET_OK != GNUNET_DISK_file_test (cfgname))
- {
- GNUNET_free (cfgname);
- GNUNET_asprintf (&cfgname,
- "/etc/%s",
- dpd->config_file);
- }
- if (GNUNET_OK != GNUNET_DISK_file_test (cfgname))
- {
- GNUNET_free (cfgname);
- GNUNET_asprintf (&cfgname,
- "/etc/%s/%s",
- dpd->project_dirname,
- dpd->config_file);
- }
- if (GNUNET_OK != GNUNET_DISK_file_test (cfgname))
- {
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "Unable to top-level configuration file.\n");
- GNUNET_OS_init (pd);
- GNUNET_CONFIGURATION_destroy (cfg);
- GNUNET_free (cfgname);
- return NULL;
- }
-
- /* We found a configuration file that looks good, try to load it. */
-
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Loading top-level configuration from '%s'\n",
- cfgname);
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_load (cfg, cfgname))
- {
- GNUNET_OS_init (pd);
- GNUNET_CONFIGURATION_destroy (cfg);
- GNUNET_free (cfgname);
- return NULL;
- }
- GNUNET_free (cfgname);
- GNUNET_OS_init (pd);
- return cfg;
-}
-
-
-/**
- * Load configuration (starts with defaults, then loads
- * system-specific configuration).
- *
- * @param cfg configuration to update
- * @param filename name of the configuration file, NULL to load defaults
- * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
- */
enum GNUNET_GenericReturnValue
GNUNET_CONFIGURATION_load (
struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -2580,7 +2526,7 @@ GNUNET_CONFIGURATION_load (
cfg->main_filename = GNUNET_strdup (filename);
}
- base_config_varname = GNUNET_OS_project_data_get ()->base_config_varname;
+ base_config_varname = cfg->pd->base_config_varname;
if ((NULL != base_config_varname)
&& (NULL != (baseconfig = getenv (base_config_varname))))
@@ -2591,7 +2537,8 @@ GNUNET_CONFIGURATION_load (
{
char *ipath;
- ipath = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
+ ipath = GNUNET_OS_installation_get_path (cfg->pd,
+ GNUNET_OS_IPK_DATADIR);
if (NULL == ipath)
{
GNUNET_break (0);
@@ -2606,6 +2553,7 @@ GNUNET_CONFIGURATION_load (
{
char *dname = GNUNET_STRINGS_filename_expand (baseconfig);
+
GNUNET_free (baseconfig);
if ((GNUNET_YES ==
@@ -2647,4 +2595,292 @@ GNUNET_CONFIGURATION_load (
}
+/**
+ * Print each option in a given section as a filename.
+ *
+ * @param cls closure
+ * @param section name of the section
+ * @param option name of the option
+ * @param value value of the option
+ */
+static void
+print_filename_option (void *cls,
+ const char *section,
+ const char *option,
+ const char *value)
+{
+ const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+
+ char *value_fn;
+ char *fn;
+
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ section,
+ option,
+ &value_fn));
+ fn = GNUNET_STRINGS_filename_expand (value_fn);
+ if (NULL == fn)
+ fn = value_fn;
+ else
+ GNUNET_free (value_fn);
+ fprintf (stdout,
+ "%s = %s\n",
+ option,
+ fn);
+ GNUNET_free (fn);
+}
+
+
+/**
+ * Print each option in a given section.
+ *
+ * @param cls closure
+ * @param section name of the section
+ * @param option name of the option
+ * @param value value of the option
+ */
+static void
+print_option (void *cls,
+ const char *section,
+ const char *option,
+ const char *value)
+{
+ (void) cls;
+ (void) section;
+
+ fprintf (stdout,
+ "%s = %s\n",
+ option,
+ value);
+}
+
+
+/**
+ * Print out given section name.
+ *
+ * @param cls unused
+ * @param section a section in the configuration file
+ */
+static void
+print_section_name (void *cls,
+ const char *section)
+{
+ (void) cls;
+ fprintf (stdout,
+ "%s\n",
+ section);
+}
+
+
+void
+GNUNET_CONFIGURATION_config_tool_run (
+ void *cls,
+ char *const *args,
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+ struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls;
+ struct GNUNET_CONFIGURATION_Handle *out = NULL;
+ struct GNUNET_CONFIGURATION_Handle *ncfg = NULL;
+
+ (void) args;
+ if (cs->diagnostics)
+ {
+ /* Re-parse the configuration with diagnostics enabled. */
+ ncfg = GNUNET_CONFIGURATION_create (cfg->pd);
+ GNUNET_CONFIGURATION_enable_diagnostics (ncfg);
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_load (ncfg,
+ cfgfile))
+ {
+ fprintf (stderr,
+ _ ("Failed to load config file `%s'"),
+ cfgfile);
+ return;
+ }
+ cfg = ncfg;
+ }
+
+ if (cs->full)
+ cs->rewrite = GNUNET_YES;
+ if (cs->list_sections)
+ {
+ fprintf (stderr,
+ _ ("The following sections are available:\n"));
+ GNUNET_CONFIGURATION_iterate_sections (cfg,
+ &print_section_name,
+ NULL);
+ return;
+ }
+ if ( (! cs->rewrite) &&
+ (NULL == cs->section) )
+ {
+ char *serialization;
+
+ if (! cs->diagnostics)
+ {
+ fprintf (stderr,
+ _ ("%s, %s or %s argument is required\n"),
+ "--section",
+ "--list-sections",
+ "--diagnostics");
+ cs->global_ret = EXIT_INVALIDARGUMENT;
+ return;
+ }
+ serialization = GNUNET_CONFIGURATION_serialize_diagnostics (cfg);
+ fprintf (stdout,
+ "%s",
+ serialization);
+ GNUNET_free (serialization);
+ }
+ else if ( (NULL != cs->section) &&
+ (NULL == cs->value) )
+ {
+ if (NULL == cs->option)
+ {
+ GNUNET_CONFIGURATION_iterate_section_values (
+ cfg,
+ cs->section,
+ cs->is_filename
+ ? &print_filename_option
+ : &print_option,
+ (void *) cfg);
+ }
+ else
+ {
+ char *value;
+
+ if (cs->is_filename)
+ {
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ cs->section,
+ cs->option,
+ &value))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ cs->section,
+ cs->option);
+ cs->global_ret = EXIT_NOTCONFIGURED;
+ return;
+ }
+ }
+ else
+ {
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ cs->section,
+ cs->option,
+ &value))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ cs->section,
+ cs->option);
+ cs->global_ret = EXIT_NOTCONFIGURED;
+ return;
+ }
+ }
+ fprintf (stdout,
+ "%s\n",
+ value);
+ GNUNET_free (value);
+ }
+ }
+ else if (NULL != cs->section)
+ {
+ if (NULL == cs->option)
+ {
+ fprintf (stderr,
+ _ ("--option argument required to set value\n"));
+ cs->global_ret = EXIT_INVALIDARGUMENT;
+ return;
+ }
+ out = GNUNET_CONFIGURATION_dup (cfg);
+ GNUNET_CONFIGURATION_set_value_string (out,
+ cs->section,
+ cs->option,
+ cs->value);
+ cs->rewrite = GNUNET_YES;
+ }
+ if (cs->rewrite)
+ {
+ char *cfg_fn = NULL;
+
+ if (NULL == out)
+ out = GNUNET_CONFIGURATION_dup (cfg);
+
+ if (NULL == cfgfile)
+ {
+ const char *xdg = getenv ("XDG_CONFIG_HOME");
+
+ if (NULL != xdg)
+ GNUNET_asprintf (&cfg_fn,
+ "%s%s%s",
+ xdg,
+ DIR_SEPARATOR_STR,
+ cfg->pd->config_file);
+ else
+ cfg_fn = GNUNET_strdup (cfg->pd->user_config_file);
+ cfgfile = cfg_fn;
+ }
+
+ if (! cs->full)
+ {
+ struct GNUNET_CONFIGURATION_Handle *def;
+
+ def = GNUNET_CONFIGURATION_create (cfg->pd);
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_load (def,
+ NULL))
+ {
+ fprintf (stderr,
+ _ ("failed to load configuration defaults"));
+ cs->global_ret = 1;
+ GNUNET_CONFIGURATION_destroy (def);
+ GNUNET_CONFIGURATION_destroy (out);
+ GNUNET_free (cfg_fn);
+ return;
+ }
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_write_diffs (def,
+ out,
+ cfgfile))
+ cs->global_ret = 2;
+ GNUNET_CONFIGURATION_destroy (def);
+ }
+ else
+ {
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_write (out,
+ cfgfile))
+ cs->global_ret = 2;
+ }
+ GNUNET_free (cfg_fn);
+ }
+ if (NULL != out)
+ GNUNET_CONFIGURATION_destroy (out);
+ if (NULL != ncfg)
+ GNUNET_CONFIGURATION_destroy (ncfg);
+}
+
+
+void
+GNUNET_CONFIGURATION_config_settings_free (
+ struct GNUNET_CONFIGURATION_ConfigSettings *cs)
+{
+ GNUNET_free (cs->option);
+ GNUNET_free (cs->section);
+ GNUNET_free (cs->value);
+}
+
+
+const struct GNUNET_OS_ProjectData *
+GNUNET_CONFIGURATION_get_project_data (
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+ return cfg->pd;
+}
+
+
/* end of configuration.c */
diff --git a/src/lib/util/configuration_helper.c
b/src/lib/util/configuration_helper.c
deleted file mode 100644
index d1836f106..000000000
--- a/src/lib/util/configuration_helper.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2006, 2007, 2008, 2009, 2013, 2020, 2021 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file src/util/configuration_helper.c
- * @brief helper logic for gnunet-config
- * @author Christian Grothoff
- */
-
-#include "platform.h"
-#include "gnunet_util_lib.h"
-
-/**
- * Print each option in a given section as a filename.
- *
- * @param cls closure
- * @param section name of the section
- * @param option name of the option
- * @param value value of the option
- */
-static void
-print_filename_option (void *cls,
- const char *section,
- const char *option,
- const char *value)
-{
- const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
-
- char *value_fn;
- char *fn;
-
- GNUNET_assert (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_filename (cfg,
- section,
- option,
- &value_fn));
- fn = GNUNET_STRINGS_filename_expand (value_fn);
- if (NULL == fn)
- fn = value_fn;
- else
- GNUNET_free (value_fn);
- fprintf (stdout,
- "%s = %s\n",
- option,
- fn);
- GNUNET_free (fn);
-}
-
-
-/**
- * Print each option in a given section.
- *
- * @param cls closure
- * @param section name of the section
- * @param option name of the option
- * @param value value of the option
- */
-static void
-print_option (void *cls,
- const char *section,
- const char *option,
- const char *value)
-{
- (void) cls;
- (void) section;
-
- fprintf (stdout,
- "%s = %s\n",
- option,
- value);
-}
-
-
-/**
- * Print out given section name.
- *
- * @param cls unused
- * @param section a section in the configuration file
- */
-static void
-print_section_name (void *cls,
- const char *section)
-{
- (void) cls;
- fprintf (stdout,
- "%s\n",
- section);
-}
-
-
-void
-GNUNET_CONFIGURATION_config_tool_run (
- void *cls,
- char *const *args,
- const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls;
- struct GNUNET_CONFIGURATION_Handle *out = NULL;
- struct GNUNET_CONFIGURATION_Handle *ncfg = NULL;
-
- (void) args;
- if (cs->diagnostics)
- {
- /* Re-parse the configuration with diagnostics enabled. */
- ncfg = GNUNET_CONFIGURATION_create ();
- GNUNET_CONFIGURATION_enable_diagnostics (ncfg);
- if (GNUNET_OK != GNUNET_CONFIGURATION_load (ncfg,
- cfgfile))
- {
- fprintf (stderr,
- _("Failed to load config file `%s'"), cfgfile);
- return;
- }
- cfg = ncfg;
- }
-
- if (cs->full)
- cs->rewrite = GNUNET_YES;
- if (cs->list_sections)
- {
- fprintf (stderr,
- _ ("The following sections are available:\n"));
- GNUNET_CONFIGURATION_iterate_sections (cfg,
- &print_section_name,
- NULL);
- return;
- }
- if ( (! cs->rewrite) &&
- (NULL == cs->section) )
- {
- char *serialization;
-
- if (! cs->diagnostics)
- {
- fprintf (stderr,
- _ ("%s, %s or %s argument is required\n"),
- "--section",
- "--list-sections",
- "--diagnostics");
- cs->global_ret = EXIT_INVALIDARGUMENT;
- return;
- }
- serialization = GNUNET_CONFIGURATION_serialize_diagnostics (cfg);
- fprintf (stdout,
- "%s",
- serialization);
- GNUNET_free (serialization);
- }
- else if ( (NULL != cs->section) &&
- (NULL == cs->value) )
- {
- if (NULL == cs->option)
- {
- GNUNET_CONFIGURATION_iterate_section_values (
- cfg,
- cs->section,
- cs->is_filename
- ? &print_filename_option
- : &print_option,
- (void *) cfg);
- }
- else
- {
- char *value;
-
- if (cs->is_filename)
- {
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_filename (cfg,
- cs->section,
- cs->option,
- &value))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- cs->section,
- cs->option);
- cs->global_ret = EXIT_NOTCONFIGURED;
- return;
- }
- }
- else
- {
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
- cs->section,
- cs->option,
- &value))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- cs->section,
- cs->option);
- cs->global_ret = EXIT_NOTCONFIGURED;
- return;
- }
- }
- fprintf (stdout,
- "%s\n",
- value);
- GNUNET_free (value);
- }
- }
- else if (NULL != cs->section)
- {
- if (NULL == cs->option)
- {
- fprintf (stderr,
- _ ("--option argument required to set value\n"));
- cs->global_ret = EXIT_INVALIDARGUMENT;
- return;
- }
- out = GNUNET_CONFIGURATION_dup (cfg);
- GNUNET_CONFIGURATION_set_value_string (out,
- cs->section,
- cs->option,
- cs->value);
- cs->rewrite = GNUNET_YES;
- }
- if (cs->rewrite)
- {
- char *cfg_fn = NULL;
-
- if (NULL == out)
- out = GNUNET_CONFIGURATION_dup (cfg);
-
- if (NULL == cfgfile)
- {
- const char *xdg = getenv ("XDG_CONFIG_HOME");
-
- if (NULL != xdg)
- GNUNET_asprintf (&cfg_fn,
- "%s%s%s",
- xdg,
- DIR_SEPARATOR_STR,
- GNUNET_OS_project_data_get ()->config_file);
- else
- cfg_fn = GNUNET_strdup (
- GNUNET_OS_project_data_get ()->user_config_file);
- cfgfile = cfg_fn;
- }
-
- if (! cs->full)
- {
- struct GNUNET_CONFIGURATION_Handle *def;
-
- def = GNUNET_CONFIGURATION_create ();
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_load (def,
- NULL))
- {
- fprintf (stderr,
- _ ("failed to load configuration defaults"));
- cs->global_ret = 1;
- GNUNET_CONFIGURATION_destroy (def);
- GNUNET_CONFIGURATION_destroy (out);
- GNUNET_free (cfg_fn);
- return;
- }
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_write_diffs (def,
- out,
- cfgfile))
- cs->global_ret = 2;
- GNUNET_CONFIGURATION_destroy (def);
- }
- else
- {
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_write (out,
- cfgfile))
- cs->global_ret = 2;
- }
- GNUNET_free (cfg_fn);
- }
- if (NULL != out)
- GNUNET_CONFIGURATION_destroy (out);
- if (NULL != ncfg)
- GNUNET_CONFIGURATION_destroy (ncfg);
-}
-
-
-void
-GNUNET_CONFIGURATION_config_settings_free (
- struct GNUNET_CONFIGURATION_ConfigSettings *cs)
-{
- GNUNET_free (cs->option);
- GNUNET_free (cs->section);
- GNUNET_free (cs->value);
-}
-
-
-/* end of configuration_helper.c */
diff --git a/src/lib/util/disk.c b/src/lib/util/disk.c
index e0ea28c7f..558003a25 100644
--- a/src/lib/util/disk.c
+++ b/src/lib/util/disk.c
@@ -374,7 +374,7 @@ GNUNET_DISK_file_backup (const char *fil)
{
GNUNET_snprintf (target, slen, "%s.%u~", fil, num++);
fd = open (target, O_CREAT | O_EXCL,
- translate_unix_perms(GNUNET_DISK_PERM_USER_WRITE));
+ translate_unix_perms (GNUNET_DISK_PERM_USER_WRITE));
} while (-1 == fd);
if (0 != renameat2 (AT_FDCWD, fil, AT_FDCWD, target, RENAME_EXCHANGE))
{
@@ -399,6 +399,7 @@ GNUNET_DISK_file_backup (const char *fil)
return target;
}
+
char *
GNUNET_DISK_mktemp (const char *t)
{
@@ -687,8 +688,9 @@ GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle
*h,
errno = EINVAL;
return GNUNET_SYSERR;
}
-
- return write (h->fd, buffer, n);
+ return write (h->fd,
+ buffer,
+ n);
}
@@ -1639,14 +1641,22 @@ purge_cfg_dir (void *cls,
char *tmpname;
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_filename (cfg, "PATHS", option, &tmpname))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "PATHS", option);
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ "PATHS",
+ option,
+ &tmpname))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "PATHS",
+ option);
return GNUNET_NO;
}
- if (GNUNET_SYSERR == GNUNET_DISK_directory_remove (tmpname))
+ if (GNUNET_SYSERR ==
+ GNUNET_DISK_directory_remove (tmpname))
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "remove", tmpname);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
+ "remove",
+ tmpname);
GNUNET_free (tmpname);
return GNUNET_OK;
}
@@ -1656,11 +1666,13 @@ purge_cfg_dir (void *cls,
void
-GNUNET_DISK_purge_cfg_dir (const char *cfg_filename,
+GNUNET_DISK_purge_cfg_dir (const struct GNUNET_OS_ProjectData *pd,
+ const char *cfg_filename,
const char *option)
{
GNUNET_break (GNUNET_OK ==
- GNUNET_CONFIGURATION_parse_and_run (cfg_filename,
+ GNUNET_CONFIGURATION_parse_and_run (pd,
+ cfg_filename,
&purge_cfg_dir,
(void *) option));
}
diff --git a/src/lib/util/getopt_helpers.c b/src/lib/util/getopt_helpers.c
index 31020f185..12ec9a35d 100644
--- a/src/lib/util/getopt_helpers.c
+++ b/src/lib/util/getopt_helpers.c
@@ -49,7 +49,9 @@ print_version (struct
GNUNET_GETOPT_CommandLineProcessorContext *ctx,
(void) option;
(void) value;
- printf ("%s v%s\n", ctx->binaryName, version);
+ printf ("%s v%s\n",
+ ctx->binaryName,
+ version);
return GNUNET_NO;
}
@@ -91,7 +93,8 @@ format_help (struct GNUNET_GETOPT_CommandLineProcessorContext
*ctx,
const char *option,
const char *value)
{
- const char *about = scls;
+ const struct GNUNET_OS_ProjectData *pd = scls;
+ const char *about = NULL;
size_t slen;
unsigned int i;
int j;
@@ -100,19 +103,25 @@ format_help (struct
GNUNET_GETOPT_CommandLineProcessorContext *ctx,
char *scp;
const char *trans;
const struct GNUNET_GETOPT_CommandLineOption *opt;
- const struct GNUNET_OS_ProjectData *pd;
(void) option;
(void) value;
+ opt = ctx->allOptions;
+ for (i=0; NULL != opt[i].description; i++)
+ {
+ /* we hacked the about argument into our own argumentHelp! */
+ if ('h' == opt[i].shortName)
+ about = opt[i].argumentHelp;
+ }
if (NULL != about)
{
- printf ("%s\n%s\n", ctx->binaryOptions, gettext (about));
+ printf ("%s\n%s\n",
+ ctx->binaryOptions,
+ gettext (about));
printf (_ (
"Arguments mandatory for long options are also mandatory for
short options.\n"));
}
- i = 0;
- opt = ctx->allOptions;
- while (NULL != opt[i].description)
+ for (i=0; NULL != opt[i].description; i++)
{
if (opt[i].shortName == '\0')
printf (" ");
@@ -120,7 +129,8 @@ format_help (struct
GNUNET_GETOPT_CommandLineProcessorContext *ctx,
printf (" -%c, ", opt[i].shortName);
printf ("--%s", opt[i].name);
slen = 8 + strlen (opt[i].name);
- if (NULL != opt[i].argumentHelp)
+ if ( (NULL != opt[i].argumentHelp) &&
+ ('h' != opt[i].shortName) )
{
printf ("=%s", opt[i].argumentHelp);
slen += 1 + strlen (opt[i].argumentHelp);
@@ -172,9 +182,7 @@ OUTER:
printf ("%s\n", &trans[p]);
if (strlen (trans) == 0)
printf ("\n");
- i++;
}
- pd = GNUNET_OS_project_data_get ();
printf ("\n"
"Report bugs to %s.\n"
"Home page: %s\n",
@@ -189,16 +197,18 @@ OUTER:
struct GNUNET_GETOPT_CommandLineOption
-GNUNET_GETOPT_option_help (const char *about)
+GNUNET_GETOPT_option_help (const struct GNUNET_OS_ProjectData *pd,
+ const char *about)
{
struct GNUNET_GETOPT_CommandLineOption clo = {
.shortName = 'h',
.name = "help",
+ .argumentHelp = about,
.description = gettext_noop (
"print this help"),
.option_exclusive = 1,
- .processor = format_help,
- .scls = (void *) about
+ .processor = &format_help,
+ .scls = (void *) pd,
};
return clo;
@@ -951,7 +961,8 @@ set_base32 (struct
GNUNET_GETOPT_CommandLineProcessorContext *ctx,
fprintf (
stderr,
_ (
- "Argument `%s' malformed. Expected base32 (Crockford) encoded
value.\n"),
+ "Argument `%s' malformed. Expected base32 (Crockford) encoded
value.\n")
+ ,
option);
return GNUNET_SYSERR;
}
diff --git a/src/lib/util/helper.c b/src/lib/util/helper.c
index 87ea749e9..b66f5fe3f 100644
--- a/src/lib/util/helper.c
+++ b/src/lib/util/helper.c
@@ -457,7 +457,8 @@ restart_task (void *cls)
struct GNUNET_HELPER_Handle *
-GNUNET_HELPER_start (int with_control_pipe,
+GNUNET_HELPER_start (const struct GNUNET_OS_ProjectData *pd,
+ int with_control_pipe,
const char *binary_name,
char *const binary_argv[],
GNUNET_MessageTokenizerCallback cb,
@@ -471,7 +472,8 @@ GNUNET_HELPER_start (int with_control_pipe,
h->with_control_pipe = with_control_pipe;
/* Lookup in libexec path only if we are starting gnunet helpers */
if (NULL != strstr (binary_name, "gnunet"))
- h->binary_name = GNUNET_OS_get_libexec_binary_path (binary_name);
+ h->binary_name = GNUNET_OS_get_libexec_binary_path (pd,
+ binary_name);
else
h->binary_name = GNUNET_strdup (binary_name);
for (c = 0; NULL != binary_argv[c]; c++)
diff --git a/src/lib/util/os_installation.c b/src/lib/util/os_installation.c
index ff04a8a7f..3e9ac5f3e 100644
--- a/src/lib/util/os_installation.c
+++ b/src/lib/util/os_installation.c
@@ -44,13 +44,13 @@
#define LOG(kind, ...) \
- GNUNET_log_from (kind, "util-os-installation", __VA_ARGS__)
+ GNUNET_log_from (kind, "util-os-installation", __VA_ARGS__)
#define LOG_STRERROR_FILE(kind, syscall, filename) \
- GNUNET_log_from_strerror_file (kind, \
- "util-os-installation", \
- syscall, \
- filename)
+ GNUNET_log_from_strerror_file (kind, \
+ "util-os-installation", \
+ syscall, \
+ filename)
/**
@@ -74,65 +74,29 @@ static const struct GNUNET_OS_ProjectData default_pd = {
.agpl_url = GNUNET_AGPL_URL,
};
-/**
- * Which project data do we currently use for installation
- * path detection? Never NULL.
- */
-static const struct GNUNET_OS_ProjectData *current_pd = &default_pd;
-
-/**
- * PD for which gettext has been initialized last.
- * Note that the gettext initialization done within
- * GNUNET_PROGRAM_run2 is for the specific application.
- */
-static const struct GNUNET_OS_ProjectData *gettextinit;
-
/**
* Return default project data used by 'libgnunetutil' for GNUnet.
*/
const struct GNUNET_OS_ProjectData *
-GNUNET_OS_project_data_default (void)
+GNUNET_OS_project_data_gnunet (void)
{
return &default_pd;
}
-/**
- * @return current project data.
- */
-const struct GNUNET_OS_ProjectData *
-GNUNET_OS_project_data_get ()
-{
- if (current_pd != gettextinit)
- {
- char *path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR);
-
- if (NULL != path)
- bindtextdomain (PACKAGE,
- path);
- GNUNET_free (path);
- gettextinit = current_pd;
- }
- return current_pd;
-}
-
-
void
-GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd)
+GNUNET_OS_init (const char *package_name,
+ const struct GNUNET_OS_ProjectData *pd)
{
- GNUNET_assert (NULL != pd);
- current_pd = pd;
- if (pd != gettextinit)
- {
- char *path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR);
+ char *path;
- if (NULL != path)
- bindtextdomain (PACKAGE,
- path);
- GNUNET_free (path);
- gettextinit = pd;
- }
+ path = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LOCALEDIR);
+ if (NULL != path)
+ bindtextdomain (package_name,
+ path);
+ GNUNET_free (path);
}
@@ -140,10 +104,11 @@ GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd)
/**
* Try to determine path by reading /proc/PID/exe
*
+ * @param pd project data to use to determine paths
* @return NULL on error
*/
static char *
-get_path_from_proc_maps (void)
+get_path_from_proc_maps (const struct GNUNET_OS_ProjectData *pd)
{
char fn[64];
char line[1024];
@@ -151,7 +116,7 @@ get_path_from_proc_maps (void)
FILE *f;
char *lgu;
- if (NULL == current_pd->libname)
+ if (NULL == pd->libname)
return NULL;
GNUNET_snprintf (fn,
sizeof(fn),
@@ -165,7 +130,7 @@ get_path_from_proc_maps (void)
"%*p-%*p %*c%*c%*c%*c %*x %*x:%*x %*u%*[ ]%1023s",
dir)) &&
(NULL != (lgu = strstr (dir,
- current_pd->libname))))
+ pd->libname))))
{
lgu[0] = '\0';
fclose (f);
@@ -180,31 +145,42 @@ get_path_from_proc_maps (void)
/**
* Try to determine path by reading /proc/PID/exe
*
+ * @param pd project data to use to determine paths
* @return NULL on error
*/
static char *
-get_path_from_proc_exe (void)
+get_path_from_proc_exe (const struct GNUNET_OS_ProjectData *pd)
{
char fn[64];
char lnk[1024];
ssize_t size;
char *lep;
- GNUNET_snprintf (fn, sizeof(fn), "/proc/%u/exe", getpid ());
- size = readlink (fn, lnk, sizeof(lnk) - 1);
+ GNUNET_snprintf (fn,
+ sizeof(fn),
+ "/proc/%u/exe",
+ getpid ());
+ size = readlink (fn,
+ lnk,
+ sizeof(lnk) - 1);
if (size <= 0)
{
- LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "readlink", fn);
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR,
+ "readlink",
+ fn);
return NULL;
}
GNUNET_assert (((size_t) size) < sizeof(lnk));
lnk[size] = '\0';
while ((lnk[size] != '/') && (size > 0))
size--;
- GNUNET_asprintf (&lep, "/%s/libexec/", current_pd->project_dirname);
+ GNUNET_asprintf (&lep,
+ "/%s/libexec/",
+ pd->project_dirname);
/* test for being in lib/gnunet/libexec/ or lib/MULTIARCH/gnunet/libexec */
if ((((size_t) size) > strlen (lep)) &&
- (0 == strcmp (lep, &lnk[size - strlen (lep)])))
+ (0 == strcmp (lep,
+ &lnk[size - strlen (lep)])))
size -= strlen (lep) - 1;
GNUNET_free (lep);
if ((size < 4) || (lnk[size - 4] != '/'))
@@ -228,7 +204,8 @@ get_path_from_proc_exe (void)
* @param number of bytes available in @a buf
* @return 0 on success, otherwise desired number of bytes is stored in
'bufsize'
*/
-typedef int (*MyNSGetExecutablePathProto) (char *buf, size_t *bufsize);
+typedef int (*MyNSGetExecutablePathProto) (char *buf,
+ size_t *bufsize);
/**
@@ -327,14 +304,18 @@ get_path_from_PATH (const char *binary)
return NULL;
path = GNUNET_strdup (p); /* because we write on it */
-
buf = GNUNET_malloc (strlen (path) + strlen (binary) + 1 + 1);
pos = path;
- while (NULL != (end = strchr (pos, PATH_SEPARATOR)))
+ while (NULL != (end = strchr (pos,
+ PATH_SEPARATOR)))
{
*end = '\0';
- sprintf (buf, "%s/%s", pos, binary);
- if (GNUNET_DISK_file_test (buf) == GNUNET_YES)
+ sprintf (buf,
+ "%s/%s",
+ pos,
+ binary);
+ if (GNUNET_YES ==
+ GNUNET_DISK_file_test (buf))
{
pos = GNUNET_strdup (pos);
GNUNET_free (buf);
@@ -343,8 +324,12 @@ get_path_from_PATH (const char *binary)
}
pos = end + 1;
}
- sprintf (buf, "%s/%s", pos, binary);
- if (GNUNET_YES == GNUNET_DISK_file_test (buf))
+ sprintf (buf,
+ "%s/%s",
+ pos,
+ binary);
+ if (GNUNET_YES ==
+ GNUNET_DISK_file_test (buf))
{
pos = GNUNET_strdup (pos);
GNUNET_free (buf);
@@ -361,18 +346,19 @@ get_path_from_PATH (const char *binary)
* Try to obtain the installation path using the "GNUNET_PREFIX" environment
* variable.
*
+ * @param pd project data to use to determine paths
* @return NULL on error (environment variable not set)
*/
static char *
-get_path_from_GNUNET_PREFIX (void)
+get_path_from_GNUNET_PREFIX (const struct GNUNET_OS_ProjectData *pd)
{
const char *p;
- if ((NULL != current_pd->env_varname) &&
- (NULL != (p = getenv (current_pd->env_varname))))
+ if ((NULL != pd->env_varname) &&
+ (NULL != (p = getenv (pd->env_varname))))
return GNUNET_strdup (p);
- if ((NULL != current_pd->env_varname_alt) &&
- (NULL != (p = getenv (current_pd->env_varname_alt))))
+ if ((NULL != pd->env_varname_alt) &&
+ (NULL != (p = getenv (pd->env_varname_alt))))
return GNUNET_strdup (p);
return NULL;
}
@@ -382,23 +368,24 @@ get_path_from_GNUNET_PREFIX (void)
* @brief get the path to GNUnet bin/ or lib/, preferring the lib/ path
* @author Milan
*
+ * @param pd project data to use to determine paths
* @return a pointer to the executable path, or NULL on error
*/
static char *
-os_get_gnunet_path (void)
+os_get_gnunet_path (const struct GNUNET_OS_ProjectData *pd)
{
char *ret;
- if (NULL != (ret = get_path_from_GNUNET_PREFIX ()))
+ if (NULL != (ret = get_path_from_GNUNET_PREFIX (pd)))
return ret;
#ifdef __linux__
- if (NULL != (ret = get_path_from_proc_maps ()))
+ if (NULL != (ret = get_path_from_proc_maps (pd)))
return ret;
/* try path *first*, before /proc/exe, as /proc/exe can be wrong */
- if ((NULL != current_pd->binary_name) &&
- (NULL != (ret = get_path_from_PATH (current_pd->binary_name))))
+ if ((NULL != pd->binary_name) &&
+ (NULL != (ret = get_path_from_PATH (pd->binary_name))))
return ret;
- if (NULL != (ret = get_path_from_proc_exe ()))
+ if (NULL != (ret = get_path_from_proc_exe (pd)))
return ret;
#endif
#if DARWIN
@@ -407,30 +394,31 @@ os_get_gnunet_path (void)
if (NULL != (ret = get_path_from_NSGetExecutablePath ()))
return ret;
#endif
- if ((NULL != current_pd->binary_name) &&
- (NULL != (ret = get_path_from_PATH (current_pd->binary_name))))
+ if ((NULL != pd->binary_name) &&
+ (NULL != (ret = get_path_from_PATH (pd->binary_name))))
return ret;
/* other attempts here */
LOG (GNUNET_ERROR_TYPE_ERROR,
- _ (
- "Could not determine installation path for %s. Set `%s' environment
variable.\n"),
- current_pd->project_dirname,
- current_pd->env_varname);
+ "Could not determine installation path for %s. Set `%s' environment
variable.\n",
+ pd->project_dirname,
+ pd->env_varname);
return NULL;
}
/**
* @brief get the path to current app's bin/
+ *
+ * @param pd project data to use to determine paths
* @return a pointer to the executable path, or NULL on error
*/
static char *
-os_get_exec_path ()
+os_get_exec_path (const struct GNUNET_OS_ProjectData *pd)
{
char *ret = NULL;
#ifdef __linux__
- if (NULL != (ret = get_path_from_proc_exe ()))
+ if (NULL != (ret = get_path_from_proc_exe (pd)))
return ret;
#endif
#if DARWIN
@@ -442,13 +430,9 @@ os_get_exec_path ()
}
-/**
- * @brief get the path to a specific GNUnet installation directory or,
- * with #GNUNET_OS_IPK_SELF_PREFIX, the current running apps installation
directory
- * @return a pointer to the dir path (to be freed by the caller)
- */
char *
-GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind)
+GNUNET_OS_installation_get_path (const struct GNUNET_OS_ProjectData *pd,
+ enum GNUNET_OS_InstallationPathKind dirkind)
{
size_t n;
char *dirname;
@@ -460,12 +444,12 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
/* if wanted, try to get the current app's bin/ */
if (dirkind == GNUNET_OS_IPK_SELF_PREFIX)
- execpath = os_get_exec_path ();
+ execpath = os_get_exec_path (pd);
/* try to get GNUnet's bin/ or lib/, or if previous was unsuccessful some
* guess for the current app */
if (NULL == execpath)
- execpath = os_get_gnunet_path ();
+ execpath = os_get_gnunet_path (pd);
if (NULL == execpath)
return NULL;
@@ -538,7 +522,7 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
(NULL != multiarch) ? DIR_SEPARATOR_STR : "",
(NULL != multiarch) ? multiarch : "",
DIR_SEPARATOR_STR,
- current_pd->project_dirname,
+ pd->project_dirname,
DIR_SEPARATOR_STR);
if (GNUNET_YES == GNUNET_DISK_directory_test (tmp, GNUNET_YES))
{
@@ -553,20 +537,28 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
GNUNET_asprintf (&dirname,
DIR_SEPARATOR_STR "lib32" DIR_SEPARATOR_STR
"%s" DIR_SEPARATOR_STR,
- current_pd->project_dirname);
- GNUNET_asprintf (&tmp, "%s%s", execpath, dirname);
+ pd->project_dirname);
+ GNUNET_asprintf (&tmp,
+ "%s%s",
+ execpath,
+ dirname);
}
if (8 == sizeof(void *))
{
GNUNET_asprintf (&dirname,
DIR_SEPARATOR_STR "lib64" DIR_SEPARATOR_STR
"%s" DIR_SEPARATOR_STR,
- current_pd->project_dirname);
- GNUNET_asprintf (&tmp, "%s%s", execpath, dirname);
+ pd->project_dirname);
+ GNUNET_asprintf (&tmp,
+ "%s%s",
+ execpath,
+ dirname);
}
if ((NULL != tmp) &&
- (GNUNET_YES == GNUNET_DISK_directory_test (tmp, GNUNET_YES)))
+ (GNUNET_YES ==
+ GNUNET_DISK_directory_test (tmp,
+ GNUNET_YES)))
{
GNUNET_free (execpath);
GNUNET_free (dirname);
@@ -577,14 +569,14 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
}
GNUNET_asprintf (&dirname,
DIR_SEPARATOR_STR "%s" DIR_SEPARATOR_STR,
- current_pd->project_dirname);
+ pd->project_dirname);
break;
case GNUNET_OS_IPK_DATADIR:
GNUNET_asprintf (&dirname,
DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR
"%s" DIR_SEPARATOR_STR,
- current_pd->project_dirname);
+ pd->project_dirname);
break;
case GNUNET_OS_IPK_LOCALEDIR:
@@ -602,7 +594,7 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR
"doc" DIR_SEPARATOR_STR
"%s" DIR_SEPARATOR_STR,
- current_pd->project_dirname);
+ pd->project_dirname);
break;
case GNUNET_OS_IPK_LIBEXECDIR:
@@ -611,7 +603,7 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
GNUNET_asprintf (&dirname,
DIR_SEPARATOR_STR "%s" DIR_SEPARATOR_STR
"libexec" DIR_SEPARATOR_STR,
- current_pd->project_dirname);
+ pd->project_dirname);
GNUNET_asprintf (&tmp,
"%s%s%s%s",
execpath,
@@ -619,7 +611,9 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
(NULL != multiarch) ? multiarch : "",
dirname);
GNUNET_free (dirname);
- if (GNUNET_YES == GNUNET_DISK_directory_test (tmp, GNUNET_YES))
+ if (GNUNET_YES ==
+ GNUNET_DISK_directory_test (tmp,
+ true))
{
GNUNET_free (execpath);
return tmp;
@@ -633,8 +627,11 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
DIR_SEPARATOR_STR "lib32" DIR_SEPARATOR_STR
"%s" DIR_SEPARATOR_STR
"libexec" DIR_SEPARATOR_STR,
- current_pd->project_dirname);
- GNUNET_asprintf (&tmp, "%s%s", execpath, dirname);
+ pd->project_dirname);
+ GNUNET_asprintf (&tmp,
+ "%s%s",
+ execpath,
+ dirname);
}
if (8 == sizeof(void *))
{
@@ -642,11 +639,16 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
DIR_SEPARATOR_STR "lib64" DIR_SEPARATOR_STR
"%s" DIR_SEPARATOR_STR
"libexec" DIR_SEPARATOR_STR,
- current_pd->project_dirname);
- GNUNET_asprintf (&tmp, "%s%s", execpath, dirname);
+ pd->project_dirname);
+ GNUNET_asprintf (&tmp,
+ "%s%s",
+ execpath,
+ dirname);
}
if ((NULL != tmp) &&
- (GNUNET_YES == GNUNET_DISK_directory_test (tmp, GNUNET_YES)))
+ (GNUNET_YES ==
+ GNUNET_DISK_directory_test (tmp,
+ true)))
{
GNUNET_free (execpath);
GNUNET_free (dirname);
@@ -658,30 +660,26 @@ GNUNET_OS_installation_get_path (enum
GNUNET_OS_InstallationPathKind dirkind)
GNUNET_asprintf (&dirname,
DIR_SEPARATOR_STR "%s" DIR_SEPARATOR_STR
"libexec" DIR_SEPARATOR_STR,
- current_pd->project_dirname);
+ pd->project_dirname);
break;
default:
GNUNET_free (execpath);
return NULL;
}
- GNUNET_asprintf (&tmp, "%s%s", execpath, dirname);
+ GNUNET_asprintf (&tmp,
+ "%s%s",
+ execpath,
+ dirname);
GNUNET_free (dirname);
GNUNET_free (execpath);
return tmp;
}
-/**
- * Given the name of a gnunet-helper, gnunet-service or gnunet-daemon
- * binary, try to prefix it with the libexec/-directory to get the
- * full path.
- *
- * @param progname name of the binary
- * @return full path to the binary, if possible, otherwise copy of 'progname'
- */
char *
-GNUNET_OS_get_libexec_binary_path (const char *progname)
+GNUNET_OS_get_libexec_binary_path (const struct GNUNET_OS_ProjectData *pd,
+ const char *progname)
{
static char *cache;
char *libexecdir;
@@ -689,34 +687,30 @@ GNUNET_OS_get_libexec_binary_path (const char *progname)
if ((DIR_SEPARATOR == progname[0]) ||
(GNUNET_YES ==
- GNUNET_STRINGS_path_is_absolute (progname, GNUNET_NO, NULL, NULL)))
+ GNUNET_STRINGS_path_is_absolute (progname,
+ GNUNET_NO,
+ NULL,
+ NULL)))
return GNUNET_strdup (progname);
if (NULL != cache)
libexecdir = cache;
else
- libexecdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBEXECDIR);
+ libexecdir = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LIBEXECDIR);
if (NULL == libexecdir)
return GNUNET_strdup (progname);
- GNUNET_asprintf (&binary, "%s%s", libexecdir, progname);
+ GNUNET_asprintf (&binary,
+ "%s%s",
+ libexecdir,
+ progname);
cache = libexecdir;
return binary;
}
-/**
- * Given the name of a helper, service or daemon binary construct the full
- * path to the binary using the SUID_BINARY_PATH in the PATHS section of the
- * configuration. If that option is not present, fall back to
- * GNUNET_OS_get_libexec_binary_path. If @a progname is an absolute path, a
- * copy of this path is returned.
- *
- * @param cfg configuration to inspect
- * @param progname name of the binary
- * @return full path to the binary, if possible, a copy of @a progname
- * otherwise
- */
char *
-GNUNET_OS_get_suid_binary_path (const struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_OS_get_suid_binary_path (const struct GNUNET_OS_ProjectData *pd,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *progname)
{
static char *cache;
@@ -725,7 +719,10 @@ GNUNET_OS_get_suid_binary_path (const struct
GNUNET_CONFIGURATION_Handle *cfg,
size_t path_len;
if (GNUNET_YES ==
- GNUNET_STRINGS_path_is_absolute (progname, GNUNET_NO, NULL, NULL))
+ GNUNET_STRINGS_path_is_absolute (progname,
+ GNUNET_NO,
+ NULL,
+ NULL))
{
return GNUNET_strdup (progname);
}
@@ -736,12 +733,14 @@ GNUNET_OS_get_suid_binary_path (const struct
GNUNET_CONFIGURATION_Handle *cfg,
"PATHS",
"SUID_BINARY_PATH",
&path);
- if ((NULL == path) || (0 == strlen (path)))
+ if ( (NULL == path) ||
+ (0 == strlen (path)) )
{
if (NULL != path)
GNUNET_free (path);
cache = NULL;
- return GNUNET_OS_get_libexec_binary_path (progname);
+ return GNUNET_OS_get_libexec_binary_path (pd,
+ progname);
}
path_len = strlen (path);
GNUNET_asprintf (&binary,
@@ -764,9 +763,12 @@ GNUNET_OS_check_helper_binary (const char *binary,
char *p;
char *pf;
- if ((GNUNET_YES ==
- GNUNET_STRINGS_path_is_absolute (binary, GNUNET_NO, NULL, NULL)) ||
- (0 == strncmp (binary, "./", 2)))
+ if ( (GNUNET_YES ==
+ GNUNET_STRINGS_path_is_absolute (binary,
+ GNUNET_NO,
+ NULL,
+ NULL)) ||
+ (0 == strncmp (binary, "./", 2)) )
{
p = GNUNET_strdup (binary);
}
@@ -775,7 +777,10 @@ GNUNET_OS_check_helper_binary (const char *binary,
p = get_path_from_PATH (binary);
if (NULL != p)
{
- GNUNET_asprintf (&pf, "%s/%s", p, binary);
+ GNUNET_asprintf (&pf,
+ "%s/%s",
+ p,
+ binary);
GNUNET_free (p);
p = pf;
}
@@ -788,9 +793,12 @@ GNUNET_OS_check_helper_binary (const char *binary,
binary);
return GNUNET_SYSERR;
}
- if (0 != access (p, X_OK))
+ if (0 != access (p,
+ X_OK))
{
- LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", p);
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING,
+ "access",
+ p);
GNUNET_free (p);
return GNUNET_SYSERR;
}
@@ -802,16 +810,20 @@ GNUNET_OS_check_helper_binary (const char *binary,
return GNUNET_YES;
}
- if (0 != stat (p, &statbuf))
+ if (0 != stat (p,
+ &statbuf))
{
- LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", p);
+ LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING,
+ "stat",
+ p);
GNUNET_free (p);
return GNUNET_SYSERR;
}
if (check_suid)
{
(void) params;
- if ((0 != (statbuf.st_mode & S_ISUID)) && (0 == statbuf.st_uid))
+ if ( (0 != (statbuf.st_mode & S_ISUID)) &&
+ (0 == statbuf.st_uid) )
{
GNUNET_free (p);
return GNUNET_YES;
diff --git a/src/lib/util/plugin.c b/src/lib/util/plugin.c
index 62c2a1df0..0bd8223b1 100644
--- a/src/lib/util/plugin.c
+++ b/src/lib/util/plugin.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- Copyright (C) 2002-2013 GNUnet e.V.
+ Copyright (C) 2002-2013, 2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -23,8 +23,6 @@
* @brief Methods to access plugins
* @author Christian Grothoff
*/
-
-
#include "platform.h"
#include <ltdl.h>
#include "gnunet_util_lib.h"
@@ -58,11 +56,6 @@ struct PluginList
*/
static int initialized;
-/**
- * Libtool search path before we started.
- */
-static char *old_dlsearchpath;
-
/**
* List of plugins we have loaded.
*/
@@ -76,9 +69,6 @@ static void
plugin_init (void)
{
int err;
- const char *opath;
- char *path;
- char *cpath;
err = lt_dlinit ();
if (err > 0)
@@ -88,28 +78,6 @@ plugin_init (void)
lt_dlerror ());
return;
}
- opath = lt_dlgetsearchpath ();
- if (NULL != opath)
- old_dlsearchpath = GNUNET_strdup (opath);
- path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR);
- if (NULL != path)
- {
- if (NULL != opath)
- {
- GNUNET_asprintf (&cpath,
- "%s:%s",
- opath,
- path);
- lt_dlsetsearchpath (cpath);
- GNUNET_free (path);
- GNUNET_free (cpath);
- }
- else
- {
- lt_dlsetsearchpath (path);
- GNUNET_free (path);
- }
- }
}
@@ -119,12 +87,6 @@ plugin_init (void)
static void
plugin_fini (void)
{
- lt_dlsetsearchpath (old_dlsearchpath);
- if (NULL != old_dlsearchpath)
- {
- GNUNET_free (old_dlsearchpath);
- old_dlsearchpath = NULL;
- }
if (NULL == getenv ("VALGRINDING_PLUGINS"))
lt_dlexit ();
}
@@ -164,8 +126,51 @@ resolve_function (struct PluginList *plug,
}
+/**
+ * Open library @a library_name using search path from @a pd.
+ *
+ * @param pd program data with paths
+ * @param library_name name of plugin to load
+ * @return NULL on error, otherwise library handle
+ */
+static void *
+open_library (const struct GNUNET_OS_ProjectData *pd,
+ const char *library_name)
+{
+ void *libhandle;
+ const char *opath;
+ char *path;
+ char *cpath;
+
+ opath = lt_dlgetsearchpath ();
+ path = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LIBDIR);
+ if (NULL != path)
+ {
+ if (NULL != opath)
+ {
+ GNUNET_asprintf (&cpath,
+ "%s:%s",
+ opath,
+ path);
+ lt_dlsetsearchpath (cpath);
+ GNUNET_free (cpath);
+ }
+ else
+ {
+ lt_dlsetsearchpath (path);
+ }
+ }
+ GNUNET_free (path);
+ libhandle = lt_dlopenext (library_name);
+ lt_dlsetsearchpath (opath);
+ return libhandle;
+}
+
+
enum GNUNET_GenericReturnValue
-GNUNET_PLUGIN_test (const char *library_name)
+GNUNET_PLUGIN_test (const struct GNUNET_OS_ProjectData *pd,
+ const char *library_name)
{
void *libhandle;
GNUNET_PLUGIN_Callback init;
@@ -176,9 +181,17 @@ GNUNET_PLUGIN_test (const char *library_name)
initialized = GNUNET_YES;
plugin_init ();
}
- libhandle = lt_dlopenext (library_name);
+ libhandle = open_library (pd,
+ library_name);
if (NULL == libhandle)
+ {
+ if (NULL == plugins)
+ {
+ plugin_fini ();
+ initialized = GNUNET_NO;
+ }
return GNUNET_NO;
+ }
plug.handle = libhandle;
plug.name = (char *) library_name;
init = resolve_function (&plug,
@@ -187,15 +200,26 @@ GNUNET_PLUGIN_test (const char *library_name)
{
GNUNET_break (0);
lt_dlclose (libhandle);
+ if (NULL == plugins)
+ {
+ plugin_fini ();
+ initialized = GNUNET_NO;
+ }
return GNUNET_NO;
}
lt_dlclose (libhandle);
+ if (NULL == plugins)
+ {
+ plugin_fini ();
+ initialized = GNUNET_NO;
+ }
return GNUNET_YES;
}
void *
-GNUNET_PLUGIN_load (const char *library_name,
+GNUNET_PLUGIN_load (const struct GNUNET_OS_ProjectData *pd,
+ const char *library_name,
void *arg)
{
void *libhandle;
@@ -208,7 +232,8 @@ GNUNET_PLUGIN_load (const char *library_name,
initialized = GNUNET_YES;
plugin_init ();
}
- libhandle = lt_dlopenext (library_name);
+ libhandle = open_library (pd,
+ library_name);
if (NULL == libhandle)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -216,6 +241,11 @@ GNUNET_PLUGIN_load (const char *library_name,
"lt_dlopenext",
library_name,
lt_dlerror ());
+ if (NULL == plugins)
+ {
+ plugin_fini ();
+ initialized = GNUNET_NO;
+ }
return NULL;
}
plug = GNUNET_new (struct PluginList);
@@ -232,6 +262,11 @@ GNUNET_PLUGIN_load (const char *library_name,
GNUNET_free (plug->name);
plugins = plug->next;
GNUNET_free (plug);
+ if (NULL == plugins)
+ {
+ plugin_fini ();
+ initialized = GNUNET_NO;
+ }
return NULL;
}
return ret;
@@ -286,6 +321,12 @@ GNUNET_PLUGIN_unload (const char *library_name,
*/
struct LoadAllContext
{
+
+ /**
+ * Project data to determine load paths.
+ */
+ const struct GNUNET_OS_ProjectData *pd;
+
/**
* Prefix the plugin names we find have to match.
*/
@@ -317,7 +358,7 @@ struct LoadAllContext
* @param filename name of a plugin library to check
* @return #GNUNET_OK (continue loading)
*/
-static int
+static enum GNUNET_GenericReturnValue
find_libraries (void *cls,
const char *filename)
{
@@ -344,7 +385,8 @@ find_libraries (void *cls,
basename = GNUNET_strdup (libname);
if (NULL != (dot = strstr (basename, ".")))
*dot = '\0';
- lib_ret = GNUNET_PLUGIN_load (basename,
+ lib_ret = GNUNET_PLUGIN_load (lac->pd,
+ basename,
lac->arg);
if (NULL != lib_ret)
lac->cb (lac->cb_cls,
@@ -356,25 +398,29 @@ find_libraries (void *cls,
void
-GNUNET_PLUGIN_load_all (const char *basename,
+GNUNET_PLUGIN_load_all (const struct GNUNET_OS_ProjectData *pd,
+ const char *basename,
void *arg,
GNUNET_PLUGIN_LoaderCallback cb,
void *cb_cls)
{
- struct LoadAllContext lac;
+ struct LoadAllContext lac = {
+ .pd = pd,
+ .basename = basename,
+ .arg = arg,
+ .cb = cb,
+ .cb_cls = cb_cls
+ };
char *path;
- path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR);
+ path = GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LIBDIR);
if (NULL == path)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_ ("Could not determine plugin installation path.\n"));
return;
}
- lac.basename = basename;
- lac.arg = arg;
- lac.cb = cb;
- lac.cb_cls = cb_cls;
GNUNET_DISK_directory_scan (path,
&find_libraries,
&lac);
@@ -382,22 +428,4 @@ GNUNET_PLUGIN_load_all (const char *basename,
}
-void
-GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx,
- const char *basename,
- void *arg,
- GNUNET_PLUGIN_LoaderCallback cb,
- void *cb_cls)
-{
- const struct GNUNET_OS_ProjectData *cpd = GNUNET_OS_project_data_get ();
-
- GNUNET_OS_init (ctx);
- GNUNET_PLUGIN_load_all (basename,
- arg,
- cb,
- cb_cls);
- GNUNET_OS_init (cpd);
-}
-
-
/* end of plugin.c */
diff --git a/src/lib/util/program.c b/src/lib/util/program.c
index 7616287c8..9c04eb1b9 100644
--- a/src/lib/util/program.c
+++ b/src/lib/util/program.c
@@ -129,7 +129,8 @@ cmd_sorter (const void *a1,
enum GNUNET_GenericReturnValue
-GNUNET_PROGRAM_run2 (int argc,
+GNUNET_PROGRAM_run2 (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
const char *binaryName,
const char *binaryHelp,
@@ -153,10 +154,10 @@ GNUNET_PROGRAM_run2 (int argc,
unsigned long long skew_variance;
long long clock_offset;
struct GNUNET_CONFIGURATION_Handle *cfg;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
const struct GNUNET_GETOPT_CommandLineOption defoptions[] = {
GNUNET_GETOPT_option_cfgfile (&cc.cfgfile),
- GNUNET_GETOPT_option_help (binaryHelp),
+ GNUNET_GETOPT_option_help (pd,
+ binaryHelp),
GNUNET_GETOPT_option_loglevel (&loglev),
GNUNET_GETOPT_option_logfile (&logfile),
GNUNET_GETOPT_option_version (pd->version)
@@ -185,9 +186,13 @@ GNUNET_PROGRAM_run2 (int argc,
for (char *tok = strtok (cargs, " ");
NULL != tok;
tok = strtok (NULL, " "))
- GNUNET_array_append (gargv, gargc, GNUNET_strdup (tok));
+ GNUNET_array_append (gargv,
+ gargc,
+ GNUNET_strdup (tok));
GNUNET_free (cargs);
- GNUNET_array_append (gargv, gargc, NULL);
+ GNUNET_array_append (gargv,
+ gargc,
+ NULL);
argv = (char *const *) gargv;
argc = gargc - 1;
}
@@ -195,18 +200,20 @@ GNUNET_PROGRAM_run2 (int argc,
loglev = NULL;
cc.task = task;
cc.task_cls = task_cls;
- cc.cfg = cfg = GNUNET_CONFIGURATION_create ();
+ cc.cfg = cfg = GNUNET_CONFIGURATION_create (pd);
/* prepare */
#if ENABLE_NLS
if (NULL != pd->gettext_domain)
{
setlocale (LC_ALL, "");
path = (NULL == pd->gettext_path)
- ? GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR)
- : GNUNET_strdup (pd->gettext_path);
+ ? GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LOCALEDIR)
+ : GNUNET_strdup (pd->gettext_path);
if (NULL != path)
{
- bindtextdomain (pd->gettext_domain, path);
+ bindtextdomain (pd->gettext_domain,
+ path);
GNUNET_free (path);
}
textdomain (pd->gettext_domain);
@@ -255,7 +262,7 @@ GNUNET_PROGRAM_run2 (int argc,
&cmd_sorter);
loglev = NULL;
if ((NULL != pd->config_file) && (NULL != pd->user_config_file))
- cfg_fn = GNUNET_CONFIGURATION_default_filename ();
+ cfg_fn = GNUNET_CONFIGURATION_default_filename (pd);
else
cfg_fn = NULL;
lpfx = GNUNET_strdup (binaryName);
@@ -397,7 +404,8 @@ cleanup:
enum GNUNET_GenericReturnValue
-GNUNET_PROGRAM_run (int argc,
+GNUNET_PROGRAM_run (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
const char *binaryName,
const char *binaryHelp,
@@ -405,7 +413,8 @@ GNUNET_PROGRAM_run (int argc,
GNUNET_PROGRAM_Main task,
void *task_cls)
{
- return GNUNET_PROGRAM_run2 (argc,
+ return GNUNET_PROGRAM_run2 (pd,
+ argc,
argv,
binaryName,
binaryHelp,
@@ -417,7 +426,8 @@ GNUNET_PROGRAM_run (int argc,
enum GNUNET_GenericReturnValue
-GNUNET_PROGRAM_conf_and_options (int argc,
+GNUNET_PROGRAM_conf_and_options (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
struct GNUNET_CONFIGURATION_Handle *cfg)
{
@@ -428,7 +438,6 @@ GNUNET_PROGRAM_conf_and_options (int argc,
const char *xdg;
int do_daemonize;
int ret;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
struct GNUNET_GETOPT_CommandLineOption service_options[] = {
GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename),
GNUNET_GETOPT_option_flag ('d',
@@ -436,7 +445,8 @@ GNUNET_PROGRAM_conf_and_options (int argc,
gettext_noop (
"do daemonize (detach from terminal)"),
&do_daemonize),
- GNUNET_GETOPT_option_help (NULL),
+ GNUNET_GETOPT_option_help (pd,
+ NULL),
GNUNET_GETOPT_option_loglevel (&loglev),
GNUNET_GETOPT_option_logfile (&logfile),
GNUNET_GETOPT_option_version (pd->version),
@@ -479,7 +489,7 @@ GNUNET_PROGRAM_conf_and_options (int argc,
}
if (NULL == cfg)
{
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (pd);
if (NULL != opt_cfg_filename)
{
if ( (GNUNET_YES !=
@@ -544,34 +554,49 @@ error:
}
+struct MonoContext
+{
+ const struct GNUNET_OS_ProjectData *pd;
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+};
+
static void
monolith_main (void *cls)
{
- struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+ struct MonoContext *mc = cls;
- GNUNET_SERVICE_main (0,
+ GNUNET_SERVICE_main (mc->pd,
+ 0,
NULL,
- cfg,
+ mc->cfg,
GNUNET_NO);
- GNUNET_DAEMON_main (0,
+ GNUNET_DAEMON_main (mc->pd,
+ 0,
NULL,
- cfg,
+ mc->cfg,
GNUNET_NO);
}
void
-GNUNET_PROGRAM_monolith_main (int argc,
+GNUNET_PROGRAM_monolith_main (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
struct GNUNET_CONFIGURATION_Handle *cfg)
{
+ struct MonoContext mc = {
+ .cfg = cfg,
+ .pd = pd
+ };
- if (GNUNET_YES != GNUNET_PROGRAM_conf_and_options (argc,
- argv,
- cfg))
+ if (GNUNET_YES !=
+ GNUNET_PROGRAM_conf_and_options (pd,
+ argc,
+ argv,
+ cfg))
return;
GNUNET_SCHEDULER_run (&monolith_main,
- cfg);
+ &mc);
}
@@ -630,7 +655,8 @@ launch_daemons (void *cls)
void
-GNUNET_DAEMON_main (int argc,
+GNUNET_DAEMON_main (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
struct GNUNET_CONFIGURATION_Handle *cfg,
enum GNUNET_GenericReturnValue with_scheduler)
@@ -639,9 +665,11 @@ GNUNET_DAEMON_main (int argc,
"Entering GNUNET_DAEMON_main\n");
if (GNUNET_YES == with_scheduler)
{
- if (GNUNET_YES != GNUNET_PROGRAM_conf_and_options (argc,
- argv,
- cfg))
+ if (GNUNET_YES !=
+ GNUNET_PROGRAM_conf_and_options (pd,
+ argc,
+ argv,
+ cfg))
return;
GNUNET_SCHEDULER_run (&launch_daemons,
cfg);
@@ -664,7 +692,9 @@ GNUNET_DAEMON_register (const char *daemon_name,
hle = GNUNET_new (struct DaemonHandleList);
hle->d = task;
hle->daemon_name = daemon_name;
- GNUNET_CONTAINER_DLL_insert (hll_head, hll_tail, hle);
+ GNUNET_CONTAINER_DLL_insert (hll_head,
+ hll_tail,
+ hle);
return GNUNET_OK;
}
diff --git a/src/lib/util/service.c b/src/lib/util/service.c
index ba678f2af..ebb09584f 100644
--- a/src/lib/util/service.c
+++ b/src/lib/util/service.c
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- Copyright (C) 2016 GNUnet e.V.
+ Copyright (C) 2016, 2024 GNUnet e.V.
GNUnet is free software: you can redistribute it and/or modify it
under the terms of the GNU Affero General Public License as published
@@ -119,6 +119,11 @@ struct GNUNET_SERVICE_Handle
*/
const struct GNUNET_CONFIGURATION_Handle *cfg;
+ /**
+ * Project data of this service.
+ */
+ const struct GNUNET_OS_ProjectData *pd;
+
/**
* Name of our service.
*/
@@ -174,7 +179,6 @@ struct GNUNET_SERVICE_Handle
*/
void *task_cls;
-
/**
* IPv4 addresses that are not allowed to connect.
*/
@@ -1464,11 +1468,13 @@ open_listen_socket (const struct sockaddr *server_addr,
* - REJECT_FROM (disallow allow connections from specified IPv4 subnets)
* - REJECT_FROM6 (disallow allow connections from specified IPv6 subnets)
*
+ * @param pd project data to use for the service
* @param sh service context to initialize
* @return #GNUNET_OK if configuration succeeded
*/
static enum GNUNET_GenericReturnValue
-setup_service (struct GNUNET_SERVICE_Handle *sh)
+setup_service (const struct GNUNET_OS_ProjectData *pd,
+ struct GNUNET_SERVICE_Handle *sh)
{
int tolerant;
struct GNUNET_NETWORK_Handle **csocks = NULL;
@@ -1852,27 +1858,30 @@ return_agpl (void *cls,
const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_SERVICE_Client *client = cls;
+ const struct GNUNET_OS_ProjectData *pd = client->sh->pd;
struct GNUNET_MQ_Handle *mq;
struct GNUNET_MQ_Envelope *env;
struct GNUNET_MessageHeader *res;
size_t slen;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
(void) msg;
slen = strlen (pd->agpl_url) + 1;
env = GNUNET_MQ_msg_extra (res,
- GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, slen);
+ GNUNET_MESSAGE_TYPE_RESPONSE_AGPL,
+ slen);
memcpy (&res[1],
GNUNET_AGPL_URL,
slen);
mq = GNUNET_SERVICE_client_get_mq (client);
- GNUNET_MQ_send (mq, env);
+ GNUNET_MQ_send (mq,
+ env);
GNUNET_SERVICE_client_continue (client);
}
struct GNUNET_SERVICE_Handle *
-GNUNET_SERVICE_start (const char *service_name,
+GNUNET_SERVICE_start (const struct GNUNET_OS_ProjectData *pd,
+ const char *service_name,
const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_SERVICE_ConnectHandler connect_cb,
GNUNET_SERVICE_DisconnectHandler disconnect_cb,
@@ -1882,6 +1891,7 @@ GNUNET_SERVICE_start (const char *service_name,
struct GNUNET_SERVICE_Handle *sh;
sh = GNUNET_new (struct GNUNET_SERVICE_Handle);
+ sh->pd = pd;
sh->service_name = service_name;
sh->cfg = cfg;
sh->connect_cb = connect_cb;
@@ -1890,7 +1900,9 @@ GNUNET_SERVICE_start (const char *service_name,
sh->handlers = GNUNET_MQ_copy_handlers2 (handlers,
&return_agpl,
NULL);
- if (GNUNET_OK != setup_service (sh))
+ if (GNUNET_OK !=
+ setup_service (pd,
+ sh))
{
GNUNET_free (sh->handlers);
GNUNET_free (sh);
@@ -1962,7 +1974,8 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv)
int
-GNUNET_SERVICE_run_ (int argc,
+GNUNET_SERVICE_run_ (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
const char *service_name,
enum GNUNET_SERVICE_Options options,
@@ -1989,7 +2002,6 @@ GNUNET_SERVICE_run_ (int argc,
struct GNUNET_CONFIGURATION_Handle *cfg;
int ret;
int err;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
struct GNUNET_GETOPT_CommandLineOption service_options[] = {
GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename),
GNUNET_GETOPT_option_flag ('d',
@@ -1997,7 +2009,8 @@ GNUNET_SERVICE_run_ (int argc,
gettext_noop (
"do daemonize (detach from terminal)"),
&do_daemonize),
- GNUNET_GETOPT_option_help (NULL),
+ GNUNET_GETOPT_option_help (pd,
+ NULL),
GNUNET_GETOPT_option_loglevel (&loglev),
GNUNET_GETOPT_option_logfile (&logfile),
GNUNET_GETOPT_option_version (pd->version),
@@ -2015,16 +2028,19 @@ GNUNET_SERVICE_run_ (int argc,
pd->config_file);
else
cfg_filename = GNUNET_strdup (pd->user_config_file);
+ sh.pd = pd;
sh.ready_confirm_fd = -1;
sh.options = options;
- sh.cfg = cfg = GNUNET_CONFIGURATION_create ();
+ sh.cfg = cfg = GNUNET_CONFIGURATION_create (pd);
sh.service_init_cb = service_init_cb;
sh.connect_cb = connect_cb;
sh.disconnect_cb = disconnect_cb;
sh.cb_cls = cls;
sh.handlers = (NULL == pd->agpl_url)
? GNUNET_MQ_copy_handlers (handlers)
- : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL);
+ : GNUNET_MQ_copy_handlers2 (handlers,
+ &return_agpl,
+ NULL);
sh.service_name = service_name;
/* setup subsystems */
loglev = NULL;
@@ -2035,9 +2051,10 @@ GNUNET_SERVICE_run_ (int argc,
if (NULL != pd->gettext_domain)
{
setlocale (LC_ALL, "");
- path = (NULL == pd->gettext_path) ?
- GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LOCALEDIR) :
- GNUNET_strdup (pd->gettext_path);
+ path = (NULL == pd->gettext_path)
+ ? GNUNET_OS_installation_get_path (pd,
+ GNUNET_OS_IPK_LOCALEDIR)
+ : GNUNET_strdup (pd->gettext_path);
if (NULL != path)
{
bindtextdomain (pd->gettext_domain, path);
@@ -2102,10 +2119,13 @@ GNUNET_SERVICE_run_ (int argc,
}
}
}
- if (GNUNET_OK != setup_service (&sh))
+ if (GNUNET_OK !=
+ setup_service (pd,
+ &sh))
goto shutdown;
if ( (1 == do_daemonize) &&
- (GNUNET_OK != detach_terminal (&sh)) )
+ (GNUNET_OK !=
+ detach_terminal (&sh)) )
{
GNUNET_break (0);
goto shutdown;
@@ -2186,7 +2206,8 @@ static struct ServiceHandleList *hll_tail;
int
-GNUNET_SERVICE_register_ (const char *service_name,
+GNUNET_SERVICE_register_ (const struct GNUNET_OS_ProjectData *pd,
+ const char *service_name,
enum GNUNET_SERVICE_Options options,
GNUNET_SERVICE_InitCallback service_init_cb,
GNUNET_SERVICE_ConnectHandler connect_cb,
@@ -2196,8 +2217,8 @@ GNUNET_SERVICE_register_ (const char *service_name,
{
struct ServiceHandleList *hle;
struct GNUNET_SERVICE_Handle *sh = GNUNET_new (struct GNUNET_SERVICE_Handle);
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
+ sh->pd = pd;
sh->ready_confirm_fd = -1;
sh->options = options;
sh->service_init_cb = service_init_cb;
@@ -2244,19 +2265,31 @@ do_registered_services_shutdown (void *cls)
}
+struct LaunchContext
+{
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_OS_ProjectData *pd;
+};
+
+
static void
launch_registered_services (void *cls)
{
- struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+ struct LaunchContext *lc = cls;
+ struct GNUNET_CONFIGURATION_Handle *cfg = lc->cfg;
+ const struct GNUNET_OS_ProjectData *pd = lc->pd;
for (struct ServiceHandleList *shl = hll_head;
NULL != shl;
shl = shl->next)
{
shl->sh->cfg = cfg;
- if (GNUNET_OK != setup_service (shl->sh))
+ if (GNUNET_OK !=
+ setup_service (pd,
+ shl->sh))
continue;
- if (GNUNET_OK != set_user_id (shl->sh))
+ if (GNUNET_OK !=
+ set_user_id (shl->sh))
continue;
GNUNET_SCHEDULER_add_now (&service_main,
shl->sh);
@@ -2267,27 +2300,35 @@ launch_registered_services (void *cls)
void
-GNUNET_SERVICE_main (int argc,
+GNUNET_SERVICE_main (const struct GNUNET_OS_ProjectData *pd,
+ int argc,
char *const *argv,
struct GNUNET_CONFIGURATION_Handle *cfg,
enum GNUNET_GenericReturnValue with_scheduler)
{
+ struct LaunchContext lc = {
+ .pd = pd,
+ .cfg = cfg
+ };
+
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Entering GNUNET_SERVICE_main\n");
if (GNUNET_YES == with_scheduler)
{
- if (GNUNET_YES != GNUNET_PROGRAM_conf_and_options (argc,
- argv,
- cfg))
+ if (GNUNET_YES !=
+ GNUNET_PROGRAM_conf_and_options (pd,
+ argc,
+ argv,
+ cfg))
return;
GNUNET_SCHEDULER_run (&launch_registered_services,
- cfg);
+ &lc);
}
else
- launch_registered_services (cfg);
-
- GNUNET_RESOLVER_connect (cfg);
-
+ {
+ launch_registered_services (&lc);
+ GNUNET_RESOLVER_connect (cfg);
+ }
}
diff --git a/src/lib/util/test_client.c b/src/lib/util/test_client.c
index 64c32f646..c61f1ba2e 100644
--- a/src/lib/util/test_client.c
+++ b/src/lib/util/test_client.c
@@ -180,7 +180,8 @@ main (int argc,
test_argv[2] = "test_client_unix.conf";
global_ret = 1;
if (0 !=
- GNUNET_SERVICE_run_ (3,
+ GNUNET_SERVICE_run_ (GNUNET_OS_project_data_gnunet (),
+ 3,
test_argv,
"test_client",
GNUNET_SERVICE_OPTION_NONE,
diff --git a/src/lib/util/test_configuration.c
b/src/lib/util/test_configuration.c
index 0faeba6f3..68f907b03 100644
--- a/src/lib/util/test_configuration.c
+++ b/src/lib/util/test_configuration.c
@@ -179,7 +179,8 @@ editConfiguration (struct GNUNET_CONFIGURATION_Handle *cfg_,
struct DiffsCBData diffsCB;
initDiffsCBData (&diffsCB);
- diffsCB.cfgDiffs = GNUNET_CONFIGURATION_create ();
+ diffsCB.cfgDiffs = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet
+ ());
switch (option)
{
@@ -240,7 +241,7 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfg_, int
option)
initDiffsCBData (&cbData);
- cfg_new = GNUNET_CONFIGURATION_create ();
+ cfg_new = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
/* load defaults */
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (cfg_new, NULL));
@@ -258,8 +259,10 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfg_, int
option)
GNUNET_CONFIGURATION_destroy (cfg_new);
/* Compare the dumped configuration with modifications done */
- cfg_new = GNUNET_CONFIGURATION_create ();
- GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg_new,
diffsFileName));
+ cfg_new = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONFIGURATION_parse (cfg_new,
+ diffsFileName));
if (0 != remove (diffsFileName))
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "remove",
diffsFileName);
@@ -493,7 +496,7 @@ main (int argc, char *argv[])
char *c;
GNUNET_log_setup ("test_configuration", "WARNING", NULL);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
GNUNET_assert (cfg != NULL);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_parse (cfg, "test_configuration_data.conf"))
@@ -519,9 +522,10 @@ main (int argc, char *argv[])
GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_assert (0 == unlink ("/tmp/gnunet-test.conf"));
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_load (cfg, "test_configuration_data.conf"))
+ GNUNET_CONFIGURATION_load (cfg,
+ "test_configuration_data.conf"))
{
GNUNET_break (0);
GNUNET_CONFIGURATION_destroy (cfg);
@@ -546,8 +550,10 @@ main (int argc, char *argv[])
GNUNET_CONFIGURATION_destroy (cfg);
/* Testing configuration diffs */
- cfg_default = GNUNET_CONFIGURATION_create ();
- if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg_default, NULL))
+ cfg_default = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_load (cfg_default,
+ NULL))
{
GNUNET_break (0);
GNUNET_CONFIGURATION_destroy (cfg_default);
diff --git a/src/lib/util/test_getopt.c b/src/lib/util/test_getopt.c
index 17234c989..933f68c50 100644
--- a/src/lib/util/test_getopt.c
+++ b/src/lib/util/test_getopt.c
@@ -98,8 +98,11 @@ testAbout ()
(char*) "-h",
NULL
};
- const struct GNUNET_GETOPT_CommandLineOption aboutoptionlist[] =
- { GNUNET_GETOPT_option_help ("Testing"), GNUNET_GETOPT_OPTION_END };
+ const struct GNUNET_GETOPT_CommandLineOption aboutoptionlist[] = {
+ GNUNET_GETOPT_option_help (GNUNET_OS_project_data_gnunet (),
+ "Testing"),
+ GNUNET_GETOPT_OPTION_END
+ };
if (0 != GNUNET_GETOPT_run ("test_getopt", aboutoptionlist, 2, myargv))
{
diff --git a/src/lib/util/test_mq.c b/src/lib/util/test_mq.c
index e085af213..a71f320a0 100644
--- a/src/lib/util/test_mq.c
+++ b/src/lib/util/test_mq.c
@@ -34,7 +34,7 @@
* How long does the receiver take per message?
*/
#define RECEIVER_THROTTLE GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MILLISECONDS, 1)
+ GNUNET_TIME_UNIT_MILLISECONDS, 1)
static unsigned int received_cnt;
@@ -327,7 +327,8 @@ main (int argc, char **argv)
test1 ();
test2 ();
if (0 !=
- GNUNET_SERVICE_run_ (3,
+ GNUNET_SERVICE_run_ (GNUNET_OS_project_data_gnunet (),
+ 3,
test_argv,
"test_client",
GNUNET_SERVICE_OPTION_NONE,
diff --git a/src/lib/util/test_os_start_process.c
b/src/lib/util/test_os_start_process.c
index cdb1acf03..33aa5b26a 100644
--- a/src/lib/util/test_os_start_process.c
+++ b/src/lib/util/test_os_start_process.c
@@ -200,7 +200,8 @@ check_kill ()
{
return 1;
}
- fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
+ fn = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-resolver");
proc =
GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ERR
| GNUNET_OS_USE_PIPE_CONTROL,
@@ -218,9 +219,13 @@ check_kill ()
}
sleep (1); /* give process time to start, so we actually use the pipe-kill
mechanism! */
GNUNET_free (fn);
- if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
- GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc));
+ if (0 !=
+ GNUNET_OS_process_kill (proc,
+ GNUNET_TERM_SIG))
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+ "kill");
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_OS_process_wait (proc));
GNUNET_OS_process_destroy (proc);
proc = NULL;
GNUNET_DISK_pipe_close (hello_pipe_stdout);
@@ -243,7 +248,8 @@ check_instant_kill ()
{
return 1;
}
- fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
+ fn = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-resolver");
proc =
GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ERR
| GNUNET_OS_USE_PIPE_CONTROL,
@@ -259,10 +265,12 @@ check_instant_kill ()
if (0 != GNUNET_OS_process_kill (proc,
GNUNET_TERM_SIG))
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+ "kill");
}
GNUNET_free (fn);
- GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proc));
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_OS_process_wait (proc));
GNUNET_OS_process_destroy (proc);
proc = NULL;
GNUNET_DISK_pipe_close (hello_pipe_stdout);
@@ -271,18 +279,33 @@ check_instant_kill ()
}
+/**
+ * Signal handler called for SIGPIPE.
+ */
+static void
+sighandler_pipe (void)
+{
+ return;
+}
+
+
int
main (int argc, char *argv[])
{
int ret;
+ struct GNUNET_SIGNAL_Context *shc_pipe;
GNUNET_log_setup ("test-os-start-process",
"WARNING",
NULL);
+
+ shc_pipe = GNUNET_SIGNAL_handler_install (SIGPIPE,
+ &sighandler_pipe);
ret = 0;
ret |= check_run ();
ret |= check_kill ();
ret |= check_instant_kill ();
+ GNUNET_SIGNAL_handler_uninstall (shc_pipe);
return ret;
}
diff --git a/src/lib/util/test_plugin.c b/src/lib/util/test_plugin.c
index 4ee4e86a9..cce658e3f 100644
--- a/src/lib/util/test_plugin.c
+++ b/src/lib/util/test_plugin.c
@@ -57,12 +57,14 @@ main (int argc, char *argv[])
NULL);
GNUNET_log_skip (1,
GNUNET_NO);
- ret = GNUNET_PLUGIN_load ("libgnunet_plugin_missing",
+ ret = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ "libgnunet_plugin_missing",
NULL);
GNUNET_log_skip (0, GNUNET_NO);
if (NULL != ret)
return 1;
- ret = GNUNET_PLUGIN_load ("libgnunet_plugin_utiltest",
+ ret = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ "libgnunet_plugin_utiltest",
(char*) "in");
if (NULL == ret)
return 1;
@@ -77,7 +79,8 @@ main (int argc, char *argv[])
"World"))
return 4;
free (ret);
- GNUNET_PLUGIN_load_all ("libgnunet_plugin_utiltes",
+ GNUNET_PLUGIN_load_all (GNUNET_OS_project_data_gnunet (),
+ "libgnunet_plugin_utiltes",
(char*) "in",
&test_cb,
(char*) "test-closure");
diff --git a/src/lib/util/test_program.c b/src/lib/util/test_program.c
index 3892a2454..3e901af68 100644
--- a/src/lib/util/test_program.c
+++ b/src/lib/util/test_program.c
@@ -107,24 +107,28 @@ main (int argc, char *argv[])
"WARNING",
NULL);
GNUNET_assert (GNUNET_OK ==
- GNUNET_PROGRAM_run (7, argvx,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ 7, argvx,
"test_program",
"A test",
options1,
&runner, &ok));
GNUNET_assert (GNUNET_OK ==
- GNUNET_PROGRAM_run (7, argvx,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ 7, argvx,
"test_program", "A test",
options2,
&runner, &ok));
GNUNET_assert (GNUNET_OK ==
- GNUNET_PROGRAM_run (7, argvx,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ 7, argvx,
"test_program", "A test",
options3,
&runner, &ok));
GNUNET_assert (GNUNET_OK ==
- GNUNET_PROGRAM_run (7, argvx,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ 7, argvx,
"test_program", "A test",
options4,
&runner, &ok));
diff --git a/src/lib/util/test_service.c b/src/lib/util/test_service.c
index ca510038e..45b7955e6 100644
--- a/src/lib/util/test_service.c
+++ b/src/lib/util/test_service.c
@@ -181,7 +181,8 @@ check (const char *sname)
sname);
global_ret = 1;
GNUNET_assert (0 ==
- GNUNET_SERVICE_run_ (3,
+ GNUNET_SERVICE_run_ (GNUNET_OS_project_data_gnunet (),
+ 3,
argv,
sname,
GNUNET_SERVICE_OPTION_NONE,
diff --git a/src/lib/util/test_speedup.c b/src/lib/util/test_speedup.c
index 99e1902a5..72224defd 100644
--- a/src/lib/util/test_speedup.c
+++ b/src/lib/util/test_speedup.c
@@ -97,7 +97,8 @@ main (int argc, char *argv[])
start_real = time (NULL);
start = GNUNET_TIME_absolute_get ();
- GNUNET_PROGRAM_run ((sizeof(argvn) / sizeof(char *)) - 1, argvn,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argvn) / sizeof(char *)) - 1, argvn,
"test-speedup",
"nohelp", options, &check, NULL);
diff --git a/src/lib/util/test_time.c b/src/lib/util/test_time.c
index bca58c0cd..386d0d246 100644
--- a/src/lib/util/test_time.c
+++ b/src/lib/util/test_time.c
@@ -240,7 +240,7 @@ main (int argc, char *argv[])
{
struct GNUNET_CONFIGURATION_Handle *cfg;
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
last = GNUNET_TIME_absolute_get_monotonic (cfg);
now = GNUNET_TIME_absolute_get_monotonic (cfg);
GNUNET_assert (now.abs_value_us > last.abs_value_us);
diff --git a/src/plugin/datastore/perf_plugin_datastore.c
b/src/plugin/datastore/perf_plugin_datastore.c
index 48e3eea0f..41558378f 100644
--- a/src/plugin/datastore/perf_plugin_datastore.c
+++ b/src/plugin/datastore/perf_plugin_datastore.c
@@ -472,7 +472,9 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Loading `%s' datastore plugin\n"),
name);
GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name);
- if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env)))
+ if (NULL == (ret = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ libname,
+ &env)))
{
fprintf (stderr, "Failed to load plugin `%s'!\n", name);
GNUNET_free (name);
@@ -539,8 +541,10 @@ main (int argc, char *argv[])
GNUNET_snprintf (category, sizeof(category), "DATASTORE-%s", plugin_name);
GNUNET_snprintf (cfg_name, sizeof(cfg_name),
"perf_plugin_datastore_data_%s.conf", plugin_name);
- GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1, xargv,
- "perf-plugin-datastore", "nohelp", options, &run, NULL);
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(xargv) / sizeof(char *)) - 1, xargv,
+ "perf-plugin-datastore", "nohelp", options,
+ &run, NULL);
if (ok != 0)
fprintf (stderr, "Missed some testcases: %u\n", ok);
GNUNET_DISK_directory_remove (dir_name);
diff --git a/src/plugin/datastore/test_plugin_datastore.c
b/src/plugin/datastore/test_plugin_datastore.c
index 6185f1089..1f7535dc9 100644
--- a/src/plugin/datastore/test_plugin_datastore.c
+++ b/src/plugin/datastore/test_plugin_datastore.c
@@ -402,7 +402,9 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Loading `%s' datastore plugin\n"),
name);
GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", name);
- if (NULL == (ret = GNUNET_PLUGIN_load (libname, &env)))
+ if (NULL == (ret = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ libname,
+ &env)))
{
fprintf (stderr, "Failed to load plugin `%s'!\n", name);
GNUNET_free (libname);
@@ -464,8 +466,10 @@ main (int argc, char *argv[])
NULL);
GNUNET_snprintf (cfg_name, sizeof(cfg_name),
"test_plugin_datastore_data_%s.conf", plugin_name);
- GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1, xargv,
- "test-plugin-datastore", "nohelp", options, &run, NULL);
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(xargv) / sizeof(char *)) - 1, xargv,
+ "test-plugin-datastore", "nohelp", options,
+ &run, NULL);
if ((0 != ok) && (77 != ok))
fprintf (stderr, "Missed some testcases: %u\n", ok);
GNUNET_DISK_directory_remove (dir_name);
diff --git a/src/plugin/fs/test_plugin_block_fs.c
b/src/plugin/fs/test_plugin_block_fs.c
index f15d10b17..e342581a8 100644
--- a/src/plugin/fs/test_plugin_block_fs.c
+++ b/src/plugin/fs/test_plugin_block_fs.c
@@ -72,7 +72,7 @@ main (int argc, char *argv[])
struct GNUNET_CONFIGURATION_Handle *cfg;
GNUNET_log_setup ("test-block", "WARNING", NULL);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
ctx = GNUNET_BLOCK_context_create (cfg);
ret = test_fs (ctx);
GNUNET_BLOCK_context_destroy (ctx);
diff --git a/src/plugin/namecache/test_plugin_namecache.c
b/src/plugin/namecache/test_plugin_namecache.c
index 141698a23..f95ba4c92 100644
--- a/src/plugin/namecache/test_plugin_namecache.c
+++ b/src/plugin/namecache/test_plugin_namecache.c
@@ -68,7 +68,9 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("Loading `%s' namecache plugin\n"),
plugin_name);
GNUNET_asprintf (&libname, "libgnunet_plugin_namecache_%s", plugin_name);
- if (NULL == (ret = GNUNET_PLUGIN_load (libname, (void *) cfg)))
+ if (NULL == (ret = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ libname,
+ (void *) cfg)))
{
fprintf (stderr, "Failed to load plugin `%s'!\n", plugin_name);
GNUNET_free (libname);
@@ -117,17 +119,22 @@ main (int argc, char *argv[])
GNUNET_snprintf (cfg_name, sizeof(cfg_name), "test_plugin_namecache_%s.conf",
plugin_name);
- GNUNET_DISK_purge_cfg_dir (cfg_name, "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir (GNUNET_OS_project_data_gnunet (),
+ cfg_name,
+ "GNUNET_TEST_HOME");
GNUNET_log_setup ("test-plugin-namecache",
"WARNING",
NULL);
- GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1, xargv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(xargv) / sizeof(char *)) - 1, xargv,
"test-plugin-namecache", "nohelp", options, &run, NULL);
if (ok != 0)
fprintf (stderr, "Missed some testcases: %d\n", ok);
- GNUNET_DISK_purge_cfg_dir (cfg_name, "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir (GNUNET_OS_project_data_gnunet (),
+ cfg_name,
+ "GNUNET_TEST_HOME");
return ok;
}
diff --git a/src/plugin/namestore/test_plugin_namestore.c
b/src/plugin/namestore/test_plugin_namestore.c
index 21e977329..8998eab68 100644
--- a/src/plugin/namestore/test_plugin_namestore.c
+++ b/src/plugin/namestore/test_plugin_namestore.c
@@ -72,7 +72,9 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
GNUNET_asprintf (&libname,
"libgnunet_plugin_namestore_%s",
plugin_name);
- if (NULL == (ret = GNUNET_PLUGIN_load (libname, (void *) cfg)))
+ if (NULL == (ret = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ libname,
+ (void *) cfg)))
{
fprintf (stderr,
"Failed to load plugin `%s'!\n",
@@ -170,7 +172,7 @@ edit_iter (void *cls,
unsigned int rd_count,
const struct GNUNET_GNSRECORD_Data *rd)
{
- const char* expected_hint = cls;
+ const char*expected_hint = cls;
printf ("Expected hint: `%s', got `%s'\n", expected_hint, editor_hint);
GNUNET_assert (0 == strcmp (expected_hint, editor_hint));
}
@@ -178,7 +180,7 @@ edit_iter (void *cls,
static void
edit_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id,
- const char *new_hint, const char* old_hint)
+ const char *new_hint, const char*old_hint)
{
struct GNUNET_CRYPTO_PrivateKey zone_private_key;
char label[64];
@@ -212,9 +214,9 @@ run (void *cls,
}
put_record (nsp, 1);
get_record (nsp, 1);
- edit_record(nsp, 1, "hello", "");
- edit_record(nsp, 1, "world", "hello");
- edit_record(nsp, 1, "gnunet", "world");
+ edit_record (nsp, 1, "hello", "");
+ edit_record (nsp, 1, "world", "hello");
+ edit_record (nsp, 1, "gnunet", "world");
#ifndef DARWIN // #5582
unload_plugin (nsp);
#endif
@@ -240,15 +242,20 @@ main (int argc, char *argv[])
sizeof(cfg_name),
"test_plugin_namestore_%s.conf",
plugin_name);
- GNUNET_DISK_purge_cfg_dir (cfg_name, "GNUNET_TMP");
- GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1,
+ GNUNET_DISK_purge_cfg_dir (GNUNET_OS_project_data_gnunet (),
+ cfg_name,
+ "GNUNET_TMP");
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(xargv) / sizeof(char *)) - 1,
xargv,
"test-plugin-namestore",
"nohelp",
options,
&run,
NULL);
- GNUNET_DISK_purge_cfg_dir (cfg_name, "GNUNET_TMP");
+ GNUNET_DISK_purge_cfg_dir (GNUNET_OS_project_data_gnunet (),
+ cfg_name,
+ "GNUNET_TMP");
if (ok != 0)
fprintf (stderr, "Missed some testcases: %d\n", ok);
return ok;
diff --git a/src/plugin/peerstore/test_plugin_peerstore.c
b/src/plugin/peerstore/test_plugin_peerstore.c
index 1377845aa..eb729bd96 100644
--- a/src/plugin/peerstore/test_plugin_peerstore.c
+++ b/src/plugin/peerstore/test_plugin_peerstore.c
@@ -80,7 +80,8 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
GNUNET_asprintf (&libname,
"libgnunet_plugin_peerstore_%s",
plugin_name);
- if (NULL == (ret = GNUNET_PLUGIN_load (libname,
+ if (NULL == (ret = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ libname,
(void *) cfg)))
{
fprintf (stderr,
@@ -208,7 +209,8 @@ main (int argc, char *argv[])
sizeof(cfg_name),
"test_plugin_peerstore_%s.conf",
plugin_name);
- GNUNET_PROGRAM_run ((sizeof(xargv) / sizeof(char *)) - 1,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(xargv) / sizeof(char *)) - 1,
xargv,
"test-plugin-peerstore",
"nohelp",
diff --git a/src/service/arm/arm_api.c b/src/service/arm/arm_api.c
index b6de6334b..90e8af94b 100644
--- a/src/service/arm/arm_api.c
+++ b/src/service/arm/arm_api.c
@@ -711,7 +711,8 @@ start_arm_service (struct GNUNET_ARM_Handle *h,
"CONFIG",
&config))
config = NULL;
- binary = GNUNET_OS_get_libexec_binary_path (cbinary);
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ cbinary);
GNUNET_asprintf ("edbinary,
"\"%s\"",
binary);
diff --git a/src/service/arm/gnunet-service-arm.c
b/src/service/arm/gnunet-service-arm.c
index dac9529b1..31ec669ce 100644
--- a/src/service/arm/gnunet-service-arm.c
+++ b/src/service/arm/gnunet-service-arm.c
@@ -890,7 +890,9 @@ start_process (struct ServiceList *sl,
sl->name,
sl->binary,
sl->config);
- binary = GNUNET_OS_get_libexec_binary_path (sl->binary);
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet
()
+ ,
+ sl->binary);
GNUNET_asprintf ("edbinary,
"\"%s\"",
binary);
@@ -2248,7 +2250,8 @@ main (int argc, char *const *argv)
shc_chld =
GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD,
&sighandler_child_death);
- if (0 != GNUNET_SERVICE_run_ (argc,
+ if (0 != GNUNET_SERVICE_run_ (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"arm",
GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN
diff --git a/src/service/arm/test_arm_api.c b/src/service/arm/test_arm_api.c
index d04995ca8..1289b2207 100644
--- a/src/service/arm/test_arm_api.c
+++ b/src/service/arm/test_arm_api.c
@@ -249,7 +249,8 @@ main (int argc, char *argvx[])
"WARNING",
NULL);
GNUNET_assert (GNUNET_OK ==
- GNUNET_PROGRAM_run ((sizeof(argv) / sizeof(char *)) - 1,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argv) / sizeof(char *)) - 1,
argv, "test-arm-api", "nohelp", options,
&task, NULL));
return ok;
diff --git a/src/service/arm/test_exponential_backoff.c
b/src/service/arm/test_exponential_backoff.c
index bddd4ea97..f6e9255df 100644
--- a/src/service/arm/test_exponential_backoff.c
+++ b/src/service/arm/test_exponential_backoff.c
@@ -389,7 +389,8 @@ check ()
/* Running ARM and running the do_nothing task */
if (GNUNET_OK !=
- GNUNET_PROGRAM_run ((sizeof(argv) / sizeof(char *)) - 1,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argv) / sizeof(char *)) - 1,
argv,
"test-exponential-backoff",
"nohelp",
@@ -416,7 +417,7 @@ init (void)
char pwd[PATH_MAX];
char *binary;
- cfg_ = GNUNET_CONFIGURATION_create ();
+ cfg_ = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (GNUNET_OK !=
GNUNET_CONFIGURATION_parse (cfg_,
"test_arm_api_data.conf"))
diff --git a/src/service/arm/test_gnunet_service_arm.c
b/src/service/arm/test_gnunet_service_arm.c
index 43dca1a1b..db886d323 100644
--- a/src/service/arm/test_gnunet_service_arm.c
+++ b/src/service/arm/test_gnunet_service_arm.c
@@ -34,7 +34,7 @@
* startup (annoying)).
*/
#define START_TIMEOUT GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MILLISECONDS, 50)
+ GNUNET_TIME_UNIT_MILLISECONDS, 50)
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
@@ -249,7 +249,8 @@ main (int argc, char *av[])
"WARNING",
NULL);
GNUNET_break (GNUNET_OK ==
- GNUNET_PROGRAM_run ((sizeof(argv) / sizeof(char *)) - 1,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argv) / sizeof(char *)) - 1,
argv, "test-gnunet-service-arm",
"nohelp", options,
&run, NULL));
diff --git a/src/service/arm/testing_arm_cmd_start_peer.c
b/src/service/arm/testing_arm_cmd_start_peer.c
index 31fc713bf..1ddf346a1 100644
--- a/src/service/arm/testing_arm_cmd_start_peer.c
+++ b/src/service/arm/testing_arm_cmd_start_peer.c
@@ -133,7 +133,7 @@ start_peer_run (void *cls,
system_cmd,
&sps->system))
GNUNET_TESTING_FAIL (is);
- sps->cfg = GNUNET_CONFIGURATION_create ();
+ sps->cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (GNUNET_OK !=
GNUNET_CONFIGURATION_load (sps->cfg,
sps->cfgname))
@@ -172,7 +172,8 @@ start_peer_run (void *cls,
}
libexec_binary
- = GNUNET_OS_get_libexec_binary_path ("gnunet-service-arm");
+ = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-arm");
ret = GNUNET_CONFIGURATION_get_value_string (sps->cfg,
"arm",
diff --git a/src/service/cadet/cadet_api.c b/src/service/cadet/cadet_api.c
index 0bfb01868..5a60b1038 100644
--- a/src/service/cadet/cadet_api.c
+++ b/src/service/cadet/cadet_api.c
@@ -563,7 +563,8 @@ handle_channel_destroy (
* #GNUNET_SYSERR otherwise
*/
static int
-check_local_data (void *cls, const struct GNUNET_CADET_LocalData *message)
+check_local_data (void *cls,
+ const struct GNUNET_CADET_LocalData *message)
{
uint16_t size;
@@ -585,7 +586,8 @@ check_local_data (void *cls, const struct
GNUNET_CADET_LocalData *message)
* @param message A message encapsulating the data
*/
static void
-handle_local_data (void *cls, const struct GNUNET_CADET_LocalData *message)
+handle_local_data (void *cls,
+ const struct GNUNET_CADET_LocalData *message)
{
struct GNUNET_CADET_Handle *h = cls;
const struct GNUNET_MessageHeader *payload;
@@ -623,7 +625,8 @@ handle_local_data (void *cls, const struct
GNUNET_CADET_LocalData *message)
* @param message Message itself.
*/
static void
-handle_local_ack (void *cls, const struct GNUNET_CADET_LocalAck *message)
+handle_local_ack (void *cls,
+ const struct GNUNET_CADET_LocalAck *message)
{
struct GNUNET_CADET_Handle *h = cls;
struct GNUNET_CADET_Channel *ch;
@@ -919,21 +922,30 @@ GNUNET_CADET_connect (const struct
GNUNET_CONFIGURATION_Handle *cfg)
* @param msg AGPL request
*/
static void
-return_agpl (void *cls, const struct GNUNET_MessageHeader *msg)
+return_agpl (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_SERVICE_Client *client = cls;
struct GNUNET_MQ_Handle *mq;
struct GNUNET_MQ_Envelope *env;
struct GNUNET_MessageHeader *res;
size_t slen;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
+ /* FIXME: this is a bug, uses always GNUnet PD while we would
+ actually WANT to use the PD of the CADET application here! */
+ const struct GNUNET_OS_ProjectData *pd =
+ GNUNET_OS_project_data_gnunet ();
(void) msg;
slen = strlen (pd->agpl_url) + 1;
- env = GNUNET_MQ_msg_extra (res, GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, slen);
- memcpy (&res[1], GNUNET_AGPL_URL, slen);
+ env = GNUNET_MQ_msg_extra (res,
+ GNUNET_MESSAGE_TYPE_RESPONSE_AGPL,
+ slen);
+ memcpy (&res[1],
+ pd->agpl_url,
+ slen);
mq = GNUNET_SERVICE_client_get_mq (client);
- GNUNET_MQ_send (mq, env);
+ GNUNET_MQ_send (mq,
+ env);
GNUNET_SERVICE_client_continue (client);
}
@@ -960,7 +972,10 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h,
const struct GNUNET_MQ_MessageHandler *handlers)
{
struct GNUNET_CADET_Port *p;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
+ /* FIXME: this is a bug, uses always GNUnet PD while we would
+ actually WANT to use the PD of the CADET application here! */
+ const struct GNUNET_OS_ProjectData *pd =
+ GNUNET_OS_project_data_gnunet ();
GNUNET_assert (NULL != connects);
GNUNET_assert (NULL != disconnects);
diff --git a/src/service/datacache/datacache.c
b/src/service/datacache/datacache.c
index c93ed58d6..a4428265a 100644
--- a/src/service/datacache/datacache.c
+++ b/src/service/datacache/datacache.c
@@ -32,7 +32,7 @@
#define LOG(kind, ...) GNUNET_log_from (kind, "datacache", __VA_ARGS__)
#define LOG_STRERROR_FILE(kind, op, fn) \
- GNUNET_log_from_strerror_file (kind, "datacache", op, fn)
+ GNUNET_log_from_strerror_file (kind, "datacache", op, fn)
/**
* Internal state of the datacache library.
@@ -133,7 +133,6 @@ GNUNET_DATACACHE_create (const struct
GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_DATACACHE_Handle *ret;
char *libname;
char *name;
- const struct GNUNET_OS_ProjectData *pd;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_size (cfg,
@@ -206,26 +205,16 @@ GNUNET_DATACACHE_create (const struct
GNUNET_CONFIGURATION_Handle *cfg,
ret->short_name = name;
ret->lib_name = libname;
/* Load the plugin within GNUnet's default context */
- pd = GNUNET_OS_project_data_get ();
- GNUNET_OS_init (GNUNET_OS_project_data_default ());
- ret->api = GNUNET_PLUGIN_load (libname,
+ ret->api = GNUNET_PLUGIN_load (GNUNET_CONFIGURATION_get_project_data (cfg),
+ libname,
&ret->env);
- GNUNET_OS_init (pd);
if (NULL == ret->api)
{
- /* Try to load the plugin within the application's context
- This normally happens when the application is not GNUnet itself but a
- third party; inside GNUnet this is effectively a double failure. */
- ret->api = GNUNET_PLUGIN_load (libname,
- &ret->env);
- if (NULL == ret->api)
- {
- LOG (GNUNET_ERROR_TYPE_ERROR,
- "Failed to load datacache plugin for `%s'\n",
- name);
- GNUNET_DATACACHE_destroy (ret);
- return NULL;
- }
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to load datacache plugin for `%s'\n",
+ name);
+ GNUNET_DATACACHE_destroy (ret);
+ return NULL;
}
return ret;
}
diff --git a/src/service/datastore/gnunet-service-datastore.c
b/src/service/datastore/gnunet-service-datastore.c
index 4c76c9f00..4fc661af2 100644
--- a/src/service/datastore/gnunet-service-datastore.c
+++ b/src/service/datastore/gnunet-service-datastore.c
@@ -1170,10 +1170,14 @@ load_plugin ()
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
_ ("Loading `%s' datastore plugin\n"),
plugin_name);
- GNUNET_asprintf (&libname, "libgnunet_plugin_datastore_%s", plugin_name);
+ GNUNET_asprintf (&libname,
+ "libgnunet_plugin_datastore_%s",
+ plugin_name);
ret->short_name = GNUNET_strdup (plugin_name);
ret->lib_name = libname;
- ret->api = GNUNET_PLUGIN_load (libname, &ret->env);
+ ret->api = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ libname,
+ &ret->env);
if (NULL == ret->api)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/service/dns/gnunet-dns-monitor.c
b/src/service/dns/gnunet-dns-monitor.c
index 502228bcd..069c6d67c 100644
--- a/src/service/dns/gnunet-dns-monitor.c
+++ b/src/service/dns/gnunet-dns-monitor.c
@@ -212,7 +212,7 @@ display_record (const struct GNUNET_DNSPARSER_Record
*record)
format = tmp;
}
break;
-
+
case GNUNET_DNSPARSER_TYPE_URI:
if (NULL == record->data.uri)
format = "<invalid>";
@@ -397,7 +397,8 @@ main (int argc, char *const *argv)
};
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-monitor",
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv, "gnunet-dns-monitor",
gettext_noop
("Monitor DNS queries."), options,
&run, NULL)) ? ret : 1;
diff --git a/src/service/dns/gnunet-dns-redirector.c
b/src/service/dns/gnunet-dns-redirector.c
index 56d25aea9..4c18815b4 100644
--- a/src/service/dns/gnunet-dns-redirector.c
+++ b/src/service/dns/gnunet-dns-redirector.c
@@ -251,7 +251,8 @@ main (int argc, char *const *argv)
};
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-dns-redirector",
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv, "gnunet-dns-redirector",
gettext_noop
("Change DNS replies to point elsewhere."),
options,
diff --git a/src/service/dns/gnunet-service-dns.c
b/src/service/dns/gnunet-service-dns.c
index 95e5bf0ac..977009bec 100644
--- a/src/service/dns/gnunet-service-dns.c
+++ b/src/service/dns/gnunet-service-dns.c
@@ -53,7 +53,7 @@
* Generic logging shorthand
*/
#define LOG(kind, ...) \
- GNUNET_log_from (kind, "dns", __VA_ARGS__);
+ GNUNET_log_from (kind, "dns", __VA_ARGS__);
/**
@@ -1111,7 +1111,9 @@ run (void *cls,
_ ("need a valid IPv4 or IPv6 address\n"));
GNUNET_free (dns_exit);
}
- binary = GNUNET_OS_get_suid_binary_path (cfg, "gnunet-helper-dns");
+ binary = GNUNET_OS_get_suid_binary_path (GNUNET_OS_project_data_gnunet (),
+ cfg,
+ "gnunet-helper-dns");
if (GNUNET_YES !=
GNUNET_OS_check_helper_binary (binary,
@@ -1202,7 +1204,8 @@ run (void *cls,
helper_argv[6] = GNUNET_strdup ("0");
helper_argv[7] = NULL;
- hijacker = GNUNET_HELPER_start (GNUNET_NO,
+ hijacker = GNUNET_HELPER_start (GNUNET_OS_project_data_gnunet (),
+ GNUNET_NO,
binary,
helper_argv,
&process_helper_messages,
@@ -1234,7 +1237,7 @@ GNUNET_SERVICE_MAIN
/* FIXME: this might need a port on systems without 'getresgid' */
#if HAVE_GETRESGID
-void __attribute__((constructor)) GNUNET_DNS_init(void);
+void __attribute__((constructor)) GNUNET_DNS_init (void);
/**
* Enable use of SGID capabilities on POSIX
diff --git a/src/service/exit/gnunet-daemon-exit.c
b/src/service/exit/gnunet-daemon-exit.c
index de3407fe3..3f75b9a72 100644
--- a/src/service/exit/gnunet-daemon-exit.c
+++ b/src/service/exit/gnunet-daemon-exit.c
@@ -3947,7 +3947,9 @@ run (void *cls,
&max_connections))
max_connections = 1024;
parse_ip_options ();
- binary = GNUNET_OS_get_suid_binary_path (cfg, "gnunet-helper-exit");
+ binary = GNUNET_OS_get_suid_binary_path (GNUNET_OS_project_data_gnunet (),
+ cfg,
+ "gnunet-helper-exit");
if ((ipv4_exit) || (ipv6_exit))
{
if (GNUNET_YES !=
@@ -4088,7 +4090,8 @@ run (void *cls,
GNUNET_free (prefixed_regex);
}
}
- helper_handle = GNUNET_HELPER_start (GNUNET_NO,
+ helper_handle = GNUNET_HELPER_start (GNUNET_OS_project_data_gnunet (),
+ GNUNET_NO,
binary,
exit_argv,
&message_token,
@@ -4114,7 +4117,8 @@ main (int argc,
};
return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-daemon-exit",
gettext_noop (
diff --git a/src/service/fs/fs_dirmetascan.c b/src/service/fs/fs_dirmetascan.c
index b09e1c0b0..737737730 100644
--- a/src/service/fs/fs_dirmetascan.c
+++ b/src/service/fs/fs_dirmetascan.c
@@ -477,7 +477,8 @@ GNUNET_FS_directory_scan_start (const char *filename,
ds->args[1] = ds->filename_expanded;
ds->args[2] = ds->ex_arg;
ds->args[3] = NULL;
- ds->helper = GNUNET_HELPER_start (GNUNET_NO,
+ ds->helper = GNUNET_HELPER_start (GNUNET_OS_project_data_gnunet (),
+ GNUNET_NO,
"gnunet-helper-fs-publish",
ds->args,
&process_helper_msgs,
diff --git a/src/service/fs/gnunet-daemon-fsprofiler.c
b/src/service/fs/gnunet-daemon-fsprofiler.c
index 45fac5533..5951eea09 100644
--- a/src/service/fs/gnunet-daemon-fsprofiler.c
+++ b/src/service/fs/gnunet-daemon-fsprofiler.c
@@ -660,7 +660,8 @@ main (int argc, char *const *argv)
};
return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "gnunet-daemon-fsprofiler",
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv, "gnunet-daemon-fsprofiler",
gettext_noop
(
"Daemon to use file-sharing to measure its
performance."),
diff --git a/src/service/fs/gnunet-service-fs.c
b/src/service/fs/gnunet-service-fs.c
index 1ab6ac2b8..6e3db49ba 100644
--- a/src/service/fs/gnunet-service-fs.c
+++ b/src/service/fs/gnunet-service-fs.c
@@ -58,7 +58,7 @@
* decremented by 1/16th.
*/
#define COVER_AGE_FREQUENCY GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_SECONDS, 5)
+ GNUNET_TIME_UNIT_SECONDS, 5)
/**
* Collect an instance number of statistics? May cause excessive IPC.
@@ -1224,7 +1224,8 @@ main_init (const struct GNUNET_CONFIGURATION_Handle *c)
anon_p2p_off = (GNUNET_YES ==
GNUNET_CONFIGURATION_get_value_yesno (GSF_cfg,
"fs",
-
"DISABLE_ANON_TRANSFER"));
+
"DISABLE_ANON_TRANSFER")
+ );
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (GSF_cfg,
@@ -1321,7 +1322,7 @@ run (void *cls,
}
GSF_rt_entry_lifetime = GNUNET_LOAD_value_init
(GNUNET_TIME_UNIT_FOREVER_REL);
GSF_stats = GNUNET_STATISTICS_create ("fs", cfg);
- block_cfg = GNUNET_CONFIGURATION_create ();
+ block_cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
GSF_block_ctx = GNUNET_BLOCK_context_create (block_cfg);
GNUNET_assert (NULL != GSF_block_ctx);
GSF_dht = GNUNET_DHT_connect (cfg, FS_DHT_HT_SIZE);
diff --git a/src/service/fs/test_fs_file_information.c
b/src/service/fs/test_fs_file_information.c
index 15380bfc4..64ba3627b 100644
--- a/src/service/fs/test_fs_file_information.c
+++ b/src/service/fs/test_fs_file_information.c
@@ -153,7 +153,8 @@ main (int argc, char *argv[])
GNUNET_log_setup ("test_fs_file_information",
"WARNING",
NULL);
- GNUNET_PROGRAM_run ((sizeof(argvx) / sizeof(char *)) - 1, argvx,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argvx) / sizeof(char *)) - 1, argvx,
"test-fs-file_information", "nohelp", options, &run,
NULL);
return 0;
diff --git a/src/service/fs/test_fs_uri.c b/src/service/fs/test_fs_uri.c
index e0f23097b..00a27b323 100644
--- a/src/service/fs/test_fs_uri.c
+++ b/src/service/fs/test_fs_uri.c
@@ -327,9 +327,9 @@ main (int argc, char *argv[])
failureCount += testFile (i);
}
/* fprintf (stderr, "%s", "\n"); */
- GNUNET_DISK_purge_cfg_dir
- ("test_fs_uri.conf",
- "GNUNET_TEST_HOME");
+ GNUNET_DISK_purge_cfg_dir (GNUNET_OS_project_data_gnunet (),
+ "test_fs_uri.conf",
+ "GNUNET_TEST_HOME");
if (failureCount != 0)
return 1;
diff --git a/src/service/gns/gnunet-bcd.c b/src/service/gns/gnunet-bcd.c
index 2fe65fe75..fa8162117 100644
--- a/src/service/gns/gnunet-bcd.c
+++ b/src/service/gns/gnunet-bcd.c
@@ -594,7 +594,8 @@ run (void *cls,
GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
- datadir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
+ datadir = GNUNET_OS_installation_get_path (GNUNET_OS_project_data_gnunet (),
+ GNUNET_OS_IPK_DATADIR);
GNUNET_assert (NULL != datadir);
GNUNET_asprintf (&tex_file_full,
@@ -682,7 +683,8 @@ main (int argc, char *const *argv)
};
return ((GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-bcd",
_ ("GNUnet HTTP server to create business
cards")
diff --git a/src/service/gns/gnunet-dns2gns.c b/src/service/gns/gnunet-dns2gns.c
index 9f89855a5..e9567a71c 100644
--- a/src/service/gns/gnunet-dns2gns.c
+++ b/src/service/gns/gnunet-dns2gns.c
@@ -382,6 +382,7 @@ dns_result_processor (void *cls,
send_response (request);
}
+
/**
* Callback invoked from the VPN service once a redirection is
* available. Provides the IP address that can now be used to
@@ -455,7 +456,6 @@ vpn_allocation_cb (void *cls,
}
-
/**
* Iterator called on obtained result for a GNS lookup.
*
@@ -609,7 +609,8 @@ result_processor (void *cls,
vpn->proto),
&vpn->peer,
&vhash,
-
GNUNET_TIME_relative_to_absolute (
+
GNUNET_TIME_relative_to_absolute
+ (
VPN_TIMEOUT),
&
vpn_allocation_cb,
@@ -902,8 +903,8 @@ run (void *cls,
}
GNUNET_free (addr_str);
if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (c, "dns2gns",
- "PORT",
- &listen_port))
+ "PORT",
+ &listen_port))
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Listening on %llu\n", listen_port);
@@ -1006,7 +1007,8 @@ main (int argc,
NULL);
ret =
(GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv,
"gnunet-dns2gns",
_ ("GNUnet DNS-to-GNS proxy (a DNS server)"),
options,
diff --git a/src/service/gns/gnunet-gns-benchmark.c
b/src/service/gns/gnunet-gns-benchmark.c
index e401252fb..7c0047ae8 100644
--- a/src/service/gns/gnunet-gns-benchmark.c
+++ b/src/service/gns/gnunet-gns-benchmark.c
@@ -32,7 +32,7 @@
* How long do we wait at least between requests by default?
*/
#define DEF_REQUEST_DELAY GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MILLISECONDS, 1)
+ GNUNET_TIME_UNIT_MILLISECONDS, 1)
/**
* How long do we wait until we consider a request failed by default?
@@ -598,7 +598,8 @@ main (int argc,
timeout = DEF_TIMEOUT;
request_delay = DEF_REQUEST_DELAY;
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-gns-benchmark",
"resolve GNS names and measure performance",
diff --git a/src/service/gns/gnunet-gns-proxy.c
b/src/service/gns/gnunet-gns-proxy.c
index cbb56f040..cbfb97618 100644
--- a/src/service/gns/gnunet-gns-proxy.c
+++ b/src/service/gns/gnunet-gns-proxy.c
@@ -92,14 +92,14 @@
* After how long do we clean up unused MHD TLS instances?
*/
#define MHD_CACHE_TIMEOUT GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_MINUTES, 5)
+ GNUNET_TIME_UNIT_MINUTES, 5)
/**
* After how long do we clean up Socks5 handles that failed to show any
activity
* with their respective MHD instance?
*/
#define HTTP_HANDSHAKE_TIMEOUT GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_SECONDS, 15)
+ GNUNET_TIME_UNIT_SECONDS, 15)
/**
@@ -110,12 +110,12 @@
* @param rc return code from curl
*/
#define LOG_CURL_EASY(level, fun, rc) \
- GNUNET_log (level, \
- _ ("%s failed at %s:%d: `%s'\n"), \
- fun, \
- __FILE__, \
- __LINE__, \
- curl_easy_strerror (rc))
+ GNUNET_log (level, \
+ _ ("%s failed at %s:%d: `%s'\n"), \
+ fun, \
+ __FILE__, \
+ __LINE__, \
+ curl_easy_strerror (rc))
/* *************** Socks protocol definitions (move to TUN?)
****************** */
@@ -1308,7 +1308,7 @@ curl_check_hdr (void *buffer,
s5r->header_tail,
header);
}
- cleanup:
+cleanup:
GNUNET_free (ndup);
GNUNET_free (new_cookie_hdr);
GNUNET_free (new_location);
@@ -3373,7 +3373,8 @@ do_s5r_read (void *cls)
s5r->gns_lookup = GNUNET_GNS_lookup_with_tld (gns_handle,
s5r->domain,
GNUNET_DNSPARSER_TYPE_A,
-
GNUNET_GNS_LO_LOCAL_MASTER /* only cached */,
+
GNUNET_GNS_LO_LOCAL_MASTER /* only cached */
+ ,
&handle_gns_result,
s5r);
break;
@@ -3892,7 +3893,8 @@ main (int argc,
ret =
(GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv,
"gnunet-gns-proxy",
_ ("GNUnet GNS proxy"),
options,
diff --git a/src/service/gns/gnunet-service-gns.c
b/src/service/gns/gnunet-service-gns.c
index 973104a42..00eb21a28 100644
--- a/src/service/gns/gnunet-service-gns.c
+++ b/src/service/gns/gnunet-service-gns.c
@@ -23,8 +23,8 @@
* @author Martin Schanzenbach
* @author Christian Grothoff
*/
-#include "gnunet_common.h"
#include "platform.h"
+#include "gnunet_common.h"
#include "gnunet_util_lib.h"
#include "gnunet_dht_service.h"
#include "gnunet_namecache_service.h"
@@ -435,9 +435,9 @@ handle_lookup (void *cls,
clh->request_id = sh_msg->id;
if ((GNUNET_SYSERR ==
GNUNET_CRYPTO_read_public_key_from_buffer (&sh_msg[1],
- key_len,
- &zone,
- &read)) ||
+ key_len,
+ &zone,
+ &read)) ||
(read != key_len))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -514,7 +514,8 @@ read_service_conf (void *cls,
section,
option,
_ (
- "Properly base32-encoded public key
required"));
+ "Properly base32-encoded public key
required"))
+ ;
return;
}
tld = GNUNET_new (struct GNS_TopLevelDomain);
diff --git a/src/service/gns/test_gns_proxy.c b/src/service/gns/test_gns_proxy.c
index 97ac6053b..dd9c661f4 100644
--- a/src/service/gns/test_gns_proxy.c
+++ b/src/service/gns/test_gns_proxy.c
@@ -471,14 +471,14 @@ run (void *cls,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Using `%s' as CA\n",
- cafile_srv);
char cert[MAX_PEM_SIZE];
char key[MAX_PEM_SIZE];
size_t key_buf_size;
size_t cert_buf_size;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Using `%s' as CA\n",
+ cafile_srv);
gnutls_global_init ();
gnutls_x509_crt_init (&proxy_cert);
gnutls_x509_privkey_init (&proxy_key);
@@ -558,11 +558,13 @@ main (int argc, char *const *argv)
GNUNET_log_setup ("gnunet-gns-proxy-test",
"WARNING",
NULL);
- if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv,
- "gnunet-gns-proxy-test",
- _ ("GNUnet GNS proxy test"),
- options,
- &run, NULL))
+ if (GNUNET_OK !=
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv,
+ "gnunet-gns-proxy-test",
+ _ ("GNUnet GNS proxy test"),
+ options,
+ &run, NULL))
return 1;
return global_ret;
}
diff --git a/src/service/hostlist/gnunet-daemon-hostlist.c
b/src/service/hostlist/gnunet-daemon-hostlist.c
index 24bbcb9dc..3122e1219 100644
--- a/src/service/hostlist/gnunet-daemon-hostlist.c
+++ b/src/service/hostlist/gnunet-daemon-hostlist.c
@@ -385,7 +385,8 @@ main (int argc, char *const *argv)
GNUNET_log_setup ("hostlist", "WARNING", NULL);
ret =
(GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv,
"hostlist",
_ ("GNUnet hostlist server and client"),
options,
diff --git a/src/service/identity/gnunet-service-identity.c
b/src/service/identity/gnunet-service-identity.c
index 7ac4bf2b9..4f1cdfa16 100644
--- a/src/service/identity/gnunet-service-identity.c
+++ b/src/service/identity/gnunet-service-identity.c
@@ -247,8 +247,8 @@ create_update_message (struct Ego *ego)
um->key_len = htons (key_len);
GNUNET_memcpy (&um[1], ego->identifier, name_len);
GNUNET_CRYPTO_write_private_key_to_buffer (&ego->pk,
- ((char*) &um[1]) + name_len,
- key_len);
+ ((char*) &um[1]) + name_len,
+ key_len);
return env;
}
@@ -431,8 +431,8 @@ notify_listeners (struct Ego *ego)
um->key_len = htons (key_len);
GNUNET_memcpy (&um[1], ego->identifier, name_len);
GNUNET_CRYPTO_write_private_key_to_buffer (&ego->pk,
- ((char*) &um[1]) + name_len,
- key_len);
+ ((char*) &um[1]) + name_len,
+ key_len);
GNUNET_notification_context_broadcast (nc, &um->header, GNUNET_NO);
GNUNET_free (um);
}
@@ -498,10 +498,10 @@ handle_create_message (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREATE message from
client\n");
key_len = ntohs (crm->key_len);
if ((GNUNET_SYSERR ==
- GNUNET_CRYPTO_read_private_key_from_buffer (&crm[1],
- key_len,
- &private_key,
- &kb_read)) ||
+ GNUNET_CRYPTO_read_private_key_from_buffer (&crm[1],
+ key_len,
+ &private_key,
+ &kb_read)) ||
(kb_read != key_len))
{
GNUNET_SERVICE_client_drop (client);
@@ -969,7 +969,8 @@ run (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Loading subsystem configuration `%s'\n",
subsystem_cfg_file);
- subsystem_cfg = GNUNET_CONFIGURATION_create ();
+ subsystem_cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet
())
+ ;
if ((GNUNET_YES == GNUNET_DISK_file_test (subsystem_cfg_file)) &&
(GNUNET_OK !=
GNUNET_CONFIGURATION_parse (subsystem_cfg, subsystem_cfg_file)))
diff --git a/src/service/messenger/gnunet-service-messenger.c
b/src/service/messenger/gnunet-service-messenger.c
index 324edd767..26ff9023b 100644
--- a/src/service/messenger/gnunet-service-messenger.c
+++ b/src/service/messenger/gnunet-service-messenger.c
@@ -22,15 +22,15 @@
* @file src/messenger/gnunet-service-messenger.c
* @brief GNUnet MESSENGER service
*/
-
+#include "platform.h"
+#include "gnunet_util_lib.h"
#include "gnunet-service-messenger.h"
-
#include "gnunet-service-messenger_handle.h"
#include "gnunet-service-messenger_room.h"
#include "gnunet-service-messenger_service.h"
-#include "gnunet_common.h"
#include "messenger_api_message.h"
+
struct GNUNET_MESSENGER_Client
{
struct GNUNET_SERVICE_Client *client;
@@ -46,7 +46,7 @@ handle_create (void *cls,
struct GNUNET_MESSENGER_Client *msg_client;
GNUNET_assert (cls);
-
+
msg_client = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Handle created\n");
@@ -62,7 +62,7 @@ handle_destroy (void *cls,
struct GNUNET_MESSENGER_Client *msg_client;
GNUNET_assert (cls);
-
+
msg_client = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Handle destroyed\n");
@@ -210,7 +210,7 @@ handle_room_entry (void *cls,
initialize_handle_via_key (msg_client->handle, msg);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Entering room: %s, %s\n", GNUNET_h2s (
- &(msg->key)), GNUNET_i2s (&(msg->door)));
+ &(msg->key)), GNUNET_i2s (&(msg->door)));
if (GNUNET_YES == entry_srv_handle_room (msg_client->handle, &(msg->door),
&(msg->key)))
@@ -290,7 +290,7 @@ handle_room_sync (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Syncing room: %s\n", GNUNET_h2s (
&(msg->key)));
-
+
{
struct GNUNET_HashCode prev;
struct GNUNET_MESSENGER_RoomMessage *response;
@@ -372,7 +372,7 @@ handle_send_message (void *cls,
uint16_t msg_length;
GNUNET_assert ((cls) && (msg));
-
+
msg_client = cls;
key = &(msg->key);
@@ -388,7 +388,8 @@ handle_send_message (void *cls,
GNUNET_h2s (key),
GNUNET_sh2s (&(message.header.sender_id)));
- if (GNUNET_YES != send_srv_handle_message (msg_client->handle, key,
&message))
+ if (GNUNET_YES != send_srv_handle_message (msg_client->handle, key,
&message
+ ))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Sending message failed: %s to
%s\n",
GNUNET_MESSENGER_name_of_kind (message.header.kind),
GNUNET_h2s (key));
@@ -410,7 +411,7 @@ callback_found_message (void *cls,
struct GNUNET_MESSENGER_SenderSession session;
GNUNET_assert ((cls) && (room) && (hash));
-
+
msg_client = cls;
if (! message)
@@ -433,7 +434,7 @@ callback_found_message (void *cls,
if (GNUNET_YES == is_peer_message (message))
{
struct GNUNET_MESSENGER_PeerStore *store;
-
+
store = get_srv_room_peer_store (room);
session.peer = get_store_peer_of (store, message, hash);
@@ -449,7 +450,7 @@ callback_found_message (void *cls,
{
struct GNUNET_MESSENGER_MemberStore *store;
struct GNUNET_MESSENGER_Member *member;
-
+
store = get_srv_room_member_store (room);
member = get_store_member_of (store, message);
@@ -488,7 +489,7 @@ handle_get_message (void *cls,
struct GNUNET_MESSENGER_MemberSession *session;
GNUNET_assert ((cls) && (msg));
-
+
msg_client = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requesting message from room: %s\n",
@@ -509,7 +510,7 @@ handle_get_message (void *cls,
struct GNUNET_MESSENGER_MemberStore *member_store;
member_store = get_srv_room_member_store (room);
-
+
member_id = get_srv_handle_member_id (msg_client->handle,
&(msg->key));
@@ -560,7 +561,7 @@ callback_client_connect (void *cls,
struct GNUNET_MESSENGER_Client *msg_client;
GNUNET_assert ((client) && (mq));
-
+
msg_client = GNUNET_new (struct GNUNET_MESSENGER_Client);
msg_client->client = client;
@@ -578,7 +579,7 @@ callback_client_disconnect (void *cls,
struct GNUNET_MESSENGER_Client *msg_client;
GNUNET_assert (internal_cls);
-
+
msg_client = internal_cls;
remove_service_handle (messenger, msg_client->handle);
@@ -600,7 +601,7 @@ run (void *cls,
struct GNUNET_SERVICE_Handle *service)
{
GNUNET_assert ((config) && (service));
-
+
messenger = create_service (config, service);
if (! messenger)
diff --git a/src/service/messenger/gnunet-service-messenger_member.c
b/src/service/messenger/gnunet-service-messenger_member.c
index f3d72efda..56481fb1f 100644
--- a/src/service/messenger/gnunet-service-messenger_member.c
+++ b/src/service/messenger/gnunet-service-messenger_member.c
@@ -81,7 +81,7 @@ iterate_destroy_subscription (void *cls,
struct GNUNET_MESSENGER_Subscription *subscription;
GNUNET_assert (value);
-
+
subscription = value;
destroy_subscription (subscription);
@@ -98,7 +98,7 @@ destroy_member (struct GNUNET_MESSENGER_Member *member)
iterate_destroy_session, NULL);
GNUNET_CONTAINER_multishortmap_iterate (member->subscriptions,
iterate_destroy_subscription, NULL);
-
+
GNUNET_CONTAINER_multihashmap_destroy (member->sessions);
GNUNET_CONTAINER_multishortmap_destroy (member->subscriptions);
@@ -122,7 +122,7 @@ callback_scan_for_sessions (void *cls,
struct GNUNET_MESSENGER_Member *member;
GNUNET_assert ((cls) && (filename));
-
+
member = cls;
if (GNUNET_YES == GNUNET_DISK_directory_test (filename, GNUNET_YES))
@@ -159,7 +159,7 @@ load_member (struct GNUNET_MESSENGER_MemberStore *store,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load member configuration: %s\n",
config_file);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (! cfg)
goto free_config;
@@ -205,7 +205,7 @@ iterate_load_next_session (void *cls,
char *load_dir;
GNUNET_assert ((cls) && (key));
-
+
sessions_directory = cls;
GNUNET_asprintf (&load_dir, "%s%s%c", sessions_directory, GNUNET_h2s (key),
@@ -215,7 +215,7 @@ iterate_load_next_session (void *cls,
struct GNUNET_MESSENGER_MemberSession *session;
GNUNET_assert (value);
-
+
session = value;
if (GNUNET_YES == GNUNET_DISK_directory_test (load_dir, GNUNET_YES))
@@ -253,7 +253,7 @@ iterate_save_session (void *cls,
char *save_dir;
GNUNET_assert ((cls) && (key));
-
+
sessions_directory = cls;
GNUNET_asprintf (&save_dir, "%s%s%c", sessions_directory, GNUNET_h2s (key),
@@ -263,7 +263,7 @@ iterate_save_session (void *cls,
struct GNUNET_MESSENGER_MemberSession *session;
GNUNET_assert (value);
-
+
session = value;
if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) ||
@@ -291,7 +291,7 @@ save_member (struct GNUNET_MESSENGER_Member *member,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Save member configuration: %s\n",
config_file);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (! cfg)
goto free_config;
@@ -319,7 +319,7 @@ free_config:
if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) ||
(GNUNET_OK == GNUNET_DISK_directory_create (save_dir)))
GNUNET_CONTAINER_multihashmap_iterate (member->sessions,
- iterate_save_session, save_dir);
+ iterate_save_session, save_dir);
GNUNET_free (save_dir);
}
@@ -350,7 +350,7 @@ iterate_sync_session_contact (void *cls,
struct GNUNET_MESSENGER_MemberSession *session;
GNUNET_assert (value);
-
+
session = value;
if (session->next)
@@ -421,7 +421,7 @@ try_member_session (struct GNUNET_MESSENGER_Member *member,
struct GNUNET_MESSENGER_MemberSession *session;
GNUNET_assert ((member) && (public_key));
-
+
session = get_member_session (member, public_key);
if (session)
@@ -456,7 +456,7 @@ get_member_session_of (struct GNUNET_MESSENGER_Member
*member,
search.match = NULL;
GNUNET_CONTAINER_multihashmap_iterate (member->sessions,
- iterate_search_session, &search);
+ iterate_search_session, &search);
return search.match;
}
@@ -537,7 +537,7 @@ iterate_member_sessions (struct GNUNET_MESSENGER_Member
*member,
void *cls)
{
struct GNUNET_MESSENGER_ClosureIterateSessions iterate;
-
+
GNUNET_assert ((member) && (member->sessions) && (it));
iterate.it = it;
@@ -557,7 +557,7 @@ add_member_subscription (struct GNUNET_MESSENGER_Member
*member,
GNUNET_assert ((member) && (member->subscriptions) && (subscription));
- discourse = get_subscription_discourse(subscription);
+ discourse = get_subscription_discourse (subscription);
if (GNUNET_OK != GNUNET_CONTAINER_multishortmap_put (
member->subscriptions, discourse, subscription,
@@ -576,9 +576,10 @@ remove_member_subscription (struct GNUNET_MESSENGER_Member
*member,
GNUNET_assert ((member) && (member->subscriptions) && (subscription));
- discourse = get_subscription_discourse(subscription);
+ discourse = get_subscription_discourse (subscription);
- if (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove
(member->subscriptions,
+ if (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove
(member->subscriptions
+ ,
discourse,
subscription))
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -605,6 +606,8 @@ iterate_member_subscriptions (struct
GNUNET_MESSENGER_Member *member,
GNUNET_assert ((member) && (member->subscriptions) && (it));
return GNUNET_CONTAINER_multishortmap_iterate (member->subscriptions,
-
(GNUNET_CONTAINER_ShortmapIterator) it,
+ (
+
GNUNET_CONTAINER_ShortmapIterator)
+ it,
cls);
}
diff --git a/src/service/messenger/gnunet-service-messenger_member_session.c
b/src/service/messenger/gnunet-service-messenger_member_session.c
index d65e61cdc..79c818d11 100644
--- a/src/service/messenger/gnunet-service-messenger_member_session.c
+++ b/src/service/messenger/gnunet-service-messenger_member_session.c
@@ -671,7 +671,7 @@ load_member_session (struct GNUNET_MESSENGER_Member *member,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Load session configuration of member: %s\n", config_file);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (! cfg)
goto free_config;
@@ -781,7 +781,7 @@ load_member_session_next (struct
GNUNET_MESSENGER_MemberSession *session,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Load next session configuration of member: %s\n", config_file);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (! cfg)
goto free_config;
@@ -901,7 +901,7 @@ save_member_session (struct GNUNET_MESSENGER_MemberSession
*session,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Save session configuration of member: %s\n", config_file);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (! cfg)
goto free_config;
diff --git a/src/service/messenger/gnunet-service-messenger_operation.c
b/src/service/messenger/gnunet-service-messenger_operation.c
index b733f1df7..e13f5701c 100644
--- a/src/service/messenger/gnunet-service-messenger_operation.c
+++ b/src/service/messenger/gnunet-service-messenger_operation.c
@@ -75,7 +75,7 @@ load_operation (struct GNUNET_MESSENGER_OperationStore *store,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load operation configuration: %s\n",
path);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (! cfg)
return NULL;
@@ -98,7 +98,8 @@ load_operation (struct GNUNET_MESSENGER_OperationStore *store,
{
unsigned long long type_number;
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "operation",
- "type",
&type_number))
+ "type",
&type_number
+ ))
switch (type_number)
{
case GNUNET_MESSENGER_OP_REQUEST:
@@ -160,7 +161,7 @@ save_operation (const struct GNUNET_MESSENGER_Operation *op,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Save operation configuration: %s\n",
path);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (! cfg)
return;
@@ -211,7 +212,7 @@ callback_operation (void *cls)
struct GNUNET_HashCode hash;
GNUNET_assert (cls);
-
+
op = cls;
op->task = NULL;
@@ -230,25 +231,26 @@ callback_operation (void *cls)
case GNUNET_MESSENGER_OP_REQUEST:
break;
case GNUNET_MESSENGER_OP_DELETE:
- {
- if (GNUNET_OK != delete_store_message (get_srv_room_message_store (room),
- &hash))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Deletion of message failed!
(%s)\n",
- GNUNET_h2s (&hash));
+ if (GNUNET_OK != delete_store_message (get_srv_room_message_store (room),
+ &hash))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Deletion of message failed! (%s)\n",
+ GNUNET_h2s (&hash));
+ break;
+ }
+
break;
}
-
- break;
- }
case GNUNET_MESSENGER_OP_MERGE:
- {
- if (! room->host)
- break;
+ {
+ if (! room->host)
+ break;
- send_srv_room_message (room, room->host, create_message_merge (&hash));
- break;
- }
+ send_srv_room_message (room, room->host, create_message_merge (&hash));
+ break;
+ }
default:
break;
}
diff --git a/src/service/messenger/gnunet-service-messenger_service.h
b/src/service/messenger/gnunet-service-messenger_service.h
index bffc0ebf9..e40091474 100644
--- a/src/service/messenger/gnunet-service-messenger_service.h
+++ b/src/service/messenger/gnunet-service-messenger_service.h
@@ -26,10 +26,8 @@
#ifndef GNUNET_SERVICE_MESSENGER_SERVICE_H
#define GNUNET_SERVICE_MESSENGER_SERVICE_H
-#include "gnunet_common.h"
-#include "gnunet_configuration_lib.h"
-#include "gnunet_statistics_service.h"
#include "gnunet_util_lib.h"
+#include "gnunet_statistics_service.h"
#include "gnunet-service-messenger_list_handles.h"
#include "gnunet-service-messenger_sender_session.h"
diff --git a/src/service/namecache/gnunet-service-namecache.c
b/src/service/namecache/gnunet-service-namecache.c
index dce843801..4c39fe9fb 100644
--- a/src/service/namecache/gnunet-service-namecache.c
+++ b/src/service/namecache/gnunet-service-namecache.c
@@ -345,7 +345,8 @@ run (void *cls,
GNUNET_asprintf (&db_lib_name,
"libgnunet_plugin_namecache_%s",
database);
- GSN_database = GNUNET_PLUGIN_load (db_lib_name,
+ GSN_database = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ db_lib_name,
(void *) GSN_cfg);
GNUNET_free (database);
if (NULL == GSN_database)
diff --git a/src/service/namestore/gnunet-service-namestore.c
b/src/service/namestore/gnunet-service-namestore.c
index 80e12bce7..a7779cdae 100644
--- a/src/service/namestore/gnunet-service-namestore.c
+++ b/src/service/namestore/gnunet-service-namestore.c
@@ -1058,8 +1058,12 @@ client_connect_cb (void *cls,
GNUNET_free (nc);
return NULL;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loading %s\n", db_lib_name);
- nc->GSN_database = GNUNET_PLUGIN_load (db_lib_name, (void *) GSN_cfg);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Loading %s\n",
+ db_lib_name);
+ nc->GSN_database = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ db_lib_name,
+ (void *) GSN_cfg);
GNUNET_free (database);
if (NULL == nc->GSN_database)
{
@@ -1070,7 +1074,9 @@ client_connect_cb (void *cls,
return NULL;
}
nc->db_lib_name = GNUNET_strdup (db_lib_name);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loaded %s\n", db_lib_name);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Loaded %s\n",
+ db_lib_name);
return nc;
}
@@ -2753,9 +2759,15 @@ run (void *cls,
GNUNET_SCHEDULER_add_now (&cleanup_task, NULL);
return;
}
- GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_namestore_%s", database);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Loading %s\n", db_lib_name);
- GSN_database = GNUNET_PLUGIN_load (db_lib_name, (void *) cfg);
+ GNUNET_asprintf (&db_lib_name,
+ "libgnunet_plugin_namestore_%s",
+ database);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Loading %s\n",
+ db_lib_name);
+ GSN_database = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ db_lib_name,
+ (void *) cfg);
GNUNET_free (database);
if (NULL == GSN_database)
{
diff --git a/src/service/nat-auto/gnunet-service-nat-auto.c
b/src/service/nat-auto/gnunet-service-nat-auto.c
index 03ce8c85d..a1a9a6c40 100644
--- a/src/service/nat-auto/gnunet-service-nat-auto.c
+++ b/src/service/nat-auto/gnunet-service-nat-auto.c
@@ -43,7 +43,7 @@
* How long do we wait until we forcefully terminate autoconfiguration?
*/
#define AUTOCONFIG_TIMEOUT GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_SECONDS, 5)
+ GNUNET_TIME_UNIT_SECONDS, 5)
/**
@@ -306,7 +306,7 @@ handle_autoconfig_request (void *cls,
ac = GNUNET_new (struct AutoconfigContext);
ac->status_code = GNUNET_NAT_ERROR_SUCCESS;
ac->ch = ch;
- ac->c = GNUNET_CONFIGURATION_create ();
+ ac->c = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (GNUNET_OK !=
GNUNET_CONFIGURATION_deserialize (ac->c,
(const char *) &message[1],
@@ -468,7 +468,7 @@ GNUNET_SERVICE_MAIN
#if defined(__linux__) && defined(__GLIBC__)
#include <malloc.h>
-void __attribute__((constructor)) GNUNET_NAT_memory_init(void);
+void __attribute__((constructor)) GNUNET_NAT_memory_init (void);
/**
* MINIMIZE heap size (way below 128k) since this process doesn't need much.
diff --git a/src/service/nat-auto/nat_auto_api.c
b/src/service/nat-auto/nat_auto_api.c
index cbedc96ef..deab786dc 100644
--- a/src/service/nat-auto/nat_auto_api.c
+++ b/src/service/nat-auto/nat_auto_api.c
@@ -165,7 +165,7 @@ handle_auto_result (void *cls,
enum GNUNET_NAT_StatusCode status = ntohl (res->status_code);
left = ntohs (res->header.size) - sizeof(*res);
- cfg = GNUNET_CONFIGURATION_create ();
+ cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
if (GNUNET_OK !=
GNUNET_CONFIGURATION_deserialize (cfg,
(const char *) &res[1],
diff --git a/src/service/nat/gnunet-service-nat_helper.c
b/src/service/nat/gnunet-service-nat_helper.c
index d92f5a99c..2c235ba65 100644
--- a/src/service/nat/gnunet-service-nat_helper.c
+++ b/src/service/nat/gnunet-service-nat_helper.c
@@ -172,7 +172,8 @@ nat_server_read (void *cls)
/* should we restart gnunet-helper-nat-server? */
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_ (
- "gnunet-helper-nat-server generated malformed address
`%s'\n"),
+ "gnunet-helper-nat-server generated malformed address
`%s'\n")
+ ,
mybuf);
h->server_read_task =
GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
@@ -212,8 +213,13 @@ restart_nat_server (void *cls)
GNUNET_assert (NULL !=
inet_ntop (AF_INET, &h->internal_address, ia, sizeof(ia)));
/* Start the server process */
- binary = GNUNET_OS_get_suid_binary_path (h->cfg, "gnunet-helper-nat-server");
- if (GNUNET_YES != GNUNET_OS_check_helper_binary (binary, GNUNET_YES, ia))
+ binary = GNUNET_OS_get_suid_binary_path (GNUNET_OS_project_data_gnunet (),
+ h->cfg,
+ "gnunet-helper-nat-server");
+ if (GNUNET_YES !=
+ GNUNET_OS_check_helper_binary (binary,
+ GNUNET_YES,
+ ia))
{
/* move instantly to max delay, as this is unlikely to be fixed */
h->server_retry_delay = GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD;
@@ -366,7 +372,9 @@ GN_request_connection_reversal (const struct in_addr
*internal_address,
intv4,
remv4,
internal_port);
- binary = GNUNET_OS_get_suid_binary_path (cfg, "gnunet-helper-nat-client");
+ binary = GNUNET_OS_get_suid_binary_path (GNUNET_OS_project_data_gnunet (),
+ cfg,
+ "gnunet-helper-nat-client");
proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_NONE,
NULL,
NULL,
diff --git a/src/service/peerstore/gnunet-service-peerstore.c
b/src/service/peerstore/gnunet-service-peerstore.c
index 8dcbd726e..dc24a5c4f 100644
--- a/src/service/peerstore/gnunet-service-peerstore.c
+++ b/src/service/peerstore/gnunet-service-peerstore.c
@@ -1216,8 +1216,12 @@ run (void *cls,
GNUNET_SCHEDULER_shutdown ();
return;
}
- GNUNET_asprintf (&db_lib_name, "libgnunet_plugin_peerstore_%s", database);
- db = GNUNET_PLUGIN_load (db_lib_name, (void *) cfg);
+ GNUNET_asprintf (&db_lib_name,
+ "libgnunet_plugin_peerstore_%s",
+ database);
+ db = GNUNET_PLUGIN_load (GNUNET_OS_project_data_gnunet (),
+ db_lib_name,
+ (void *) cfg);
GNUNET_free (database);
if (NULL == db)
{
@@ -1236,7 +1240,8 @@ run (void *cls,
use_included = GNUNET_NO;
if (GNUNET_YES == use_included)
{
- ip = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
+ ip = GNUNET_OS_installation_get_path (GNUNET_OS_project_data_gnunet (),
+ GNUNET_OS_IPK_DATADIR);
GNUNET_asprintf (&peerdir, "%shellos", ip);
GNUNET_free (ip);
diff --git a/src/service/pt/gnunet-daemon-pt.c
b/src/service/pt/gnunet-daemon-pt.c
index cbb639d5d..99265f8bf 100644
--- a/src/service/pt/gnunet-daemon-pt.c
+++ b/src/service/pt/gnunet-daemon-pt.c
@@ -1302,7 +1302,8 @@ main (int argc,
int ret;
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-daemon-pt",
gettext_noop (
diff --git a/src/service/reclaim/gnunet-service-reclaim.c
b/src/service/reclaim/gnunet-service-reclaim.c
index 13cef4ba2..ead8e55a6 100644
--- a/src/service/reclaim/gnunet-service-reclaim.c
+++ b/src/service/reclaim/gnunet-service-reclaim.c
@@ -22,6 +22,7 @@
* @file src/reclaim/gnunet-service-reclaim.c
* @brief reclaim Service
*/
+#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet-service-reclaim_tickets.h"
#include "gnunet_gnsrecord_lib.h"
diff --git a/src/service/reclaim/reclaim_attribute.c
b/src/service/reclaim/reclaim_attribute.c
index f4978143b..f85059fd6 100644
--- a/src/service/reclaim/reclaim_attribute.c
+++ b/src/service/reclaim/reclaim_attribute.c
@@ -96,13 +96,14 @@ init ()
if (GNUNET_YES == initialized)
return;
initialized = GNUNET_YES;
- GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (),
- "libgnunet_plugin_reclaim_attribute_",
- NULL,
- &add_plugin,
- NULL);
+ GNUNET_PLUGIN_load_all (GNUNET_OS_project_data_gnunet (),
+ "libgnunet_plugin_reclaim_attribute_",
+ NULL,
+ &add_plugin,
+ NULL);
}
+
void RECLAIM_ATTRIBUTE_fini (void);
/**
@@ -112,11 +113,6 @@ void __attribute__ ((destructor))
RECLAIM_ATTRIBUTE_fini (void)
{
struct Plugin *plugin;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
- const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default ();
-
- if (pd != dpd)
- GNUNET_OS_init (dpd);
for (unsigned int i = 0; i < num_plugins; i++)
{
@@ -128,15 +124,10 @@ RECLAIM_ATTRIBUTE_fini (void)
GNUNET_free (plugin);
}
GNUNET_free (attr_plugins);
-
- if (pd != dpd)
- GNUNET_OS_init (pd);
-
attr_plugins = NULL;
}
-
/**
* Convert a type name to the corresponding number
*
@@ -525,7 +516,7 @@ GNUNET_RECLAIM_attribute_deserialize (const char *data,
size_t data_size,
return -1;
}
attribute = GNUNET_malloc (sizeof(struct GNUNET_RECLAIM_Attribute)
- + data_len + name_len + 1);
+ + data_len + name_len + 1);
attribute->type = ntohl (attr_ser->attribute_type);
attribute->flag = ntohl (attr_ser->attribute_flag);
attribute->id = attr_ser->attribute_id;
@@ -539,7 +530,7 @@ GNUNET_RECLAIM_attribute_deserialize (const char *data,
size_t data_size,
write_ptr += name_len + 1;
GNUNET_memcpy (write_ptr, (char *) &attr_ser[1] + name_len,
- attribute->data_size);
+ attribute->data_size);
*attr = attribute;
attribute->data = write_ptr;
return sizeof(struct Attribute) + data_len + name_len;
diff --git a/src/service/reclaim/reclaim_credential.c
b/src/service/reclaim/reclaim_credential.c
index 947c9f349..cdfb95cf5 100644
--- a/src/service/reclaim/reclaim_credential.c
+++ b/src/service/reclaim/reclaim_credential.c
@@ -95,11 +95,11 @@ init ()
if (GNUNET_YES == initialized)
return;
initialized = GNUNET_YES;
- GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (),
- "libgnunet_plugin_reclaim_credential_",
- NULL,
- &add_plugin,
- NULL);
+ GNUNET_PLUGIN_load_all (GNUNET_OS_project_data_gnunet (),
+ "libgnunet_plugin_reclaim_credential_",
+ NULL,
+ &add_plugin,
+ NULL);
}
@@ -113,11 +113,6 @@ void __attribute__ ((destructor))
RECLAIM_CREDENTIAL_fini (void)
{
struct Plugin *plugin;
- const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
- const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default ();
-
- if (pd != dpd)
- GNUNET_OS_init (dpd);
for (unsigned int i = 0; i < num_plugins; i++)
{
@@ -129,10 +124,6 @@ RECLAIM_CREDENTIAL_fini (void)
GNUNET_free (plugin);
}
GNUNET_free (credential_plugins);
-
- if (pd != dpd)
- GNUNET_OS_init (pd);
-
credential_plugins = NULL;
}
diff --git a/src/service/regex/gnunet-daemon-regexprofiler.c
b/src/service/regex/gnunet-daemon-regexprofiler.c
index 80ec1bf94..3dcfe9e3c 100644
--- a/src/service/regex/gnunet-daemon-regexprofiler.c
+++ b/src/service/regex/gnunet-daemon-regexprofiler.c
@@ -376,7 +376,8 @@ main (int argc, char *const *argv)
};
return (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc, argv, "regexprofiler",
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc, argv, "regexprofiler",
gettext_noop
(
"Daemon to announce regular expressions for
the peer using cadet."),
diff --git a/src/service/rest/config_plugin.c b/src/service/rest/config_plugin.c
index 9a3d5a069..fc1c1d904 100644
--- a/src/service/rest/config_plugin.c
+++ b/src/service/rest/config_plugin.c
@@ -329,9 +329,10 @@ set_cont (struct GNUNET_REST_RequestHandle *con_handle,
"%s%s%s",
xdg,
DIR_SEPARATOR_STR,
- GNUNET_OS_project_data_get ()->config_file);
+ GNUNET_OS_project_data_gnunet ()->config_file);
else
- cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file);
+ cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_gnunet
()->user_config_file
+ );
}
GNUNET_CONFIGURATION_write (out, cfg_fn);
diff --git a/src/service/setu/gnunet-setu-ibf-profiler.c
b/src/service/setu/gnunet-setu-ibf-profiler.c
index 6465b15b8..e20fb39bc 100644
--- a/src/service/setu/gnunet-setu-ibf-profiler.c
+++ b/src/service/setu/gnunet-setu-ibf-profiler.c
@@ -296,7 +296,8 @@ main (int argc, char **argv)
GNUNET_GETOPT_OPTION_END
};
- GNUNET_PROGRAM_run2 (argc,
+ GNUNET_PROGRAM_run2 (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-consensus-ibf",
"help",
diff --git a/src/service/statistics/test_statistics_api.c
b/src/service/statistics/test_statistics_api.c
index c9e568870..60c9349db 100644
--- a/src/service/statistics/test_statistics_api.c
+++ b/src/service/statistics/test_statistics_api.c
@@ -195,7 +195,8 @@ main (int argc, char *argv_ign[])
GNUNET_log_setup ("test_statistics_api",
"WARNING",
NULL);
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-statistics");
proc =
GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR
| GNUNET_OS_USE_PIPE_CONTROL,
@@ -204,7 +205,8 @@ main (int argc, char *argv_ign[])
"gnunet-service-statistics",
"-c", "test_statistics_api_data.conf", NULL);
GNUNET_assert (NULL != proc);
- GNUNET_PROGRAM_run (5, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ 5, argv,
"test-statistics-api", "nohelp",
options, &run,
&ok);
@@ -232,7 +234,8 @@ main (int argc, char *argv_ign[])
"gnunet-service-statistics",
"-c", "test_statistics_api_data.conf",
NULL);
- GNUNET_PROGRAM_run (5, argv,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ 5, argv,
"test-statistics-api", "nohelp",
options,
&run_more, &ok);
diff --git a/src/service/statistics/test_statistics_api_loop.c
b/src/service/statistics/test_statistics_api_loop.c
index ad273287d..91ab04c91 100644
--- a/src/service/statistics/test_statistics_api_loop.c
+++ b/src/service/statistics/test_statistics_api_loop.c
@@ -96,7 +96,8 @@ main (int argc, char *argv_ign[])
struct GNUNET_OS_Process *proc;
char *binary;
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-statistics");
proc =
GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR
| GNUNET_OS_USE_PIPE_CONTROL,
@@ -105,9 +106,11 @@ main (int argc, char *argv_ign[])
"gnunet-service-statistics",
"-c", "test_statistics_api_data.conf", NULL);
GNUNET_assert (NULL != proc);
- GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", options, &run,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ 3, argv, "test-statistics-api", "nohelp", options, &run,
&ok);
- if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
+ if (0 != GNUNET_OS_process_kill (proc,
+ GNUNET_TERM_SIG))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
ok = 1;
diff --git a/src/service/statistics/test_statistics_api_watch.c
b/src/service/statistics/test_statistics_api_watch.c
index 2d9d08305..4fb8e6e7b 100644
--- a/src/service/statistics/test_statistics_api_watch.c
+++ b/src/service/statistics/test_statistics_api_watch.c
@@ -128,7 +128,8 @@ main (int argc, char *argv_ign[])
struct GNUNET_OS_Process *proc;
char *binary;
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-statistics");
proc =
GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR
| GNUNET_OS_USE_PIPE_CONTROL,
@@ -138,7 +139,9 @@ main (int argc, char *argv_ign[])
"-c", "test_statistics_api_data.conf", NULL);
GNUNET_assert (NULL != proc);
ok = 3;
- GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", options, &run,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ 3, argv, "test-statistics-api", "nohelp", options,
+ &run,
NULL);
if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
{
diff --git a/src/service/statistics/test_statistics_api_watch_zero_value.c
b/src/service/statistics/test_statistics_api_watch_zero_value.c
index cb2694f8f..73d916d7b 100644
--- a/src/service/statistics/test_statistics_api_watch_zero_value.c
+++ b/src/service/statistics/test_statistics_api_watch_zero_value.c
@@ -166,7 +166,8 @@ main (int argc, char *argv_ign[])
struct GNUNET_OS_Process *proc;
char *binary;
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-statistics");
proc =
GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR
| GNUNET_OS_USE_PIPE_CONTROL,
@@ -177,7 +178,8 @@ main (int argc, char *argv_ign[])
GNUNET_assert (NULL != proc);
ok = 3;
ok2 = 1;
- GNUNET_PROGRAM_run (3, argv, "test-statistics-api", "nohelp", options, &run,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ 3, argv, "test-statistics-api", "nohelp", options, &run,
NULL);
if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
{
diff --git a/src/service/testbed/gnunet-testbed.c
b/src/service/testbed/gnunet-testbed.c
index f96a1014a..ed2798400 100644
--- a/src/service/testbed/gnunet-testbed.c
+++ b/src/service/testbed/gnunet-testbed.c
@@ -64,7 +64,7 @@ create_unique_cfgs (const char *template,
create_cfg_template);
return 1;
}
- cfg_tmpl = GNUNET_CONFIGURATION_create ();
+ cfg_tmpl = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
/* load template */
if ((create_cfg_template != NULL) &&
@@ -206,7 +206,8 @@ main (int argc, char *const *argv)
ret =
(GNUNET_OK ==
- GNUNET_PROGRAM_run2 (argc,
+ GNUNET_PROGRAM_run2 (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-testing",
gettext_noop (
diff --git a/src/service/testbed/test_testbed_portreservation.c
b/src/service/testbed/test_testbed_portreservation.c
index 90e0f9f57..8102d89d2 100644
--- a/src/service/testbed/test_testbed_portreservation.c
+++ b/src/service/testbed/test_testbed_portreservation.c
@@ -89,7 +89,8 @@ main (int argc, char *argv[])
status = GNUNET_SYSERR;
if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"test_testbed_new_portreservation",
"test case for testing port reservation routines"
diff --git a/src/service/topology/gnunet-daemon-topology.c
b/src/service/topology/gnunet-daemon-topology.c
index e99fd83f0..ab045865a 100644
--- a/src/service/topology/gnunet-daemon-topology.c
+++ b/src/service/topology/gnunet-daemon-topology.c
@@ -1082,13 +1082,15 @@ main (int argc, char *const *argv)
};
int ret;
- ret = (GNUNET_OK == GNUNET_PROGRAM_run (argc,
- argv,
- "gnunet-daemon-topology",
- _ ("GNUnet topology control"),
- options,
- &run,
- NULL))
+ ret = (GNUNET_OK ==
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
+ argv,
+ "gnunet-daemon-topology",
+ _ ("GNUnet topology control"),
+ options,
+ &run,
+ NULL))
? 0
: 1;
return ret;
diff --git a/src/service/transport/gnunet-communicator-http3.c
b/src/service/transport/gnunet-communicator-http3.c
index 2e8511f8e..c6035b86f 100644
--- a/src/service/transport/gnunet-communicator-http3.c
+++ b/src/service/transport/gnunet-communicator-http3.c
@@ -704,7 +704,8 @@ remove_stream (struct Connection *connection, int64_t
stream_id)
if (GNUNET_NO == rv)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "can't remove non-exist pair in connection->streams, stream_id
= %"PRIi64"\n",
+ "can't remove non-exist pair in connection->streams, stream_id
= %"
+ PRIi64 "\n",
stream_id);
return;
}
@@ -1997,7 +1998,8 @@ setup_httpconn (struct Connection *connection)
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Bind control stream: %"PRIi64", enc stream: %"PRIi64", dec
stream: %"PRIi64"\n",
+ "Bind control stream: %" PRIi64 ", enc stream: %" PRIi64
+ ", dec stream: %" PRIi64 "\n",
ctrl_stream_id, enc_stream_id, dec_stream_id);
return GNUNET_NO;
}
@@ -2102,7 +2104,7 @@ stream_close_cb (ngtcp2_conn *conn, uint32_t flags,
int64_t stream_id,
void *stream_user_data)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "stream_close id = %"PRIi64"\n",
+ "stream_close id = %" PRIi64 "\n",
stream_id);
struct Connection *connection = user_data;
int rv;
@@ -3925,7 +3927,8 @@ main (int argc, char *const *argv)
"transport",
"Starting http3 communicator\n");
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-communicator-http3",
_ ("GNUnet HTTP3 communicator"),
diff --git a/src/service/transport/gnunet-communicator-tcp.c
b/src/service/transport/gnunet-communicator-tcp.c
index e2f6b185c..e8c69de55 100644
--- a/src/service/transport/gnunet-communicator-tcp.c
+++ b/src/service/transport/gnunet-communicator-tcp.c
@@ -4220,7 +4220,8 @@ main (int argc, char *const *argv)
"Starting tcp communicator\n");
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-communicator-tcp",
_ ("GNUnet TCP communicator"),
diff --git a/src/service/transport/gnunet-communicator-unix.c
b/src/service/transport/gnunet-communicator-unix.c
index 8af202423..c4957d4fe 100644
--- a/src/service/transport/gnunet-communicator-unix.c
+++ b/src/service/transport/gnunet-communicator-unix.c
@@ -1129,7 +1129,8 @@ main (int argc, char *const *argv)
int ret;
ret = (GNUNET_OK ==
- GNUNET_PROGRAM_run (argc,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ argc,
argv,
"gnunet-communicator-unix",
_ ("GNUnet UNIX domain socket communicator"),
diff --git a/src/service/transport/test_communicator_basic.c
b/src/service/transport/test_communicator_basic.c
index 4042ed8ab..8da8bcfe5 100644
--- a/src/service/transport/test_communicator_basic.c
+++ b/src/service/transport/test_communicator_basic.c
@@ -1174,7 +1174,8 @@ main (int argc,
"test_communicator_%s_%s_peer%u.conf",
communicator_name, test_mode, i + 1);
cfg_peers_name[i] = cfg_peer;
- cfg_peers[i] = GNUNET_CONFIGURATION_create ();
+ cfg_peers[i] = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet
()
+ );
if (GNUNET_YES ==
GNUNET_DISK_file_test (cfg_peers_name[i]))
{
diff --git a/src/service/transport/transport-testing-communicator.c
b/src/service/transport/transport-testing-communicator.c
index fb7c4eb0c..a55ee6474 100644
--- a/src/service/transport/transport-testing-communicator.c
+++ b/src/service/transport/transport-testing-communicator.c
@@ -748,7 +748,8 @@ transport_communicator_start (
};
- tc_h->sh = GNUNET_SERVICE_start ("transport",
+ tc_h->sh = GNUNET_SERVICE_start (GNUNET_OS_project_data_gnunet (),
+ "transport",
tc_h->cfg,
&connect_cb,
&disconnect_cb,
@@ -846,7 +847,8 @@ communicator_start (
loprefix = GNUNET_strdup ("");
- binary = GNUNET_OS_get_libexec_binary_path (binary_name);
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ binary_name);
tc_h->c_proc = GNUNET_OS_start_process_s (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
NULL,
loprefix,
@@ -903,7 +905,8 @@ resolver_start (struct
char *binary;
LOG (GNUNET_ERROR_TYPE_DEBUG, "resolver_start\n");
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-resolver");
tc_h->resolver_proc = GNUNET_OS_start_process (
GNUNET_OS_INHERIT_STD_OUT_AND_ERR
| GNUNET_OS_USE_PIPE_CONTROL,
@@ -936,7 +939,8 @@ statistics_start (
{
char *binary;
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-statistics");
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-statistics");
tc_h->stat_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
NULL,
NULL,
@@ -966,7 +970,8 @@ peerstore_start (
{
char *binary;
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-peerstore");
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-peerstore");
tc_h->ps_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
NULL,
NULL,
@@ -997,7 +1002,8 @@ nat_start (
char *binary;
LOG (GNUNET_ERROR_TYPE_DEBUG, "nat_start\n");
- binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-nat");
+ binary = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-nat");
tc_h->nat_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR
| GNUNET_OS_USE_PIPE_CONTROL,
NULL,
@@ -1053,8 +1059,10 @@
GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
tc_h =
GNUNET_new (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle);
tc_h->cfg_filename = GNUNET_strdup (cfg_filename);
- tc_h->cfg = GNUNET_CONFIGURATION_create ();
- if ((GNUNET_SYSERR == GNUNET_CONFIGURATION_load (tc_h->cfg, cfg_filename)))
+ tc_h->cfg = GNUNET_CONFIGURATION_create (GNUNET_OS_project_data_gnunet ());
+ if ((GNUNET_SYSERR ==
+ GNUNET_CONFIGURATION_load (tc_h->cfg,
+ cfg_filename)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_ ("Malformed configuration file `%s', exit ...\n"),
diff --git a/src/service/util/test_resolver_api.c
b/src/service/util/test_resolver_api.c
index f5b6dde72..7ff21c1ed 100644
--- a/src/service/util/test_resolver_api.c
+++ b/src/service/util/test_resolver_api.c
@@ -350,7 +350,8 @@ main (int argc, char *argv[])
GNUNET_log_setup ("test-resolver-api",
"WARNING",
NULL);
- fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
+ fn = GNUNET_OS_get_libexec_binary_path (GNUNET_OS_project_data_gnunet (),
+ "gnunet-service-resolver");
proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR
| GNUNET_OS_USE_PIPE_CONTROL,
NULL, NULL, NULL,
@@ -360,12 +361,16 @@ main (int argc, char *argv[])
GNUNET_assert (NULL != proc);
GNUNET_free (fn);
GNUNET_assert (GNUNET_OK ==
- GNUNET_PROGRAM_run ((sizeof(argvx) / sizeof(char *)) - 1,
+ GNUNET_PROGRAM_run (GNUNET_OS_project_data_gnunet (),
+ (sizeof(argvx) / sizeof(char *)) - 1,
argvx, "test-resolver-api", "nohelp",
- options, &run, &ok));
- if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
+ options,
+ &run, &ok));
+ if (0 != GNUNET_OS_process_kill (proc,
+ GNUNET_TERM_SIG))
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+ "kill");
ok = 1;
}
GNUNET_OS_process_wait (proc);
diff --git a/src/service/vpn/gnunet-service-vpn.c
b/src/service/vpn/gnunet-service-vpn.c
index b94c7786a..f9d23f3da 100644
--- a/src/service/vpn/gnunet-service-vpn.c
+++ b/src/service/vpn/gnunet-service-vpn.c
@@ -1502,10 +1502,11 @@ create_channel_to_destination (struct
DestinationChannel *dt, int client_af)
case AF_INET: {
char address[GNUNET_TUN_IPV4_REGEXLEN];
- GNUNET_REGEX_ipv4toregexsearch
(&dt->destination->details.exit_destination
- .ip.v4,
- dt->destination_port,
- address);
+ GNUNET_REGEX_ipv4toregexsearch (&dt->destination->details.
+ exit_destination
+ .ip.v4,
+ dt->destination_port,
+ address);
GNUNET_asprintf (&policy,
"%s%s",
GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX,
@@ -1516,10 +1517,11 @@ create_channel_to_destination (struct
DestinationChannel *dt, int client_af)
case AF_INET6: {
char address[GNUNET_TUN_IPV6_REGEXLEN];
- GNUNET_REGEX_ipv6toregexsearch
(&dt->destination->details.exit_destination
- .ip.v6,
- dt->destination_port,
- address);
+ GNUNET_REGEX_ipv6toregexsearch (&dt->destination->details.
+ exit_destination
+ .ip.v6,
+ dt->destination_port,
+ address);
GNUNET_asprintf (&policy,
"%s%s",
GNUNET_APPLICATION_TYPE_EXIT_REGEX_PREFIX,
@@ -2407,7 +2409,8 @@ allocate_v4_address (struct in_addr *v4)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_ (
- "Failed to find unallocated IPv4 address in VPN's
range\n"));
+ "Failed to find unallocated IPv4 address in VPN's
range\n"))
+ ;
return GNUNET_SYSERR;
}
/* Pick random IPv4 address within the subnet, except 'addr' or 'mask'
itself */
@@ -2459,7 +2462,8 @@ allocate_v6_address (struct in6_addr *v6)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_ (
- "Failed to find unallocated IPv6 address in VPN's
range\n"));
+ "Failed to find unallocated IPv6 address in VPN's
range\n"))
+ ;
return GNUNET_SYSERR;
}
for (i = 0; i < 16; i++)
@@ -2940,7 +2944,9 @@ run (void *cls,
char *binary;
cfg = cfg_;
- binary = GNUNET_OS_get_suid_binary_path (cfg, "gnunet-helper-vpn");
+ binary = GNUNET_OS_get_suid_binary_path (GNUNET_OS_project_data_gnunet (),
+ cfg,
+ "gnunet-helper-vpn");
if (GNUNET_YES !=
GNUNET_OS_check_helper_binary (
@@ -3012,21 +3018,25 @@ run (void *cls,
}
vpn_argv[2] = ipv6addr;
ipv6prefix_s = NULL;
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
- "VPN",
- "IPV6PREFIX",
- &ipv6prefix_s))
+ if (GNUNET_SYSERR ==
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "VPN",
+ "IPV6PREFIX",
+ &ipv6prefix_s))
{
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, "VPN", "IPV6PREFIX");
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "VPN",
+ "IPV6PREFIX");
GNUNET_SCHEDULER_shutdown ();
GNUNET_free (ipv6prefix_s);
return;
}
vpn_argv[3] = ipv6prefix_s;
- if ((GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
- "VPN",
- "IPV6PREFIX",
- &ipv6prefix)) ||
+ if ((GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg,
+ "VPN",
+ "IPV6PREFIX",
+ &ipv6prefix)) ||
(ipv6prefix >= 127))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
@@ -3049,10 +3059,11 @@ run (void *cls,
if (GNUNET_OK == GNUNET_NETWORK_test_pf (PF_INET))
{
ipv4addr = NULL;
- if (((GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
- "vpn",
- "IPV4ADDR",
- &ipv4addr))
||
+ if (((GNUNET_SYSERR ==
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "vpn",
+ "IPV4ADDR",
+ &ipv4addr)) ||
(1 != inet_pton (AF_INET, ipv4addr, &v4))))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
@@ -3066,10 +3077,11 @@ run (void *cls,
}
vpn_argv[4] = ipv4addr;
ipv4mask = NULL;
- if (((GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
- "vpn",
- "IPV4MASK",
- &ipv4mask))
||
+ if (((GNUNET_SYSERR ==
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "vpn",
+ "IPV4MASK",
+ &ipv4mask)) ||
(1 != inet_pton (AF_INET, ipv4mask, &v4))))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
@@ -3095,7 +3107,8 @@ run (void *cls,
cadet_handle = GNUNET_CADET_connect (cfg_);
// FIXME never opens ports???
- helper_handle = GNUNET_HELPER_start (GNUNET_NO,
+ helper_handle = GNUNET_HELPER_start (GNUNET_OS_project_data_gnunet (),
+ GNUNET_NO,
binary,
vpn_argv,
&message_token,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: fix #8962 by making project data no longer a global but instead passing it explicitly where required,
gnunet <=