From fd1bcccb9b6063d0501c81323eef81c0dd7a6340 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Fri, 23 Jul 2021 18:20:33 +0200 Subject: 5708: allow gnunet-config to output build config informations With this commit, `gnunet-config' is now able to print some informations about how GNUnet was built through some additional flags (here `--cflags', `--libs' and `--prefix'.) These flags allow `gnunet-config' to behave like other `*-config' tools provided by other applications/libraries, which are used by third-party applications, especially when the tool is provided by a library, to properly compile using the flags recommended by the library/application. In terms of GNUnet, any client or service connecting to any GNUnet service can now be built using some variation of the following: cc $(gnunet-config --cflags) -o my-client client.c $(gnunet-config --libs) --- src/util/Makefile.am | 5 +++++ src/util/gnunet-config.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/src/util/Makefile.am b/src/util/Makefile.am index e720112be..ab66756b4 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -227,6 +227,11 @@ gnunet_config_SOURCES = \ gnunet_config_LDADD = \ libgnunetutil.la \ $(GN_LIBINTL) +gnunet_config_CPPFLAGS = \ + -DINCLUDEDIR=\"$(includedir)\" \ + -DLIBDIR=\"$(libdir)\" \ + -DPREFIX=\"$(prefix)\" \ + $(AM_CPPFLAGS) gnunet_uri_SOURCES = \ gnunet-uri.c diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 3932ff1bf..0a5c0712b 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -74,6 +74,21 @@ static int rewrite; */ static int full; +/** + * If printing the value of CFLAGS has been requested. + */ +static int cflags; + +/** + * If printing the value of LIBS has been requested. + */ +static int libs; + +/** + * If printing the value of PREFIX has been requested. + */ +static int prefix; + /** * Print each option in a given section. @@ -150,6 +165,23 @@ run (void *cls, (void) cls; (void) args; + if (1 == cflags || 1 == libs || 1 == prefix) + { + /* These values are defined in the makefile */ + if (1 == cflags) + { + fprintf (stdout, "%s\n", "-I"INCLUDEDIR); + } + if (1 == libs) + { + fprintf (stdout, "%s\n", "-L"LIBDIR" -lgnunetutil"); + } + if (1 == prefix) + { + fprintf (stdout, "%s\n", PREFIX); + } + return; + } if (NULL != backend_check) { char *name; @@ -364,6 +396,21 @@ main (int argc, char *const *argv) "VALUE", gettext_noop ("value to set"), &value), + GNUNET_GETOPT_option_flag ('C', + "cflags", + gettext_noop ( + "Provide an appropriate value for CFLAGS to applications building on top of GNUnet"), + &cflags), + GNUNET_GETOPT_option_flag ('j', + "libs", + gettext_noop ( + "Provide an appropriate value for LIBS to applications building on top of GNUnet"), + &libs), + GNUNET_GETOPT_option_flag ('p', + "prefix", + gettext_noop ( + "Provide the path under which GNUnet was installed"), + &prefix), GNUNET_GETOPT_OPTION_END }; int ret; -- cgit v1.2.3 From 9bdfda437e180ee9fe6d1e54b201c538086d2c48 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Sat, 24 Jul 2021 16:15:10 +0200 Subject: gnunet-config manpage: Document the new flags --- doc/man/gnunet-config.1 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/doc/man/gnunet-config.1 b/doc/man/gnunet-config.1 index 03f180c29..c749c03b5 100644 --- a/doc/man/gnunet-config.1 +++ b/doc/man/gnunet-config.1 @@ -26,33 +26,44 @@ .Os .Sh NAME .Nm gnunet-config -.Nd manipulate GNUnet configuration files +.Nd manipulate GNUnet configuration files and provide informations on how GNUnet was built .Sh SYNOPSIS .Nm .Op Fl b Ar BACKEND | Fl -supported-backend= Ns Ar BACKEND +.Op Fl C | -cflags .Op Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME +.Op Fl F | -full .Op Fl f | -filename .Op Fl h | -help +.Op Fl j | -libs .Op Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL .Op Fl o Ar OPTION | Fl -option= Ns Ar OPTION +.Op Fl p | -prefix +.Op Fl r | -rewrite .Op Fl S |-list-sections .Op Fl s Ar SECTION | Fl -section= Ns Ar SECTION .Op Fl V Ar VALUE | Fl -value Ar VALUE .Op Fl v | -version -.Op Fl r | -rewrite -.Op Fl F | -full .Sh DESCRIPTION .Nm can be used to read or modify GNUnet configuration files. +It can also provide informations to properly build applications on top of +GNUnet, like appropriate values for CFLAGS or the installation prefix. .Bl -tag -width indent .It Fl b Ar BACKEND | Fl -supported-backend= Ns Ar BACKEND Tests whether the specified BACKEND is supported by the current installation. The backend must match the name of a plugin, e.g. "namestore_postgres" for the Postgres database backend of the "NAMESTORE" service. If the BACKEND is supported, gnunet-config will return a status code of 0 (success), otherwise 77 (unsupported). When this option is specified, no other options may be specified. Specifying this option together with other options will cause gnunet-config to return a status code of 1 (error). +.It Fl C | -cflags +Print an appropriate value for CFLAGS to compile applications on top of GNUnet. .It Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME Use the configuration file FILENAME. +.It Fl F | -full +Write the full configuration, not just the deltas to the defaults. .It Fl f | -filename Try to perform expansions as if the option values represent filenames (will also be applied even if the option is not really a filename). .It Fl h | -help Print short help on options. +.It Fl j | -libs +Print an appropriate value for LIBS to compile applications on top of GNUnet. .It Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL Use LOGLEVEL for logging. Valid values are DEBUG, INFO, WARNING and ERROR. @@ -60,6 +71,10 @@ Valid values are DEBUG, INFO, WARNING and ERROR. Which configuration option should be accessed or edited. Required to set a value. If not given, all values of a given section will be printed in the format "OPTION = VALUE". +.It Fl p | -prefix +Print GNUnet's installation prefix (for example /usr/local.) +.It Fl r | -rewrite +Write the configuration to file, even if it did not change. .It Fl S |-list-sections List available configuration sections for use with --section. .It Fl s Ar SECTION | Fl -section= Ns Ar SECTION @@ -70,10 +85,6 @@ Configuration value to store in the given section under the given option. Must only be given together with -s and -o options. .It Fl v | -version Print GNUnet version number. -.It Fl r | -rewrite -Write the configuration to file, even if it did not change. -.It Fl F | -full -Write the full configuration, not just the deltas to the defaults. .El .Sh SEE ALSO The full documentation for gnunet is maintained as a Texinfo manual. -- cgit v1.2.3 From b474cdc0baffa55b700008d55cded7f11126a063 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Sun, 25 Jul 2021 15:00:51 +0200 Subject: - Do not hardcode values in gnunet-config --- src/util/Makefile.am | 5 ----- src/util/gnunet-config.c | 11 +++++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/util/Makefile.am b/src/util/Makefile.am index ab66756b4..e720112be 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -227,11 +227,6 @@ gnunet_config_SOURCES = \ gnunet_config_LDADD = \ libgnunetutil.la \ $(GN_LIBINTL) -gnunet_config_CPPFLAGS = \ - -DINCLUDEDIR=\"$(includedir)\" \ - -DLIBDIR=\"$(libdir)\" \ - -DPREFIX=\"$(prefix)\" \ - $(AM_CPPFLAGS) gnunet_uri_SOURCES = \ gnunet-uri.c diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 0a5c0712b..11682daea 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -167,19 +167,22 @@ run (void *cls, (void) args; if (1 == cflags || 1 == libs || 1 == prefix) { - /* These values are defined in the makefile */ + char *prefixdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX); + char *libdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR); if (1 == cflags) { - fprintf (stdout, "%s\n", "-I"INCLUDEDIR); + fprintf (stdout, "-I%sinclude\n", prefixdir); } if (1 == libs) { - fprintf (stdout, "%s\n", "-L"LIBDIR" -lgnunetutil"); + fprintf (stdout, "-L%s -lgnunetutil\n", libdir); } if (1 == prefix) { - fprintf (stdout, "%s\n", PREFIX); + fprintf (stdout, "%s\n", prefixdir); } + GNUNET_free (prefixdir); + GNUNET_free (libdir); return; } if (NULL != backend_check) -- cgit v1.2.3 From 649d10b2756bda49694d380e82154a96dde98670 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Tue, 27 Jul 2021 16:27:14 +0200 Subject: Autoconf macro to detect GNUnet installations --- contrib/Makefile.am | 4 ++++ contrib/gnunet.m4 | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 contrib/gnunet.m4 diff --git a/contrib/Makefile.am b/contrib/Makefile.am index f42fb684d..150e47ff0 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -53,6 +53,7 @@ EXTRA_DIST = \ conf/gnunet/gnunet-user.conf \ conf/nss/nssswitch.conf \ conf/wireshark/wireshark.lua \ + gnunet.m4 \ $(PACKAGES_FILES) \ $(INITD_FILES) \ Makefile.inc \ @@ -77,3 +78,6 @@ test_gnunet_prefix_LDADD = \ $(LTLIBICONV) \ $(GN_LIBINTL) \ $(LIBLTDL) -lunistring $(XLIB) + +aclocaldir = $(datadir)/aclocal +aclocal_DATA = gnunet.m4 diff --git a/contrib/gnunet.m4 b/contrib/gnunet.m4 new file mode 100644 index 000000000..fe70fbde1 --- /dev/null +++ b/contrib/gnunet.m4 @@ -0,0 +1,63 @@ +# Autoconf macro for working with GNUnet +# This file is in the public domain. +# +# AM_PATH_GNUNET([MINIMUM-VERSION = 0.14.2, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]]) +# Find the GNUnet installation, either automatically or through the +# --with-gnunet-prefix flag +# +# This macro runs the pkg-config and, if needed, the gnunet-config tool +# provided by GNUnet itself. +# +# The gnunet-config tool can be overridden by setting the GNUNET_CONFIG +# variable before executing the configure script. +# +# The variables GNUNET_CFLAGS and GNUNET_LIBS will be set to appropriate +# values and are made available to Automake. +AC_DEFUN([AM_PATH_GNUNET], +[AC_ARG_WITH([gnunet-prefix], + [AS_HELP_STRING([--with-gnunet-prefix=PATH], + [PATH to the GNUnet installation])], + [gnunet_prefix="$withval"], + [gnunet_prefix=""]) + AC_ARG_VAR([GNUNET_CONFIG],[The gnunet-config tool]) + min_gnunet_version=m4_if([$1], ,0.14.2,$1) + # Make sure the specified version is at least the version with + # the features required to use this macro + AS_VERSION_COMPARE([$min_gnunet_version],[0.14.2], + [AC_MSG_WARN([The specified GNUnet version $min_gnunet_version is too old.]) + AC_MSG_WARN([The minimum version has been set to 0.14.2]) + min_gnunet_version="0.14.2"]) + AS_IF([test "x${GNUNET_CONFIG+set}" != "xset"], + [PKG_CHECK_MODULES([GNUNET],[gnunetutil >= $min_gnunet_version], + [gnunet_pkgconfig=yes],[gnunet_pkgconfig=no]) + AS_IF([test "x$gnunet_pkgconfig" = "xno" && test "x$gnunet_prefix" != "x"], + [gnunet_PATH="$PATH" + AS_IF([test "x$prefix" != "xNONE"], + [gnunet_PATH="$prefix/bin${PATH_SEPARATOR}$prefix/usr/bin"]) + AC_PATH_PROG([GNUNET_CONFIG],[gnunet-config],[no],[$gnunet_PATH]) + AS_UNSET([gnunet_PATH])], + [GNUNET_CONFIG="pkg-config gnunetutil"])]) + AC_MSG_CHECKING([if GNUnet version is >= $min_gnunet_version]) + gnunet_result=no + AS_IF([test "x$GNUNET_CONFIG" != "xno" && test -n "$GNUNET_CONFIG"], + [gnunet_version=`$GNUNET_CONFIG --version | tr ' ' '\n' | sed -n '2p'` + AS_VERSION_COMPARE([$gnunet_version],[$min_gnunet_version], + [gnunet_result=no], + [gnunet_result=yes], + [gnunet_result=yes]) + AS_UNSET([gnunet_version])]) + AS_IF([test "x$gnunet_result" != "xyes"], + [AC_MSG_RESULT([no]) + m4_if([$3], ,:,[$3])], + [AC_MSG_RESULT([yes]) + m4_if([$2], ,:,[$2]) + AC_CHECK_HEADERS([sys/socket.h netinet/in.h byteswap.h]) + AS_IF([test "x${GNUNET_CFLAGS+set}" != "xset"], + [GNUNET_CFLAGS=`$GNUNET_CONFIG --cflags` + AC_SUBST([GNUNET_CFLAGS])]) + AS_IF([test "x${GNUNET_LIBS+set}" != "xset"], + [GNUNET_LIBS=`$GNUNET_CONFIG --libs` + AC_SUBST([GNUNET_LIBS])])]) + AS_UNSET([gnunet_result]) + AS_UNSET([min_gnunet_version]) +]) -- cgit v1.2.3 From 382fc8faaf4ccccd870dc7e746a9f002f3f6cfd1 Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Tue, 31 Aug 2021 15:54:43 +0200 Subject: gnunet.m4: add flag to disable debug messages --- contrib/gnunet.m4 | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/contrib/gnunet.m4 b/contrib/gnunet.m4 index fe70fbde1..6d9332db3 100644 --- a/contrib/gnunet.m4 +++ b/contrib/gnunet.m4 @@ -1,7 +1,7 @@ # Autoconf macro for working with GNUnet # This file is in the public domain. # -# AM_PATH_GNUNET([MINIMUM-VERSION = 0.14.2, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]]) +# AM_PATH_GNUNET([MINIMUM-VERSION = 0.15.3, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]]) # Find the GNUnet installation, either automatically or through the # --with-gnunet-prefix flag # @@ -19,14 +19,19 @@ AC_DEFUN([AM_PATH_GNUNET], [PATH to the GNUnet installation])], [gnunet_prefix="$withval"], [gnunet_prefix=""]) + AC_ARG_ENABLE([debug-log], + [AS_HELP_STRING([--disable-debug-log], + [Disable all DEBUG-level logging])], + [], + [enable_debug_log=yes]) AC_ARG_VAR([GNUNET_CONFIG],[The gnunet-config tool]) - min_gnunet_version=m4_if([$1], ,0.14.2,$1) + min_gnunet_version=m4_if([$1], ,0.15.3,$1) # Make sure the specified version is at least the version with # the features required to use this macro - AS_VERSION_COMPARE([$min_gnunet_version],[0.14.2], + AS_VERSION_COMPARE([$min_gnunet_version],[0.15.3], [AC_MSG_WARN([The specified GNUnet version $min_gnunet_version is too old.]) - AC_MSG_WARN([The minimum version has been set to 0.14.2]) - min_gnunet_version="0.14.2"]) + AC_MSG_WARN([The minimum version has been set to 0.15.3]) + min_gnunet_version="0.15.3"]) AS_IF([test "x${GNUNET_CONFIG+set}" != "xset"], [PKG_CHECK_MODULES([GNUNET],[gnunetutil >= $min_gnunet_version], [gnunet_pkgconfig=yes],[gnunet_pkgconfig=no]) @@ -57,7 +62,11 @@ AC_DEFUN([AM_PATH_GNUNET], AC_SUBST([GNUNET_CFLAGS])]) AS_IF([test "x${GNUNET_LIBS+set}" != "xset"], [GNUNET_LIBS=`$GNUNET_CONFIG --libs` - AC_SUBST([GNUNET_LIBS])])]) + AC_SUBST([GNUNET_LIBS])]) + AS_IF([test "x$enable_debug_log" = "xno"], + [AC_DEFINE([GNUNET_EXTRA_LOGGING], + [0], + [0 if debug messages should be culled])])]) AS_UNSET([gnunet_result]) AS_UNSET([min_gnunet_version]) ]) -- cgit v1.2.3 From d832ad808672dadcf94e02899525cca31054e9bf Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Tue, 7 Sep 2021 14:52:36 +0200 Subject: -indentation --- src/util/gnunet-config.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index a195d6014..b81b3b6a7 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -134,21 +134,24 @@ main (int argc, gettext_noop ( "test if the current installation supports the specified BACKEND"), &backend_check)), - GNUNET_GETOPT_option_flag ('C', - "cflags", - gettext_noop ( - "Provide an appropriate value for CFLAGS to applications building on top of GNUnet"), - &cflags), - GNUNET_GETOPT_option_flag ('j', - "libs", - gettext_noop ( - "Provide an appropriate value for LIBS to applications building on top of GNUnet"), - &libs), - GNUNET_GETOPT_option_flag ('p', - "prefix", - gettext_noop ( - "Provide the path under which GNUnet was installed"), - &prefix), + GNUNET_GETOPT_option_flag ( + 'C', + "cflags", + gettext_noop ( + "Provide an appropriate value for CFLAGS to applications building on top of GNUnet"), + &cflags), + GNUNET_GETOPT_option_flag ( + 'j', + "libs", + gettext_noop ( + "Provide an appropriate value for LIBS to applications building on top of GNUnet"), + &libs), + GNUNET_GETOPT_option_flag ( + 'p', + "prefix", + gettext_noop ( + "Provide the path under which GNUnet was installed"), + &prefix), GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), GNUNET_GETOPT_OPTION_END }; -- cgit v1.2.3 From c7ed99ce83e15bab7fc7240a77da703d98a06edd Mon Sep 17 00:00:00 2001 From: Alessio Vanni Date: Tue, 7 Sep 2021 14:57:10 +0200 Subject: -set return value following the current API --- src/util/gnunet-config.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index b81b3b6a7..2ca78577e 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c @@ -40,11 +40,13 @@ static char *backend_check; */ static int cflags; + /** * If printing the value of LIBS has been requested. */ static int libs; + /** * If printing the value of PREFIX has been requested. */ @@ -75,6 +77,7 @@ run (void *cls, { char *prefixdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX); char *libdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR); + if (1 == cflags) { fprintf (stdout, "-I%sinclude\n", prefixdir); @@ -87,6 +90,7 @@ run (void *cls, { fprintf (stdout, "%s\n", prefixdir); } + cs->global_ret = 0; GNUNET_free (prefixdir); GNUNET_free (libdir); return; -- cgit v1.2.3 From fc9ca33bca2652a6516eb1878863ea0d03c65d04 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 16 Sep 2021 22:51:28 +0200 Subject: fix typos spotted by madmurphy --- contrib/services/systemd/tmpfiles-gnunet.conf | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/services/systemd/tmpfiles-gnunet.conf b/contrib/services/systemd/tmpfiles-gnunet.conf index ffffa3284..251b475c9 100644 --- a/contrib/services/systemd/tmpfiles-gnunet.conf +++ b/contrib/services/systemd/tmpfiles-gnunet.conf @@ -1,10 +1,10 @@ # Typically placed into /usr/lib/tmpfiles.d/gnunet.conf d /var/lib/gnunet 0700 gnunet gnunet - - -z /usr/lib/gnunet/gnunet-helper-dns 4750 root gnunetdns - - -z /usr/lib/gnunet/gnunet-service-dns 2750 gnunet gnunetdns - - -z /usr/lib/gnunet/libexec/gnunet-helper-vpn 4750 root root - - -z /usr/lib/gnunet/libexec/gnunet-helper-transport-wlan 4750 root root - - -z /usr/lib/gnunet/libexec/gnunet-helper-transport-bluetooth 4750 root root - - -z /usr/lib/gnunet/libexec/gnunet-helper-exit 4750 root root - - -z /usr/lib/gnunet/libexec/gnunet-helper-nat-server 4750 root root - - -z /usr/lib/gnunet/libexec/gnunet-helper-nat-client 4750 root root - - +z /usr/lib/gnunet/libexec/gnunet-helper-dns 4750 root gnunetdns - - +z /usr/lib/gnunet/libexec/gnunet-service-dns 2750 gnunet gnunetdns - - +z /usr/lib/gnunet/libexec/gnunet-helper-vpn 4755 root root - - +z /usr/lib/gnunet/libexec/gnunet-helper-transport-wlan 4755 root root - - +z /usr/lib/gnunet/libexec/gnunet-helper-transport-bluetooth 4755 root root - - +z /usr/lib/gnunet/libexec/gnunet-helper-exit 4755 root root - - +z /usr/lib/gnunet/libexec/gnunet-helper-nat-server 4755 root root - - +z /usr/lib/gnunet/libexec/gnunet-helper-nat-client 4755 root root - - -- cgit v1.2.3 From 5df20a349cabc2ebd3747292be97239fdf837386 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 17 Sep 2021 11:05:29 +0200 Subject: madmurphy writes: On AUR I have created the gnunet-uri.desktop file (which is installed as /usr/share/applications/gnunet-uri.desktop) to add support for the gnunet:// URI scheme (so basically it becomes possible to click on gnunet:// URIs in any browser GNUnet GTK needs to be installed too, but the URI handler gnunet-uri is part of the gnunet package). You can find a patch attached, which adds contrib/xdg-scheme-handler/gnunet-uri.desktop contrib/xdg-scheme-handler/README.md to the git repository. --- contrib/xdg-scheme-handler/README.md | 8 ++++++++ contrib/xdg-scheme-handler/gnunet-uri.desktop | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100644 contrib/xdg-scheme-handler/README.md create mode 100644 contrib/xdg-scheme-handler/gnunet-uri.desktop diff --git a/contrib/xdg-scheme-handler/README.md b/contrib/xdg-scheme-handler/README.md new file mode 100644 index 000000000..919ae37f8 --- /dev/null +++ b/contrib/xdg-scheme-handler/README.md @@ -0,0 +1,8 @@ +XDG Scheme Handler for GNUnet URIs +================================== + +To register the `gnunet://` URI scheme, launch the following commands from this +directory as a privileged user: + + install -Dm644 gnunet-uri.desktop /usr/share/applications/gnunet-uri.desktop + update-mime-database /usr/share/applications/ diff --git a/contrib/xdg-scheme-handler/gnunet-uri.desktop b/contrib/xdg-scheme-handler/gnunet-uri.desktop new file mode 100644 index 000000000..4f847d20f --- /dev/null +++ b/contrib/xdg-scheme-handler/gnunet-uri.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=GNUnet URI +Exec=gnunet-uri %u +GenericName=URI handler for the GNUnet network +Icon=gnunet +Type=Application +Terminal=false +NoDisplay=true +MimeType=x-scheme-handler/gnunet; -- cgit v1.2.3 From 730fcf8d05c3179b0a85be198ce29359ece17116 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 18 Sep 2021 16:37:03 +0200 Subject: -fix typos --- src/testing/testing_api_cmd_netjail_start_testsystem_v2.c | 2 +- src/transport/test_transport_port_forward.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c b/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c index 64ce549a4..e5d4221ec 100644 --- a/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c +++ b/src/testing/testing_api_cmd_netjail_start_testsystem_v2.c @@ -62,7 +62,7 @@ struct HelperMessage struct NetJailState { /** - * The complete topology infomation. + * The complete topology information. */ struct GNUNET_TESTING_NetjailTopology *topology; diff --git a/src/transport/test_transport_port_forward.c b/src/transport/test_transport_port_forward.c index b0f0b113e..d3233c2da 100644 --- a/src/transport/test_transport_port_forward.c +++ b/src/transport/test_transport_port_forward.c @@ -21,7 +21,7 @@ /** * @file transport/test_transport_port_forward.c * @brief Test case executing a script which sends a test UDP message from a nated peer - * to a gloabl known peer. There is a tcp port forwarding in place towards the + * to a global known peer. There is a tcp port forwarding in place towards the * natted peer to test the backchannel functionality of the TNG service. * @author t3sserakt */ -- cgit v1.2.3 From df00745ee4eb1a322111552c2f934c13aae41454 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 18 Sep 2021 16:37:45 +0200 Subject: -fix typos --- doc/man/gnunet-config.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/man/gnunet-config.1 b/doc/man/gnunet-config.1 index c749c03b5..93d943758 100644 --- a/doc/man/gnunet-config.1 +++ b/doc/man/gnunet-config.1 @@ -26,7 +26,7 @@ .Os .Sh NAME .Nm gnunet-config -.Nd manipulate GNUnet configuration files and provide informations on how GNUnet was built +.Nd manipulate GNUnet configuration files and provide information on how GNUnet was built .Sh SYNOPSIS .Nm .Op Fl b Ar BACKEND | Fl -supported-backend= Ns Ar BACKEND -- cgit v1.2.3 From 83c0efff026598098addfabdf72698d5d13b7b48 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Sun, 19 Sep 2021 20:06:17 +0200 Subject: -BUILD: Fix bswap portability --- po/POTFILES.in | 2 +- src/include/gnunet_common.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/po/POTFILES.in b/po/POTFILES.in index 385aa00c4..042b1efc5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -424,6 +424,7 @@ src/testing/list-keys.c src/testing/testing.c src/testing/testing_api_cmd_batch.c src/testing/testing_api_cmd_block_until_all_peers_started.c +src/testing/testing_api_cmd_block_until_external_trigger.c src/testing/testing_api_cmd_hello_world.c src/testing/testing_api_cmd_hello_world_birth.c src/testing/testing_api_cmd_local_test_finished.c @@ -442,7 +443,6 @@ src/testing/testing_api_loop.c src/testing/testing_api_trait_cmd.c src/testing/testing_api_trait_process.c src/testing/testing_api_traits.c -src/testing/testing_json_vnet.c src/topology/friends.c src/topology/gnunet-daemon-topology.c src/transport/gnunet-communicator-tcp.c diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index ca3ddceaa..4472d3ee8 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -151,10 +151,10 @@ enum GNUNET_GenericReturnValue */ #if __BYTE_ORDER == __LITTLE_ENDIAN -#if defined(__linux__) -#define BYTE_SWAP_16(x) __bswap_16 (x) -#define BYTE_SWAP_32(x) __bswap_32 (x) -#define BYTE_SWAP_64(x) __bswap_64 (x) +#ifdef HAVE_BYTESWAP_H +#define BYTE_SWAP_16(x) bswap_16 (x) +#define BYTE_SWAP_32(x) bswap_32 (x) +#define BYTE_SWAP_64(x) bswap_64 (x) #else #define BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) -- cgit v1.2.3 From 10eac9bb7230973e2c37be9181c36bd086ca38de Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 19 Sep 2021 21:05:00 +0200 Subject: -work on dhtu --- src/dhtu/Makefile.am | 11 +++++ src/dhtu/plugin_dhtu_gnunet.c | 92 +++++++++++++++++++++++++++++++--------- src/dhtu/plugin_dhtu_ip.c | 4 +- src/include/gnunet_dhtu_plugin.h | 54 +++++++---------------- 4 files changed, 99 insertions(+), 62 deletions(-) diff --git a/src/dhtu/Makefile.am b/src/dhtu/Makefile.am index 72b422812..4bc96f236 100644 --- a/src/dhtu/Makefile.am +++ b/src/dhtu/Makefile.am @@ -11,6 +11,7 @@ if USE_COVERAGE endif plugin_LTLIBRARIES = \ + libgnunet_plugin_dhtu_gnunet.la \ libgnunet_plugin_dhtu_ip.la libgnunet_plugin_dhtu_ip_la_SOURCES = \ @@ -22,3 +23,13 @@ libgnunet_plugin_dhtu_ip_la_LIBADD = \ libgnunet_plugin_dhtu_ip_la_LDFLAGS = \ $(GN_PLUGIN_LDFLAGS) + + +libgnunet_plugin_dhtu_gnunet_la_SOURCES = \ + plugin_dhtu_gnunet.c +libgnunet_plugin_dhtu_gnunet_la_LIBADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(XLIBS) \ + $(LTLIBINTL) +libgnunet_plugin_dhtu_gnunet_la_LDFLAGS = \ + $(GN_PLUGIN_LDFLAGS) diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c index d6cd75242..9597ebdc0 100644 --- a/src/dhtu/plugin_dhtu_gnunet.c +++ b/src/dhtu/plugin_dhtu_gnunet.c @@ -21,11 +21,43 @@ /** * @author Christian Grothoff * - * @file plugin_dhtu_ip.c + * @file plugin_dhtu_gnunet.c * @brief plain IP based DHT network underlay */ #include "platform.h" -#incluce "gnunet_dhtu_plugin.h" +#include "gnunet_dhtu_plugin.h" + +/** + * Handle for a private key used by this underlay. + */ +struct GNUNET_DHTU_PrivateKey +{ + /** + * GNUnet uses eddsa for peers. + */ + struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv; + +}; + + +/** + * Handle for a public key used by this underlay. + */ +struct PublicKey +{ + + /** + * Header. + */ + struct GNUNET_DHTU_PublicKey header; + + /** + * GNUnet uses eddsa for peers. + */ + struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub; + +}; + /** * Opaque handle that the underlay offers for our address to be used when @@ -47,7 +79,7 @@ struct GNUNET_DHTU_Source */ struct GNUNET_DHTU_Target { - + /** * Application context for this target. */ @@ -93,21 +125,12 @@ struct GNUNET_DHTU_PreferenceHandle }; -/** - * Opaque handle for a private key used by this underlay. - */ -struct GNUNET_DHTU_PrivateKey -{ - /* we are IP, we do not do crypto */ -}; - - /** * Closure for all plugin functions. */ struct Plugin { - /** + /** * Callbacks into the DHT. */ struct GNUNET_DHTU_PluginEnvironment *env; @@ -126,10 +149,17 @@ struct Plugin static ssize_t ip_sign (void *cls, const struct GNUNET_DHTU_PrivateKey *pk, - const struct GNUNET_DHTU_SignaturePurpose *purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, void **sig) { - return 0; + struct GNUNET_CRYPTO_EddsaSignature *es; + + es = GNUNET_new (struct GNUNET_CRYPTO_EddsaSignature); + GNUNET_CRYPTO_eddsa_sign_ (&pk->eddsa_priv, + purpose, + es); + *sig = es; + return sizeof (*es); } @@ -148,11 +178,31 @@ ip_sign (void *cls, static enum GNUNET_GenericReturnValue ip_verify (void *cls, const struct GNUNET_DHTU_PublicKey *pk, - const struct GNUNET_DHTU_SignaturePurpose *purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, const void *sig, size_t sig_size) { - return GNUNET_NO; + const struct GNUNET_CRYPTO_EddsaSignature *es = sig; + const struct PublicKey *pub; + + GNUNET_assert (sizeof (struct PublicKey) == + ntohs (pk->size)); + pub = (const struct PublicKey *) pk; + if (sizeof (*es) != sig_size) + { + GNUNET_break_op (0); + return GNUNET_SYSERR; + } + if (GNUNET_OK != + GNUNET_CRYPTO_eddsa_verify_ (ntohl (purpose->purpose), + purpose, + es, + &pub->eddsa_pub)) + { + GNUNET_break_op (0); + return GNUNET_SYSERR; + } + return GNUNET_OK; } @@ -174,7 +224,7 @@ ip_try_connect (void *cls, * Request underlay to keep the connection to @a target alive if possible. * Hold may be called multiple times to express a strong preference to * keep a connection, say because a @a target is in multiple tables. - * + * * @param cls closure * @param target connection to keep alive */ @@ -196,7 +246,7 @@ ip_hold (void *cls, /** * Do no long request underlay to keep the connection alive. - * + * * @param cls closure * @param target connection to keep alive */ @@ -204,7 +254,7 @@ static void ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) { struct GNUNET_DHTU_Target *target = ph->target; - + GNUNET_CONTAINER_DLL_remove (target->ph_head, target->ph_tail, ph); @@ -225,7 +275,7 @@ ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) * @param msg_size number of bytes in @a msg * @param finished_cb function called once transmission is done * (not called if @a target disconnects, then only the - * disconnect_cb is called). + * disconnect_cb is called). * @param finished_cb_cls closure for @a finished_cb */ static void diff --git a/src/dhtu/plugin_dhtu_ip.c b/src/dhtu/plugin_dhtu_ip.c index 8593a69ef..ae35adb37 100644 --- a/src/dhtu/plugin_dhtu_ip.c +++ b/src/dhtu/plugin_dhtu_ip.c @@ -240,7 +240,7 @@ struct Plugin static ssize_t ip_sign (void *cls, const struct GNUNET_DHTU_PrivateKey *pk, - const struct GNUNET_DHTU_SignaturePurpose *purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, void **sig) { return 0; @@ -262,7 +262,7 @@ ip_sign (void *cls, static enum GNUNET_GenericReturnValue ip_verify (void *cls, const struct GNUNET_DHTU_PublicKey *pk, - const struct GNUNET_DHTU_SignaturePurpose *purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, const void *sig, size_t sig_size) { diff --git a/src/include/gnunet_dhtu_plugin.h b/src/include/gnunet_dhtu_plugin.h index df9729a23..e65318fb5 100644 --- a/src/include/gnunet_dhtu_plugin.h +++ b/src/include/gnunet_dhtu_plugin.h @@ -75,42 +75,18 @@ struct GNUNET_DHTU_PublicKey /* followed by size-2 bytes of the actual public key */ }; - + /** * Hash used by the DHT for keys and peers. */ struct GNUNET_DHTU_Hash { - - /** - * For now, use a 512 bit hash. (To be discussed). - */ - struct GNUNET_HashCode hc; -}; - -/** - * @brief header of what an DHTU signature signs - * this must be followed by "size - 8" bytes of - * the actual signed data - */ -struct GNUNET_DHTU_SignaturePurpose -{ /** - * How many bytes does this signature sign? - * (including this purpose header); in network - * byte order (!). - */ - uint32_t size GNUNET_PACKED; - - /** - * What does this signature vouch for? This - * must contain a GNUNET_SIGNATURE_PURPOSE_XXX - * constant (from gnunet_signatures.h). In - * network byte order! + * For now, use a 512 bit hash. (To be discussed). */ - uint32_t purpose GNUNET_PACKED; + struct GNUNET_HashCode hc; }; @@ -131,7 +107,7 @@ struct GNUNET_DHTU_PluginEnvironment */ void *cls; - /** + /** * Function to call with new addresses of this peer. * * @param cls the closure @@ -151,7 +127,7 @@ struct GNUNET_DHTU_PluginEnvironment struct GNUNET_DHTU_Source *source, void **ctx); - /** + /** * Function to call with expired addresses of this peer. * * @param[in] ctx storage space used by the DHT in association with this address @@ -160,7 +136,7 @@ struct GNUNET_DHTU_PluginEnvironment (*address_del_cb)(void *ctx); /** - * We have a new estimate on the size of the underlay. + * We have a new estimate on the size of the underlay. * * @param cls closure * @param timestamp time when the estimate was received from the server (or created by the server) @@ -172,7 +148,7 @@ struct GNUNET_DHTU_PluginEnvironment struct GNUNET_TIME_Absolute timestamp, double logestimate, double std_dev); - + /** * Function to call when we connect to a peer and can henceforth transmit to * that peer. @@ -208,7 +184,7 @@ struct GNUNET_DHTU_PluginEnvironment * @param cls the closure * @param origin where the message originated from * @param[in,out] tctx ctx of target address where we received the message from - * @param[in,out] sctx ctx of our own source address at which we received the message + * @param[in,out] sctx ctx of our own source address at which we received the message * @param message the message we received @param message_size number of * bytes in @a message */ @@ -244,7 +220,7 @@ struct GNUNET_DHTU_PluginFunctions ssize_t (*sign)(void *cls, const struct GNUNET_DHTU_PrivateKey *pk, - const struct GNUNET_DHTU_SignaturePurpose *purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, void **sig); /** @@ -262,7 +238,7 @@ struct GNUNET_DHTU_PluginFunctions enum GNUNET_GenericReturnValue (*verify)(void *cls, const struct GNUNET_DHTU_PublicKey *pk, - const struct GNUNET_DHTU_SignaturePurpose *purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, const void *sig, size_t sig_size); @@ -281,7 +257,7 @@ struct GNUNET_DHTU_PluginFunctions * Request underlay to keep the connection to @a target alive if possible. * Hold may be called multiple times to express a strong preference to * keep a connection, say because a @a target is in multiple tables. - * + * * @param cls closure * @param target connection to keep alive */ @@ -291,13 +267,13 @@ struct GNUNET_DHTU_PluginFunctions /** * Do no long request underlay to keep the connection alive. - * + * * @param cls closure * @param target connection to keep alive */ void (*drop)(struct GNUNET_DHTU_PreferenceHandle *ph); - + /** * Send message to some other participant over the network. Note that * sending is not guaranteeing that the other peer actually received the @@ -310,7 +286,7 @@ struct GNUNET_DHTU_PluginFunctions * @param msg_size number of bytes in @a msg * @param finished_cb function called once transmission is done * (not called if @a target disconnects, then only the - * disconnect_cb is called). + * disconnect_cb is called). * @param finished_cb_cls closure for @a finished_cb */ void @@ -320,7 +296,7 @@ struct GNUNET_DHTU_PluginFunctions size_t msg_size, GNUNET_SCHEDULER_TaskCallback finished_cb, void *finished_cb_cls); - + }; -- cgit v1.2.3 From 48896731e966376ec6f256e175e0d12cd17afa42 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 19 Sep 2021 23:35:17 +0200 Subject: more dhtu-gnunet basics --- src/dhtu/Makefile.am | 1 + src/dhtu/plugin_dhtu_gnunet.c | 71 ++++++++++++++++++++++++++++++++++ src/include/gnunet_hello_lib.h | 7 ++-- src/include/gnunet_mq_lib.h | 21 ++++++---- src/include/gnunet_transport_service.h | 21 ++++++---- 5 files changed, 103 insertions(+), 18 deletions(-) diff --git a/src/dhtu/Makefile.am b/src/dhtu/Makefile.am index 4bc96f236..f4b968526 100644 --- a/src/dhtu/Makefile.am +++ b/src/dhtu/Makefile.am @@ -28,6 +28,7 @@ libgnunet_plugin_dhtu_ip_la_LDFLAGS = \ libgnunet_plugin_dhtu_gnunet_la_SOURCES = \ plugin_dhtu_gnunet.c libgnunet_plugin_dhtu_gnunet_la_LIBADD = \ + $(top_builddir)/src/core/libgnunetcore.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(XLIBS) \ $(LTLIBINTL) diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c index 9597ebdc0..ccd329e8e 100644 --- a/src/dhtu/plugin_dhtu_gnunet.c +++ b/src/dhtu/plugin_dhtu_gnunet.c @@ -26,6 +26,7 @@ */ #include "platform.h" #include "gnunet_dhtu_plugin.h" +#include "gnunet_core_service.h" /** * Handle for a private key used by this underlay. @@ -134,6 +135,12 @@ struct Plugin * Callbacks into the DHT. */ struct GNUNET_DHTU_PluginEnvironment *env; + + /** + * Handle to the CORE service. + */ + struct GNUNET_CORE_Handle *core; + }; @@ -290,6 +297,60 @@ ip_send (void *cls, } + +/** + * Method called whenever a given peer connects. + * + * @param cls closure + * @param peer peer identity this notification is about + * @return closure associated with @a peer. given to mq callbacks and + * #GNUNET_CORE_DisconnectEventHandler + */ +static void * +core_connect_cb (void *cls, + const struct GNUNET_PeerIdentity *peer, + struct GNUNET_MQ_Handle *mq) +{ + return NULL; +} + + +/** + * Method called whenever a peer disconnects. + * + * @param cls closure + * @param peer peer identity this notification is about + * @param peer_cls closure associated with peer. given in + * #GNUNET_CORE_ConnectEventHandler + */ +static void +core_disconnect_cb (void *cls, + const struct GNUNET_PeerIdentity *peer, + void *peer_cls) +{ +} + + +/** + * Function called after #GNUNET_CORE_connect has succeeded (or failed + * for good). Note that the private key of the peer is intentionally + * not exposed here; if you need it, your process should try to read + * the private key file directly (which should work if you are + * authorized...). Implementations of this function must not call + * #GNUNET_CORE_disconnect (other than by scheduling a new task to + * do this later). + * + * @param cls closure + * @param my_identity ID of this peer, NULL if we failed + */ +static void +core_init_cb (void *cls, + const struct GNUNET_PeerIdentity *my_identity) +{ + struct Plugin *plugin = cls; +} + + /** * Entry point for the plugin. * @@ -302,6 +363,9 @@ libgnunet_plugin_dhtu_ip_init (void *cls) struct GNUNET_DHTU_PluginEnvironment *env = cls; struct GNUNET_DHTU_PluginFunctions *api; struct Plugin *plugin; + struct GNUNET_MQ_MessageHandler handlers[] = { + GNUNET_MQ_handler_end () + }; plugin = GNUNET_new (struct Plugin); plugin->env = env; @@ -313,6 +377,12 @@ libgnunet_plugin_dhtu_ip_init (void *cls) api->hold = &ip_hold; api->drop = &ip_drop; api->send = &ip_send; + plugin->core = GNUNET_CORE_connect (env->cfg, + plugin, + &core_init_cb, + &core_connect_cb, + &core_disconnect_cb, + handlers); return api; } @@ -329,6 +399,7 @@ libgnunet_plugin_dhtu_gnunet_done (void *cls) struct GNUNET_DHTU_PluginFunctions *api = cls; struct Plugin *plugin = api->cls; + GNUNET_CORE_disconnect (plugin->core); GNUNET_free (plugin); GNUNET_free (api); return NULL; diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h index fff0045aa..74eca999d 100644 --- a/src/include/gnunet_hello_lib.h +++ b/src/include/gnunet_hello_lib.h @@ -268,9 +268,10 @@ GNUNET_HELLO_add_address (const struct GNUNET_HELLO_Address *address, * @return number of bytes written or 0, #GNUNET_SYSERR to signal the * end of the iteration. */ -typedef ssize_t (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, - size_t max, - void *buf); +typedef ssize_t +(*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, + size_t max, + void *buf); /** diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h index 37bba8c1b..765647a98 100644 --- a/src/include/gnunet_mq_lib.h +++ b/src/include/gnunet_mq_lib.h @@ -331,9 +331,10 @@ typedef int (*GNUNET_MQ_MessageValidationCallback) ( * @param msg the message to send * @param impl_state state of the implementation */ -typedef void (*GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, - const struct GNUNET_MessageHeader *msg, - void *impl_state); +typedef void +(*GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, + const struct GNUNET_MessageHeader *msg, + void *impl_state); /** @@ -345,8 +346,9 @@ typedef void (*GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, * @param mq the message queue to destroy * @param impl_state state of the implementation */ -typedef void (*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, - void *impl_state); +typedef void +(*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, + void *impl_state); /** @@ -355,8 +357,9 @@ typedef void (*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, * @param mq message queue * @param impl_state state specific to the implementation */ -typedef void (*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, - void *impl_state); +typedef void +(*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, + void *impl_state); /** @@ -368,7 +371,9 @@ typedef void (*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, * @param cls closure * @param error error code */ -typedef void (*GNUNET_MQ_ErrorHandler) (void *cls, enum GNUNET_MQ_Error error); +typedef void +(*GNUNET_MQ_ErrorHandler) (void *cls, + enum GNUNET_MQ_Error error); /** diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h index d190eff92..545bb28d2 100644 --- a/src/include/gnunet_transport_service.h +++ b/src/include/gnunet_transport_service.h @@ -115,7 +115,8 @@ struct GNUNET_TRANSPORT_AddressToStringContext; * if #GNUNET_NO: address was invalid (or not supported) * if #GNUNET_SYSERR: communication error (IPC error) */ -typedef void (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls, +typedef void +(*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls, const char *address, int res); @@ -326,7 +327,8 @@ struct GNUNET_TRANSPORT_PeerMonitoringContext; * @param state current state this peer is in * @param state_timeout timeout for the current state of the peer */ -typedef void (*GNUNET_TRANSPORT_PeerIterateCallback) ( +typedef void +(*GNUNET_TRANSPORT_PeerIterateCallback) ( void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_HELLO_Address *address, @@ -394,7 +396,8 @@ struct GNUNET_TRANSPORT_Blacklist; * @param pid peer to approve or disapproave * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not */ -typedef int (*GNUNET_TRANSPORT_BlacklistCallback) ( +typedef int +(*GNUNET_TRANSPORT_BlacklistCallback) ( void *cls, const struct GNUNET_PeerIdentity *pid); @@ -541,7 +544,8 @@ struct GNUNET_TRANSPORT_SessionInfo * NULL with @a session being non-NULL if the monitor * was being cancelled while sessions were active */ -typedef void (*GNUNET_TRANSPORT_SessionMonitorCallback) ( +typedef void +(*GNUNET_TRANSPORT_SessionMonitorCallback) ( void *cls, struct GNUNET_TRANSPORT_PluginSession *session, void **session_ctx, @@ -593,7 +597,8 @@ struct GNUNET_TRANSPORT_CoreHandle; * @param mq message queue to use to transmit to @a peer * @return closure to use in MQ handlers */ -typedef void *(*GNUNET_TRANSPORT_NotifyConnect) ( +typedef void * +(*GNUNET_TRANSPORT_NotifyConnect) ( void *cls, const struct GNUNET_PeerIdentity *peer, struct GNUNET_MQ_Handle *mq); @@ -610,7 +615,8 @@ typedef void *(*GNUNET_TRANSPORT_NotifyConnect) ( * @param handlers_cls closure of the handlers, was returned from the * connect notification callback */ -typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) ( +typedef void +(*GNUNET_TRANSPORT_NotifyDisconnect) ( void *cls, const struct GNUNET_PeerIdentity *peer, void *handler_cls); @@ -632,7 +638,8 @@ typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) ( * @param handlers_cls closure of the handlers, was returned from the * connect notification callback */ -typedef void (*GNUNET_TRANSPORT_NotifyExcessBandwidth) ( +typedef void +(*GNUNET_TRANSPORT_NotifyExcessBandwidth) ( void *cls, const struct GNUNET_PeerIdentity *neighbour, void *handlers_cls); -- cgit v1.2.3