diff options
author | t3sserakt <t3ss@posteo.de> | 2021-09-20 09:00:16 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2021-09-20 11:10:54 +0200 |
commit | b97b260a0461401b317958002b472ff7ed29fb68 (patch) | |
tree | 0681d8e7e91626cdcd22f5724557e39153b45306 | |
parent | d5df403e64bbde52c5436165eee5231a1b2f876b (diff) | |
parent | 48896731e966376ec6f256e175e0d12cd17afa42 (diff) | |
download | gnunet-b97b260a0461401b317958002b472ff7ed29fb68.tar.gz gnunet-b97b260a0461401b317958002b472ff7ed29fb68.zip |
Merge branch 'master' of ssh://git.gnunet.org/gnunet
-rw-r--r-- | contrib/Makefile.am | 4 | ||||
-rw-r--r-- | contrib/gnunet.m4 | 72 | ||||
-rw-r--r-- | contrib/services/systemd/tmpfiles-gnunet.conf | 16 | ||||
-rw-r--r-- | contrib/xdg-scheme-handler/README.md | 8 | ||||
-rw-r--r-- | contrib/xdg-scheme-handler/gnunet-uri.desktop | 9 | ||||
-rw-r--r-- | doc/man/gnunet-config.1 | 25 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/dhtu/Makefile.am | 12 | ||||
-rw-r--r-- | src/dhtu/plugin_dhtu_gnunet.c | 163 | ||||
-rw-r--r-- | src/dhtu/plugin_dhtu_ip.c | 4 | ||||
-rw-r--r-- | src/include/gnunet_common.h | 8 | ||||
-rw-r--r-- | src/include/gnunet_dhtu_plugin.h | 54 | ||||
-rw-r--r-- | src/include/gnunet_hello_lib.h | 7 | ||||
-rw-r--r-- | src/include/gnunet_mq_lib.h | 21 | ||||
-rw-r--r-- | src/include/gnunet_transport_service.h | 21 | ||||
-rw-r--r-- | src/transport/test_transport_port_forward.c | 2 | ||||
-rw-r--r-- | src/util/gnunet-config.c | 59 |
17 files changed, 385 insertions, 101 deletions
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 = \ | |||
53 | conf/gnunet/gnunet-user.conf \ | 53 | conf/gnunet/gnunet-user.conf \ |
54 | conf/nss/nssswitch.conf \ | 54 | conf/nss/nssswitch.conf \ |
55 | conf/wireshark/wireshark.lua \ | 55 | conf/wireshark/wireshark.lua \ |
56 | gnunet.m4 \ | ||
56 | $(PACKAGES_FILES) \ | 57 | $(PACKAGES_FILES) \ |
57 | $(INITD_FILES) \ | 58 | $(INITD_FILES) \ |
58 | Makefile.inc \ | 59 | Makefile.inc \ |
@@ -77,3 +78,6 @@ test_gnunet_prefix_LDADD = \ | |||
77 | $(LTLIBICONV) \ | 78 | $(LTLIBICONV) \ |
78 | $(GN_LIBINTL) \ | 79 | $(GN_LIBINTL) \ |
79 | $(LIBLTDL) -lunistring $(XLIB) | 80 | $(LIBLTDL) -lunistring $(XLIB) |
81 | |||
82 | aclocaldir = $(datadir)/aclocal | ||
83 | aclocal_DATA = gnunet.m4 | ||
diff --git a/contrib/gnunet.m4 b/contrib/gnunet.m4 new file mode 100644 index 000000000..6d9332db3 --- /dev/null +++ b/contrib/gnunet.m4 | |||
@@ -0,0 +1,72 @@ | |||
1 | # Autoconf macro for working with GNUnet | ||
2 | # This file is in the public domain. | ||
3 | # | ||
4 | # AM_PATH_GNUNET([MINIMUM-VERSION = 0.15.3, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]]) | ||
5 | # Find the GNUnet installation, either automatically or through the | ||
6 | # --with-gnunet-prefix flag | ||
7 | # | ||
8 | # This macro runs the pkg-config and, if needed, the gnunet-config tool | ||
9 | # provided by GNUnet itself. | ||
10 | # | ||
11 | # The gnunet-config tool can be overridden by setting the GNUNET_CONFIG | ||
12 | # variable before executing the configure script. | ||
13 | # | ||
14 | # The variables GNUNET_CFLAGS and GNUNET_LIBS will be set to appropriate | ||
15 | # values and are made available to Automake. | ||
16 | AC_DEFUN([AM_PATH_GNUNET], | ||
17 | [AC_ARG_WITH([gnunet-prefix], | ||
18 | [AS_HELP_STRING([--with-gnunet-prefix=PATH], | ||
19 | [PATH to the GNUnet installation])], | ||
20 | [gnunet_prefix="$withval"], | ||
21 | [gnunet_prefix=""]) | ||
22 | AC_ARG_ENABLE([debug-log], | ||
23 | [AS_HELP_STRING([--disable-debug-log], | ||
24 | [Disable all DEBUG-level logging])], | ||
25 | [], | ||
26 | [enable_debug_log=yes]) | ||
27 | AC_ARG_VAR([GNUNET_CONFIG],[The gnunet-config tool]) | ||
28 | min_gnunet_version=m4_if([$1], ,0.15.3,$1) | ||
29 | # Make sure the specified version is at least the version with | ||
30 | # the features required to use this macro | ||
31 | AS_VERSION_COMPARE([$min_gnunet_version],[0.15.3], | ||
32 | [AC_MSG_WARN([The specified GNUnet version $min_gnunet_version is too old.]) | ||
33 | AC_MSG_WARN([The minimum version has been set to 0.15.3]) | ||
34 | min_gnunet_version="0.15.3"]) | ||
35 | AS_IF([test "x${GNUNET_CONFIG+set}" != "xset"], | ||
36 | [PKG_CHECK_MODULES([GNUNET],[gnunetutil >= $min_gnunet_version], | ||
37 | [gnunet_pkgconfig=yes],[gnunet_pkgconfig=no]) | ||
38 | AS_IF([test "x$gnunet_pkgconfig" = "xno" && test "x$gnunet_prefix" != "x"], | ||
39 | [gnunet_PATH="$PATH" | ||
40 | AS_IF([test "x$prefix" != "xNONE"], | ||
41 | [gnunet_PATH="$prefix/bin${PATH_SEPARATOR}$prefix/usr/bin"]) | ||
42 | AC_PATH_PROG([GNUNET_CONFIG],[gnunet-config],[no],[$gnunet_PATH]) | ||
43 | AS_UNSET([gnunet_PATH])], | ||
44 | [GNUNET_CONFIG="pkg-config gnunetutil"])]) | ||
45 | AC_MSG_CHECKING([if GNUnet version is >= $min_gnunet_version]) | ||
46 | gnunet_result=no | ||
47 | AS_IF([test "x$GNUNET_CONFIG" != "xno" && test -n "$GNUNET_CONFIG"], | ||
48 | [gnunet_version=`$GNUNET_CONFIG --version | tr ' ' '\n' | sed -n '2p'` | ||
49 | AS_VERSION_COMPARE([$gnunet_version],[$min_gnunet_version], | ||
50 | [gnunet_result=no], | ||
51 | [gnunet_result=yes], | ||
52 | [gnunet_result=yes]) | ||
53 | AS_UNSET([gnunet_version])]) | ||
54 | AS_IF([test "x$gnunet_result" != "xyes"], | ||
55 | [AC_MSG_RESULT([no]) | ||
56 | m4_if([$3], ,:,[$3])], | ||
57 | [AC_MSG_RESULT([yes]) | ||
58 | m4_if([$2], ,:,[$2]) | ||
59 | AC_CHECK_HEADERS([sys/socket.h netinet/in.h byteswap.h]) | ||
60 | AS_IF([test "x${GNUNET_CFLAGS+set}" != "xset"], | ||
61 | [GNUNET_CFLAGS=`$GNUNET_CONFIG --cflags` | ||
62 | AC_SUBST([GNUNET_CFLAGS])]) | ||
63 | AS_IF([test "x${GNUNET_LIBS+set}" != "xset"], | ||
64 | [GNUNET_LIBS=`$GNUNET_CONFIG --libs` | ||
65 | AC_SUBST([GNUNET_LIBS])]) | ||
66 | AS_IF([test "x$enable_debug_log" = "xno"], | ||
67 | [AC_DEFINE([GNUNET_EXTRA_LOGGING], | ||
68 | [0], | ||
69 | [0 if debug messages should be culled])])]) | ||
70 | AS_UNSET([gnunet_result]) | ||
71 | AS_UNSET([min_gnunet_version]) | ||
72 | ]) | ||
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 @@ | |||
1 | # Typically placed into /usr/lib/tmpfiles.d/gnunet.conf | 1 | # Typically placed into /usr/lib/tmpfiles.d/gnunet.conf |
2 | d /var/lib/gnunet 0700 gnunet gnunet - - | 2 | d /var/lib/gnunet 0700 gnunet gnunet - - |
3 | z /usr/lib/gnunet/gnunet-helper-dns 4750 root gnunetdns - - | 3 | z /usr/lib/gnunet/libexec/gnunet-helper-dns 4750 root gnunetdns - - |
4 | z /usr/lib/gnunet/gnunet-service-dns 2750 gnunet gnunetdns - - | 4 | z /usr/lib/gnunet/libexec/gnunet-service-dns 2750 gnunet gnunetdns - - |
5 | z /usr/lib/gnunet/libexec/gnunet-helper-vpn 4750 root root - - | 5 | z /usr/lib/gnunet/libexec/gnunet-helper-vpn 4755 root root - - |
6 | z /usr/lib/gnunet/libexec/gnunet-helper-transport-wlan 4750 root root - - | 6 | z /usr/lib/gnunet/libexec/gnunet-helper-transport-wlan 4755 root root - - |
7 | z /usr/lib/gnunet/libexec/gnunet-helper-transport-bluetooth 4750 root root - - | 7 | z /usr/lib/gnunet/libexec/gnunet-helper-transport-bluetooth 4755 root root - - |
8 | z /usr/lib/gnunet/libexec/gnunet-helper-exit 4750 root root - - | 8 | z /usr/lib/gnunet/libexec/gnunet-helper-exit 4755 root root - - |
9 | z /usr/lib/gnunet/libexec/gnunet-helper-nat-server 4750 root root - - | 9 | z /usr/lib/gnunet/libexec/gnunet-helper-nat-server 4755 root root - - |
10 | z /usr/lib/gnunet/libexec/gnunet-helper-nat-client 4750 root root - - | 10 | z /usr/lib/gnunet/libexec/gnunet-helper-nat-client 4755 root root - - |
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 @@ | |||
1 | XDG Scheme Handler for GNUnet URIs | ||
2 | ================================== | ||
3 | |||
4 | To register the `gnunet://` URI scheme, launch the following commands from this | ||
5 | directory as a privileged user: | ||
6 | |||
7 | install -Dm644 gnunet-uri.desktop /usr/share/applications/gnunet-uri.desktop | ||
8 | 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 @@ | |||
1 | [Desktop Entry] | ||
2 | Name=GNUnet URI | ||
3 | Exec=gnunet-uri %u | ||
4 | GenericName=URI handler for the GNUnet network | ||
5 | Icon=gnunet | ||
6 | Type=Application | ||
7 | Terminal=false | ||
8 | NoDisplay=true | ||
9 | MimeType=x-scheme-handler/gnunet; | ||
diff --git a/doc/man/gnunet-config.1 b/doc/man/gnunet-config.1 index 03f180c29..93d943758 100644 --- a/doc/man/gnunet-config.1 +++ b/doc/man/gnunet-config.1 | |||
@@ -26,33 +26,44 @@ | |||
26 | .Os | 26 | .Os |
27 | .Sh NAME | 27 | .Sh NAME |
28 | .Nm gnunet-config | 28 | .Nm gnunet-config |
29 | .Nd manipulate GNUnet configuration files | 29 | .Nd manipulate GNUnet configuration files and provide information on how GNUnet was built |
30 | .Sh SYNOPSIS | 30 | .Sh SYNOPSIS |
31 | .Nm | 31 | .Nm |
32 | .Op Fl b Ar BACKEND | Fl -supported-backend= Ns Ar BACKEND | 32 | .Op Fl b Ar BACKEND | Fl -supported-backend= Ns Ar BACKEND |
33 | .Op Fl C | -cflags | ||
33 | .Op Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME | 34 | .Op Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME |
35 | .Op Fl F | -full | ||
34 | .Op Fl f | -filename | 36 | .Op Fl f | -filename |
35 | .Op Fl h | -help | 37 | .Op Fl h | -help |
38 | .Op Fl j | -libs | ||
36 | .Op Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL | 39 | .Op Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL |
37 | .Op Fl o Ar OPTION | Fl -option= Ns Ar OPTION | 40 | .Op Fl o Ar OPTION | Fl -option= Ns Ar OPTION |
41 | .Op Fl p | -prefix | ||
42 | .Op Fl r | -rewrite | ||
38 | .Op Fl S |-list-sections | 43 | .Op Fl S |-list-sections |
39 | .Op Fl s Ar SECTION | Fl -section= Ns Ar SECTION | 44 | .Op Fl s Ar SECTION | Fl -section= Ns Ar SECTION |
40 | .Op Fl V Ar VALUE | Fl -value Ar VALUE | 45 | .Op Fl V Ar VALUE | Fl -value Ar VALUE |
41 | .Op Fl v | -version | 46 | .Op Fl v | -version |
42 | .Op Fl r | -rewrite | ||
43 | .Op Fl F | -full | ||
44 | .Sh DESCRIPTION | 47 | .Sh DESCRIPTION |
45 | .Nm | 48 | .Nm |
46 | can be used to read or modify GNUnet configuration files. | 49 | can be used to read or modify GNUnet configuration files. |
50 | It can also provide informations to properly build applications on top of | ||
51 | GNUnet, like appropriate values for CFLAGS or the installation prefix. | ||
47 | .Bl -tag -width indent | 52 | .Bl -tag -width indent |
48 | .It Fl b Ar BACKEND | Fl -supported-backend= Ns Ar BACKEND | 53 | .It Fl b Ar BACKEND | Fl -supported-backend= Ns Ar BACKEND |
49 | 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). | 54 | 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). |
55 | .It Fl C | -cflags | ||
56 | Print an appropriate value for CFLAGS to compile applications on top of GNUnet. | ||
50 | .It Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME | 57 | .It Fl c Ar FILENAME | Fl -config= Ns Ar FILENAME |
51 | Use the configuration file FILENAME. | 58 | Use the configuration file FILENAME. |
59 | .It Fl F | -full | ||
60 | Write the full configuration, not just the deltas to the defaults. | ||
52 | .It Fl f | -filename | 61 | .It Fl f | -filename |
53 | Try to perform expansions as if the option values represent filenames (will also be applied even if the option is not really a filename). | 62 | Try to perform expansions as if the option values represent filenames (will also be applied even if the option is not really a filename). |
54 | .It Fl h | -help | 63 | .It Fl h | -help |
55 | Print short help on options. | 64 | Print short help on options. |
65 | .It Fl j | -libs | ||
66 | Print an appropriate value for LIBS to compile applications on top of GNUnet. | ||
56 | .It Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL | 67 | .It Fl L Ar LOGLEVEL | Fl -loglevel= Ns Ar LOGLEVEL |
57 | Use LOGLEVEL for logging. | 68 | Use LOGLEVEL for logging. |
58 | Valid values are DEBUG, INFO, WARNING and ERROR. | 69 | Valid values are DEBUG, INFO, WARNING and ERROR. |
@@ -60,6 +71,10 @@ Valid values are DEBUG, INFO, WARNING and ERROR. | |||
60 | Which configuration option should be accessed or edited. | 71 | Which configuration option should be accessed or edited. |
61 | Required to set a value. | 72 | Required to set a value. |
62 | If not given, all values of a given section will be printed in the format "OPTION = VALUE". | 73 | If not given, all values of a given section will be printed in the format "OPTION = VALUE". |
74 | .It Fl p | -prefix | ||
75 | Print GNUnet's installation prefix (for example /usr/local.) | ||
76 | .It Fl r | -rewrite | ||
77 | Write the configuration to file, even if it did not change. | ||
63 | .It Fl S |-list-sections | 78 | .It Fl S |-list-sections |
64 | List available configuration sections for use with --section. | 79 | List available configuration sections for use with --section. |
65 | .It Fl s Ar SECTION | Fl -section= Ns Ar SECTION | 80 | .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. | |||
70 | Must only be given together with -s and -o options. | 85 | Must only be given together with -s and -o options. |
71 | .It Fl v | -version | 86 | .It Fl v | -version |
72 | Print GNUnet version number. | 87 | Print GNUnet version number. |
73 | .It Fl r | -rewrite | ||
74 | Write the configuration to file, even if it did not change. | ||
75 | .It Fl F | -full | ||
76 | Write the full configuration, not just the deltas to the defaults. | ||
77 | .El | 88 | .El |
78 | .Sh SEE ALSO | 89 | .Sh SEE ALSO |
79 | The full documentation for gnunet is maintained as a Texinfo manual. | 90 | The full documentation for gnunet is maintained as a Texinfo manual. |
diff --git a/po/POTFILES.in b/po/POTFILES.in index ddef6ac33..adea4bcf1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -443,7 +443,6 @@ src/testing/testing_api_loop.c | |||
443 | src/testing/testing_api_trait_cmd.c | 443 | src/testing/testing_api_trait_cmd.c |
444 | src/testing/testing_api_trait_process.c | 444 | src/testing/testing_api_trait_process.c |
445 | src/testing/testing_api_traits.c | 445 | src/testing/testing_api_traits.c |
446 | src/testing/testing_json_vnet.c | ||
447 | src/topology/friends.c | 446 | src/topology/friends.c |
448 | src/topology/gnunet-daemon-topology.c | 447 | src/topology/gnunet-daemon-topology.c |
449 | src/transport/gnunet-communicator-tcp.c | 448 | src/transport/gnunet-communicator-tcp.c |
diff --git a/src/dhtu/Makefile.am b/src/dhtu/Makefile.am index 72b422812..f4b968526 100644 --- a/src/dhtu/Makefile.am +++ b/src/dhtu/Makefile.am | |||
@@ -11,6 +11,7 @@ if USE_COVERAGE | |||
11 | endif | 11 | endif |
12 | 12 | ||
13 | plugin_LTLIBRARIES = \ | 13 | plugin_LTLIBRARIES = \ |
14 | libgnunet_plugin_dhtu_gnunet.la \ | ||
14 | libgnunet_plugin_dhtu_ip.la | 15 | libgnunet_plugin_dhtu_ip.la |
15 | 16 | ||
16 | libgnunet_plugin_dhtu_ip_la_SOURCES = \ | 17 | libgnunet_plugin_dhtu_ip_la_SOURCES = \ |
@@ -22,3 +23,14 @@ libgnunet_plugin_dhtu_ip_la_LIBADD = \ | |||
22 | libgnunet_plugin_dhtu_ip_la_LDFLAGS = \ | 23 | libgnunet_plugin_dhtu_ip_la_LDFLAGS = \ |
23 | $(GN_PLUGIN_LDFLAGS) | 24 | $(GN_PLUGIN_LDFLAGS) |
24 | 25 | ||
26 | |||
27 | |||
28 | libgnunet_plugin_dhtu_gnunet_la_SOURCES = \ | ||
29 | plugin_dhtu_gnunet.c | ||
30 | libgnunet_plugin_dhtu_gnunet_la_LIBADD = \ | ||
31 | $(top_builddir)/src/core/libgnunetcore.la \ | ||
32 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
33 | $(XLIBS) \ | ||
34 | $(LTLIBINTL) | ||
35 | libgnunet_plugin_dhtu_gnunet_la_LDFLAGS = \ | ||
36 | $(GN_PLUGIN_LDFLAGS) | ||
diff --git a/src/dhtu/plugin_dhtu_gnunet.c b/src/dhtu/plugin_dhtu_gnunet.c index d6cd75242..ccd329e8e 100644 --- a/src/dhtu/plugin_dhtu_gnunet.c +++ b/src/dhtu/plugin_dhtu_gnunet.c | |||
@@ -21,11 +21,44 @@ | |||
21 | /** | 21 | /** |
22 | * @author Christian Grothoff | 22 | * @author Christian Grothoff |
23 | * | 23 | * |
24 | * @file plugin_dhtu_ip.c | 24 | * @file plugin_dhtu_gnunet.c |
25 | * @brief plain IP based DHT network underlay | 25 | * @brief plain IP based DHT network underlay |
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #incluce "gnunet_dhtu_plugin.h" | 28 | #include "gnunet_dhtu_plugin.h" |
29 | #include "gnunet_core_service.h" | ||
30 | |||
31 | /** | ||
32 | * Handle for a private key used by this underlay. | ||
33 | */ | ||
34 | struct GNUNET_DHTU_PrivateKey | ||
35 | { | ||
36 | /** | ||
37 | * GNUnet uses eddsa for peers. | ||
38 | */ | ||
39 | struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_priv; | ||
40 | |||
41 | }; | ||
42 | |||
43 | |||
44 | /** | ||
45 | * Handle for a public key used by this underlay. | ||
46 | */ | ||
47 | struct PublicKey | ||
48 | { | ||
49 | |||
50 | /** | ||
51 | * Header. | ||
52 | */ | ||
53 | struct GNUNET_DHTU_PublicKey header; | ||
54 | |||
55 | /** | ||
56 | * GNUnet uses eddsa for peers. | ||
57 | */ | ||
58 | struct GNUNET_CRYPTO_EddsaPublicKey eddsa_pub; | ||
59 | |||
60 | }; | ||
61 | |||
29 | 62 | ||
30 | /** | 63 | /** |
31 | * Opaque handle that the underlay offers for our address to be used when | 64 | * Opaque handle that the underlay offers for our address to be used when |
@@ -47,7 +80,7 @@ struct GNUNET_DHTU_Source | |||
47 | */ | 80 | */ |
48 | struct GNUNET_DHTU_Target | 81 | struct GNUNET_DHTU_Target |
49 | { | 82 | { |
50 | 83 | ||
51 | /** | 84 | /** |
52 | * Application context for this target. | 85 | * Application context for this target. |
53 | */ | 86 | */ |
@@ -94,23 +127,20 @@ struct GNUNET_DHTU_PreferenceHandle | |||
94 | 127 | ||
95 | 128 | ||
96 | /** | 129 | /** |
97 | * Opaque handle for a private key used by this underlay. | ||
98 | */ | ||
99 | struct GNUNET_DHTU_PrivateKey | ||
100 | { | ||
101 | /* we are IP, we do not do crypto */ | ||
102 | }; | ||
103 | |||
104 | |||
105 | /** | ||
106 | * Closure for all plugin functions. | 130 | * Closure for all plugin functions. |
107 | */ | 131 | */ |
108 | struct Plugin | 132 | struct Plugin |
109 | { | 133 | { |
110 | /** | 134 | /** |
111 | * Callbacks into the DHT. | 135 | * Callbacks into the DHT. |
112 | */ | 136 | */ |
113 | struct GNUNET_DHTU_PluginEnvironment *env; | 137 | struct GNUNET_DHTU_PluginEnvironment *env; |
138 | |||
139 | /** | ||
140 | * Handle to the CORE service. | ||
141 | */ | ||
142 | struct GNUNET_CORE_Handle *core; | ||
143 | |||
114 | }; | 144 | }; |
115 | 145 | ||
116 | 146 | ||
@@ -126,10 +156,17 @@ struct Plugin | |||
126 | static ssize_t | 156 | static ssize_t |
127 | ip_sign (void *cls, | 157 | ip_sign (void *cls, |
128 | const struct GNUNET_DHTU_PrivateKey *pk, | 158 | const struct GNUNET_DHTU_PrivateKey *pk, |
129 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 159 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
130 | void **sig) | 160 | void **sig) |
131 | { | 161 | { |
132 | return 0; | 162 | struct GNUNET_CRYPTO_EddsaSignature *es; |
163 | |||
164 | es = GNUNET_new (struct GNUNET_CRYPTO_EddsaSignature); | ||
165 | GNUNET_CRYPTO_eddsa_sign_ (&pk->eddsa_priv, | ||
166 | purpose, | ||
167 | es); | ||
168 | *sig = es; | ||
169 | return sizeof (*es); | ||
133 | } | 170 | } |
134 | 171 | ||
135 | 172 | ||
@@ -148,11 +185,31 @@ ip_sign (void *cls, | |||
148 | static enum GNUNET_GenericReturnValue | 185 | static enum GNUNET_GenericReturnValue |
149 | ip_verify (void *cls, | 186 | ip_verify (void *cls, |
150 | const struct GNUNET_DHTU_PublicKey *pk, | 187 | const struct GNUNET_DHTU_PublicKey *pk, |
151 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 188 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
152 | const void *sig, | 189 | const void *sig, |
153 | size_t sig_size) | 190 | size_t sig_size) |
154 | { | 191 | { |
155 | return GNUNET_NO; | 192 | const struct GNUNET_CRYPTO_EddsaSignature *es = sig; |
193 | const struct PublicKey *pub; | ||
194 | |||
195 | GNUNET_assert (sizeof (struct PublicKey) == | ||
196 | ntohs (pk->size)); | ||
197 | pub = (const struct PublicKey *) pk; | ||
198 | if (sizeof (*es) != sig_size) | ||
199 | { | ||
200 | GNUNET_break_op (0); | ||
201 | return GNUNET_SYSERR; | ||
202 | } | ||
203 | if (GNUNET_OK != | ||
204 | GNUNET_CRYPTO_eddsa_verify_ (ntohl (purpose->purpose), | ||
205 | purpose, | ||
206 | es, | ||
207 | &pub->eddsa_pub)) | ||
208 | { | ||
209 | GNUNET_break_op (0); | ||
210 | return GNUNET_SYSERR; | ||
211 | } | ||
212 | return GNUNET_OK; | ||
156 | } | 213 | } |
157 | 214 | ||
158 | 215 | ||
@@ -174,7 +231,7 @@ ip_try_connect (void *cls, | |||
174 | * Request underlay to keep the connection to @a target alive if possible. | 231 | * Request underlay to keep the connection to @a target alive if possible. |
175 | * Hold may be called multiple times to express a strong preference to | 232 | * Hold may be called multiple times to express a strong preference to |
176 | * keep a connection, say because a @a target is in multiple tables. | 233 | * keep a connection, say because a @a target is in multiple tables. |
177 | * | 234 | * |
178 | * @param cls closure | 235 | * @param cls closure |
179 | * @param target connection to keep alive | 236 | * @param target connection to keep alive |
180 | */ | 237 | */ |
@@ -196,7 +253,7 @@ ip_hold (void *cls, | |||
196 | 253 | ||
197 | /** | 254 | /** |
198 | * Do no long request underlay to keep the connection alive. | 255 | * Do no long request underlay to keep the connection alive. |
199 | * | 256 | * |
200 | * @param cls closure | 257 | * @param cls closure |
201 | * @param target connection to keep alive | 258 | * @param target connection to keep alive |
202 | */ | 259 | */ |
@@ -204,7 +261,7 @@ static void | |||
204 | ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) | 261 | ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) |
205 | { | 262 | { |
206 | struct GNUNET_DHTU_Target *target = ph->target; | 263 | struct GNUNET_DHTU_Target *target = ph->target; |
207 | 264 | ||
208 | GNUNET_CONTAINER_DLL_remove (target->ph_head, | 265 | GNUNET_CONTAINER_DLL_remove (target->ph_head, |
209 | target->ph_tail, | 266 | target->ph_tail, |
210 | ph); | 267 | ph); |
@@ -225,7 +282,7 @@ ip_drop (struct GNUNET_DHTU_PreferenceHandle *ph) | |||
225 | * @param msg_size number of bytes in @a msg | 282 | * @param msg_size number of bytes in @a msg |
226 | * @param finished_cb function called once transmission is done | 283 | * @param finished_cb function called once transmission is done |
227 | * (not called if @a target disconnects, then only the | 284 | * (not called if @a target disconnects, then only the |
228 | * disconnect_cb is called). | 285 | * disconnect_cb is called). |
229 | * @param finished_cb_cls closure for @a finished_cb | 286 | * @param finished_cb_cls closure for @a finished_cb |
230 | */ | 287 | */ |
231 | static void | 288 | static void |
@@ -240,6 +297,60 @@ ip_send (void *cls, | |||
240 | } | 297 | } |
241 | 298 | ||
242 | 299 | ||
300 | |||
301 | /** | ||
302 | * Method called whenever a given peer connects. | ||
303 | * | ||
304 | * @param cls closure | ||
305 | * @param peer peer identity this notification is about | ||
306 | * @return closure associated with @a peer. given to mq callbacks and | ||
307 | * #GNUNET_CORE_DisconnectEventHandler | ||
308 | */ | ||
309 | static void * | ||
310 | core_connect_cb (void *cls, | ||
311 | const struct GNUNET_PeerIdentity *peer, | ||
312 | struct GNUNET_MQ_Handle *mq) | ||
313 | { | ||
314 | return NULL; | ||
315 | } | ||
316 | |||
317 | |||
318 | /** | ||
319 | * Method called whenever a peer disconnects. | ||
320 | * | ||
321 | * @param cls closure | ||
322 | * @param peer peer identity this notification is about | ||
323 | * @param peer_cls closure associated with peer. given in | ||
324 | * #GNUNET_CORE_ConnectEventHandler | ||
325 | */ | ||
326 | static void | ||
327 | core_disconnect_cb (void *cls, | ||
328 | const struct GNUNET_PeerIdentity *peer, | ||
329 | void *peer_cls) | ||
330 | { | ||
331 | } | ||
332 | |||
333 | |||
334 | /** | ||
335 | * Function called after #GNUNET_CORE_connect has succeeded (or failed | ||
336 | * for good). Note that the private key of the peer is intentionally | ||
337 | * not exposed here; if you need it, your process should try to read | ||
338 | * the private key file directly (which should work if you are | ||
339 | * authorized...). Implementations of this function must not call | ||
340 | * #GNUNET_CORE_disconnect (other than by scheduling a new task to | ||
341 | * do this later). | ||
342 | * | ||
343 | * @param cls closure | ||
344 | * @param my_identity ID of this peer, NULL if we failed | ||
345 | */ | ||
346 | static void | ||
347 | core_init_cb (void *cls, | ||
348 | const struct GNUNET_PeerIdentity *my_identity) | ||
349 | { | ||
350 | struct Plugin *plugin = cls; | ||
351 | } | ||
352 | |||
353 | |||
243 | /** | 354 | /** |
244 | * Entry point for the plugin. | 355 | * Entry point for the plugin. |
245 | * | 356 | * |
@@ -252,6 +363,9 @@ libgnunet_plugin_dhtu_ip_init (void *cls) | |||
252 | struct GNUNET_DHTU_PluginEnvironment *env = cls; | 363 | struct GNUNET_DHTU_PluginEnvironment *env = cls; |
253 | struct GNUNET_DHTU_PluginFunctions *api; | 364 | struct GNUNET_DHTU_PluginFunctions *api; |
254 | struct Plugin *plugin; | 365 | struct Plugin *plugin; |
366 | struct GNUNET_MQ_MessageHandler handlers[] = { | ||
367 | GNUNET_MQ_handler_end () | ||
368 | }; | ||
255 | 369 | ||
256 | plugin = GNUNET_new (struct Plugin); | 370 | plugin = GNUNET_new (struct Plugin); |
257 | plugin->env = env; | 371 | plugin->env = env; |
@@ -263,6 +377,12 @@ libgnunet_plugin_dhtu_ip_init (void *cls) | |||
263 | api->hold = &ip_hold; | 377 | api->hold = &ip_hold; |
264 | api->drop = &ip_drop; | 378 | api->drop = &ip_drop; |
265 | api->send = &ip_send; | 379 | api->send = &ip_send; |
380 | plugin->core = GNUNET_CORE_connect (env->cfg, | ||
381 | plugin, | ||
382 | &core_init_cb, | ||
383 | &core_connect_cb, | ||
384 | &core_disconnect_cb, | ||
385 | handlers); | ||
266 | return api; | 386 | return api; |
267 | } | 387 | } |
268 | 388 | ||
@@ -279,6 +399,7 @@ libgnunet_plugin_dhtu_gnunet_done (void *cls) | |||
279 | struct GNUNET_DHTU_PluginFunctions *api = cls; | 399 | struct GNUNET_DHTU_PluginFunctions *api = cls; |
280 | struct Plugin *plugin = api->cls; | 400 | struct Plugin *plugin = api->cls; |
281 | 401 | ||
402 | GNUNET_CORE_disconnect (plugin->core); | ||
282 | GNUNET_free (plugin); | 403 | GNUNET_free (plugin); |
283 | GNUNET_free (api); | 404 | GNUNET_free (api); |
284 | return NULL; | 405 | return NULL; |
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 | |||
240 | static ssize_t | 240 | static ssize_t |
241 | ip_sign (void *cls, | 241 | ip_sign (void *cls, |
242 | const struct GNUNET_DHTU_PrivateKey *pk, | 242 | const struct GNUNET_DHTU_PrivateKey *pk, |
243 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 243 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
244 | void **sig) | 244 | void **sig) |
245 | { | 245 | { |
246 | return 0; | 246 | return 0; |
@@ -262,7 +262,7 @@ ip_sign (void *cls, | |||
262 | static enum GNUNET_GenericReturnValue | 262 | static enum GNUNET_GenericReturnValue |
263 | ip_verify (void *cls, | 263 | ip_verify (void *cls, |
264 | const struct GNUNET_DHTU_PublicKey *pk, | 264 | const struct GNUNET_DHTU_PublicKey *pk, |
265 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 265 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
266 | const void *sig, | 266 | const void *sig, |
267 | size_t sig_size) | 267 | size_t sig_size) |
268 | { | 268 | { |
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 | |||
151 | */ | 151 | */ |
152 | 152 | ||
153 | #if __BYTE_ORDER == __LITTLE_ENDIAN | 153 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
154 | #if defined(__linux__) | 154 | #ifdef HAVE_BYTESWAP_H |
155 | #define BYTE_SWAP_16(x) __bswap_16 (x) | 155 | #define BYTE_SWAP_16(x) bswap_16 (x) |
156 | #define BYTE_SWAP_32(x) __bswap_32 (x) | 156 | #define BYTE_SWAP_32(x) bswap_32 (x) |
157 | #define BYTE_SWAP_64(x) __bswap_64 (x) | 157 | #define BYTE_SWAP_64(x) bswap_64 (x) |
158 | #else | 158 | #else |
159 | #define BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) | 159 | #define BYTE_SWAP_16(x) ((((x) & 0x00ff) << 8) | (((x) & 0xff00) >> 8)) |
160 | 160 | ||
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 | |||
75 | 75 | ||
76 | /* followed by size-2 bytes of the actual public key */ | 76 | /* followed by size-2 bytes of the actual public key */ |
77 | }; | 77 | }; |
78 | 78 | ||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Hash used by the DHT for keys and peers. | 81 | * Hash used by the DHT for keys and peers. |
82 | */ | 82 | */ |
83 | struct GNUNET_DHTU_Hash | 83 | struct GNUNET_DHTU_Hash |
84 | { | 84 | { |
85 | |||
86 | /** | ||
87 | * For now, use a 512 bit hash. (To be discussed). | ||
88 | */ | ||
89 | struct GNUNET_HashCode hc; | ||
90 | }; | ||
91 | |||
92 | 85 | ||
93 | /** | ||
94 | * @brief header of what an DHTU signature signs | ||
95 | * this must be followed by "size - 8" bytes of | ||
96 | * the actual signed data | ||
97 | */ | ||
98 | struct GNUNET_DHTU_SignaturePurpose | ||
99 | { | ||
100 | /** | 86 | /** |
101 | * How many bytes does this signature sign? | 87 | * For now, use a 512 bit hash. (To be discussed). |
102 | * (including this purpose header); in network | ||
103 | * byte order (!). | ||
104 | */ | ||
105 | uint32_t size GNUNET_PACKED; | ||
106 | |||
107 | /** | ||
108 | * What does this signature vouch for? This | ||
109 | * must contain a GNUNET_SIGNATURE_PURPOSE_XXX | ||
110 | * constant (from gnunet_signatures.h). In | ||
111 | * network byte order! | ||
112 | */ | 88 | */ |
113 | uint32_t purpose GNUNET_PACKED; | 89 | struct GNUNET_HashCode hc; |
114 | }; | 90 | }; |
115 | 91 | ||
116 | 92 | ||
@@ -131,7 +107,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
131 | */ | 107 | */ |
132 | void *cls; | 108 | void *cls; |
133 | 109 | ||
134 | /** | 110 | /** |
135 | * Function to call with new addresses of this peer. | 111 | * Function to call with new addresses of this peer. |
136 | * | 112 | * |
137 | * @param cls the closure | 113 | * @param cls the closure |
@@ -151,7 +127,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
151 | struct GNUNET_DHTU_Source *source, | 127 | struct GNUNET_DHTU_Source *source, |
152 | void **ctx); | 128 | void **ctx); |
153 | 129 | ||
154 | /** | 130 | /** |
155 | * Function to call with expired addresses of this peer. | 131 | * Function to call with expired addresses of this peer. |
156 | * | 132 | * |
157 | * @param[in] ctx storage space used by the DHT in association with this address | 133 | * @param[in] ctx storage space used by the DHT in association with this address |
@@ -160,7 +136,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
160 | (*address_del_cb)(void *ctx); | 136 | (*address_del_cb)(void *ctx); |
161 | 137 | ||
162 | /** | 138 | /** |
163 | * We have a new estimate on the size of the underlay. | 139 | * We have a new estimate on the size of the underlay. |
164 | * | 140 | * |
165 | * @param cls closure | 141 | * @param cls closure |
166 | * @param timestamp time when the estimate was received from the server (or created by the server) | 142 | * @param timestamp time when the estimate was received from the server (or created by the server) |
@@ -172,7 +148,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
172 | struct GNUNET_TIME_Absolute timestamp, | 148 | struct GNUNET_TIME_Absolute timestamp, |
173 | double logestimate, | 149 | double logestimate, |
174 | double std_dev); | 150 | double std_dev); |
175 | 151 | ||
176 | /** | 152 | /** |
177 | * Function to call when we connect to a peer and can henceforth transmit to | 153 | * Function to call when we connect to a peer and can henceforth transmit to |
178 | * that peer. | 154 | * that peer. |
@@ -208,7 +184,7 @@ struct GNUNET_DHTU_PluginEnvironment | |||
208 | * @param cls the closure | 184 | * @param cls the closure |
209 | * @param origin where the message originated from | 185 | * @param origin where the message originated from |
210 | * @param[in,out] tctx ctx of target address where we received the message from | 186 | * @param[in,out] tctx ctx of target address where we received the message from |
211 | * @param[in,out] sctx ctx of our own source address at which we received the message | 187 | * @param[in,out] sctx ctx of our own source address at which we received the message |
212 | * @param message the message we received @param message_size number of | 188 | * @param message the message we received @param message_size number of |
213 | * bytes in @a message | 189 | * bytes in @a message |
214 | */ | 190 | */ |
@@ -244,7 +220,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
244 | ssize_t | 220 | ssize_t |
245 | (*sign)(void *cls, | 221 | (*sign)(void *cls, |
246 | const struct GNUNET_DHTU_PrivateKey *pk, | 222 | const struct GNUNET_DHTU_PrivateKey *pk, |
247 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 223 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
248 | void **sig); | 224 | void **sig); |
249 | 225 | ||
250 | /** | 226 | /** |
@@ -262,7 +238,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
262 | enum GNUNET_GenericReturnValue | 238 | enum GNUNET_GenericReturnValue |
263 | (*verify)(void *cls, | 239 | (*verify)(void *cls, |
264 | const struct GNUNET_DHTU_PublicKey *pk, | 240 | const struct GNUNET_DHTU_PublicKey *pk, |
265 | const struct GNUNET_DHTU_SignaturePurpose *purpose, | 241 | const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, |
266 | const void *sig, | 242 | const void *sig, |
267 | size_t sig_size); | 243 | size_t sig_size); |
268 | 244 | ||
@@ -281,7 +257,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
281 | * Request underlay to keep the connection to @a target alive if possible. | 257 | * Request underlay to keep the connection to @a target alive if possible. |
282 | * Hold may be called multiple times to express a strong preference to | 258 | * Hold may be called multiple times to express a strong preference to |
283 | * keep a connection, say because a @a target is in multiple tables. | 259 | * keep a connection, say because a @a target is in multiple tables. |
284 | * | 260 | * |
285 | * @param cls closure | 261 | * @param cls closure |
286 | * @param target connection to keep alive | 262 | * @param target connection to keep alive |
287 | */ | 263 | */ |
@@ -291,13 +267,13 @@ struct GNUNET_DHTU_PluginFunctions | |||
291 | 267 | ||
292 | /** | 268 | /** |
293 | * Do no long request underlay to keep the connection alive. | 269 | * Do no long request underlay to keep the connection alive. |
294 | * | 270 | * |
295 | * @param cls closure | 271 | * @param cls closure |
296 | * @param target connection to keep alive | 272 | * @param target connection to keep alive |
297 | */ | 273 | */ |
298 | void | 274 | void |
299 | (*drop)(struct GNUNET_DHTU_PreferenceHandle *ph); | 275 | (*drop)(struct GNUNET_DHTU_PreferenceHandle *ph); |
300 | 276 | ||
301 | /** | 277 | /** |
302 | * Send message to some other participant over the network. Note that | 278 | * Send message to some other participant over the network. Note that |
303 | * sending is not guaranteeing that the other peer actually received the | 279 | * sending is not guaranteeing that the other peer actually received the |
@@ -310,7 +286,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
310 | * @param msg_size number of bytes in @a msg | 286 | * @param msg_size number of bytes in @a msg |
311 | * @param finished_cb function called once transmission is done | 287 | * @param finished_cb function called once transmission is done |
312 | * (not called if @a target disconnects, then only the | 288 | * (not called if @a target disconnects, then only the |
313 | * disconnect_cb is called). | 289 | * disconnect_cb is called). |
314 | * @param finished_cb_cls closure for @a finished_cb | 290 | * @param finished_cb_cls closure for @a finished_cb |
315 | */ | 291 | */ |
316 | void | 292 | void |
@@ -320,7 +296,7 @@ struct GNUNET_DHTU_PluginFunctions | |||
320 | size_t msg_size, | 296 | size_t msg_size, |
321 | GNUNET_SCHEDULER_TaskCallback finished_cb, | 297 | GNUNET_SCHEDULER_TaskCallback finished_cb, |
322 | void *finished_cb_cls); | 298 | void *finished_cb_cls); |
323 | 299 | ||
324 | }; | 300 | }; |
325 | 301 | ||
326 | 302 | ||
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, | |||
268 | * @return number of bytes written or 0, #GNUNET_SYSERR to signal the | 268 | * @return number of bytes written or 0, #GNUNET_SYSERR to signal the |
269 | * end of the iteration. | 269 | * end of the iteration. |
270 | */ | 270 | */ |
271 | typedef ssize_t (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, | 271 | typedef ssize_t |
272 | size_t max, | 272 | (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, |
273 | void *buf); | 273 | size_t max, |
274 | void *buf); | ||
274 | 275 | ||
275 | 276 | ||
276 | /** | 277 | /** |
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) ( | |||
331 | * @param msg the message to send | 331 | * @param msg the message to send |
332 | * @param impl_state state of the implementation | 332 | * @param impl_state state of the implementation |
333 | */ | 333 | */ |
334 | typedef void (*GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, | 334 | typedef void |
335 | const struct GNUNET_MessageHeader *msg, | 335 | (*GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, |
336 | void *impl_state); | 336 | const struct GNUNET_MessageHeader *msg, |
337 | void *impl_state); | ||
337 | 338 | ||
338 | 339 | ||
339 | /** | 340 | /** |
@@ -345,8 +346,9 @@ typedef void (*GNUNET_MQ_SendImpl) (struct GNUNET_MQ_Handle *mq, | |||
345 | * @param mq the message queue to destroy | 346 | * @param mq the message queue to destroy |
346 | * @param impl_state state of the implementation | 347 | * @param impl_state state of the implementation |
347 | */ | 348 | */ |
348 | typedef void (*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, | 349 | typedef void |
349 | void *impl_state); | 350 | (*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, |
351 | void *impl_state); | ||
350 | 352 | ||
351 | 353 | ||
352 | /** | 354 | /** |
@@ -355,8 +357,9 @@ typedef void (*GNUNET_MQ_DestroyImpl) (struct GNUNET_MQ_Handle *mq, | |||
355 | * @param mq message queue | 357 | * @param mq message queue |
356 | * @param impl_state state specific to the implementation | 358 | * @param impl_state state specific to the implementation |
357 | */ | 359 | */ |
358 | typedef void (*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, | 360 | typedef void |
359 | void *impl_state); | 361 | (*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, |
362 | void *impl_state); | ||
360 | 363 | ||
361 | 364 | ||
362 | /** | 365 | /** |
@@ -368,7 +371,9 @@ typedef void (*GNUNET_MQ_CancelImpl) (struct GNUNET_MQ_Handle *mq, | |||
368 | * @param cls closure | 371 | * @param cls closure |
369 | * @param error error code | 372 | * @param error error code |
370 | */ | 373 | */ |
371 | typedef void (*GNUNET_MQ_ErrorHandler) (void *cls, enum GNUNET_MQ_Error error); | 374 | typedef void |
375 | (*GNUNET_MQ_ErrorHandler) (void *cls, | ||
376 | enum GNUNET_MQ_Error error); | ||
372 | 377 | ||
373 | 378 | ||
374 | /** | 379 | /** |
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; | |||
115 | * if #GNUNET_NO: address was invalid (or not supported) | 115 | * if #GNUNET_NO: address was invalid (or not supported) |
116 | * if #GNUNET_SYSERR: communication error (IPC error) | 116 | * if #GNUNET_SYSERR: communication error (IPC error) |
117 | */ | 117 | */ |
118 | typedef void (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls, | 118 | typedef void |
119 | (*GNUNET_TRANSPORT_AddressToStringCallback) (void *cls, | ||
119 | const char *address, | 120 | const char *address, |
120 | int res); | 121 | int res); |
121 | 122 | ||
@@ -326,7 +327,8 @@ struct GNUNET_TRANSPORT_PeerMonitoringContext; | |||
326 | * @param state current state this peer is in | 327 | * @param state current state this peer is in |
327 | * @param state_timeout timeout for the current state of the peer | 328 | * @param state_timeout timeout for the current state of the peer |
328 | */ | 329 | */ |
329 | typedef void (*GNUNET_TRANSPORT_PeerIterateCallback) ( | 330 | typedef void |
331 | (*GNUNET_TRANSPORT_PeerIterateCallback) ( | ||
330 | void *cls, | 332 | void *cls, |
331 | const struct GNUNET_PeerIdentity *peer, | 333 | const struct GNUNET_PeerIdentity *peer, |
332 | const struct GNUNET_HELLO_Address *address, | 334 | const struct GNUNET_HELLO_Address *address, |
@@ -394,7 +396,8 @@ struct GNUNET_TRANSPORT_Blacklist; | |||
394 | * @param pid peer to approve or disapproave | 396 | * @param pid peer to approve or disapproave |
395 | * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not | 397 | * @return #GNUNET_OK if the connection is allowed, #GNUNET_SYSERR if not |
396 | */ | 398 | */ |
397 | typedef int (*GNUNET_TRANSPORT_BlacklistCallback) ( | 399 | typedef int |
400 | (*GNUNET_TRANSPORT_BlacklistCallback) ( | ||
398 | void *cls, | 401 | void *cls, |
399 | const struct GNUNET_PeerIdentity *pid); | 402 | const struct GNUNET_PeerIdentity *pid); |
400 | 403 | ||
@@ -541,7 +544,8 @@ struct GNUNET_TRANSPORT_SessionInfo | |||
541 | * NULL with @a session being non-NULL if the monitor | 544 | * NULL with @a session being non-NULL if the monitor |
542 | * was being cancelled while sessions were active | 545 | * was being cancelled while sessions were active |
543 | */ | 546 | */ |
544 | typedef void (*GNUNET_TRANSPORT_SessionMonitorCallback) ( | 547 | typedef void |
548 | (*GNUNET_TRANSPORT_SessionMonitorCallback) ( | ||
545 | void *cls, | 549 | void *cls, |
546 | struct GNUNET_TRANSPORT_PluginSession *session, | 550 | struct GNUNET_TRANSPORT_PluginSession *session, |
547 | void **session_ctx, | 551 | void **session_ctx, |
@@ -593,7 +597,8 @@ struct GNUNET_TRANSPORT_CoreHandle; | |||
593 | * @param mq message queue to use to transmit to @a peer | 597 | * @param mq message queue to use to transmit to @a peer |
594 | * @return closure to use in MQ handlers | 598 | * @return closure to use in MQ handlers |
595 | */ | 599 | */ |
596 | typedef void *(*GNUNET_TRANSPORT_NotifyConnect) ( | 600 | typedef void * |
601 | (*GNUNET_TRANSPORT_NotifyConnect) ( | ||
597 | void *cls, | 602 | void *cls, |
598 | const struct GNUNET_PeerIdentity *peer, | 603 | const struct GNUNET_PeerIdentity *peer, |
599 | struct GNUNET_MQ_Handle *mq); | 604 | struct GNUNET_MQ_Handle *mq); |
@@ -610,7 +615,8 @@ typedef void *(*GNUNET_TRANSPORT_NotifyConnect) ( | |||
610 | * @param handlers_cls closure of the handlers, was returned from the | 615 | * @param handlers_cls closure of the handlers, was returned from the |
611 | * connect notification callback | 616 | * connect notification callback |
612 | */ | 617 | */ |
613 | typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) ( | 618 | typedef void |
619 | (*GNUNET_TRANSPORT_NotifyDisconnect) ( | ||
614 | void *cls, | 620 | void *cls, |
615 | const struct GNUNET_PeerIdentity *peer, | 621 | const struct GNUNET_PeerIdentity *peer, |
616 | void *handler_cls); | 622 | void *handler_cls); |
@@ -632,7 +638,8 @@ typedef void (*GNUNET_TRANSPORT_NotifyDisconnect) ( | |||
632 | * @param handlers_cls closure of the handlers, was returned from the | 638 | * @param handlers_cls closure of the handlers, was returned from the |
633 | * connect notification callback | 639 | * connect notification callback |
634 | */ | 640 | */ |
635 | typedef void (*GNUNET_TRANSPORT_NotifyExcessBandwidth) ( | 641 | typedef void |
642 | (*GNUNET_TRANSPORT_NotifyExcessBandwidth) ( | ||
636 | void *cls, | 643 | void *cls, |
637 | const struct GNUNET_PeerIdentity *neighbour, | 644 | const struct GNUNET_PeerIdentity *neighbour, |
638 | void *handlers_cls); | 645 | void *handlers_cls); |
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 @@ | |||
21 | /** | 21 | /** |
22 | * @file transport/test_transport_port_forward.c | 22 | * @file transport/test_transport_port_forward.c |
23 | * @brief Test case executing a script which sends a test UDP message from a nated peer | 23 | * @brief Test case executing a script which sends a test UDP message from a nated peer |
24 | * to a gloabl known peer. There is a tcp port forwarding in place towards the | 24 | * to a global known peer. There is a tcp port forwarding in place towards the |
25 | * natted peer to test the backchannel functionality of the TNG service. | 25 | * natted peer to test the backchannel functionality of the TNG service. |
26 | * @author t3sserakt | 26 | * @author t3sserakt |
27 | */ | 27 | */ |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 797de0b0d..2ca78577e 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -36,6 +36,25 @@ static char *backend_check; | |||
36 | 36 | ||
37 | 37 | ||
38 | /** | 38 | /** |
39 | * If printing the value of CFLAGS has been requested. | ||
40 | */ | ||
41 | static int cflags; | ||
42 | |||
43 | |||
44 | /** | ||
45 | * If printing the value of LIBS has been requested. | ||
46 | */ | ||
47 | static int libs; | ||
48 | |||
49 | |||
50 | /** | ||
51 | * If printing the value of PREFIX has been requested. | ||
52 | */ | ||
53 | static int prefix; | ||
54 | |||
55 | |||
56 | /** | ||
57 | * Print each option in a given section. | ||
39 | * Main task to run to perform operations typical for | 58 | * Main task to run to perform operations typical for |
40 | * gnunet-config as per the configuration settings | 59 | * gnunet-config as per the configuration settings |
41 | * given in @a cls. | 60 | * given in @a cls. |
@@ -54,6 +73,28 @@ run (void *cls, | |||
54 | { | 73 | { |
55 | struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls; | 74 | struct GNUNET_CONFIGURATION_ConfigSettings *cs = cls; |
56 | 75 | ||
76 | if (1 == cflags || 1 == libs || 1 == prefix) | ||
77 | { | ||
78 | char *prefixdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_PREFIX); | ||
79 | char *libdir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR); | ||
80 | |||
81 | if (1 == cflags) | ||
82 | { | ||
83 | fprintf (stdout, "-I%sinclude\n", prefixdir); | ||
84 | } | ||
85 | if (1 == libs) | ||
86 | { | ||
87 | fprintf (stdout, "-L%s -lgnunetutil\n", libdir); | ||
88 | } | ||
89 | if (1 == prefix) | ||
90 | { | ||
91 | fprintf (stdout, "%s\n", prefixdir); | ||
92 | } | ||
93 | cs->global_ret = 0; | ||
94 | GNUNET_free (prefixdir); | ||
95 | GNUNET_free (libdir); | ||
96 | return; | ||
97 | } | ||
57 | if (NULL != backend_check) | 98 | if (NULL != backend_check) |
58 | { | 99 | { |
59 | char *name; | 100 | char *name; |
@@ -97,6 +138,24 @@ main (int argc, | |||
97 | gettext_noop ( | 138 | gettext_noop ( |
98 | "test if the current installation supports the specified BACKEND"), | 139 | "test if the current installation supports the specified BACKEND"), |
99 | &backend_check)), | 140 | &backend_check)), |
141 | GNUNET_GETOPT_option_flag ( | ||
142 | 'C', | ||
143 | "cflags", | ||
144 | gettext_noop ( | ||
145 | "Provide an appropriate value for CFLAGS to applications building on top of GNUnet"), | ||
146 | &cflags), | ||
147 | GNUNET_GETOPT_option_flag ( | ||
148 | 'j', | ||
149 | "libs", | ||
150 | gettext_noop ( | ||
151 | "Provide an appropriate value for LIBS to applications building on top of GNUnet"), | ||
152 | &libs), | ||
153 | GNUNET_GETOPT_option_flag ( | ||
154 | 'p', | ||
155 | "prefix", | ||
156 | gettext_noop ( | ||
157 | "Provide the path under which GNUnet was installed"), | ||
158 | &prefix), | ||
100 | GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), | 159 | GNUNET_CONFIGURATION_CONFIG_OPTIONS (&cs), |
101 | GNUNET_GETOPT_OPTION_END | 160 | GNUNET_GETOPT_OPTION_END |
102 | }; | 161 | }; |